diff --git a/include/revng-c/RestructureCFG/BasicBlockNode.h b/include/revng-c/RestructureCFG/BasicBlockNode.h index 8154e1b96..1d17ac207 100644 --- a/include/revng-c/RestructureCFG/BasicBlockNode.h +++ b/include/revng-c/RestructureCFG/BasicBlockNode.h @@ -193,8 +193,6 @@ public: RegionCFGT *getParent() { return Parent; } void setParent(RegionCFGT *P) { Parent = P; } - // void removeNode(); - // TODO: Check why this implementation is really necessary. void printAsOperand(llvm::raw_ostream &O, bool /* PrintType */) const; diff --git a/lib/HeadersGeneration/HelpersToHeader.cpp b/lib/HeadersGeneration/HelpersToHeader.cpp index 916474972..8f208f302 100644 --- a/lib/HeadersGeneration/HelpersToHeader.cpp +++ b/lib/HeadersGeneration/HelpersToHeader.cpp @@ -32,11 +32,6 @@ using llvm::dyn_cast; -using pipeline::serializedLocation; -namespace tags = ptml::tags; -namespace attributes = ptml::attributes; -namespace ranks = revng::ranks; - static Logger<> Log{ "helpers-to-header" }; /// Print the declaration a C struct corresponding to an LLVM struct diff --git a/lib/HeadersGeneration/ModelToHeader.cpp b/lib/HeadersGeneration/ModelToHeader.cpp index d75c33ba4..c2d92348f 100644 --- a/lib/HeadersGeneration/ModelToHeader.cpp +++ b/lib/HeadersGeneration/ModelToHeader.cpp @@ -31,11 +31,7 @@ #include "DependencyGraph.h" -using ArtificialTypes::ArrayWrapperFieldName; - -using llvm::cast; using llvm::isa; -using llvm::Twine; using QualifiedTypeNameMap = std::map; using TypeToNumOfRefsMap = std::unordered_map; @@ -182,6 +178,7 @@ bool dumpModelToHeader(const model::Binary &Model, auto Scope = ThePTMLCBuilder.getTag(ptml::tags::Div).scope(Header); Header << ThePTMLCBuilder.getPragmaOnce(); + Header << "\n"; Header << ThePTMLCBuilder.getIncludeAngle("stdint.h"); Header << ThePTMLCBuilder.getIncludeAngle("stdbool.h"); Header << ThePTMLCBuilder.getIncludeQuote("revng-primitive-types.h"); diff --git a/lib/ImportModelFromC/HeaderToModel.cpp b/lib/ImportModelFromC/HeaderToModel.cpp index 8b4ef05fd..ee619f677 100644 --- a/lib/ImportModelFromC/HeaderToModel.cpp +++ b/lib/ImportModelFromC/HeaderToModel.cpp @@ -880,7 +880,7 @@ bool DeclVisitor::VisitFunctionDecl(const clang::FunctionDecl *FD) { ModelFunction.OriginalName() = Function->OriginalName(); ModelFunction.ExportedNames() = Function->ExportedNames(); - // TODO: Remember/clone StackFrameType as well. + // TODO: remember/clone StackFrameType as well. auto Prototype = Model->recordNewType(std::move(NewType)); ModelFunction.Prototype() = Prototype; @@ -894,7 +894,7 @@ bool DeclVisitor::VisitTypedefDecl(const TypedefDecl *D) { revng_assert(AnalysisOption != ImportModelFromCOption::EditFunctionPrototype); - auto TheType = D->getUnderlyingType(); + QualType TheType = D->getUnderlyingType(); if (auto Fn = llvm::dyn_cast(TheType)) { // Parse the ABI from annotate attribute attached to the typedef // declaration. Please do note that annotations on the parameters are not diff --git a/lib/ImportModelFromC/ImportModelFromCAnalysis.cpp b/lib/ImportModelFromC/ImportModelFromCAnalysis.cpp index 5b3ec7859..82e304047 100644 --- a/lib/ImportModelFromC/ImportModelFromCAnalysis.cpp +++ b/lib/ImportModelFromC/ImportModelFromCAnalysis.cpp @@ -121,8 +121,7 @@ struct ImportModelFromCAnalysis { TheOption = ImportModelFromCOption::EditType; } else { return llvm::createStringError(llvm::inconvertibleErrorCode(), - "Please provide a location that is " - "supported by our Model"); + "Invalid location"); } } diff --git a/lib/TypeNames/ModelToPTMLTypeHelpers.cpp b/lib/TypeNames/ModelToPTMLTypeHelpers.cpp index 2b58917ae..5e3bbeb48 100644 --- a/lib/TypeNames/ModelToPTMLTypeHelpers.cpp +++ b/lib/TypeNames/ModelToPTMLTypeHelpers.cpp @@ -31,10 +31,6 @@ #include "revng-c/TypeNames/ModelToPTMLTypeHelpers.h" #include "revng-c/TypeNames/ModelTypeNames.h" -namespace attributes = ptml::attributes; -namespace tokens = ptml::c::tokens; -namespace ranks = revng::ranks; - using QualifiedTypeNameMap = std::map; using TypeSet = std::set; using TypeToNumOfRefsMap = std::unordered_map; @@ -177,13 +173,15 @@ TypeSet TypeInlineHelper::collectStackTypes(const model::Binary &Model) const { for (auto &Function : Model.Functions()) { if (not Function.StackFrameType().empty()) { const model::Type *StackT = Function.StackFrameType().getConst(); + revng_assert(StackT->Kind() == model::TypeKind::StructType); + // Do not inline stack types that are being used somewhere else. auto TheTypeToNumOfRefs = TypeToNumOfRefs.find(StackT); if (TheTypeToNumOfRefs != TypeToNumOfRefs.end() and TheTypeToNumOfRefs->second != 0) continue; - revng_assert(StackT->Kind() == model::TypeKind::StructType); + revng_assert(StackT != nullptr); Result.insert(StackT); auto AllNestedTypes = getTypesToInlineInTypeTy(Model, StackT); Result.merge(AllNestedTypes);