[PATCH] D93453: [flang][driver] Add support for `-I`

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 17 08:38:14 PST 2020


awarzynski added a comment.

Hi @FarisRehman ! Thank you for working on this! Could you add tests?



================
Comment at: clang/lib/Driver/ToolChains/Flang.cpp:75
 
+  Args.AddAllArgs(CmdArgs, options::OPT_I);
+
----------------
This would ideally go to a dedicated method for parsing preprocessor options.


================
Comment at: flang/include/flang/Frontend/PreprocessorOptions.h:13
   std::vector<std::pair<std::string, bool /*isUndef*/>> Macros;
+  std::vector<std::string> SearchDirectoriesFromI;
 
----------------
[nit] I'd be tempted to be more explicit here, e.g. `SearchDirectoriesFromDashI;`.


================
Comment at: flang/lib/Frontend/CompilerInvocation.cpp:170
+  // Add the ordered list of -I's.
+  for (const auto *A : args.filtered(clang::driver::options::OPT_I))
+    opts.SearchDirectoriesFromI.emplace_back(A->getValue());
----------------
Lower case, sadly.


================
Comment at: flang/lib/Frontend/CompilerInvocation.cpp:240-243
-  // These defaults are based on the defaults in f18/f18.cpp.
-  std::vector<std::string> searchDirectories{"."s};
-  fortranOptions.searchDirectories = searchDirectories;
   fortranOptions.isFixedForm = false;
----------------
_Moving_ this code seems like _unrelated_ change.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93453/new/

https://reviews.llvm.org/D93453



More information about the cfe-commits mailing list