Skip to content
Snippets Groups Projects
Commit ccf86524 authored by Krasimir Georgiev's avatar Krasimir Georgiev
Browse files

[Tooling][libclang] Remove unused CompilationDatabase::MappedSources

Summary:
This field is never assigned to and it's only ever read from libclang.
This patch removes it and adapts libclang to return constants.

Reviewers: klimek, bkramer

Reviewed By: klimek

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D32351

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303635 91177308-0d34-0410-b5e6-96231b3b80d8
parent fd0f94c1
No related branches found
No related tags found
No related merge requests found
...@@ -60,16 +60,6 @@ struct CompileCommand { ...@@ -60,16 +60,6 @@ struct CompileCommand {
/// The output file associated with the command. /// The output file associated with the command.
std::string Output; std::string Output;
/// \brief An optional mapping from each file's path to its content for all
/// files needed for the compilation that are not available via the file
/// system.
///
/// Note that a tool implementation is required to fall back to the file
/// system if a source file is not provided in the mapped sources, as
/// compilation databases will usually not provide all files in mapped sources
/// for performance reasons.
std::vector<std::pair<std::string, std::string> > MappedSources;
}; };
/// \brief Interface for compilation databases. /// \brief Interface for compilation databases.
......
...@@ -145,36 +145,23 @@ clang_CompileCommand_getArg(CXCompileCommand CCmd, unsigned Arg) ...@@ -145,36 +145,23 @@ clang_CompileCommand_getArg(CXCompileCommand CCmd, unsigned Arg)
unsigned unsigned
clang_CompileCommand_getNumMappedSources(CXCompileCommand CCmd) clang_CompileCommand_getNumMappedSources(CXCompileCommand CCmd)
{ {
if (!CCmd) // Left here for backward compatibility. No mapped sources exists in the C++
return 0; // backend anymore.
return 0;
return static_cast<CompileCommand *>(CCmd)->MappedSources.size();
} }
CXString CXString
clang_CompileCommand_getMappedSourcePath(CXCompileCommand CCmd, unsigned I) clang_CompileCommand_getMappedSourcePath(CXCompileCommand CCmd, unsigned I)
{ {
if (!CCmd) // Left here for backward compatibility. No mapped sources exists in the C++
return cxstring::createNull(); // backend anymore.
return cxstring::createNull();
CompileCommand *Cmd = static_cast<CompileCommand *>(CCmd);
if (I >= Cmd->MappedSources.size())
return cxstring::createNull();
return cxstring::createRef(Cmd->MappedSources[I].first.c_str());
} }
CXString CXString
clang_CompileCommand_getMappedSourceContent(CXCompileCommand CCmd, unsigned I) clang_CompileCommand_getMappedSourceContent(CXCompileCommand CCmd, unsigned I)
{ {
if (!CCmd) // Left here for backward compatibility. No mapped sources exists in the C++
return cxstring::createNull(); // backend anymore.
return cxstring::createNull();
CompileCommand *Cmd = static_cast<CompileCommand *>(CCmd);
if (I >= Cmd->MappedSources.size())
return cxstring::createNull();
return cxstring::createRef(Cmd->MappedSources[I].second.c_str());
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment