ClangImport; Fixed output for anonymous enum
This commit is contained in:
parent
79a8f21183
commit
0adf09c507
|
@ -497,6 +497,9 @@ const ::Type * clangimport::AstNode::addTypeTokens(TokenList *tokenList, const s
|
||||||
return addTypeTokens(tokenList, str.substr(0, str.find("\':\'") + 1), scope);
|
return addTypeTokens(tokenList, str.substr(0, str.find("\':\'") + 1), scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (str.compare(0, 16, "'enum (anonymous") == 0)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
std::string type;
|
std::string type;
|
||||||
if (str.find(" (") != std::string::npos) {
|
if (str.find(" (") != std::string::npos) {
|
||||||
if (str.find("<") != std::string::npos)
|
if (str.find("<") != std::string::npos)
|
||||||
|
|
|
@ -74,6 +74,7 @@ private:
|
||||||
TEST_CASE(enumDecl1);
|
TEST_CASE(enumDecl1);
|
||||||
TEST_CASE(enumDecl2);
|
TEST_CASE(enumDecl2);
|
||||||
TEST_CASE(enumDecl3);
|
TEST_CASE(enumDecl3);
|
||||||
|
TEST_CASE(enumDecl4);
|
||||||
TEST_CASE(forStmt);
|
TEST_CASE(forStmt);
|
||||||
TEST_CASE(funcdecl1);
|
TEST_CASE(funcdecl1);
|
||||||
TEST_CASE(funcdecl2);
|
TEST_CASE(funcdecl2);
|
||||||
|
@ -690,6 +691,16 @@ private:
|
||||||
ASSERT_EQUALS("enum __syntax_option { _S_polynomial , _S_syntax_last }", parse(clang));
|
ASSERT_EQUALS("enum __syntax_option { _S_polynomial , _S_syntax_last }", parse(clang));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void enumDecl4() {
|
||||||
|
const char clang[] = "|-EnumDecl 0xace1f8 <e1.cpp:3:1, col:51> col:1\n"
|
||||||
|
"| |-EnumConstantDecl 0xace2c8 <col:7> col:7 A '(anonymous enum at e1.cpp:3:1)'\n"
|
||||||
|
"| |-EnumConstantDecl 0xace318 <col:16> col:16 B '(anonymous enum at e1.cpp:3:1)'\n"
|
||||||
|
"| `-EnumConstantDecl 0xace3b8 <col:46> col:46 referenced C '(anonymous enum at e1.cpp:3:1)'\n"
|
||||||
|
"`-VarDecl 0xace470 <col:1, col:66> col:53 x 'enum (anonymous enum at e1.cpp:3:1)':'(anonymous enum at e1.cpp:3:1)' cinit\n"
|
||||||
|
" `-DeclRefExpr 0xace520 <col:66> '(anonymous enum at e1.cpp:3:1)' EnumConstant 0xace3b8 'C' '(anonymous enum at e1.cpp:3:1)'";
|
||||||
|
ASSERT_EQUALS("enum { A , B , C } x@1 = C ;", parse(clang));
|
||||||
|
}
|
||||||
|
|
||||||
void forStmt() {
|
void forStmt() {
|
||||||
const char clang[] = "`-FunctionDecl 0x2f93ae0 <1.c:1:1, col:56> col:5 main 'int ()'\n"
|
const char clang[] = "`-FunctionDecl 0x2f93ae0 <1.c:1:1, col:56> col:5 main 'int ()'\n"
|
||||||
" `-CompoundStmt 0x2f93dc0 <col:12, col:56>\n"
|
" `-CompoundStmt 0x2f93dc0 <col:12, col:56>\n"
|
||||||
|
|
Loading…
Reference in New Issue