Questions tagged [llvm-clang]

Clang is the C language family front-end for the LLVM compiler. (The C language family includes C, C++, Objective-C, and Objective-C++.)

Clang refers to the C language family front-end for the LLVM (originally known as "low level virtual machine") compiler. The C language family consists of C, C++, Objective-C, and Objective-C++.

High-level features of clang include better compile-time performance than gcc, helpful error and warning messages, and a static analyzer to automatically detect software bugs.

1101 questions
6
votes
2 answers

How to get the textual representation of an LLVM IR instruction?

If I is of type llvm::Instruction, we can print out the same in human-readable form (textual representation) by errs() << I; I want the assign the exact same representation to a std::string to C type string. How can I do that?
sherlock
  • 2,397
  • 3
  • 27
  • 44
6
votes
0 answers

Building llvm with CMake on Windows

I am trying to build LLVM / Clang on Windows 10 pro following the instruction from llvm. I also have followed all suggestions I could find from prior posts and other sites, but still got errors. Thanks for the help. I tried it with GCC and Visual…
DavidY
  • 357
  • 5
  • 15
6
votes
2 answers

What should I replace getGlobalContext() with in LLVM 3.9.1?

Doing old tutorials, I often see getGlobalContext() used. However, in LLVM 3.9.1, this function can no longer be found. What should I replace these calls with for equivalent behaviour?
Shuzheng
  • 11,288
  • 20
  • 88
  • 186
6
votes
0 answers

How to get list of all standard predefined macros in Clang

I can get list of Clang's compiler predefined macros with the following command in Terminal. (Reference) clang -dM -E -x c /dev/null However, this list doesn't contain Standard Predefined Macros, such as __FILE__, __LINE__, __FUNCTION__, etc. (GCC…
Keita
  • 1,478
  • 2
  • 14
  • 18
6
votes
1 answer

Is it possible to compile & link Clang/LLVM using the gold linker?

I'm writing a custom pass for LLVM/Clang, and recompiling tends to take a while and use a lot of memory. I've heard that the gold linker (1) takes less time and (2) uses less memory than the standard ld linker. Is there a way to pass flags into the…
tonysdg
  • 1,335
  • 11
  • 32
6
votes
1 answer

Can I set the stack pointer in LLVM?

I'm working on a small c++-like language which I'll be compiling to LLVM. One of the things I want to implement is cooperative multitasking; there will be a "yield" operator which will hopefully switch the stack pointer and program counter to the…
Verdagon
  • 2,456
  • 3
  • 22
  • 36
6
votes
0 answers

Homebrew-installed Clang fails to find headers on Mac OS X

So, for no apparent reason (I haven't installed a new version of clang, or changed any compiler configuration), clang suddenly can't find assert.h on my Mac. In my development VM, running Ubuntu, both gcc and clang compile the project fine; on the…
ELLIOTTCABLE
  • 17,185
  • 12
  • 62
  • 78
6
votes
1 answer

How to get source line number from .ll file LLVM

I am working with LLVM 3.4 and want to obtain the line number information of source file from IR. The IR is generated from simple c code with Clang. I want to obtain the line number in source c file from the line in IR body. I tried this - For…
Shail Dave
  • 63
  • 1
  • 5
6
votes
1 answer

Clang AST visitor, avoid traversing include files

Hello I am trying to implement an AST Clang visitor and this is my code. class ExampleVisitor : public RecursiveASTVisitor { private: ASTContext *astContext; // used for getting additional AST info public: virtual bool…
Andreas Geo
  • 365
  • 2
  • 15
6
votes
1 answer

turning off CLANG_ENABLE_MODULE_DEBUGGING consequences

In order to work around an apple bug in xcode 7.3 where xcode blows up when hitting some breakpoints, we need to either turn off CLANG_ENABLE_MODULE_DEBUGGING or stay with xcode 7.2. Turning off CLANG_ENABLE_MODULE_DEBUGGING sounds great. What does…
finneycanhelp
  • 9,018
  • 12
  • 53
  • 77
6
votes
1 answer

Just-in-time compilation using libclang and LLVM C

I have a software that is able to generate C code that I would like to use in a just-in-time compilation context. From what I understand, LLVM/Clang is the way to go and, for maintainability of the project, I'd like to use the C API of llvm and…
Joel
  • 1,295
  • 15
  • 30
6
votes
2 answers

Return Void from function LLVM

I have created a function in LLVM IR. Now I want to create a return instruction return void. I saw the function Create ReturnInst::(LLVMContext &C, Value *retVal, BasicBlock *InsertAtEnd) But I don't know what should retVal should be so that it…
coder hacker
  • 4,819
  • 1
  • 25
  • 50
6
votes
1 answer

C++ program not compiling with Clang and visual Studio 2010 Express

I'm trying to compile the source code as described in this tutorial with visual c++ 2010 express. http://kevinaboos.wordpress.com/2013/07/23/clang-tutorial-part-ii-libtooling-example/ The full source code is over…
6
votes
4 answers

clang not compiling c programs?

I use clang to compile most of the times when programming in c. Suddenly it has stopped working. Whenever I try to compile something it gives me this output Suppose the file name is test.c clang test.c In file included from…
Deepak
  • 1,503
  • 3
  • 22
  • 45
6
votes
2 answers

Compile protobuf with xCode 5

I want to use protobuf(https://code.google.com/p/protobuf/) in my project Did you successfully compile protobuf with xCode 5, Please help to share your experience? Thanks.
Huy Tran
  • 217
  • 5
  • 11