Search Results

Search found 124 results on 5 pages for 'clang'.

Page 1/5 | 1 2 3 4 5  | Next Page >

  • c++ ide & tools with clang integration

    - by lurscher
    recently i read this blog about google integrating clang parser into their code analysis tools This is something in which c++ is at least a decade behind other languages like java, but now that llvm-clang is almost c++ iso-ready, i think its possible for c++ code analysis tools to begin using the c++ parser effectively, since it has been designed from the ground up precisely for this so i'm wondering if there are existing open source or known commercial projects taking this path, integrating with clang to provide higher-level analysis tools?

    Read the article

  • are there compiler options in clang? [on hold]

    - by Deohboeh
    I am learning from The C++ Primer. One of the exercises is to compile a program with arguments in main(). For this I am trying to use mac terminal. I need to compile a C++11 Unix executable file named "main" which takes “f" as an argument. I am using Xcode 4.6.3 on OS X Lion. I compiled the program with clang++ -std=c++11 -stdlib=libc++ main.cpp -o main. But don’t know what to do next. I found -frecord-gcc-switches while searching compiler options on google. It does what I need to do. Is there a clang version of this? Please use simple language. I have never used command line before. I tried going through the clang user guide but a lot of it is out of my depth.

    Read the article

  • Clang warning flags for Objective-C development

    - by Macmade
    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 I have a really good reason not to turn it on. I personally think this may actually improve coding skills, as well as potential code portability, prevent some issues, as it forces you to be aware of every little detail, potential implementation and architecture issues, and so on... It's also in my opinion a good every day learning tool, even if you're an experienced programmer. For the subjective part of this question, I'm interested in hearing other developers (mainly C, Objective-C and C++) about this topic. Do you actually care about stuff like pedantic warnings, etc? And if yes or no, why? Now about Objective-C, I recently completely switched to the LLVM toolchain (with Clang), instead of GCC. On my production code, I usually set this warning flags (explicitly, even if some of them may be covered by -Wall): -Wall -Wbad-function-cast -Wcast-align -Wconversion -Wdeclaration-after-statement -Wdeprecated-implementations -Wextra -Wfloat-equal -Wformat=2 -Wformat-nonliteral -Wfour-char-constants -Wimplicit-atomic-properties -Wmissing-braces -Wmissing-declarations -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wnewline-eof -Wold-style-definition -Woverlength-strings -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wshorten-64-to-32 -Wsign-compare -Wsign-conversion -Wstrict-prototypes -Wstrict-selector-match -Wswitch -Wswitch-default -Wswitch-enum -Wundeclared-selector -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings I'm interested in hearing what other developers have to say about this. For instance, do you think I missed a particular flag for Clang (Objective-C), and why? Or do you think a particular flag is not useful (or not wanted at all), and why?

    Read the article

  • Compiling GCC or Clang for thumb drive on OSX

    - by user105524
    I have a mac book that I don't have admin rights to which I would like to be able to use either GCC or clang. Since I lack admin right I can't install binutils or a compiler to /usr directory. My plan is to install both of these (using an old macbook that I do have admin rights for) to a flash drive and then run the compiler off of there. How would one go building gcc or clang so that it could run just off of a thumb drive? I've tried both but haven't had any success. I've tried doing it defining as many of the directories as possible through configure, but haven't been able to successfully build. My current configure script for gcc-4.8.1 is (where USB20D is the thumb drive): ../gcc-4.8.1/configure --prefix=/Volumes/USB20FD/usr \ --with-local-prefix=/Volumes/USB20FD/usr/local \ --with-native-system-header-dir=/Volumes/USB20FD/usr/include \ --with-as=/Volumes/USB20FD/usr/bin/as \ --enable-languages=c,c++,fortran\ --with-ld=/Volumes/USB20FD/usr/bin/ld \ --with-build-time-tools=/Volumes/USB20FD/usr/bin \ AR=/Volumes/USB20FD/usr/bin/ar \ AS=/Volumes/USB20FD/usr/bin/as \ RANLIB=/Volumes/USB20FD/usr/bin/ranlib \ LD=/Volumes/USB20FD/usr/bin/ld \ NM=/Volumes/USB20FD/usr/bin/nm \ LIPO=/Volumes/USB20FD/usr/bin/lipo \ AR_FOR_TARGET=/Volumes/USB20FD/usr/bin/ar \ AS_FOR_TARGET=/Volumes/USB20FD/usr/bin/as \ RANLIB_FOR_TARGET=/Volumes/USB20FD/usr/bin/ranlib \ LD_FOR_TARGET=/Volumes/USB20FD/usr/bin/ld \ NM_FOR_TARGET=/Volumes/USB20FD/usr/bin/nm \ LIPO_FOR_TARGET=/Volumes/USB20FD/usr/bin/lipo CFLAGS=" -nodefaultlibs -nostdlib -B/Volumes/USB20FD/bin -isystem/Volumes/USB20FD/usr/include -static-libgcc -v -L/Volumes/USB20FD/usr/lib " \ LDFLAGS=" -Z -lc -nodefaultlibs -nostdlib -L/Volumes/USB20FD/usr/lib -lgcc -syslibroot /Volumes/USB20FD/usr/lib/crt1.10.6.o " Any obvious ideas of which of these options need to be turned on to install the appropriate files on the thumb drive during installation? What other magic occurs during xcode installation which isn't occurring here? Thanks for any suggestions

    Read the article

  • Clang Static Analyzer for xcode for dummies

    - by dubbeat
    Hi, Could somebody please help me get Clang up and running? (I don't have 3.2) I've followed numerous tutorials (basically every link off of this page http://stackoverflow.com/questions/961844/using-clang-static-analyzer-from-within-xcode) but I just cant get it to work! The only thing I've managed to do successfully so far is download clang! Grrrr .... dubbeat smash! Bear in mind I've never written an apple script before. I have clang on my desktop

    Read the article

  • llvm/clang re-compilation with itself

    - by teppic
    After reading many questions on here, I decided to give clang a go, and installed the svn version on Ubuntu 12.04 (64bit). I was expecting issues, but it all installed smoothly with no warnings. I noticed though that when re-running the configure script, if clang/clang++ is in your path it will choose this over gcc/g++ for its own compilation. Is it a good idea to recompile llvm/clang with itself? I know this is absolutely standard with gcc, but I've read that clang's C++ implementation isn't quite good enough yet (maybe this is out of date info...).

    Read the article

  • Using clang to analyze C++ code

    - by aneccodeal
    We want to do some fairly simple analysis of user's C++ code and then use that information to instrument their code (basically regen their code with a bit of instrumentation code) so that the user can run a dynamic analysis of their code and get stats on things like ranges of values of certain numeric types. clang should be able to handle enough C++ now to handle the kind of code our users would be throwing at it - and since clang's C++ coverage is continuously improving by the time we're done it'll be even better. So how does one go about using clang like this as a standalone parser? We're thinking we could just generate an AST and then walk it looking for objects of the classes we're interested in tracking. Would be interested in hearing from others who are using clang without LLVM.

    Read the article

  • How to preserve struct member identifiers when compiling to LLVM IR with Clang?

    - by smokris
    Say I have the following C structure definition: struct stringStructure { char *stringVariable; }; For the above, Clang produces the following LLVM IR: %struct.stringStructure = type { i8* } ...which includes everything in my definition except the variable identifier stringVariable. I'd like to find some way to export the identifier into the generated LLVM IR, so that I can refer to it by name from my application (which uses the LLVM C++ API). I've tried adding the annotate attribute, as follows: char *stringVariable __attribute__((annotate("stringVariable"))); ...but the annotation doesn't seem to make it through (the structure is still just defined as type { i8* }). Any ideas?

    Read the article

  • How can I fix this clang warning: "Object with +0 retain counts returned to caller where +1 (owning)

    - by mipadi
    I have a piece of Objective-C code that looks like the following: - (NSString *)copyData:(NSData *)data { NSString *path = [[[self outputDirectory] stringByAppendingPathComponent:@"archive"] stringByAppendingPathExtension:@"zip"]; NSLog(@"Copying data to %@", path); [data writeToFile:path atomically:NO]; return path; } The code is called from an initializer that looks like this: - (id)initWithData:(NSData *)data { if ((self = [super init]) != nil) { NSString *path = [self copyData:data]; // Line 41 (referenced in warning, shown below) return [self initWithContentsOfFile:path]; } return self; } When running the clang static analyzer, I get the following warnings for the path variable: Potential leak of an object allocated on line 41 and stored into 'path' Object with +0 retain counts returned to caller where +1 (owning) retain count is expected I'm confused. My understanding is that stringByAppendingPathComponent should not return an autoreleased string, so it should have a net retain count of 0. (Obviously I don't want to retain it.) I've tried altering copyData: to return the following, but it didn't get rid of the warning: return [[path retain] autorelease]; So what's the deal with this warning?

    Read the article

  • Additional macro support in clang?

    - by anon
    Since LLVM/cLang is especially well designed. This seems like a great opportunity to augment the C/C++ macro/preprocessor system. Does anyone know of additional macro/preprocessor abilities added by Clang or side projects to make the macro system more powerful (like turing complete) Thakns! Note: I am asking about macros. Not C++ templates. Readers: pleaser downvote any answers referring to templates. I want this thread to be macro/preprocessor specific.

    Read the article

  • Recommended Clang command line options

    - by frou
    The Manual for Clang seems to be work in progress, so could you help me formulate the definitive command line options for compiling ANSI-C (AKA C89, C90) with maximum strictness and relevant/helpful warnings? Clang is a compiler front end for the C, C++, and Objective-C programming languages. It uses the Low Level Virtual Machine (LLVM) as its back end. It is still under development. Its goal is to offer a replacement to the GNU Compiler Collection (GCC)

    Read the article

  • iPhone static library Clang/LLVM error: non_lazy_symbol_pointers

    - by Bekenn
    After several hours of experimentation, I've managed to reduce the problem to the following example (C++): extern "C" void foo(); struct test { ~test() { } }; void doTest() { test t; // 1 foo(); // 2 } This is being compiled for iOS devices in XCode 4.2, using the provided Clang compiler (Apple LLVM compiler 3.0) and the iOS 5.0 SDK. The project is configured as a Cocoa Touch Static Library, and "Enable Linking With Shared Libraries" is set to No because I'm building an AIR native extension. The function foo is defined in another external library. (In my actual project, this would be any of the C API functions defined by Adobe for use in AIR native extensions.) When attempting to compile this code, I get back the error: FATAL:incompatible feature used: section type non_lazy_symbol_pointers (must specify "-dynamic" to be used) clang: error: assembler command failed with exit code 1 (use -v to see invocation) The error goes away if I comment out either of the lines marked 1 or 2 above, or if I change the build setting "Enable Linking With Shared Libraries" to Yes. (However, if I change the build setting, then I get multiple ld warning: unexpected srelocation type 9 warnings when linking the library into the final project, and the application crashes when running on the device.) The build error also goes away if I remove the destructor from test. So: Is this a bug in Clang? Am I missing some all-important and undocumented build setting? The interaction between an externally-provided function and a struct with a destructor is very peculiar, to say the least.

    Read the article

  • clang parser pass example

    - by anon
    Hi! Can anyone paste sample code for a clang extra preprocessor pass where it: takes every variable named "foo", and renames it "bar", thus making the following code legal: int main() { int foo; bar = 5; } ? Thanks! [Aside: what I'm trying to do is write my own macro system for clang. Doing the above will let me inject at the right level to do my rewrites.] Thanks!

    Read the article

  • tail call generated by clang 1.1 and 1.0 (llvm 2.7 and 2.6)

    - by ony
    After compilation next snippet of code with clang -O2 (or with online demo): #include <stdio.h> #include <stdlib.h> int flop(int x); int flip(int x) { if (x == 0) return 1; return (x+1)*flop(x-1); } int flop(int x) { if (x == 0) return 1; return (x+0)*flip(x-1); } int main(int argc, char **argv) { printf("%d\n", flip(atoi(argv[1]))); } I'm getting next snippet of llvm assembly in flip: bb1.i: ; preds = %bb1 %4 = add nsw i32 %x, -2 ; <i32> [#uses=1] %5 = tail call i32 @flip(i32 %4) nounwind ; <i32> [#uses=1] %6 = mul nsw i32 %5, %2 ; <i32> [#uses=1] br label %flop.exit I thought that tail call means dropping current stack (i.e. return will be to the upper frame, so next instruction should be ret %5), but according to this code it will do mul for it. And in native assembly there is simple call without tail optimisation (even with appropriate flag for llc) Can sombody explain why clang generates such code? As well I can't understand why llvm have tail call if it can simply check that next ret will use result of prev call and later do appropriate optimisation or generate native equivalent of tail-call instruction?

    Read the article

  • Clang LLVM doesn't generate warnings in Xcode

    - by John Gallagher
    I want lots of lovely warnings when compiling. I've set my build configuration to be based on a build config file I have. When I switch to GCC 4.0, it generates all the required warnings. As soon as I change to the Clang LLVM compiler, all the warnings disappear. Every other setting is identical. What am I missing?

    Read the article

  • c++ g++ llvm-clang compiler profiling

    - by anon
    Note, my question is not: how do I tell my compiler to compile with profiling on. I want to profile my compiles process. For each file, I'd like to know how much time is spent on each line of the program. I'm working on a project, some files have huge compile times, I'm trying to figure out why. Is there anyway to do this with g++ or llvm-clang? Thanks!

    Read the article

  • CLang error (objective C): value stored during initialization is never read

    - by Scott Pendleton
    Foo *oFoo = [[[Foo alloc] init] autorelease]; This is how I was taught to program in Objective C, yet the CLang error checker complains that the initial value was never read. But oFoo is an object with properties. oFoo itself has no single value. The property values are what matter. oFoo.PropertyA = 1; oFoo.PropertyB = @"Hello, World." Should I just ignore this? Is this worth fixing? What is the fix, seeing that "initial value" is meaningless in my context?

    Read the article

  • Figuring Out Memory Leaks without Clang

    - by RoLYroLLs
    I'm trying to see if I can find some leaks myself in Apple's TopSongs app. Can someone help me out in at least one and how to identify what is in the Leaks reports and how I can get an idea on finding them? ie: I got one like this: # Category Event Type Timestamp Address Size Responsible Library Responsible Caller 0 GeneralBlock-448 Malloc 00:02.185 0x3f41220 448 libxml2.2.dylib xmlNewParserCtxt From what I can tell, the method xmlNewParserCtxt is the problem, and it's not releasing an object, hence Malloc. The responsible library tells me it's the libxml2.2.dylib library with the problem, which I can't edit. Am I heading in the right direction? If so, half the leaks are in that library and well, i can't edit that.

    Read the article

  • Memory leak found with clang but cant release and autorelease crashes

    - by Rudiger
    I have a class that builds a request based on a few passed in variables. The class also has all the delegate methods to receive the data and stores it in a property for the calling class to retrieve. When the class initializes it creates a connection and then returns itself: NSURLConnection *connection; if (self = [super init]) { self.delegate = theDelegate; ...some code here... connection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self startImmediately:YES]; } return self; So I can't release it normally and if I autorelease it crashes. Is it the job of the calling class to release? And if so does just releasing the initilised object also release connection or do you have to release it specifically? If so how would you? Thanks

    Read the article

  • What predefined macro can I use to detect clang ?

    - by Pierre Bourdon
    I'm trying to detect the compiler used to compile my source code. I can easily find predefined macros to check for MSVC or GCC (see http://predef.sourceforge.net/ for example), but I cannot find any macro to check for clang. Does someone know if clang defines a macro like __CLANG__ in order to know what is currently compiling my code ?

    Read the article

  • Xcode 3.2: Build & Analyze never finds any issues

    - by GamingHorror
    I've used the Clang Static Analyzer from the command line before. I wanted to try Xcode's built-in version via Build & Analyze. I never get any negative results even though i specially prepared my code with very obvious issues Clang was always able to point out: // over-releasing an object: [label release]; [label release]; // uninitialized vars, allocating but not freeing an object NSString* str; int number; CCLabel* newLabel = [[CCLabel alloc] initWithString:str fontName:str fontSize:number]; [newLabel setPosition:CGPointZero]; The result is always the same: a green checkbox, no issues. I read that C++ code can cause issues. I'm running this with cocos2d that includes box2d. Could this be a cause? Did anyone get results from Build & Analyze with the cocos2d engine? What else could it be? I also tried enabling the Static Analyzer Build Settings and then Build but the result was the same. I have restarted Xcode, cleaned all targets and emptied Xcode caches to no avail.

    Read the article

1 2 3 4 5  | Next Page >