Questions tagged [clang]

compiler front end for C, C++, Objective-C

Filter by
Sorted by
Tagged with
102 votes
5 answers
23k views

Clang warning flags for Objective-C development

As a C & Objective-C programmer, I'm a bit paranoid with the compiler warning flags. I usually try to find a complete list of warning flags for the compiler I use, and turn most of them on, unless ...
Macmade's user avatar
  • 1,146
26 votes
4 answers
12k views

GCC vs clang/LLVM -- pros and cons of each [closed]

What are the pros and cons of GCC vs clang/LLVM?
yodie's user avatar
  • 694
18 votes
1 answer
4k views

Why does LLVM have an assembly-like IR rather than a tree-like IR? Or: why do projects target LLVM IR instead of clang's AST?

Why is LLVM's intermediate representation (LLVM IR) assembly-like rather than tree-like? Alternatively, why do language implementations target LLVM IR rather than clang's AST? I'm not trying to ask ...
Praxeolitic's user avatar
  • 1,634
13 votes
3 answers
5k views

C++: Metaprogramming with a compiler API rather than with C++ features

This started out as a SO question but I realized that it is quite unconventional and based on the actual description on the websites, it might be better suited to programmers.se since the question has ...
Steven Lu's user avatar
  • 519
9 votes
3 answers
2k views

Is Clang/LLVM ready for prime time? [closed]

Clang is able to be used instead of gcc? What your experience on that? What disadvantages there are yet? Performance of compilation is very better than gcc but about performance of code generated ...
Maniero's user avatar
  • 10.8k
8 votes
2 answers
825 views

Is it wise to use Clang for personal code analysis in a project that builds with gcc?

I started to work on several C projects that are building using gcc. I believe this choice was made for several reasons: Had to cross-compile for arm very early on (I think). Performance is the first ...
nathdwek's user avatar
  • 271
7 votes
4 answers
5k views

Reason to use mingw win32 headers and libs with LLVM/Clang

Is there any good reason (except "GCC is better") to use the MinGW win32api/headers/libs with LLVM/Clang. Suppose that in two to three years, Clang has matured enough (in C++0x and performance) that ...
rubenvb's user avatar
  • 580
2 votes
1 answer
97 views

Does an explicit temporary of an integral type qualify as an integral constant expression?

In the following code, int() is an explicit type conversion. #include <iostream> int main() { void* ptr = int(); return 0; } Clang Compiler: source_file.cpp:5:11: error: cannot ...
Jemes's user avatar
  • 133
2 votes
1 answer
241 views

How are objects stored in unordered_sets?

I've been doing a bit of research on the subject. I know unordered_sets are hash tables, where the key and value are one and the same. What I'd like to know is how the compiler figures out where in ...
moonman239's user avatar
  • 2,053
2 votes
1 answer
615 views

Why isn't the isa pointer hardwired in Objective-C classes?

I've been studying the Objective-C runtime for some years, and even hacked libobjc a little bit (both Apple's and GNUStep's), and I've been wondering about a design decision on the compilers. Every ...
paulotorrens's user avatar
1 vote
2 answers
2k views

How to prevent 'global variables' in a big project?

With 'global variables', I mean Variables on namespace level Static data members in classes Static variables in functions In a big C++ project I would like to have a mechanism (like a compiler ...
Borph's user avatar
  • 121
1 vote
2 answers
446 views

How could Clang release under BSD license?

I found that llvm could only generate assembly code. If someone want generate and link assembly code to native executable code, they should use external tool(GNU as/ld, for example. Currently lld is ...
sunny2016's user avatar
  • 113
1 vote
1 answer
170 views

Switching out implementation source files in C project

For simplicity, let's say I have the following C project structure: src/ utils/ logger.c logger.h main.c secondary_component.c main.c starts with: #include "utils/logger.h" I would ...
ChaimKut's user avatar
  • 123
1 vote
1 answer
136 views

Cross compiling: Share compile steps between different target platforms?

For a C project, I'm upgrading my build process from MingGW-GCC / make and Android Studio under Windows (2 separate processes) to Clang / CMake under Debian 8, using wclang and wine to compile and ...
Engineer's user avatar
  • 767
0 votes
1 answer
102 views

When is it a good idea to test a build with both clang and gcc?

I am peeking through the code of torsocks where as you'll notice, the .travis.yml file instructs Travis CI to test against both clang and gcc. compiler: - clang - gcc I'm still learning and ...
Alex V's user avatar
  • 111