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

Clang(LLVM) compile with frameworks

I am using: clang -ObjC -framework UIKit -o /var/compiled/c /Documents/Source/main.m In OS X terminal. I also tried UIKit.framework, but I am getting Fatal Error: 'UIKit/UIKit.h' not found with both. Any suggestions? Thanks
user1710004
  • 209
  • 1
  • 4
  • 12
6
votes
2 answers

Objective-C Auto-unboxing with LLVM 4

I've been looking at autoboxing in Objective-C (here, for instance). Is there a new syntax for unboxing? For instance, I want to do this but shorter: NSArray *oneNumber = @[@1]; int one = ((NSNumber *)oneNumber[0]).intValue; the second line's…
Dan Rosenstark
  • 68,471
  • 58
  • 283
  • 421
6
votes
1 answer

Finding all uses of a specific variable in LLVM

I am very new to LLVM. I am trying to write an llvm Pass to perform something akin to taint analysis. In my effort I need to iterate through the Def-use chain of specific predefined variables. For example the dis assembly of a C program the…
ash
  • 1,170
  • 1
  • 15
  • 24
5
votes
2 answers

Converting i1 type to integer value

For the following branch instruction br i1 %cmp, label %if.then, label %if.end, !dbg !35 Since llvm is SSA, I can directly access the operand 0, to determine whether the comparison is true or not. The type evaluates to i1 but I am having trouble…
webjockey
  • 1,647
  • 2
  • 20
  • 28
5
votes
1 answer

Cannot find llc tool in LLVM

I can get llvm-ir from C code using Clang. I just want to work with LLVM-IR. For my compiler project. I need to convert LLVM-IR to target machine code or executable. But I can't convert LLVM-IR to .exe. I downloaded LLVM from official site. But I…
5
votes
3 answers

Cannot install llvm-9 or clang-9 on Ubuntu 16.04

I have not been able to install either llvm version 9 or clang version 9 on Ubuntu. We have installed them on Windows. I have tried a command and saw this response. sudo apt-get install llvm-9 Reading package lists... Done Building dependency…
J-A-Brown
  • 85
  • 1
  • 3
  • 9
5
votes
1 answer

Xcode 4 - Linking error when archiving application

We have been using Xcode 4 and LLVM 2.0 for a couple of months now and after finishing a huge update to our application we thought we would send it off to Apple. What we couldn't imagine however, was that although the program was able to be built…
Argiris
  • 71
  • 6
5
votes
1 answer

How to fix "undefined symbol" in CLANG when using simple Template

I'm trying to implement a simple system using template struct, the code is very simple and compile fine with MSVC, yet i cannot understand why CLANG gives me this error: "lld-link : error : undefined symbol: public: static struct FMyStruct const…
Layl
  • 73
  • 2
  • 8
5
votes
1 answer

Setting path to Clang library in CMake

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…
albert
  • 8,285
  • 3
  • 19
  • 32
5
votes
1 answer

How to process c and c++ source code to calculate metrics for static code analysis?

Iam extending a software tool to calculate metrics for software projects. The metrics are then used to do a static code analysis. My task is to implement the calculation of metrics for c and c++ projects. In the developing process i encountered…
Tarexx
  • 131
  • 1
  • 5
5
votes
0 answers

LLVM/Clang generating useless-looking instructions

If I write this code: void loop1(int N, double* R, double* A, double* B) { for (int i = 0; i < N; i += 1) { R[i] = A[i] + B[i]; } } Clang (-O3) generates the following x64 ASM as part of an unrolled version of the loop (Compiler…
cloudfeet
  • 12,156
  • 1
  • 56
  • 57
5
votes
0 answers

Clang build is extremely slow and hangs up in the middle

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…
Tehreem
  • 939
  • 2
  • 14
  • 31
5
votes
1 answer

How to set up llvm-symbolizer?

I was able to push the ASAN related libs located in ANDROID_SDK using the script "asan_device_setup" located inside "Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/7.0.2/bin" from my MacOS. However, I am unable to get any…
user1128265
  • 2,891
  • 10
  • 29
  • 34
5
votes
1 answer

LLVM IR calling and linking printf or any external C function in a portable way

I created a very simple LLVM IR code piece via the API. Inside the main block, I want to insert calls to functions that are available in the C standard library such as malloc, printf or some other ones that I write in C by myself. ; ModuleID =…
diegoperini
  • 1,796
  • 21
  • 37
5
votes
3 answers

How to compile OpenCL Kernels to SPIR-V using Clang

I need compile OpenCL kernels in SPIR-V to use with Vulkan, I tried with Google CLSPV https://github.com/google/clspv, but the problem occur with vectorization, functions like vload8 doesn't work. So I need compile OpenCL kernels in SPIR-V using…
Alex
  • 3,301
  • 4
  • 29
  • 43