-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[NFC][TableGen] Refactor preprocessor directive handling #102967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make PreprocessDirs array constexpr
The subject isn't accurate as this patch has other refactoring.
llvm/lib/TableGen/TGLexer.cpp
Outdated
}; | ||
} // end anonymous namespace | ||
|
||
static constexpr PreprocessorDir PreprocessorDirs[] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just constexpr
. This has internal linkage even without static
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
How about: Refactor preprocessor directive handling in TableGen ? |
- Make `PreprocessorDirs` array constexpr, move its definition outside the anonymous namespace, and make it static. - Change `Word` field to a StringRef. - Simplify `prepIsDirective` to use StringRef comparison and early `continue` per LLVM coding standards. - Use C++17 structured bindings to iterate over the array.
55536b6
to
00f731f
Compare
Thanks @s-barannikov. Can one of you please merge the PR? |
Thanks! |
- Fixes an issue in llvm#102967, which inddvertently changed the type of `NextChar` from int to char, causing ppc64le build failures.
Fixes an issue in #102967, which inddvertently changed the type of `NextChar` from int to char, causing ppc64le build failures.
PreprocessorDirs
array constexpr, move its definition outside the anonymous namespace, and make it static.Word
field to a StringRef.prepIsDirective
to use StringRef comparison and earlycontinue
per LLVM coding standards.