summaryrefslogtreecommitdiffstats
path: root/clang/lib/Tooling/CompilationDatabase.cpp
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2012-05-23 22:24:20 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2012-05-23 22:24:20 +0000
commit9b2d17c6137b5d79c7e1765e24ad35465a7fa095 (patch)
treed648dc09adc3aa26d0bad7c28363472bc9f1fb80 /clang/lib/Tooling/CompilationDatabase.cpp
parente351e8c52d2c6a95142c536ad929186940b1a748 (diff)
downloadbcm5719-llvm-9b2d17c6137b5d79c7e1765e24ad35465a7fa095.tar.gz
bcm5719-llvm-9b2d17c6137b5d79c7e1765e24ad35465a7fa095.zip
Tooling: Canonicalize Key in IndexByFile[]. llvm::sys::path::native() may be used here.
It fixes test/Tooling on Win32 hosts. llvm-svn: 157350
Diffstat (limited to 'clang/lib/Tooling/CompilationDatabase.cpp')
-rw-r--r--clang/lib/Tooling/CompilationDatabase.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Tooling/CompilationDatabase.cpp b/clang/lib/Tooling/CompilationDatabase.cpp
index c87833fba63..227fa82926c 100644
--- a/clang/lib/Tooling/CompilationDatabase.cpp
+++ b/clang/lib/Tooling/CompilationDatabase.cpp
@@ -179,8 +179,10 @@ JSONCompilationDatabase::loadFromBuffer(StringRef DatabaseString,
std::vector<CompileCommand>
JSONCompilationDatabase::getCompileCommands(StringRef FilePath) const {
+ llvm::SmallString<128> NativeFilePath;
+ llvm::sys::path::native(FilePath, NativeFilePath);
llvm::StringMap< std::vector<CompileCommandRef> >::const_iterator
- CommandsRefI = IndexByFile.find(FilePath);
+ CommandsRefI = IndexByFile.find(NativeFilePath);
if (CommandsRefI == IndexByFile.end())
return std::vector<CompileCommand>();
const std::vector<CompileCommandRef> &CommandsRef = CommandsRefI->getValue();
@@ -271,7 +273,9 @@ bool JSONCompilationDatabase::parse(std::string &ErrorMessage) {
return false;
}
llvm::SmallString<8> FileStorage;
- IndexByFile[File->getValue(FileStorage)].push_back(
+ llvm::SmallString<128> NativeFilePath;
+ llvm::sys::path::native(File->getValue(FileStorage), NativeFilePath);
+ IndexByFile[NativeFilePath].push_back(
CompileCommandRef(Directory, Command));
}
return true;
OpenPOWER on IntegriCloud