title: Generate an optimized AST using clang and libclang
body: <p>I want to apply clang optimizations to a source file then generate its AST.
  I tried passing <code>-O3</code> flag but it seems that it is ignored.</p>
  
  <p>For example I assume that for this snipped of program:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main(void) {
    int a = 5 + 5;
    for (int i = 0; i &lt; 10; i++) { }
    printf("%i\n", a);
    return 0;
  }
  </code></pre>
  
  <p>Many optimizations can be applied, like removing the for loop converting 5 + 5 to 10.</p>
  
  <p>When I dump the AST using <code>clang -O3 -Xclang -ast-dump -fsyntax-only a.c</code> I get the same AST without the optimization flag.</p>
  
  <p>My goal is create a TranslationUnit with flag optimizations passed.</p>