aboutsummaryrefslogtreecommitdiff
path: root/tools/index-test/index-test.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-12-13 03:46:13 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-12-13 03:46:13 +0000
commit869824e87940f97b87064db2df2861e82e08a8c6 (patch)
tree46fa24160a6c50347a34be7967f0de7aa5d1f2f3 /tools/index-test/index-test.cpp
parent1e69fe3a9f0a42b32a3000bda51677d51416564e (diff)
Lift builtin-include-path logic out of ASTUnit::LoadFromCommandLine and fix CIndex to pass in the right directory (previously it was using the path to the main executable, which generally is wrong).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91238 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/index-test/index-test.cpp')
-rw-r--r--tools/index-test/index-test.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/index-test/index-test.cpp b/tools/index-test/index-test.cpp
index 0b1971f797..8b12c0ba8c 100644
--- a/tools/index-test/index-test.cpp
+++ b/tools/index-test/index-test.cpp
@@ -223,9 +223,12 @@ ASTUnit *CreateFromSource(const std::string &Filename, Diagnostic &Diags,
for (unsigned i = 0, e = CompilerArgs.size(); i != e; ++i)
Args.push_back(CompilerArgs[i].c_str());
+ void *MainAddr = (void*) (intptr_t) CreateFromSource;
+ llvm::sys::Path ResourcesPath(
+ CompilerInvocation::GetBuiltinIncludePath(Argv0, MainAddr));
+ ResourcesPath.eraseComponent();
return ASTUnit::LoadFromCommandLine(Args.data(), Args.data() + Args.size(),
- Diags, Argv0,
- (void*) (intptr_t) CreateFromSource);
+ Diags, ResourcesPath.str());
}
int main(int argc, char **argv) {