File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -382,6 +382,13 @@ std::string SourceToHeaderMatchCallback::decorate(std::string_view name) const {
382
382
return forStubHeader ? std::string (name) : NameDecorator::decorate (name);
383
383
}
384
384
385
+ const std::string GNUPREREQ = " !__GNUC_PREREQ (7, 0) || defined __cplusplus" ;
386
+ const std::set<std::string> TypedefEscapeMap = {
387
+ " _Float32" ,
388
+ " _Float64" ,
389
+ " _Float32x" ,
390
+ " _Float64x"
391
+ };
385
392
386
393
void SourceToHeaderMatchCallback::print (const NamedDecl *decl, const PrintingPolicy &policy) const {
387
394
if (externalStream == nullptr ) {
@@ -394,8 +401,20 @@ void SourceToHeaderMatchCallback::print(const NamedDecl *decl, const PrintingPol
394
401
}
395
402
auto name = decl->getNameAsString ();
396
403
auto decoratedName = decorate (name);
404
+ const auto it = TypedefEscapeMap.find (name);
397
405
auto declaration = getRenamedDeclarationAsString (decl, policy, decoratedName);
398
- *externalStream << declaration << " ;\n " ;
406
+ if (it != TypedefEscapeMap.end ()) {
407
+ *externalStream << " #ifdef __GNUC__\n "
408
+ << " # include <features.h>\n "
409
+ << " # if " << GNUPREREQ << " \n "
410
+ << declaration << " ;\n "
411
+ << " # endif" << " \n "
412
+ << " #else" << " \n "
413
+ << declaration << " ;\n "
414
+ << " #endif" << " \n " ;
415
+ } else {
416
+ *externalStream << declaration << " ;\n " ;
417
+ }
399
418
if (pAlignmentAttr) {
400
419
*externalStream << " #pragma pack(pop)\n " ;
401
420
}
You can’t perform that action at this time.
0 commit comments