File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -3006,22 +3006,14 @@ bool DeclAndTypePrinter::shouldInclude(const ValueDecl *VD) {
3006
3006
return false ;
3007
3007
}
3008
3008
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))
3017
3015
return false ;
3018
3016
3019
- // C output mode only accepts @cdecl functions.
3020
- if (outputLang == OutputLanguageMode::C &&
3021
- !cdeclKind) {
3022
- return false ;
3023
- }
3024
-
3025
3017
if (VD->getAttrs ().hasAttribute <ImplementationOnlyAttr>())
3026
3018
return false ;
3027
3019
You can’t perform that action at this time.
0 commit comments