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
110
votes
11 answers

Clang doesn't see basic headers

I've tried to compile simple hello world on Fedora 20 with Clang, and I get the following output: d.cpp:1:10: fatal error: 'iostream' file not found #include I don't have any idea how to resolve it.
sweet_sugar
  • 1,390
  • 3
  • 13
  • 22
69
votes
2 answers

tgmath.h doesn't work if modules are enabled

I looked into using tgmath.h to deal with the CGFloat typedef float/double mess when dealing with arm64. This answer has a pretty good description of how to use it, except that it didn't work at all for me. No matter what, my code was still calling…
Dima
  • 23,484
  • 6
  • 56
  • 83
63
votes
3 answers

How do I specify a clang-format file?

I just built clang 5.0.0 on a Redhat 6 machine and tried to run clang-format. I'm unable to get the -style option to read in a style file. Here's an example of a set of commands that I think should work: ./clang-format -style=llvm -dump-config >…
dromodel
  • 9,581
  • 12
  • 47
  • 65
53
votes
4 answers

What do you need to install to use Clang on windows to build c++14 for 64 bit?

UPDATE: I've written a detailed tutorial that incorporates the top two answers on this question: http://blog.johannesmp.com/2015/09/01/installing-clang-on-windows-pt1/ TL;DR On Windows, Given the following program: #include int…
Johannes
  • 6,232
  • 9
  • 43
  • 59
44
votes
4 answers

clang: no out-of-line virtual method definitions (pure abstract C++ class)

I'm trying to compile the following simple C++ code using Clang-3.5: test.h: class A { public: A(); virtual ~A() = 0; }; test.cc: #include "test.h" A::A() {;} A::~A() {;} The command that I use for compiling this (Linux, uname -r:…
banach-space
  • 1,781
  • 1
  • 12
  • 27
41
votes
4 answers

Clang C++ Cross Compiler - Generating Windows Executable from Mac OS X

I have created a C++ application using Xcode on my Mac using the Clang compiler. I want to compile my source files to create an executable that can be ran on a windows machine however I cant get Clang to generate me an executable. Here is what I've…
gavlaaaaaaaa
  • 612
  • 2
  • 7
  • 11
26
votes
4 answers

clang-format: How to keep each element of constructor's initializer list on a separate line

I have a C++ class like this: class A { public: A() : m_a(someValue1), m_b(someValue2), m_c(someValue3) { } // .... other class members private: A m_a; B m_b; C m_c; }; After formatting this…
ivan.ukr
  • 2,853
  • 1
  • 23
  • 41
24
votes
6 answers

Bind mutex to object

Given the following example code: int var; int mvar; std::mutex mvar_mutex; void f(){ mvar_mutex.lock(); mvar = var * var; mvar_mutex.unlock(); } I want to express that mvar_mutex is bound to the variable mvar and protects only that…
nwp
  • 9,623
  • 5
  • 38
  • 68
21
votes
4 answers

What standard C library does Clang use? glibc, its own, or some other one?

I'm pretty sure glibc is the name of the standard C library implementation for gcc. But for LLVM/Clang I'm not sure. I've Googled to try to find if it comes with its own implementation of the whole standard C library, or whether they also use glibc.…
hippietrail
  • 15,848
  • 18
  • 99
  • 158
21
votes
1 answer

Private module map for a framework

I'm using this answer to create a module map to create a module for CommonCrypto so I can use it in a framework. Doing this however means that any projects that I use this framework in have access to CommonCrypto with import CommonCrypto - and even…
Rich
  • 8,108
  • 5
  • 46
  • 59
19
votes
2 answers

std::variant<>::get() does not compile with Apple LLVM 10.0

I'm playing with the C++17 std::variant type and tried to compile the cppreference example code for get(): #include #include int main() { std::variant v{12}, w; int i = std::get(v); w =…
Mike Lischke
  • 48,925
  • 16
  • 119
  • 181
18
votes
2 answers

Why doesn't Clang come with standard library headers?

I downloaded Clang 3.6.2 from this website and am trying to set it up with Code::Blocks under Windows. Unfortunately, it fails to compile a simple "hello world" program on the grounds that it doesn't know where iostream is. Looking through the…
Therhang
  • 825
  • 1
  • 9
  • 15
17
votes
3 answers

What effect does #define X X have in C?

In the source code of stdbool.h in LLVM project, it reads: /* Don't define bool, true, and false in C++, except as a GNU extension. */ #ifndef __cplusplus #define bool _Bool #define true 1 #define false 0 #elif defined(__GNUC__) &&…
Mohsen Nosratinia
  • 9,844
  • 1
  • 27
  • 52
16
votes
1 answer

Clang-Tidy llvm-header-guard directory configuration

Is there a way to remove the suggested computer specific path on the suggested llvm-header-guard string when running static analysis with clang-tidy? For example the suggested header guard for the file (cls/math/matrix.hpp) is: …
user7119460
  • 1,451
  • 10
  • 20
16
votes
2 answers

Pasting formed an invalid processing token '.'

I am trying to use macro for calling appropriate object based on the type. #define DELEGATE_FUNC(FuncName, kind, paramPtr) \ if (kind == 1) { \ return PolicyObject1.##FuncName(paramPtr); \ …
Nitesh
  • 2,681
  • 4
  • 27
  • 45
1
2 3
73 74