[PATCH] D36782: [Bash-autocompletion] Add support for static analyzer flags

Rui Ueyama via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 17 13:09:08 PDT 2017


ruiu added inline comments.


================
Comment at: clang/include/clang/Driver/CC1Options.td:104
+  ValuesCode<[{
+    const char* Values =
+    #define GET_CHECKERS
----------------
`const char* Values` -> `const char *Values`


================
Comment at: llvm/utils/TableGen/OptParserEmitter.cpp:308
+    const Record &R = *Opts[I];
+    if (!isa<UnsetInit>(R.getValueInit("ValuesCode"))) {
+      OS << "{\n";
----------------
Maybe it is better to do early continue to reduce indentation depth.

  if (isa<UnsetInit>(R.getValueInit("ValuesCode")))
    continue;


================
Comment at: llvm/utils/TableGen/OptParserEmitter.cpp:313-314
+      for (const std::string &Pref : R.getValueAsListOfStrings("Prefixes")) {
+        OS << "bool ValuesWereAdded = ";
+        OS << "Opt.addValues(";
+        std::string S = (Pref + R.getValueAsString("Name")).str();
----------------
You can combine these two lines:

  OS << "bool ValuesWereAdded = Opt.addValues(";


================
Comment at: llvm/utils/TableGen/OptParserEmitter.cpp:318-319
+        OS << ", Values);\n";
+        OS << "(void)ValuesWereAdded;\nassert(ValuesWereAdded &&";
+        OS << " \"Couldn't add values to OptTable!\");\n";
+      }
----------------
It is more readable if you split it at a natural boundary:

  OS << "(void)ValuesWereAdded;\n";
  OS << "assert(ValuesWereAdded && \"Couldn't add values to OptTable!\");\n";


https://reviews.llvm.org/D36782





More information about the cfe-commits mailing list