llvm-clang

Gcc - why are lambdas not stripped during release build

梦想的初衷 提交于 2021-02-08 03:59:28
问题 I'm creating a .component bundle on MacOSX with xCode 7. I'm trying to get rid of all debugging symbols and library symbols for release configuration. I set all suitable options in xCode (like Strip Debug Symbols , Strip style to all symbols , symbols hidden by default etc.) Unfortunately there are still some symbols visible in compiled and linked component file. So I use strip -x -S mybundle.component to remove them externally. And it almost work but not for lambdas callers. If any of method

C++ code segfaults when compiled -O with Apple's LLVM compiler, but not with g++ -7.2.0

我的未来我决定 提交于 2021-02-06 10:20:10
问题 Update: I've created an even more M, but still CVE that reproduces the crash. Summary: removed all use of the Bool* bools_ field in Base class (but it still must be defined or the crash does not happen). Also removed Base::Initialize() and the virtual method Rule from Base and its descendants. New MCVE is attached. I've managed to create an MCVE for this code and posted it below. Some descriptive details: the code uses virtual base and derived classes, and certain derived classes that are

Clang AST Interpretation

独自空忆成欢 提交于 2021-02-05 09:28:16
问题 I am trying to interpret parts of the Clang AST you can see in the picture below. In short I am trying to do is to check if two variables are the same at different program points. After inspecting the AST, I noticed that the only commonality between the AST sections are the sections circled in blue. Can anyone help me as to what these hex numbers correspond to in the AST? I understand that the first block corresponds to a Variable Declaration and the second block corresponds to a Expression.

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

CMakeList file to generate LLVM bitcode file from C source file

喜欢而已 提交于 2021-01-27 16:55:03
问题 I am trying to generate LLVM bytecode file from a C source file (hello.c) using CMake. And below is my CMakeLists file. ###### CMakelists.txt ############ cmake_minimum_required(VERSION 2.8.9) set(CMAKE_C_COMPILER "clang") set(CMAKE_C_FLAGS "-emit-llvm") project (hello) add_executable(hello hello.c) I am new to CMake and not sure if this is the right way. I could not find any rules to make *.bc in the generated MakeFile . Please correct me here. I also tried "-save-temps" Considering this for

CMakeList file to generate LLVM bitcode file from C source file

谁说我不能喝 提交于 2021-01-27 16:47:13
问题 I am trying to generate LLVM bytecode file from a C source file (hello.c) using CMake. And below is my CMakeLists file. ###### CMakelists.txt ############ cmake_minimum_required(VERSION 2.8.9) set(CMAKE_C_COMPILER "clang") set(CMAKE_C_FLAGS "-emit-llvm") project (hello) add_executable(hello hello.c) I am new to CMake and not sure if this is the right way. I could not find any rules to make *.bc in the generated MakeFile . Please correct me here. I also tried "-save-temps" Considering this for

Cannot cross-compiling code using clang++

一个人想着一个人 提交于 2020-12-15 05:01:47
问题 Command: I am trying to cross compile a simple C++ program using clang++. I'm using Linaro gcc tool-chain to obtain the library and other includes required. ${root}/bin/clang++ --target=arm-linux-gnueabihf --rtlib=compiler-rt --stdlib=libc++ -nostdinc++ -I${root}/include/c++/v1 -Wl,-L${root}/lib --sysroot ${sysroot} --gcc-toolchain=/home/user/Tejas/LLVM/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf -rpath ${root}/lib TestCodeX86toARM.cpp -o Test -v The value of root and sysroot is as

Setting path to Clang library in CMake

夙愿已清 提交于 2020-08-26 07:41:57
问题 I build llvm from git and want to use the libraries in a project, especially the libclang. The "makefiles" are generated by means of CMake and for the LLVM part I found the setting LLVM_DIR to reroute the path for the llvm libraries, but for Clang I cannot find such a variable and I still see in my link line (it is a Cygwin system): /usr/lib/libclang.dll.a /usr/lib/libclangTooling.dll.a . Question: which environment variable do I set to get the right build Clang libraries? 回答1: The variable

How do I specify a clang-format file?

流过昼夜 提交于 2020-08-22 07:13:53
问题 I just built clang 5.0.0 on a Redhat 6 machine and tried to run clang-format. I'm unable to get the -style option to read in a style file. Here's an example of a set of commands that I think should work: ./clang-format -style=llvm -dump-config > .llvm-format ./clang-format -style=.llvm-format ~/myFile.cc When I run this command I get the following error: Invalid value for -style It appears to find and use .clang-format when placed in a parent directory as expect. The built-in types also work:

How do I specify a clang-format file?

有些话、适合烂在心里 提交于 2020-08-22 07:13:29
问题 I just built clang 5.0.0 on a Redhat 6 machine and tried to run clang-format. I'm unable to get the -style option to read in a style file. Here's an example of a set of commands that I think should work: ./clang-format -style=llvm -dump-config > .llvm-format ./clang-format -style=.llvm-format ~/myFile.cc When I run this command I get the following error: Invalid value for -style It appears to find and use .clang-format when placed in a parent directory as expect. The built-in types also work: