[PATCH] D52695: [clang][Parse] Diagnose useless null statements (PR39111)

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 2 13:34:45 PDT 2018


rsmith added inline comments.


================
Comment at: include/clang/Basic/DiagnosticGroups.td:164
+def ExtraSemiStmt : DiagGroup<"extra-semi-stmt">;
+def EmptyInitStatement : DiagGroup<"empty-init-stmt">;
 def ExtraSemi : DiagGroup<"extra-semi", [CXX98CompatExtraSemi,
----------------
I think this should either be folded into `-Wextra-semi-stmt` or should perhaps be a subgroup of it.


================
Comment at: include/clang/Basic/DiagnosticGroups.td:167-168
+                                         CXX11ExtraSemi,
+                                         ExtraSemiStmt,
+                                         EmptyInitStatement]>;
 
----------------
I would prefer to keep `-Wextra-semi` and `-Wextra-semi-stmt` separate. `-Wextra-semi` is for those cases that are ill-formed in C++98, whereas your new warning is only about code style / typo detection.


================
Comment at: lib/Parse/ParseStmt.cpp:1600
 
+  llvm::Optional<SourceLocation> EmptyInitStmtSemiLoc;
+
----------------
You can just use a `SourceLocation` here; it already has an 'invalid' state.


Repository:
  rC Clang

https://reviews.llvm.org/D52695





More information about the cfe-commits mailing list