Revert "[clang][DeclPrinter] Fix missing semicolon in AST print for methods that are definitions without having a body"

This reverts commit a3da6284c23affdd9092b2641017e99d85c2d89b. It breaks
tests on macOS as macOS doesn't support attribute alias.
This commit is contained in:
Steven Wu 2023-07-28 11:39:46 -07:00
parent 3b73139150
commit 4098e13a71
2 changed files with 2 additions and 17 deletions

View File

@ -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 = ";";

View File

@ -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: };
};