utility: added FilePath abstraction and rewrote data management to use it

The utility class FilePath wraps an instance of boost::filesystem::path. Using FilePath allows for easy comparision of
file paths on different platforms using absolute or relative paths. Whereever file paths are compared, this wrapper
should be used.
This commit is contained in:
Eberhard Graether
2015-03-09 01:51:32 +01:00
parent 7014c8ac4c
commit df888e4151
37 changed files with 387 additions and 126 deletions
+2 -1
View File
@@ -7,6 +7,7 @@
#include "data/parser/ParserClient.h"
class FilePath;
class TextAccess;
class Parser
@@ -16,7 +17,7 @@ public:
virtual ~Parser();
virtual void parseFiles(
const std::vector<std::string>& filePaths,
const std::vector<FilePath>& filePaths,
const std::vector<std::string>& systemHeaderSearchPaths,
const std::vector<std::string>& headerSearchPaths) = 0;
virtual void parseFile(std::shared_ptr<TextAccess> textAccess) = 0;
+9 -3
View File
@@ -59,7 +59,7 @@ CxxParser::~CxxParser()
}
void CxxParser::parseFiles(
const std::vector<std::string>& filePaths,
const std::vector<FilePath>& filePaths,
const std::vector<std::string>& systemHeaderSearchPaths,
const std::vector<std::string>& headerSearchPaths
){
@@ -113,12 +113,18 @@ void CxxParser::parseFiles(
FileRegister fileRegister(m_fileManager, filePaths);
std::vector<std::string> sourcePaths;
for (const FilePath& path : fileRegister.getSourceFilePaths())
{
sourcePaths.push_back(path.absoluteStr());
}
llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions> options = new clang::DiagnosticOptions();
CxxDiagnosticConsumer reporter(llvm::errs(), &*options, m_client);
ASTActionFactory actionFactory(m_client, &fileRegister);
clang::tooling::ClangTool tool(*compilationDatabase, fileRegister.getSourceFilePaths());
clang::tooling::ClangTool tool(*compilationDatabase, sourcePaths);
tool.setDiagnosticConsumer(&reporter);
tool.run(&actionFactory);
}
@@ -131,7 +137,7 @@ void CxxParser::parseFile(std::shared_ptr<TextAccess> textAccess)
llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions> options = new clang::DiagnosticOptions();
CxxDiagnosticConsumer reporter(llvm::errs(), &*options, m_client, false);
FileRegister fileRegister(m_fileManager, std::vector<std::string>());
FileRegister fileRegister(m_fileManager, std::vector<FilePath>());
ASTActionFactory actionFactory(m_client, &fileRegister);
runToolOnCodeWithArgs(&reporter, actionFactory.create(), textAccess->getText(), args);
+1 -1
View File
@@ -11,7 +11,7 @@ public:
~CxxParser();
virtual void parseFiles(
const std::vector<std::string>& filePaths,
const std::vector<FilePath>& filePaths,
const std::vector<std::string>& systemHeaderSearchPaths,
const std::vector<std::string>& headerSearchPaths);
virtual void parseFile(std::shared_ptr<TextAccess> textAccess);