title: How to detect LLVM and its version through #define directives?
body: <p>The question is quite clear I think. I'm trying to write a compiler detection header to be able to include in the application information on which compiler was used and which version.</p>
  
  <p>This is part of the code I'm using:</p>
  
  <pre><code>/* GNU C Compiler Detection */
  #elif defined __GNUC__
      #ifdef __MINGW32__
          #define COMPILER "MinGW GCC %d.%d.%d"
      #else
          #define COMPILER "GCC %d.%d.%d"
      #endif
      #define COMP_VERSION __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__
  #endif
  </code></pre>
  
  <p>Which could be used like this:</p>
  
  <pre><code>printf("  Compiled using " COMPILER "\n", COMP_VERSION);
  </code></pre>
  
  <p>Is there any way to detect LLVM and its version? And CLANG?</p>