<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-9"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
span.EmailStyle18
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        font-family:"Calibri","sans-serif";
        mso-ligatures:none;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1298291516;
        mso-list-type:hybrid;
        mso-list-template-ids:1233054812 -20922988 69140483 69140485 69140481 69140483 69140485 69140481 69140483 69140485;}
@list l0:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:"Times New Roman";}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=TR link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US>Hello everyone,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>I’m trying to develop a tool based on cmake and I have couple of problems. I’ll be really happy if anyone would help me. </span><span lang=EN-US style='font-family:Wingdings'>J</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>In our project we have a custom c++ reflection library and we are using it pretty much everywhere. Our developer uses a simple tool to generate type information from header files. It is a very simple tool which requires ugly syntax (I’m not fond of it) in source code.  Therefore we have decided to replaced it with an source to source transformation tool based on cmake. We have developed the tool simply by using CompilerInstance and ASTConsumer which is pretty neat and simple. :D It works perfectly in our test inputs.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>The tool works perfectly and is going to improve our code quality massively. However the problem is when we have tried to use our new tool in our actual project code. It produces tremendous amounts of error output in system headers. (crtlib, ostream, string) Our main development platform is Windows and Visual Studio 2010. When I tried to compile the actual project code in clang.exe it compiled the files perfectly fine. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>So I have looked out for a way to make our tool behave more like clang.exe;<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo2'><![if !supportLists]><span lang=EN-US style='font-family:Symbol'><span style='mso-list:Ignore'>·<span style='font:7.0pt "Times New Roman"'>         </span></span></span><![endif]><span lang=EN-US>I have tried to set CompilerInstance options manually. I have compiled target code with clang.exe –v and tried to match the clangs.exe’s default options in the tool’s source code. I have achieved some progress but not fully get rid of the errors.<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo2'><![if !supportLists]><span lang=EN-US style='font-family:Symbol'><span style='mso-list:Ignore'>·<span style='font:7.0pt "Times New Roman"'>         </span></span></span><![endif]><span lang=EN-US>I have tried tooling library. But I could not get it working.<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo2'><![if !supportLists]><span lang=EN-US style='font-family:Symbol'><span style='mso-list:Ignore'>·<span style='font:7.0pt "Times New Roman"'>         </span></span></span><![endif]><span lang=EN-US>I have tried to reverse engineer frondend, driver and clang code. But I got stuck.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>So, my question is how can I automatically configure my CompilerInstance for my platform ? (Include paths, compiler definitions, compiler options, preprocessor options, language options) Is there a way, function, class or mechanism that automatically configures CompilerInstance ?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Here is my actual code;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>int</span><span style='font-size:9.5pt;font-family:Consolas'> <span style='color:#010001'>main_compiler_instance</span>(<span style='color:blue'>int</span> <span style='color:#010001'>argc</span>, <span style='color:blue'>const</span> <span style='color:blue'>char</span>** <span style='color:#010001'>argv</span>)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>{<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>CompilerInstance</span> <span style='color:#010001'>Compiler</span>;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>createDiagnostics</span>(0, <span style='color:#010001'>NULL</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>TargetOptions</span> <span style='color:#010001'>to</span>;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>to</span>.<span style='color:#010001'>Triple</span> = <span style='color:#010001'>llvm</span>::<span style='color:#010001'>sys</span>::<span style='color:#010001'>getDefaultTargetTriple</span>();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>TargetInfo</span> *<span style='color:#010001'>pti</span> = <span style='color:#010001'>TargetInfo</span>::<span style='color:#010001'>CreateTargetInfo</span>(<span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getDiagnostics</span>(), <span style='color:#010001'>to</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>setTarget</span>(<span style='color:#010001'>pti</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getPreprocessorOpts</span>().<span style='color:#010001'>UsePredefines</span> = <span style='color:blue'>false</span>;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getLangOpts</span>().<span style='color:#010001'>CPlusPlus</span> = 1;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getLangOpts</span>().<span style='color:#010001'>Bool</span> = 1;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getLangOpts</span>().<span style='color:#010001'>MSCVersion</span> = 1300;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getLangOpts</span>().<span style='color:#010001'>MicrosoftExt</span> = 1;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getLangOpts</span>().<span style='color:#010001'>MicrosoftMode</span> = 1;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getLangOpts</span>().<span style='color:#010001'>CPlusPlus0x</span> = 1;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getLangOpts</span>().<span style='color:#010001'>ShortWChar</span> = 1;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getLangOpts</span>().<span style='color:#010001'>Exceptions</span> = 1;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getLangOpts</span>().<span style='color:#010001'>CXXExceptions</span> = 1;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getLangOpts</span>().<span style='color:#010001'>DelayedTemplateParsing</span> = 1;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getLangOpts</span>().<span style='color:#010001'>MathErrno</span> = 1;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getHeaderSearchOpts</span>().<span style='color:#010001'>ResourceDir</span> = <span style='color:#A31515'>"c:/llvm/bin\\..\\lib\\clang\\3.2"</span>;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getHeaderSearchOpts</span>().<span style='color:#010001'>AddPath</span>(<span style='color:#A31515'>"c:/llvm/bin/../lib/clang/3.2/include"</span>, <span style='color:#010001'>frontend</span>::<span style='color:#010001'>System</span>, <span style='color:blue'>false</span>, <span style='color:blue'>false</span>, <span style='color:blue'>true</span>, <span style='color:blue'>true</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getHeaderSearchOpts</span>().<span style='color:#010001'>AddPath</span>(<span style='color:#A31515'>"C:\\Program Files (x86)\\Microsoft SDKs\Windows\v7.0A\Include"</span>, <span style='color:#010001'>frontend</span>::<span style='color:#010001'>System</span>, <span style='color:blue'>false</span>, <span style='color:blue'>false</span>, <span style='color:blue'>true</span>, <span style='color:blue'>true</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getHeaderSearchOpts</span>().<span style='color:#010001'>AddPath</span>(<span style='color:#A31515'>"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\include"</span>, <span style='color:#010001'>frontend</span>::<span style='color:#010001'>System</span>, <span style='color:blue'>false</span>, <span style='color:blue'>false</span>, <span style='color:blue'>true</span>, <span style='color:blue'>true</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getHeaderSearchOpts</span>().<span style='color:#010001'>AddPath</span>(<span style='color:#A31515'>"C:\\Users\\Orcun\\Desktop\\ZEPrototypes\\Source"</span>, <span style='color:#010001'>frontend</span>::<span style='color:#010001'>Quoted</span>, <span style='color:blue'>false</span>, <span style='color:blue'>false</span>, <span style='color:blue'>true</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getHeaderSearchOpts</span>().<span style='color:#010001'>AddPath</span>(<span style='color:#A31515'>"C:\\Users\\Orcun\\Desktop\\ZEPrototypes\\Source\\ZEFoundation"</span>, <span style='color:#010001'>frontend</span>::<span style='color:#010001'>Quoted</span>, <span style='color:blue'>false</span>, <span style='color:blue'>false</span>, <span style='color:blue'>true</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getHeaderSearchOpts</span>().<span style='color:#010001'>AddPath</span>(<span style='color:#A31515'>"C:\\Users\\Orcun\\Desktop\\ZEPrototypes\\Source\\ZECodeGenerator"</span>, <span style='color:#010001'>frontend</span>::<span style='color:#010001'>Quoted</span>, <span style='color:blue'>false</span>, <span style='color:blue'>false</span>, <span style='color:blue'>true</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getPreprocessorOpts</span>().<span style='color:#010001'>addMacroDef</span>(<span style='color:#A31515'>"_WIN32"</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getPreprocessorOpts</span>().<span style='color:#010001'>addMacroDef</span>(<span style='color:#A31515'>"_WINDOWS"</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getPreprocessorOpts</span>().<span style='color:#010001'>addMacroDef</span>(<span style='color:#A31515'>"_WCHAR_T_DEFINED"</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>createFileManager</span>();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>createSourceManager</span>(<span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getFileManager</span>());<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>createPreprocessor</span>();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>setASTConsumer</span>(<span style='color:blue'>new</span> ZE<span style='color:#010001'>CodeGeneratorASTConsumer</span>());<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>createASTContext</span>();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:blue'>const</span> <span style='color:#010001'>FileEntry</span> *<span style='color:#010001'>pFile</span> = <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getFileManager</span>().<span style='color:#010001'>getFile</span>(<span style='color:#010001'>argv</span>[1]);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getSourceManager</span>().<span style='color:#010001'>createMainFileID</span>(<span style='color:#010001'>pFile</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getDiagnosticClient</span>().<span style='color:#010001'>BeginSourceFile</span>(<span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getLangOpts</span>(), &<span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getPreprocessor</span>());<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>ParseAST</span>(<span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getPreprocessor</span>(), &<span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getASTConsumer</span>(), <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getASTContext</span>(), <span style='color:blue'>false</span>, <span style='color:#010001'>clang</span>::<span style='color:#010001'>TU_Complete</span>, <span style='color:#010001'>NULL</span>, <span style='color:blue'>true</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>Compiler</span>.<span style='color:#010001'>getDiagnosticClient</span>().<span style='color:#010001'>EndSourceFile</span>();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:blue'>return</span> 1;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>}<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>#include</span><span style='font-size:9.5pt;font-family:Consolas'> <span style='color:#A31515'>"clang/Tooling/Tooling.h"</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>#include</span><span style='font-size:9.5pt;font-family:Consolas'> <span style='color:#A31515'>"llvm/Support/CommandLine.h"</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>#include</span><span style='font-size:9.5pt;font-family:Consolas'> <span style='color:#A31515'>"clang/Tooling/CompilationDatabase.h"</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>using</span><span style='font-size:9.5pt;font-family:Consolas'> <span style='color:blue'>namespace</span> <span style='color:#010001'>clang</span>::<span style='color:#010001'>tooling</span>;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>using</span><span style='font-size:9.5pt;font-family:Consolas'> <span style='color:blue'>namespace</span> <span style='color:#010001'>llvm</span>;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>int</span><span style='font-size:9.5pt;font-family:Consolas'> <span style='color:#010001'>main_tooling</span>(<span style='color:blue'>int</span> <span style='color:#010001'>argc</span>, <span style='color:blue'>const</span> <span style='color:blue'>char</span> **<span style='color:#010001'>argv</span>) <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>{<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>FixedCompilationDatabase</span>* <span style='color:#010001'>Database</span> = <span style='color:#010001'>FixedCompilationDatabase</span>::<span style='color:#010001'>loadFromCommandLine</span>(<span style='color:#010001'>argc</span>, <span style='color:#010001'>argv</span>); //Actually I’m not pretty sure what it does.<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:#010001'>ClangTool</span> <span style='color:#010001'>Tool</span>(*<span style='color:#010001'>Database</span>, <span style='color:#010001'>Database</span>-><span style='color:#010001'>getAllFiles</span>());<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:blue'>return</span> <span style='color:#010001'>Tool</span>.<span style='color:#010001'>run</span>(<span style='color:#010001'>newFrontendActionFactory</span><ZE<span style='color:#010001'>CodeGeneratorFrontendAction</span>>());<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>}<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>int</span><span style='font-size:9.5pt;font-family:Consolas'> <span style='color:#010001'>main</span>(<span style='color:blue'>int</span> <span style='color:#010001'>argc</span>, <span style='color:blue'>const</span> <span style='color:blue'>char</span>** <span style='color:#010001'>argv</span>)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>{<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:green'>/* Select one of them */</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       <span style='color:green'>//main_compiler_instance(argc, argv);</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>       //<span style='color:#010001'>main_tooling</span>(<span style='color:#010001'>argc</span>, <span style='color:#010001'>argv</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>}<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>And here is the command line options that I use: ZEMeta.cpp -I ..\ZEFoundation -I ..<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>“main_tooling” function does not work because “</span><span style='font-size:9.5pt;font-family:Consolas;color:#010001'>FixedCompilationDatabase</span><span style='font-size:9.5pt;font-family:Consolas'>::<span style='color:#010001'>loadFromCommandLine</span>(<span style='color:#010001'>argc</span>, <span style='color:#010001'>argv</span>);” </span><span lang=EN-US>function return NULL. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>I have appended output log of “main_compiler_instance” function at the end of this email. Output log is very big (256+ KB) so I have removed some of the errors. When compiling the ZEMeta.cpp with clang.exe It does not produces these errors.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Thanks to anyone has read this long email and have a nice day,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Orcun.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Note: My native language is not English. Therefore, I’m sorry if I could not express myself clearly or correctly.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>--- Output Log ---<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from ZEMeta.h:2:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Users\Orcun\Desktop\ZEPrototypes\Source\ZEFoundation\ZEDS/ZEArray.h:66:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Users\Orcun\Desktop\ZEPrototypes\Source\ZEFoundation\ZEError.h:41:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Users\Orcun\Desktop\ZEPrototypes\Source\ZEFoundation/ZELog.h:5:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Users\Orcun\Desktop\ZEPrototypes\Source\ZEFoundation/ZEDS/ZEString.h:40:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\istream:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ios:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocnum:10:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\streambuf:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xiosbase:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale:8:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdexcept:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\exception:38:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\eh.h:58:53: error: unknown type name 'type_info'<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>_CRTIMP int __cdecl _is_exception_typeof(_In_ const type_info &_Type, _In_ struct _EXCEPTION_POINTERS * _ExceptionPtr);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from ZEMeta.h:2:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Users\Orcun\Desktop\ZEPrototypes\Source\ZEFoundation\ZEDS/ZEArray.h:66:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Users\Orcun\Desktop\ZEPrototypes\Source\ZEFoundation\ZEError.h:41:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Users\Orcun\Desktop\ZEPrototypes\Source\ZEFoundation/ZELog.h:5:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Users\Orcun\Desktop\ZEPrototypes\Source\ZEFoundation/ZEDS/ZEString.h:40:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\istream:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ios:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocnum:10:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\streambuf:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xiosbase:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale:8:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdexcept:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\exception:39:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\malloc.h:187:40: error: use of undeclared identifier '_ALLOCA_S_MARKER_SIZE'<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>_STATIC_ASSERT(sizeof(unsigned int) <= _ALLOCA_S_MARKER_SIZE);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>                                       ^<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\malloc.h:43:63: note: expanded from macro '_STATIC_ASSERT'<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>#define _STATIC_ASSERT(expr) typedef char __static_assert_t[ (expr) ]<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from ZEMeta.h:2:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Users\Orcun\Desktop\ZEPrototypes\Source\ZEFoundation\ZEDS/ZEArray.h:66:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Users\Orcun\Desktop\ZEPrototypes\Source\ZEFoundation\ZEError.h:41:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Users\Orcun\Desktop\ZEPrototypes\Source\ZEFoundation/ZELog.h:5:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Users\Orcun\Desktop\ZEPrototypes\Source\ZEFoundation/ZEDS/ZEString.h:40:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\istream:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ios:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocnum:10:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\streambuf:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xiosbase:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale:8:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdexcept:7:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstring:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xmemory:8:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility:8:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility:9:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\type_traits:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\limits:182:22: error: use of undeclared identifier '__FLT_RADIX__'<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>        _STCONS(int, radix, FLT_RADIX);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from ZEMeta.h:2:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Users\Orcun\Desktop\ZEPrototypes\Source\ZEFoundation\ZEDS/ZEArray.h:66:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Users\Orcun\Desktop\ZEPrototypes\Source\ZEFoundation\ZEError.h:41:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Users\Orcun\Desktop\ZEPrototypes\Source\ZEFoundation/ZELog.h:5:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Users\Orcun\Desktop\ZEPrototypes\Source\ZEFoundation/ZEDS/ZEString.h:40:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\istream:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ios:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocnum:10:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\streambuf:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xiosbase:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale:8:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdexcept:7:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstring:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xmemory:8:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility:8:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility:9:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\type_traits:6:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\limits:27:61: note: expanded from macro '_STCONS'<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>#define _STCONS(ty, name, val) static const ty name = (ty)(val)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>                                                            ^<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\limits:240:23: error: use of undeclared identifier '__CHAR_BIT__'<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>        _STCONS(int, digits, CHAR_BIT - (CHAR_MIN != 0 ? 1 : 0));<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\limits:1467:15: error: default initialization of an object of const type 'const int'<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>        _STCONS(int, digits, CHAR_BIT);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\limits:1490:15: error: no member named 'digits10' in 'std::numeric_limits<unsigned short>'<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>        _STCONS(int, digits10, (CHAR_BIT * sizeof (unsigned short) - 1)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>C:\Users\Orcun\Desktop\ZEPrototypes\Source\ZEFoundation/ZEDS/ZEString.h:233:74: error: expected expression<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>                static ZEString                         FromUInt64(ZEUInt64 Value, const char* Format = NULL); <o:p></o:p></span></p></div></body></html>