[clang] 028092e - Correct the tablegen logic for MutualExclusions attribute checking.
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 7 11:04:17 PDT 2021
Author: Aaron Ballman
Date: 2021-04-07T14:04:08-04:00
New Revision: 028092eb613e5553ce0833878e7d36fcaf11fcb2
URL: https://github.com/llvm/llvm-project/commit/028092eb613e5553ce0833878e7d36fcaf11fcb2
DIFF: https://github.com/llvm/llvm-project/commit/028092eb613e5553ce0833878e7d36fcaf11fcb2.diff
LOG: Correct the tablegen logic for MutualExclusions attribute checking.
Just because an attribute is a statement attribute doesn't mean it's
not also a declaration attribute. In Clang, there are not currently any
DeclOrStmtAttr attributes that require mutual exclusion checking, but
downstream clients discovered this issue.
Added:
Modified:
clang/utils/TableGen/ClangAttrEmitter.cpp
Removed:
################################################################################
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index 6b76ad8ccc0d1..ececceb5d3fd4 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -3644,10 +3644,12 @@ static void GenerateMutualExclusionsChecks(const Record &Attr,
if (Attr.isSubClassOf("TypeAttr"))
return;
- // This means the attribute is either a statement attribute or a decl
- // attribute, find out which.
+ // This means the attribute is either a statement attribute, a decl
+ // attribute, or both; find out which.
bool CurAttrIsStmtAttr =
Attr.isSubClassOf("StmtAttr") || Attr.isSubClassOf("DeclOrStmtAttr");
+ bool CurAttrIsDeclAttr =
+ !CurAttrIsStmtAttr || Attr.isSubClassOf("DeclOrStmtAttr");
std::vector<std::string> DeclAttrs, StmtAttrs;
@@ -3666,7 +3668,7 @@ static void GenerateMutualExclusionsChecks(const Record &Attr,
if (CurAttrIsStmtAttr)
StmtAttrs.push_back((AttrToExclude->getName() + "Attr").str());
- else
+ if (CurAttrIsDeclAttr)
DeclAttrs.push_back((AttrToExclude->getName() + "Attr").str());
}
}
More information about the cfe-commits
mailing list