<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=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@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:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
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;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        mso-fareast-language:RU;}
span.gmail-stdout
        {mso-style-name:gmail-stdout;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></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="RU" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">I was not able to reproduce the issue, so I reverted the commit (new revision is 347129).  Again, sorry for the inconvenience.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Slava<o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></a></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><a name="_____replyseparator"></a><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Zakharin, Vyacheslav P
<br>
<b>Sent:</b> Friday, November 16, 2018 5:12 PM<br>
<b>To:</b> 'Vitaly Buka' <vitalybuka@google.com><br>
<b>Cc:</b> llvm-commits <llvm-commits@lists.llvm.org><br>
<b>Subject:</b> RE: [llvm] r347092 - Preprocessing support in tablegen.<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">FYI, I am trying to reproduce the issue.  I will revert it in hour, if I cannot find a solution or the fix is not trivial. 
 Sorry for the inconvenience.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Slava<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Vitaly Buka [<a href="mailto:vitalybuka@google.com">mailto:vitalybuka@google.com</a>]
<br>
<b>Sent:</b> Friday, November 16, 2018 2:14 PM<br>
<b>To:</b> Zakharin, Vyacheslav P <<a href="mailto:vyacheslav.p.zakharin@intel.com">vyacheslav.p.zakharin@intel.com</a>><br>
<b>Cc:</b> llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>><br>
<b>Subject:</b> Re: [llvm] r347092 - Preprocessing support in tablegen.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<div>
<p class="MsoNormal">The patch breaks this bot: <a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/26263/steps/check-llvm%20asan/logs/stdio">
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/26263/steps/check-llvm%20asan/logs/stdio</a><o:p></o:p></p>
</div>
<div>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">- Testing: 28663 tests, 64 threads --<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">FAIL: LLVM :: TableGen/<a href="http://prep-diag12.td">prep-diag12.td</a> (22344 of 28663)<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">******************** TEST 'LLVM :: TableGen/<a href="http://prep-diag12.td">prep-diag12.td</a>' FAILED ********************<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Script:<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">: 'RUN: at line 1';   not /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/llvm-tblgen -I /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/<a href="http://prep-diag12.td">prep-diag12.td</a> 2>&1 | /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/FileCheck /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/<a href="http://prep-diag12.td">prep-diag12.td</a><o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Exit Code: 1<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Command Output (stderr):<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">/b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/prep-diag12.td:3:11: error: CHECK: expected string not found in input<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">// CHECK: error: Reached EOF without matching #endif<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">          ^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><stdin>:1:1: note: scanning from here<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">=================================================================<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><stdin>:23:1: note: possible intended match here<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">allocated by thread T0 here:<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">********************<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">FAIL: LLVM :: TableGen/<a href="http://prep-diag2.td">prep-diag2.td</a> (22346 of 28663)<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">******************** TEST 'LLVM :: TableGen/<a href="http://prep-diag2.td">prep-diag2.td</a>' FAILED ********************<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Script:<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">: 'RUN: at line 1';   not /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/llvm-tblgen -DDIAG1 -I /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/<a href="http://prep-diag2.td">prep-diag2.td</a> 2>&1 | /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/FileCheck --check-prefixes=DIAG1 /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/<a href="http://prep-diag2.td">prep-diag2.td</a><o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">: 'RUN: at line 2';   not /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/llvm-tblgen -I /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/<a href="http://prep-diag2.td">prep-diag2.td</a> 2>&1 | /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/FileCheck --check-prefixes=DIAG2 /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/<a href="http://prep-diag2.td">prep-diag2.td</a><o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Exit Code: 1<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Command Output (stderr):<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">/b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/prep-diag2.td:5:11: error: DIAG1: expected string not found in input<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">// DIAG1: error: Only comments are supported after #else<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">          ^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><stdin>:1:1: note: scanning from here<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">=================================================================<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><stdin>:31:8: note: possible intended match here<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">allocated by thread T0 here:<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">       ^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">********************<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">FAIL: LLVM :: TableGen/<a href="http://prep-region-processing.td">prep-region-processing.td</a> (22347 of 28663)<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">******************** TEST 'LLVM :: TableGen/<a href="http://prep-region-processing.td">prep-region-processing.td</a>' FAILED ********************<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Script:<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">: 'RUN: at line 1';   /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/llvm-tblgen -I /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/<a href="http://prep-region-processing.td">prep-region-processing.td</a> 2>&1 | /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/FileCheck /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/<a href="http://prep-region-processing.td">prep-region-processing.td</a> --implicit-check-not warning:<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Exit Code: 1<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Command Output (stderr):<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">/b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/prep-region-processing.td:8:11: error: CHECK: expected string not found in input<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">// CHECK: def ifdef_disabled3<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">          ^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><stdin>:1:1: note: scanning from here<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">=================================================================<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><stdin>:25:11: note: possible intended match here<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"> #21 0xbca32f in llvm::TableGenMain(char*, bool (*)(llvm::raw_ostream&, llvm::RecordKeeper&)) /b/sanitizer-x86_64-linux-fast/build/llvm/lib/TableGen/Main.cpp:100:14<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">          ^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">********************<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">FAIL: LLVM :: TableGen/<a href="http://prep-diag4.td">prep-diag4.td</a> (22349 of 28663)<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">******************** TEST 'LLVM :: TableGen/<a href="http://prep-diag4.td">prep-diag4.td</a>' FAILED ********************<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Script:<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">: 'RUN: at line 1';   not /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/llvm-tblgen -I /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/<a href="http://prep-diag4.td">prep-diag4.td</a> 2>&1 | /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/FileCheck /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/<a href="http://prep-diag4.td">prep-diag4.td</a><o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Exit Code: 1<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Command Output (stderr):<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">/b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/prep-diag4.td:3:11: error: CHECK: expected string not found in input<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">// CHECK: error: double #else<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">          ^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><stdin>:1:1: note: scanning from here<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">=================================================================<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><stdin>:29:56: note: possible intended match here<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"> #5 0xc384a8 in void std::__1::vector<llvm::TGLexer::PreprocessorControlDesc, std::__1::allocator<llvm::TGLexer::PreprocessorControlDesc> >::__push_back_slow_path<llvm::TGLexer::PreprocessorControlDesc>(llvm::TGLexer::PreprocessorControlDesc&&) /b/sanitizer-x86_64-linux-fast/build/libcxx_build_asan/include/c++/v1/vector:1613<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">                                                       ^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">********************<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">FAIL: LLVM :: TableGen/<a href="http://prep-diag3.td">prep-diag3.td</a> (22350 of 28663)<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">******************** TEST 'LLVM :: TableGen/<a href="http://prep-diag3.td">prep-diag3.td</a>' FAILED ********************<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Script:<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">: 'RUN: at line 1';   not /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/llvm-tblgen -DDIAG1 -I /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/<a href="http://prep-diag3.td">prep-diag3.td</a> 2>&1 | /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/FileCheck --check-prefixes=DIAG1 /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/<a href="http://prep-diag3.td">prep-diag3.td</a><o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">: 'RUN: at line 2';   not /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/llvm-tblgen -I /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/<a href="http://prep-diag3.td">prep-diag3.td</a> 2>&1 | /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/FileCheck --check-prefixes=DIAG2 /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/<a href="http://prep-diag3.td">prep-diag3.td</a><o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Exit Code: 1<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Command Output (stderr):<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">/b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/prep-diag3.td:5:11: error: DIAG1: expected string not found in input<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">// DIAG1: error: Only comments are supported after #endif<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">          ^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><stdin>:1:1: note: scanning from here<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">=================================================================<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><stdin>:31:8: note: possible intended match here<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">allocated by thread T0 here:<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">       ^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">********************<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">FAIL: LLVM :: TableGen/<a href="http://prep-diag10.td">prep-diag10.td</a> (22351 of 28663)<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">******************** TEST 'LLVM :: TableGen/<a href="http://prep-diag10.td">prep-diag10.td</a>' FAILED ********************<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Script:<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">: 'RUN: at line 1';   not /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/llvm-tblgen -I /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/<a href="http://prep-diag10.td">prep-diag10.td</a> 2>&1 | /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/FileCheck /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/<a href="http://prep-diag10.td">prep-diag10.td</a><o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Exit Code: 1<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Command Output (stderr):<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">/b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/prep-diag10.td:3:11: error: CHECK: expected string not found in input<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">// CHECK: error: Reached EOF without matching #endif<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">          ^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><stdin>:1:1: note: scanning from here<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">=================================================================<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><stdin>:23:1: note: possible intended match here<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">allocated by thread T0 here:<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">********************<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">FAIL: LLVM :: TableGen/<a href="http://prep-diag11.td">prep-diag11.td</a> (22352 of 28663)<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">******************** TEST 'LLVM :: TableGen/<a href="http://prep-diag11.td">prep-diag11.td</a>' FAILED ********************<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Script:<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">: 'RUN: at line 1';   not /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/llvm-tblgen -I /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/<a href="http://prep-diag11.td">prep-diag11.td</a> 2>&1 | /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/FileCheck /b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/<a href="http://prep-diag11.td">prep-diag11.td</a><o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Exit Code: 1<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Command Output (stderr):<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">/b/sanitizer-x86_64-linux-fast/build/llvm/test/TableGen/prep-diag11.td:3:11: error: CHECK: expected string not found in input<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">// CHECK: error: Reached EOF without matching #endif<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">          ^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><stdin>:1:1: note: scanning from here<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">=================================================================<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><stdin>:23:1: note: possible intended match here<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">allocated by thread T0 here:<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">^<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">********************<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. <o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Testing Time: 224.74s<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">********************<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">Failing Tests (7):<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">    LLVM :: TableGen/<a href="http://prep-diag10.td">prep-diag10.td</a><o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">    LLVM :: TableGen/<a href="http://prep-diag11.td">prep-diag11.td</a><o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">    LLVM :: TableGen/<a href="http://prep-diag12.td">prep-diag12.td</a><o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">    LLVM :: TableGen/<a href="http://prep-diag2.td">prep-diag2.td</a><o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">    LLVM :: TableGen/<a href="http://prep-diag3.td">prep-diag3.td</a><o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">    LLVM :: TableGen/<a href="http://prep-diag4.td">prep-diag4.td</a><o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">    LLVM :: TableGen/<a href="http://prep-region-processing.td">prep-region-processing.td</a><o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">  Expected Passes    : 27915<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">  Expected Failures  : 148<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">  Unsupported Tests  : 593<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">  Unexpected Failures: 7<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">FAILED: test/CMakeFiles/check-llvm <o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">cd /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/test && /usr/bin/python2.7 /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/./bin/llvm-lit -sv /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/test<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">ninja: build stopped: subcommand failed.<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">+ echo @@@STEP_FAILURE@@@<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">+ echo @@@BUILD_STEP check-clang asan@@@<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">@@@STEP_FAILURE@@@<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black"><o:p> </o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">--------------------------------------------------------------------------------<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">started: Fri Nov 16 13:04:39 2018<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">ended: Fri Nov 16 13:16:22 2018<o:p></o:p></span></span></pre>
<pre><span class="gmail-stdout"><span style="font-size:13.5pt;color:black">duration: 11 mins, 42 secs</span></span><o:p></o:p></pre>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Fri, Nov 16, 2018 at 1:00 PM Vyacheslav Zakharin via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal">Author: vzakhari<br>
Date: Fri Nov 16 12:57:29 2018<br>
New Revision: 347092<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=347092&view=rev" target="_blank">
http://llvm.org/viewvc/llvm-project?rev=347092&view=rev</a><br>
Log:<br>
Preprocessing support in tablegen.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D53840" target="_blank">
https://reviews.llvm.org/D53840</a><br>
<br>
<br>
Added:<br>
    llvm/trunk/test/TableGen/<a href="http://prep-diag1.td" target="_blank">prep-diag1.td</a><br>
    llvm/trunk/test/TableGen/<a href="http://prep-diag10.td" target="_blank">prep-diag10.td</a><br>
    llvm/trunk/test/TableGen/prep-diag11-include.inc<br>
    llvm/trunk/test/TableGen/<a href="http://prep-diag11.td" target="_blank">prep-diag11.td</a><br>
    llvm/trunk/test/TableGen/prep-diag12-include.inc<br>
    llvm/trunk/test/TableGen/<a href="http://prep-diag12.td" target="_blank">prep-diag12.td</a><br>
    llvm/trunk/test/TableGen/<a href="http://prep-diag13.td" target="_blank">prep-diag13.td</a><br>
    llvm/trunk/test/TableGen/<a href="http://prep-diag14.td" target="_blank">prep-diag14.td</a><br>
    llvm/trunk/test/TableGen/<a href="http://prep-diag2.td" target="_blank">prep-diag2.td</a><br>
    llvm/trunk/test/TableGen/<a href="http://prep-diag3.td" target="_blank">prep-diag3.td</a><br>
    llvm/trunk/test/TableGen/<a href="http://prep-diag4.td" target="_blank">prep-diag4.td</a><br>
    llvm/trunk/test/TableGen/<a href="http://prep-diag5.td" target="_blank">prep-diag5.td</a><br>
    llvm/trunk/test/TableGen/<a href="http://prep-diag6.td" target="_blank">prep-diag6.td</a><br>
    llvm/trunk/test/TableGen/<a href="http://prep-diag7.td" target="_blank">prep-diag7.td</a><br>
    llvm/trunk/test/TableGen/<a href="http://prep-diag8.td" target="_blank">prep-diag8.td</a><br>
    llvm/trunk/test/TableGen/<a href="http://prep-diag9.td" target="_blank">prep-diag9.td</a><br>
    llvm/trunk/test/TableGen/prep-region-include.inc<br>
    llvm/trunk/test/TableGen/<a href="http://prep-region-processing.td" target="_blank">prep-region-processing.td</a><br>
    llvm/trunk/test/TableGen/unterminated-c-comment-include.inc<br>
    llvm/trunk/test/TableGen/<a href="http://unterminated-c-comment.td" target="_blank">unterminated-c-comment.td</a><br>
    llvm/trunk/test/TableGen/unterminated-code-block-include.inc<br>
    llvm/trunk/test/TableGen/<a href="http://unterminated-code-block.td" target="_blank">unterminated-code-block.td</a><br>
Modified:<br>
    llvm/trunk/docs/TableGen/LangRef.rst<br>
    llvm/trunk/lib/TableGen/Main.cpp<br>
    llvm/trunk/lib/TableGen/TGLexer.cpp<br>
    llvm/trunk/lib/TableGen/TGLexer.h<br>
    llvm/trunk/lib/TableGen/TGParser.h<br>
<br>
Modified: llvm/trunk/docs/TableGen/LangRef.rst<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TableGen/LangRef.rst?rev=347092&r1=347091&r2=347092&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TableGen/LangRef.rst?rev=347092&r1=347091&r2=347092&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/docs/TableGen/LangRef.rst (original)<br>
+++ llvm/trunk/docs/TableGen/LangRef.rst Fri Nov 16 12:57:29 2018<br>
@@ -33,7 +33,7 @@ Lexical Analysis<br>
 ================<br>
<br>
 TableGen supports BCPL (``// ...``) and nestable C-style (``/* ... */``)<br>
-comments.<br>
+comments.  TableGen also provides simple `Preprocessing Support`_.<br>
<br>
 The following is a listing of the basic punctuation tokens::<br>
<br>
@@ -448,3 +448,50 @@ applied at the end of parsing the base c<br>
    BaseMultiClassList: `MultiClassID` ("," `MultiClassID`)*<br>
    MultiClassID: `TokIdentifier`<br>
    MultiClassObject: `Def` | `Defm` | `Let` | `Foreach`<br>
+<br>
+Preprocessing Support<br>
+=====================<br>
+<br>
+TableGen's embedded preprocessor is only intended for conditional compilation.<br>
+It supports the following directives:<br>
+<br>
+.. productionlist::<br>
+   LineBegin: ^<br>
+   LineEnd: "\n" | "\r" | EOF<br>
+   WhiteSpace: " " | "\t"<br>
+   CStyleComment: "/*" (.* - "*/") "*/"<br>
+   BCPLComment: "//" (.* - `LineEnd`) `LineEnd`<br>
+   WhiteSpaceOrCStyleComment: `WhiteSpace` | `CStyleComment`<br>
+   WhiteSpaceOrAnyComment: `WhiteSpace` | `CStyleComment` | `BCPLComment`<br>
+   MacroName: `ualpha` (`ualpha` | "0"..."9")*<br>
+   PrepDefine: `LineBegin` (`WhiteSpaceOrCStyleComment`)*<br>
+             : "#define" (`WhiteSpace`)+ `MacroName`<br>
+             : (`WhiteSpaceOrAnyComment`)* `LineEnd`<br>
+   PrepIfdef: `LineBegin` (`WhiteSpaceOrCStyleComment`)*<br>
+            : "#ifdef" (`WhiteSpace`)+ `MacroName`<br>
+            : (`WhiteSpaceOrAnyComment`)* `LineEnd`<br>
+   PrepElse: `LineBegin` (`WhiteSpaceOrCStyleComment`)*<br>
+           : "#else" (`WhiteSpaceOrAnyComment`)* `LineEnd`<br>
+   PrepEndif: `LineBegin` (`WhiteSpaceOrCStyleComment`)*<br>
+            : "#endif" (`WhiteSpaceOrAnyComment`)* `LineEnd`<br>
+   PrepRegContentException: `PredIfdef` | `PredElse` | `PredEndif` | EOF<br>
+   PrepRegion: .* - `PrepRegContentException`<br>
+             :| `PrepIfDef`<br>
+             :  (`PrepRegion`)*<br>
+             :  [`PrepElse`]<br>
+             :  (`PrepRegion`)*<br>
+             :  `PrepEndif`<br>
+<br>
+:token:`PrepRegion` may occur anywhere in a TD file, as long as it matches<br>
+the grammar specification.<br>
+<br>
+:token:`PrepDefine` allows defining a :token:`MacroName` so that any following<br>
+:token:`PrepIfdef` - :token:`PrepElse` preprocessing region part and<br>
+:token:`PrepIfdef` - :token:`PrepEndif` preprocessing region<br>
+are enabled for TableGen tokens parsing.<br>
+<br>
+A preprocessing region, starting (i.e. having its :token:`PrepIfdef`) in a file,<br>
+must end (i.e. have its :token:`PrepEndif`) in the same file.<br>
+<br>
+A :token:`MacroName` may be defined externally by using ``{ -D<NAME> }``<br>
+option of TableGen.<br>
<br>
Modified: llvm/trunk/lib/TableGen/Main.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Main.cpp?rev=347092&r1=347091&r2=347092&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Main.cpp?rev=347092&r1=347091&r2=347092&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/TableGen/Main.cpp (original)<br>
+++ llvm/trunk/lib/TableGen/Main.cpp Fri Nov 16 12:57:29 2018<br>
@@ -46,6 +46,10 @@ static cl::list<std::string><br>
 IncludeDirs("I", cl::desc("Directory of include files"),<br>
             cl::value_desc("directory"), cl::Prefix);<br>
<br>
+static cl::list<std::string><br>
+MacroNames("D", cl::desc("Name of the macro to be defined"),<br>
+            cl::value_desc("macro name"), cl::Prefix);<br>
+<br>
 static int reportError(const char *ProgName, Twine Msg) {<br>
   errs() << ProgName << ": " << Msg;<br>
   errs().flush();<br>
@@ -91,7 +95,7 @@ int llvm::TableGenMain(char *argv0, Tabl<br>
   // it later.<br>
   SrcMgr.setIncludeDirs(IncludeDirs);<br>
<br>
-  TGParser Parser(SrcMgr, Records);<br>
+  TGParser Parser(SrcMgr, MacroNames, Records);<br>
<br>
   if (Parser.ParseFile())<br>
     return 1;<br>
<br>
Modified: llvm/trunk/lib/TableGen/TGLexer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGLexer.cpp?rev=347092&r1=347091&r2=347092&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGLexer.cpp?rev=347092&r1=347091&r2=347092&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/TableGen/TGLexer.cpp (original)<br>
+++ llvm/trunk/lib/TableGen/TGLexer.cpp Fri Nov 16 12:57:29 2018<br>
@@ -19,6 +19,7 @@<br>
 #include "llvm/Support/MemoryBuffer.h"<br>
 #include "llvm/Support/SourceMgr.h"<br>
 #include "llvm/TableGen/Error.h"<br>
+#include <algorithm><br>
 #include <cctype><br>
 #include <cerrno><br>
 #include <cstdint><br>
@@ -28,11 +29,35 @@<br>
<br>
 using namespace llvm;<br>
<br>
-TGLexer::TGLexer(SourceMgr &SM) : SrcMgr(SM) {<br>
+namespace {<br>
+// A list of supported preprocessing directives with their<br>
+// internal token kinds and names.<br>
+struct {<br>
+  tgtok::TokKind Kind;<br>
+  const char *Word;<br>
+} PreprocessorDirs[] = {<br>
+  { tgtok::Ifdef, "ifdef" },<br>
+  { tgtok::Else, "else" },<br>
+  { tgtok::Endif, "endif" },<br>
+  { tgtok::Define, "define" }<br>
+};<br>
+} // end anonymous namespace<br>
+<br>
+TGLexer::TGLexer(SourceMgr &SM, ArrayRef<std::string> Macros) : SrcMgr(SM) {<br>
   CurBuffer = SrcMgr.getMainFileID();<br>
   CurBuf = SrcMgr.getMemoryBuffer(CurBuffer)->getBuffer();<br>
   CurPtr = CurBuf.begin();<br>
   TokStart = nullptr;<br>
+<br>
+  // Pretend that we enter the "top-level" include file.<br>
+  PrepIncludeStack.push_back(<br>
+      make_unique<std::vector<PreprocessorControlDesc>>());<br>
+<br>
+  // Put all macros defined in the command line into the DefinedMacros set.<br>
+  std::for_each(Macros.begin(), Macros.end(),<br>
+                [this](const std::string &MacroName) {<br>
+                  DefinedMacros.insert(MacroName);<br>
+                });<br>
 }<br>
<br>
 SMLoc TGLexer::getLoc() const {<br>
@@ -41,11 +66,42 @@ SMLoc TGLexer::getLoc() const {<br>
<br>
 /// ReturnError - Set the error to the specified string at the specified<br>
 /// location.  This is defined to always return tgtok::Error.<br>
-tgtok::TokKind TGLexer::ReturnError(const char *Loc, const Twine &Msg) {<br>
+tgtok::TokKind TGLexer::ReturnError(SMLoc Loc, const Twine &Msg) {<br>
   PrintError(Loc, Msg);<br>
   return tgtok::Error;<br>
 }<br>
<br>
+tgtok::TokKind TGLexer::ReturnError(const char *Loc, const Twine &Msg) {<br>
+  return ReturnError(SMLoc::getFromPointer(Loc), Msg);<br>
+}<br>
+<br>
+bool TGLexer::processEOF() {<br>
+  SMLoc ParentIncludeLoc = SrcMgr.getParentIncludeLoc(CurBuffer);<br>
+  if (ParentIncludeLoc != SMLoc()) {<br>
+    // If prepExitInclude() detects a problem with the preprocessing<br>
+    // control stack, it will return false.  Pretend that we reached<br>
+    // the final EOF and stop lexing more tokens by returning false<br>
+    // to LexToken().<br>
+    if (!prepExitInclude(false))<br>
+      return false;<br>
+<br>
+    CurBuffer = SrcMgr.FindBufferContainingLoc(ParentIncludeLoc);<br>
+    CurBuf = SrcMgr.getMemoryBuffer(CurBuffer)->getBuffer();<br>
+    CurPtr = ParentIncludeLoc.getPointer();<br>
+    // Make sure TokStart points into the parent file's buffer.<br>
+    // LexToken() assigns to it before calling getNextChar(),<br>
+    // so it is pointing into the included file now.<br>
+    TokStart = CurPtr;<br>
+    return true;<br>
+  }<br>
+<br>
+  // Pretend that we exit the "top-level" include file.<br>
+  // Note that in case of an error (e.g. control stack imbalance)<br>
+  // the routine will issue a fatal error.<br>
+  prepExitInclude(true);<br>
+  return false;<br>
+}<br>
+<br>
 int TGLexer::getNextChar() {<br>
   char CurChar = *CurPtr++;<br>
   switch (CurChar) {<br>
@@ -57,16 +113,6 @@ int TGLexer::getNextChar() {<br>
     if (CurPtr-1 != CurBuf.end())<br>
       return 0;  // Just whitespace.<br>
<br>
-    // If this is the end of an included file, pop the parent file off the<br>
-    // include stack.<br>
-    SMLoc ParentIncludeLoc = SrcMgr.getParentIncludeLoc(CurBuffer);<br>
-    if (ParentIncludeLoc != SMLoc()) {<br>
-      CurBuffer = SrcMgr.FindBufferContainingLoc(ParentIncludeLoc);<br>
-      CurBuf = SrcMgr.getMemoryBuffer(CurBuffer)->getBuffer();<br>
-      CurPtr = ParentIncludeLoc.getPointer();<br>
-      return getNextChar();<br>
-    }<br>
-<br>
     // Otherwise, return end of file.<br>
     --CurPtr;  // Another call to lex will return EOF again.<br>
     return EOF;<br>
@@ -83,11 +129,11 @@ int TGLexer::getNextChar() {<br>
   }<br>
 }<br>
<br>
-int TGLexer::peekNextChar(int Index) {<br>
+int TGLexer::peekNextChar(int Index) const {<br>
   return *(CurPtr + Index);<br>
 }<br>
<br>
-tgtok::TokKind TGLexer::LexToken() {<br>
+tgtok::TokKind TGLexer::LexToken(bool FileOrLineStart) {<br>
   TokStart = CurPtr;<br>
   // This always consumes at least one character.<br>
   int CurChar = getNextChar();<br>
@@ -100,7 +146,18 @@ tgtok::TokKind TGLexer::LexToken() {<br>
<br>
     // Unknown character, emit an error.<br>
     return ReturnError(TokStart, "Unexpected character");<br>
-  case EOF: return tgtok::Eof;<br>
+  case EOF:<br>
+    // Lex next token, if we just left an include file.<br>
+    // Note that leaving an include file means that the next<br>
+    // symbol is located at the end of 'include "..."'<br>
+    // construct, so LexToken() is called with default<br>
+    // false parameter.<br>
+    if (processEOF())<br>
+      return LexToken();<br>
+<br>
+    // Return EOF denoting the end of lexing.<br>
+    return tgtok::Eof;<br>
+<br>
   case ':': return tgtok::colon;<br>
   case ';': return tgtok::semi;<br>
   case '.': return tgtok::period;<br>
@@ -114,15 +171,27 @@ tgtok::TokKind TGLexer::LexToken() {<br>
   case ')': return tgtok::r_paren;<br>
   case '=': return tgtok::equal;<br>
   case '?': return tgtok::question;<br>
-  case '#': return tgtok::paste;<br>
+  case '#':<br>
+    if (FileOrLineStart) {<br>
+      tgtok::TokKind Kind = prepIsDirective();<br>
+      if (Kind != tgtok::Error)<br>
+        return lexPreprocessor(Kind);<br>
+    }<br>
+<br>
+    return tgtok::paste;<br>
+<br>
+  case '\r':<br>
+    PrintFatalError("getNextChar() must never return '\r'");<br>
+    return tgtok::Error;<br>
<br>
   case 0:<br>
   case ' ':<br>
   case '\t':<br>
-  case '\n':<br>
-  case '\r':<br>
     // Ignore whitespace.<br>
-    return LexToken();<br>
+    return LexToken(FileOrLineStart);<br>
+  case '\n':<br>
+    // Ignore whitespace, and identify the new line.<br>
+    return LexToken(true);<br>
   case '/':<br>
     // If this is the start of a // comment, skip until the end of the line or<br>
     // the end of the buffer.<br>
@@ -133,7 +202,7 @@ tgtok::TokKind TGLexer::LexToken() {<br>
         return tgtok::Error;<br>
     } else // Otherwise, this is an error.<br>
       return ReturnError(TokStart, "Unexpected character");<br>
-    return LexToken();<br>
+    return LexToken(FileOrLineStart);<br>
   case '-': case '+':<br>
   case '0': case '1': case '2': case '3': case '4': case '5': case '6':<br>
   case '7': case '8': case '9': {<br>
@@ -249,10 +318,10 @@ tgtok::TokKind TGLexer::LexVarName() {<br>
 }<br>
<br>
 tgtok::TokKind TGLexer::LexIdentifier() {<br>
-  // The first letter is [a-zA-Z_#].<br>
+  // The first letter is [a-zA-Z_].<br>
   const char *IdentStart = TokStart;<br>
<br>
-  // Match the rest of the identifier regex: [0-9a-zA-Z_#]*<br>
+  // Match the rest of the identifier regex: [0-9a-zA-Z_]*<br>
   while (isalpha(*CurPtr) || isdigit(*CurPtr) || *CurPtr == '_')<br>
     ++CurPtr;<br>
<br>
@@ -322,6 +391,9 @@ bool TGLexer::LexInclude() {<br>
   // Save the line number and lex buffer of the includer.<br>
   CurBuf = SrcMgr.getMemoryBuffer(CurBuffer)->getBuffer();<br>
   CurPtr = CurBuf.begin();<br>
+<br>
+  PrepIncludeStack.push_back(<br>
+      make_unique<std::vector<PreprocessorControlDesc>>());<br>
   return false;<br>
 }<br>
<br>
@@ -496,3 +568,444 @@ tgtok::TokKind TGLexer::LexExclaim() {<br>
<br>
   return Kind != tgtok::Error ? Kind : ReturnError(Start-1, "Unknown operator");<br>
 }<br>
+<br>
+bool TGLexer::prepExitInclude(bool IncludeStackMustBeEmpty) {<br>
+  // Report an error, if preprocessor control stack for the current<br>
+  // file is not empty.<br>
+  if (!PrepIncludeStack.back()->empty()) {<br>
+    prepReportPreprocessorStackError();<br>
+<br>
+    return false;<br>
+  }<br>
+<br>
+  // Pop the preprocessing controls from the include stack.<br>
+  if (PrepIncludeStack.empty()) {<br>
+    PrintFatalError("Preprocessor include stack is empty");<br>
+  }<br>
+<br>
+  PrepIncludeStack.pop_back();<br>
+<br>
+  if (IncludeStackMustBeEmpty) {<br>
+    if (!PrepIncludeStack.empty())<br>
+      PrintFatalError("Preprocessor include stack is not empty");<br>
+  } else {<br>
+    if (PrepIncludeStack.empty())<br>
+      PrintFatalError("Preprocessor include stack is empty");<br>
+  }<br>
+<br>
+  return true;<br>
+}<br>
+<br>
+tgtok::TokKind TGLexer::prepIsDirective() const {<br>
+  for (unsigned ID = 0; ID < llvm::array_lengthof(PreprocessorDirs); ++ID) {<br>
+    int NextChar = *CurPtr;<br>
+    bool Match = true;<br>
+    unsigned I = 0;<br>
+    for (; I < strlen(PreprocessorDirs[ID].Word); ++I) {<br>
+      if (NextChar != PreprocessorDirs[ID].Word[I]) {<br>
+        Match = false;<br>
+        break;<br>
+      }<br>
+<br>
+      NextChar = peekNextChar(I + 1);<br>
+    }<br>
+<br>
+    // Check for whitespace after the directive.  If there is no whitespace,<br>
+    // then we do not recognize it as a preprocessing directive.<br>
+    if (Match) {<br>
+      tgtok::TokKind Kind = PreprocessorDirs[ID].Kind;<br>
+<br>
+      // New line and EOF may follow only #else/#endif.  It will be reported<br>
+      // as an error for #ifdef/#define after the call to prepLexMacroName().<br>
+      if (NextChar == ' ' || NextChar == '\t' || NextChar == EOF ||<br>
+          NextChar == '\n' ||<br>
+          // It looks like TableGen does not support '\r' as the actual<br>
+          // carriage return, e.g. getNextChar() treats a single '\r'<br>
+          // as '\n'.  So we do the same here.<br>
+          NextChar == '\r')<br>
+        return Kind;<br>
+<br>
+      // Allow comments after some directives, e.g.:<br>
+      //     #else// OR #else/**/<br>
+      //     #endif// OR #endif/**/<br>
+      //<br>
+      // Note that we do allow comments after #ifdef/#define here, e.g.<br>
+      //     #ifdef/**/ AND #ifdef//<br>
+      //     #define/**/ AND #define//<br>
+      //<br>
+      // These cases will be reported as incorrect after calling<br>
+      // prepLexMacroName().  We could have supported C-style comments<br>
+      // after #ifdef/#define, but this would complicate the code<br>
+      // for little benefit.<br>
+      if (NextChar == '/') {<br>
+        NextChar = peekNextChar(I + 1);<br>
+<br>
+        if (NextChar == '*' || NextChar == '/')<br>
+          return Kind;<br>
+<br>
+        // Pretend that we do not recognize the directive.<br>
+      }<br>
+    }<br>
+  }<br>
+<br>
+  return tgtok::Error;<br>
+}<br>
+<br>
+bool TGLexer::prepEatPreprocessorDirective(tgtok::TokKind Kind) {<br>
+  TokStart = CurPtr;<br>
+<br>
+  for (unsigned ID = 0; ID < llvm::array_lengthof(PreprocessorDirs); ++ID)<br>
+    if (PreprocessorDirs[ID].Kind == Kind) {<br>
+      // Advance CurPtr to the end of the preprocessing word.<br>
+      CurPtr += strlen(PreprocessorDirs[ID].Word);<br>
+      return true;<br>
+    }<br>
+<br>
+  PrintFatalError("Unsupported preprocessing token in "<br>
+                  "prepEatPreprocessorDirective()");<br>
+  return false;<br>
+}<br>
+<br>
+tgtok::TokKind TGLexer::lexPreprocessor(<br>
+    tgtok::TokKind Kind, bool ReturnNextLiveToken) {<br>
+<br>
+  // We must be looking at a preprocessing directive.  Eat it!<br>
+  if (!prepEatPreprocessorDirective(Kind))<br>
+    PrintFatalError("lexPreprocessor() called for unknown "<br>
+                    "preprocessor directive");<br>
+<br>
+  if (Kind == tgtok::Ifdef) {<br>
+    StringRef MacroName = prepLexMacroName();<br>
+    if (MacroName.empty())<br>
+      return ReturnError(TokStart, "Expected macro name after #ifdef");<br>
+<br>
+    bool MacroIsDefined = DefinedMacros.count(MacroName) != 0;<br>
+<br>
+    // Regardless of whether we are processing tokens or not,<br>
+    // we put the #ifdef control on stack.<br>
+    PrepIncludeStack.back()->push_back(<br>
+        {Kind, MacroIsDefined, SMLoc::getFromPointer(TokStart)});<br>
+<br>
+    if (!prepSkipDirectiveEnd())<br>
+      return ReturnError(CurPtr,<br>
+                         "Only comments are supported after #ifdef NAME");<br>
+<br>
+    // If we were not processing tokens before this #ifdef,<br>
+    // then just return back to the lines skipping code.<br>
+    if (!ReturnNextLiveToken)<br>
+      return Kind;<br>
+<br>
+    // If we were processing tokens before this #ifdef,<br>
+    // and the macro is defined, then just return the next token.<br>
+    if (MacroIsDefined)<br>
+      return LexToken();<br>
+<br>
+    // We were processing tokens before this #ifdef, and the macro<br>
+    // is not defined, so we have to start skipping the lines.<br>
+    // If the skipping is successful, it will return the token following<br>
+    // either #else or #endif corresponding to this #ifdef.<br>
+    if (prepSkipRegion(ReturnNextLiveToken))<br>
+      return LexToken();<br>
+<br>
+    return tgtok::Error;<br>
+  } else if (Kind == tgtok::Else) {<br>
+    // Check if this #else is correct before calling prepSkipDirectiveEnd(),<br>
+    // which will move CurPtr away from the beginning of #else.<br>
+    if (PrepIncludeStack.back()->empty())<br>
+      return ReturnError(TokStart, "#else without #ifdef");<br>
+<br>
+    auto &IfdefEntry = PrepIncludeStack.back()->back();<br>
+<br>
+    if (IfdefEntry.Kind != tgtok::Ifdef) {<br>
+      PrintError(TokStart, "double #else");<br>
+      return ReturnError(IfdefEntry.SrcPos, "Previous #else is here");<br>
+    }<br>
+<br>
+    // Replace the corresponding #ifdef's control with its negation<br>
+    // on the control stack.<br>
+    PrepIncludeStack.back()->pop_back();<br>
+    PrepIncludeStack.back()->push_back(<br>
+        {Kind, !IfdefEntry.IsDefined, SMLoc::getFromPointer(TokStart)});<br>
+<br>
+    if (!prepSkipDirectiveEnd())<br>
+      return ReturnError(CurPtr, "Only comments are supported after #else");<br>
+<br>
+    // If we were processing tokens before this #else,<br>
+    // we have to start skipping lines until the matching #endif.<br>
+    if (ReturnNextLiveToken) {<br>
+      if (prepSkipRegion(ReturnNextLiveToken))<br>
+        return LexToken();<br>
+<br>
+      return tgtok::Error;<br>
+    }<br>
+<br>
+    // Return to the lines skipping code.<br>
+    return Kind;<br>
+  } else if (Kind == tgtok::Endif) {<br>
+    // Check if this #endif is correct before calling prepSkipDirectiveEnd(),<br>
+    // which will move CurPtr away from the beginning of #endif.<br>
+    if (PrepIncludeStack.back()->empty())<br>
+      return ReturnError(TokStart, "#endif without #ifdef");<br>
+<br>
+    auto &IfdefOrElseEntry = PrepIncludeStack.back()->back();<br>
+<br>
+    if (IfdefOrElseEntry.Kind != tgtok::Ifdef &&<br>
+        IfdefOrElseEntry.Kind != tgtok::Else) {<br>
+      PrintFatalError("Invalid preprocessor control on the stack");<br>
+      return tgtok::Error;<br>
+    }<br>
+<br>
+    if (!prepSkipDirectiveEnd())<br>
+      return ReturnError(CurPtr, "Only comments are supported after #endif");<br>
+<br>
+    PrepIncludeStack.back()->pop_back();<br>
+<br>
+    // If we were processing tokens before this #endif, then<br>
+    // we should continue it.<br>
+    if (ReturnNextLiveToken) {<br>
+      return LexToken();<br>
+    }<br>
+<br>
+    // Return to the lines skipping code.<br>
+    return Kind;<br>
+  } else if (Kind == tgtok::Define) {<br>
+    StringRef MacroName = prepLexMacroName();<br>
+    if (MacroName.empty())<br>
+      return ReturnError(TokStart, "Expected macro name after #define");<br>
+<br>
+    if (!DefinedMacros.insert(MacroName).second)<br>
+      PrintWarning(getLoc(),<br>
+                   "Duplicate definition of macro: " + Twine(MacroName));<br>
+<br>
+    if (!prepSkipDirectiveEnd())<br>
+      return ReturnError(CurPtr,<br>
+                         "Only comments are supported after #define NAME");<br>
+<br>
+    if (!ReturnNextLiveToken) {<br>
+      PrintFatalError("#define must be ignored during the lines skipping");<br>
+      return tgtok::Error;<br>
+    }<br>
+<br>
+    return LexToken();<br>
+  }<br>
+<br>
+  PrintFatalError("Preprocessing directive is not supported");<br>
+  return tgtok::Error;<br>
+}<br>
+<br>
+bool TGLexer::prepSkipRegion(bool MustNeverBeFalse) {<br>
+  if (!MustNeverBeFalse)<br>
+    PrintFatalError("Invalid recursion.");<br>
+<br>
+  do {<br>
+    // Skip all symbols to the line end.<br>
+    prepSkipToLineEnd();<br>
+<br>
+    // Find the first non-whitespace symbol in the next line(s).<br>
+    if (!prepSkipLineBegin())<br>
+      return false;<br>
+<br>
+    // If the first non-blank/comment symbol on the line is '#',<br>
+    // it may be a start of preprocessing directive.<br>
+    //<br>
+    // If it is not '#' just go to the next line.<br>
+    if (*CurPtr == '#')<br>
+      ++CurPtr;<br>
+    else<br>
+      continue;<br>
+<br>
+    tgtok::TokKind Kind = prepIsDirective();<br>
+<br>
+    // If we did not find a preprocessing directive or it is #define,<br>
+    // then just skip to the next line.  We do not have to do anything<br>
+    // for #define in the line-skipping mode.<br>
+    if (Kind == tgtok::Error || Kind == tgtok::Define)<br>
+      continue;<br>
+<br>
+    tgtok::TokKind ProcessedKind = lexPreprocessor(Kind, false);<br>
+<br>
+    // If lexPreprocessor() encountered an error during lexing this<br>
+    // preprocessor idiom, then return false to the calling lexPreprocessor().<br>
+    // This will force tgtok::Error to be returned to the tokens processing.<br>
+    if (ProcessedKind == tgtok::Error)<br>
+      return false;<br>
+<br>
+    if (Kind != ProcessedKind)<br>
+      PrintFatalError("prepIsDirective() and lexPreprocessor() "<br>
+                      "returned different token kinds");<br>
+<br>
+    // If this preprocessing directive enables tokens processing,<br>
+    // then return to the lexPreprocessor() and get to the next token.<br>
+    // We can move from line-skipping mode to processing tokens only<br>
+    // due to #else or #endif.<br>
+    if (prepIsProcessingEnabled()) {<br>
+      if (Kind != tgtok::Else && Kind != tgtok::Endif) {<br>
+        PrintFatalError("Tokens processing was enabled by an unexpected "<br>
+                        "preprocessing directive");<br>
+        return false;<br>
+      }<br>
+<br>
+      return true;<br>
+    }<br>
+  } while (CurPtr != CurBuf.end());<br>
+<br>
+  // We have reached the end of the file, but never left the lines-skipping<br>
+  // mode.  This means there is no matching #endif.<br>
+  prepReportPreprocessorStackError();<br>
+  return false;<br>
+}<br>
+<br>
+StringRef TGLexer::prepLexMacroName() {<br>
+  // Skip whitespaces between the preprocessing directive and the macro name.<br>
+  while (*CurPtr == ' ' || *CurPtr == '\t')<br>
+    ++CurPtr;<br>
+<br>
+  TokStart = CurPtr;<br>
+  // Macro names start with [a-zA-Z_].<br>
+  if (*CurPtr != '_' && !isalpha(*CurPtr))<br>
+    return "";<br>
+<br>
+  // Match the rest of the identifier regex: [0-9a-zA-Z_]*<br>
+  while (isalpha(*CurPtr) || isdigit(*CurPtr) || *CurPtr == '_')<br>
+    ++CurPtr;<br>
+<br>
+  return StringRef(TokStart, CurPtr - TokStart);<br>
+}<br>
+<br>
+bool TGLexer::prepSkipLineBegin() {<br>
+  while (CurPtr != CurBuf.end()) {<br>
+    switch (*CurPtr) {<br>
+    case ' ':<br>
+    case '\t':<br>
+    case '\n':<br>
+    case '\r':<br>
+      break;<br>
+<br>
+    case '/': {<br>
+      int NextChar = peekNextChar(1);<br>
+      if (NextChar == '*') {<br>
+        // Skip C-style comment.<br>
+        // Note that we do not care about skipping the C++-style comments.<br>
+        // If the line contains "//", it may not contain any processable<br>
+        // preprocessing directive.  Just return CurPtr pointing to<br>
+        // the first '/' in this case.  We also do not care about<br>
+        // incorrect symbols after the first '/' - we are in lines-skipping<br>
+        // mode, so incorrect code is allowed to some extent.<br>
+<br>
+        // Set TokStart to the beginning of the comment to enable proper<br>
+        // diagnostic printing in case of error in SkipCComment().<br>
+        TokStart = CurPtr;<br>
+<br>
+        // CurPtr must point to '*' before call to SkipCComment().<br>
+        ++CurPtr;<br>
+        if (SkipCComment())<br>
+          return false;<br>
+      } else {<br>
+        // CurPtr points to the non-whitespace '/'.<br>
+        return true;<br>
+      }<br>
+<br>
+      // We must not increment CurPtr after the comment was lexed.<br>
+      continue;<br>
+    }<br>
+<br>
+    default:<br>
+      return true;<br>
+    }<br>
+<br>
+    ++CurPtr;<br>
+  }<br>
+<br>
+  // We have reached the end of the file.  Return to the lines skipping<br>
+  // code, and allow it to handle the EOF as needed.<br>
+  return true;<br>
+}<br>
+<br>
+bool TGLexer::prepSkipDirectiveEnd() {<br>
+  while (CurPtr != CurBuf.end()) {<br>
+    switch (*CurPtr) {<br>
+    case ' ':<br>
+    case '\t':<br>
+      break;<br>
+<br>
+    case '\n':<br>
+    case '\r':<br>
+      return true;<br>
+<br>
+    case '/': {<br>
+      int NextChar = peekNextChar(1);<br>
+      if (NextChar == '/') {<br>
+        // Skip C++-style comment.<br>
+        // We may just return true now, but let's skip to the line/buffer end<br>
+        // to simplify the method specification.<br>
+        ++CurPtr;<br>
+        SkipBCPLComment();<br>
+      } else if (NextChar == '*') {<br>
+        // When we are skipping C-style comment at the end of a preprocessing<br>
+        // directive, we can skip several lines.  If any meaningful TD token<br>
+        // follows the end of the C-style comment on the same line, it will<br>
+        // be considered as an invalid usage of TD token.<br>
+        // For example, we want to forbid usages like this one:<br>
+        //     #define MACRO class Class {}<br>
+        // But with C-style comments we also disallow the following:<br>
+        //     #define MACRO /* This macro is used<br>
+        //                      to ... */ class Class {}<br>
+        // One can argue that this should be allowed, but it does not seem<br>
+        // to be worth of the complication.  Moreover, this matches<br>
+        // the C preprocessor behavior.<br>
+<br>
+        // Set TokStart to the beginning of the comment to enable proper<br>
+        // diagnostic printer in case of error in SkipCComment().<br>
+        TokStart = CurPtr;<br>
+        ++CurPtr;<br>
+        if (SkipCComment())<br>
+          return false;<br>
+      } else {<br>
+        TokStart = CurPtr;<br>
+        PrintError(CurPtr, "Unexpected character");<br>
+        return false;<br>
+      }<br>
+<br>
+      // We must not increment CurPtr after the comment was lexed.<br>
+      continue;<br>
+    }<br>
+<br>
+    default:<br>
+      // Do not allow any non-whitespaces after the directive.<br>
+      TokStart = CurPtr;<br>
+      return false;<br>
+    }<br>
+<br>
+    ++CurPtr;<br>
+  }<br>
+<br>
+  return true;<br>
+}<br>
+<br>
+void TGLexer::prepSkipToLineEnd() {<br>
+  while (*CurPtr != '\n' && *CurPtr != '\r' && CurPtr != CurBuf.end())<br>
+    ++CurPtr;<br>
+}<br>
+<br>
+bool TGLexer::prepIsProcessingEnabled() {<br>
+  for (auto I = PrepIncludeStack.back()->rbegin(),<br>
+            E = PrepIncludeStack.back()->rend();<br>
+       I != E; ++I) {<br>
+    if (!I->IsDefined)<br>
+      return false;<br>
+  }<br>
+<br>
+  return true;<br>
+}<br>
+<br>
+void TGLexer::prepReportPreprocessorStackError() {<br>
+  if (PrepIncludeStack.back()->empty())<br>
+    PrintFatalError("prepReportPreprocessorStackError() called with "<br>
+                    "empty control stack");<br>
+<br>
+  auto &PrepControl = PrepIncludeStack.back()->back();<br>
+  PrintError(CurBuf.end(), "Reached EOF without matching #endif");<br>
+  PrintError(PrepControl.SrcPos, "The latest preprocessor control is here");<br>
+<br>
+  TokStart = CurPtr;<br>
+}<br>
<br>
Modified: llvm/trunk/lib/TableGen/TGLexer.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGLexer.h?rev=347092&r1=347091&r2=347092&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGLexer.h?rev=347092&r1=347091&r2=347092&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/TableGen/TGLexer.h (original)<br>
+++ llvm/trunk/lib/TableGen/TGLexer.h Fri Nov 16 12:57:29 2018<br>
@@ -14,11 +14,14 @@<br>
 #ifndef LLVM_LIB_TABLEGEN_TGLEXER_H<br>
 #define LLVM_LIB_TABLEGEN_TGLEXER_H<br>
<br>
+#include "llvm/ADT/ArrayRef.h"<br>
 #include "llvm/ADT/StringRef.h"<br>
+#include "llvm/ADT/StringSet.h"<br>
 #include "llvm/Support/DataTypes.h"<br>
 #include "llvm/Support/SMLoc.h"<br>
 #include <cassert><br>
 #include <map><br>
+#include <memory><br>
 #include <string><br>
<br>
 namespace llvm {<br>
@@ -59,7 +62,11 @@ namespace tgtok {<br>
     BinaryIntVal,<br>
<br>
     // String valued tokens.<br>
-    Id, StrVal, VarName, CodeFragment<br>
+    Id, StrVal, VarName, CodeFragment,<br>
+<br>
+    // Preprocessing tokens for internal usage by the lexer.<br>
+    // They are never returned as a result of Lex().<br>
+    Ifdef, Else, Endif, Define<br>
   };<br>
 }<br>
<br>
@@ -87,10 +94,10 @@ private:<br>
   DependenciesMapTy Dependencies;<br>
<br>
 public:<br>
-  TGLexer(SourceMgr &SrcMgr);<br>
+  TGLexer(SourceMgr &SrcMgr, ArrayRef<std::string> Macros);<br>
<br>
   tgtok::TokKind Lex() {<br>
-    return CurCode = LexToken();<br>
+    return CurCode = LexToken(CurPtr == CurBuf.begin());<br>
   }<br>
<br>
   const DependenciesMapTy &getDependencies() const {<br>
@@ -119,12 +126,13 @@ public:<br>
<br>
 private:<br>
   /// LexToken - Read the next token and return its code.<br>
-  tgtok::TokKind LexToken();<br>
+  tgtok::TokKind LexToken(bool FileOrLineStart = false);<br>
<br>
+  tgtok::TokKind ReturnError(SMLoc Loc, const Twine &Msg);<br>
   tgtok::TokKind ReturnError(const char *Loc, const Twine &Msg);<br>
<br>
   int getNextChar();<br>
-  int peekNextChar(int Index);<br>
+  int peekNextChar(int Index) const;<br>
   void SkipBCPLComment();<br>
   bool SkipCComment();<br>
   tgtok::TokKind LexIdentifier();<br>
@@ -134,6 +142,231 @@ private:<br>
   tgtok::TokKind LexNumber();<br>
   tgtok::TokKind LexBracket();<br>
   tgtok::TokKind LexExclaim();<br>
+<br>
+  // Process EOF encountered in LexToken().<br>
+  // If EOF is met in an include file, then the method will update<br>
+  // CurPtr, CurBuf and preprocessing include stack, and return true.<br>
+  // If EOF is met in the top-level file, then the method will<br>
+  // update and check the preprocessing include stack, and return false.<br>
+  bool processEOF();<br>
+<br>
+  // *** Structures and methods for preprocessing support ***<br>
+<br>
+  // A set of macro names that are defined either via command line or<br>
+  // by using:<br>
+  //     #define NAME<br>
+  StringSet<> DefinedMacros;<br>
+<br>
+  // Each of #ifdef and #else directives has a descriptor associated<br>
+  // with it.<br>
+  //<br>
+  // An ordered list of preprocessing controls defined by #ifdef/#else<br>
+  // directives that are in effect currently is called preprocessing<br>
+  // control stack.  It is represented as a vector of PreprocessorControlDesc's.<br>
+  //<br>
+  // The control stack is updated according to the following rules:<br>
+  //<br>
+  // For each #ifdef we add an element to the control stack.<br>
+  // For each #else we replace the top element with a descriptor<br>
+  // with an inverted IsDefined value.<br>
+  // For each #endif we pop the top element from the control stack.<br>
+  //<br>
+  // When CurPtr reaches the current buffer's end, the control stack<br>
+  // must be empty, i.e. #ifdef and the corresponding #endif<br>
+  // must be located in the same file.<br>
+  struct PreprocessorControlDesc {<br>
+    // Either tgtok::Ifdef or tgtok::Else.<br>
+    tgtok::TokKind Kind;<br>
+<br>
+    // True, if the condition for this directive is true, false - otherwise.<br>
+    // Examples:<br>
+    //     #ifdef NAME       : true, if NAME is defined, false - otherwise.<br>
+    //     ...<br>
+    //     #else             : false, if NAME is defined, true - otherwise.<br>
+    bool IsDefined;<br>
+<br>
+    // Pointer into CurBuf to the beginning of the preprocessing directive<br>
+    // word, e.g.:<br>
+    //     #ifdef NAME<br>
+    //      ^ - SrcPos<br>
+    SMLoc SrcPos;<br>
+  };<br>
+<br>
+  // We want to disallow code like this:<br>
+  //     <a href="http://file1.td" target="_blank">file1.td</a>:<br>
+  //         #define NAME<br>
+  //         #ifdef NAME<br>
+  //         include "<a href="http://file2.td" target="_blank">file2.td</a>"<br>
+  //     EOF<br>
+  //     <a href="http://file2.td" target="_blank">file2.td</a>:<br>
+  //         #endif<br>
+  //     EOF<br>
+  //<br>
+  // To do this, we clear the preprocessing control stack on entry<br>
+  // to each of the included file.  PrepIncludeStack is used to store<br>
+  // preprocessing control stacks for the current file and all its<br>
+  // parent files.  The back() element is the preprocessing control<br>
+  // stack for the current file.<br>
+  std::vector<std::unique_ptr<std::vector<PreprocessorControlDesc>>><br>
+      PrepIncludeStack;<br>
+<br>
+  // Validate that the current preprocessing control stack is empty,<br>
+  // since we are about to exit a file, and pop the include stack.<br>
+  //<br>
+  // If IncludeStackMustBeEmpty is true, the include stack must be empty<br>
+  // after the popping, otherwise, the include stack must not be empty<br>
+  // after the popping.  Basically, the include stack must be empty<br>
+  // only if we exit the "top-level" file (i.e. finish lexing).<br>
+  //<br>
+  // The method returns false, if the current preprocessing control stack<br>
+  // is not empty (e.g. there is an unterminated #ifdef/#else),<br>
+  // true - otherwise.<br>
+  bool prepExitInclude(bool IncludeStackMustBeEmpty);<br>
+<br>
+  // Look ahead for a preprocessing directive starting from CurPtr.  The caller<br>
+  // must only call this method, if *(CurPtr - 1) is '#'.  If the method matches<br>
+  // a preprocessing directive word followed by a whitespace, then it returns<br>
+  // one of the internal token kinds, i.e. Ifdef, Else, Endif, Define.<br>
+  //<br>
+  // CurPtr is not adjusted by this method.<br>
+  tgtok::TokKind prepIsDirective() const;<br>
+<br>
+  // Given a preprocessing token kind, adjusts CurPtr to the end<br>
+  // of the preprocessing directive word.  Returns true, unless<br>
+  // an unsupported token kind is passed in.<br>
+  //<br>
+  // We use look-ahead prepIsDirective() and prepEatPreprocessorDirective()<br>
+  // to avoid adjusting CurPtr before we are sure that '#' is followed<br>
+  // by a preprocessing directive.  If it is not, then we fall back to<br>
+  // tgtok::paste interpretation of '#'.<br>
+  bool prepEatPreprocessorDirective(tgtok::TokKind Kind);<br>
+<br>
+  // The main "exit" point from the token parsing to preprocessor.<br>
+  //<br>
+  // The method is called for CurPtr, when prepIsDirective() returns<br>
+  // true.  The first parameter matches the result of prepIsDirective(),<br>
+  // denoting the actual preprocessor directive to be processed.<br>
+  //<br>
+  // If the preprocessing directive disables the tokens processing, e.g.:<br>
+  //     #ifdef NAME // NAME is undefined<br>
+  // then lexPreprocessor() enters the lines-skipping mode.<br>
+  // In this mode, it does not parse any tokens, because the code under<br>
+  // the #ifdef may not even be a correct tablegen code.  The preprocessor<br>
+  // looks for lines containing other preprocessing directives, which<br>
+  // may be prepended with whitespaces and C-style comments.  If the line<br>
+  // does not contain a preprocessing directive, it is skipped completely.<br>
+  // Otherwise, the preprocessing directive is processed by recursively<br>
+  // calling lexPreprocessor().  The processing of the encountered<br>
+  // preprocessing directives includes updating preprocessing control stack<br>
+  // and adding new macros into DefinedMacros set.<br>
+  //<br>
+  // The second parameter controls whether lexPreprocessor() is called from<br>
+  // LexToken() (true) or recursively from lexPreprocessor() (false).<br>
+  //<br>
+  // If ReturnNextLiveToken is true, the method returns the next<br>
+  // LEX token following the current directive or following the end<br>
+  // of the disabled preprocessing region corresponding to this directive.<br>
+  // If ReturnNextLiveToken is false, the method returns the first parameter,<br>
+  // unless there were errors encountered in the disabled preprocessing<br>
+  // region - in this case, it returns tgtok::Error.<br>
+  tgtok::TokKind lexPreprocessor(tgtok::TokKind Kind,<br>
+                                 bool ReturnNextLiveToken = true);<br>
+<br>
+  // Worker method for lexPreprocessor() to skip lines after some<br>
+  // preprocessing directive up to the buffer end or to the directive<br>
+  // that re-enables token processing.  The method returns true<br>
+  // upon processing the next directive that re-enables tokens<br>
+  // processing.  False is returned if an error was encountered.<br>
+  //<br>
+  // Note that prepSkipRegion() calls lexPreprocessor() to process<br>
+  // encountered preprocessing directives.  In this case, the second<br>
+  // parameter to lexPreprocessor() is set to false.  Being passed<br>
+  // false ReturnNextLiveToken, lexPreprocessor() must never call<br>
+  // prepSkipRegion().  We assert this by passing ReturnNextLiveToken<br>
+  // to prepSkipRegion() and checking that it is never set to false.<br>
+  bool prepSkipRegion(bool MustNeverBeFalse);<br>
+<br>
+  // Lex name of the macro after either #ifdef or #define.  We could have used<o:p></o:p></p>
<p class="MsoNormal">+  // LexIdentifier(), but it has special handling of "include" word, which<br>
+  // could result in awkward diagnostic errors.  Consider:<br>
+  // ----<br>
+  // #ifdef include<br>
+  // class ...<br>
+  // ----<br>
+  // LexIdentifier() will engage LexInclude(), which will complain about<br>
+  // missing file with name "class".  Instead, prepLexMacroName() will treat<br>
+  // "include" as a normal macro name.<br>
+  //<br>
+  // On entry, CurPtr points to the end of a preprocessing directive word.<br>
+  // The method allows for whitespaces between the preprocessing directive<br>
+  // and the macro name.  The allowed whitespaces are ' ' and '\t'.<br>
+  //<br>
+  // If the first non-whitespace symbol after the preprocessing directive<br>
+  // is a valid start symbol for an identifier (i.e. [a-zA-Z_]), then<br>
+  // the method updates TokStart to the position of the first non-whitespace<br>
+  // symbol, sets CurPtr to the position of the macro name's last symbol,<br>
+  // and returns a string reference to the macro name.  Otherwise,<br>
+  // TokStart is set to the first non-whitespace symbol after the preprocessing<br>
+  // directive, and the method returns an empty string reference.<br>
+  //<br>
+  // In all cases, TokStart may be used to point to the word following<br>
+  // the preprocessing directive.<br>
+  StringRef prepLexMacroName();<br>
+<br>
+  // Skip any whitespaces starting from CurPtr.  The method is used<br>
+  // only in the lines-skipping mode to find the first non-whitespace<br>
+  // symbol after or at CurPtr.  Allowed whitespaces are ' ', '\t', '\n'<br>
+  // and '\r'.  The method skips C-style comments as well, because<br>
+  // it is used to find the beginning of the preprocessing directive.<br>
+  // If we do not handle C-style comments the following code would<br>
+  // result in incorrect detection of a preprocessing directive:<br>
+  //     /*<br>
+  //     #ifdef NAME<br>
+  //     */<br>
+  // As long as we skip C-style comments, the following code is correctly<br>
+  // recognized as a preprocessing directive:<br>
+  //     /* first line comment<br>
+  //        second line comment */ #ifdef NAME<br>
+  //<br>
+  // The method returns true upon reaching the first non-whitespace symbol<br>
+  // or EOF, CurPtr is set to point to this symbol.  The method returns false,<br>
+  // if an error occured during skipping of a C-style comment.<br>
+  bool prepSkipLineBegin();<br>
+<br>
+  // Skip any whitespaces or comments after a preprocessing directive.<br>
+  // The method returns true upon reaching either end of the line<br>
+  // or end of the file.  If there is a multiline C-style comment<br>
+  // after the preprocessing directive, the method skips<br>
+  // the comment, so the final CurPtr may point to one of the next lines.<br>
+  // The method returns false, if an error occured during skipping<br>
+  // C- or C++-style comment, or a non-whitespace symbol appears<br>
+  // after the preprocessing directive.<br>
+  //<br>
+  // The method maybe called both during lines-skipping and tokens<br>
+  // processing.  It actually verifies that only whitespaces or/and<br>
+  // comments follow a preprocessing directive.<br>
+  //<br>
+  // After the execution of this mehod, CurPtr points either to new line<br>
+  // symbol, buffer end or non-whitespace symbol following the preprocesing<br>
+  // directive.<br>
+  bool prepSkipDirectiveEnd();<br>
+<br>
+  // Skip all symbols to the end of the line/file.<br>
+  // The method adjusts CurPtr, so that it points to either new line<br>
+  // symbol in the current line or the buffer end.<br>
+  void prepSkipToLineEnd();<br>
+<br>
+  // Return true, if the current preprocessor control stack is such that<br>
+  // we should allow lexer to process the next token, false - otherwise.<br>
+  //<br>
+  // In particular, the method returns true, if all the #ifdef/#else<br>
+  // controls on the stack have their IsDefined member set to true.<br>
+  bool prepIsProcessingEnabled();<br>
+<br>
+  // Report an error, if we reach EOF with non-empty preprocessing control<br>
+  // stack.  This means there is no matching #endif for the previous<br>
+  // #ifdef/#else.<br>
+  void prepReportPreprocessorStackError();<br>
 };<br>
<br>
 } // end namespace llvm<br>
<br>
Modified: llvm/trunk/lib/TableGen/TGParser.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGParser.h?rev=347092&r1=347091&r2=347092&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGParser.h?rev=347092&r1=347091&r2=347092&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/TableGen/TGParser.h (original)<br>
+++ llvm/trunk/lib/TableGen/TGParser.h Fri Nov 16 12:57:29 2018<br>
@@ -115,8 +115,9 @@ class TGParser {<br>
   };<br>
<br>
 public:<br>
-  TGParser(SourceMgr &SrcMgr, RecordKeeper &records)<br>
-      : Lex(SrcMgr), CurMultiClass(nullptr), Records(records) {}<br>
+  TGParser(SourceMgr &SrcMgr, ArrayRef<std::string> Macros,<br>
+           RecordKeeper &records)<br>
+    : Lex(SrcMgr, Macros), CurMultiClass(nullptr), Records(records) {}<br>
<br>
   /// ParseFile - Main entrypoint for parsing a tblgen file.  These parser<br>
   /// routines return true on error, or false on success.<br>
<br>
Added: llvm/trunk/test/TableGen/<a href="http://prep-diag1.td" target="_blank">prep-diag1.td</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag1.td?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag1.td?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/<a href="http://prep-diag1.td" target="_blank">prep-diag1.td</a> (added)<br>
+++ llvm/trunk/test/TableGen/<a href="http://prep-diag1.td" target="_blank">prep-diag1.td</a> Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,26 @@<br>
+// RUN: not llvm-tblgen -DDIAG1 -I %p %s 2>&1 | FileCheck --check-prefixes=DIAG1 %s<br>
+// RUN: not llvm-tblgen -DDIAG4 -I %p %s 2>&1 | FileCheck --check-prefixes=DIAG4 %s<br>
+// RUN: not llvm-tblgen -DDIAG2 -I %p %s 2>&1 | FileCheck --check-prefixes=DIAG2 %s<br>
+// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck --check-prefixes=DIAG3 %s<br>
+<br>
+#ifdef DIAG1<br>
+// DIAG1: error: Only comments are supported after #define NAME<br>
+#define ENABLED1/*<br>
+*/class C;<br>
+#endif // DIAG1<br>
+<br>
+#ifdef DIAG4<br>
+// DIAG4: warning: Duplicate definition of macro: ENABLED1<br>
+#define ENABLED1<br>
+#define ENABLED1<br>
+#endif // DIAG4<br>
+<br>
+#ifdef DIAG2<br>
+// DIAG2: error: Only comments are supported after #ifdef NAME<br>
+<br>
+// Invalid #ifdef below should be detected even if DIAG2 is not defined.<br>
+// DIAG3: error: Only comments are supported after #ifdef NAME<br>
+#ifdef DIAG2/*<br>
+*/class C;<br>
+#endif<br>
+#endif // DIAG2<br>
<br>
Added: llvm/trunk/test/TableGen/<a href="http://prep-diag10.td" target="_blank">prep-diag10.td</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag10.td?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag10.td?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/<a href="http://prep-diag10.td" target="_blank">prep-diag10.td</a> (added)<br>
+++ llvm/trunk/test/TableGen/<a href="http://prep-diag10.td" target="_blank">prep-diag10.td</a> Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,6 @@<br>
+// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s<br>
+<br>
+// CHECK: error: Reached EOF without matching #endif<br>
+// CHECK: error: The latest preprocessor control is here<br>
+#ifdef DISABLED<br>
+#else<br>
<br>
Added: llvm/trunk/test/TableGen/prep-diag11-include.inc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag11-include.inc?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag11-include.inc?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/prep-diag11-include.inc (added)<br>
+++ llvm/trunk/test/TableGen/prep-diag11-include.inc Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1 @@<br>
+#ifdef ENABLED<br>
<br>
Added: llvm/trunk/test/TableGen/<a href="http://prep-diag11.td" target="_blank">prep-diag11.td</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag11.td?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag11.td?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/<a href="http://prep-diag11.td" target="_blank">prep-diag11.td</a> (added)<br>
+++ llvm/trunk/test/TableGen/<a href="http://prep-diag11.td" target="_blank">prep-diag11.td</a> Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,8 @@<br>
+// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s<br>
+<br>
+// CHECK: error: Reached EOF without matching #endif<br>
+// CHECK: error: The latest preprocessor control is here<br>
+#ifdef DISABLED<br>
+#else<br>
+#define ENABLED<br>
+include "prep-diag11-include.inc"<br>
<br>
Added: llvm/trunk/test/TableGen/prep-diag12-include.inc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag12-include.inc?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag12-include.inc?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/prep-diag12-include.inc (added)<br>
+++ llvm/trunk/test/TableGen/prep-diag12-include.inc Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,2 @@<br>
+#ifdef ENABLED<br>
+#else<br>
<br>
Added: llvm/trunk/test/TableGen/<a href="http://prep-diag12.td" target="_blank">prep-diag12.td</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag12.td?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag12.td?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/<a href="http://prep-diag12.td" target="_blank">prep-diag12.td</a> (added)<br>
+++ llvm/trunk/test/TableGen/<a href="http://prep-diag12.td" target="_blank">prep-diag12.td</a> Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,8 @@<br>
+// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s<br>
+<br>
+// CHECK: error: Reached EOF without matching #endif<br>
+// CHECK: error: The latest preprocessor control is here<br>
+#ifdef DISABLED<br>
+#else<br>
+#define ENABLED<br>
+include "prep-diag12-include.inc"<br>
<br>
Added: llvm/trunk/test/TableGen/<a href="http://prep-diag13.td" target="_blank">prep-diag13.td</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag13.td?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag13.td?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/<a href="http://prep-diag13.td" target="_blank">prep-diag13.td</a> (added)<br>
+++ llvm/trunk/test/TableGen/<a href="http://prep-diag13.td" target="_blank">prep-diag13.td</a> Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,9 @@<br>
+// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s<br>
+<br>
+// CHECK: error: Reached EOF without matching #endif<br>
+// CHECK: error: The latest preprocessor control is here<br>
+#ifdef DISABLED<br>
+/*<br>
+#else<br>
+#endif<br>
+*/<br>
<br>
Added: llvm/trunk/test/TableGen/<a href="http://prep-diag14.td" target="_blank">prep-diag14.td</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag14.td?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag14.td?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/<a href="http://prep-diag14.td" target="_blank">prep-diag14.td</a> (added)<br>
+++ llvm/trunk/test/TableGen/<a href="http://prep-diag14.td" target="_blank">prep-diag14.td</a> Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,6 @@<br>
+// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s<br>
+<br>
+// CHECK: error: Reached EOF without matching #endif<br>
+// CHECK: error: The latest preprocessor control is here<br>
+#ifdef DISABLED<br>
+// #endif<br>
<br>
Added: llvm/trunk/test/TableGen/<a href="http://prep-diag2.td" target="_blank">prep-diag2.td</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag2.td?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag2.td?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/<a href="http://prep-diag2.td" target="_blank">prep-diag2.td</a> (added)<br>
+++ llvm/trunk/test/TableGen/<a href="http://prep-diag2.td" target="_blank">prep-diag2.td</a> Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,14 @@<br>
+// RUN: not llvm-tblgen -DDIAG1 -I %p %s 2>&1 | FileCheck --check-prefixes=DIAG1 %s<br>
+// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck --check-prefixes=DIAG2 %s<br>
+<br>
+#ifdef DIAG1<br>
+// DIAG1: error: Only comments are supported after #else<br>
+<br>
+// Invalid #else below should be detected even if DIAG1 is not defined.<br>
+// DIAG2: error: Only comments are supported after #else<br>
+#ifdef DIAG2//DIAG2<br>
+#else/*<br>
+*/class C;<br>
+#endif<br>
+#endif // DIAG1<br>
+<br>
<br>
Added: llvm/trunk/test/TableGen/<a href="http://prep-diag3.td" target="_blank">prep-diag3.td</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag3.td?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag3.td?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/<a href="http://prep-diag3.td" target="_blank">prep-diag3.td</a> (added)<br>
+++ llvm/trunk/test/TableGen/<a href="http://prep-diag3.td" target="_blank">prep-diag3.td</a> Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,14 @@<br>
+// RUN: not llvm-tblgen -DDIAG1 -I %p %s 2>&1 | FileCheck --check-prefixes=DIAG1 %s<br>
+// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck --check-prefixes=DIAG2 %s<br>
+<br>
+#ifdef DIAG1<br>
+// DIAG1: error: Only comments are supported after #endif<br>
+<br>
+// Invalid #else below should be detected even if DIAG1 is not defined.<br>
+// DIAG2: error: Only comments are supported after #endif<br>
+#ifdef DIAG2//DIAG2<br>
+#else/*!DIAG2*/<br>
+#endif/* !DIAG2<br>
+*/class C;<br>
+#endif // DIAG1<br>
+<br>
<br>
Added: llvm/trunk/test/TableGen/<a href="http://prep-diag4.td" target="_blank">prep-diag4.td</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag4.td?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag4.td?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/<a href="http://prep-diag4.td" target="_blank">prep-diag4.td</a> (added)<br>
+++ llvm/trunk/test/TableGen/<a href="http://prep-diag4.td" target="_blank">prep-diag4.td</a> Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,8 @@<br>
+// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s<br>
+<br>
+// CHECK: error: double #else<br>
+// CHECK: error: Previous #else is here<br>
+#ifdef DIAG1<br>
+#else<br>
+#else<br>
+#endif<br>
<br>
Added: llvm/trunk/test/TableGen/<a href="http://prep-diag5.td" target="_blank">prep-diag5.td</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag5.td?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag5.td?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/<a href="http://prep-diag5.td" target="_blank">prep-diag5.td</a> (added)<br>
+++ llvm/trunk/test/TableGen/<a href="http://prep-diag5.td" target="_blank">prep-diag5.td</a> Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,6 @@<br>
+// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s<br>
+<br>
+// CHECK: error: #else without #ifdef<br>
+#else<br>
+#else<br>
+#endif<br>
<br>
Added: llvm/trunk/test/TableGen/<a href="http://prep-diag6.td" target="_blank">prep-diag6.td</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag6.td?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag6.td?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/<a href="http://prep-diag6.td" target="_blank">prep-diag6.td</a> (added)<br>
+++ llvm/trunk/test/TableGen/<a href="http://prep-diag6.td" target="_blank">prep-diag6.td</a> Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,7 @@<br>
+// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s<br>
+<br>
+// CHECK: error: Expected macro name after #ifdef<br>
+#ifdef<br>
+#else<br>
+#else<br>
+#endif<br>
<br>
Added: llvm/trunk/test/TableGen/<a href="http://prep-diag7.td" target="_blank">prep-diag7.td</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag7.td?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag7.td?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/<a href="http://prep-diag7.td" target="_blank">prep-diag7.td</a> (added)<br>
+++ llvm/trunk/test/TableGen/<a href="http://prep-diag7.td" target="_blank">prep-diag7.td</a> Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,4 @@<br>
+// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s<br>
+<br>
+// CHECK: error: #endif without #ifdef<br>
+#endif<br>
<br>
Added: llvm/trunk/test/TableGen/<a href="http://prep-diag8.td" target="_blank">prep-diag8.td</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag8.td?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag8.td?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/<a href="http://prep-diag8.td" target="_blank">prep-diag8.td</a> (added)<br>
+++ llvm/trunk/test/TableGen/<a href="http://prep-diag8.td" target="_blank">prep-diag8.td</a> Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,5 @@<br>
+// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s<br>
+<br>
+// CHECK: error: Expected macro name after #define<br>
+#define<br>
+#endif<br>
<br>
Added: llvm/trunk/test/TableGen/<a href="http://prep-diag9.td" target="_blank">prep-diag9.td</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag9.td?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-diag9.td?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/<a href="http://prep-diag9.td" target="_blank">prep-diag9.td</a> (added)<br>
+++ llvm/trunk/test/TableGen/<a href="http://prep-diag9.td" target="_blank">prep-diag9.td</a> Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,5 @@<br>
+// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s<br>
+<br>
+// CHECK: error: Reached EOF without matching #endif<br>
+// CHECK: error: The latest preprocessor control is here<br>
+#ifdef DISABLED<br>
<br>
Added: llvm/trunk/test/TableGen/prep-region-include.inc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-region-include.inc?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-region-include.inc?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/prep-region-include.inc (added)<br>
+++ llvm/trunk/test/TableGen/prep-region-include.inc Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,8 @@<br>
+#ifdef ENABLED4<br>
+def ifdef_enabled4 : C;<br>
+#else<br>
+def ifdef_enabled4_else : C;<br>
+#endif<br>
+<br>
+// EOF immediately after ENABLED5<br>
+#define ENABLED5<br>
<br>
Added: llvm/trunk/test/TableGen/<a href="http://prep-region-processing.td" target="_blank">prep-region-processing.td</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-region-processing.td?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/prep-region-processing.td?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/<a href="http://prep-region-processing.td" target="_blank">prep-region-processing.td</a> (added)<br>
+++ llvm/trunk/test/TableGen/<a href="http://prep-region-processing.td" target="_blank">prep-region-processing.td</a> Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,150 @@<br>
+// RUN: llvm-tblgen -I %p %s 2>&1 | FileCheck %s --implicit-check-not warning:<br>
+<br>
+class C;<br>
+<br>
+// TableGen prints records in alpabetical order.<br>
+// CHECK-NOT: def ifdef_disabled1<br>
+// CHECK-NOT: def ifdef_disabled2<br>
+// CHECK:     def ifdef_disabled3<br>
+// CHECK-NOT: def ifdef_disabled4<br>
+// CHECK-NOT: def ifdef_disabled5<br>
+// CHECK:     def ifdef_disabled4_else<br>
+// CHECK-NOT: def ifdef_disabled5_else<br>
+// CHECK:     def ifdef_enabled1<br>
+// CHECK-NOT: def ifdef_enabled2<br>
+// CHECK:     def ifdef_enabled3<br>
+// CHECK:     def ifdef_enabled4<br>
+// CHECK-NOT: def ifdef_enabled4_else<br>
+// CHECK:     def ifdef_enabled5<br>
+// CHECK:     def ifdef_enabled6<br>
+// CHECK-NOT: def ifdef_enabled6_else<br>
+// CHECK-NOT: def ifdef_disabled6<br>
+// CHECK-NOT: def ifdef_disabled6_else<br>
+<br>
+#define ENABLED1<br>
+#define ENABLED2<br>
+<br>
+#ifdef DISABLED1<br>
+//<br>
+def ifdef_disabled1 : C;<br>
+<br>
+#define DISABLED2/*This one is disabled,<br>
+                   because DISABLED1 is.<br>
+*/<br>
+#endif<br>
+<br>
+#ifdef ENABLED1<br>
+def ifdef_enabled1 : C;<br>
+#endif<br>
+<br>
+#ifdef DISABLED2/*<br>
+*/<br>
+def ifdef_disabled2 : C;<br>
+#endif<br>
+<br>
+/*<br>
+#ifdef ENABLED2<br>
+def ifdef_enabled2 : C;<br>
+#endif<br>
+*/<br>
+<br>
+//#ifdef DISABLED3<br>
+def ifdef_disabled3 : C;<br>
+<br>
+//#endif<br>
+<br>
+/* _DISABLED4 */  /* padding */ #ifdef _DISABLED4<br>
+def ifdef_disabled4 : C;<br>
+#else//      /*!_DISABLED4<br>
+def ifdef_disabled4_else : C;<br>
+<br>
+#define ENABLED3<br>
+#endif<br>
+<br>
+#ifdef __DISABLED5<br>
+def ifdef_disabled5 : C;<br>
+/*<br>
+<br>
+*/#else<br>
+#ifdef ENABLED3<br>
+def ifdef_enabled3 : C;<br>
+#else /* //!ENABLED3<br>
+*/<br>
+def ifdef_disabled5_else : C;<br>
+#endif<br>
+#endif<br>
+<br>
+#define ENABLED4<br>
+include "prep-region-include.inc"//ENABLED5 is defined inside<br>
+<br>
+#ifdef ENABLED5<br>
+def ifdef_enabled5 : C;<br>
+#endif // ENABLED5<br>
+<br>
+#ifdef DISABLED6__<br>
+// Double inclusion is an error.<br>
+include "prep-region-include.inc"<br>
+#else<br>
+#endif<br>
+<br>
+#ifdef DIS<br>
+#ifdef DIS<br>
+#ifdef DIS<br>
+#ifdef DIS<br>
+#ifdef DIS<br>
+#ifdef DIS<br>
+#ifdef DIS<br>
+#ifdef DIS<br>
+#ifdef DIS<br>
+#ifdef DIS<br>
+#ifdef DIS<br>
+def ifdef_disabled6 : C;<br>
+#endif<br>
+#endif<br>
+#endif<br>
+#endif<br>
+#else<br>
+def ifdef_disabled6_else : C;<br>
+#endif<br>
+#endif<br>
+#endif<br>
+#endif<br>
+#endif<br>
+#endif<br>
+#else<br>
+#define ENAB//ENAB<br>
+#endif<br>
+<br>
+#ifdef ENAB<br>
+#ifdef ENAB<br>
+#ifdef ENAB<br>
+#ifdef ENAB<br>
+#ifdef ENAB<br>
+#ifdef ENAB<br>
+#ifdef ENAB<br>
+#ifdef ENAB<br>
+#ifdef ENAB<br>
+#ifdef ENAB<br>
+#ifdef ENAB<br>
+def ifdef_enabled6 : C;<br>
+#endif<br>
+#endif<br>
+#endif<br>
+#endif<br>
+#else<br>
+def ifdef_enabled6_else : C;<br>
+#endif<br>
+#endif<br>
+#endif<br>
+#endif<br>
+#endif<br>
+#endif<br>
+#endif<br>
+<br>
+#ifdef DISABLED_7<br>
+include "non-existent-file.inc"<br>
+#endif<br>
+<br>
+#ifdef DISABLED_8<br>
+\\\\\ invalid TD text /////<br>
+#endif // DISABLED_8<br>
<br>
Added: llvm/trunk/test/TableGen/unterminated-c-comment-include.inc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/unterminated-c-comment-include.inc?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/unterminated-c-comment-include.inc?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/unterminated-c-comment-include.inc (added)<br>
+++ llvm/trunk/test/TableGen/unterminated-c-comment-include.inc Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,2 @@<br>
+/* comment starts here and finished in the parent file.<br>
+   TableGen used to allow such usage.<br>
<br>
Added: llvm/trunk/test/TableGen/<a href="http://unterminated-c-comment.td" target="_blank">unterminated-c-comment.td</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/unterminated-c-comment.td?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/unterminated-c-comment.td?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/<a href="http://unterminated-c-comment.td" target="_blank">unterminated-c-comment.td</a> (added)<br>
+++ llvm/trunk/test/TableGen/<a href="http://unterminated-c-comment.td" target="_blank">unterminated-c-comment.td</a> Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,5 @@<br>
+// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s<br>
+<br>
+// CHECK: error: Unterminated comment!<br>
+<br>
+include "unterminated-c-comment-include.inc" */<br>
<br>
Added: llvm/trunk/test/TableGen/unterminated-code-block-include.inc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/unterminated-code-block-include.inc?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/unterminated-code-block-include.inc?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/unterminated-code-block-include.inc (added)<br>
+++ llvm/trunk/test/TableGen/unterminated-code-block-include.inc Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,8 @@<br>
+class test<code C> {<br>
+  code Code = C;<br>
+}<br>
+<br>
+// TableGen used to allow code blocks starting in one file<br>
+// and finishing in the parent one.  This test checks<br>
+// that this is reported as an error from now on.<br>
+def foo : test<[{ hello world!<br>
<br>
Added: llvm/trunk/test/TableGen/<a href="http://unterminated-code-block.td" target="_blank">unterminated-code-block.td</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/unterminated-code-block.td?rev=347092&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/unterminated-code-block.td?rev=347092&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/TableGen/<a href="http://unterminated-code-block.td" target="_blank">unterminated-code-block.td</a> (added)<br>
+++ llvm/trunk/test/TableGen/<a href="http://unterminated-code-block.td" target="_blank">unterminated-code-block.td</a> Fri Nov 16 12:57:29 2018<br>
@@ -0,0 +1,5 @@<br>
+// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s<br>
+<br>
+// CHECK: error: Unterminated Code Block<br>
+<br>
+include "unterminated-code-block-include.inc" }]>;<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</body>
</html>