Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions clang/lib/Parse/ParseCXXInlineMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "clang/Sema/DeclSpec.h"
#include "clang/Sema/EnterExpressionEvaluationContext.h"
#include "clang/Sema/Scope.h"
#include "llvm/ADT/ScopeExit.h"

using namespace clang;

Expand Down Expand Up @@ -624,6 +625,13 @@ void Parser::ParseLexedMethodDef(LexedMethod &LM) {

Actions.ActOnStartOfFunctionDef(getCurScope(), LM.D);

auto _ = llvm::make_scope_exit([&]() {
if (auto *FD = dyn_cast_or_null<FunctionDecl>(LM.D))
if (isa<CXXMethodDecl>(FD) ||
FD->isInIdentifierNamespace(Decl::IDNS_OrdinaryFriend))
Actions.ActOnFinishInlineFunctionDef(FD);
});

if (Tok.is(tok::kw_try)) {
ParseFunctionTryBlock(LM.D, FnScope);

Expand Down Expand Up @@ -666,11 +674,6 @@ void Parser::ParseLexedMethodDef(LexedMethod &LM) {

if (Tok.is(tok::eof) && Tok.getEofData() == LM.D)
ConsumeAnyToken();

if (auto *FD = dyn_cast_or_null<FunctionDecl>(LM.D))
if (isa<CXXMethodDecl>(FD) ||
FD->isInIdentifierNamespace(Decl::IDNS_OrdinaryFriend))
Actions.ActOnFinishInlineFunctionDef(FD);
}

/// ParseLexedMemberInitializers - We finished parsing the member specification
Expand Down
13 changes: 13 additions & 0 deletions clang/test/Modules/try-func-body.cppm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// RUN: %clang_cc1 -std=c++20 %s -fexceptions -fcxx-exceptions -emit-llvm -triple %itanium_abi_triple -o - | FileCheck %s

export module func;
class C {
public:
void member() try {

} catch (...) {

}
};

// CHECK: define {{.*}}@_ZNW4func1C6memberEv