From e052dee40fb38ecd20fc3fce7b21a51061b3f800 Mon Sep 17 00:00:00 2001 From: Pietro Fezzardi Date: Thu, 11 Apr 2024 08:14:52 +0200 Subject: [PATCH] Drop isCandidateForInline --- lib/Backend/DecompileFunction.cpp | 2 +- lib/TypeNames/ModelToPTMLTypeHelpers.cpp | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/lib/Backend/DecompileFunction.cpp b/lib/Backend/DecompileFunction.cpp index ece360b0c..41f8a6917 100644 --- a/lib/Backend/DecompileFunction.cpp +++ b/lib/Backend/DecompileFunction.cpp @@ -1988,7 +1988,7 @@ void CCodeGenerator::emitFunction(bool NeedsLocalStateVar, // For all nested types within stack definition we print forward // declarations. for (auto *Type : TheStackTypes) { - revng_assert(isCandidateForInline(Type)); + revng_assert(not declarationIsDefinition(Type)); printForwardDeclaration(*Type, Out, B); } printDefinition(Log, diff --git a/lib/TypeNames/ModelToPTMLTypeHelpers.cpp b/lib/TypeNames/ModelToPTMLTypeHelpers.cpp index e2557bb7b..c4ef39a08 100644 --- a/lib/TypeNames/ModelToPTMLTypeHelpers.cpp +++ b/lib/TypeNames/ModelToPTMLTypeHelpers.cpp @@ -76,12 +76,10 @@ TypeSet TypeInlineHelper::findTypesToInline(const model::Binary &Model, for (const UpcastablePointer &T : Model.Types()) { for (const model::QualifiedType &QT : T->edges()) { auto *DependantType = QT.UnqualifiedType().get(); - if (llvm::isa(T.get()) - or llvm::isa(T.get()) - or llvm::isa(T.get())) { - // Used as typename. + if (declarationIsDefinition(T.get())) { + // Should never be inlined ShouldIgnore.insert(DependantType); - } else if (isCandidateForInline(DependantType)) { + } else { // If it comes from a Type other than a function, consider that we are // interested for the type, or if it was referenced from a type other // than itself. @@ -660,11 +658,6 @@ void printDefinition(Logger<> &Log, } } -bool isCandidateForInline(const model::Type *T) { - return llvm::isa(T) or llvm::isa(T) - or llvm::isa(T); -} - using UPtrTy = UpcastablePointer; TypeSet TypeInlineHelper::getNestedTypesToInline(const model::Type *RootType, const UPtrTy &NestedTy) const {