MCPcopy Create free account
hub / github.com/Samsung/UTopia / createEnum

Function createEnum

tests/TestHelper.cpp:24–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22namespace ftg {
23
24std::unique_ptr<Enum> createEnum(std::string TypeName, clang::ASTContext &Ctx) {
25 std::string Tag(__FUNCTION__);
26 std::unique_ptr<clang::ast_matchers::DeclarationMatcher> Matcher;
27 if (TypeName.empty()) {
28 Matcher = std::make_unique<clang::ast_matchers::DeclarationMatcher>(
29 clang::ast_matchers::enumDecl(
30 clang::ast_matchers::unless(clang::ast_matchers::hasAnyName()))
31 .bind(Tag));
32 } else {
33 Matcher = std::make_unique<clang::ast_matchers::DeclarationMatcher>(
34 clang::ast_matchers::enumDecl(clang::ast_matchers::hasName(TypeName))
35 .bind(Tag));
36 }
37 if (!Matcher)
38 return nullptr;
39
40 for (const auto &Node : clang::ast_matchers::match(*Matcher, Ctx)) {
41 auto *Record = Node.getNodeAs<clang::EnumDecl>(Tag);
42 if (!Record)
43 continue;
44
45 return std::make_unique<Enum>(*Record);
46 }
47 return nullptr;
48}
49
50std::string getBaseDirPath() {
51

Callers 1

TESTFunction · 0.85

Calls 1

emptyMethod · 0.80

Tested by

no test coverage detected