Under what conditions is @synthesize automatic in Objective-c?

As of clang 3.2 (circa February 2012), “default synthesis” (or “auto property synthesis”) of Objective-C properties is provided by default. It’s essentially as described in the blog post you originally read: http://www.mcubedsw.com/blog/index.php/site/comments/new_objective-c_features/ (except that that post describes the feature as “enabled, then disabled”; I don’t know if that’s an issue with Xcode or if the … Read more

How to tell Clang to stop pretending to be other compilers?

__GNUC__ doesn’t mean GCC specifically. All compilers that support GNU C extensions define it, including clang and ICC. The normal way to detect specifically GCC is by excluding other “compatible” compilers #if defined(__GNUC__) && !defined(__llvm__) && !defined(__INTEL_COMPILER) #define REAL_GCC __GNUC__ // probably #endif The Clang front-end defines __clang__, but other front-ends that use the LLVM … Read more

Functional languages targeting the LLVM

There’s a Haskell (GHC) backend targeting the LLVM. You could also try using F# through Mono-LLVM. Also, the VMKit project is implementing both the JVM and the .NET CLI on top of LLVM; it’s still in its early stages but once it matures you could use it with F#, or any JVM-targeting functional languages (Scala, … Read more

Does libcxxabi makes sense under linux? What are the benefits?

You should not use libcxxabi directly. To my understanding it is a kind of platform abstraction library, providing low level functions needed to implement libcxx. If you are asking about using libcxx or libstdc++, the differences are mostly the license, newer standard version completeness (the clang project seems slightly faster in implementing recent C++ revisions) … Read more

Having LLVM IR library how to crosscompile it to iOS, Android, Windows and Mac from Ubuntu?

Using the LLVM static compiler (llc), you can compile the LLVM IR into object files for a specific target triple. Though the target triples are not documented very well, the LLVM infrastructure is all open source, so a quick search through the source code will lead you here. Unfortunately, there is no documentation for a … Read more

Xcode 3.2.1 GCC CLANG and LLVM demystification

In a nutshell: Compilers are basically split into two parts. One being the front-end that contains the parser and semantic analysis for the programming language. The front-end produces some kind of intermediate representation of your code. Then there’s the backend which takes the stuff the front-end produced, optimizes it, and eventually generates assembly code. GCC: … Read more

What are the differences between LLVM bitcode and Java bytecode?

Assuming you mean JVM rather than Java: The LLVM is a low level register-based virtual machine. It is designed to abstract the underlying hardware and draw a clean line between a compiler back-end (machine code generation) and front-end (parsing, etc.). The JVM is a much higher level stack-based virtual machine. The JVM provides garbage collection, … Read more

How does clang generate non-looping code for sum of squares?

TL:DR: Yes, clang knows the closed-form formulas for sums of integer power series, and can detect such loops. Smart humans have taught modern compilers to recognize certain patterns of operations and replace them with operations not present in the source, e.g. for rotates and even popcount loops and bithacks. And for clang/LLVM specifically, also closed-form … Read more