[llvm] [TableGen] Detect invalid -D arguments and fail (PR #102813)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 13 10:54:14 PDT 2024
================
@@ -44,6 +44,28 @@ constexpr PreprocessorDir PreprocessorDirs[] = {{tgtok::Ifdef, "ifdef"},
{tgtok::Endif, "endif"},
{tgtok::Define, "define"}};
+// Returns a pointer past the end of a valid macro name at the start of `Str`.
+// Valid macro names match the regular expression [a-zA-Z_][0-9a-zA-Z_]*.
+static const char *lexMacroName(StringRef Str) {
+ assert(!Str.empty());
----------------
jurahul wrote:
Makes sense. I have tried to reduce the whitespace, and have 3 sections: initial assert, first char check, rest chech. PTAL.
https://github.com/llvm/llvm-project/pull/102813
More information about the llvm-commits
mailing list