[PATCH] D59402: Suggestions to fix -Wmissing-{prototypes,variable-declarations}

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 17 08:10:46 PDT 2019


aaron.ballman added inline comments.


================
Comment at: lib/Sema/SemaDecl.cpp:13340-13342
       }
+      else
+        Diag(FD->getTypeSpecStartLoc(), diag::note_static_for_internal_linkage)
----------------
Formatting here is a bit off -- you should run through clang-format. Also, I'd appreciate curly braces even though the `else` clause is technically one line.


================
Comment at: lib/Sema/SemaDecl.cpp:13345-13346
+            << (FD->getStorageClass() == SC_None
+                    ? FixItHint::CreateInsertion(FD->getTypeSpecStartLoc(),
+                                                 "static ")
+                    : FixItHint{});
----------------
We may not want to produce the fixit if there's a macro involved in the declaration. Consider:
```
#ifdef SOMETHING
#define FROBBLE static
#else
#define FROBBLE
#endif

FROBBLE void foo(void);
```
We probably don't want the fixit in the case `SOMETHING` is not defined.


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