summaryrefslogtreecommitdiffstats
path: root/clang/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
commit8d4a202aad0dfe57ef2a54334f0b8725a5821b37 (patch)
treeaaa5a0252e5592f9a1cae352ddc23d1e7e3dacfa /clang/tools/index-test/index-test.cpp
parentd613677ec9d0de87b6437765cbc9f7fd7c4fa62e (diff)
downloadbcm5719-llvm-8d4a202aad0dfe57ef2a54334f0b8725a5821b37.tar.gz
bcm5719-llvm-8d4a202aad0dfe57ef2a54334f0b8725a5821b37.zip
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).
llvm-svn: 91238
Diffstat (limited to 'clang/tools/index-test/index-test.cpp')
-rw-r--r--clang/tools/index-test/index-test.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/tools/index-test/index-test.cpp b/clang/tools/index-test/index-test.cpp
index 0b1971f797c..8b12c0ba8cd 100644
--- a/clang/tools/index-test/index-test.cpp
+++ b/clang/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) {
OpenPOWER on IntegriCloud