data: Fixes for parsing Coati
* reverted to old source location retrieval for CxxConstructExpr, because source locations were outside file * removed exisiting source location check for better performance * fixed CXXParserTestSuite to use c++11 standard * fixed crash on missing signature retrieval
This commit is contained in:
@@ -195,9 +195,6 @@ Id SqliteStorage::addError(const std::string& message, const std::string& filePa
|
||||
return q.getIntField(0, -1);
|
||||
}
|
||||
|
||||
std::cout << ("INSERT INTO error(message, file_path, line_number, column_number) "
|
||||
"VALUES ('" + sanitizedMessage + "', '" + filePath + "', " + std::to_string(lineNumber) + ", " + std::to_string(columnNumber) + ");") << std::endl;
|
||||
|
||||
m_database.execDML((
|
||||
"INSERT INTO error(message, file_path, line_number, column_number) "
|
||||
"VALUES ('" + sanitizedMessage + "', '" + filePath + "', " + std::to_string(lineNumber) + ", " + std::to_string(columnNumber) + ");"
|
||||
@@ -764,7 +761,7 @@ std::string SqliteStorage::getSignatureByNodeId(Id nodeId) const
|
||||
return q.getStringField(1, "");
|
||||
}
|
||||
|
||||
return 0;
|
||||
return "";
|
||||
}
|
||||
|
||||
std::vector<StorageCommentLocation> SqliteStorage::getCommentLocationsInFile(const FilePath& filePath) const
|
||||
|
||||
@@ -1400,18 +1400,10 @@ Id Storage::addSourceLocation(Id elementNodeId, const ParseLocation &location, b
|
||||
return 0;
|
||||
}
|
||||
|
||||
Id locationId = m_sqliteStorage.getSourceLocationByData(
|
||||
Id locationId = m_sqliteStorage.addSourceLocation(
|
||||
elementNodeId, fileNodeId, location.startLineNumber, location.startColumnNumber,
|
||||
location.endLineNumber, location.endColumnNumber, isScope
|
||||
).id;
|
||||
|
||||
if (locationId == 0)
|
||||
{
|
||||
locationId = m_sqliteStorage.addSourceLocation(
|
||||
elementNodeId, fileNodeId, location.startLineNumber, location.startColumnNumber,
|
||||
location.endLineNumber, location.endColumnNumber, isScope
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
return locationId;
|
||||
}
|
||||
|
||||
@@ -455,7 +455,7 @@ bool ASTVisitor::VisitFunctionTemplateDecl(clang::FunctionTemplateDecl *declarat
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (clang::FunctionTemplateDecl::spec_iterator it = declaration->specializations().begin(); it != declaration->specializations().end(); it++)
|
||||
{
|
||||
clang::FunctionDecl* specializationDecl = *it;
|
||||
@@ -534,7 +534,8 @@ void ASTVisitor::VisitDeclRefExprInDeclBody(clang::DeclaratorDecl* decl, clang::
|
||||
void ASTVisitor::VisitCXXConstructExprInDeclBody(clang::FunctionDecl* decl, clang::CXXConstructExpr* expr)
|
||||
{
|
||||
m_client->onCallParsed(
|
||||
getParseLocationForTokensInRange(expr->getSourceRange()),
|
||||
// getParseLocationForTokensInRange(expr->getSourceRange()),
|
||||
getParseLocation(expr->getSourceRange()),
|
||||
getParseFunction(decl),
|
||||
getParseFunction(expr->getConstructor())
|
||||
);
|
||||
@@ -543,7 +544,8 @@ void ASTVisitor::VisitCXXConstructExprInDeclBody(clang::FunctionDecl* decl, clan
|
||||
void ASTVisitor::VisitCXXConstructExprInDeclBody(clang::DeclaratorDecl* decl, clang::CXXConstructExpr* expr)
|
||||
{
|
||||
m_client->onCallParsed(
|
||||
getParseLocationForTokensInRange(expr->getSourceRange()),
|
||||
// getParseLocationForTokensInRange(expr->getSourceRange()),
|
||||
getParseLocation(expr->getSourceRange()),
|
||||
getParseVariable(decl),
|
||||
getParseFunction(expr->getConstructor())
|
||||
);
|
||||
|
||||
@@ -1664,7 +1664,7 @@ public:
|
||||
// TS_ASSERT_EQUALS(client->templateArgumentTypes[0], "A<1>->int <0:0 0:0>");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
void test_cxx_parser_finds_non_type_bool_template_argument_of_implicit_template_specialization()
|
||||
{
|
||||
@@ -2724,7 +2724,7 @@ public:
|
||||
"}\n"
|
||||
);
|
||||
|
||||
TS_ASSERT_EQUALS(client->functions.size(), 2);
|
||||
TS_ASSERT_EQUALS(client->functions.size(), 2);
|
||||
TS_ASSERT_EQUALS(client->functions[0], "void lambdaCaller() <1:1 <1:6 1:17> 4:1>");
|
||||
TS_ASSERT_EQUALS(client->functions[1], "void lambdaCaller()::lambda at 3:2 <3:5 <3:2 3:2> 3:7>");
|
||||
TS_ASSERT_EQUALS(client->calls.size(), 1);
|
||||
@@ -2762,7 +2762,12 @@ public:
|
||||
std::vector<FilePath> filePaths;
|
||||
filePaths.push_back(FilePath("data/CxxParserTestSuite/header.h"));
|
||||
filePaths.push_back(FilePath("data/CxxParserTestSuite/code.cpp"));
|
||||
parser.parseFiles(filePaths, Parser::Arguments());
|
||||
|
||||
Parser::Arguments args;
|
||||
args.language = "c++";
|
||||
args.languageStandard = "1z";
|
||||
|
||||
parser.parseFiles(filePaths, args);
|
||||
|
||||
TS_ASSERT_EQUALS(client.errors.size(), 0);
|
||||
|
||||
@@ -3209,6 +3214,8 @@ private:
|
||||
}
|
||||
|
||||
m_args.logErrors = logErrors;
|
||||
m_args.language = "c++";
|
||||
m_args.languageStandard = "1z";
|
||||
|
||||
TestFileManager fm;
|
||||
std::shared_ptr<TestParserClient> client = std::make_shared<TestParserClient>();
|
||||
|
||||
Reference in New Issue
Block a user