diff --git a/bin/test/data/log/test_log.txt b/bin/test/data/log/test_log.txt index e69de29b..6d3c3676 100644 --- a/bin/test/data/log/test_log.txt +++ b/bin/test/data/log/test_log.txt @@ -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. diff --git a/src/lib/data/parser/cxx/ASTVisitor.cpp b/src/lib/data/parser/cxx/ASTVisitor.cpp index 2182a290..8258e621 100644 --- a/src/lib/data/parser/cxx/ASTVisitor.cpp +++ b/src/lib/data/parser/cxx/ASTVisitor.cpp @@ -306,7 +306,8 @@ ParseVariable ASTVisitor::getParseVariable(clang::ValueDecl* declaration) const bool isStatic = false; if (clang::isa(declaration)) { - isStatic = static_cast(declaration)->isStaticDataMember(); + clang::VarDecl* varDecl = static_cast(declaration); + isStatic = varDecl->isStaticDataMember() || varDecl->getStorageClass() == clang::SC_Static; } return ParseVariable( diff --git a/src/test/CxxParserTestSuite.h b/src/test/CxxParserTestSuite.h index 373932f4..b421355a 100644 --- a/src/test/CxxParserTestSuite.h +++ b/src/test/CxxParserTestSuite.h @@ -117,13 +117,17 @@ public: { std::shared_ptr 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()