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

How to represent clang AST in JSON format?

clang-check -ast-dump -ast-dump-filter= main.c gives a AST (only a function declaration) of the particular code. How can we represent generated AST in JSON format? PS: I Want AST for function declaration only.
achala
  • 197
  • 1
  • 11
9
votes
0 answers

Is libclang slower than using clang driver based tool?

I am writing an autocompletion and syntax tool using libclang. I am pretty much using the same code as in c-index-test.c file. But the speed of results is very slow. There are few non libclang clang tools which works faster than my libclang…
abhanshu
  • 91
  • 2
9
votes
2 answers

Clang can't compile basic header files (like ) in macOS

My macOS version is 10.14 Xcode version is 10.2 To write the plugin for clang. I just install the llvm and clang from Github with following commands. git clone https://github.com/llvm/llvm-project.git cd llvm-project mkdir build cd build cmake -G…
kiimmm
  • 91
  • 1
  • 3
9
votes
1 answer

LLVM IR : C++ API : Typecast from i1 to i32 and i32 to i1

I am writing a compiler for a self-made language which can handle only int values i.e. i32. Conditions and expressions are similar to C language. Thus, I am considering conditional statements as expressions i.e. they return an int value. They can…
Chaitanya Patel
  • 390
  • 1
  • 4
  • 15
9
votes
2 answers

Is OpenMP available in High Sierra LLVM?

In the default LLVM provided by Apple in macOS 10.13, High Sierra, is OpenMP finally available? It has been available in main LLVM for more than a year now. (another way to ask the question might be what version of LLVM is the new Apple LLVM based…
Henry Schreiner
  • 905
  • 1
  • 7
  • 18
9
votes
4 answers

C++ Why doesn't my code print updates made to the give file

I was trying to write a code in C++ the does something like tail -f in linux. I found this question : How to read a growing text file in C++? and implemented the same. I created a temp.txt and started doing echo "temp" >> temp.txt. But my program is…
banarun
  • 2,305
  • 2
  • 23
  • 40
9
votes
3 answers

Using OpenMP with llvm-clang

So I tried to use OpenMP with one of the latest version of clang, clang version 3.4.2 (tags/RELEASE_34/dot2-final). Followed the procedure to compile and add the PATHs of omp.h, then Compiling my hello.c using : clang -fopenmp hello.c and then…
Amir
  • 1,348
  • 3
  • 21
  • 44
9
votes
1 answer

How to get function name using FunctionDecl *D in clang

In one of my checker, i am using FunctionDecl class to get the function declaration. Now i want to get the name of the function for which i enter into the checkASTDecl method. As we know that in checkASTDecl() we get pointer of class FunctionDecl.…
user1497818
  • 375
  • 1
  • 7
  • 16
9
votes
1 answer

Why isn't libclang returning meaningful completion results?

I'm trying to understand how to do code completion with libclang. I've watched "Thinking beyond the compiler" and I've looked over c-index-test, and I found a simple sample program here I compiled that program and ran it on this sample file that I…
John
  • 548
  • 7
  • 15
9
votes
3 answers

How to build llvm and clang on cygwin

Can I build the LLVM and clang from source code on cygwin? How long to build LLVM and Clang? Because I try to build them on VirtualBox, it takes about 2 hours.
Han Bing
  • 91
  • 1
  • 1
  • 4
8
votes
2 answers

Are loops allowed in Linux's BPF programs?

I am thinking of a solution of replicating packets in the kernel and forward to 5 hosts (unicast). Planning to utilize eBPF/XDP for it. I am trying to loop for 5 times, and inside the loop I am planning to clone the packet, modify the DST IP…
Fernando
  • 163
  • 1
  • 9
8
votes
1 answer

What is LLVM Comdat?

What does comdat in LLVM represents? You can find the source here:Comdata An example from source level program representation (c++) would be very much helpful. If you need more info, please feel free to ask. I find it in many places in llvm code…
PreeJackie
  • 587
  • 4
  • 14
8
votes
1 answer

How to generate LLVM SSA Format

I write the following C code where variable X is being assigned twice: int main() { int x; x = 10; x = 20; return 0; } Compile and generate IR representation using the following command clang -emit-llvm -c ssa.c IR…
Shehbaz Jaffer
  • 1,944
  • 8
  • 23
  • 30
8
votes
3 answers

What is proper LLVM header guard style?

In clang tidy, the check [llvm-header-guard] looks for LLVM style header guards, but I can't find any examples of proper LLVM header guard style, specifically the structure of the name given to the define, the coding standards pages does not mention…
A-n-t-h-o-n-y
  • 410
  • 6
  • 14
8
votes
7 answers

Integrate LLVM Clang 4.x.x / 5.x.x / 6.x.x into Visual Studio 2017

The official LLVM 4.0 build for Windows integrates with Visual Studio up to Visual Studio 2015. Unfortunately it still doesn't support Visual Studio 2017. When you try to set the Platform Toolset of a project to LLVM-vs2014, it pops up an error. Do…
plasmacel
  • 8,183
  • 7
  • 53
  • 101