summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorGeorge Burgess IV <george.burgess.iv@gmail.com>2016-12-01 17:52:39 +0000
committerGeorge Burgess IV <george.burgess.iv@gmail.com>2016-12-01 17:52:39 +0000
commit2f42451024d418bb049e96de5579568ddc091975 (patch)
tree0745395f02c0b79f0014d9f25febb11f67e64fe1 /utils
parentc0504aa4cc2b4a183c6dc98eaf62ca5900fd0e36 (diff)
[TableGen] Ignore fake args for parsing-related arg counts.
We should complain about the following: ``` void foo() __attribute__((unavailable("a", "b"))); ``` Instead, we currently just ignore "b". (...We also end up ignoring "a", because we assume elsewhere that this attribute can only have 1 or 0 args.) This happens because `unavailable` has a fake enum arg, and `AttributeList::{getMinArgs,getMaxArgs}` include fake args in their counts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288388 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/ClangAttrEmitter.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/utils/TableGen/ClangAttrEmitter.cpp b/utils/TableGen/ClangAttrEmitter.cpp
index 78a2eb118b..8185b6ab1e 100644
--- a/utils/TableGen/ClangAttrEmitter.cpp
+++ b/utils/TableGen/ClangAttrEmitter.cpp
@@ -2540,6 +2540,10 @@ static void emitArgInfo(const Record &R, std::stringstream &OS) {
unsigned ArgCount = 0, OptCount = 0;
bool HasVariadic = false;
for (const auto *Arg : Args) {
+ // If the arg is fake, it's the user's job to supply it: general parsing
+ // logic shouldn't need to know anything about it.
+ if (Arg->getValueAsBit("Fake"))
+ continue;
Arg->getValueAsBit("Optional") ? ++OptCount : ++ArgCount;
if (!HasVariadic && isArgVariadic(*Arg, R.getName()))
HasVariadic = true;