[clang] 920d90f - The generated code does not need to check for a null Decl; NFC.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 21 12:48:38 PDT 2020


Author: Aaron Ballman
Date: 2020-03-21T15:48:28-04:00
New Revision: 920d90f9663f796c4797f7078684f13c96688069

URL: https://github.com/llvm/llvm-project/commit/920d90f9663f796c4797f7078684f13c96688069
DIFF: https://github.com/llvm/llvm-project/commit/920d90f9663f796c4797f7078684f13c96688069.diff

LOG: The generated code does not need to check for a null Decl; NFC.

It is already assumed to be nonnull by the code calling diagAppertainsToDecl.

Added: 
    

Modified: 
    clang/utils/TableGen/ClangAttrEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index c7380cd49652..601f186086ec 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -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)
@@ -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");


        


More information about the cfe-commits mailing list