clang

compiling gpsim on macOS causes “error: 'long long type-name' is invalid”

旧时模样 提交于 2021-01-29 20:11:26
问题 Following this question, I'm trying to compile this code on macOS. I ran /System/Volumes/Data/usr/local/Cellar/qt/5.14.1/bin/qmake inside the build_XX folder successfully, and then make . However, I get the compiling error: ../src/gpsim/protocol.cc:79:8: error: 'long long type-name' is invalid uint long long i = ascii2uint64(buffer, digits); ^ 1 error generated. make: *** [build/release/protocol.o] Error 1 as suggested here, I added #ifdef __APPLE__ #include <sys/types.h> #endif // __APPLE__

“Failed to run llvm optimizations” using clang++ for webassmebly

南笙酒味 提交于 2021-01-29 17:31:25
问题 I've installed emscripten-1.38.27 1 and fastcomp-clang-e1.38.27-64bit via the official emsdk tool. After running qmake and gettting no errors nor warnings,I ran make for my Qt project and that resulted in this(with EMCC_DEBUG=1 ): shared:DEBUG: executed emsdk-master/fastcomp-clang/e1.38.27_64bit/clang++ -target asmjs- unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=38 -D__EMSCRIPTEN_tiny__=27 -D_LIBCPP_ABI_VERSION=2 -Werror=implicit-function-declaration -nostdinc -Xclang

compiling gpsim on macOS causes “error: 'long long type-name' is invalid”

给你一囗甜甜゛ 提交于 2021-01-29 16:09:56
问题 Following this question, I'm trying to compile this code on macOS. I ran /System/Volumes/Data/usr/local/Cellar/qt/5.14.1/bin/qmake inside the build_XX folder successfully, and then make . However, I get the compiling error: ../src/gpsim/protocol.cc:79:8: error: 'long long type-name' is invalid uint long long i = ascii2uint64(buffer, digits); ^ 1 error generated. make: *** [build/release/protocol.o] Error 1 as suggested here, I added #ifdef __APPLE__ #include <sys/types.h> #endif // __APPLE__

Generating IR from clang using classes

时间秒杀一切 提交于 2021-01-29 10:00:39
问题 I am trying to generate LLVM IR using clang classes I am pretty new at this and so far I've used this code as a reference which is in turn copied from Method to create LLVM IR The above link is pretty old and I did change my code here and there according to the new signatures #include <clang/CodeGen/CodeGenAction.h> #include <clang/Frontend/CompilerInstance.h> #include <clang/Frontend/CompilerInvocation.h> #include <clang/Basic/DiagnosticOptions.h> #include <clang/Frontend

Compiler error with filesystem library: clang and g++

泪湿孤枕 提交于 2021-01-29 07:20:45
问题 I am writing a personal project in c++ which needs to access to files in some directories, hence I decided to use the filesystem library. I encountered some problems when I try to compile my project on MacOS and on Linux. The code snippet is the following #include <iostream> #include <fstream> int main(){ std::string path = "Inner"; std::cout << "Files in " << path << " directory :" << std::endl; for (const auto & entry : std::filesystem::directory_iterator(path)) std::cout << entry.path() <<

Trying to understand clang/gcc __builtin_memset on constant size / aligned pointers

喜你入骨 提交于 2021-01-28 22:06:33
问题 Basically I am trying to understand why both gcc/clang use xmm register for their __builtin_memset even when the memory destination and size are both divisible by sizeof ymm (or zmm for that matter) and the CPU supports AVX2 / AVX512 . and why GCC implements __builtin_memset on medium sized values without any SIMD (again assuming CPU supports SIMD). For example: __builtin_memset(__builtin_assume_aligned(ptr, 64), -1, 64)); Will compile to: vpcmpeqd %xmm0, %xmm0, %xmm0 vmovdqa %xmm0, (%rdi)

clang-format main include sorting with folders prefix

淺唱寂寞╮ 提交于 2021-01-28 13:34:58
问题 I am trying to get clang-format to recognize the main include for foo.cpp in the following setup: project/my_lib ├── CMakeLists.txt ├── include │ └── project │ └── my_lib │ └── foo.hpp ├── src │ └── foo.cpp └── tests └── foo_test.cpp And foo.cpp has the following content: #include <project/another_lib/bar.hpp> #include <project/my_lib/foo.hpp> #include <vector> // ... The problem I think I have identified is the following: clang tries to identify the 'main' include based on the file name, in

clang-format main include sorting with folders prefix

一曲冷凌霜 提交于 2021-01-28 13:34:43
问题 I am trying to get clang-format to recognize the main include for foo.cpp in the following setup: project/my_lib ├── CMakeLists.txt ├── include │ └── project │ └── my_lib │ └── foo.hpp ├── src │ └── foo.cpp └── tests └── foo_test.cpp And foo.cpp has the following content: #include <project/another_lib/bar.hpp> #include <project/my_lib/foo.hpp> #include <vector> // ... The problem I think I have identified is the following: clang tries to identify the 'main' include based on the file name, in

LTO causes crash in standard library

北战南征 提交于 2021-01-28 07:54:17
问题 Consider the following program: #include <iostream> #include <string> int main() { std::string s; std::getline(std::cin, s); return 0; } I try to build it with various flags and run as echo foo | ./prog . If I build it with clang 5.0 or gcc 7.1 (or 7.2) with optimization from -O0 to -O3 , it works as expected. But if I add -flto to any of these configurations, it crashes immediately with the following backtrace: /lib64/libc.so.6(+0x721af)[0x7f596b08e1af] /lib64/libc.so.6(+0x77706)

Building a simple C++ project on Windows, using CMake and clang

…衆ロ難τιáo~ 提交于 2021-01-28 04:51:19
问题 I'm trying to get a simple 'Hello World' program to build on Windows 10, preferably using CMake and clang. I can successfully compile, link and run the same project if I use the g++ compiler from MinGW, but have problems when I try using clang++. I have CMake, MinGW and LLVM already installed and accessible in my path: clang++ clang++: error: no input files cmake --version cmake version 3.16.0-rc1 I have set up environment variables for CMake to use clang: echo %CC% C:\Program Files\LLVM\bin