data: parsing static global variables as static

This commit is contained in:
Eberhard Graether
2014-07-09 12:41:40 +02:00
parent 78704b6407
commit 37f5579649
3 changed files with 17 additions and 4 deletions
+8
View File
@@ -0,0 +1,8 @@
Graph.cpp ERROR: Can't remove member edge, without removing the child node.
TextAccess.cpp WARNING: Index 'firstLine' has to be lower or equal index 'lastLine', is 2 > 1
TextAccess.cpp WARNING: Tried to access index 9. Maximum index is 7
TextAccess.cpp WARNING: Tried to access index 9. Maximum index is 7
TextAccess.cpp WARNING: Line numbers start with one, is 0
TextAccess.cpp WARNING: Line numbers start with one, is 0
TokenLocationCollection.cpp ERROR: Can't create TokenLocation with wrong boundaries.
TokenLocationCollection.cpp ERROR: Can't create TokenLocation with wrong boundaries.
+2 -1
View File
@@ -306,7 +306,8 @@ ParseVariable ASTVisitor::getParseVariable(clang::ValueDecl* declaration) const
bool isStatic = false;
if (clang::isa<clang::VarDecl>(declaration))
{
isStatic = static_cast<clang::VarDecl*>(declaration)->isStaticDataMember();
clang::VarDecl* varDecl = static_cast<clang::VarDecl*>(declaration);
isStatic = varDecl->isStaticDataMember() || varDecl->getStorageClass() == clang::SC_Static;
}
return ParseVariable(
+7 -3
View File
@@ -117,13 +117,17 @@ public:
{
std::shared_ptr<TestParserClient> client = parseCode(
"int x;\n"
"const int y = 0;\n"
"static int z;\n"
"class A;\n"
"A* b;"
);
TS_ASSERT_EQUALS(client->globalVariables.size(), 2);
TS_ASSERT_EQUALS(client->globalVariables.size(), 4);
TS_ASSERT_EQUALS(client->globalVariables[0], "int x <1:1 1:5>");
TS_ASSERT_EQUALS(client->globalVariables[1], "A b <3:1 3:4>"); // Todo: what about the pointer?
TS_ASSERT_EQUALS(client->globalVariables[1], "const int y <2:1 2:15>");
TS_ASSERT_EQUALS(client->globalVariables[2], "static int z <3:1 3:12>");
TS_ASSERT_EQUALS(client->globalVariables[3], "A b <5:1 5:4>"); // Todo: what about the pointer?
}
void test_cxx_parser_finds_variable_definitions_in_namespace_scope()
@@ -139,7 +143,7 @@ public:
TS_ASSERT_EQUALS(client->globalVariables.size(), 2);
TS_ASSERT_EQUALS(client->globalVariables[0], "int n::x <2:2 2:6>");
TS_ASSERT_EQUALS(client->globalVariables[1], "n::A n::b <4:2 4:5>"); // Todo: what about the pointer?
TS_ASSERT_EQUALS(client->globalVariables[1], "n::A n::b <4:2 4:5>"); // Todo: what about the pointer?
}
void test_cxx_parser_finds_field_in_nested_class()