clang

Using Wide Character Constants with clang Gets "extraneous characters in wide character constant ignored" Error

I recently decided to switch to clang from gcc and I’m getting the following warning for my use of wide character constants: "extraneous characters in wide character constant ignored". Here is the code that gets the warning: wstring& line; … for (wstring::iterator ch = line.begin(); ch != line.end(); ++ch) switch (*ch) { cas...

Windows.h and clang (LLVM)

Hi, I'm trying to compile a little project that includes windows.h using the clang compiler. Unfortunately, clang produces some errors I'm not able to resolve. What's causing these errors? Does clang not support all required features, am I missing something? In file included from C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include/w...

Precompiled C++ headers with Clang++ 2.0 (Xcode 4 Developer Preview 2)

Hi, Does anyone know if precompiled headers are supported when using Clang++ 2.0? I've installed Xcode 4 Developer Preview 2 which includes a Clang++ build that reports its version as "Apple clang version 2.0 (tags/Apple/clang-108.3))", but trying to replicate the basic PCH usage example at http://clang.llvm.org/docs/UsersManual.html#pr...

clang cannot find MinimalAction

I get an error when trying to use class MinimalAction in clang. I included Action.h. ...

Example code to trigger Clang's static analyser

I would like to see a small but complete snippet of code that will cause Clang's static analyser to complain. My motivation is mostly that I'm trying to get it to work on my PIC32 code, and I need a way to distinguish between "all the code is fine" and "it's not actually doing anything". It's also partly curiosity, since I can't seem to ...

How to suppress Objective-C warning "incomplete implementation of class 'SomeClass'"?

I have a class which routing many messages into inner component instance. So the class have only method definition, but no implementation. How can I suppress these warnings for those dynamic methods? -- edited -- My code sample: @interface SomeClass : NSObject { } - (void)mssageA:(id)value1 additionalOption:(id)value2; - (void)mssageB...

building a parser with clang

Hi, I need to build an AST using clang and the only tutorials that I found are vague and two years out of date. Could anybody point me to an example? ...

What version clang is in Xcode 3?

How do I figure which version of clang that Xcode use? It's 1.5 in Xcode, yet the official llvm-clang is 2.7. Are they the same? ...

Error while compiling C++ file using clang

After building CLang on the linux environment I tried to build it on Windows using Visual Studio. Everything went right but when I tried to compile this classic Hello World! program #include <iostream> int main() { std::cout<<"Hello World!"; } I got many errors C:\Users\SUPER USER\Desktop>clang++ a.cpp In file included from a.cpp...

LLVM jit and native

I don't understand how LLVM JIT relating to normal no JIT compile and documentation isn't good. I elaborate example suppose using clang front end: Case 1: I compile C file to native with clang/llvm. This flow I understand is like gcc flow - I get my x86 executable and that runs Case 2: I compile into some kind of LLVM IR that runs on...

What's the data-type of C enum of Clang compiler?

I posted other question: http://stackoverflow.com/questions/3509470/what-type-should-i-use-for-binary-representation-of-c-enum, and by the answer, I have to know my compiler's enum data-type. What's the data-type of C enum on Clang compiler? ...

Registering extern function with clang's JIT?

Im trying to register an extern function with clangs JIT without success. Heres the function im trying to call: extern "C" int myFunction(int val) { fprintf(stderr, "success!"); return 1; } Heres the code im using to register it: llvm::FunctionType* ft = llvm::FunctionType::get(llvm::Type::getInt32Ty(llvm::getGlobalContext()), ...

Have I found a bug in Clang?

I tried to compile the code below with Clang class Prasoon{ static const int dummy = 0; }; int const Prasoon::dummy = 0; int main(){} The above code did not give any error when compiled with Clang. prasoon@prasoon-desktop ~ $ clang++ --version clang version 2.8 (trunk 107611) Target: i386-pc-linux-gnu Thread model: posix prasoo...

Method not found (return type defaults to 'id')

Does anyone know what this LLVM warning means: Method '-retry' not found (return type defaults to 'id') in sourceFile.m I get this warning on the following line of sourceFile.m: [self.operation retry]; My class has a variable 'operation', which is a custom class extending NSOperation. MyCustomOperation* operation; @property (nona...

Clang preprocessor flag for Objective-C block support?

What's the Clang preprocessor flag for Objective-C block support? ...

Unexpected output from Clang

I've been testing out clang-llvm to see if it is worth it to mention to my school's IT department to add it to the machines we students program on. For all of our assignments, we are required to compile using g++ -Wall -W -pedantic-errors *.cpp, so I just converted the command to clang++ -Wall -W -pedantic-errors. I got some output that ...

Alternative to -pg with Clang?

I wish to profile CPU (sample if possible), with as small a performance impact as possible (hence similar to GCC's -pg), binaries compiled with Clang. Is there an alternative that uses instrumentation of the code, or produces output similar to gprof? ...

Confusing Template error

I've been playing with clang a while, and I stumbled upon "test/SemaTemplate/dependent-template-recover.cpp" (in the clang distribution) which is supposed to provide hints to recover from a template error. The whole thing can be easily stripped down to a minimal example: template<typename T, typename U, int N> struct X { void f(T* ...

Pragma message in Clang?

What's Clang's equivalent to #pragma message as used in GCC and MSVC? ...

Allow for loop initialization in GCC and Clang when std={c,gnu}89?

How can I enable for loop initialization when compiling in c89 or gnu89 mode using GCC and Clang? ...