[llvm] [llvm-tblgen] Added keyword #undef to llvm-tblgen and fixed a small b… (PR #69135)

via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 15 19:34:36 PDT 2023


github-actions[bot] wrote:


<!--LLVM CODE FORMAT COMMENT: {clang-format}-->

:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 819ac45d1c1b7a2d784b2606c84de46ce714f278 19fc7b3caca4a43fc1e7204d6957f5298d16c871 -- llvm/lib/TableGen/TGLexer.cpp llvm/lib/TableGen/TGLexer.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/TableGen/TGLexer.cpp b/llvm/lib/TableGen/TGLexer.cpp
index ab6c1b7fc704..256925b33a36 100644
--- a/llvm/lib/TableGen/TGLexer.cpp
+++ b/llvm/lib/TableGen/TGLexer.cpp
@@ -35,14 +35,9 @@ namespace {
 struct {
   tgtok::TokKind Kind;
   const char *Word;
-} PreprocessorDirs[] = {
-  { tgtok::Ifdef, "ifdef" },
-  { tgtok::Ifndef, "ifndef" },
-  { tgtok::Else, "else" },
-  { tgtok::Endif, "endif" },
-  { tgtok::Define, "define" }, 
-  { tgtok::Undef, "undef" }
-};
+} PreprocessorDirs[] = {{tgtok::Ifdef, "ifdef"},   {tgtok::Ifndef, "ifndef"},
+                        {tgtok::Else, "else"},     {tgtok::Endif, "endif"},
+                        {tgtok::Define, "define"}, {tgtok::Undef, "undef"}};
 } // end anonymous namespace
 
 TGLexer::TGLexer(SourceMgr &SM, ArrayRef<std::string> Macros) : SrcMgr(SM) {
@@ -852,7 +847,7 @@ tgtok::TokKind TGLexer::lexPreprocessor(
       PrintFatalError("#undef must be ignored during the lines skipping");
       return tgtok::Error;
     }
-    
+
     return LexToken();
   }
 
diff --git a/llvm/lib/TableGen/TGLexer.h b/llvm/lib/TableGen/TGLexer.h
index 0b36249b4a57..02d141b629e1 100644
--- a/llvm/lib/TableGen/TGLexer.h
+++ b/llvm/lib/TableGen/TGLexer.h
@@ -72,7 +72,7 @@ enum TokKind {
   Else,
   Endif,
   Define,
-  Undef, 
+  Undef,
 
   // Reserved keywords. ('ElseKW' is named to distinguish it from the
   // existing 'Else' that means the preprocessor #else.)

``````````

</details>


https://github.com/llvm/llvm-project/pull/69135


More information about the llvm-commits mailing list