aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 57f097f..aeb4ac3 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -176,6 +176,10 @@ static void parsePreprocessorArgs(
opts.addMacroUndef(currentArg->getValue());
}
}
+
+ // Add the ordered list of -I's.
+ for (const auto *currentArg : args.filtered(clang::driver::options::OPT_I))
+ opts.searchDirectoriesFromDashI.emplace_back(currentArg->getValue());
}
bool CompilerInvocation::CreateFromArgs(CompilerInvocation &res,
@@ -261,4 +265,9 @@ void CompilerInvocation::setFortranOpts() {
const auto &preprocessorOptions = preprocessorOpts();
collectMacroDefinitions(preprocessorOptions, fortranOptions);
+
+ fortranOptions.searchDirectories.insert(
+ fortranOptions.searchDirectories.end(),
+ preprocessorOptions.searchDirectoriesFromDashI.begin(),
+ preprocessorOptions.searchDirectoriesFromDashI.end());
}