[PATCH] D24933: Enable configuration files in clang

Bruno Cardoso Lopes via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 12 11:11:13 PST 2016


bruno added inline comments.


================
Comment at: include/clang/Driver/Driver.h:287
+  const std::string &getConfigFile() const { return ConfigFile; }
+  void setConfigFile(StringRef x, unsigned N) {
+    ConfigFile = x;
----------------
x -> FileName


================
Comment at: lib/Driver/Driver.cpp:172
+    NumConfigArgs = static_cast<unsigned>(NumCfgArgs);
+  }
+
----------------
If `NumCfgArgs == 0` it would be nice to warn that the config file is empty?


================
Comment at: lib/Driver/Driver.cpp:2698
+  for (unsigned I = 0; I < NumConfigArgs; ++I)
+    C.getArgs().getArgs()[I]->claim();
+
----------------
Why shouldn't we warn about those? Should clang warn and point to the config file instead?


================
Comment at: tools/driver/driver.cpp:318
+
+/// Deduce configuration name if it is encoded in the executable name.
+///
----------------
Use  `\brief` here?


================
Comment at: tools/driver/driver.cpp:333
+  size_t Pos = PName.find("-clang");
+  if (Pos != StringRef::npos) {
+    ConfigFile.append(PName.begin(), PName.begin() + Pos);
----------------
You can early `return false` here if `Pos == StringRef::npos`


https://reviews.llvm.org/D24933





More information about the cfe-commits mailing list