MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / enum12

Method enum12

test/testsymboldatabase.cpp:6573–6587  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6571 }
6572
6573 void enum12() {
6574 GET_SYMBOL_DB_C("struct { enum E { E0 }; } t;\n"
6575 "void f() {\n"
6576 " if (t.E0) {}\n"
6577 "}\n");
6578 ASSERT(db != nullptr);
6579 auto it = db->scopeList.begin();
6580 std::advance(it, 2);
6581 const Enumerator* E0 = it->findEnumerator("E0");
6582 ASSERT(E0 && E0->value_known);
6583 ASSERT_EQUALS(E0->value, 0);
6584 const Token* const e = Token::findsimplematch(tokenizer.tokens(), "E0 )");
6585 ASSERT(e && e->enumerator());
6586 ASSERT_EQUALS(e->enumerator(), E0);
6587 }
6588
6589 void enum13() {
6590 GET_SYMBOL_DB("struct S { enum E { E0, E1 }; };\n"

Callers

nothing calls this directly

Calls 3

findsimplematchFunction · 0.85
findEnumeratorMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected