llvm-clang

Quirk with Core Data, protocols, and readwrite vs. readonly property declarations

倾然丶 夕夏残阳落幕 提交于 2020-01-13 16:23:12
问题 I'm running into an odd quirk involving Core Data, a declared protocol, and perhaps the LLVM 1.5 compiler. Here's the situation. I have a Core Data model that among others has two classes, IPContainer and IPEvent, with IPContainer being the parent entity of IPEvent. Each entity has a custom class in the project for it, created using mogenerator. mogenerator generates an additional subclass that just contains the modeled property declarations, so the class hierarchy is actually IPEvent >

Omitted code blocks from clang AST for ObjectiveC

随声附和 提交于 2020-01-06 16:18:57
问题 I was generating AST for Objective C code on a .m file The command is roughly like clang-check -ast-dump /source/file.m &> /output/file.txt It had an error that said Error while trying to load a compilation database: Could not auto-detect compilation database for file '/source/file.m' No compilation database found in /source or any parent directory json-compilation-database: Error while opening JSON database: No such file or directory Running without flags. In file included from /source ..

Clang build is extremely slow and hangs up in the middle

▼魔方 西西 提交于 2020-01-05 07:13:29
问题 I am getting started with writing my own clang tools. These are the steps I have followed so far: Checked out llvm 7.0 release build Checked out clang 7.0 release build Built clang and llvm using ninja with following flags (It was hanging up on me constantly without these) -DLLVM_USE_LINKER=gold -DLLVM_PARALLEL_LINK_JOBS=1 -DLLVM_LINK_LLVM_DYLIB=true -DLLVM_USE_SPLIT_DWARF=ON -DBUILD_SHARED_LIBS=ON Installed clang Now I want to set clang as it's own compiler. So I have set these flags in

What to pass for the vmap argument of CloneFunction in llvm?

邮差的信 提交于 2020-01-03 18:53:29
问题 I am trying to clone the exact copy of another function. I have not been able to find any examples of CloneFunction usage on the internets. 回答1: It turns at the you can just create a ValueToValueMapTy variable and pass it without initialization. 回答2: The following code segment is enough for cloning the function called Func ValueToValueMapTy VMap; auto *Clone = CloneFunction(Func, VMap); rahib bob 来源: https://stackoverflow.com/questions/13104085/what-to-pass-for-the-vmap-argument-of

Getting fatal error: 'type_traits' file not found #include <type_traits>, while building clang example

对着背影说爱祢 提交于 2020-01-01 18:54:33
问题 I am trying to build the PrintFunctionNames example from clang. However I get the following error: [mac-osx:clang/examples/PrintFunctionNames] osx% clang++ -std=c++0x PrintFunctionNames.cpp In file included from PrintFunctionNames.cpp:15: In file included from /usr/local/include/clang/Frontend/FrontendPluginRegistry.h:13: In file included from /usr/local/include/clang/Frontend/FrontendAction.h:22: In file included from /usr/local/include/clang/Basic/LLVM.h:22: In file included from /usr/local

Getting fatal error: 'type_traits' file not found #include <type_traits>, while building clang example

橙三吉。 提交于 2020-01-01 18:54:32
问题 I am trying to build the PrintFunctionNames example from clang. However I get the following error: [mac-osx:clang/examples/PrintFunctionNames] osx% clang++ -std=c++0x PrintFunctionNames.cpp In file included from PrintFunctionNames.cpp:15: In file included from /usr/local/include/clang/Frontend/FrontendPluginRegistry.h:13: In file included from /usr/local/include/clang/Frontend/FrontendAction.h:22: In file included from /usr/local/include/clang/Basic/LLVM.h:22: In file included from /usr/local

How can I get Function Name of indirect call from CallInst in LLVM

岁酱吖の 提交于 2020-01-01 12:06:16
问题 Function *fun = call->getCalledFunction(); getCalledFunction(); returns null if it's indirect call. How can I get the name of the function or the name of the pointer? I found all questions in Stack Overflow related to this issue talked about function name of direct call, or type of pointer. I just want to track cases like this one: void foo(){} void goo(){} void main(){ int x = 1; void (*p)(); if(x) p = &foo; else p = &goo; p(); // print the called function name } 回答1: I get the same problem.

How can I find all member field read/writes using Clang?

ぃ、小莉子 提交于 2020-01-01 05:18:09
问题 Given a C++ source code, I want to find the class fields that every function writes and reads. What is the best way of doing this using the Clang frontend? (I'm not asking for a detailed explanation of all the steps; however a starting point for an efficient solution would be great.) So far I tried parsing statements using the RecursiveASTVisitor, but keeping track of node connections is difficult. Also, I cannot figure out how to keep track of something like below: int& x = m_int_field; x++;

Clang+LLVM static library linking error on Windows - Why would the symbols be different?

流过昼夜 提交于 2019-12-24 22:11:30
问题 After compiling clang and llvm following the instruction on the llvm website I try linking to the built static libs in a test app. All code is built with v110 of the VS toolset. Im getting linker errors of type "error LNK2001" and "error LNK2019". The app appears to put the libs in the bucket for symbol resolution. With verbose linker output i can see that they are just being dismissed: 1> Unused libraries: ... 1> C:\Sdk\llvm\Debug\lib\clangTooling.lib ... Digging a little deeper i have found

Generate LLVM IR for httpd

六月ゝ 毕业季﹏ 提交于 2019-12-24 12:21:42
问题 I am trying to compile apache2 with LLVM, to generate final binaries in LLVM IR. I used flto option in compiling and linking and passed "also-emit-llvm" to the linker through clang. It seems to work for most steps, however I had two concerns 1) Earlier I used LLVM 3.6, whose gold plugin doesn't accept also-emit-llvm, but has emit-llvm only, basically it will emit only elf or llvm. Which the Autotools build system doesn't like. The configure and make script want binaries, while I want llvm.