File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -2289,6 +2289,14 @@ class DeclAndTypePrinter::Implementation
22892289 return false ;
22902290 }
22912291
2292+ std::optional<PrimitiveTypeMapping::ClangTypeInfo>
2293+ getKnownType (const TypeDecl *typeDecl) {
2294+ if (outputLang == OutputLanguageMode::C)
2295+ return owningPrinter.typeMapping .getKnownCTypeInfo (typeDecl);
2296+
2297+ return owningPrinter.typeMapping .getKnownObjCTypeInfo (typeDecl);
2298+ }
2299+
22922300 // / If \p typeDecl is one of the standard library types used to map in Clang
22932301 // / primitives and basic types, print out the appropriate spelling and
22942302 // / return true.
@@ -2297,8 +2305,7 @@ class DeclAndTypePrinter::Implementation
22972305 // / for interfacing with C and Objective-C.
22982306 bool printIfKnownSimpleType (const TypeDecl *typeDecl,
22992307 std::optional<OptionalTypeKind> optionalKind) {
2300- auto knownTypeInfo =
2301- owningPrinter.typeMapping .getKnownObjCTypeInfo (typeDecl);
2308+ auto knownTypeInfo = getKnownType (typeDecl);
23022309 if (!knownTypeInfo)
23032310 return false ;
23042311 os << knownTypeInfo->name ;
Original file line number Diff line number Diff line change 1515
1616namespace swift {
1717
18- enum class OutputLanguageMode { ObjC, Cxx };
18+ enum class OutputLanguageMode { ObjC, Cxx, C };
1919
2020} // end namespace swift
2121
You can’t perform that action at this time.
0 commit comments