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
7
votes
1 answer

"is_assignable"error when using Boost 1.68 / LLVM / VS2017

I receive the following build error when switching to LLVM toolset in VS2017 to build code using Boost 1.68. The code builds fine with MSVC compiler. 1>C:\boost_1_68_0\boost/type_traits/has_trivial_move_assign.hpp(49): error : no template named…
oracle3001
  • 1,090
  • 19
  • 31
7
votes
1 answer

How to get the source text from line number using clang?

I am using clang matcher to obtain the result nodes. From the result nodes, I am able to get the line number, let us say 17. Now, I would like to get the entire source code in that line. Please help. Let me explain in detail. I have a clang matcher…
The Voyager
  • 617
  • 8
  • 21
7
votes
1 answer

How to identify any type of instruction in LLVM/C++?

I've been asked to do a LLVM function that allows me to find: jump/branch, load/store, call, 'arithmetic and other type of instruction'. As far as I managed to do, I've been able to find the CallInst, LoadInst, StoreInst and BranchInst doing the…
Neitral
  • 71
  • 1
  • 3
7
votes
1 answer

Output from bpf_printk()

While running some examples from samples/bpf I noticed that bpf_printk output is prepended with some extra information, e.g. : telnet-470 [001] .N.. 419421.045894: 0x00000001: BPF command: 2 BPF command: 2 is actual string passed to bpf_printk in…
Mark
  • 6,052
  • 8
  • 61
  • 129
7
votes
3 answers

Analyze Embarcadero RAD Studio project with clang analyzer

I would like to know is it possible to analyze Embarcadero RAD Studio C++ project with Clang Static Analyzer. As far as I understand I need a makefile or something any and ability to build the project with clang. But Embarcadero uses it's own C++…
7
votes
1 answer

How to get the arguments of a function call in LLVM?

I want to write an LLVM pass that'll extract the arguments of function calls. If the argument is a constant one, my objective is to recover what that constant is. The IR looks like %2 = call noalias i8* @malloc(i64 512) #3 The LLVM pass looks…
sherlock
  • 2,397
  • 3
  • 27
  • 44
7
votes
0 answers

How to get actual name of invalid/unresolved type in clang AST

Consider the following code int function() { unknownType variable; } In the above code snippet, "unknownType" is not resolved at compile time, so clang will put default type as int in the AST and mark the declaration as invalid. Now the question…
Hemant
  • 767
  • 6
  • 20
7
votes
1 answer

clang-3.8 and compiler-rt vs libgcc

I have been using clang-3.5 to happily build bitcode versions of musl libc and use the result to produce nice stand alone executables. Recent attempts with clang-3.8 have not been so happy. It seems that the bitcode clang-3.8 generates uses…
Ian A. Mason
  • 207
  • 3
  • 8
7
votes
2 answers

lld undefined symbol: mainCRTStartup

My cpp code: int main(int argc, char** argv) {} I use the following command to compile and link it: // I want to read the result ir clang -S -emit-llvm main.cpp // I want to compile directly from ir llc -filetype=obj main.ll lld -flavor link…
J.Doe
  • 83
  • 1
  • 5
7
votes
1 answer

iOS mixed dynamic framework - bridge objc headers with private module

In regards to a "dynamic framework" target, I need to bridge internal (private) objective-c headers to my swift counterparts. From my understanding I need to use a private module. Some of these swift counterparts are bridged back to objective-c…
Avba
  • 14,822
  • 20
  • 92
  • 192
7
votes
1 answer

Problems installing Clang in windows

I've been trying to install clang in virtual machine with windows xp, first I try with the Pre-Built Binaries of clang for Windows from this page: LLVM Download and I was getting this error: Failed to find MSBuild toolset directory So, I try to…
SujaM
  • 409
  • 6
  • 16
7
votes
1 answer

No type named 'unique_ptr' in namespace 'std' when compiling under LLVM/Clang

I'm catching a compile error when attempting to use unique_ptr on Apple platforms with -std=c++11: $ make c++ -std=c++11 -DNDEBUG -g2 -O3 -fPIC -march=native -Wall -Wextra -pipe -c 3way.cpp In file included ... ./smartptr.h:23:27: error: no type…
jww
  • 97,681
  • 90
  • 411
  • 885
7
votes
2 answers

Loop unrolling in clang

I am trying to selectively unroll the second loop in the following program: #include int main() { int in[1000], out[1000]; int i,j; #pragma nounroll for (i = 100; i < 1000; i++) { in[i]+= 10; } …
k01
  • 71
  • 1
  • 1
  • 3
7
votes
1 answer

Assigning literal value to local variable in LLVM IR

I've been messing around with code generation to LLVM IR, and there's something I don't quite understand, which is the distinction of when local variables have to be allocated, and how to load a literal value into a local variable. If I compile the…
Jumhyn
  • 6,687
  • 9
  • 48
  • 76
7
votes
3 answers

Unable to cross-compile to SPARC using clang

So here's the situation: I need to be able to compile binaries from a Linux machine (on Ubuntu, for what it's worth) which are able to run from a SPARC server. The program I'm trying to compile is very simple: #include #include…
eezstreet
  • 119
  • 1
  • 10