Dynamic forwarding: suppress Incomplete Implementation warning

You can suppress Incomplete Implementation warnings by adding #pragma clang diagnostic ignored “-Wincomplete-implementation” just above the @implementation Hope this helps EDIT After being told in the comments that this didn’t work for someone and finding out the reason was because it was a different warning they were getting I have done a bit of playing … Read more

How to use my own Android.mk file with Android Studio

yes, by default the gradle android plugin regenerates and uses its own Android.mk file to compile your sources. You can deactivate this and use your own Android.mk file instead, by setting this inside your build.gradle configuration file: import org.apache.tools.ant.taskdefs.condition.Os … android { … sourceSets.main { jniLibs.srcDir ‘src/main/libs’ //set libs as .so’s location instead of jniLibs … Read more

How to make clang compile to llvm IR

Given some C/C++ file foo.c: > clang -S -emit-llvm foo.c Produces foo.ll which is an LLVM IR file. The -emit-llvm option can also be passed to the compiler front-end directly, and not the driver by means of -cc1: > clang -cc1 foo.c -emit-llvm Produces foo.ll with the IR. -cc1 adds some cool options like -ast-print. … Read more

Is there some literal dictionary or array syntax in Objective-C?

With this change to the LLVM codebase, Apple has added a new syntax for literals in upcoming versions of the Clang compiler. Before, arrays were created using a C-based array and were converted on the fly into Objective-C objects, such as: NSArray* array = [NSArray arrayWithObjects: @”One”, @”Two”, @”Three”, nil]; Note that since this is … Read more

Switching between GCC and Clang/LLVM using CMake

CMake honors the environment variables CC and CXX upon detecting the C and C++ compiler to use: $ export CC=/usr/bin/clang $ export CXX=/usr/bin/clang++ $ cmake .. — The C compiler identification is Clang — The CXX compiler identification is Clang The compiler specific flags can be overridden by putting them into a make override file … Read more

Enable OpenMP support in clang in Mac OS X (sierra & Mojave)

Try using Homebrew‘s llvm: brew install llvm You then have all the llvm binaries in /usr/local/opt/llvm/bin. Compile the OpenMP Hello World program. Put omp_hello.c /****************************************************************************** * FILE: omp_hello.c * DESCRIPTION: * OpenMP Example – Hello World – C/C++ Version * In this simple example, the master thread forks a parallel region. * All threads in … Read more