Skip to content

Commit 0807966

Browse files
committed
[clang] WIP: Warn on mismatched RequiresCapability attributes
1 parent 3e97db8 commit 0807966

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

clang/lib/Parse/Parser.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -1484,6 +1484,18 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D,
14841484
if (LateParsedAttrs)
14851485
ParseLexedAttributeList(*LateParsedAttrs, Res, false, true);
14861486

1487+
if (Res) {
1488+
for (const auto *FD : Res->redecls()) {
1489+
if (FD == Res)
1490+
continue;
1491+
if (Res->hasAttr<RequiresCapabilityAttr>() &&
1492+
!FD->hasAttr<RequiresCapabilityAttr>()) {
1493+
// Definition has attribute, but the declaration doesn't.
1494+
llvm::errs() << "AHA!\n";
1495+
}
1496+
}
1497+
}
1498+
14871499
return ParseFunctionStatementBody(Res, BodyScope);
14881500
}
14891501

0 commit comments

Comments
 (0)