-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Clang] Add missing macro undefs in AttributeSpellingList emitter #141090
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
[Clang] Add missing macro undefs in AttributeSpellingList emitter #141090
Conversation
@llvm/pr-subscribers-clang Author: Oleksandr T. (a-tarasyuk) ChangesFixes #140629 (comment) This patch adds Full diff: https://github.com/llvm/llvm-project/pull/141090.diff 2 Files Affected:
diff --git a/clang/lib/Basic/Attributes.cpp b/clang/lib/Basic/Attributes.cpp
index c2f3120aed5d0..ebc86a5adf7a7 100644
--- a/clang/lib/Basic/Attributes.cpp
+++ b/clang/lib/Basic/Attributes.cpp
@@ -233,13 +233,11 @@ unsigned AttributeCommonInfo::calculateAttributeSpellingListIndex() const {
static constexpr const char *AttrSpellingList[] = {
#include "clang/Basic/AttributeSpellingList.inc"
};
-#undef ATTR_NAME
-#define ATTR_SCOPE_SCOPE(SCOPE_NAME) SCOPE_NAME,
+#define ATTR_SCOPE_NAME(SCOPE_NAME) SCOPE_NAME,
static constexpr const char *AttrScopeSpellingList[] = {
#include "clang/Basic/AttributeSpellingList.inc"
};
-#undef ATTR_SCOPE_SCOPE
std::optional<std::string>
AttributeCommonInfo::getCorrectedFullName(const TargetInfo &Target,
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index f6c5c84602762..21d76c12a3cce 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -4146,14 +4146,18 @@ void EmitAttributeSpellingList(const RecordKeeper &Records, raw_ostream &OS) {
OS << "ATTR_NAME(\"" << AttrName << "\")\n";
}
OS << "\n";
+ OS << "#undef ATTR_NAME" << "\n";
+ OS << "\n";
- OS << "#ifndef ATTR_SCOPE_SCOPE" << "\n";
- OS << "#define ATTR_SCOPE_SCOPE(SCOPE_NAME) SCOPE_NAME" << "\n";
+ OS << "#ifndef ATTR_SCOPE_NAME" << "\n";
+ OS << "#define ATTR_SCOPE_NAME(SCOPE_NAME) SCOPE_NAME" << "\n";
OS << "#endif" << "\n" << "\n";
for (const auto &AttrScopeName : AttrScopeSpellingList) {
- OS << "ATTR_SCOPE_SCOPE(\"" << AttrScopeName << "\")\n";
+ OS << "ATTR_SCOPE_NAME(\"" << AttrScopeName << "\")\n";
}
OS << "\n";
+ OS << "#undef ATTR_SCOPE_NAME" << "\n";
+ OS << "\n";
}
static bool isArgVariadic(const Record &R, StringRef AttrName) {
|
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.
LGTM!
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.
LGTM. I've verified that the warning goes away. Thank for fixing this quickly!
Could you please merge this to bring the buildbots back to green? Thanks! |
Done! |
Thank you! |
…vm#141090) Fixes llvm#140629 (comment) --- This patch adds `#undef ATTR_NAME` and `#undef ATTR_SCOPE_NAME` to the end of the generated `AttributeSpellingList.inc` file to prevent macro redefinition warnings
…vm#141090) Fixes llvm#140629 (comment) --- This patch adds `#undef ATTR_NAME` and `#undef ATTR_SCOPE_NAME` to the end of the generated `AttributeSpellingList.inc` file to prevent macro redefinition warnings
Fixes #140629 (comment)
This patch adds
#undef ATTR_NAME
and#undef ATTR_SCOPE_NAME
to theend of the generated
AttributeSpellingList.inc
file to prevent macroredefinition warnings