Skip to content

Commit 31f8c3b

Browse files
committed
Revert "PrintAsClang: Apply review comments to check on should print of @cdecl"
This reverts commit 3623c1d.
1 parent a8032fa commit 31f8c3b

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

lib/PrintAsClang/DeclAndTypePrinter.cpp

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3006,22 +3006,14 @@ bool DeclAndTypePrinter::shouldInclude(const ValueDecl *VD) {
30063006
return false;
30073007
}
30083008

3009-
// In C output mode print only the C variant `@cdecl` (no `@_cdecl`),
3010-
// while in other modes print only `@_cdecl`.
3011-
std::optional<ForeignLanguage> cdeclKind = std::nullopt;
3012-
if (auto *FD = dyn_cast<AbstractFunctionDecl>(VD))
3013-
cdeclKind = FD->getCDeclKind();
3014-
if (cdeclKind &&
3015-
(*cdeclKind == ForeignLanguage::C) !=
3016-
(outputLang == OutputLanguageMode::C))
3009+
// In C output mode print only @cdecls and skip them in other modes.
3010+
bool isCDeclForC = false;
3011+
auto *FD = dyn_cast<AbstractFunctionDecl>(VD);
3012+
if (FD)
3013+
isCDeclForC = FD->getCDeclKind() == ForeignLanguage::C;
3014+
if (isCDeclForC != (outputLang == OutputLanguageMode::C))
30173015
return false;
30183016

3019-
// C output mode only accepts @cdecl functions.
3020-
if (outputLang == OutputLanguageMode::C &&
3021-
!cdeclKind) {
3022-
return false;
3023-
}
3024-
30253017
if (VD->getAttrs().hasAttribute<ImplementationOnlyAttr>())
30263018
return false;
30273019

0 commit comments

Comments
 (0)