[tooling] In CompileCommand, Expose the 'file' that was associated with the command.

llvm-svn: 247468
This commit is contained in:
Argyrios Kyrtzidis
2015-09-11 20:43:05 +00:00
parent 744267765c
commit 74bcd21e34
7 changed files with 37 additions and 8 deletions

View File

@@ -232,8 +232,11 @@ void JSONCompilationDatabase::getCommands(
std::vector<CompileCommand> &Commands) const {
for (int I = 0, E = CommandsRef.size(); I != E; ++I) {
SmallString<8> DirectoryStorage;
Commands.emplace_back(CommandsRef[I].first->getValue(DirectoryStorage),
nodeToCommandLine(CommandsRef[I].second));
SmallString<32> FilenameStorage;
Commands.emplace_back(
std::get<0>(CommandsRef[I])->getValue(DirectoryStorage),
std::get<1>(CommandsRef[I])->getValue(FilenameStorage),
nodeToCommandLine(std::get<2>(CommandsRef[I])));
}
}
@@ -335,7 +338,7 @@ bool JSONCompilationDatabase::parse(std::string &ErrorMessage) {
llvm::sys::path::native(FileName, NativeFilePath);
}
IndexByFile[NativeFilePath].push_back(
CompileCommandRef(Directory, *Command));
CompileCommandRef(Directory, File, *Command));
MatchTrie.insert(NativeFilePath);
}
return true;