erik.pilkington added a comment.

Thanks for working on this!



================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:318-320
+def warn_misleading_var_type_decl : Warning<
+  "misleading variable declaration, supposed to be a pointer type instead ?">,
+  InGroup<DiagGroup<"misleading-declarations">>;
----------------
I think this should really be off by default, this is a stylistic warning that 
would be really noisy for existing projects. Also, I think the text might be 
better spelled as "declaring a variable of type %0; did you mean to declare a 
pointer?".  Also, -Wmisleading-declarations doesn't really describe what this 
warning diagnoses. This is C, so there is plenty of ways to write a misleading 
declaration ;). Maybe -Wmisleading-pointer-declarator?


================
Comment at: lib/Sema/SemaStmt.cpp:81
+  DeclStmt *DS = new (Context) DeclStmt(DG, StartLoc, EndLoc);
+  if (DS) {
+    VarDecl *FirstVarDecl = nullptr;
----------------
The null check here is redundant, new (Context) should never return nullptr.


https://reviews.llvm.org/D52791



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to