[llvm] Added keyword #undef to llvm-tblgen and fixed a small bug for llvm-tb… (PR #69093)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 15 00:27:04 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 0187960cdd0cc640317b29a2f25a0c30df3f68ef 2f4529974677a075290f5038d0e7df4d897a34c8 -- 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 87d3627f10ca..f00640dd13e3 100644
--- a/llvm/lib/TableGen/TGLexer.cpp
+++ b/llvm/lib/TableGen/TGLexer.cpp
@@ -12,8 +12,8 @@
#include "TGLexer.h"
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Config/config.h" // for strtoull()/strtoll() define
#include "llvm/Support/Compiler.h"
@@ -36,14 +36,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) {
@@ -666,8 +661,7 @@ tgtok::TokKind TGLexer::prepIsDirective() const {
// It looks like TableGen does not support '\r' as the actual
// carriage return, e.g. getNextChar() treats a single '\r'
// as '\n'. So we do the same here.
- NextChar == '\r' ||
- NextChar == '\0')
+ NextChar == '\r' || NextChar == '\0')
return Kind;
// Allow comments after some directives, e.g.:
@@ -854,7 +848,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/69093
More information about the llvm-commits
mailing list