Skip to content

Commit

Permalink
Revert "[clang][DeclPrinter] Fix missing semicolon in AST print for m…
Browse files Browse the repository at this point in the history
…ethods that are definitions without having a body"

This reverts commit a3da628. It breaks
tests on macOS as macOS doesn't support attribute alias.
  • Loading branch information
cachemeifyoucan committed Jul 28, 2023
1 parent 3b73139 commit 4098e13
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
4 changes: 2 additions & 2 deletions clang/lib/AST/DeclPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,12 +463,12 @@ void DeclPrinter::VisitDeclContext(DeclContext *DC, bool Indent) {
else if (isa<ObjCMethodDecl>(*D) && cast<ObjCMethodDecl>(*D)->hasBody())
Terminator = nullptr;
else if (auto FD = dyn_cast<FunctionDecl>(*D)) {
if (FD->doesThisDeclarationHaveABody() && !FD->isDefaulted())
if (FD->isThisDeclarationADefinition())
Terminator = nullptr;
else
Terminator = ";";
} else if (auto TD = dyn_cast<FunctionTemplateDecl>(*D)) {
if (TD->getTemplatedDecl()->doesThisDeclarationHaveABody())
if (TD->getTemplatedDecl()->isThisDeclarationADefinition())
Terminator = nullptr;
else
Terminator = ";";
Expand Down
15 changes: 0 additions & 15 deletions clang/test/AST/ast-print-method-decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,3 @@ struct CurlyCtorInit {

// CHECK-NEXT: };
};


// CHECK: struct DefMethodsWithoutBody {
struct DefMethodsWithoutBody {
// CHECK-NEXT: DefMethodsWithoutBody() = delete;
DefMethodsWithoutBody() = delete;

// CHECK-NEXT: DefMethodsWithoutBody() = default;
~DefMethodsWithoutBody() = default;

// CHECK-NEXT: void m1() __attribute__((alias("X")));
void m1() __attribute__((alias("X")));

// CHECK-NEXT: };
};

0 comments on commit 4098e13

Please sign in to comment.