aaron.ballman added inline comments.

================
Comment at: lib/Sema/SemaChecking.cpp:5523
+      StringLiteralCheckType CommonResult;
+      for (const FormatArgAttr *FA : ND->specific_attrs<FormatArgAttr>()) {
         const Expr *Arg = CE->getArg(FA->getFormatIdx().getASTIndex());
----------------
You can use `const auto *FA` here instead; the type is spelled out in the 
initializer.


================
Comment at: lib/Sema/SemaChecking.cpp:5536
+
+      if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
         unsigned BuiltinID = FD->getBuiltinID();
----------------
`const auto *`


================
Comment at: test/Sema/attr-format_arg.c:17
+
+  printf(h("", ""), 123); // expected-warning 2{{format string is empty}}
 }
----------------
Can you add tests for the other permutations as well? It would also be useful 
to put the string literals on their own line so that the expected-warning 
designation matches the specific argument that's being diagnosed. e.g.,
```
h(
  "%d",
  ""
)
h(
  "", 
  "%d"
)
h(
  "%d",
  "%d"
)
```



Repository:
  rC Clang

https://reviews.llvm.org/D48734



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

Reply via email to