[llvm] [TableGen] Detect invalid -D arguments and fail (PR #102813)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 10:45:29 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());
----------------
MaskRay wrote:

There are too many blank lines in this function, which does not match the style in the majority of the code base.

The blank lines give readers a pause, but we don't give a pause for nearly every statement. Variables and the immediate use usually do not need a separator.

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


More information about the llvm-commits mailing list