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
5
votes
0 answers

Build llvm/clang with static libraries by default

I need to use custom llvm/clang in machines that Ubuntu version varies. I want build my llvm/clang with all shared libraries (libc, libm and etc.) replaced with static libraries to avoid runtime crash caused by out-of-date shared libraries. Is there…
Mindong
  • 89
  • 9
5
votes
1 answer

Clang - how to retrieve "Expr" as string?

I am using Clang/libtooling (ASTComsumer with a Matcher) to visit ALL return statements (ReturnStmt). I need to extract the expression that comes after the keyword return in a string form so that I can put that in a macro that I am replacing return…
DLight
  • 51
  • 1
  • 2
5
votes
1 answer

Clang emits an "unused type alias" warning for a type alias that is used

I have some code that Clang is generating a warning for. This is simplified from the actual code, but the spirit is the same. this_t in the local class is used to instantiate some other template class. template struct value_holder { T …
Chris Hunt
  • 3,840
  • 3
  • 30
  • 46
5
votes
1 answer

LLVM OPT not giving optimised file as output.

The man page for opt says: "It takes LLVM source files as input, runs the specified optimizations or analyses on it, and then outputs the optimized file or the analysis results". My Goal: To use the inbuilt optimisation pass -dce available in opt.…
Rahul Bharadwaj
  • 2,555
  • 2
  • 18
  • 29
5
votes
1 answer

fatal error: 'stddef.h' file not found when using clang-llvm ASTMatcher

I am new to using ASTMatcher and following a code from a tutorial - https://github.com/peter-can-talk/cppnow-2017. Here, the tool clang-variables can be run using the following command: cd code/clang-variables docker run -it -v $PWD:/home clang…
5
votes
2 answers

clang static analyzer skipping some checks

I am using clang static analyzer 4.0.0. For the following example int fun(){ int aa = 1,bb = 0; int cc = aa/bb; // 1) devide by zero. // Reported by clang int *pt = nullptr; int a = *pt; // 2) null pointer dereference. // NOT…
Hemant
  • 767
  • 6
  • 20
5
votes
0 answers

Running LLVM file, generated with rustc, with clang

I'm trying to run a .ll file with clang and getting linker errors. I have a file test.rs that simply includes a main function with a println! statement. I generate the LLVM IR with the command rustc --emit=llvm-ir --crate-type=bin test.rs. When I…
Jon Catanio
  • 283
  • 1
  • 3
  • 11
5
votes
1 answer

How to generate 64 bit Visual Studio project for LLVM using CMake?

I have downloaded LLVM source repository form http://releases.llvm.org/download.html. Now when I am running CMAKE in the source directory it is generating 32bit Visual Studio Projects but I want to generate 64 bit visual studio projects. If someone…
Sanjit Kumar Mishra
  • 1,153
  • 13
  • 32
5
votes
1 answer

lldb is not starting an application

this is my first experience in commandline mode of lldb. unsuccessful. installed minimal kit with clang, lld, lldb v5 (ubuntu 16.04) sample application built with clang. trying to start: lldb applcation >run error: process launch failed: unable…
amigo421
  • 2,429
  • 4
  • 26
  • 55
5
votes
1 answer

Generate memory and table imports/exports in web assembly

The default code generation for compiling with LLVM/Clang to WebAssembly exports memory and ignores tables completely. Is there a way to emit memory and table imports (and/or exports) when targeting web assembly with clang…
Casper Beyer
  • 2,203
  • 2
  • 22
  • 35
5
votes
2 answers

Linking against clang-llvm

I've been working on a small tool with clang/llvm but I haven't been able to successfully get g++ and gnu's linker to properly link my code against clang. my linker is generating the following errors: undefined reference to…
ct_
  • 1,189
  • 4
  • 20
  • 34
5
votes
4 answers

What's required to implement root class of Objective-C?

I tried this code: // main.m #import @interface Test + (void)test; @end @implementation Test + (void)test { printf("test"); } @end int main() { [Test test]; return 0; } with LLVM/Clang without any framework, it doesn't…
eonil
  • 83,476
  • 81
  • 317
  • 516
5
votes
3 answers

Abstract Interpretation in LLVM

I need to use abstract interpretation to do some analysis using LLVM. Is this possible? or I need to use analysis tools easier. If I could do that by LLVM , which classes would help me to formulate the statements from the original source code to…
R.Omar
  • 645
  • 1
  • 6
  • 18
5
votes
1 answer

Disable Clang Tool diagnostics

This will be a general question. I am currently writing a tool for clang which is related to AST traversal. So I have a frontendaction to create an ASTConsumer which, further, has a RecursiveASTVistor. I call Tool.run() to execute my action. It runs…
Gawain
  • 71
  • 6
5
votes
2 answers

How to make LLVM prefer one machine instruction over another?

Suppose I have two register computational blocks in the target machine: I and X. One may apply only integer operations to I-registers and both integer and float operations to X-registers. There're two types of instructions as well: def ADDIi32 :…