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

Method dumpFallthrough

test/testtokenize.cpp:9030–9052  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9028 }
9029
9030 void dumpFallthrough() {
9031 const char code[] = "void f(int n) {\n"
9032 " void g(), h(), i();\n"
9033 " switch (n) {\n"
9034 " case 1:\n"
9035 " case 2:\n"
9036 " g();\n"
9037 " [[fallthrough]];\n"
9038 " case 3:\n"
9039 " h();\n"
9040 " break;\n"
9041 " default:\n"
9042 " i();\n"
9043 " break;\n"
9044 " }\n"
9045 "}";
9046 SimpleTokenizer tokenizer(settingsDefault, *this, false);
9047 ASSERT(tokenizer.tokenize(code));
9048 std::ostringstream ostr;
9049 tokenizer.dump(ostr);
9050 const std::string dump = ostr.str();
9051 ASSERT(dump.find(" isAttributeFallthrough=\"true\"") != std::string::npos);
9052 }
9053
9054 void simplifyRedundantParentheses() {
9055 const char code[] = "int f(struct S s) {\n"

Callers

nothing calls this directly

Calls 4

tokenizeMethod · 0.80
dumpMethod · 0.45
strMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected