CompilerInvocation: Move builtin-include-path logic out of CompilerInvocation::CreateFromArgs.
llvm-svn: 91237
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 8f66d4c..16d2ea9 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -327,7 +327,13 @@
CompilerInvocation CI;
CompilerInvocation::CreateFromArgs(CI, (const char**) CCArgs.data(),
(const char**) CCArgs.data()+CCArgs.size(),
- Argv0, MainAddr, Diags);
+ Diags);
+
+ // Infer the builtin include path if unspecified.
+ if (CI.getHeaderSearchOpts().UseBuiltinIncludes &&
+ CI.getHeaderSearchOpts().BuiltinIncludePath.empty())
+ CI.getHeaderSearchOpts().BuiltinIncludePath =
+ CompilerInvocation::GetBuiltinIncludePath(Argv0, MainAddr);
CI.getFrontendOpts().DisableFree = UseBumpAllocator;
return LoadFromCompilerInvocation(CI, Diags, OnlyLocalDecls);