[PATCH] D59402: Fix-it hints for -Wmissing-{prototypes,variable-declarations}

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 24 11:38:53 PDT 2019


rsmith added inline comments.


================
Comment at: lib/Sema/SemaDecl.cpp:11810
+          << var
+          << ((var->getStorageClass() != SC_Extern)
+                  ? FixItHint::CreateInsertion(var->getBeginLoc(), "static ")
----------------
It would be more appropriate to suppress the fixit if any storage class specifier is present, since a declaration can have only one such specifier.


================
Comment at: lib/Sema/SemaDecl.cpp:13225-13230
           if (FunctionNoProtoTypeLoc FTL = TL.getAs<FunctionNoProtoTypeLoc>())
-            Diag(PossibleZeroParamPrototype->getLocation(),
+            Diag(PossiblePrototype->getLocation(),
                  diag::note_declaration_not_a_prototype)
-                << PossibleZeroParamPrototype
+                << PossiblePrototype
                 << FixItHint::CreateInsertion(FTL.getRParenLoc(), "void");
         }
----------------
If we produce this note, we should not also produce the "add static" suggestion.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59402/new/

https://reviews.llvm.org/D59402





More information about the cfe-commits mailing list