Clang import; Tweaks
This commit is contained in:
parent
90e7a94ff4
commit
98e700e30d
|
@ -77,7 +77,7 @@ static std::vector<std::string> splitString(const std::string &line)
|
||||||
pos2 = line.find(">", pos1);
|
pos2 = line.find(">", pos1);
|
||||||
else if (line[pos1] == '\'') {
|
else if (line[pos1] == '\'') {
|
||||||
pos2 = line.find("\'", pos1+1);
|
pos2 = line.find("\'", pos1+1);
|
||||||
if (line.compare(pos2, 3, "\':\'", 0, 3) == 0)
|
if (pos2 < (int)line.size() - 3 && line.compare(pos2, 3, "\':\'", 0, 3) == 0)
|
||||||
pos2 = line.find("\'", pos2 + 3);
|
pos2 = line.find("\'", pos2 + 3);
|
||||||
} else
|
} else
|
||||||
pos2 = line.find(" ", pos1) - 1;
|
pos2 = line.find(" ", pos1) - 1;
|
||||||
|
|
|
@ -245,7 +245,10 @@ unsigned int CppCheck::check(const std::string &path)
|
||||||
const std::string clang = Path::isCPP(path) ? "clang++" : "clang";
|
const std::string clang = Path::isCPP(path) ? "clang++" : "clang";
|
||||||
|
|
||||||
/* Experimental: import clang ast dump */
|
/* Experimental: import clang ast dump */
|
||||||
const std::string cmd1 = clang + " -v -fsyntax-only " + path + " 2>&1";
|
std::ofstream fout("temp.c");
|
||||||
|
fout << "int x;\n";
|
||||||
|
fout.close();
|
||||||
|
const std::string cmd1 = clang + " -v -fsyntax-only temp.c 2>&1";
|
||||||
const std::pair<bool, std::string> res1 = executeCommand(cmd1);
|
const std::pair<bool, std::string> res1 = executeCommand(cmd1);
|
||||||
if (!res1.first) {
|
if (!res1.first) {
|
||||||
std::cerr << "Failed to execute '" + cmd1 + "'" << std::endl;
|
std::cerr << "Failed to execute '" + cmd1 + "'" << std::endl;
|
||||||
|
@ -276,7 +279,7 @@ unsigned int CppCheck::check(const std::string &path)
|
||||||
std::istringstream ast(res.second);
|
std::istringstream ast(res.second);
|
||||||
Tokenizer tokenizer(&mSettings, this);
|
Tokenizer tokenizer(&mSettings, this);
|
||||||
clangastdump::parseClangAstDump(&tokenizer, ast);
|
clangastdump::parseClangAstDump(&tokenizer, ast);
|
||||||
ValueFlow::setValues(&tokenizer.list, const_cast<SymbolDatabase *>(tokenizer.getSymbolDatabase()), this, &mSettings);
|
//ValueFlow::setValues(&tokenizer.list, const_cast<SymbolDatabase *>(tokenizer.getSymbolDatabase()), this, &mSettings);
|
||||||
if (mSettings.debugnormal)
|
if (mSettings.debugnormal)
|
||||||
tokenizer.printDebugOutput(1);
|
tokenizer.printDebugOutput(1);
|
||||||
ExprEngine::runChecks(this, &tokenizer, &mSettings);
|
ExprEngine::runChecks(this, &tokenizer, &mSettings);
|
||||||
|
|
Loading…
Reference in New Issue