Skip to content

Commit

Permalink
The generated code does not need to check for a null Decl; NFC.
Browse files Browse the repository at this point in the history
It is already assumed to be nonnull by the code calling diagAppertainsToDecl.
  • Loading branch information
AaronBallman committed Mar 21, 2020
1 parent 2d712fb commit 920d90f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clang/utils/TableGen/ClangAttrEmitter.cpp
Expand Up @@ -3510,7 +3510,7 @@ static void GenerateAppertainsTo(const Record &Attr, raw_ostream &OS) {
// of the declaration).
OS << "virtual bool diagAppertainsToDecl(Sema &S, ";
OS << "const ParsedAttr &Attr, const Decl *D) const {\n";
OS << " if (!D || (";
OS << " if (";
for (auto I = Subjects.begin(), E = Subjects.end(); I != E; ++I) {
// If the subject has custom code associated with it, use the generated
// function for it. The function cannot be inlined into this check (yet)
Expand All @@ -3526,7 +3526,7 @@ static void GenerateAppertainsTo(const Record &Attr, raw_ostream &OS) {
if (I + 1 != E)
OS << " && ";
}
OS << ")) {\n";
OS << ") {\n";
OS << " S.Diag(Attr.getLoc(), diag::";
OS << (Warn ? "warn_attribute_wrong_decl_type_str" :
"err_attribute_wrong_decl_type_str");
Expand Down

0 comments on commit 920d90f

Please sign in to comment.