[PATCH] modularize - header dependencies - version 2

John Thompson john.thompson.jtsoftware at gmail.com
Mon May 5 18:11:27 PDT 2014


Committed in r189837 (and fixes r189983 r189984).

================
Comment at: modularize/Modularize.cpp:281
@@ +280,3 @@
+      std::string File(
+        std::string("\"") + FileDependents[Index] + std::string("\""));
+      NewArgs.push_back(FileDependents[Index]);
----------------
Sean Silva wrote:
> Is the quoting here actually necessary? I don't think that there is a shell-escaping step after this.
It's needed because the path might have spaces (i.e. the default Sony sdk path does).

================
Comment at: modularize/Modularize.cpp:287-302
@@ +286,18 @@
+  // Helper function for finding the input file in an arguments list.
+  llvm::StringRef findInputFile(const CommandLineArguments &CLArgs) {
+    OwningPtr<OptTable> Opts(createDriverOptTable());
+    const unsigned IncludedFlagsBitmask = options::CC1Option;
+    unsigned MissingArgIndex, MissingArgCount;
+    SmallVector<const char*, 256> Argv;
+    for (CommandLineArguments::const_iterator I = CLArgs.begin(),
+          E = CLArgs.end();
+        I != E; ++I)
+      Argv.push_back(I->c_str());
+    OwningPtr<InputArgList> Args(
+      Opts->ParseArgs(Argv.data(), Argv.data() + Argv.size(),
+                      MissingArgIndex, MissingArgCount,
+                      IncludedFlagsBitmask));
+    std::vector<std::string> Inputs = Args->getAllArgValues(OPT_INPUT);
+    return Inputs.back();
+  }
+  DependencyMap &Dependencies;
----------------
Sean Silva wrote:
> Does this function actually use any of the class members? It seems like it should be a free function.
Got it.

================
Comment at: modularize/Modularize.cpp:292-294
@@ +291,5 @@
+    SmallVector<const char*, 256> Argv;
+    for (CommandLineArguments::const_iterator I = CLArgs.begin(),
+          E = CLArgs.end();
+        I != E; ++I)
+      Argv.push_back(I->c_str());
----------------
Sean Silva wrote:
> clang-format
Got it.

http://reviews.llvm.org/D1474






More information about the cfe-commits mailing list