diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2012-05-23 22:24:20 +0000 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2012-05-23 22:24:20 +0000 |
commit | 62d198c5b1174279174eb35d222b5cee46f3ef6f (patch) | |
tree | 1d5928861931805f1da5d1da0d252fa1fb51f822 /lib/Tooling/CompilationDatabase.cpp | |
parent | 1b8fbd3601e009803565e74d2ec54abecb5cbf73 (diff) |
Tooling: Canonicalize Key in IndexByFile[]. llvm::sys::path::native() may be used here.
It fixes test/Tooling on Win32 hosts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157350 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Tooling/CompilationDatabase.cpp')
-rw-r--r-- | lib/Tooling/CompilationDatabase.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Tooling/CompilationDatabase.cpp b/lib/Tooling/CompilationDatabase.cpp index c87833fba6..227fa82926 100644 --- a/lib/Tooling/CompilationDatabase.cpp +++ b/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; |