diff --git a/src/hir2mpl/ast_input/clang/include/ast_op.h b/src/hir2mpl/ast_input/clang/include/ast_op.h index cd6ceb4accbe30ed268143a313a58516ec639b70..795a9181daf91f5b909f2facc9b631668f6f1d94 100644 --- a/src/hir2mpl/ast_input/clang/include/ast_op.h +++ b/src/hir2mpl/ast_input/clang/include/ast_op.h @@ -168,6 +168,7 @@ enum ASTStmtOp { kASTStmtGCCAsmStmt, kASTOffsetOfStmt, kASTGenericSelectionExprStmt, + kASTStmtAttributed, }; } // namespace maple #endif // HIR2MPL_AST_INPUT_INCLUDE_AST_OP_H diff --git a/src/hir2mpl/ast_input/clang/include/ast_parser.h b/src/hir2mpl/ast_input/clang/include/ast_parser.h index 07d3559416196c85910ed3cb17df49c965699036..7d05e26fc4f69d5bdb28dfc379dbb40268cf98d2 100644 --- a/src/hir2mpl/ast_input/clang/include/ast_parser.h +++ b/src/hir2mpl/ast_input/clang/include/ast_parser.h @@ -50,6 +50,7 @@ class ASTParser { ASTStmt *ProcessStmt(MapleAllocator &allocator, const clang::Stmt &stmt); ASTStmt *ProcessFunctionBody(MapleAllocator &allocator, const clang::CompoundStmt &cpdStmt); #define PROCESS_STMT(CLASS) ProcessStmt##CLASS(MapleAllocator&, const clang::CLASS&) + ASTStmt *PROCESS_STMT(AttributedStmt); ASTStmt *PROCESS_STMT(UnaryOperator); ASTStmt *PROCESS_STMT(BinaryOperator); ASTStmt *PROCESS_STMT(CompoundAssignOperator); diff --git a/src/hir2mpl/ast_input/clang/include/ast_stmt.h b/src/hir2mpl/ast_input/clang/include/ast_stmt.h index 06ce39078c85a5252664bbe7d1e2bba9d3fdf14c..d6b82daa5db84527aaa2fd1066114484e3ae6fc3 100644 --- a/src/hir2mpl/ast_input/clang/include/ast_stmt.h +++ b/src/hir2mpl/ast_input/clang/include/ast_stmt.h @@ -108,6 +108,15 @@ class ASTReturnStmt : public ASTStmt { std::list Emit2FEStmtImpl() const override; }; +class ASTAttributedStmt : public ASTStmt { + public: + ASTAttributedStmt() : ASTStmt(kASTStmtAttributed) {} + ~ASTAttributedStmt() override = default; + + private: + std::list Emit2FEStmtImpl() const override{ return {}; }; +}; + class ASTIfStmt : public ASTStmt { public: ASTIfStmt() : ASTStmt(kASTStmtIf) {} diff --git a/src/hir2mpl/ast_input/clang/src/ast_parser.cpp b/src/hir2mpl/ast_input/clang/src/ast_parser.cpp index 213d75e35777f47946c562012dbe102f2af951ed..af08eef88cd7f2f218f41a484e58a000ce5a4b0a 100644 --- a/src/hir2mpl/ast_input/clang/src/ast_parser.cpp +++ b/src/hir2mpl/ast_input/clang/src/ast_parser.cpp @@ -143,6 +143,7 @@ ASTStmt *ASTParser::ProcessStmt(MapleAllocator &allocator, const clang::Stmt &st STMT_CASE(GCCAsmStmt); STMT_CASE(OffsetOfExpr); STMT_CASE(GenericSelectionExpr); + STMT_CASE(AttributedStmt); default: { CHECK_FATAL(false, "ASTStmt: %s NIY", stmt.getStmtClassName()); return nullptr; @@ -150,6 +151,13 @@ ASTStmt *ASTParser::ProcessStmt(MapleAllocator &allocator, const clang::Stmt &st } } +ASTStmt *ASTParser::ProcessStmtAttributedStmt(MapleAllocator &allocator, const clang::AttributedStmt &AttrStmt) { + ASSERT(clang::hasSpecificAttr(AttrStmt.getAttrs()), "AttrStmt is not fallthrough"); + ASTAttributedStmt *astAttributedStmt = ASTDeclsBuilder::ASTStmtBuilder(allocator); + CHECK_FATAL(astAttributedStmt != nullptr, "astAttributedStmt is nullptr"); + return astAttributedStmt; +} + ASTStmt *ASTParser::ProcessStmtOffsetOfExpr(MapleAllocator &allocator, const clang::OffsetOfExpr &expr) { auto *astStmt = ASTDeclsBuilder::ASTStmtBuilder(allocator); CHECK_FATAL(astStmt != nullptr, "astStmt is nullptr");