diff --git a/include/revng/EarlyFunctionAnalysis/BasicBlock.h b/include/revng/EarlyFunctionAnalysis/BasicBlock.h index b20d7ac1f..50f0a2b99 100644 --- a/include/revng/EarlyFunctionAnalysis/BasicBlock.h +++ b/include/revng/EarlyFunctionAnalysis/BasicBlock.h @@ -10,7 +10,6 @@ #include "revng/EarlyFunctionAnalysis/FunctionEdge.h" #include "revng/EarlyFunctionAnalysis/FunctionEdgeBase.h" #include "revng/Model/CallSitePrototype.h" -#include "revng/Model/Identifier.h" #include "revng/Support/BasicBlockID.h" #include "revng/Support/BasicBlockID/YAMLTraits.h" #include "revng/Support/MetaAddress.h" @@ -52,7 +51,7 @@ public: using generated::BasicBlock::BasicBlock; public: - model::Identifier name() const; + std::string name() const; BasicBlockID nextBlock() const { return BasicBlockID(End(), ID().inliningIndex()); } diff --git a/include/revng/EarlyFunctionAnalysis/ControlFlowGraph.h b/include/revng/EarlyFunctionAnalysis/ControlFlowGraph.h index c8f26e344..e65f6b695 100644 --- a/include/revng/EarlyFunctionAnalysis/ControlFlowGraph.h +++ b/include/revng/EarlyFunctionAnalysis/ControlFlowGraph.h @@ -24,7 +24,7 @@ fields: - name: Entry doc: Start address of the basic block type: MetaAddress - - name: OriginalName + - name: Name type: string doc: Optional name for debugging purposes optional: true diff --git a/include/revng/Model/Argument.h b/include/revng/Model/Argument.h index 37bceb583..55ebb454f 100644 --- a/include/revng/Model/Argument.h +++ b/include/revng/Model/Argument.h @@ -5,7 +5,6 @@ // #include "revng/ADT/RecursiveCoroutine.h" -#include "revng/Model/Identifier.h" #include "revng/Model/Type.h" /* TUPLE-TREE-YAML @@ -21,10 +20,7 @@ fields: type: Type doc: The type of the argument. upcastable: true - - name: CustomName - type: Identifier - optional: true - - name: OriginalName + - name: Name type: string optional: true - name: Comment @@ -44,7 +40,7 @@ class model::Argument : public model::generated::Argument { public: using generated::Argument::Argument; Argument(uint64_t Index, UpcastableType &&Type) : - model::generated::Argument(Index, std::move(Type), {}, {}, {}) {} + model::generated::Argument(Index, std::move(Type), {}, {}) {} public: bool verify() const debug_function; diff --git a/include/revng/Model/CABIFunctionDefinition.h b/include/revng/Model/CABIFunctionDefinition.h index 0092d070f..ceea57c54 100644 --- a/include/revng/Model/CABIFunctionDefinition.h +++ b/include/revng/Model/CABIFunctionDefinition.h @@ -6,7 +6,6 @@ #include "revng/ADT/SortedVector.h" #include "revng/Model/Argument.h" -#include "revng/Model/Identifier.h" #include "revng/Model/Type.h" #include "revng/Model/TypeDefinition.h" diff --git a/include/revng/Model/DynamicFunction.h b/include/revng/Model/DynamicFunction.h index b8120ceaf..b2e26ff37 100644 --- a/include/revng/Model/DynamicFunction.h +++ b/include/revng/Model/DynamicFunction.h @@ -6,17 +6,13 @@ #include "revng/ADT/MutableSet.h" #include "revng/Model/CommonFunctionMethods.h" -#include "revng/Model/Identifier.h" /* TUPLE-TREE-YAML name: DynamicFunction doc: A function defined in a dynamic library. type: struct fields: - - name: CustomName - type: Identifier - optional: true - - name: OriginalName + - name: Name doc: The name of the symbol for this dynamic function. type: string - name: Comment @@ -43,7 +39,7 @@ fields: optional: true key: - - OriginalName + - Name TUPLE-TREE-YAML */ #include "revng/Model/Generated/Early/DynamicFunction.h" diff --git a/include/revng/Model/EnumDefinition.h b/include/revng/Model/EnumDefinition.h index b3c9c6bb0..3d2e3f939 100644 --- a/include/revng/Model/EnumDefinition.h +++ b/include/revng/Model/EnumDefinition.h @@ -5,7 +5,6 @@ // #include "revng/Model/EnumEntry.h" -#include "revng/Model/Identifier.h" #include "revng/Model/TypeDefinition.h" /* TUPLE-TREE-YAML diff --git a/include/revng/Model/EnumEntry.h b/include/revng/Model/EnumEntry.h index b6ba8018b..c086bf096 100644 --- a/include/revng/Model/EnumEntry.h +++ b/include/revng/Model/EnumEntry.h @@ -5,7 +5,6 @@ // #include "revng/ADT/SortedVector.h" -#include "revng/Model/Identifier.h" /* TUPLE-TREE-YAML name: EnumEntry @@ -18,19 +17,11 @@ fields: Has to be unique within the `enum`. type: uint64_t - - name: CustomName - type: Identifier - optional: true - doc: |- - A user-chosen `Identifier` for this `enum` entry. - - name: OriginalName + - name: Name type: string optional: true doc: |- - The name this `enum` entry had upon import. - - This value can differ from `CustomName`, since `CustomName` needs to - respect the constraints of an `Identifier`. + A user-chosen `Identifier` for this `enum` entry. - name: Comment type: string optional: true diff --git a/include/revng/Model/Function.h b/include/revng/Model/Function.h index c74bd5b8b..917a4ee0d 100644 --- a/include/revng/Model/Function.h +++ b/include/revng/Model/Function.h @@ -9,7 +9,6 @@ #include "revng/Model/CallSitePrototype.h" #include "revng/Model/CommonFunctionMethods.h" #include "revng/Model/FunctionAttribute.h" -#include "revng/Model/Identifier.h" #include "revng/Model/StatementComment.h" #include "revng/Model/TypeDefinition.h" #include "revng/Support/MetaAddress.h" @@ -28,10 +27,7 @@ fields: Note: this does not necessarily correspond to the address of the basic block with the lowest address. type: MetaAddress - - name: CustomName - type: Identifier - optional: true - - name: OriginalName + - name: Name type: string optional: true - name: Comment diff --git a/include/revng/Model/Helpers.h b/include/revng/Model/Helpers.h index 079c35276..1b128decd 100644 --- a/include/revng/Model/Helpers.h +++ b/include/revng/Model/Helpers.h @@ -10,7 +10,6 @@ #include "revng/ADT/Concepts.h" #include "revng/Model/DynamicFunction.h" #include "revng/Model/Function.h" -#include "revng/Model/Identifier.h" #include "revng/Model/Segment.h" // @@ -31,13 +30,8 @@ concept EntityWithKey = requires(const Type &Value) { }; template -concept EntityWithCustomName = requires(const Type &Value) { - { Value.CustomName() } -> std::convertible_to; -}; - -template -concept EntityWithOriginalName = requires(const Type &Value) { - { Value.OriginalName() } -> std::convertible_to; +concept EntityWithName = requires(const Type &Value) { + { Value.Name() } -> std::convertible_to; }; template @@ -52,8 +46,7 @@ concept EntityWithReturnValueComment = requires(const Type &Value) { template void ensureCompatibility() { - static_assert(EntityWithCustomName || EntityWithOriginalName - || EntityWithComment + static_assert(EntityWithName || EntityWithComment || EntityWithReturnValueComment, "This would be a no-op."); } @@ -63,11 +56,8 @@ LHS ©Metadata(LHS &To, const RHS &From) { ensureCompatibility(); ensureCompatibility(); - if constexpr (EntityWithCustomName && EntityWithCustomName) - To.CustomName() = From.CustomName(); - - if constexpr (EntityWithOriginalName && EntityWithOriginalName) - To.OriginalName() = From.OriginalName(); + if constexpr (EntityWithName && EntityWithName) + To.Name() = From.Name(); if constexpr (EntityWithComment && EntityWithComment) To.Comment() = From.Comment(); @@ -85,11 +75,8 @@ LHS &moveMetadata(LHS &To, const RHS &From) { ensureCompatibility(); ensureCompatibility(); - if constexpr (EntityWithCustomName && EntityWithCustomName) - To.CustomName() = std::move(From.CustomName()); - - if constexpr (EntityWithOriginalName && EntityWithOriginalName) - To.OriginalName() = std::move(From.OriginalName()); + if constexpr (EntityWithName && EntityWithName) + To.Name() = std::move(From.Name()); if constexpr (EntityWithComment && EntityWithComment) To.Comment() = std::move(From.Comment()); @@ -106,12 +93,8 @@ template bool hasMetadata(const Type &Value) { ensureCompatibility(); - if constexpr (EntityWithCustomName) - if (!Value.CustomName().empty()) - return true; - - if constexpr (EntityWithOriginalName) - if (!Value.OriginalName().empty()) + if constexpr (EntityWithName) + if (!Value.Name().empty()) return true; if constexpr (EntityWithComment) diff --git a/include/revng/Model/Identifier.h b/include/revng/Model/Identifier.h deleted file mode 100644 index aca2f304a..000000000 --- a/include/revng/Model/Identifier.h +++ /dev/null @@ -1,62 +0,0 @@ -#pragma once - -// -// This file is distributed under the MIT License. See LICENSE.md for details. -// - -#include "llvm/ADT/SmallString.h" -#include "llvm/ADT/StringRef.h" - -#include "revng/ADT/KeyedObjectContainer.h" - -namespace model { - -class VerifyHelper; - -/// \note Zero-sized identifiers are valid -class Identifier : public llvm::SmallString<16> { -public: - using llvm::SmallString<16>::SmallString; - using llvm::SmallString<16>::operator=; - -public: - static const Identifier Empty; - -public: - /// Produce a (locally) valid identifier from an arbitrary string - static Identifier fromString(llvm::StringRef Name); - - /// Produce a string without any character that's invalid for an identifier - /// - /// \note: given that reserved keywords are not considered by this function, - /// it does not necessarily emit a valid identifier. - static Identifier sanitize(llvm::StringRef Name); - -public: - bool verify() const debug_function; - bool verify(bool Assert) const debug_function; - bool verify(VerifyHelper &VH) const; -}; - -} // namespace model - -/// KeyedObjectTraits for std::string based on its value -template<> -struct KeyedObjectTraits - : public IdentityKeyedObjectTraits {}; - -template<> -struct llvm::yaml::ScalarTraits { - static void - output(const model::Identifier &Value, void *, llvm::raw_ostream &Output) { - Output << Value; - } - - static StringRef - input(llvm::StringRef Scalar, void *, model::Identifier &Value) { - Value = model::Identifier(Scalar); - return StringRef(); - } - - static QuotingType mustQuote(StringRef) { return QuotingType::Double; } -}; diff --git a/include/revng/Model/Importer/TypeCopier.h b/include/revng/Model/Importer/TypeCopier.h index 1a0fa1f0d..f0656a6b6 100644 --- a/include/revng/Model/Importer/TypeCopier.h +++ b/include/revng/Model/Importer/TypeCopier.h @@ -10,14 +10,6 @@ #include "revng/ADT/GenericGraph.h" #include "revng/Model/Binary.h" -template -concept HasCustomAndOriginalName = requires(const T &Element) { - { Element.CustomName() } -> std::same_as; - { Element.OriginalName() } -> std::same_as; -}; -static_assert(HasCustomAndOriginalName); -static_assert(HasCustomAndOriginalName); - class TypeCopier { private: TupleTree &FromModel; @@ -59,18 +51,6 @@ public: // Reset type ID: recordNewType will set it for us NewType->ID() = 0; - // Adjust all CustomNames - auto Visitor = [](auto &Element) { - using T = std::decay_t; - if constexpr (HasCustomAndOriginalName) { - std::string CustomName = Element.CustomName().str().str(); - Element.CustomName() = model::Identifier(); - if (Element.OriginalName().empty()) - Element.OriginalName() = CustomName; - } - }; - visitTupleTree(NewType, Visitor, [](const auto &) {}); - // Record the type auto &&[D, Type] = DestinationModel->recordNewType(std::move(NewType)); NewTypes.insert(&D); diff --git a/include/revng/Model/NameBuilder.h b/include/revng/Model/NameBuilder.h index ce2ae8cee..7562a1c42 100644 --- a/include/revng/Model/NameBuilder.h +++ b/include/revng/Model/NameBuilder.h @@ -11,7 +11,6 @@ #include "revng/Model/EnumDefinition.h" #include "revng/Model/Function.h" #include "revng/Model/Helpers.h" -#include "revng/Model/Identifier.h" #include "revng/Model/NamingConfiguration.h" #include "revng/Model/RawFunctionDefinition.h" #include "revng/Model/StructDefinition.h" @@ -137,27 +136,25 @@ private: } public: - [[nodiscard]] std::string name(EntityWithCustomName auto const &Entity) { - if (Entity.CustomName().empty() - || isNameReserved(Entity.CustomName(), Configuration)) - return automaticName(Entity); + [[nodiscard]] std::string name(EntityWithName auto const &E) { + if (E.Name().empty() || isNameReserved(E.Name(), Configuration)) + return automaticName(E); - return Entity.CustomName().str().str(); + return E.Name(); } [[nodiscard]] std::string name(const auto &Parent, - EntityWithCustomName auto const &Entity) { - if (Entity.CustomName().empty() - || isNameReserved(Entity.CustomName(), Configuration)) - return automaticName(Parent, Entity); + EntityWithName auto const &E) { + if (E.Name().empty() || isNameReserved(E.Name(), Configuration)) + return automaticName(Parent, E); - return Entity.CustomName().str().str(); + return E.Name(); } // Dynamic functions are special - we never introduce automatic names for them [[nodiscard]] std::string name(const model::DynamicFunction &Function) { - revng_assert(not isNameReserved(Function.CustomName(), Configuration)); - return Function.CustomName().str().str(); + revng_assert(not isNameReserved(Function.Name(), Configuration)); + return Function.Name(); } [[nodiscard]] std::string llvmName(const model::Function &Function) { diff --git a/include/revng/Model/NamedTypedRegister.h b/include/revng/Model/NamedTypedRegister.h index fa9ebe503..a2e657a35 100644 --- a/include/revng/Model/NamedTypedRegister.h +++ b/include/revng/Model/NamedTypedRegister.h @@ -5,7 +5,6 @@ // #include "revng/ADT/RecursiveCoroutine.h" -#include "revng/Model/Identifier.h" #include "revng/Model/Type.h" /* TUPLE-TREE-YAML @@ -21,11 +20,8 @@ fields: - name: Type type: Type upcastable: true - - name: CustomName - type: Identifier - optional: true - - name: OriginalName - type: Identifier + - name: Name + type: string optional: true - name: Comment type: string diff --git a/include/revng/Model/Pass/AllPasses.h b/include/revng/Model/Pass/AllPasses.h index e1decf85f..68750742d 100644 --- a/include/revng/Model/Pass/AllPasses.h +++ b/include/revng/Model/Pass/AllPasses.h @@ -5,6 +5,5 @@ // #include "revng/Model/Pass/DeduplicateEquivalentTypes.h" -#include "revng/Model/Pass/PromoteOriginalName.h" #include "revng/Model/Pass/PurgeUnnamedAndUnreachableTypes.h" #include "revng/Model/Pass/Verify.h" diff --git a/include/revng/Model/Pass/PromoteOriginalName.h b/include/revng/Model/Pass/PromoteOriginalName.h deleted file mode 100644 index 0bd70d51f..000000000 --- a/include/revng/Model/Pass/PromoteOriginalName.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -// -// This file is distributed under the MIT License. See LICENSE.md for details. -// - -#include "revng/Model/Binary.h" - -namespace model { - -/// Promote OriginalName fields to CustomName ensuring -/// the validity of the model is preserved -void promoteOriginalName(TupleTree &Model); - -} // namespace model diff --git a/include/revng/Model/Pass/PurgeUnnamedAndUnreachableTypes.h b/include/revng/Model/Pass/PurgeUnnamedAndUnreachableTypes.h index 21cdbc450..c8815b042 100644 --- a/include/revng/Model/Pass/PurgeUnnamedAndUnreachableTypes.h +++ b/include/revng/Model/Pass/PurgeUnnamedAndUnreachableTypes.h @@ -12,7 +12,7 @@ namespace model { void purgeInvalidTypes(TupleTree &Model); /// Remove all the types that cannot be reached from outside Binary::Types and -/// have no OriginalName or CustomName +/// have no name void purgeUnnamedAndUnreachableTypes(TupleTree &Model); /// Remove all the types that cannot be reached from outside Binary::Types diff --git a/include/revng/Model/RawFunctionDefinition.h b/include/revng/Model/RawFunctionDefinition.h index ef763c645..4c7a5b14d 100644 --- a/include/revng/Model/RawFunctionDefinition.h +++ b/include/revng/Model/RawFunctionDefinition.h @@ -4,7 +4,6 @@ // This file is distributed under the MIT License. See LICENSE.md for details. // -#include "revng/Model/Identifier.h" #include "revng/Model/NamedTypedRegister.h" #include "revng/Model/TypeDefinition.h" diff --git a/include/revng/Model/Segment.h b/include/revng/Model/Segment.h index 1ade07ad0..f0c0d83b2 100644 --- a/include/revng/Model/Segment.h +++ b/include/revng/Model/Segment.h @@ -5,7 +5,6 @@ // #include "revng/ADT/SortedVector.h" -#include "revng/Model/Identifier.h" #include "revng/Model/Relocation.h" #include "revng/Model/TypeDefinition.h" #include "revng/Support/MetaAddress.h" @@ -41,11 +40,7 @@ fields: doc: Is this segment writable? - name: IsExecutable type: bool - doc: Is this segment executable? - - name: CustomName - type: Identifier - optional: true - - name: OriginalName + - name: Name type: string optional: true - name: Comment diff --git a/include/revng/Model/StructDefinition.h b/include/revng/Model/StructDefinition.h index a9e435086..39e3cc3c8 100644 --- a/include/revng/Model/StructDefinition.h +++ b/include/revng/Model/StructDefinition.h @@ -4,7 +4,6 @@ // This file is distributed under the MIT License. See LICENSE.md for details. // -#include "revng/Model/Identifier.h" #include "revng/Model/StructField.h" #include "revng/Model/TypeDefinition.h" diff --git a/include/revng/Model/StructField.h b/include/revng/Model/StructField.h index 8330a040b..84a077855 100644 --- a/include/revng/Model/StructField.h +++ b/include/revng/Model/StructField.h @@ -5,7 +5,6 @@ // #include "revng/ADT/RecursiveCoroutine.h" -#include "revng/Model/Identifier.h" #include "revng/Model/Type.h" /* TUPLE-TREE-YAML @@ -18,11 +17,7 @@ type: struct fields: - name: Offset type: uint64_t - doc: Offset at which the field starts within the `struct`. - - name: CustomName - type: Identifier - optional: true - - name: OriginalName + - name: Name type: string optional: true - name: Comment diff --git a/include/revng/Model/TypeDefinition.h b/include/revng/Model/TypeDefinition.h index 6c835f4e8..58a592223 100644 --- a/include/revng/Model/TypeDefinition.h +++ b/include/revng/Model/TypeDefinition.h @@ -12,7 +12,6 @@ #include "revng/ADT/UpcastablePointer/YAMLTraits.h" #include "revng/Model/ABI.h" #include "revng/Model/CommonTypeMethods.h" -#include "revng/Model/Identifier.h" #include "revng/Model/Register.h" #include "revng/Model/TypeDefinitionKind.h" #include "revng/Support/Assert.h" @@ -41,20 +40,11 @@ fields: A unique identifier for this type. - name: Kind type: TypeDefinitionKind - doc: |- - A discriminator field to identify the concrete type. - - name: CustomName - type: Identifier - optional: true + - name: Name doc: |- A user-chosen `Identifier` for this type. - - name: OriginalName type: string optional: true - doc: |- - The name this type had upon import. - This value can differ from `CustomName`, since `CustomName` needs to - respect the constraints of an `Identifier`. - name: Comment type: string optional: true diff --git a/include/revng/Model/TypedefDefinition.h b/include/revng/Model/TypedefDefinition.h index 384ec2e7c..438502a32 100644 --- a/include/revng/Model/TypedefDefinition.h +++ b/include/revng/Model/TypedefDefinition.h @@ -4,7 +4,6 @@ // This file is distributed under the MIT License. See LICENSE.md for details. // -#include "revng/Model/Identifier.h" #include "revng/Model/Type.h" #include "revng/Model/TypeDefinition.h" diff --git a/include/revng/Model/UnionDefinition.h b/include/revng/Model/UnionDefinition.h index 7491a0a58..13616bfd0 100644 --- a/include/revng/Model/UnionDefinition.h +++ b/include/revng/Model/UnionDefinition.h @@ -4,7 +4,6 @@ // This file is distributed under the MIT License. See LICENSE.md for details. // -#include "revng/Model/Identifier.h" #include "revng/Model/TypeDefinition.h" #include "revng/Model/UnionField.h" diff --git a/include/revng/Model/UnionField.h b/include/revng/Model/UnionField.h index f94d78121..5ddb1b0ea 100644 --- a/include/revng/Model/UnionField.h +++ b/include/revng/Model/UnionField.h @@ -5,7 +5,6 @@ // #include "revng/ADT/RecursiveCoroutine.h" -#include "revng/Model/Identifier.h" #include "revng/Model/Type.h" /* TUPLE-TREE-YAML @@ -18,11 +17,7 @@ type: struct fields: - name: Index type: uint64_t - doc: The index of the alternative within the `union`. - - name: CustomName - type: Identifier - optional: true - - name: OriginalName + - name: Name type: string optional: true - name: Comment diff --git a/include/revng/tests/unit/ModelType.inc b/include/revng/tests/unit/ModelType.inc index d7da7aa31..b54b1109f 100644 --- a/include/revng/tests/unit/ModelType.inc +++ b/include/revng/tests/unit/ModelType.inc @@ -154,7 +154,7 @@ BOOST_AUTO_TEST_CASE(EnumTypes) { // With a valid underlying type and at least one entry we're good, but we // have to initialize all the cross references in the tree. EnumEntry Entry = EnumEntry{ 0 }; - Entry.CustomName() = "value0"; + Entry.Name() = "value0"; revng_check(Entry.verify(true)); revng_check(EnumDefinition.Entries().insert(Entry).second); @@ -181,14 +181,14 @@ BOOST_AUTO_TEST_CASE(EnumTypes) { // Inserting two entries with the same name succeeds but does not verify. EnumEntry Entry1{ 5 }; - Entry1.CustomName() = "some_value"; + Entry1.Name() = "some_value"; revng_check(EnumDefinition.Entries().insert(Entry1).second); revng_check(EnumDefinition.Entries().size() == 3); revng_check(verify(EnumDefinition, *T, true)); revng_check(verify(*T, true)); revng_check(checkSerialization(T)); EnumEntry Entry2{ 7 }; - Entry2.CustomName() = "some_value"; + Entry2.Name() = "some_value"; revng_check(EnumDefinition.Entries().insert(Entry2).second); revng_check(EnumDefinition.Entries().size() == 4); revng_check(not verify(*T, false)); @@ -233,7 +233,7 @@ BOOST_AUTO_TEST_CASE(TypedefTypes) { auto &&[Int32, Int32Type] = T->makeTypeDefinition(); revng_check(T->TypeDefinitions().size() == 1); Int32.UnderlyingType() = model::PrimitiveType::make(Signed, 4); - Int32.CustomName() = "int_32_typedef"; + Int32.Name() = "int_32_typedef"; revng_check(verify(Int32, *T, true)); revng_check(verify(*T, true)); revng_check(checkSerialization(T)); @@ -248,7 +248,7 @@ BOOST_AUTO_TEST_CASE(TypedefTypes) { auto &&[Pointer, PointerType] = T->makeTypeDefinition(); revng_check(T->TypeDefinitions().size() == 2); Pointer.UnderlyingType() = model::PointerType::make(std::move(Int32Type), 4); - Pointer.CustomName() = "int_32_pointer_typedef"; + Pointer.Name() = "int_32_pointer_typedef"; revng_check(verify(Pointer, *T, true)); revng_check(verify(*T, true)); revng_check(checkSerialization(T)); @@ -257,7 +257,7 @@ BOOST_AUTO_TEST_CASE(TypedefTypes) { auto &&[Array, ArrayType] = T->makeTypeDefinition(); revng_check(T->TypeDefinitions().size() == 3); Array.UnderlyingType() = model::ArrayType::make(std::move(PointerType), 25); - Array.CustomName() = "int_32_pointer_array_typedef"; + Array.Name() = "int_32_pointer_array_typedef"; revng_check(verify(Array, *T, true)); revng_check(verify(*T, true)); revng_check(checkSerialization(T)); @@ -315,9 +315,9 @@ BOOST_AUTO_TEST_CASE(StructTypes) { // Assigning succeeds if even if an index is already present StructField Field1Ter = StructField{ 4 }; Field1Ter.Type() = model::PrimitiveType::makeSigned(4); - Field1Ter.CustomName() = "fld1ter"; + Field1Ter.Name() = "fld1ter"; revng_check(not Struct.Fields().insert_or_assign(Field1Ter).second); - revng_check(Struct.Fields().at(4).CustomName() == "fld1ter"); + revng_check(Struct.Fields().at(4).Name() == "fld1ter"); revng_check(verify(Struct, *T, true)); revng_check(verify(*T, true)); revng_check(checkSerialization(T)); @@ -427,7 +427,7 @@ BOOST_AUTO_TEST_CASE(UnionTypes) { { UnionField Field1(1); Field1.Type() = model::PrimitiveType::makeSigned(8); - Field1.CustomName() = "fld1"; + Field1.Name() = "fld1"; auto &&[It, New] = Union.Fields().insert(std::move(Field1)); revng_check(New); } @@ -440,10 +440,10 @@ BOOST_AUTO_TEST_CASE(UnionTypes) { // succeeds, but verification of the binary fails. UnionField Field1(2); Field1.Type() = model::PrimitiveType::makeSigned(4); - Field1.CustomName() = "fld1"; + Field1.Name() = "fld1"; auto &&[It, New] = Union.Fields().insert(std::move(Field1)); revng_check(New); - revng_check(Union.Fields().at(It->Index()).CustomName() == "fld1"); + revng_check(Union.Fields().at(It->Index()).Name() == "fld1"); revng_check(not verify(*T, false)); // But removing goes back to good again @@ -575,7 +575,7 @@ BOOST_AUTO_TEST_CASE(RawFunctionTypes) { auto &RSIArg = Prototype.addArgument(model::Register::rsi_x86_64, model::PrimitiveType::makeGeneric(8)); revng_check(RSIArg.verify(true)); - RSIArg.CustomName() = "Second"; + RSIArg.Name() = "Second"; revng_check(RSIArg.verify(true)); revng_check(verify(Prototype, *T, true)); revng_check(verify(*T, true)); diff --git a/lib/ABI/FunctionType/Conversion.cpp b/lib/ABI/FunctionType/Conversion.cpp index b242b8e67..e1f200a8b 100644 --- a/lib/ABI/FunctionType/Conversion.cpp +++ b/lib/ABI/FunctionType/Conversion.cpp @@ -252,7 +252,7 @@ TCC::tryConvertingRegisterArguments(RFTArguments Registers) { // If the current register is confirmed to be in use, convert it into // an argument while preserving its type and metadata. model::Argument &Current = Result.emplace_back(); - Current.CustomName() = CurrentRegisterIterator->CustomName(); + Current.Name() = CurrentRegisterIterator->Name(); revng_assert(!CurrentRegisterIterator->Type().isEmpty()); Current.Type() = CurrentRegisterIterator->Type().copy(); @@ -439,7 +439,7 @@ TCC::tryConvertingStackArguments(const model::UpcastableType &StackStruct, if (!StackStruct->isTypedef() && !model::hasMetadata(Stack)) { // NOTE: Only proceed with trying to "split" the stack struct up if it has // no metadata attached: as in, it doesn't have a user-defined - // `CustomName` or a `Comment` or any other fields we'll mark as + // `Name` or a `Comment` or any other fields we'll mark as // metadata in the future. if (Stack.Fields().empty()) diff --git a/lib/Backend/DecompileFunction.cpp b/lib/Backend/DecompileFunction.cpp index 8d1622980..5436b5c97 100644 --- a/lib/Backend/DecompileFunction.cpp +++ b/lib/Backend/DecompileFunction.cpp @@ -38,7 +38,6 @@ #include "revng/Model/Binary.h" #include "revng/Model/Helpers.h" #include "revng/Model/IRHelpers.h" -#include "revng/Model/Identifier.h" #include "revng/Model/NameBuilder.h" #include "revng/Model/PrimitiveKind.h" #include "revng/Model/RawFunctionDefinition.h" diff --git a/lib/DataLayoutAnalysis/Backend/DLAMakeModelTypes.cpp b/lib/DataLayoutAnalysis/Backend/DLAMakeModelTypes.cpp index ba6ecf364..cf050cde4 100644 --- a/lib/DataLayoutAnalysis/Backend/DLAMakeModelTypes.cpp +++ b/lib/DataLayoutAnalysis/Backend/DLAMakeModelTypes.cpp @@ -204,7 +204,7 @@ makeStructFromNode(const LTSN *N, PointerFieldsToUpdate, Model); - model::StructField Field{ FieldOffset, {}, {}, {}, std::move(FieldType) }; + model::StructField Field{ FieldOffset, {}, {}, std::move(FieldType) }; bool Inserted = Fields.insert({ std::move(Field), SuccNode }).second; revng_assert(Inserted); } @@ -283,7 +283,7 @@ makeUnionFromNode(const LTSN *N, Model, FieldOffset); - UnionField Field{ FieldIndex, {}, {}, {}, FieldType }; + UnionField Field{ FieldIndex, {}, {}, FieldType }; bool Inserted = Fields.insert({ std::move(Field), SuccNode }).second; revng_assert(Inserted); } diff --git a/lib/EarlyFunctionAnalysis/CollectCFG.cpp b/lib/EarlyFunctionAnalysis/CollectCFG.cpp index 1119da682..f41d86b53 100644 --- a/lib/EarlyFunctionAnalysis/CollectCFG.cpp +++ b/lib/EarlyFunctionAnalysis/CollectCFG.cpp @@ -66,7 +66,7 @@ public: if (DebugNames) { auto Function = Binary->Functions().at(EntryAddress); - New.OriginalName() = Function.OriginalName(); + New.Name() = Function.Name(); } if (New.Blocks().size() > 0) diff --git a/lib/EarlyFunctionAnalysis/ControlFlowGraph.cpp b/lib/EarlyFunctionAnalysis/ControlFlowGraph.cpp index c0f8c432b..c28be6952 100644 --- a/lib/EarlyFunctionAnalysis/ControlFlowGraph.cpp +++ b/lib/EarlyFunctionAnalysis/ControlFlowGraph.cpp @@ -343,9 +343,8 @@ bool FunctionEdgeBase::verify(model::VerifyHelper &VH) const { return true; } -model::Identifier BasicBlock::name() const { - using llvm::Twine; - return model::Identifier(std::string("bb_") + ID().toString()); +std::string BasicBlock::name() const { + return "bb_" + ID().toString(); } bool BasicBlock::verify() const { diff --git a/lib/EarlyFunctionAnalysis/DecoratedFunction.h b/lib/EarlyFunctionAnalysis/DecoratedFunction.h index 0ab46e6af..6093b80e6 100644 --- a/lib/EarlyFunctionAnalysis/DecoratedFunction.h +++ b/lib/EarlyFunctionAnalysis/DecoratedFunction.h @@ -17,7 +17,7 @@ type: struct fields: - name: Entry type: MetaAddress - - name: OriginalName + - name: Name type: string - name: ControlFlowGraph type: efa::ControlFlowGraph diff --git a/lib/EarlyFunctionAnalysis/DetectABI.cpp b/lib/EarlyFunctionAnalysis/DetectABI.cpp index e2cddd5dd..28ee9facb 100644 --- a/lib/EarlyFunctionAnalysis/DetectABI.cpp +++ b/lib/EarlyFunctionAnalysis/DetectABI.cpp @@ -34,7 +34,6 @@ #include "revng/EarlyFunctionAnalysis/FunctionSummaryOracle.h" #include "revng/Model/Binary.h" #include "revng/Model/NameBuilder.h" -#include "revng/Model/Pass/PromoteOriginalName.h" #include "revng/Model/Register.h" #include "revng/Pipeline/Pipe.h" #include "revng/Pipeline/RegisterAnalysis.h" @@ -650,7 +649,7 @@ void DetectABI::applyABIDeductions() { Summary.ABIResults.ReturnValuesRegisters = std::move(ResultingReturnValues); if (Log.isEnabled()) { - Log << "Summary for " << Function.OriginalName() << ":\n"; + Log << "Summary for " << Function.Name() << ":\n"; Summary.dump(Log); Log << DoLog; } @@ -835,24 +834,22 @@ void DetectABI::propagatePrototypesInFunction(model::Function &Function) { Function.Prototype() = Binary->makeType(Prototype->key()); - if (Function.CustomName().empty() and Function.OriginalName().empty()) { + if (Function.Name().empty()) { if (not Call->DynamicFunction().empty()) { - Function.OriginalName() = Call->DynamicFunction(); + Function.Name() = Call->DynamicFunction(); + } else if (Call->Destination().isValid()) { const model::Function &Callee = Binary->Functions() .at(Call->Destination() .notInlinedAddress()); - if (not Callee.CustomName().empty()) - Function.OriginalName() = Callee.CustomName().str(); - else if (not Callee.OriginalName().empty()) - Function.OriginalName() = Callee.OriginalName(); + if (not Callee.Name().empty()) + Function.Name() = Callee.Name(); + else if (not Callee.Name().empty()) + Function.Name() = Callee.Name(); } } } } - - // TODO: should this be done at an higher abstraction level? - model::promoteOriginalName(Binary); } model::UpcastableType diff --git a/lib/EarlyFunctionAnalysis/FunctionSummaryOracle.cpp b/lib/EarlyFunctionAnalysis/FunctionSummaryOracle.cpp index 97db90830..cd21ba541 100644 --- a/lib/EarlyFunctionAnalysis/FunctionSummaryOracle.cpp +++ b/lib/EarlyFunctionAnalysis/FunctionSummaryOracle.cpp @@ -178,7 +178,7 @@ FunctionSummaryOracle::getDynamicFunction(llvm::StringRef Name) { for (auto &ToCopy : DynamicFunction.Attributes()) Attributes.insert(ToCopy); - registerDynamicFunction(DynamicFunction.OriginalName(), + registerDynamicFunction(DynamicFunction.Name(), Importer.prototype(Attributes, Prototype)); } return DynamicFunctions.at(Name.str()); diff --git a/lib/FunctionIsolation/EnforceABI.cpp b/lib/FunctionIsolation/EnforceABI.cpp index 96784ea2c..0bda2c506 100644 --- a/lib/FunctionIsolation/EnforceABI.cpp +++ b/lib/FunctionIsolation/EnforceABI.cpp @@ -125,8 +125,7 @@ bool EnforceABI::prologue() { for (const model::DynamicFunction &FunctionModel : Binary.ImportedDynamicFunctions()) { // TODO: have an API to go from model to llvm::Function - auto OldFunctionName = (Twine("dynamic_") + FunctionModel.OriginalName()) - .str(); + auto OldFunctionName = (Twine("dynamic_") + FunctionModel.Name()).str(); Function *OldFunction = M.getFunction(OldFunctionName); if (not OldFunction or OldFunction->isDeclaration()) continue; diff --git a/lib/FunctionIsolation/IsolateFunctions.cpp b/lib/FunctionIsolation/IsolateFunctions.cpp index 873ef2607..faeec3077 100644 --- a/lib/FunctionIsolation/IsolateFunctions.cpp +++ b/lib/FunctionIsolation/IsolateFunctions.cpp @@ -529,11 +529,11 @@ void IsolateFunctionsImpl::run() { "Dynamic functions creation"); for (const model::DynamicFunction &Function : Binary.ImportedDynamicFunctions()) { - StringRef Name = Function.OriginalName(); + StringRef Name = Function.Name(); DynamicFunctionsTask.advance(Name, true); auto *NewFunction = Function::Create(IsolatedFunctionType, GlobalValue::ExternalLinkage, - "dynamic_" + Function.OriginalName(), + "dynamic_" + Function.Name(), TheModule); FunctionTags::DynamicFunction.addTo(NewFunction); NewFunction->addFnAttr(Attribute::NoMerge); diff --git a/lib/HeadersGeneration/HelpersToHeader.cpp b/lib/HeadersGeneration/HelpersToHeader.cpp index b2446976f..a3a1926dd 100644 --- a/lib/HeadersGeneration/HelpersToHeader.cpp +++ b/lib/HeadersGeneration/HelpersToHeader.cpp @@ -18,7 +18,6 @@ #include "revng/HeadersGeneration/PTMLHeaderBuilder.h" #include "revng/Model/Binary.h" -#include "revng/Model/Identifier.h" #include "revng/PTML/IndentedOstream.h" #include "revng/Pipeline/Location.h" #include "revng/Pipes/Ranks.h" diff --git a/lib/ImportFromC/HeaderToModel.cpp b/lib/ImportFromC/HeaderToModel.cpp index a56d0e6ba..422cd0867 100644 --- a/lib/ImportFromC/HeaderToModel.cpp +++ b/lib/ImportFromC/HeaderToModel.cpp @@ -318,7 +318,7 @@ model::UpcastableType DeclVisitor::makeTypeByNameOrID(llvm::StringRef Name) { // Try to find by name first. for (auto &Type : Model->TypeDefinitions()) if (llvm::isa(Type.get())) - if (Type->CustomName() == Name) + if (Type->Name() == Name) return Model->makeType(Type->key()); // Getting here means we didn't manage to find it, @@ -549,7 +549,7 @@ bool DeclVisitor::VisitFunctionDecl(const clang::FunctionDecl *FD) { model::Argument &NewArgument = FunctionType.Arguments()[Index]; // TODO: we shouldn't write generated names into the model. - NewArgument.CustomName() = FD->getParamDecl(I)->getName(); + NewArgument.Name() = FD->getParamDecl(I)->getName(); NewArgument.Type() = std::move(ParamType); ++Index; @@ -695,7 +695,7 @@ bool DeclVisitor::VisitFunctionDecl(const clang::FunctionDecl *FD) { NamedTypedRegister &ParamReg = ArgumentsInserter.emplace(Location); ParamReg.Type() = std::move(ParamType); if (not ParamDecl->getName().empty()) - ParamReg.CustomName() = ParamDecl->getName(); + ParamReg.Name() = ParamDecl->getName(); } } } @@ -704,7 +704,7 @@ bool DeclVisitor::VisitFunctionDecl(const clang::FunctionDecl *FD) { auto &ModelFunction = Model->Functions()[FunctionEntry]; // TODO: we shouldn't write generated names into the model. - ModelFunction.CustomName() = FD->getName(); + ModelFunction.Name() = FD->getName(); // TODO: remember/clone StackFrameType as well. @@ -763,7 +763,7 @@ bool DeclVisitor::VisitTypedefDecl(const TypedefDecl *D) { TheTypeTypeDef->UnderlyingType() = std::move(ModelTypedefType); // TODO: we shouldn't write generated names into the model. - TheTypeTypeDef->CustomName() = D->getName(); + TheTypeTypeDef->Name() = D->getName(); if (AnalysisOption == ImportFromCOption::EditType) { revng_assert(*Type == NewTypedef->key()); @@ -870,7 +870,7 @@ bool DeclVisitor::handleStructType(const clang::RecordDecl *RD) { NewType->ID() = ID; // TODO: we shouldn't write generated names into the model. - NewType->CustomName() = RD->getName(); + NewType->Name() = RD->getName(); auto *Struct = cast(NewType.get()); uint64_t CurrentOffset = 0; @@ -977,7 +977,7 @@ bool DeclVisitor::handleStructType(const clang::RecordDecl *RD) { auto &FieldModelType = Struct->Fields()[CurrentOffset]; // TODO: we shouldn't write generated names into the model. - FieldModelType.CustomName() = Field->getName(); + FieldModelType.Name() = Field->getName(); FieldModelType.Type() = std::move(ModelField); } else { @@ -1042,7 +1042,7 @@ bool DeclVisitor::handleUnionType(const clang::RecordDecl *RD) { NewType->ID() = ID; // TODO: we shouldn't write generated names into the model. - NewType->CustomName() = RD->getName(); + NewType->Name() = RD->getName(); auto Union = cast(NewType.get()); @@ -1069,7 +1069,7 @@ bool DeclVisitor::handleUnionType(const clang::RecordDecl *RD) { auto &FieldModelType = Union->Fields()[CurrentIndex]; // TODO: we shouldn't write generated names into the model. - FieldModelType.CustomName() = Field->getName(); + FieldModelType.Name() = Field->getName(); FieldModelType.Type() = std::move(TheFieldType); @@ -1177,12 +1177,12 @@ bool DeclVisitor::VisitEnumDecl(const EnumDecl *D) { auto *Definition = D->getDefinition(); // TODO: we shouldn't write generated names into the model. - NewType->CustomName() = Definition->getName(); + NewType->Name() = Definition->getName(); for (const auto *Enum : Definition->enumerators()) { auto Value = Enum->getInitVal().getExtValue(); auto NewIterator = NewType->Entries().insert(Value).first; - NewIterator->CustomName() = Enum->getName().str(); + NewIterator->Name() = Enum->getName().str(); } return true; diff --git a/lib/Lift/JumpTargetManager.cpp b/lib/Lift/JumpTargetManager.cpp index a32bd7a3d..55e129334 100644 --- a/lib/Lift/JumpTargetManager.cpp +++ b/lib/Lift/JumpTargetManager.cpp @@ -416,8 +416,8 @@ MaterializedValue JumpTargetManager::readFromPointer(MetaAddress LoadAddress, auto RelocationSize = model::RelocationType::getSize(Relocation.Type()); if (LoadAddress == Relocation.Address() and LoadSize == RelocationSize) { // TODO: add this to model verify - revng_assert(not StringRef(Function.OriginalName()).contains('\0')); - Result = MaterializedValue::fromSymbol(Function.OriginalName(), + revng_assert(not StringRef(Function.Name()).contains('\0')); + Result = MaterializedValue::fromSymbol(Function.Name(), NewAPInt(Addend)); ++MatchCount; } diff --git a/lib/Model/CMakeLists.txt b/lib/Model/CMakeLists.txt index 74943d682..82f04f79e 100644 --- a/lib/Model/CMakeLists.txt +++ b/lib/Model/CMakeLists.txt @@ -7,7 +7,6 @@ revng_add_analyses_library_internal( revngModel Binary.cpp CommonTypeMethods.cpp - Identifier.cpp LoadModelPass.cpp NameBuilder.cpp TypeSystemPrinter.cpp @@ -49,12 +48,9 @@ target_tuple_tree_generator( EMIT_TRACKING GLOBAL_NAME Model - STRING_TYPES - "Identifier" SEPARATE_STRING_TYPES "MetaAddress" SCALAR_TYPES - "Identifier" "MetaAddress" HEADERS "${MODEL_HEADERS_DIR}/ABI.h" diff --git a/lib/Model/Identifier.cpp b/lib/Model/Identifier.cpp deleted file mode 100644 index c0e355fae..000000000 --- a/lib/Model/Identifier.cpp +++ /dev/null @@ -1,323 +0,0 @@ -/// \file Identifier.cpp - -// -// This file is distributed under the MIT License. See LICENSE.md for details. -// - -#include "revng/Model/ArrayType.h" -#include "revng/Model/DefinedType.h" -#include "revng/Model/Identifier.h" -#include "revng/Model/PointerType.h" -#include "revng/Model/PrimitiveType.h" -#include "revng/Model/VerifyHelper.h" - -using namespace model; - -const Identifier Identifier::Empty = Identifier(""); - -const std::set ReservedKeywords = { - // reserved keywords for primitive types - "void", - "pointer_or_number8_t", - "pointer_or_number16_t", - "pointer_or_number32_t", - "pointer_or_number64_t", - "pointer_or_number128_t", - "number8_t", - "number16_t", - "number32_t", - "number64_t", - "number128_t", - "generic8_t", - "generic16_t", - "generic32_t", - "generic64_t", - "generic80_t", - "generic96_t", - "generic128_t", - "int8_t", - "int16_t", - "int32_t", - "int64_t", - "int128_t", - "int_fast8_t", - "int_fast16_t", - "int_fast32_t", - "int_fast64_t", - "int_fast128_t", - "int_least8_t", - "int_least16_t", - "int_least32_t", - "int_least64_t", - "int_least128_t", - "intmax_t", - "intptr_t", - "uint8_t", - "uint16_t", - "uint32_t", - "uint64_t", - "uint128_t", - "uint_fast8_t", - "uint_fast16_t", - "uint_fast32_t", - "uint_fast64_t", - "uint_fast128_t", - "uint_least8_t", - "uint_least16_t", - "uint_least32_t", - "uint_least64_t", - "uint_least128_t", - "uintmax_t", - "uintptr_t", - "float16_t", - "float32_t", - "float64_t", - "float80_t", - "float96_t", - "float128_t", - // Integer macros from stdint.h, reserved to prevent clashes. - "INT8_WIDTH", - "INT16_WIDTH", - "INT32_WIDTH", - "INT64_WIDTH", - "INT_FAST8_WIDTH", - "INT_FAST16_WIDTH", - "INT_FAST32_WIDTH", - "INT_FAST64_WIDTH", - "INT_LEAST8_WIDTH", - "INT_LEAST16_WIDTH", - "INT_LEAST32_WIDTH", - "INT_LEAST64_WIDTH", - "INTPTR_WIDTH", - "INTMAX_WIDTH", - "INT8_MIN", - "INT16_MIN", - "INT32_MIN", - "INT64_MIN", - "INT_FAST8_MIN", - "INT_FAST16_MIN", - "INT_FAST32_MIN", - "INT_FAST64_MIN", - "INT_LEAST8_MIN", - "INT_LEAST16_MIN", - "INT_LEAST32_MIN", - "INT_LEAST64_MIN", - "INTPTR_MIN", - "INTMAX_MIN", - "INT8_MAX", - "INT16_MAX", - "INT32_MAX", - "INT64_MAX", - "INT_FAST8_MAX", - "INT_FAST16_MAX", - "INT_FAST32_MAX", - "INT_FAST64_MAX", - "INT_LEAST8_MAX", - "INT_LEAST16_MAX", - "INT_LEAST32_MAX", - "INT_LEAST64_MAX", - "INTPTR_MAX", - "INTMAX_MAX", - "UINT8_WIDTH", - "UINT16_WIDTH", - "UINT32_WIDTH", - "UINT64_WIDTH", - "UINT_FAST8_WIDTH", - "UINT_FAST16_WIDTH", - "UINT_FAST32_WIDTH", - "UINT_FAST64_WIDTH", - "UINT_LEAST8_WIDTH", - "UINT_LEAST16_WIDTH", - "UINT_LEAST32_WIDTH", - "UINT_LEAST64_WIDTH", - "UINTPTR_WIDTH", - "UINTMAX_WIDTH", - "UINT8_MAX", - "UINT16_MAX", - "UINT32_MAX", - "UINT64_MAX", - "UINT_FAST8_MAX", - "UINT_FAST16_MAX", - "UINT_FAST32_MAX", - "UINT_FAST64_MAX", - "UINT_LEAST8_MAX", - "UINT_LEAST16_MAX", - "UINT_LEAST32_MAX", - "UINT_LEAST64_MAX", - "UINTPTR_MAX", - "UINTMAX_MAX", - "INT8_C", - "INT16_C", - "INT32_C", - "INT64_C", - "INTMAX_C", - "UINT8_C", - "UINT16_C", - "UINT32_C", - "UINT64_C", - "UINTMAX_C", - // C reserved keywords - "auto", - "break", - "case", - "char", - "const", - "continue", - "default", - "do", - "double", - "else", - "enum", - "extern", - "float", - "for", - "goto", - "if", - "inline", // Since C99 - "int", - "long", - "register", - "restrict", // Since C99 - "return", - "short", - "signed", - "sizeof", - "static", - "struct", - "switch", - "typedef", - "union", - "unsigned", - "volatile", - "while", - "_Alignas", // Since C11 - "_Alignof", // Since C11 - "_Atomic", // Since C11 - "_Bool", // Since C99 - "_Complex", // Since C99 - "_Decimal128", // Since C23 - "_Decimal32", // Since C23 - "_Decimal64", // Since C23 - "_Generic", // Since C11 - "_Imaginary", // Since C99 - "_Noreturn", // Since C11 - "_Static_assert", // Since C11 - "_Thread_local", // Since C11 - // Convenience macros - "alignas", - "alignof", - "bool", - "complex", - "imaginary", - "noreturn", - "static_assert", - "thread_local", - // Convenience macros for atomic types - "atomic_bool", - "atomic_char", - "atomic_schar", - "atomic_uchar", - "atomic_short", - "atomic_ushort", - "atomic_int", - "atomic_uint", - "atomic_long", - "atomic_ulong", - "atomic_llong", - "atomic_ullong", - "atomic_char16_t", - "atomic_char32_t", - "atomic_wchar_t", - "atomic_int_least8_t", - "atomic_uint_least8_t", - "atomic_int_least16_t", - "atomic_uint_least16_t", - "atomic_int_least32_t", - "atomic_uint_least32_t", - "atomic_int_least64_t", - "atomic_uint_least64_t", - "atomic_int_fast8_t", - "atomic_uint_fast8_t", - "atomic_int_fast16_t", - "atomic_uint_fast16_t", - "atomic_int_fast32_t", - "atomic_uint_fast32_t", - "atomic_int_fast64_t", - "atomic_uint_fast64_t", - "atomic_intptr_t", - "atomic_uintptr_t", - "atomic_size_t", - "atomic_ptrdiff_t", - "atomic_intmax_t", - "atomic_uintmax_t", - // C Extensions - "_Pragma", - "asm", -}; - -static bool isNotUnderscore(const char C) { - return C != '_'; -}; - -static bool allAlphaNumOrUnderscore(const Identifier &Range) { - const auto &FilterRange = llvm::make_filter_range(Range, isNotUnderscore); - for (const auto &Entry : FilterRange) - if (not std::isalnum(Entry)) - return false; - return true; -}; - -bool Identifier::verify(VerifyHelper &VH) const { - return VH.maybeFail(not(not empty() and std::isdigit(str()[0])) - and not startswith("_") - and allAlphaNumOrUnderscore(str()) - and not ReservedKeywords.contains(str()), - llvm::Twine(*this) + " is not a valid identifier"); -} - -bool Identifier::verify(bool Assert) const { - VerifyHelper VH(Assert); - return verify(VH); -} -bool Identifier::verify() const { - return verify(false); -} - -constexpr static llvm::StringRef PrefixForReservedNames = "unreserved_"; - -Identifier Identifier::fromString(llvm::StringRef Name) { - revng_assert(not Name.empty()); - Identifier Result; - - // For reserved C keywords prepend a non-reserved prefix and we're done. - if (ReservedKeywords.contains(Name)) { - Result += PrefixForReservedNames; - Result += Name; - return Result; - } - - const auto BecomesUnderscore = [](const char C) { - return not std::isalnum(C) or C == '_'; - }; - - // For invalid C identifiers prepend the our reserved prefix. - if (std::isdigit(Name[0]) or BecomesUnderscore(Name[0])) { - Result += PrefixForReservedNames; - } - - // Append the rest of the name - Result += Name; - - return sanitize(Result); -} - -Identifier Identifier::sanitize(llvm::StringRef Name) { - Identifier Result(Name); - - // Convert all non-alphanumeric chars to underscores - for (char &C : Result) - if (not std::isalnum(C)) - C = '_'; - - return Result; -} diff --git a/lib/Model/Importer/Binary/CrossModelFindTypeHelper.h b/lib/Model/Importer/Binary/CrossModelFindTypeHelper.h index aed458fe6..fd598f919 100644 --- a/lib/Model/Importer/Binary/CrossModelFindTypeHelper.h +++ b/lib/Model/Importer/Binary/CrossModelFindTypeHelper.h @@ -43,8 +43,7 @@ findPrototypeInLocalFunctions(T &Functions, if (!FoundAlias) continue; } else { - // Rely on OriginalName only. - if (Function.OriginalName() != FunctionName) + if (Function.Name() != FunctionName) continue; } @@ -63,8 +62,7 @@ findPrototypeInDynamicFunctions(T &Functions, llvm::StringRef FunctionName, llvm::StringRef ModuleName) { for (auto &DynamicFunction : Functions) { - // Rely on OriginalName only. - if (DynamicFunction.OriginalName() != FunctionName) + if (DynamicFunction.Name() != FunctionName) continue; if (const model::TypeDefinition *Prototype = DynamicFunction.prototype()) diff --git a/lib/Model/Importer/Binary/ELFImporter.cpp b/lib/Model/Importer/Binary/ELFImporter.cpp index 0f83b729f..bc9e015c9 100644 --- a/lib/Model/Importer/Binary/ELFImporter.cpp +++ b/lib/Model/Importer/Binary/ELFImporter.cpp @@ -425,9 +425,6 @@ Error ELFImporter::import(const ImporterOptions &Options) { findMissingTypes(TheELF, AdjustedOptions); } - Task.advance("Promote original name", true); - model::promoteOriginalName(Model); - return Error::success(); } @@ -507,18 +504,17 @@ void ELFImporter::findMissingTypes(object::ELFFile &TheELF, }; for (auto &Fn : Model->ImportedDynamicFunctions()) { - if (not Fn.Prototype().isEmpty() or Fn.OriginalName().size() == 0) + if (not Fn.Prototype().isEmpty() or Fn.Name().size() == 0) continue; - if (auto Found = findPrototype(Fn.OriginalName(), ModelsOfLibraries)) { + if (auto Found = findPrototype(Fn.Name(), ModelsOfLibraries)) { revng_assert(!Found->ModuleName.empty()); revng_assert(Found->Prototype.verify(true)); model::UpcastableTypeDefinition SerializablePrototype = Found->Prototype; revng_log(ELFImporterLog, - "Found type for " << Fn.OriginalName() << " in " - << Found->ModuleName << ": " - << toString(SerializablePrototype)); + "Found type for " << Fn.Name() << " in " << Found->ModuleName + << ": " << toString(SerializablePrototype)); TypeCopier &TheTypeCopier = GetOrMakeACopier(Found->ModuleName); Fn.Prototype() = TheTypeCopier.copyTypeInto(Found->Prototype); @@ -527,8 +523,7 @@ void ELFImporter::findMissingTypes(object::ELFFile &TheELF, if (Attribute != model::FunctionAttribute::Inline) Fn.Attributes().insert(Attribute); } else { - revng_log(ELFImporterLog, - "Prototype for " << Fn.OriginalName() << " not found"); + revng_log(ELFImporterLog, "Prototype for " << Fn.Name() << " not found"); } } @@ -541,7 +536,6 @@ void ELFImporter::findMissingTypes(object::ELFFile &TheELF, Model.initializeReferences(); deduplicateEquivalentTypes(Model); - promoteOriginalName(Model); } using Libs = SmallVectorImpl; @@ -670,7 +664,7 @@ void ELFImporter::parseSymbols(object::ELFFile &TheELF, if (Model->Functions().tryGet(Address) == nullptr) { auto *Function = registerFunctionEntry(Address); if (Function != nullptr and MaybeName and MaybeName->size() > 0) { - Function->OriginalName() = *MaybeName; + Function->Name() = *MaybeName; // Insert Original name into exported ones, since it is by default // true. Function->ExportedNames().insert((*MaybeName).str()); @@ -843,7 +837,7 @@ void ELFImporter::parseDynamicSymbol(Elf_Sym_Impl &Symbol, } else { Function = registerFunctionEntry(Address); if (Function != nullptr) - Function->OriginalName() = Name; + Function->Name() = Name; } if (Function != nullptr and Name.size() > 0) diff --git a/lib/Model/Importer/Binary/MachOImporter.cpp b/lib/Model/Importer/Binary/MachOImporter.cpp index c45078d73..90aecce5f 100644 --- a/lib/Model/Importer/Binary/MachOImporter.cpp +++ b/lib/Model/Importer/Binary/MachOImporter.cpp @@ -12,7 +12,6 @@ #include "revng/Model/IRHelpers.h" #include "revng/Model/Importer/Binary/BinaryImporterHelper.h" #include "revng/Model/Importer/Binary/Options.h" -#include "revng/Model/Pass/PromoteOriginalName.h" #include "revng/Model/RawBinaryView.h" #include "revng/Support/Debug.h" #include "revng/Support/FunctionTags.h" @@ -298,7 +297,6 @@ Error MachOImporter::import() { if (TheError) revng_log(Log, "Error while decoding weakBindTable: " << TheError); - promoteOriginalName(Model); return Error::success(); } @@ -317,7 +315,7 @@ void MachOImporter::parseMachOSegment(ArrayRef RawDataRef, return; } - Segment.OriginalName() = SegmentCommand.segname; + Segment.Name() = SegmentCommand.segname; Segment.FileSize() = SegmentCommand.filesize; Segment.IsReadable() = SegmentCommand.initprot & VM_PROT_READ; diff --git a/lib/Model/Importer/Binary/PECOFFImporter.cpp b/lib/Model/Importer/Binary/PECOFFImporter.cpp index 581005d50..1399d83c7 100644 --- a/lib/Model/Importer/Binary/PECOFFImporter.cpp +++ b/lib/Model/Importer/Binary/PECOFFImporter.cpp @@ -183,7 +183,7 @@ void PECOFFImporter::parseSymbols() { continue; if (auto *Function = registerFunctionEntry(Address)) - Function->OriginalName() = *MaybeName; + Function->Name() = *MaybeName; } } @@ -468,19 +468,18 @@ void PECOFFImporter::findMissingTypes(const ImporterOptions &Opts) { }; for (auto &Fn : Model->ImportedDynamicFunctions()) { - if (not Fn.Prototype().isEmpty() or Fn.OriginalName().size() == 0) + if (not Fn.Prototype().isEmpty() or Fn.Name().size() == 0) continue; - revng_log(Log, "Searching for prototype for " << Fn.OriginalName()); - if (auto Found = findPrototype(Fn.OriginalName(), ModelsOfLibraries)) { + revng_log(Log, "Searching for prototype for " << Fn.Name()); + if (auto Found = findPrototype(Fn.Name(), ModelsOfLibraries)) { revng_assert(!Found->ModuleName.empty()); revng_assert(Found->Prototype.verify(true)); model::UpcastableTypeDefinition SerializablePrototype = Found->Prototype; revng_log(Log, - "Found type for " << Fn.OriginalName() << " in " - << Found->ModuleName << ": " - << toString(SerializablePrototype)); + "Found type for " << Fn.Name() << " in " << Found->ModuleName + << ": " << toString(SerializablePrototype)); TypeCopier &TheTypeCopier = GetOrMakeACopier(Found->ModuleName); Fn.Prototype() = TheTypeCopier.copyTypeInto(Found->Prototype); @@ -500,7 +499,6 @@ void PECOFFImporter::findMissingTypes(const ImporterOptions &Opts) { Model.initializeReferences(); deduplicateEquivalentTypes(Model); - promoteOriginalName(Model); } Error PECOFFImporter::import(const ImporterOptions &Options) { @@ -540,7 +538,6 @@ Error PECOFFImporter::import(const ImporterOptions &Options) { findMissingTypes(Options); } - model::promoteOriginalName(Model); return Error::success(); } diff --git a/lib/Model/Importer/Binary/SegmentImportHelpers.h b/lib/Model/Importer/Binary/SegmentImportHelpers.h index 632de302d..12f569dea 100644 --- a/lib/Model/Importer/Binary/SegmentImportHelpers.h +++ b/lib/Model/Importer/Binary/SegmentImportHelpers.h @@ -60,7 +60,7 @@ inline void importSymbolsInto(model::Binary &Binary, model::StructField &Field = Struct.addField(*Offset, {}); Field.Offset() = *Offset; - Field.OriginalName() = SymbolName.str(); + Field.Name() = SymbolName.str(); if (SymbolSize == 1 || SymbolSize == 2 || SymbolSize == 4 || SymbolSize == 8) { Field.Type() = model::PrimitiveType::makeGeneric(SymbolSize); @@ -115,7 +115,7 @@ populateSegmentTypeStruct(model::Binary &Binary, // Insert the field the segment struct auto &SectionField = SegmentStruct.addField(*Offset, std::move(Type)); - SectionField.OriginalName() = Section.Name; + SectionField.Name() = Section.Name; } // Pour the remaining symbols into the segment struct diff --git a/lib/Model/Importer/DebugInfo/DwarfImporter.cpp b/lib/Model/Importer/DebugInfo/DwarfImporter.cpp index 2e6236d82..406579c26 100644 --- a/lib/Model/Importer/DebugInfo/DwarfImporter.cpp +++ b/lib/Model/Importer/DebugInfo/DwarfImporter.cpp @@ -490,7 +490,7 @@ private: switch (Tag) { case llvm::dwarf::DW_TAG_subroutine_type: { auto &FunctionType = cast(Definition); - FunctionType.OriginalName() = Name; + FunctionType.Name() = Name; FunctionType.ABI() = getABI(); if (FunctionType.ABI() == model::ABI::Invalid) { @@ -524,7 +524,7 @@ private: case llvm::dwarf::DW_TAG_restrict_type: case llvm::dwarf::DW_TAG_volatile_type: { auto &Typedef = cast(Definition); - Typedef.OriginalName() = Name; + Typedef.Name() = Name; Typedef.UnderlyingType() = rc_recur makeTypeOrVoid(Die); } break; @@ -538,7 +538,7 @@ private: } auto &Struct = cast(Definition); - Struct.OriginalName() = Name; + Struct.Name() = Name; Struct.Size() = *MaybeSize->getAsUnsignedConstant(); uint64_t Index = 0; @@ -570,7 +570,7 @@ private: // Create new field auto &Field = Struct.Fields()[Offset]; - Field.OriginalName() = getName(ChildDie); + Field.Name() = getName(ChildDie); Field.Type() = std::move(MemberType); ++Index; @@ -586,7 +586,7 @@ private: case llvm::dwarf::DW_TAG_union_type: { auto &Union = cast(Definition); - Union.OriginalName() = Name; + Union.Name() = Name; for (const DWARFDie &ChildDie : Die.children()) { if (ChildDie.getTag() == DW_TAG_member) { @@ -600,7 +600,7 @@ private: // Create new field auto &Field = Union.addField(std::move(MemberType)); - Field.OriginalName() = getName(ChildDie); + Field.Name() = getName(ChildDie); } } @@ -613,7 +613,7 @@ private: case llvm::dwarf::DW_TAG_enumeration_type: { auto &Enum = llvm::cast(Definition); - Enum.OriginalName() = Name; + Enum.Name() = Name; const model::UpcastableType UnderlyingType = rc_recur makeType(Die); if (UnderlyingType.isEmpty()) { @@ -641,11 +641,11 @@ private: // Create new entry std::string EntryName = getName(ChildDie); - // If it's the first time, set OriginalName + // If it's the first time, set the name auto *It = Enum.Entries().tryGet(Value); if (It == nullptr) { auto &Entry = Enum.Entries()[Value]; - Entry.OriginalName() = EntryName; + Entry.Name() = EntryName; } else { // Ignore aliases } @@ -825,7 +825,7 @@ private: // Note: at this stage we don't check the size. If an argument is // unsized, the function will be purged later on. model::Argument &A = FunctionType.addArgument(std::move(ArgumentType)); - A.OriginalName() = getName(ChildDie); + A.Name() = getName(ChildDie); } } @@ -870,8 +870,8 @@ private: if (SymbolName.size() != 0) { Function->ExportedNames().insert(SymbolName); - if (Function->OriginalName().size() == 0) - Function->OriginalName() = SymbolName; + if (Function->Name().size() == 0) + Function->Name() = SymbolName; } if (isNoReturn(*CU.get(), Die)) @@ -937,8 +937,6 @@ public: purgeInvalidTypes(Model); T.advance("Deduplicate equivalent types", true); deduplicateEquivalentTypes(Model); - T.advance("Promote OriginalName", true); - promoteOriginalName(Model); T.advance("Purge unnamed unreachable types", true); purgeUnnamedAndUnreachableTypes(Model); T.advance("Verify the model", true); @@ -1373,8 +1371,8 @@ inline void detectAliases(const llvm::object::ObjectFile &ELF, std::unordered_map FunctionsByName; // Map functions by names, so we have faster lookup below. for (auto &Function : Functions) { - if (Function.OriginalName().size()) { - FunctionsByName[Function.OriginalName()] = &Function; + if (Function.Name().size()) { + FunctionsByName[Function.Name()] = &Function; } } @@ -1417,7 +1415,7 @@ inline void detectAliases(const llvm::object::ObjectFile &ELF, PotentialExportedNamesToBeAdded.push_back(Name); if (It != FunctionsByName.end()) { // We found a local function. - // TODO: In some situations OriginalName is not in the ExportedNames? + // TODO: In some situations Name is not in the ExportedNames? // For example in the case of importing `__libc_calloc` from // libc.so.6. TheFunction = It->second; diff --git a/lib/Model/Importer/DebugInfo/PDBImporter.cpp b/lib/Model/Importer/DebugInfo/PDBImporter.cpp index 4553ad331..e99c031e7 100644 --- a/lib/Model/Importer/DebugInfo/PDBImporter.cpp +++ b/lib/Model/Importer/DebugInfo/PDBImporter.cpp @@ -289,7 +289,6 @@ void PDBImporterImpl::run(NativeSession &Session) { TupleTree &Model = Importer.getModel(); deduplicateEquivalentTypes(Model); - promoteOriginalName(Model); purgeUnreachableTypes(Model); revng_assert(Model->verify(true)); } @@ -670,12 +669,12 @@ Error PDBImporterTypeVisitor::visitKnownRecord(CVType &Record, // an incomplete struct type. model::UpcastableType Void = model::PrimitiveType::makeVoid(); auto &&[Typedef, NewType] = Model->makeTypedefDefinition(std::move(Void)); - Typedef.OriginalName() = Class.getName(); + Typedef.Name() = Class.getName(); ProcessedTypes[CurrentTypeIndex] = std::move(NewType); } else { // Pre-create the type that is being referenced by this type. auto &&[Struct, NewType] = Model->makeStructDefinition(); - Struct.OriginalName() = Class.getName(); + Struct.Name() = Class.getName(); Struct.Size() = ForwardTypeSize; ProcessedTypes[CurrentTypeIndex] = std::move(NewType); } @@ -689,7 +688,7 @@ Error PDBImporterTypeVisitor::visitKnownRecord(CVType &Record, model::StructDefinition *Struct = nullptr; auto NewDefinition = makeTypeDefinition(); if (not WasReferenced) { - NewDefinition->OriginalName() = Class.getName(); + NewDefinition->Name() = Class.getName(); auto &NewStruct = llvm::cast(*NewDefinition); NewStruct.Size() = Class.getSize(); Struct = &NewStruct; @@ -743,7 +742,7 @@ Error PDBImporterTypeVisitor::visitKnownRecord(CVType &Record, } auto &FieldType = Struct->Fields()[Offset]; - FieldType.OriginalName() = Field.getName().str(); + FieldType.Name() = Field.getName().str(); FieldType.Type() = std::move(FieldModelType); } } @@ -844,7 +843,7 @@ Error PDBImporterTypeVisitor::visitKnownRecord(CVType &Record, TypeIndex FieldsTypeIndex = Enum.getFieldList(); auto NewDefinition = model::makeTypeDefinition(); auto &NewEnum = *cast(NewDefinition.get()); - NewEnum.OriginalName() = Enum.getName(); + NewEnum.Name() = Enum.getName(); TypeIndex UnderlyingTypeIndex = Enum.getUnderlyingType(); auto UnderlyingModelType = makeModelTypeForIndex(UnderlyingTypeIndex); @@ -863,7 +862,7 @@ Error PDBImporterTypeVisitor::visitKnownRecord(CVType &Record, for (const auto &Entry : TheFields) { auto &EnumEntry = NewEnum.Entries()[Entry.getValue().getExtValue()]; - EnumEntry.OriginalName() = Entry.getName().str(); + EnumEntry.Name() = Entry.getName().str(); } auto &&[_, NewType] = Model->recordNewType(std::move(NewDefinition)); @@ -1001,7 +1000,7 @@ Error PDBImporterTypeVisitor::visitKnownRecord(CVType &Record, // Typedef it to void. model::UpcastableType Void = model::PrimitiveType::makeVoid(); auto &&[Typedef, NewType] = Model->makeTypedefDefinition(std::move(Void)); - Typedef.OriginalName() = Union.getName().str(); + Typedef.Name() = Union.getName().str(); ProcessedTypes[CurrentTypeIndex] = std::move(NewType); return Error::success(); @@ -1009,7 +1008,7 @@ Error PDBImporterTypeVisitor::visitKnownRecord(CVType &Record, auto NewDefinition = model::makeTypeDefinition(); auto &NewUnion = llvm::cast(*NewDefinition.get()); - NewUnion.OriginalName() = Union.getName().str(); + NewUnion.Name() = Union.getName().str(); bool GeneratedAtLeastOneField = false; for (const auto &Field : TheFields) { @@ -1030,7 +1029,7 @@ Error PDBImporterTypeVisitor::visitKnownRecord(CVType &Record, GeneratedAtLeastOneField = true; auto &FieldType = NewUnion.addField(std::move(FieldModelType)); - FieldType.OriginalName() = Field.getName().str(); + FieldType.Name() = Field.getName().str(); } } @@ -1314,7 +1313,7 @@ Error PDBImporterSymbolVisitor::visitKnownRecord(CVSymbol &Record, if (not Model->Functions().contains(FunctionAddress)) { if (auto *Function = Helper.registerFunctionEntry(FunctionAddress)) { - Function->OriginalName() = Proc.Name; + Function->Name() = Proc.Name; TypeIndex FunctionTypeIndex = Proc.FunctionType; if (ProcessedTypes.find(FunctionTypeIndex) != ProcessedTypes.end()) Function->Prototype() = ProcessedTypes[FunctionTypeIndex]; diff --git a/lib/Model/Importer/WellKnownModels.cpp b/lib/Model/Importer/WellKnownModels.cpp index e21e33e0a..b833a37fa 100644 --- a/lib/Model/Importer/WellKnownModels.cpp +++ b/lib/Model/Importer/WellKnownModels.cpp @@ -81,7 +81,7 @@ public: // Compose the key WellKnownFunctionKey Key = { Model->Architecture(), Model->DefaultABI(), - F.OriginalName() }; + F.Name() }; // See if it's a well-known function auto It = WellKnownFunctions.find(Key); diff --git a/lib/Model/NamespaceBuilder.h b/lib/Model/NamespaceBuilder.h index 448a743c9..3b50396ab 100644 --- a/lib/Model/NamespaceBuilder.h +++ b/lib/Model/NamespaceBuilder.h @@ -26,7 +26,7 @@ using ConstIf = std::conditional_t; template struct NamespaceEntry { - using StoredNameType = ConstIf; + using StoredNameType = ConstIf; StoredNameType *Name; @@ -56,9 +56,8 @@ collectNamespaces(BinaryType &Binary) { Namespaces> Result; for (ConstOrNot auto &F : Binary.ImportedDynamicFunctions()) - if (not F.CustomName().empty()) - Result.Global[F.CustomName()].emplace_back(F.CustomName(), - detail::path(F)); + if (not F.Name().empty()) + Result.Global[F.Name()].emplace_back(F.Name(), detail::path(F)); // Dynamic functions are a bit special in that we cannot afford to change // their names no matter what. As such, if we run into any dynamic function @@ -81,26 +80,22 @@ collectNamespaces(BinaryType &Binary) { } for (ConstOrNot auto &F : Binary.Functions()) - if (not F.CustomName().empty()) - Result.Global[F.CustomName()].emplace_back(F.CustomName(), - detail::path(F)); + if (not F.Name().empty()) + Result.Global[F.Name()].emplace_back(F.Name(), detail::path(F)); for (ConstOrNot auto &S : Binary.Segments()) - if (not S.CustomName().empty()) - Result.Global[S.CustomName()].emplace_back(S.CustomName(), - detail::path(S)); + if (not S.Name().empty()) + Result.Global[S.Name()].emplace_back(S.Name(), detail::path(S)); for (auto &Def : Binary.TypeDefinitions()) { - if (not Def->CustomName().empty()) - Result.Global[Def->CustomName()].emplace_back(Def->CustomName(), - detail::path(*Def)); + if (not Def->Name().empty()) + Result.Global[Def->Name()].emplace_back(Def->Name(), detail::path(*Def)); if (auto *Enum = llvm::dyn_cast(Def.get())) for (auto &Entry : Enum->Entries()) - if (not Entry.CustomName().empty()) - Result.Global[Entry.CustomName()].emplace_back(Entry.CustomName(), - detail::path(*Enum, - Entry)); + if (not Entry.Name().empty()) + Result.Global[Entry.Name()].emplace_back(Entry.Name(), + detail::path(*Enum, Entry)); } for (auto &Definition : Binary.TypeDefinitions()) { @@ -114,41 +109,38 @@ collectNamespaces(BinaryType &Binary) { } else if (auto *RFT = llvm::dyn_cast(D)) { auto &Arguments = Result.Local.emplace_back(); for (auto &Argument : RFT->Arguments()) - if (not Argument.CustomName().empty()) - Arguments[Argument.CustomName()].emplace_back(Argument.CustomName(), - detail::path(*RFT, - Argument)); + if (not Argument.Name().empty()) + Arguments[Argument.Name()].emplace_back(Argument.Name(), + detail::path(*RFT, Argument)); auto &RVs = Result.Local.emplace_back(); for (auto &ReturnValue : RFT->ReturnValues()) - if (not ReturnValue.CustomName().empty()) - RVs[ReturnValue.CustomName()].emplace_back(ReturnValue.CustomName(), - detail::path(*RFT, - ReturnValue)); + if (not ReturnValue.Name().empty()) + RVs[ReturnValue.Name()].emplace_back(ReturnValue.Name(), + detail::path(*RFT, ReturnValue)); } else if (auto *CFT = llvm::dyn_cast(D)) { auto &Arguments = Result.Local.emplace_back(); for (auto &Argument : CFT->Arguments()) - if (not Argument.CustomName().empty()) - Arguments[Argument.CustomName()].emplace_back(Argument.CustomName(), - detail::path(*CFT, - Argument)); + if (not Argument.Name().empty()) + Arguments[Argument.Name()].emplace_back(Argument.Name(), + detail::path(*CFT, Argument)); // TODO: don't forget about local variables once those are in the model. } else if (auto *S = llvm::dyn_cast(D)) { auto &Fields = Result.Local.emplace_back(); for (auto &Field : S->Fields()) - if (not Field.CustomName().empty()) - Fields[Field.CustomName()].emplace_back(Field.CustomName(), - detail::path(*S, Field)); + if (not Field.Name().empty()) + Fields[Field.Name()].emplace_back(Field.Name(), + detail::path(*S, Field)); } else if (auto *U = llvm::dyn_cast(D)) { auto &Fields = Result.Local.emplace_back(); for (auto &Field : U->Fields()) - if (not Field.CustomName().empty()) - Fields[Field.CustomName()].emplace_back(Field.CustomName(), - detail::path(*U, Field)); + if (not Field.Name().empty()) + Fields[Field.Name()].emplace_back(Field.Name(), + detail::path(*U, Field)); } else { revng_abort("Unsupported type definition kind."); diff --git a/lib/Model/Pass/CMakeLists.txt b/lib/Model/Pass/CMakeLists.txt index b470bb0e2..992d89086 100644 --- a/lib/Model/Pass/CMakeLists.txt +++ b/lib/Model/Pass/CMakeLists.txt @@ -3,12 +3,7 @@ # revng_add_library_internal( - revngModelPasses - SHARED - DeduplicateEquivalentTypes.cpp - OptionCategory.cpp - PromoteOriginalName.cpp - PurgeUnnamedAndUnreachableTypes.cpp - Verify.cpp) + revngModelPasses SHARED DeduplicateEquivalentTypes.cpp OptionCategory.cpp + PurgeUnnamedAndUnreachableTypes.cpp Verify.cpp) target_link_libraries(revngModelPasses revngModel revngPipes) diff --git a/lib/Model/Pass/DeduplicateEquivalentTypes.cpp b/lib/Model/Pass/DeduplicateEquivalentTypes.cpp index c7e93abcd..0af290f16 100644 --- a/lib/Model/Pass/DeduplicateEquivalentTypes.cpp +++ b/lib/Model/Pass/DeduplicateEquivalentTypes.cpp @@ -79,7 +79,7 @@ private: LoggerIndent Indent(Log); auto ComputeKey = [](model::TypeDefinition *T) { - return std::pair{ T->OriginalName(), T->Kind() }; + return std::pair{ T->Name(), T->Kind() }; }; // Sort types by the key (the name) @@ -189,10 +189,10 @@ private: LoggerIndent Indent(Log); for (model::TypeDefinition *Leader : VisitOrder) { - revng_log(Log, "Considering " << Leader->OriginalName()); + revng_log(Log, "Considering " << Leader->Name()); LoggerIndent Indent2(Log); - revng_assert(not Leader->OriginalName().empty()); + revng_assert(not Leader->Name().empty()); auto LeaderIt = WeakEquivalence.findValue(Leader); revng_assert(LeaderIt->isLeader()); @@ -321,8 +321,7 @@ private: Visited.insert(Left); return true; } else if (WeakEquivalence.isEquivalent(Right->T, Left->T) - or (Left->T->OriginalName().empty() - and Right->T->OriginalName().empty() + or (Left->T->Name().empty() and Right->T->Name().empty() and Left->T->localCompare(*Right->T))) { // Weak equivalence return true; diff --git a/lib/Model/Pass/PromoteOriginalName.cpp b/lib/Model/Pass/PromoteOriginalName.cpp deleted file mode 100644 index a201f0f7b..000000000 --- a/lib/Model/Pass/PromoteOriginalName.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/// \file PromoteOriginalName.cpp - -// -// This file is distributed under the MIT License. See LICENSE.md for details. -// - -#include -#include - -#include "revng/Model/Pass/PromoteOriginalName.h" -#include "revng/Model/Pass/RegisterModelPass.h" - -using namespace llvm; -using namespace model; - -static RegisterModelPass R("promote-original-name", - "Promote OriginalName fields to CustomName ensuring " - "the validity of the model is preserved", - model::promoteOriginalName); - -class SymbolPromoter { -private: - std::set GlobalSymbols; - std::set TakenLocalSymbols; - -public: - void dump() const debug_function { - for (const Identifier &ID : GlobalSymbols) - dbg << ID.str().str() << "\n"; - } - -public: - void recordGlobalSymbols(auto &Collection, auto Unwrap) { - for (auto &Entry2 : Collection) { - auto *Entry = Unwrap(Entry2); - if (not Entry->CustomName().empty()) { - GlobalSymbols.insert(Entry->CustomName()); - } - } - } - - void recordLocalSymbols(auto &Collection, auto Unwrap) { - for (auto &Entry2 : Collection) { - auto *Entry = Unwrap(Entry2); - if (not Entry->CustomName().empty()) { - TakenLocalSymbols.insert(Entry->CustomName()); - } - } - } - - void promoteGlobalSymbols(auto &Collection, auto Unwrap) { - promoteSymbolsImpl(Collection, Unwrap, GlobalSymbols, TakenLocalSymbols); - } - - void promoteLocalSymbols(auto &Collection, auto Unwrap) { - std::set LocalBucket; - promoteSymbolsImpl(Collection, Unwrap, LocalBucket, GlobalSymbols); - } - -private: - void promoteSymbolsImpl(auto &Collection, - auto Unwrap, - std::set &Namespace, - const std::set &Taken) { - // TODO: collapse uint8_t typedefs into the primitive type - for (auto &Wrapped : Collection) { - auto *Entry = Unwrap(Wrapped); - if (Entry->CustomName().empty() and not Entry->OriginalName().empty()) { - // We have an OriginalName but not CustomName - auto Name = Identifier::fromString(Entry->OriginalName()); - - while (Taken.contains(Name) or Namespace.contains(Name)) - Name += "_"; - - // Assign name - Entry->CustomName() = Name; - - // Record new name as taken in the current namespace - auto &&[_, Inserted] = Namespace.insert(Name); - revng_assert(Inserted); - } - } - } -}; - -/// Promote OriginalNames to CustomNames -void model::promoteOriginalName(TupleTree &Model) { - auto AddressOf = [](auto &Entry) { return &Entry; }; - auto Unwrap = [](auto &UC) { return UC.get(); }; - - SymbolPromoter Promoter; - - // Reserve symbols we can't use both for local symbols and global symbols - Promoter.recordGlobalSymbols(Model->Functions(), AddressOf); - Promoter.recordGlobalSymbols(Model->ImportedDynamicFunctions(), AddressOf); - Promoter.recordGlobalSymbols(Model->TypeDefinitions(), Unwrap); - for (auto &UP : Model->TypeDefinitions()) - if (auto *Enum = dyn_cast(UP.get())) - Promoter.recordGlobalSymbols(Enum->Entries(), AddressOf); - - Promoter.recordGlobalSymbols(Model->Segments(), AddressOf); - - // Reserve symbols we can't use for global symbols - for (auto &UP : Model->TypeDefinitions()) { - if (auto *Struct = dyn_cast(UP.get())) - Promoter.recordLocalSymbols(Struct->Fields(), AddressOf); - else if (auto *Union = dyn_cast(UP.get())) - Promoter.recordLocalSymbols(Union->Fields(), AddressOf); - else if (auto *CFT = dyn_cast(UP.get())) - Promoter.recordLocalSymbols(CFT->Arguments(), AddressOf); - else if (auto *RFT = dyn_cast(UP.get())) - Promoter.recordLocalSymbols(RFT->Arguments(), AddressOf); - } - - // Promote global symbols - Promoter.promoteGlobalSymbols(Model->Functions(), AddressOf); - Promoter.promoteGlobalSymbols(Model->ImportedDynamicFunctions(), AddressOf); - Promoter.promoteGlobalSymbols(Model->TypeDefinitions(), Unwrap); - for (auto &UP : Model->TypeDefinitions()) - if (auto *Enum = dyn_cast(UP.get())) - Promoter.promoteGlobalSymbols(Enum->Entries(), AddressOf); - - Promoter.promoteGlobalSymbols(Model->Segments(), AddressOf); - - // Promote local symbols - for (auto &UP : Model->TypeDefinitions()) { - if (auto *Struct = dyn_cast(UP.get())) - Promoter.promoteLocalSymbols(Struct->Fields(), AddressOf); - else if (auto *Union = dyn_cast(UP.get())) - Promoter.promoteLocalSymbols(Union->Fields(), AddressOf); - else if (auto *CFT = dyn_cast(UP.get())) - Promoter.promoteLocalSymbols(CFT->Arguments(), AddressOf); - else if (auto *RFT = dyn_cast(UP.get())) - Promoter.promoteLocalSymbols(RFT->Arguments(), AddressOf); - } -} diff --git a/lib/Model/Pass/PurgeUnnamedAndUnreachableTypes.cpp b/lib/Model/Pass/PurgeUnnamedAndUnreachableTypes.cpp index 3185730c9..fd8669c47 100644 --- a/lib/Model/Pass/PurgeUnnamedAndUnreachableTypes.cpp +++ b/lib/Model/Pass/PurgeUnnamedAndUnreachableTypes.cpp @@ -153,7 +153,7 @@ static void model::purgeTypesImpl(TupleTree &Model, // Remember those types we want to preserve. for (const model::UpcastableTypeDefinition &T : Model->TypeDefinitions()) { if (KeepTypesWithName) - if (not T->CustomName().empty() or not T->OriginalName().empty()) + if (not T->Name().empty()) ToKeep.insert(T.get()); TypeToNode[T.get()] = TypeGraph.addNode(NodeData{ T.get() }); diff --git a/lib/Model/Verification.cpp b/lib/Model/Verification.cpp index 10a9c3804..23cb72188 100644 --- a/lib/Model/Verification.cpp +++ b/lib/Model/Verification.cpp @@ -173,11 +173,11 @@ bool DynamicFunction::verify(VerifyHelper &VH) const { auto Guard = VH.suspendTracking(*this); // Ensure we have a name - if (OriginalName().size() == 0) - return VH.fail("Dynamic functions must have an OriginalName.", *this); + if (Name().size() == 0) + return VH.fail("Dynamic functions must have a name.", *this); - if (OriginalName().find('/') != std::string::npos) - return VH.fail("Dynamic function names must not contain '/'.", *this); + if (not VH.isNameAllowed(Name())) + return VH.fail(); if (not Prototype().isEmpty()) { if (not Prototype()->isPrototype()) @@ -314,12 +314,12 @@ RecursiveCoroutine model::Type::verify(VerifyHelper &VH) const { bool EnumEntry::verify(VerifyHelper &VH) const { auto Guard = VH.suspendTracking(*this); - return VH.maybeFail(CustomName().verify(VH)); + return VH.isNameAllowed(Name()); } static RecursiveCoroutine verifyImpl(VerifyHelper &VH, const EnumDefinition &T) { - if (T.Entries().empty() or not T.CustomName().verify(VH)) + if (T.Entries().empty() or not VH.isNameAllowed(T.Name())) rc_return VH.fail(); if (T.UnderlyingType().isEmpty()) @@ -348,7 +348,7 @@ static RecursiveCoroutine verifyImpl(VerifyHelper &VH, static RecursiveCoroutine verifyImpl(VerifyHelper &VH, const TypedefDefinition &T) { - rc_return VH.maybeFail(T.CustomName().verify(VH) + rc_return VH.maybeFail(VH.isNameAllowed(T.Name()) and T.Kind() == TypeDefinitionKind::TypedefDefinition and not T.UnderlyingType().isEmpty() and rc_recur T.UnderlyingType()->verify(VH)); @@ -368,7 +368,7 @@ RecursiveCoroutine StructField::verify(VerifyHelper &VH) const { if (not MaybeSize) rc_return VH.fail("Struct field is zero-sized", Type()); - rc_return VH.maybeFail(CustomName().verify(VH)); + rc_return VH.isNameAllowed(Name()); } static RecursiveCoroutine verifyImpl(VerifyHelper &VH, @@ -378,8 +378,8 @@ static RecursiveCoroutine verifyImpl(VerifyHelper &VH, revng_assert(T.Kind() == TypeDefinitionKind::StructDefinition); - if (not T.CustomName().verify(VH)) - rc_return VH.fail("Invalid name", T); + if (not VH.isNameAllowed(T.Name())) + rc_return VH.fail(); if (T.Size() == 0) rc_return VH.fail("Struct size must be greater than zero.", T); @@ -424,7 +424,7 @@ static RecursiveCoroutine verifyImpl(VerifyHelper &VH, rc_return VH.fail("Last field ends outside the struct", T); } - if (not VH.isNameAllowed(Field.CustomName())) + if (not VH.isNameAllowed(Field.Name())) rc_return VH.fail(); } @@ -445,15 +445,15 @@ RecursiveCoroutine UnionField::verify(VerifyHelper &VH) const { if (not MaybeSize) rc_return VH.fail("Union field is zero-sized", Type()); - rc_return VH.maybeFail(CustomName().verify(VH)); + rc_return VH.isNameAllowed(Name()); } static RecursiveCoroutine verifyImpl(VerifyHelper &VH, const UnionDefinition &T) { revng_assert(T.Kind() == TypeDefinitionKind::UnionDefinition); - if (not T.CustomName().verify(VH)) - rc_return VH.fail("Invalid name", T); + if (not VH.isNameAllowed(T.Name())) + rc_return VH.fail(); if (T.Fields().empty()) rc_return VH.fail("Union must have at least one field.", T); @@ -472,7 +472,7 @@ static RecursiveCoroutine verifyImpl(VerifyHelper &VH, if (not rc_recur Field.verify(VH)) rc_return VH.fail(); - if (not VH.isNameAllowed(Field.CustomName())) + if (not VH.isNameAllowed(Field.Name())) rc_return VH.fail(); } @@ -480,8 +480,8 @@ static RecursiveCoroutine verifyImpl(VerifyHelper &VH, } RecursiveCoroutine Argument::verify(VerifyHelper &VH) const { - if (not CustomName().verify(VH)) - rc_return VH.fail("A function argument has invalid CustomName", *this); + if (not VH.isNameAllowed(Name())) + rc_return VH.fail(); if (Type().isEmpty()) rc_return VH.fail("A function argument must have a type", *this); @@ -497,7 +497,7 @@ RecursiveCoroutine Argument::verify(VerifyHelper &VH) const { static RecursiveCoroutine verifyImpl(VerifyHelper &VH, const CABIFunctionDefinition &T) { - if (not T.CustomName().verify(VH)) + if (not VH.isNameAllowed(T.Name())) rc_return VH.fail(); if (not T.ReturnType().isEmpty()) { @@ -527,7 +527,7 @@ static RecursiveCoroutine verifyImpl(VerifyHelper &VH, if (not rc_recur Argument.verify(VH)) rc_return VH.fail(); - if (not VH.isNameAllowed(Argument.CustomName())) + if (not VH.isNameAllowed(Argument.Name())) rc_return VH.fail(); } @@ -538,7 +538,7 @@ RecursiveCoroutine NamedTypedRegister::verify(VerifyHelper &VH) const { auto Guard = VH.suspendTracking(*this); // Ensure the name is valid - if (not CustomName().verify(VH)) + if (not VH.isNameAllowed(Name())) rc_return VH.fail(); if (Type().isEmpty()) @@ -584,7 +584,7 @@ static RecursiveCoroutine verifyImpl(VerifyHelper &VH, rc_return VH.fail(); if (not isUsedInArchitecture(Argument.Location(), Architecture)) rc_return VH.fail(); - if (not VH.isNameAllowed(Argument.CustomName())) + if (not VH.isNameAllowed(Argument.Name())) rc_return VH.fail(); } @@ -609,7 +609,7 @@ static RecursiveCoroutine verifyImpl(VerifyHelper &VH, and not rc_recur StackArgumentsType->verify(VH)) rc_return VH.fail(); - rc_return VH.maybeFail(T.CustomName().verify(VH)); + rc_return VH.isNameAllowed(T.Name()); } RecursiveCoroutine TypeDefinition::verify(VerifyHelper &VH) const { @@ -658,7 +658,6 @@ RecursiveCoroutine TypeDefinition::verify(VerifyHelper &VH) const { bool Binary::verifyTypeDefinitions(VerifyHelper &VH) const { auto Guard = VH.suspendTracking(*this); - std::set Names; for (const model::UpcastableTypeDefinition &Definition : TypeDefinitions()) { // All types on their own should verify if (not Definition.get()->verify(VH)) @@ -832,8 +831,8 @@ bool Binary::verify(VerifyHelper &VH) const { // Unlike all the other renamable objects, dynamic functions do not have // a possibility of falling back onto an automatic name. As such, we have to // be a lot stricter with what we allow as their names. - if (llvm::Error Error = NameBuilder.isNameReserved(DF.CustomName())) - return VH.fail("Dynamic function name (`" + DF.CustomName() + if (llvm::Error Error = NameBuilder.isNameReserved(DF.Name())) + return VH.fail("Dynamic function name (`" + DF.Name() + "`) is not valid because " + revng::unwrapError(std::move(Error))); } diff --git a/lib/TypeNames/LLVMTypeNames.cpp b/lib/TypeNames/LLVMTypeNames.cpp index 6bab691d1..a221b81f4 100644 --- a/lib/TypeNames/LLVMTypeNames.cpp +++ b/lib/TypeNames/LLVMTypeNames.cpp @@ -10,7 +10,6 @@ #include "llvm/IR/Type.h" #include "revng/Model/Binary.h" -#include "revng/Model/Identifier.h" #include "revng/Pipeline/Location.h" #include "revng/Pipes/Ranks.h" #include "revng/Support/Assert.h" @@ -121,15 +120,23 @@ std::string getScalarCType(const llvm::Type *LLVMType, const CBuilder &B) { } } -static std::string getHelperFunctionIdentifier(const llvm::Function *F) { +static std::string getHelperFunctionIdentifier(const llvm::Function *F, + const CTypeBuilder &B) { revng_assert(not FunctionTags::Isolated.isTagOf(F)); - return (Twine("_") + model::Identifier::sanitize(F->getName())).str(); + + auto ReplaceForbiddenCharacters = [](char Character) -> char { + return std::isalnum(Character) ? Character : '_'; + }; + return "_" + F->getName().str() + | std::views::transform(ReplaceForbiddenCharacters) + | revng::to(); } -static std::string getReturnedStructIdentifier(const llvm::Function *F) { +static std::string getReturnedStructIdentifier(const llvm::Function *F, + const CTypeBuilder &B) { revng_assert(not FunctionTags::Isolated.isTagOf(F)); revng_assert(llvm::isa(F->getReturnType())); - return (Twine(StructWrapperPrefix) + Twine(getHelperFunctionIdentifier(F))) + return (Twine(StructWrapperPrefix) + Twine(getHelperFunctionIdentifier(F, B))) .str(); } @@ -145,7 +152,7 @@ getReturnTypeLocation(const llvm::Function *F, const CTypeBuilder &B) { revng_assert(not FunctionTags::Isolated.isTagOf(F)); if (RetType->isAggregateType()) { - std::string StructName = getReturnedStructIdentifier(F); + std::string StructName = getReturnedStructIdentifier(F, B); return B.tokenTag(StructName, ptml::c::tokens::Type) .addAttribute(B.getLocationAttribute(IsDefinition), serializeHelperStructLocation(StructName)) @@ -189,7 +196,7 @@ static std::string getReturnStructFieldLocation(const llvm::Function *F, revng_assert(not FunctionTags::Isolated.isTagOf(F)); revng_assert(F->getReturnType()->isStructTy()); - std::string StructName = getReturnedStructIdentifier(F); + std::string StructName = getReturnedStructIdentifier(F, B); std::string FieldName = (Twine(StructFieldPrefix) + Twine(Index)).str(); return B.getTag(ptml::tags::Span, FieldName) .addAttribute(attributes::Token, tokens::Field) @@ -218,7 +225,8 @@ static std::string serializeHelperFunctionLocation(const llvm::Function *F) { template static std::string getHelperFunctionLocation(const llvm::Function *F, const CTypeBuilder &B) { - return B.tokenTag(getHelperFunctionIdentifier(F), ptml::c::tokens::Function) + return B + .tokenTag(getHelperFunctionIdentifier(F, B), ptml::c::tokens::Function) .addAttribute(B.getLocationAttribute(IsDefinition), serializeHelperFunctionLocation(F)) .toString(); diff --git a/lib/TypeNames/ModelTypeNames.cpp b/lib/TypeNames/ModelTypeNames.cpp index 087ac1a1e..238c18b26 100644 --- a/lib/TypeNames/ModelTypeNames.cpp +++ b/lib/TypeNames/ModelTypeNames.cpp @@ -18,7 +18,6 @@ #include "revng/Model/CABIFunctionDefinition.h" #include "revng/Model/FunctionAttribute.h" #include "revng/Model/Helpers.h" -#include "revng/Model/Identifier.h" #include "revng/Model/RawFunctionDefinition.h" #include "revng/PTML/Constants.h" #include "revng/PTML/Tag.h" diff --git a/python/revng/internal/cli/_commands/hard_purge.py b/python/revng/internal/cli/_commands/hard_purge.py index 2b4094f6a..d41ca8fc3 100644 --- a/python/revng/internal/cli/_commands/hard_purge.py +++ b/python/revng/internal/cli/_commands/hard_purge.py @@ -56,13 +56,13 @@ class HardPurgeCommand(Command): if "Functions" in reference_model: for function in reference_model["Functions"]: - function_name = function["OriginalName"] + function_name = function["Name"] self.log(" Function to be preserved: " + function_name) functions_to_preserve.add(function_name) if "ImportedDynamicFunctions" in reference_model: for dynamic_function in reference_model["ImportedDynamicFunctions"]: - function_name = dynamic_function["OriginalName"] + function_name = dynamic_function["Name"] self.log(" Dynamic function to be preserved: " + function_name) functions_to_preserve.add(function_name) @@ -74,16 +74,14 @@ class HardPurgeCommand(Command): # Delete functions. patched_model["Functions"] = [ - f - for f in patched_model["Functions"] - if f.get("OriginalName", "") in functions_to_preserve + f for f in patched_model["Functions"] if f.get("Name", "") in functions_to_preserve ] # Delete dynamic functions. patched_model["ImportedDynamicFunctions"] = [ f for f in patched_model["ImportedDynamicFunctions"] - if f["OriginalName"] in functions_to_preserve + if f["Name"] in functions_to_preserve ] temporary_file = temporary_file_gen("revng-hard-purge-", options) diff --git a/python/revng/internal/cli/_commands/idb_converter.py b/python/revng/internal/cli/_commands/idb_converter.py index 965770bd1..9c40128b2 100644 --- a/python/revng/internal/cli/_commands/idb_converter.py +++ b/python/revng/internal/cli/_commands/idb_converter.py @@ -140,7 +140,7 @@ class IDBConverter: if idb_function_type is not None: prototype = self._convert_idb_type_to_revng_type(idb_function_type) revng_function = m.Function( - OriginalName=function_name, + Name=function_name, Entry=m.MetaAddress(Address=function_start_addr, Type=metaaddr_type), Attributes=function_attributes, Prototype=prototype, @@ -148,7 +148,7 @@ class IDBConverter: else: self.log(f"warning: Function {function_name} without a signature.") revng_function = m.Function( - OriginalName=function_name, + Name=function_name, Entry=m.MetaAddress(Address=function_start_addr, Type=metaaddr_type), Attributes=function_attributes, ) @@ -196,7 +196,7 @@ class IDBConverter: self.revng_types_by_id[prototype_definition.ID] = prototype_definition prototype = self._type_for_definition(prototype_definition) dynamic_function = m.DynamicFunction( - OriginalName=function_name, + Name=function_name, Prototype=prototype, ) self.dynamic_functions.append(dynamic_function) @@ -246,7 +246,7 @@ class IDBConverter: ) placeholder_definition.Fields = real_definition.Fields - placeholder_definition.OriginalName = real_definition.OriginalName + placeholder_definition.Name = real_definition.Name placeholder_definition.Size = real_definition.Size def _fixup_structs(self): @@ -265,15 +265,14 @@ class IDBConverter: for member in idb_type.type_details.members: if member.type.is_decl_bitfield(): self.log( - f"warning: Ignoring {revng_type.OriginalName} struct that contains a " - "bitfield." + f"warning: Ignoring {revng_type.Name} struct that contains a " "bitfield." ) return for member in idb_type.type_details.members: underlying_type = self._convert_idb_type_to_revng_type(member.type) revng_member = m.StructField( - OriginalName=member.name, + Name=member.name, Type=underlying_type, Offset=committed_size, ) @@ -281,7 +280,7 @@ class IDBConverter: if member_size == 0: self.log( f"warning: Dropping zero-sized field {member.name} of struct " - f"{revng_type.OriginalName}." + f"{revng_type.Name}." ) else: fields.append(revng_member) @@ -301,7 +300,7 @@ class IDBConverter: for idx, member in enumerate(idb_type.type_details.members): qualified_type = self._convert_idb_type_to_revng_type(member.type) revng_member = m.UnionField( - OriginalName=member.name, + Name=member.name, Type=qualified_type, Index=idx, ) @@ -348,9 +347,7 @@ class IDBConverter: aliased_type, ordinal=aliased_type_ordinal ) - resulting_definition = m.TypedefDefinition( - OriginalName=type_name, UnderlyingType=underlying - ) + resulting_definition = m.TypedefDefinition(Name=type_name, UnderlyingType=underlying) elif type.is_decl_enum(): underlying = m.PrimitiveType( @@ -366,7 +363,7 @@ class IDBConverter: continue # TODO: We should keep the user comment which might exist in member.cmt. enum_entry = m.EnumEntry( - OriginalName=member.name, + Name=member.name, Value=member.value, ) entries.append(enum_entry) @@ -374,11 +371,11 @@ class IDBConverter: if len(entries) == 0: self.log(f"warning: An empty enum type: {type_name}, emitting a typedef instead.") resulting_definition = m.TypedefDefinition( - OriginalName=type_name, UnderlyingType=underlying + Name=type_name, UnderlyingType=underlying ) else: resulting_definition = m.EnumDefinition( - OriginalName=type_name, + Name=type_name, Entries=entries, UnderlyingType=underlying, ) @@ -387,7 +384,7 @@ class IDBConverter: if type.type_details.ref is not None and type.type_details.ref.type_details.is_ordref: if type.type_details.ref.type_details.ordinal not in self.idb_types_to_revng_types: # This is just a forward declaration. Make a placeholder for now. - resulting_definition = m.StructDefinition(OriginalName="", Size=0, Fields=[]) + resulting_definition = m.StructDefinition(Name="", Size=0, Fields=[]) self.revng_types_by_id[resulting_definition.ID] = resulting_definition wrapped = self._type_for_definition(resulting_definition, type.is_decl_const()) @@ -404,23 +401,21 @@ class IDBConverter: if len(type.type_details.members) == 0: self.log(f"warning: Ignoring empty struct {type_name}, typedef it to `void`") typedef = m.TypedefDefinition( - OriginalName=type_name, + Name=type_name, UnderlyingType=m.PrimitiveType(m.PrimitiveKind.Void, 0), ) self.revng_types_by_id[typedef.ID] = typedef return self._type_for_definition(typedef, type.is_decl_const()) else: # Struct members and size will be computed later. - resulting_definition = m.StructDefinition( - OriginalName=type_name, Size=0, Fields=[] - ) + resulting_definition = m.StructDefinition(Name=type_name, Size=0, Fields=[]) self._structs_to_fixup.add((resulting_definition, type)) elif type.is_decl_union(): if type.type_details.ref is not None and type.type_details.ref.type_details.is_ordref: if type.type_details.ref.type_details.ordinal not in self.idb_types_to_revng_types: # This is just a forward declaration. Make a placeholder for now. - resulting_definition = m.UnionDefinition(OriginalName="", Fields=[]) + resulting_definition = m.UnionDefinition(Name="", Fields=[]) self.revng_types_by_id[resulting_definition.ID] = resulting_definition wrapped = self._type_for_definition(resulting_definition, type.is_decl_const()) @@ -436,14 +431,14 @@ class IDBConverter: if len(type.type_details.members) == 0: self.log(f"warning: Ignoring empty union {type_name}, typedef it to `void`") typedef = m.TypedefDefinition( - OriginalName=type_name, + Name=type_name, UnderlyingType=m.PrimitiveType(m.PrimitiveKind.Void, 0), ) self.revng_types_by_id[typedef.ID] = typedef return self._type_for_definition(typedef, type.is_decl_const()) else: # Union members will be computed later. - resulting_definition = m.UnionDefinition(OriginalName=type_name, Fields=[]) + resulting_definition = m.UnionDefinition(Name=type_name, Fields=[]) self._unions_to_fixup.add((resulting_definition, type)) elif type.is_decl_ptr(): @@ -501,7 +496,7 @@ class IDBConverter: if type.get_name() != "": # Treat this as `typedef void someothername`. result = m.TypedefDefinition( - OriginalName=type_name, UnderlyingType=result, IsConst=type.is_decl_const() + Name=type_name, UnderlyingType=result, IsConst=type.is_decl_const() ) if ordinal is not None: @@ -520,7 +515,7 @@ class IDBConverter: m.Argument( Index=idx, Type=self._convert_idb_type_to_revng_type(argument.type), - OriginalName=argument.name, + Name=argument.name, ) ) @@ -605,7 +600,7 @@ class IDBConverter: def get_revng_type_by_name(self, name): for revng_type in self.revng_types_by_id.values(): - if revng_type.OriginalName == name: + if revng_type.Name == name: return revng_type return None diff --git a/python/revng/internal/cli/_commands/model_compare.py b/python/revng/internal/cli/_commands/model_compare.py index a1be4b911..495a07595 100644 --- a/python/revng/internal/cli/_commands/model_compare.py +++ b/python/revng/internal/cli/_commands/model_compare.py @@ -245,19 +245,19 @@ class YAMLGraph: interestingness = defaultdict(lambda: 2) shortest_paths = dict(all_pairs_shortest_path_length(self.graph)) for node_id in self.graph: - # TODO: here we are hardcoding `CustomName`, we need to take + # TODO: here we are hardcoding the name, we need to take # the time to write a small function computing how # much disambiguation power a certain reference node # has based on how many compatible nodes are there in # the input graph, just looking at the semantic. has_customname = ( - isinstance(self.node_map[node_id], dict) and "CustomName" in self.node_map[node_id] + isinstance(self.node_map[node_id], dict) and "Name" in self.node_map[node_id] ) if self.graph.in_degree(node_id) == 0: # No incoming edges, it's the entry node interestingness[node_id] = 1 elif has_customname: - # Those with CustomName take priority + # Those with a name take priority interestingness[node_id] = 2 # Distribute points depending on the distance diff --git a/python/revng/internal/cli/_commands/override_by_name.py b/python/revng/internal/cli/_commands/override_by_name.py index 319d59902..a82a24f71 100644 --- a/python/revng/internal/cli/_commands/override_by_name.py +++ b/python/revng/internal/cli/_commands/override_by_name.py @@ -77,18 +77,18 @@ class ModelOverrideByName(Command): self.log("Loading the override model") override_model = yaml.load(override_file, Loader=yaml.SafeLoader) - self.log("Importing Entry and OriginalName") + self.log("Importing entry address and name") for function_to_override in override_model["Functions"]: - function_name = function_to_override["OriginalName"] + function_name = function_to_override["Name"] if not function_name: - self.log("A function is missing OriginalName") + self.log("A function is missing a name Name") return 1 for base_function in base_model["Functions"]: - if base_function["OriginalName"] == function_name: + if base_function["Name"] == function_name: function_to_override["Entry"] = base_function["Entry"] - function_to_override["CustomName"] = base_function["CustomName"] + function_to_override["Name"] = base_function["Name"] self.log("Saving patched override file") patched_file.write("---\n") diff --git a/share/doc/revng/user-manual/tutorial/model-from-scratch.md b/share/doc/revng/user-manual/tutorial/model-from-scratch.md index 22c7975ef..106ef9b9a 100644 --- a/share/doc/revng/user-manual/tutorial/model-from-scratch.md +++ b/share/doc/revng/user-manual/tutorial/model-from-scratch.md @@ -192,7 +192,7 @@ One of the main activities of a reverse engineer is giving things a name, just l Prototype: Kind: DefinedType Definition: "/TypeDefinitions/0-CABIFunctionDefinition" -+ CustomName: Sum ++ Name: Sum TypeDefinitions: - Kind: CABIFunctionDefinition ABI: SystemV_x86_64 @@ -213,13 +213,13 @@ Almost everything in the model can have a name. Let's add a name to the function Kind: PrimitiveType PrimitiveKind: Unsigned Size: 8 -+ CustomName: FirstAddend ++ Name: FirstAddend - Index: 1 Type: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 8 -+ CustomName: SecondAddend ++ Name: SecondAddend ReturnType: Kind: PrimitiveType PrimitiveKind: Unsigned diff --git a/share/revng/test/configuration/revng/for-collect-cfg.yml b/share/revng/test/configuration/revng/for-collect-cfg.yml index 72bb00ede..2c002f33f 100644 --- a/share/revng/test/configuration/revng/for-collect-cfg.yml +++ b/share/revng/test/configuration/revng/for-collect-cfg.yml @@ -25,7 +25,7 @@ commands: import yaml def should_keep(cfg): - if cfg.get("OriginalName", ""): + if cfg.get("Name", ""): return True for block in cfg["Blocks"]: diff --git a/share/revng/test/tests/abi/README.md b/share/revng/test/tests/abi/README.md index dbdfa39a5..4bdbc3f0c 100644 --- a/share/revng/test/tests/abi/README.md +++ b/share/revng/test/tests/abi/README.md @@ -129,4 +129,4 @@ This tool is used to compare `downgraded_reference_binary.yml` and `downgraded_u Sadly, there are cases where `revng model diff` is not good enough to verify that two instances of a model are the same. Mostly because it relies on the type IDs. So even if there are two identical types generated in different places (they have different IDs because of that), the diff detects these "changes" and fails the check. -To counteract that, use a `CustomName`-first approach. And since there are quirks, it's easier to provide specialized tool (namely `revng ensure-rft-equivalence`) which scouts two separate model files for the functions with a matching `CustomName` and then takes extra care comparing them semantically. +To counteract that, use a name-first approach. And since there are quirks, it's easier to provide specialized tool (namely `revng ensure-rft-equivalence`) which scouts two separate model files for the functions with a matching names and then takes extra care comparing them semantically. diff --git a/share/revng/test/tests/abi/end_to_end.md b/share/revng/test/tests/abi/end_to_end.md index 4a7a76f46..761e44d32 100644 --- a/share/revng/test/tests/abi/end_to_end.md +++ b/share/revng/test/tests/abi/end_to_end.md @@ -115,25 +115,21 @@ For our `test_args`, the prototype looks like - Index: 0 Type: UnqualifiedType: "/TypeDefinitions/2-StructDefinition" - CustomName: "argument_0" - OriginalName: argument_0 + Name: argument_0 - Index: 1 Type: UnqualifiedType: "/TypeDefinitions/3-StructDefinition" - CustomName: "argument_1" - OriginalName: argument_1 + Name: argument_1 - ID: 2 Kind: StructDefinition Size: 4 Fields: - Offset: 0 - CustomName: "a" - OriginalName: a + Name: a Type: UnqualifiedType: "/TypeDefinitions/1282-PrimitiveDefinition" - Offset: 2 - CustomName: "b" - OriginalName: b + Name: b Type: UnqualifiedType: "/TypeDefinitions/1282-PrimitiveDefinition" - ID: 3 @@ -141,8 +137,7 @@ For our `test_args`, the prototype looks like Size: 64 Fields: - Offset: 0 - CustomName: "a" - OriginalName: a + Name: a Type: UnqualifiedType: "/TypeDefinitions/1288-PrimitiveDefinition" Qualifiers: diff --git a/share/revng/test/tests/abi/prepare-tested-model.py b/share/revng/test/tests/abi/prepare-tested-model.py index fe87b340b..b0e190634 100755 --- a/share/revng/test/tests/abi/prepare-tested-model.py +++ b/share/revng/test/tests/abi/prepare-tested-model.py @@ -35,9 +35,9 @@ def main(): def can_drop(function): return not ( - function.OriginalName.startswith("test_") - or function.OriginalName == "main" - or function.OriginalName == "memcpy" + function.Name.startswith("test_") + or function.Name == "main" + or function.Name == "memcpy" ) for function in [f for f in binary.Functions if can_drop(f)]: diff --git a/share/revng/test/tests/analysis/CollectCFG/arm/call.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/arm/call.S.cfg.yml index 720954b59..bd9f916c0 100644 --- a/share/revng/test/tests/analysis/CollectCFG/arm/call.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/arm/call.S.cfg.yml @@ -3,7 +3,7 @@ # --- -- OriginalName: _start +- Name: _start Blocks: - End: "2" ID: "1" @@ -15,7 +15,7 @@ Successors: - "-Destination": "" Type: Return -- OriginalName: function +- Name: function Blocks: - End: "4" ID: "3" diff --git a/share/revng/test/tests/analysis/CollectCFG/arm/dynamic-call.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/arm/dynamic-call.S.cfg.yml index 315546898..761ef3170 100644 --- a/share/revng/test/tests/analysis/CollectCFG/arm/dynamic-call.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/arm/dynamic-call.S.cfg.yml @@ -9,13 +9,13 @@ Type: FunctionCall DynamicFunction: strlen IsTailCall: true -- OriginalName: _start +- Name: _start Blocks: - Successors: - Type: FunctionCall - Successors: - Type: Return -- OriginalName: use_plt +- Name: use_plt Blocks: - Successors: - Type: FunctionCall diff --git a/share/revng/test/tests/analysis/CollectCFG/arm/fake-function.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/arm/fake-function.S.cfg.yml index 0cde80cf2..227ffe125 100644 --- a/share/revng/test/tests/analysis/CollectCFG/arm/fake-function.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/arm/fake-function.S.cfg.yml @@ -3,7 +3,7 @@ # --- -- OriginalName: _start +- Name: _start Blocks: - End: "2" ID: "1" @@ -25,7 +25,7 @@ Successors: - "-Destination": "" Type: Return -- OriginalName: prologue +- Name: prologue # Note: this function is inline, if necessary, we can add it here. Blocks: - ID: "3" @@ -33,7 +33,7 @@ Successors: - "-Destination": "" Type: BrokenReturn -- OriginalName: epilogue +- Name: epilogue # Note: this function is noreturn, if necessary, we can add it here. Blocks: - End: "5" diff --git a/share/revng/test/tests/analysis/CollectCFG/arm/indirect-call.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/arm/indirect-call.S.cfg.yml index 6080d87a9..0c090c398 100644 --- a/share/revng/test/tests/analysis/CollectCFG/arm/indirect-call.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/arm/indirect-call.S.cfg.yml @@ -3,7 +3,7 @@ # --- -- OriginalName: _start +- Name: _start Blocks: - End: "2" ID: "1" @@ -15,7 +15,7 @@ Successors: - "-Destination": "" Type: Return -- OriginalName: indirectcall +- Name: indirectcall Blocks: - End: "4" ID: "3" diff --git a/share/revng/test/tests/analysis/CollectCFG/arm/indirect-tail-call.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/arm/indirect-tail-call.S.cfg.yml index 249c2d7c7..1c193e1e0 100644 --- a/share/revng/test/tests/analysis/CollectCFG/arm/indirect-tail-call.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/arm/indirect-tail-call.S.cfg.yml @@ -3,14 +3,14 @@ # --- -- OriginalName: _start +- Name: _start Blocks: - ID: "1" End: "2" Successors: - Destination: "3" Type: FunctionCall -- OriginalName: tailcall +- Name: tailcall Blocks: - ID: "3" End: "4" diff --git a/share/revng/test/tests/analysis/CollectCFG/arm/longjmp.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/arm/longjmp.S.cfg.yml index 3d89726dc..620ea0f80 100644 --- a/share/revng/test/tests/analysis/CollectCFG/arm/longjmp.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/arm/longjmp.S.cfg.yml @@ -3,7 +3,7 @@ # --- -- OriginalName: _start +- Name: _start Blocks: - ID: "1" End: "2" @@ -15,7 +15,7 @@ Successors: - "-Destination": "" Type: Return -- OriginalName: longjmp +- Name: longjmp Blocks: - ID: "3" End: "4" diff --git a/share/revng/test/tests/analysis/CollectCFG/arm/memset.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/arm/memset.S.cfg.yml index c63384509..520ce70b6 100644 --- a/share/revng/test/tests/analysis/CollectCFG/arm/memset.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/arm/memset.S.cfg.yml @@ -3,7 +3,7 @@ # --- -- OriginalName: _start +- Name: _start Blocks: - ID: "1" End: "2" diff --git a/share/revng/test/tests/analysis/CollectCFG/arm/switch-addls.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/arm/switch-addls.S.cfg.yml index 0dd4c477d..86653feb1 100644 --- a/share/revng/test/tests/analysis/CollectCFG/arm/switch-addls.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/arm/switch-addls.S.cfg.yml @@ -3,7 +3,7 @@ # --- -- OriginalName: _start +- Name: _start Blocks: - ID: "1" End: "2" diff --git a/share/revng/test/tests/analysis/CollectCFG/arm/switch-disjoint-ranges.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/arm/switch-disjoint-ranges.S.cfg.yml index d04d6a904..a8395cf3e 100644 --- a/share/revng/test/tests/analysis/CollectCFG/arm/switch-disjoint-ranges.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/arm/switch-disjoint-ranges.S.cfg.yml @@ -3,7 +3,7 @@ # --- -- OriginalName: _start +- Name: _start Blocks: - ID: "1" End: "2" diff --git a/share/revng/test/tests/analysis/CollectCFG/arm/switch-ldrls.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/arm/switch-ldrls.S.cfg.yml index 48bc468ff..f0027b3a0 100644 --- a/share/revng/test/tests/analysis/CollectCFG/arm/switch-ldrls.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/arm/switch-ldrls.S.cfg.yml @@ -3,7 +3,7 @@ # --- -- OriginalName: _start +- Name: _start Blocks: - ID: "1" End: "2" diff --git a/share/revng/test/tests/analysis/CollectCFG/i386/dynamic-call.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/i386/dynamic-call.S.cfg.yml index 6eafb2ed1..649f1702c 100644 --- a/share/revng/test/tests/analysis/CollectCFG/i386/dynamic-call.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/i386/dynamic-call.S.cfg.yml @@ -9,7 +9,7 @@ Type: FunctionCall DynamicFunction: strlen IsTailCall: true -- OriginalName: use_plt +- Name: use_plt Blocks: - Successors: - Type: FunctionCall @@ -17,7 +17,7 @@ - Type: FunctionCall - Successors: - Type: Return -- OriginalName: __x86.get_pc_thunk.bx +- Name: __x86.get_pc_thunk.bx Blocks: - Successors: - Type: Return diff --git a/share/revng/test/tests/analysis/CollectCFG/mips/dynamic-call.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/mips/dynamic-call.S.cfg.yml index c383003fb..def8b237f 100644 --- a/share/revng/test/tests/analysis/CollectCFG/mips/dynamic-call.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/mips/dynamic-call.S.cfg.yml @@ -3,7 +3,7 @@ # --- -- OriginalName: __start +- Name: __start Entry: "1" Blocks: - ID: "1" diff --git a/share/revng/test/tests/analysis/CollectCFG/mips/jump-table-base-before-function-call.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/mips/jump-table-base-before-function-call.S.cfg.yml index 2d0815de1..f6b843db0 100644 --- a/share/revng/test/tests/analysis/CollectCFG/mips/jump-table-base-before-function-call.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/mips/jump-table-base-before-function-call.S.cfg.yml @@ -3,7 +3,7 @@ # --- -- OriginalName: __start +- Name: __start Blocks: - Successors: - Type: DirectBranch @@ -26,7 +26,7 @@ - Successors: - "-Destination": "" Type: LongJmp -- OriginalName: function +- Name: function Blocks: - Successors: - "-Destination": "" diff --git a/share/revng/test/tests/analysis/CollectCFG/mips/switch-jump-table.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/mips/switch-jump-table.S.cfg.yml index 82b409e9b..66cce757a 100644 --- a/share/revng/test/tests/analysis/CollectCFG/mips/switch-jump-table.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/mips/switch-jump-table.S.cfg.yml @@ -3,7 +3,7 @@ # --- -- OriginalName: __start +- Name: __start Blocks: - ID: "1" End: "2" diff --git a/share/revng/test/tests/analysis/CollectCFG/x86_64/call.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/x86_64/call.S.cfg.yml index de85cc30d..611ddd16b 100644 --- a/share/revng/test/tests/analysis/CollectCFG/x86_64/call.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/x86_64/call.S.cfg.yml @@ -3,7 +3,7 @@ # --- -- OriginalName: _start +- Name: _start Blocks: - ID: "1" End: "2" @@ -15,7 +15,7 @@ Successors: - "-Destination": "" Type: Return -- OriginalName: call +- Name: call Blocks: - ID: "3" End: "4" diff --git a/share/revng/test/tests/analysis/CollectCFG/x86_64/dynamic-call.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/x86_64/dynamic-call.S.cfg.yml index 43b0dc75d..2b24a509a 100644 --- a/share/revng/test/tests/analysis/CollectCFG/x86_64/dynamic-call.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/x86_64/dynamic-call.S.cfg.yml @@ -3,14 +3,14 @@ # --- -- OriginalName: "strlen" +- Name: "strlen_1" Blocks: - Successors: - "-Destination": "" Type: FunctionCall DynamicFunction: strlen IsTailCall: true -- OriginalName: use_plt +- Name: use_plt Blocks: - Successors: - Kind: CallEdge @@ -19,7 +19,7 @@ - Type: FunctionCall - Successors: - Type: Return -- OriginalName: do_not_use_plt +- Name: do_not_use_plt Blocks: - Successors: - "-Destination": "" diff --git a/share/revng/test/tests/analysis/CollectCFG/x86_64/fibonacci.c.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/x86_64/fibonacci.c.cfg.yml index f0bc70120..93e225f70 100644 --- a/share/revng/test/tests/analysis/CollectCFG/x86_64/fibonacci.c.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/x86_64/fibonacci.c.cfg.yml @@ -3,7 +3,7 @@ # --- -- OriginalName: fibonacci +- Name: fibonacci Blocks: - ID: "1" End: "2" @@ -32,7 +32,7 @@ Successors: - "-Destination": "" Type: Return -- OriginalName: _start +- Name: _start Blocks: - ID: "6" End: "7" diff --git a/share/revng/test/tests/analysis/CollectCFG/x86_64/indirect-call.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/x86_64/indirect-call.S.cfg.yml index 6080d87a9..0c090c398 100644 --- a/share/revng/test/tests/analysis/CollectCFG/x86_64/indirect-call.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/x86_64/indirect-call.S.cfg.yml @@ -3,7 +3,7 @@ # --- -- OriginalName: _start +- Name: _start Blocks: - End: "2" ID: "1" @@ -15,7 +15,7 @@ Successors: - "-Destination": "" Type: Return -- OriginalName: indirectcall +- Name: indirectcall Blocks: - End: "4" ID: "3" diff --git a/share/revng/test/tests/analysis/CollectCFG/x86_64/indirect-tail-call.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/x86_64/indirect-tail-call.S.cfg.yml index 249c2d7c7..1c193e1e0 100644 --- a/share/revng/test/tests/analysis/CollectCFG/x86_64/indirect-tail-call.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/x86_64/indirect-tail-call.S.cfg.yml @@ -3,14 +3,14 @@ # --- -- OriginalName: _start +- Name: _start Blocks: - ID: "1" End: "2" Successors: - Destination: "3" Type: FunctionCall -- OriginalName: tailcall +- Name: tailcall Blocks: - ID: "3" End: "4" diff --git a/share/revng/test/tests/analysis/CollectCFG/x86_64/longjmp.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/x86_64/longjmp.S.cfg.yml index 3d89726dc..620ea0f80 100644 --- a/share/revng/test/tests/analysis/CollectCFG/x86_64/longjmp.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/x86_64/longjmp.S.cfg.yml @@ -3,7 +3,7 @@ # --- -- OriginalName: _start +- Name: _start Blocks: - ID: "1" End: "2" @@ -15,7 +15,7 @@ Successors: - "-Destination": "" Type: Return -- OriginalName: longjmp +- Name: longjmp Blocks: - ID: "3" End: "4" diff --git a/share/revng/test/tests/analysis/CollectCFG/x86_64/switch-jump-table-32-bit-comparison.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/x86_64/switch-jump-table-32-bit-comparison.S.cfg.yml index 9dd769e27..be2deec75 100644 --- a/share/revng/test/tests/analysis/CollectCFG/x86_64/switch-jump-table-32-bit-comparison.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/x86_64/switch-jump-table-32-bit-comparison.S.cfg.yml @@ -3,7 +3,7 @@ # --- -- OriginalName: _start +- Name: _start Blocks: - ID: "1" End: "2" diff --git a/share/revng/test/tests/analysis/CollectCFG/x86_64/switch-jump-table.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/x86_64/switch-jump-table.S.cfg.yml index 632896580..c2d8cb938 100644 --- a/share/revng/test/tests/analysis/CollectCFG/x86_64/switch-jump-table.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/x86_64/switch-jump-table.S.cfg.yml @@ -3,7 +3,7 @@ # --- -- OriginalName: myfunc +- Name: myfunc Blocks: - ID: "1" End: "2" diff --git a/share/revng/test/tests/analysis/CollectCFG/x86_64/try-catch-ehframe.S.cfg.yml b/share/revng/test/tests/analysis/CollectCFG/x86_64/try-catch-ehframe.S.cfg.yml index 9ea13a738..779e47cf3 100644 --- a/share/revng/test/tests/analysis/CollectCFG/x86_64/try-catch-ehframe.S.cfg.yml +++ b/share/revng/test/tests/analysis/CollectCFG/x86_64/try-catch-ehframe.S.cfg.yml @@ -3,14 +3,14 @@ # --- -- OriginalName: function_call +- Name: function_call Blocks: - ID: "1" End: "2" Successors: - "-Destination": "" Type: Return -- OriginalName: _start +- Name: _start Blocks: - End: "3" ID: "2" diff --git a/share/revng/test/tests/analysis/Decompilation/clang/linked-lists.c.model.yml b/share/revng/test/tests/analysis/Decompilation/clang/linked-lists.c.model.yml index 8692b3136..6f3f5aec0 100644 --- a/share/revng/test/tests/analysis/Decompilation/clang/linked-lists.c.model.yml +++ b/share/revng/test/tests/analysis/Decompilation/clang/linked-lists.c.model.yml @@ -6,7 +6,7 @@ Architecture: x86_64 Functions: - - OriginalName: init_list + - Name: init_list Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1867-CABIFunctionDefinition" @@ -14,15 +14,15 @@ Functions: # memory release in general, so for now we disabled the test on the prototype of # release_list. We might think to re-enable this in the future when we support # `free` or tweak the input program, but for now this is just disabled. - # - OriginalName: release_list + # - Name: release_list # Prototype: # Kind: DefinedType # Definition: "/TypeDefinitions/1868-CABIFunctionDefinition" - - OriginalName: sum + - Name: sum Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1869-CABIFunctionDefinition" - - OriginalName: compute + - Name: compute Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1870-CABIFunctionDefinition" diff --git a/share/revng/test/tests/analysis/Decompilation/x86-64/segments-and-sections.c.filecheck b/share/revng/test/tests/analysis/Decompilation/x86-64/segments-and-sections.c.filecheck index 8c83f9ef6..6fd2c6454 100644 --- a/share/revng/test/tests/analysis/Decompilation/x86-64/segments-and-sections.c.filecheck +++ b/share/revng/test/tests/analysis/Decompilation/x86-64/segments-and-sections.c.filecheck @@ -12,4 +12,4 @@ These fields should be accessed using member access operator to access sections the binary. CHECK: sum_globals(void) -CHECK: return {{.*}}segment_[[SEGMENT_INDEX:[0-9]+]].unreserved__data.TheData.offset_1004 + segment_[[SEGMENT_INDEX]].unreserved__data.TheData.offset_0 +CHECK: return segment_[[SEGMENT_INDEX:[0-9]+]]._data.TheData.offset_1004 + segment_[[SEGMENT_INDEX]]._data.TheData.offset_0 diff --git a/share/revng/test/tests/analysis/Decompilation/x86-64/segments-and-sections.c.model.yml b/share/revng/test/tests/analysis/Decompilation/x86-64/segments-and-sections.c.model.yml index a4682b5a2..2386e4dde 100644 --- a/share/revng/test/tests/analysis/Decompilation/x86-64/segments-and-sections.c.model.yml +++ b/share/revng/test/tests/analysis/Decompilation/x86-64/segments-and-sections.c.model.yml @@ -17,7 +17,7 @@ TypeDefinitions: - ID: 1812 Kind: StructDefinition Fields: - - OriginalName: .rodata + - Name: .rodata Type: Kind: DefinedType Definition: "/TypeDefinitions/1813-StructDefinition" @@ -27,14 +27,14 @@ TypeDefinitions: - ID: 1815 Kind: StructDefinition Fields: - - OriginalName: .data + - Name: .data Type: Kind: DefinedType Definition: "/TypeDefinitions/1816-StructDefinition" - ID: 1816 Kind: StructDefinition Fields: - - OriginalName: TheData + - Name: TheData Type: Kind: DefinedType Definition: "/TypeDefinitions/1817-StructDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/always-dead-return-value.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/always-dead-return-value.S.model.yml index 1c4c68abc..1cadc0386 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/always-dead-return-value.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/always-dead-return-value.S.model.yml @@ -4,11 +4,11 @@ --- Functions: - - OriginalName: func + - Name: func Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1-RawFunctionDefinition" - - OriginalName: callee + - Name: callee Prototype: Kind: DefinedType Definition: "/TypeDefinitions/2-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/argument-from-call-site.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/argument-from-call-site.S.model.yml index 09e076afe..f8a08a907 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/argument-from-call-site.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/argument-from-call-site.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: caller + - Name: caller Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1815-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/argument-used-on-one-path.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/argument-used-on-one-path.S.model.yml index f92bb520b..738b4ac9b 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/argument-used-on-one-path.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/argument-used-on-one-path.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: function + - Name: function Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1814-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/call-site-argument.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/call-site-argument.S.model.yml index 58a41f194..d41cedbd2 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/call-site-argument.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/call-site-argument.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: function + - Name: function CallSitePrototypes: - Prototype: Kind: DefinedType diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/call-site-register-used-on-one-path.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/call-site-register-used-on-one-path.S.model.yml index 178579de2..81af7e439 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/call-site-register-used-on-one-path.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/call-site-register-used-on-one-path.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: function + - Name: function CallSitePrototypes: - Prototype: Kind: DefinedType diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/call-site-return-value-used-on-one-path-only.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/call-site-return-value-used-on-one-path-only.S.model.yml index 334189ca2..768de5b86 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/call-site-return-value-used-on-one-path-only.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/call-site-return-value-used-on-one-path-only.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: function + - Name: function CallSitePrototypes: - Prototype: Kind: DefinedType diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/call-site-return-value.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/call-site-return-value.S.model.yml index 334189ca2..768de5b86 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/call-site-return-value.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/call-site-return-value.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: function + - Name: function CallSitePrototypes: - Prototype: Kind: DefinedType diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/callee-saved-register-in-callee.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/callee-saved-register-in-callee.S.model.yml index f188320ab..c77c2cf97 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/callee-saved-register-in-callee.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/callee-saved-register-in-callee.S.model.yml @@ -4,11 +4,11 @@ --- Functions: - - OriginalName: callee + - Name: callee Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1814-RawFunctionDefinition" - - OriginalName: caller + - Name: caller Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1815-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/callee-saved-register.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/callee-saved-register.S.model.yml index 71cd23ef3..8bf396ad1 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/callee-saved-register.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/callee-saved-register.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: function + - Name: function Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1814-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/clobbered-register-in-callee.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/clobbered-register-in-callee.S.model.yml index 416ad5263..eebf8108d 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/clobbered-register-in-callee.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/clobbered-register-in-callee.S.model.yml @@ -4,11 +4,11 @@ --- Functions: - - OriginalName: callee + - Name: callee Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1814-RawFunctionDefinition" - - OriginalName: caller + - Name: caller Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1815-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/dead-on-one-path.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/dead-on-one-path.S.model.yml index 97812e43d..2830f4090 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/dead-on-one-path.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/dead-on-one-path.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: func + - Name: func Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/dead-register.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/dead-register.S.model.yml index 6bc12108c..bf9c62b99 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/dead-register.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/dead-register.S.model.yml @@ -4,11 +4,11 @@ --- Functions: - - OriginalName: func + - Name: func Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1-RawFunctionDefinition" - - OriginalName: callee + - Name: callee Prototype: Kind: DefinedType Definition: "/TypeDefinitions/2-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/draof.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/draof.S.model.yml index 2ab4bb2df..823e50ce1 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/draof.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/draof.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: draof + - Name: draof Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/drvofc.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/drvofc.S.model.yml index d08121bb3..c015faf06 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/drvofc.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/drvofc.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: drvofc + - Name: drvofc Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/indirect-call-callee-saved.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/indirect-call-callee-saved.S.model.yml index cf137fa09..bd477850c 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/indirect-call-callee-saved.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/indirect-call-callee-saved.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: indirect_caller + - Name: indirect_caller Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/propagate.S.add-puts.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/propagate.S.add-puts.yml index a0fc36363..d9d1db9d4 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/propagate.S.add-puts.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/propagate.S.add-puts.yml @@ -27,5 +27,4 @@ Changes: IsConst: true PrimitiveKind: Signed Size: 1 - CustomName: "str" - OriginalName: str + Name: str diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/propagate.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/propagate.S.model.yml index e23e6c457..b9b8befa6 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/propagate.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/propagate.S.model.yml @@ -29,5 +29,4 @@ TypeDefinitions: IsConst: true PrimitiveKind: Signed Size: 1 - CustomName: "str" - OriginalName: str + Name: str diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/push-pop.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/push-pop.S.model.yml index 3a445afd1..11bee644f 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/push-pop.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/push-pop.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: push_pop + - Name: push_pop Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/raofc.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/raofc.S.model.yml index 98e74d561..01a1dae11 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/raofc.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/raofc.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: raofc + - Name: raofc Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/register-clobbered-on-all-paths.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/register-clobbered-on-all-paths.S.model.yml index e30133bbc..86ca9ab61 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/register-clobbered-on-all-paths.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/register-clobbered-on-all-paths.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: function + - Name: function Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1814-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/regular-argument.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/regular-argument.S.model.yml index f92bb520b..738b4ac9b 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/regular-argument.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/regular-argument.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: function + - Name: function Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1814-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/regular-return-value.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/regular-return-value.S.model.yml index 71eef2a17..ce9125a6f 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/regular-return-value.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/regular-return-value.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: function + - Name: function Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1814-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/return-value-and-callee-saved-register-in-callee.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/return-value-and-callee-saved-register-in-callee.S.model.yml index 638a35078..c847e4062 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/return-value-and-callee-saved-register-in-callee.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/return-value-and-callee-saved-register-in-callee.S.model.yml @@ -4,11 +4,11 @@ --- Functions: - - OriginalName: callee + - Name: callee Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1814-RawFunctionDefinition" - - OriginalName: caller + - Name: caller Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1815-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/return-value-and-clobbered-register-in-callee.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/return-value-and-clobbered-register-in-callee.S.model.yml index 6f9aae021..3bee47133 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/return-value-and-clobbered-register-in-callee.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/return-value-and-clobbered-register-in-callee.S.model.yml @@ -4,11 +4,11 @@ --- Functions: - - OriginalName: callee + - Name: callee Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1814-RawFunctionDefinition" - - OriginalName: caller + - Name: caller Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1815-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/return-value-from-call-site.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/return-value-from-call-site.S.model.yml index e2058c35a..a34e7b8ce 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/return-value-from-call-site.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/return-value-from-call-site.S.model.yml @@ -4,11 +4,11 @@ --- Functions: - - OriginalName: callee + - Name: callee Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1814-RawFunctionDefinition" - - OriginalName: caller + - Name: caller Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1815-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/return-value-multiple-paths.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/return-value-multiple-paths.S.model.yml index 38dd0c18b..252af50ee 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/return-value-multiple-paths.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/return-value-multiple-paths.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: function + - Name: function Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1814-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/scratch-register.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/scratch-register.S.model.yml index e30133bbc..86ca9ab61 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/scratch-register.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/scratch-register.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: function + - Name: function Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1814-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/sometimes-dead-return-value.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/sometimes-dead-return-value.S.model.yml index 06f92f92e..8def0a9c5 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/sometimes-dead-return-value.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/sometimes-dead-return-value.S.model.yml @@ -4,15 +4,15 @@ --- Functions: - - OriginalName: func1 + - Name: func1 Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1-RawFunctionDefinition" - - OriginalName: func2 + - Name: func2 Prototype: Kind: DefinedType Definition: "/TypeDefinitions/2-RawFunctionDefinition" - - OriginalName: callee + - Name: callee Prototype: Kind: DefinedType Definition: "/TypeDefinitions/3-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/stack-argument-contradiction.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/stack-argument-contradiction.S.model.yml index 120699e78..eb9ea7644 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/stack-argument-contradiction.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/stack-argument-contradiction.S.model.yml @@ -4,11 +4,11 @@ --- Functions: - - OriginalName: func + - Name: func Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1-RawFunctionDefinition" - - OriginalName: callee + - Name: callee Prototype: Kind: DefinedType Definition: "/TypeDefinitions/2-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/stack-pointer-is-not-an-argument.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/stack-pointer-is-not-an-argument.S.model.yml index cd2fa884d..fbcbd91b3 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/stack-pointer-is-not-an-argument.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/stack-pointer-is-not-an-argument.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: function + - Name: function Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1814-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/uraof.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/uraof.S.model.yml index 782eba52c..5fb2e2bbc 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/uraof.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/uraof.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: uraof + - Name: uraof Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/urvof.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/urvof.S.model.yml index b6014cc87..d64f16433 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/urvof.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/urvof.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: urvof + - Name: urvof Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/urvofc.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/urvofc.S.model.yml index 6eddf7936..10e4f2248 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/urvofc.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/urvofc.S.model.yml @@ -4,11 +4,11 @@ --- Functions: - - OriginalName: urvofc + - Name: urvofc Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1-RawFunctionDefinition" - - OriginalName: callee + - Name: callee Prototype: Kind: DefinedType Definition: "/TypeDefinitions/2-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectABI/x86_64/write-used-only-one-path.S.model.yml b/share/revng/test/tests/analysis/DetectABI/x86_64/write-used-only-one-path.S.model.yml index fdabf1640..5f6227797 100644 --- a/share/revng/test/tests/analysis/DetectABI/x86_64/write-used-only-one-path.S.model.yml +++ b/share/revng/test/tests/analysis/DetectABI/x86_64/write-used-only-one-path.S.model.yml @@ -4,7 +4,7 @@ --- Functions: - - OriginalName: function + - Name: function Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1814-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectStackSize/dynamic_native/memcpy-from-stack-arguments.c.model.yml b/share/revng/test/tests/analysis/DetectStackSize/dynamic_native/memcpy-from-stack-arguments.c.model.yml index 88d49d0d3..34c905586 100644 --- a/share/revng/test/tests/analysis/DetectStackSize/dynamic_native/memcpy-from-stack-arguments.c.model.yml +++ b/share/revng/test/tests/analysis/DetectStackSize/dynamic_native/memcpy-from-stack-arguments.c.model.yml @@ -4,11 +4,11 @@ --- Functions: - - OriginalName: memcpy_from_stack_arguments + - Name: memcpy_from_stack_arguments Prototype: Kind: DefinedType Definition: "/TypeDefinitions/38-RawFunctionDefinition" - - OriginalName: backward_memcpy_from_stack_arguments + - Name: backward_memcpy_from_stack_arguments Prototype: Kind: DefinedType Definition: "/TypeDefinitions/100-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/DetectStackSize/dynamic_native/stackframe.c.model.yml b/share/revng/test/tests/analysis/DetectStackSize/dynamic_native/stackframe.c.model.yml index 659325e16..dd111d387 100644 --- a/share/revng/test/tests/analysis/DetectStackSize/dynamic_native/stackframe.c.model.yml +++ b/share/revng/test/tests/analysis/DetectStackSize/dynamic_native/stackframe.c.model.yml @@ -51,29 +51,29 @@ TypeDefinitions: # TODO: this should be 24, see source file for explanation Size: 20 Functions: - - CustomName: "stack_frame" + - Name: "stack_frame" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/7412439904038490792-RawFunctionDefinition" StackFrameType: Kind: DefinedType Definition: "/TypeDefinitions/17773669446801075323-StructDefinition" - - CustomName: "stack_frame_array" + - Name: "stack_frame_array" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/13776914522867493387-RawFunctionDefinition" StackFrameType: Kind: DefinedType Definition: "/TypeDefinitions/10059356012972557344-StructDefinition" - - CustomName: "stack_arguments_64" + - Name: "stack_arguments_64" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/962527246414399901-RawFunctionDefinition" - - CustomName: "call_stack_arguments_64" + - Name: "call_stack_arguments_64" -StackFrameType: "" # TODO: once we have references in the CFG we can test the relationship with # the callee. - - CustomName: "stack_arguments_32" + - Name: "stack_arguments_32" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/15643449473528100124-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/cft-with-an-unknown-abi/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/cft-with-an-unknown-abi/input-model.yml index ed3a7d119..4cbbe5f2e 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/cft-with-an-unknown-abi/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/cft-with-an-unknown-abi/input-model.yml @@ -19,8 +19,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - CustomName: "argc" - OriginalName: argc + Name: argc - Index: 1 Type: Kind: PointerType @@ -32,5 +31,4 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 1 - CustomName: "argv" - OriginalName: argv + Name: argv diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/cft-with-complex-arguments/check-against.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/cft-with-complex-arguments/check-against.yml index e8ad17189..78839d355 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/cft-with-complex-arguments/check-against.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/cft-with-complex-arguments/check-against.yml @@ -45,8 +45,7 @@ TypeDefinitions: ID: 3005 Fields: - Offset: 0 - CustomName: "can_do_threads" - OriginalName: can_do_threads + Name: can_do_threads Type: Kind: PrimitiveType PrimitiveKind: Signed @@ -56,8 +55,7 @@ TypeDefinitions: ID: 3006 Fields: - Offset: 0 - CustomName: "do_threads" - OriginalName: do_threads + Name: do_threads Type: Kind: PrimitiveType PrimitiveKind: Signed diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/cft-with-complex-arguments/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/cft-with-complex-arguments/input-model.yml index a146b4c8a..c704d3122 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/cft-with-complex-arguments/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/cft-with-complex-arguments/input-model.yml @@ -10,8 +10,7 @@ TypeDefinitions: ID: 3005 Fields: - Offset: 0 - CustomName: "can_do_threads" - OriginalName: can_do_threads + Name: can_do_threads Type: Kind: PrimitiveType PrimitiveKind: Signed @@ -21,8 +20,7 @@ TypeDefinitions: ID: 3006 Fields: - Offset: 0 - CustomName: "do_threads" - OriginalName: do_threads + Name: do_threads Type: Kind: PrimitiveType PrimitiveKind: Signed @@ -57,8 +55,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - CustomName: "argc" - OriginalName: argc + Name: argc - Index: 1 Type: Kind: PointerType @@ -70,5 +67,4 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 1 - CustomName: "argv" - OriginalName: argv + Name: argv diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/cft-with-no-abi/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/cft-with-no-abi/input-model.yml index ed3a7d119..4cbbe5f2e 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/cft-with-no-abi/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/cft-with-no-abi/input-model.yml @@ -19,8 +19,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - CustomName: "argc" - OriginalName: argc + Name: argc - Index: 1 Type: Kind: PointerType @@ -32,5 +31,4 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 1 - CustomName: "argv" - OriginalName: argv + Name: argv diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/cft/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/cft/input-model.yml index ed3a7d119..4cbbe5f2e 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/cft/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/cft/input-model.yml @@ -19,8 +19,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - CustomName: "argc" - OriginalName: argc + Name: argc - Index: 1 Type: Kind: PointerType @@ -32,5 +31,4 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 1 - CustomName: "argv" - OriginalName: argv + Name: argv diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/enum-with-a-broken-annotation/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/enum-with-a-broken-annotation/input-model.yml index dea5f1ce8..c13a5021b 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/enum-with-a-broken-annotation/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/enum-with-a-broken-annotation/input-model.yml @@ -14,11 +14,8 @@ TypeDefinitions: Size: 4 Entries: - Value: 0 - CustomName: "none" - OriginalName: none + Name: none - Value: 1 - CustomName: "positive" - OriginalName: positive + Name: positive - Value: 2 - CustomName: "negative" - OriginalName: negative + Name: negative diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/enum-with-a-non-primitive-underlying-type/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/enum-with-a-non-primitive-underlying-type/input-model.yml index 0f9380cbf..e00d6b95d 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/enum-with-a-non-primitive-underlying-type/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/enum-with-a-non-primitive-underlying-type/input-model.yml @@ -14,16 +14,13 @@ TypeDefinitions: Size: 4 Entries: - Value: 0 - CustomName: "none" - OriginalName: none + Name: none - Value: 1 - CustomName: "positive" - OriginalName: positive + Name: positive - Value: 2 - CustomName: "negative" - OriginalName: negative + Name: negative - Kind: StructDefinition ID: 3001 - CustomName: "some_struct" + Name: "some_struct" Fields: [] Size: 8 diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/enum-with-a-void-underlying-type/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/enum-with-a-void-underlying-type/input-model.yml index dea5f1ce8..c13a5021b 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/enum-with-a-void-underlying-type/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/enum-with-a-void-underlying-type/input-model.yml @@ -14,11 +14,8 @@ TypeDefinitions: Size: 4 Entries: - Value: 0 - CustomName: "none" - OriginalName: none + Name: none - Value: 1 - CustomName: "positive" - OriginalName: positive + Name: positive - Value: 2 - CustomName: "negative" - OriginalName: negative + Name: negative diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/enum-without-an-annotation/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/enum-without-an-annotation/input-model.yml index dea5f1ce8..c13a5021b 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/enum-without-an-annotation/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/enum-without-an-annotation/input-model.yml @@ -14,11 +14,8 @@ TypeDefinitions: Size: 4 Entries: - Value: 0 - CustomName: "none" - OriginalName: none + Name: none - Value: 1 - CustomName: "positive" - OriginalName: positive + Name: positive - Value: 2 - CustomName: "negative" - OriginalName: negative + Name: negative diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/enum/check-against.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/enum/check-against.yml index e273ac7c4..114e704a5 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/enum/check-against.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/enum/check-against.yml @@ -5,17 +5,17 @@ TypeDefinitions: - Kind: EnumDefinition ID: 3000 - CustomName: "my_enum" + Name: "my_enum" UnderlyingType: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 4 Entries: - Value: 0 - CustomName: "none" + Name: "none" - Value: 1 - CustomName: "positive" + Name: "positive" - Value: 2 - CustomName: "negative" + Name: "negative" - Value: 3 - CustomName: "neutral" + Name: "neutral" diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/enum/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/enum/input-model.yml index dea5f1ce8..c13a5021b 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/enum/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/enum/input-model.yml @@ -14,11 +14,8 @@ TypeDefinitions: Size: 4 Entries: - Value: 0 - CustomName: "none" - OriginalName: none + Name: none - Value: 1 - CustomName: "positive" - OriginalName: positive + Name: positive - Value: 2 - CustomName: "negative" - OriginalName: negative + Name: negative diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/primitives/check-against.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/primitives/check-against.yml index 0d6f19707..4014b0e13 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/primitives/check-against.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/primitives/check-against.yml @@ -5,34 +5,34 @@ TypeDefinitions: - Kind: UnionDefinition ID: 3000 - CustomName: "my_union" + Name: "my_union" Fields: - Index: 0 - CustomName: "first_field" + Name: "first_field" Type: Kind: PrimitiveType PrimitiveKind: Generic Size: 10 - Index: 1 - CustomName: "second_field" + Name: "second_field" Type: Kind: PrimitiveType PrimitiveKind: Generic Size: 12 - Index: 2 - CustomName: "third_field" + Name: "third_field" Type: Kind: PrimitiveType PrimitiveKind: Float Size: 10 - Index: 3 - CustomName: "fourth_field" + Name: "fourth_field" Type: Kind: PrimitiveType PrimitiveKind: Float Size: 12 - Index: 4 - CustomName: "fifth_field" + Name: "fifth_field" Type: Kind: PrimitiveType PrimitiveKind: Float diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-misplaced-stack-argument/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-misplaced-stack-argument/input-model.yml index 21b0158e4..cb714e6d7 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-misplaced-stack-argument/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-misplaced-stack-argument/input-model.yml @@ -7,7 +7,7 @@ Architecture: x86_64 DefaultABI: SystemV_x86_64 Functions: - Entry: "0x400000:Code_x86_64" - CustomName: "old_function_name" + Name: "old_function_name" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/3000-CABIFunctionDefinition" @@ -27,13 +27,12 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Generic Size: 8 - CustomName: "fd" - OriginalName: fd + Name: fd - Kind: StructDefinition ID: 3001 Fields: [] Size: 16 - CustomName: "my_stack_struct" + Name: "my_stack_struct" Segments: - StartAddress: "0x400000:Generic64" diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-non-struct-stack-argument/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-non-struct-stack-argument/input-model.yml index 21b0158e4..cb714e6d7 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-non-struct-stack-argument/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-non-struct-stack-argument/input-model.yml @@ -7,7 +7,7 @@ Architecture: x86_64 DefaultABI: SystemV_x86_64 Functions: - Entry: "0x400000:Code_x86_64" - CustomName: "old_function_name" + Name: "old_function_name" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/3000-CABIFunctionDefinition" @@ -27,13 +27,12 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Generic Size: 8 - CustomName: "fd" - OriginalName: fd + Name: fd - Kind: StructDefinition ID: 3001 Fields: [] Size: 16 - CustomName: "my_stack_struct" + Name: "my_stack_struct" Segments: - StartAddress: "0x400000:Generic64" diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-register-stack-argument/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-register-stack-argument/input-model.yml index 21b0158e4..cb714e6d7 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-register-stack-argument/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-register-stack-argument/input-model.yml @@ -7,7 +7,7 @@ Architecture: x86_64 DefaultABI: SystemV_x86_64 Functions: - Entry: "0x400000:Code_x86_64" - CustomName: "old_function_name" + Name: "old_function_name" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/3000-CABIFunctionDefinition" @@ -27,13 +27,12 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Generic Size: 8 - CustomName: "fd" - OriginalName: fd + Name: fd - Kind: StructDefinition ID: 3001 Fields: [] Size: 16 - CustomName: "my_stack_struct" + Name: "my_stack_struct" Segments: - StartAddress: "0x400000:Generic64" diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-stack-return-value/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-stack-return-value/input-model.yml index e454e5de2..f4c50ccaa 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-stack-return-value/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-stack-return-value/input-model.yml @@ -7,7 +7,7 @@ Architecture: x86_64 DefaultABI: SystemV_x86_64 Functions: - Entry: "0x400000:Code_x86_64" - CustomName: "old_function_name" + Name: "old_function_name" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/3000-CABIFunctionDefinition" @@ -25,8 +25,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - CustomName: "fd" - OriginalName: fd + Name: fd Segments: - StartAddress: "0x400000:Generic64" diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-stack/check-against.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-stack/check-against.yml index 603ced8a4..d898d76f6 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-stack/check-against.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-stack/check-against.yml @@ -5,7 +5,7 @@ Architecture: x86_64 Functions: - - CustomName: "new_function_name" + - Name: "new_function_name" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/3000-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-stack/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-stack/input-model.yml index 21b0158e4..cb714e6d7 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-stack/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-a-stack/input-model.yml @@ -7,7 +7,7 @@ Architecture: x86_64 DefaultABI: SystemV_x86_64 Functions: - Entry: "0x400000:Code_x86_64" - CustomName: "old_function_name" + Name: "old_function_name" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/3000-CABIFunctionDefinition" @@ -27,13 +27,12 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Generic Size: 8 - CustomName: "fd" - OriginalName: fd + Name: fd - Kind: StructDefinition ID: 3001 Fields: [] Size: 16 - CustomName: "my_stack_struct" + Name: "my_stack_struct" Segments: - StartAddress: "0x400000:Generic64" diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unannotated-argument/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unannotated-argument/input-model.yml index 21b0158e4..cb714e6d7 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unannotated-argument/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unannotated-argument/input-model.yml @@ -7,7 +7,7 @@ Architecture: x86_64 DefaultABI: SystemV_x86_64 Functions: - Entry: "0x400000:Code_x86_64" - CustomName: "old_function_name" + Name: "old_function_name" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/3000-CABIFunctionDefinition" @@ -27,13 +27,12 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Generic Size: 8 - CustomName: "fd" - OriginalName: fd + Name: fd - Kind: StructDefinition ID: 3001 Fields: [] Size: 16 - CustomName: "my_stack_struct" + Name: "my_stack_struct" Segments: - StartAddress: "0x400000:Generic64" diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unannotated-return-value/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unannotated-return-value/input-model.yml index e454e5de2..f4c50ccaa 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unannotated-return-value/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unannotated-return-value/input-model.yml @@ -7,7 +7,7 @@ Architecture: x86_64 DefaultABI: SystemV_x86_64 Functions: - Entry: "0x400000:Code_x86_64" - CustomName: "old_function_name" + Name: "old_function_name" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/3000-CABIFunctionDefinition" @@ -25,8 +25,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - CustomName: "fd" - OriginalName: fd + Name: fd Segments: - StartAddress: "0x400000:Generic64" diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unknown-architecture/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unknown-architecture/input-model.yml index 52f733c93..62747e31f 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unknown-architecture/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unknown-architecture/input-model.yml @@ -7,7 +7,7 @@ Architecture: x86_64 DefaultABI: SystemV_x86_64 Functions: - Entry: "0x400000:Code_x86_64" - CustomName: "old_function_name" + Name: "old_function_name" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/3000-CABIFunctionDefinition" @@ -27,8 +27,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Generic Size: 8 - CustomName: "fd" - OriginalName: fd + Name: fd Segments: - StartAddress: "0x400000:Generic64" diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unknown-argument-register/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unknown-argument-register/input-model.yml index e454e5de2..f4c50ccaa 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unknown-argument-register/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unknown-argument-register/input-model.yml @@ -7,7 +7,7 @@ Architecture: x86_64 DefaultABI: SystemV_x86_64 Functions: - Entry: "0x400000:Code_x86_64" - CustomName: "old_function_name" + Name: "old_function_name" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/3000-CABIFunctionDefinition" @@ -25,8 +25,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - CustomName: "fd" - OriginalName: fd + Name: fd Segments: - StartAddress: "0x400000:Generic64" diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unknown-return-value-register/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unknown-return-value-register/input-model.yml index e454e5de2..f4c50ccaa 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unknown-return-value-register/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-an-unknown-return-value-register/input-model.yml @@ -7,7 +7,7 @@ Architecture: x86_64 DefaultABI: SystemV_x86_64 Functions: - Entry: "0x400000:Code_x86_64" - CustomName: "old_function_name" + Name: "old_function_name" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/3000-CABIFunctionDefinition" @@ -25,8 +25,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - CustomName: "fd" - OriginalName: fd + Name: fd Segments: - StartAddress: "0x400000:Generic64" diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-multiple-return-values/check-against.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-multiple-return-values/check-against.yml index 4410fe0f3..2db2f2400 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-multiple-return-values/check-against.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-multiple-return-values/check-against.yml @@ -6,7 +6,7 @@ Architecture: x86_64 Functions: - Entry: "0x400000:Code_x86_64" - CustomName: new_function_name + Name: new_function_name Prototype: Kind: DefinedType Definition: "/TypeDefinitions/3000-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-multiple-return-values/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-multiple-return-values/input-model.yml index e454e5de2..f4c50ccaa 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-multiple-return-values/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft-with-multiple-return-values/input-model.yml @@ -7,7 +7,7 @@ Architecture: x86_64 DefaultABI: SystemV_x86_64 Functions: - Entry: "0x400000:Code_x86_64" - CustomName: "old_function_name" + Name: "old_function_name" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/3000-CABIFunctionDefinition" @@ -25,8 +25,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - CustomName: "fd" - OriginalName: fd + Name: fd Segments: - StartAddress: "0x400000:Generic64" diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft/check-against.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft/check-against.yml index 179cdab84..01ae81980 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft/check-against.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft/check-against.yml @@ -5,7 +5,7 @@ Architecture: x86_64 Functions: - - CustomName: "new_function_name" + - Name: new_function_name Prototype: Kind: DefinedType Definition: "/TypeDefinitions/3000-RawFunctionDefinition" diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft/input-model.yml index 52f733c93..62747e31f 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/rft/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/rft/input-model.yml @@ -7,7 +7,7 @@ Architecture: x86_64 DefaultABI: SystemV_x86_64 Functions: - Entry: "0x400000:Code_x86_64" - CustomName: "old_function_name" + Name: "old_function_name" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/3000-CABIFunctionDefinition" @@ -27,8 +27,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Generic Size: 8 - CustomName: "fd" - OriginalName: fd + Name: fd Segments: - StartAddress: "0x400000:Generic64" diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/struct-with-a-broken-field/expected-error.txt b/share/revng/test/tests/analysis/ImportFromCAnalysis/struct-with-a-broken-field/expected-error.txt index 6067dc137..d250325ab 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/struct-with-a-broken-field/expected-error.txt +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/struct-with-a-broken-field/expected-error.txt @@ -6,20 +6,19 @@ New model does not verify: Field at offset 1024 is out of struct boundaries (fie --- ID: 0 Kind: StructDefinition -CustomName: "my_struct" +Name: my_struct Size: 24 Fields: - Offset: 16 - CustomName: "normal_field" + Name: normal_field Type: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 8 - Offset: 1024 - CustomName: "broken_field" + Name: broken_field Type: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 8 ... - diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/struct-with-code/check-against.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/struct-with-code/check-against.yml index 2a334c1d2..7792d7125 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/struct-with-code/check-against.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/struct-with-code/check-against.yml @@ -5,13 +5,13 @@ TypeDefinitions: - Kind: StructDefinition ID: 0 - CustomName: "my_struct" + Name: "my_struct" Size: 24 CanContainCode: true # The leading $ means that the size of the Fields list must match $Fields: - Offset: 16 - CustomName: "no_code_in_the_last_third" + Name: "no_code_in_the_last_third" Type: Kind: PrimitiveType PrimitiveKind: Unsigned diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/struct-with-conflicting-padding/check-against.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/struct-with-conflicting-padding/check-against.yml index 7fcbca5c3..a957141fb 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/struct-with-conflicting-padding/check-against.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/struct-with-conflicting-padding/check-against.yml @@ -5,12 +5,12 @@ TypeDefinitions: - Kind: StructDefinition ID: 0 - CustomName: "my_struct" + Name: "my_struct" Size: 24 # The leading $ means that the size of the Fields list must match $Fields: - Offset: 16 - CustomName: "field" + Name: "field" Type: Kind: PointerType PointerSize: 8 diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/struct-with-explicit-padding/check-against.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/struct-with-explicit-padding/check-against.yml index 75295ad1b..ceac5f7fa 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/struct-with-explicit-padding/check-against.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/struct-with-explicit-padding/check-against.yml @@ -5,12 +5,12 @@ TypeDefinitions: - Kind: StructDefinition ID: 0 - CustomName: "my_struct" + Name: "my_struct" Size: 24 # The leading $ means that the size of the Fields list must match $Fields: - Offset: 8 - CustomName: "field" + Name: "field" Type: Kind: PointerType PointerSize: 8 diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/struct/check-against.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/struct/check-against.yml index 75295ad1b..ceac5f7fa 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/struct/check-against.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/struct/check-against.yml @@ -5,12 +5,12 @@ TypeDefinitions: - Kind: StructDefinition ID: 0 - CustomName: "my_struct" + Name: "my_struct" Size: 24 # The leading $ means that the size of the Fields list must match $Fields: - Offset: 8 - CustomName: "field" + Name: "field" Type: Kind: PointerType PointerSize: 8 diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/typedef/check-against.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/typedef/check-against.yml index 8364767d1..b37d1d8f1 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/typedef/check-against.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/typedef/check-against.yml @@ -5,7 +5,7 @@ TypeDefinitions: - Kind: TypedefDefinition ID: 3000 - CustomName: my_typedef + Name: my_typedef UnderlyingType: Kind: PrimitiveType PrimitiveKind: Signed diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/union/check-against.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/union/check-against.yml index 7f1cc5b1c..6dedb9fce 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/union/check-against.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/union/check-against.yml @@ -5,16 +5,16 @@ TypeDefinitions: - Kind: UnionDefinition ID: 3000 - CustomName: new_union_name + Name: new_union_name Fields: - Index: 0 - CustomName: "first_field" + Name: "first_field" Type: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 8 - Index: 1 - CustomName: "second_field" + Name: "second_field" Type: Kind: PrimitiveType PrimitiveKind: Unsigned diff --git a/share/revng/test/tests/analysis/ImportFromCAnalysis/union/input-model.yml b/share/revng/test/tests/analysis/ImportFromCAnalysis/union/input-model.yml index 52db249b7..94b2eb0fa 100644 --- a/share/revng/test/tests/analysis/ImportFromCAnalysis/union/input-model.yml +++ b/share/revng/test/tests/analysis/ImportFromCAnalysis/union/input-model.yml @@ -8,7 +8,7 @@ DefaultABI: SystemV_x86_64 TypeDefinitions: - Kind: UnionDefinition ID: 3000 - CustomName: old_union_name + Name: old_union_name Fields: - Index: 0 Type: diff --git a/share/revng/test/tests/analysis/SegregateStackAccesses/dynamic_native/segregate.c.override.yml b/share/revng/test/tests/analysis/SegregateStackAccesses/dynamic_native/segregate.c.override.yml index 5e449522f..7f041e3e0 100644 --- a/share/revng/test/tests/analysis/SegregateStackAccesses/dynamic_native/segregate.c.override.yml +++ b/share/revng/test/tests/analysis/SegregateStackAccesses/dynamic_native/segregate.c.override.yml @@ -5,39 +5,39 @@ Architecture: x86_64 Functions: - - OriginalName: raw_primitives_on_registers + - Name: raw_primitives_on_registers Prototype: Kind: DefinedType Definition: "/TypeDefinitions/100000-RawFunctionDefinition" - - OriginalName: raw_pointers_on_registers + - Name: raw_pointers_on_registers Prototype: Kind: DefinedType Definition: "/TypeDefinitions/100001-RawFunctionDefinition" - - OriginalName: raw_primitives_on_stack + - Name: raw_primitives_on_stack Prototype: Kind: DefinedType Definition: "/TypeDefinitions/100002-RawFunctionDefinition" - - OriginalName: cabi_primitives_on_registers + - Name: cabi_primitives_on_registers Prototype: Kind: DefinedType Definition: "/TypeDefinitions/100004-CABIFunctionDefinition" - - OriginalName: cabi_primitives_on_stack + - Name: cabi_primitives_on_stack Prototype: Kind: DefinedType Definition: "/TypeDefinitions/100005-CABIFunctionDefinition" - - OriginalName: cabi_aggregate_on_registers + - Name: cabi_aggregate_on_registers Prototype: Kind: DefinedType Definition: "/TypeDefinitions/100006-CABIFunctionDefinition" - - OriginalName: cabi_aggregate_on_stack + - Name: cabi_aggregate_on_stack Prototype: Kind: DefinedType Definition: "/TypeDefinitions/100007-CABIFunctionDefinition" - - OriginalName: cabi_aggregate_on_stack_and_registers + - Name: cabi_aggregate_on_stack_and_registers Prototype: Kind: DefinedType Definition: "/TypeDefinitions/100008-CABIFunctionDefinition" - - OriginalName: cabi_return_big_aggregate + - Name: cabi_return_big_aggregate Prototype: Kind: DefinedType Definition: "/TypeDefinitions/100010-CABIFunctionDefinition" diff --git a/share/revng/test/tests/invalidation/four-functions.S.add-segment-customname.filecheck b/share/revng/test/tests/invalidation/four-functions.S.add-segment-customname.filecheck index 70b727663..a4b8a5cc3 100644 --- a/share/revng/test/tests/invalidation/four-functions.S.add-segment-customname.filecheck +++ b/share/revng/test/tests/invalidation/four-functions.S.add-segment-customname.filecheck @@ -4,7 +4,7 @@ --- Changes: - - Path: "/Segments/0x500000:Generic64-9/CustomName" + - Path: "/Segments/0x500000:Generic64-9/Name" Remove: "" Add: "mysegment" ... diff --git a/share/revng/test/tests/invalidation/four-functions.S.empty.pre-patch.yml b/share/revng/test/tests/invalidation/four-functions.S.empty.pre-patch.yml index 16c78c01d..67f972e2a 100644 --- a/share/revng/test/tests/invalidation/four-functions.S.empty.pre-patch.yml +++ b/share/revng/test/tests/invalidation/four-functions.S.empty.pre-patch.yml @@ -10,21 +10,21 @@ Changes: - Path: "/Functions" Add: Entry: "0x500000:Code_x86_64" - CustomName: "caller" + Name: "caller" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/2000-RawFunctionDefinition" - Path: "/Functions" Add: Entry: "0x500006:Code_x86_64" - CustomName: "callee" + Name: "callee" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/2001-RawFunctionDefinition" - Path: "/Functions" Add: Entry: "0x500007:Code_x86_64" - CustomName: "not_called" + Name: "not_called" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/2002-RawFunctionDefinition" diff --git a/share/revng/test/tests/model-to-header/annotate-attibutes.model.yml b/share/revng/test/tests/model-to-header/annotate-attibutes.model.yml index af09a0fb5..1dbef8615 100644 --- a/share/revng/test/tests/model-to-header/annotate-attibutes.model.yml +++ b/share/revng/test/tests/model-to-header/annotate-attibutes.model.yml @@ -7,8 +7,7 @@ Architecture: x86_64 Functions: - Entry: "0x400700:Code_x86_64" - CustomName: "fn" - OriginalName: fn + Name: fn StackFrameType: Kind: DefinedType Definition: "/TypeDefinitions/3007-StructDefinition" @@ -18,8 +17,7 @@ Functions: ExportedNames: - fn - Entry: "0x400800:Code_x86_64" - CustomName: "fn2" - OriginalName: fn2 + Name: fn2 StackFrameType: Kind: DefinedType Definition: "/TypeDefinitions/3007-StructDefinition" @@ -38,36 +36,33 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - CustomName: "b" - OriginalName: b + Name: b - Index: 1 Type: Kind: PrimitiveType PrimitiveKind: Generic Size: 8 - CustomName: "c" - OriginalName: c + Name: c - Index: 2 Type: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 2 - CustomName: "d" - OriginalName: d + Name: d - Kind: EnumDefinition ID: 3009 - CustomName: "prefix_enum_9" + Name: "prefix_enum_9" UnderlyingType: Kind: PrimitiveType PrimitiveKind: Signed Size: 8 Entries: - Value: 0 - CustomName: "prefix_enum_9_none" + Name: "prefix_enum_9_none" - Value: 1 - CustomName: "prefix_enum_9_positive" + Name: "prefix_enum_9_positive" - Value: 4294967295 - CustomName: "prefix_enum_9_max_held_value" + Name: "prefix_enum_9_max_held_value" - Kind: StructDefinition ID: 3007 Fields: diff --git a/share/revng/test/tests/model-to-header/do-not-generate-struct-for-stack-type.h.model.yml b/share/revng/test/tests/model-to-header/do-not-generate-struct-for-stack-type.h.model.yml index b9d2d58e1..eead4663b 100644 --- a/share/revng/test/tests/model-to-header/do-not-generate-struct-for-stack-type.h.model.yml +++ b/share/revng/test/tests/model-to-header/do-not-generate-struct-for-stack-type.h.model.yml @@ -7,8 +7,7 @@ Architecture: x86_64 Functions: - Entry: "0x401129:Code_x86_64" - CustomName: "fn" - OriginalName: fn + Name: fn StackFrameType: Kind: DefinedType Definition: "/TypeDefinitions/3001-StructDefinition" diff --git a/share/revng/test/tests/model-to-header/do-not-inline-types-pointing-to-itself.h.model.yml b/share/revng/test/tests/model-to-header/do-not-inline-types-pointing-to-itself.h.model.yml index a6de2c063..c1aaecebc 100644 --- a/share/revng/test/tests/model-to-header/do-not-inline-types-pointing-to-itself.h.model.yml +++ b/share/revng/test/tests/model-to-header/do-not-inline-types-pointing-to-itself.h.model.yml @@ -6,12 +6,10 @@ TypeDefinitions: - Kind: StructDefinition ID: 3001 - CustomName: "B" - OriginalName: B + Name: B Fields: - Offset: 0 - CustomName: "next" - OriginalName: next + Name: next Type: Kind: PointerType PointerSize: 8 diff --git a/share/revng/test/tests/model-to-header/do-not-inline-used-stack-type.h.model.yml b/share/revng/test/tests/model-to-header/do-not-inline-used-stack-type.h.model.yml index ca2e56b20..24f11efc2 100644 --- a/share/revng/test/tests/model-to-header/do-not-inline-used-stack-type.h.model.yml +++ b/share/revng/test/tests/model-to-header/do-not-inline-used-stack-type.h.model.yml @@ -7,8 +7,7 @@ Architecture: x86_64 Functions: - Entry: "0x401129:Code_x86_64" - CustomName: "fn" - OriginalName: fn + Name: fn StackFrameType: Kind: DefinedType Definition: "/TypeDefinitions/3001-StructDefinition" @@ -37,12 +36,10 @@ TypeDefinitions: Size: 16 - Kind: StructDefinition ID: 3003 - CustomName: "S" - OriginalName: S + Name: S Fields: - Offset: 0 - CustomName: "s1" - OriginalName: s1 + Name: s1 Type: Kind: DefinedType Definition: "/TypeDefinitions/3001-StructDefinition" diff --git a/share/revng/test/tests/model-to-header/inline-complex-struct.h.model.yml b/share/revng/test/tests/model-to-header/inline-complex-struct.h.model.yml index b5b9bcf6c..525dbfb3b 100644 --- a/share/revng/test/tests/model-to-header/inline-complex-struct.h.model.yml +++ b/share/revng/test/tests/model-to-header/inline-complex-struct.h.model.yml @@ -6,36 +6,30 @@ TypeDefinitions: - Kind: StructDefinition ID: 3001 - CustomName: "X" - OriginalName: X + Name: X Fields: - Offset: 0 - CustomName: "the_struct_y" - OriginalName: the_struct_y + Name: the_struct_y Type: Kind: DefinedType Definition: "/TypeDefinitions/3002-StructDefinition" Size: 56 - Kind: StructDefinition ID: 3002 - CustomName: "Y" - OriginalName: Y + Name: Y Fields: - Offset: 0 - CustomName: "the_union_w" - OriginalName: the_union_w + Name: the_union_w Type: Kind: DefinedType Definition: "/TypeDefinitions/3003-UnionDefinition" - Offset: 4 - CustomName: "the_union_z" - OriginalName: the_union_z + Name: the_union_z Type: Kind: DefinedType Definition: "/TypeDefinitions/3004-UnionDefinition" - Offset: 48 - CustomName: "ptr_to_E" - OriginalName: ptr_to_E + Name: ptr_to_E Type: Kind: PointerType PointerSize: 8 @@ -45,30 +39,25 @@ TypeDefinitions: Size: 56 - Kind: UnionDefinition ID: 3003 - CustomName: "W" - OriginalName: W + Name: W Fields: - Index: 0 - CustomName: "field" - OriginalName: field + Name: field Type: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - Kind: UnionDefinition ID: 3004 - CustomName: "Z" - OriginalName: Z + Name: Z Fields: - Index: 0 - CustomName: "the_enum_e" - OriginalName: the_enum_e + Name: the_enum_e Type: Kind: DefinedType Definition: "/TypeDefinitions/3005-EnumDefinition" - Index: 1 - CustomName: "array_of_a" - OriginalName: array_of_a + Name: array_of_a Type: Kind: PointerType PointerSize: 8 @@ -77,27 +66,22 @@ TypeDefinitions: Definition: "/TypeDefinitions/3006-StructDefinition" - Kind: EnumDefinition ID: 3005 - CustomName: "E" - OriginalName: E + Name: E UnderlyingType: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 4 Entries: - Value: 2 - CustomName: "VALUE" - OriginalName: VALUE + Name: VALUE - Value: 7 - CustomName: "OTHER" - OriginalName: OTHER + Name: OTHER - Kind: StructDefinition ID: 3006 - CustomName: "A" - OriginalName: A + Name: A Fields: - Offset: 0 - CustomName: "field" - OriginalName: field + Name: field Type: Kind: PrimitiveType PrimitiveKind: Signed @@ -105,18 +89,15 @@ TypeDefinitions: Size: 4 - Kind: EnumDefinition ID: 3007 - CustomName: "E2" - OriginalName: E2 + Name: E2 UnderlyingType: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 4 Entries: - Value: 1 - CustomName: "FIRST" - OriginalName: FIRST + Name: FIRST - Value: 2 - CustomName: "SECOND" - OriginalName: SECOND + Name: SECOND --- diff --git a/share/revng/test/tests/model-to-header/inline-enum.h.model.yml b/share/revng/test/tests/model-to-header/inline-enum.h.model.yml index b84934183..d81c6d211 100644 --- a/share/revng/test/tests/model-to-header/inline-enum.h.model.yml +++ b/share/revng/test/tests/model-to-header/inline-enum.h.model.yml @@ -6,30 +6,25 @@ TypeDefinitions: - Kind: StructDefinition ID: 1 - CustomName: "B" - OriginalName: B + Name: B Fields: - Offset: 0 - CustomName: "the_a" - OriginalName: the_a + Name: the_a Type: Kind: DefinedType Definition: "/TypeDefinitions/3002-EnumDefinition" Size: 4 - Kind: EnumDefinition ID: 3002 - CustomName: "A" - OriginalName: A + Name: A UnderlyingType: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 4 Entries: - Value: 0 - CustomName: "FIRST" - OriginalName: FIRST + Name: FIRST - Value: 1 - CustomName: "SECOND" - OriginalName: SECOND + Name: SECOND --- diff --git a/share/revng/test/tests/model-to-header/inline-struct.h.model.yml b/share/revng/test/tests/model-to-header/inline-struct.h.model.yml index c65ce0a1c..a1434bbd5 100644 --- a/share/revng/test/tests/model-to-header/inline-struct.h.model.yml +++ b/share/revng/test/tests/model-to-header/inline-struct.h.model.yml @@ -6,24 +6,20 @@ TypeDefinitions: - Kind: StructDefinition ID: 3001 - CustomName: "B" - OriginalName: B + Name: B Fields: - Offset: 0 - CustomName: "a1" - OriginalName: a1 + Name: a1 Type: Kind: DefinedType Definition: "/TypeDefinitions/3002-StructDefinition" Size: 4 - Kind: StructDefinition ID: 3002 - CustomName: "A" - OriginalName: A + Name: A Fields: - Offset: 0 - CustomName: "x" - OriginalName: x + Name: x Type: Kind: PrimitiveType PrimitiveKind: Signed diff --git a/share/revng/test/tests/model-to-header/inline-union.h.model.yml b/share/revng/test/tests/model-to-header/inline-union.h.model.yml index 642bdcfaf..5458c3a65 100644 --- a/share/revng/test/tests/model-to-header/inline-union.h.model.yml +++ b/share/revng/test/tests/model-to-header/inline-union.h.model.yml @@ -6,24 +6,20 @@ TypeDefinitions: - Kind: StructDefinition ID: 3001 - CustomName: "B" - OriginalName: B + Name: B Fields: - Offset: 0 - CustomName: "a1" - OriginalName: a1 + Name: a1 Type: Kind: DefinedType Definition: "/TypeDefinitions/3002-UnionDefinition" Size: 4 - Kind: UnionDefinition ID: 3002 - CustomName: "A" - OriginalName: A + Name: A Fields: - Index: 0 - CustomName: "x" - OriginalName: x + Name: x Type: Kind: PrimitiveType PrimitiveKind: Signed diff --git a/share/revng/test/tests/model-to-header/pointer-to-struct.h.model.yml b/share/revng/test/tests/model-to-header/pointer-to-struct.h.model.yml index 158f944cd..f7f47d308 100644 --- a/share/revng/test/tests/model-to-header/pointer-to-struct.h.model.yml +++ b/share/revng/test/tests/model-to-header/pointer-to-struct.h.model.yml @@ -7,8 +7,7 @@ Architecture: x86_64 Functions: - Entry: "0x401129:Code_x86_64" - CustomName: "fn" - OriginalName: fn + Name: fn Prototype: Kind: DefinedType Definition: "/TypeDefinitions/3001-CABIFunctionDefinition" @@ -26,23 +25,19 @@ TypeDefinitions: PointeeType: Kind: DefinedType Definition: "/TypeDefinitions/3002-StructDefinition" - CustomName: "b_array" - OriginalName: b_array + Name: b_array - Kind: StructDefinition ID: 3002 - CustomName: "B" - OriginalName: B + Name: B Fields: - Offset: 0 - CustomName: "a1" - OriginalName: a1 + Name: a1 Type: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 4 - Offset: 4 - CustomName: "a2" - OriginalName: a2 + Name: a2 Type: Kind: PrimitiveType PrimitiveKind: Unsigned diff --git a/share/revng/test/tests/model-to-header/primitive-types.h.model.yml b/share/revng/test/tests/model-to-header/primitive-types.h.model.yml index 15176ec48..524b1dc26 100644 --- a/share/revng/test/tests/model-to-header/primitive-types.h.model.yml +++ b/share/revng/test/tests/model-to-header/primitive-types.h.model.yml @@ -7,8 +7,7 @@ Architecture: x86_64 Functions: - Entry: "0x400700:Code_x86_64" - CustomName: "fn" - OriginalName: fn + Name: fn StackFrameType: Kind: DefinedType Definition: "/TypeDefinitions/3007-StructDefinition" @@ -18,8 +17,7 @@ Functions: ExportedNames: - fn - Entry: "0x400740:Code_x86_64" - CustomName: "fn2" - OriginalName: fn2 + Name: fn2 StackFrameType: Kind: DefinedType Definition: "/TypeDefinitions/3007-StructDefinition" @@ -29,8 +27,7 @@ Functions: ExportedNames: - fn2 - Entry: "0x400749:Code_x86_64" - CustomName: "fn3" - OriginalName: fn3 + Name: fn3 StackFrameType: Kind: DefinedType Definition: "/TypeDefinitions/3007-StructDefinition" @@ -40,8 +37,7 @@ Functions: ExportedNames: - fn3 - Entry: "0x400770:Code_x86_64" - CustomName: "fn4" - OriginalName: fn4 + Name: fn4 StackFrameType: Kind: DefinedType Definition: "/TypeDefinitions/3007-StructDefinition" @@ -51,8 +47,7 @@ Functions: ExportedNames: - fn4 - Entry: "0x4007e8:Code_x86_64" - CustomName: "fn5" - OriginalName: fn5 + Name: fn5 StackFrameType: Kind: DefinedType Definition: "/TypeDefinitions/3007-StructDefinition" @@ -62,8 +57,7 @@ Functions: ExportedNames: - fn5 - Entry: "0x402266:Code_x86_64" - CustomName: "fn6" - OriginalName: fn6 + Name: fn6 StackFrameType: Kind: DefinedType Definition: "/TypeDefinitions/3007-StructDefinition" @@ -73,8 +67,7 @@ Functions: ExportedNames: - fn6 - Entry: "0x402288:Code_x86_64" - CustomName: "fn7" - OriginalName: fn7 + Name: fn7 StackFrameType: Kind: DefinedType Definition: "/TypeDefinitions/3007-StructDefinition" @@ -96,8 +89,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - CustomName: "b" - OriginalName: b + Name: b - Index: 1 Type: Kind: PointerType @@ -106,8 +98,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Generic Size: 8 - CustomName: "c" - OriginalName: c + Name: c - Index: 2 Type: Kind: PointerType @@ -116,8 +107,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 2 - CustomName: "d" - OriginalName: d + Name: d - Kind: CABIFunctionDefinition ID: 3008 ABI: SystemV_x86_64 @@ -130,8 +120,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Generic Size: 10 - CustomName: "arg5" - OriginalName: arg5 + Name: arg5 - Index: 1 Type: Kind: PointerType @@ -140,8 +129,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Generic Size: 12 - CustomName: "arg6" - OriginalName: arg6 + Name: arg6 - Kind: CABIFunctionDefinition ID: 3002 ABI: SystemV_x86_64 @@ -154,8 +142,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Generic Size: 1 - CustomName: "arg1" - OriginalName: arg1 + Name: arg1 - Index: 1 Type: Kind: PointerType @@ -164,8 +151,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Generic Size: 2 - CustomName: "arg2" - OriginalName: arg2 + Name: arg2 - Index: 2 Type: Kind: PointerType @@ -174,8 +160,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Generic Size: 4 - CustomName: "arg3" - OriginalName: arg3 + Name: arg3 - Index: 3 Type: Kind: PointerType @@ -184,8 +169,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Generic Size: 8 - CustomName: "arg4" - OriginalName: arg4 + Name: arg4 - Kind: CABIFunctionDefinition ID: 3003 ABI: SystemV_x86_64 @@ -198,8 +182,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Generic Size: 16 - CustomName: "arg1" - OriginalName: arg1 + Name: arg1 - Index: 1 Type: Kind: PointerType @@ -208,8 +191,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: PointerOrNumber Size: 1 - CustomName: "arg2" - OriginalName: arg2 + Name: arg2 - Index: 2 Type: Kind: PointerType @@ -218,8 +200,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: PointerOrNumber Size: 2 - CustomName: "arg3" - OriginalName: arg3 + Name: arg3 - Index: 3 Type: Kind: PointerType @@ -228,8 +209,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: PointerOrNumber Size: 4 - CustomName: "arg4" - OriginalName: arg4 + Name: arg4 - Index: 4 Type: Kind: PointerType @@ -238,8 +218,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: PointerOrNumber Size: 8 - CustomName: "arg5" - OriginalName: arg5 + Name: arg5 - Index: 5 Type: Kind: PointerType @@ -248,8 +227,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: PointerOrNumber Size: 16 - CustomName: "arg6" - OriginalName: arg6 + Name: arg6 - Kind: CABIFunctionDefinition ID: 3004 ABI: SystemV_x86_64 @@ -262,8 +240,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Number Size: 1 - CustomName: "arg1" - OriginalName: arg1 + Name: arg1 - Index: 1 Type: Kind: PointerType @@ -272,8 +249,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Number Size: 2 - CustomName: "arg2" - OriginalName: arg2 + Name: arg2 - Index: 2 Type: Kind: PointerType @@ -282,8 +258,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Number Size: 4 - CustomName: "arg3" - OriginalName: arg3 + Name: arg3 - Index: 3 Type: Kind: PointerType @@ -292,8 +267,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Number Size: 8 - CustomName: "arg4" - OriginalName: arg4 + Name: arg4 - Index: 4 Type: Kind: PointerType @@ -302,8 +276,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Number Size: 16 - CustomName: "arg5" - OriginalName: arg5 + Name: arg5 - Index: 5 Type: Kind: PointerType @@ -312,8 +285,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 1 - CustomName: "arg6" - OriginalName: arg6 + Name: arg6 - Kind: CABIFunctionDefinition ID: 3005 ABI: SystemV_x86_64 @@ -326,8 +298,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 2 - CustomName: "arg1" - OriginalName: arg1 + Name: arg1 - Index: 1 Type: Kind: PointerType @@ -336,8 +307,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 4 - CustomName: "arg2" - OriginalName: arg2 + Name: arg2 - Index: 2 Type: Kind: PointerType @@ -346,8 +316,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 8 - CustomName: "arg3" - OriginalName: arg3 + Name: arg3 - Index: 3 Type: Kind: PointerType @@ -356,8 +325,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 16 - CustomName: "arg4" - OriginalName: arg4 + Name: arg4 - Index: 4 Type: Kind: PointerType @@ -366,8 +334,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 1 - CustomName: "arg5" - OriginalName: arg5 + Name: arg5 - Index: 5 Type: Kind: PointerType @@ -376,8 +343,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 2 - CustomName: "arg6" - OriginalName: arg6 + Name: arg6 - Kind: CABIFunctionDefinition ID: 3006 ABI: SystemV_x86_64 @@ -390,8 +356,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - CustomName: "arg1" - OriginalName: arg1 + Name: arg1 - Index: 1 Type: Kind: PointerType @@ -400,8 +365,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 8 - CustomName: "arg2" - OriginalName: arg2 + Name: arg2 - Index: 2 Type: Kind: PointerType @@ -410,8 +374,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 16 - CustomName: "arg3" - OriginalName: arg3 + Name: arg3 - Index: 3 Type: Kind: PointerType @@ -420,8 +383,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Float Size: 2 - CustomName: "arg4" - OriginalName: arg4 + Name: arg4 - Index: 4 Type: Kind: PointerType @@ -430,8 +392,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Float Size: 4 - CustomName: "arg5" - OriginalName: arg5 + Name: arg5 - Index: 5 Type: Kind: PointerType @@ -440,8 +401,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Float Size: 8 - CustomName: "arg6" - OriginalName: arg6 + Name: arg6 - Index: 6 Type: Kind: PointerType @@ -450,8 +410,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Float Size: 10 - CustomName: "arg7" - OriginalName: arg7 + Name: arg7 - Index: 7 Type: Kind: PointerType @@ -460,8 +419,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Float Size: 12 - CustomName: "arg8" - OriginalName: arg8 + Name: arg8 - Index: 8 Type: Kind: PointerType @@ -470,8 +428,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Float Size: 16 - CustomName: "arg9" - OriginalName: arg9 + Name: arg9 - Kind: StructDefinition ID: 3007 Fields: diff --git a/share/revng/test/tests/model-to-header/struct.h.model.yml b/share/revng/test/tests/model-to-header/struct.h.model.yml index 700979350..32345d7b8 100644 --- a/share/revng/test/tests/model-to-header/struct.h.model.yml +++ b/share/revng/test/tests/model-to-header/struct.h.model.yml @@ -6,30 +6,25 @@ TypeDefinitions: - Kind: StructDefinition ID: 3001 - CustomName: "B" - OriginalName: B + Name: B Fields: - Offset: 0 - CustomName: "a1" - OriginalName: a1 + Name: a1 Type: Kind: DefinedType Definition: "/TypeDefinitions/3002-StructDefinition" - Offset: 4 - CustomName: "a2" - OriginalName: a2 + Name: a2 Type: Kind: DefinedType Definition: "/TypeDefinitions/3002-StructDefinition" Size: 8 - Kind: StructDefinition ID: 3002 - CustomName: "A" - OriginalName: A + Name: A Fields: - Offset: 0 - CustomName: "x" - OriginalName: x + Name: x Type: Kind: PrimitiveType PrimitiveKind: Signed diff --git a/share/revng/test/tests/model-to-header/union.h.model.yml b/share/revng/test/tests/model-to-header/union.h.model.yml index 235c208a1..96044ae9c 100644 --- a/share/revng/test/tests/model-to-header/union.h.model.yml +++ b/share/revng/test/tests/model-to-header/union.h.model.yml @@ -6,37 +6,31 @@ TypeDefinitions: - Kind: StructDefinition ID: 3001 - CustomName: "B" - OriginalName: B + Name: B Fields: - Offset: 0 - CustomName: "a1" - OriginalName: a1 + Name: a1 Type: Kind: DefinedType Definition: "/TypeDefinitions/3002-UnionDefinition" - Offset: 4 - CustomName: "a2" - OriginalName: a2 + Name: a2 Type: Kind: DefinedType Definition: "/TypeDefinitions/3002-UnionDefinition" Size: 8 - Kind: UnionDefinition ID: 3002 - CustomName: "A" - OriginalName: A + Name: A Fields: - Index: 0 - CustomName: "a" - OriginalName: a + Name: a Type: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 4 - Index: 1 - CustomName: "b" - OriginalName: b + Name: b Type: Kind: PrimitiveType PrimitiveKind: Unsigned diff --git a/share/revng/test/tests/model/import/idb/enum-type.c.model.yml b/share/revng/test/tests/model/import/idb/enum-type.c.model.yml index f61b8d464..6c4d57f35 100644 --- a/share/revng/test/tests/model/import/idb/enum-type.c.model.yml +++ b/share/revng/test/tests/model/import/idb/enum-type.c.model.yml @@ -5,19 +5,19 @@ TypeDefinitions: - Kind: EnumDefinition ID: 8119090305649570066 - OriginalName: A + Name: A UnderlyingType: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 4 Entries: - Value: 0 - OriginalName: x + Name: x - Value: 1 - OriginalName: "y" + Name: "y" - Kind: TypedefDefinition ID: 1687222338895130802 - OriginalName: A + Name: A UnderlyingType: Kind: DefinedType Definition: "/TypeDefinitions/8119090305649570066-EnumDefinition" @@ -29,4 +29,4 @@ TypeDefinitions: Type: Kind: DefinedType Definition: "/TypeDefinitions/1687222338895130802-TypedefDefinition" - OriginalName: x + Name: x diff --git a/share/revng/test/tests/model/import/idb/linked-list.c.model.yml b/share/revng/test/tests/model/import/idb/linked-list.c.model.yml index e8e30eae5..cb73fd1c2 100644 --- a/share/revng/test/tests/model/import/idb/linked-list.c.model.yml +++ b/share/revng/test/tests/model/import/idb/linked-list.c.model.yml @@ -5,15 +5,15 @@ TypeDefinitions: - Kind: StructDefinition ID: 17825711661244524544 - OriginalName: Node + Name: Node Fields: - Offset: 0 - OriginalName: content_uint32 + Name: content_uint32 Type: Kind: DefinedType Definition: "/TypeDefinitions/16313795245817021241-TypedefDefinition" - Offset: 4 - OriginalName: prev + Name: prev Type: Kind: PointerType PointerSize: 8 @@ -21,7 +21,7 @@ TypeDefinitions: Kind: DefinedType Definition: "/TypeDefinitions/14968854803921815239-TypedefDefinition" - Offset: 12 - OriginalName: next + Name: next Type: Kind: PointerType PointerSize: 8 diff --git a/share/revng/test/tests/model/import/idb/nested-struct.c.model.yml b/share/revng/test/tests/model/import/idb/nested-struct.c.model.yml index cd6687640..32228e601 100644 --- a/share/revng/test/tests/model/import/idb/nested-struct.c.model.yml +++ b/share/revng/test/tests/model/import/idb/nested-struct.c.model.yml @@ -5,21 +5,21 @@ TypeDefinitions: - Kind: StructDefinition ID: 8153719478940916065 - OriginalName: my_struct + Name: my_struct Fields: - Offset: 0 - OriginalName: second + Name: second Type: Kind: DefinedType Definition: "/TypeDefinitions/3436967820219683210-TypedefDefinition" - Offset: 8 - OriginalName: x + Name: x Type: Kind: PrimitiveType PrimitiveKind: Number Size: 4 - Offset: 12 - OriginalName: "y" + Name: "y" Type: Kind: PrimitiveType PrimitiveKind: Number @@ -27,22 +27,22 @@ TypeDefinitions: Size: 16 - Kind: TypedefDefinition ID: 3436967820219683210 - OriginalName: second_struct + Name: second_struct UnderlyingType: Kind: DefinedType Definition: "/TypeDefinitions/9993798603444101287-StructDefinition" - Kind: StructDefinition ID: 9993798603444101287 - OriginalName: second_struct + Name: second_struct Fields: - Offset: 0 - OriginalName: a + Name: a Type: Kind: PrimitiveType PrimitiveKind: Number Size: 4 - Offset: 4 - OriginalName: b + Name: b Type: Kind: PrimitiveType PrimitiveKind: Number diff --git a/share/revng/test/tests/model/import/idb/qsort.c.model.yml b/share/revng/test/tests/model/import/idb/qsort.c.model.yml index aa2ff65ac..b28c24bc2 100644 --- a/share/revng/test/tests/model/import/idb/qsort.c.model.yml +++ b/share/revng/test/tests/model/import/idb/qsort.c.model.yml @@ -3,12 +3,12 @@ # ImportedDynamicFunctions: - - OriginalName: qsort + - Name: qsort Prototype: Kind: DefinedType Definition: "/TypeDefinitions/3821538295510931842-CABIFunctionDefinition" Functions: - - OriginalName: cmpfunc + - Name: cmpfunc Prototype: Kind: DefinedType Definition: "/TypeDefinitions/5944255354151483434-CABIFunctionDefinition" @@ -24,32 +24,32 @@ TypeDefinitions: PointeeType: Kind: PrimitiveType PrimitiveKind: Void - OriginalName: base + Name: base - Index: 1 Type: Kind: DefinedType Definition: "/TypeDefinitions/855760813070670525-TypedefDefinition" - OriginalName: nmemb + Name: nmemb - Index: 2 Type: Kind: DefinedType Definition: "/TypeDefinitions/855760813070670525-TypedefDefinition" - OriginalName: size + Name: size - Index: 3 Type: Kind: DefinedType Definition: "/TypeDefinitions/7339777181910699325-TypedefDefinition" - OriginalName: compar + Name: compar - Kind: TypedefDefinition ID: 855760813070670525 - OriginalName: size_t + Name: size_t UnderlyingType: Kind: PrimitiveType PrimitiveKind: Unsigned Size: 8 - Kind: TypedefDefinition ID: 7339777181910699325 - OriginalName: __compar_fn_t + Name: __compar_fn_t UnderlyingType: Kind: PointerType PointerSize: 8 diff --git a/share/revng/test/tests/model/import/idb/simple.c.model.yml b/share/revng/test/tests/model/import/idb/simple.c.model.yml index 7bf6baf84..e08675e7f 100644 --- a/share/revng/test/tests/model/import/idb/simple.c.model.yml +++ b/share/revng/test/tests/model/import/idb/simple.c.model.yml @@ -3,7 +3,7 @@ # Functions: - - OriginalName: main + - Name: main Prototype: Kind: DefinedType Definition: "/TypeDefinitions/9061286636309425384-CABIFunctionDefinition" @@ -21,7 +21,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Number Size: 4 - OriginalName: argc + Name: argc - Index: 1 Type: Kind: PointerType @@ -34,7 +34,7 @@ TypeDefinitions: IsConst: true PrimitiveKind: Number Size: 1 - OriginalName: argv + Name: argv - Index: 2 Type: Kind: PointerType @@ -47,4 +47,4 @@ TypeDefinitions: IsConst: true PrimitiveKind: Number Size: 1 - OriginalName: envp + Name: envp diff --git a/share/revng/test/tests/model/import/idb/struct-as-field-ptr.c.model.yml b/share/revng/test/tests/model/import/idb/struct-as-field-ptr.c.model.yml index 2e015efe2..ae9daed8c 100644 --- a/share/revng/test/tests/model/import/idb/struct-as-field-ptr.c.model.yml +++ b/share/revng/test/tests/model/import/idb/struct-as-field-ptr.c.model.yml @@ -5,22 +5,22 @@ TypeDefinitions: - Kind: StructDefinition ID: 12620553074732431538 - OriginalName: my_struct + Name: my_struct Fields: - Offset: 0 - OriginalName: x + Name: x Type: Kind: PrimitiveType PrimitiveKind: Number Size: 4 - Offset: 4 - OriginalName: "y" + Name: "y" Type: Kind: PrimitiveType PrimitiveKind: Number Size: 4 - Offset: 8 - OriginalName: z + Name: z Type: Kind: PointerType PointerSize: 8 @@ -30,22 +30,22 @@ TypeDefinitions: Size: 16 - Kind: TypedefDefinition ID: 626103279023675435 - OriginalName: second_struct + Name: second_struct UnderlyingType: Kind: DefinedType Definition: "/TypeDefinitions/2113910595525978593-StructDefinition" - Kind: StructDefinition ID: 2113910595525978593 - OriginalName: second_struct + Name: second_struct Fields: - Offset: 0 - OriginalName: a + Name: a Type: Kind: PrimitiveType PrimitiveKind: Number Size: 4 - Offset: 4 - OriginalName: b + Name: b Type: Kind: PrimitiveType PrimitiveKind: Number diff --git a/share/revng/test/tests/model/import/idb/struct.c.model.yml b/share/revng/test/tests/model/import/idb/struct.c.model.yml index 668eb4aa2..6c7c89b58 100644 --- a/share/revng/test/tests/model/import/idb/struct.c.model.yml +++ b/share/revng/test/tests/model/import/idb/struct.c.model.yml @@ -5,16 +5,16 @@ TypeDefinitions: - Kind: StructDefinition ID: 10354558065911308391 - OriginalName: my_struct + Name: my_struct Fields: - Offset: 0 - OriginalName: x + Name: x Type: Kind: PrimitiveType PrimitiveKind: Number Size: 4 - Offset: 4 - OriginalName: "y" + Name: "y" Type: Kind: PrimitiveType PrimitiveKind: Number diff --git a/share/revng/test/tests/model/import/idb/typedef-char-to-uint32.c.model.yml b/share/revng/test/tests/model/import/idb/typedef-char-to-uint32.c.model.yml index 5a0f98264..b27ffac99 100644 --- a/share/revng/test/tests/model/import/idb/typedef-char-to-uint32.c.model.yml +++ b/share/revng/test/tests/model/import/idb/typedef-char-to-uint32.c.model.yml @@ -3,7 +3,7 @@ # Functions: - - OriginalName: fn + - Name: fn Prototype: Kind: DefinedType Definition: "/TypeDefinitions/13950133128659256343-CABIFunctionDefinition" @@ -20,11 +20,11 @@ TypeDefinitions: Type: Kind: DefinedType Definition: "/TypeDefinitions/10614298789832763328-TypedefDefinition" - OriginalName: x + Name: x - Kind: TypedefDefinition ID: 10614298789832763328 - OriginalName: uint32_t + Name: uint32_t UnderlyingType: Kind: PrimitiveType PrimitiveKind: Number diff --git a/share/revng/test/tests/model/import/pe/main.c.model.yml b/share/revng/test/tests/model/import/pe/main.c.model.yml index d1d274843..0bb2f561d 100644 --- a/share/revng/test/tests/model/import/pe/main.c.model.yml +++ b/share/revng/test/tests/model/import/pe/main.c.model.yml @@ -12,8 +12,7 @@ --- Functions: - - CustomName: "main" - OriginalName: main + - Name: main Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1215409121627673421-CABIFunctionDefinition" diff --git a/share/revng/test/tests/model/import/pe/qsort.c.model.yml b/share/revng/test/tests/model/import/pe/qsort.c.model.yml index 7c1f00173..cccf89782 100644 --- a/share/revng/test/tests/model/import/pe/qsort.c.model.yml +++ b/share/revng/test/tests/model/import/pe/qsort.c.model.yml @@ -12,11 +12,11 @@ --- Functions: - - OriginalName: cmpfunc + - Name: cmpfunc Prototype: Kind: DefinedType Definition: "/TypeDefinitions/5944255354151483434-CABIFunctionDefinition" - - OriginalName: qsort + - Name: qsort Prototype: Kind: DefinedType Definition: "/TypeDefinitions/17913232940792519997-CABIFunctionDefinition" diff --git a/share/revng/test/tests/model/import/pe/simple-cpp-class.cpp.model.yml b/share/revng/test/tests/model/import/pe/simple-cpp-class.cpp.model.yml index 8e0a9f9ea..9ec07eba9 100644 --- a/share/revng/test/tests/model/import/pe/simple-cpp-class.cpp.model.yml +++ b/share/revng/test/tests/model/import/pe/simple-cpp-class.cpp.model.yml @@ -12,41 +12,35 @@ --- Functions: - - CustomName: "Foo__Foo" - OriginalName: "Foo::Foo" + - Name: "Foo::Foo" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/16558654860526908435-CABIFunctionDefinition" - - CustomName: "Foo__retX" - OriginalName: "Foo::retX" + - Name: "Foo::retX" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/17990064059287856019-CABIFunctionDefinition" - - CustomName: "Foo__retY" - OriginalName: "Foo::retY" + - Name: "Foo::retY" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/8800211852340388695-CABIFunctionDefinition" - - CustomName: "Foo__dummy" - OriginalName: "Foo::dummy" + - Name: "Foo::dummy" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/11972987020417764497-CABIFunctionDefinition" TypeDefinitions: - Kind: StructDefinition ID: 987067897056915724 - OriginalName: Foo + Name: Foo Fields: - Offset: 0 - CustomName: "x" - OriginalName: x + Name: x Type: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - Offset: 4 - CustomName: "y" - OriginalName: "y" + Name: "y" Type: Kind: PrimitiveType PrimitiveKind: Signed diff --git a/share/revng/test/tests/model/import/pe/zero-sized-class.cpp.model.yml b/share/revng/test/tests/model/import/pe/zero-sized-class.cpp.model.yml index 8e0165c9a..2e0533de1 100644 --- a/share/revng/test/tests/model/import/pe/zero-sized-class.cpp.model.yml +++ b/share/revng/test/tests/model/import/pe/zero-sized-class.cpp.model.yml @@ -12,11 +12,11 @@ --- Functions: - - OriginalName: main + - Name: main Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1815-CABIFunctionDefinition" - - OriginalName: doSomething + - Name: doSomething Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1818-CABIFunctionDefinition" @@ -44,20 +44,17 @@ TypeDefinitions: Definition: "/TypeDefinitions/1822-StructDefinition" - Kind: StructDefinition ID: 1822 - CustomName: "Foo" - OriginalName: Foo + Name: Foo Size: 8 Fields: - Offset: 0 - CustomName: "x" - OriginalName: x + Name: x Type: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - Offset: 4 - CustomName: "y" - OriginalName: "y" + Name: "y" Type: Kind: PrimitiveType PrimitiveKind: Signed diff --git a/share/revng/test/tests/model/import/types/types.c.model.yml b/share/revng/test/tests/model/import/types/types.c.model.yml index 7a7f34c43..66e91349b 100644 --- a/share/revng/test/tests/model/import/types/types.c.model.yml +++ b/share/revng/test/tests/model/import/types/types.c.model.yml @@ -13,8 +13,7 @@ TypeDefinitions: Size: 92 Fields: - Offset: 0 - CustomName: "unreserved__custom_data" - OriginalName: .custom_data + Name: .custom_data Type: Kind: DefinedType Definition: "/TypeDefinitions/1816-StructDefinition" @@ -23,18 +22,18 @@ TypeDefinitions: Size: 92 Fields: - Offset: 0 - OriginalName: char_80_global + Name: char_80_global Type: Kind: DefinedType Definition: "/TypeDefinitions/1817-StructDefinition" - Offset: 80 - OriginalName: uint64_global + Name: uint64_global Type: Kind: PrimitiveType PrimitiveKind: Generic Size: 8 - Offset: 88 - OriginalName: uint32_global + Name: uint32_global Type: Kind: PrimitiveType PrimitiveKind: Generic diff --git a/share/revng/test/tests/s3_storage.py b/share/revng/test/tests/s3_storage.py index f2998b82a..552d91fe0 100755 --- a/share/revng/test/tests/s3_storage.py +++ b/share/revng/test/tests/s3_storage.py @@ -120,12 +120,12 @@ def main(): first_function = model["Functions"][0] unique_id = str(uuid4()).replace("-", "") diff = { - "Path": f"/Functions/{first_function['Entry']}/CustomName", + "Path": f"/Functions/{first_function['Entry']}/Name", "Add": unique_id, "Remove": "", } - if "CustomName" in first_function: - diff["Remove"] = first_function["CustomName"] + if "Name" in first_function: + diff["Remove"] = first_function["Name"] diff_content = yaml.safe_dump({"Changes": [diff]}) with wait_save(): diff --git a/tests/abi/tools/check-compatibility-with-abi/Verify.cpp b/tests/abi/tools/check-compatibility-with-abi/Verify.cpp index 06790a54c..c3cfd8555 100644 --- a/tests/abi/tools/check-compatibility-with-abi/Verify.cpp +++ b/tests/abi/tools/check-compatibility-with-abi/Verify.cpp @@ -550,7 +550,7 @@ void verifyABI(const TupleTree &Binary, VerificationHelper Helper{ Architecture, Def, Parsed.IsLittleEndian }; size_t ArgumentTestCount = 0, ReturnValueTestCount = 0; for (auto &Function : Binary->Functions()) { - Helper.FunctionName = Function.OriginalName(); + Helper.FunctionName = Function.Name(); if (Helper.FunctionName.take_front(5) == "test_") Helper.FunctionName = Helper.FunctionName.drop_front(5); if (auto Test = Parsed.ArgumentTests.find(Helper.FunctionName); diff --git a/tests/abi/tools/ensure-rft-equivalence/Main.cpp b/tests/abi/tools/ensure-rft-equivalence/Main.cpp index 9e947f4a9..d893d6c95 100644 --- a/tests/abi/tools/ensure-rft-equivalence/Main.cpp +++ b/tests/abi/tools/ensure-rft-equivalence/Main.cpp @@ -72,7 +72,7 @@ ensureIDMatch(const model::TypeDefinition::Key &Left, // Make sure the replacement ID is not in use already. if (LeftIterator != Model.TypeDefinitions().end()) { - if (ExpectedName == LeftIterator->get()->OriginalName()) { + if (ExpectedName == LeftIterator->get()->Name()) { // Original names match: assume the types are the same and skip // the replacement. return std::nullopt; @@ -82,7 +82,7 @@ ensureIDMatch(const model::TypeDefinition::Key &Left, + toString(LeftIterator->get()->key()) + "\nLHS name is '" + ExpectedName.str() + "' while RHS name is '" - + LeftIterator->get()->OriginalName() + "'."; + + LeftIterator->get()->Name() + "'."; revng_abort(Error.c_str()); } @@ -131,7 +131,7 @@ int main(int Argc, char *Argv[]) { ExitOnError(llvm::createStringError(EC, EC.message())); // Introduce a function pair container to allow grouping them based on their - // `CustomName`. + // name. struct KeyPair { std::optional Left = std::nullopt; std::optional Right = std::nullopt; @@ -252,12 +252,12 @@ int main(int Argc, char *Argv[]) { if (LeftStack != nullptr) { const model::TypeDefinition::Key &LSK = LeftStack->key(); const model::TypeDefinition::Key &RSK = RightStack->key(); - llvm::StringRef N = LeftModel->TypeDefinitions().at(LSK)->OriginalName(); + llvm::StringRef N = LeftModel->TypeDefinitions().at(LSK)->Name(); if (auto Replacement = ensureIDMatch(LSK, RSK, N, *RightModel)) Replacements.emplace(std::move(Replacement.value())); } - llvm::StringRef N = LeftModel->TypeDefinitions().at(*LKey)->OriginalName(); + llvm::StringRef N = LeftModel->TypeDefinitions().at(*LKey)->Name(); if (auto Replacement = ensureIDMatch(*LKey, *RKey, N, *RightModel)) Replacements.emplace(std::move(Replacement.value())); } diff --git a/tests/unit/Location.cpp b/tests/unit/Location.cpp index f871b7cb3..b7c2b64d3 100644 --- a/tests/unit/Location.cpp +++ b/tests/unit/Location.cpp @@ -52,9 +52,9 @@ BOOST_AUTO_TEST_CASE(TypeIDAsTheKey) { // Define a new union auto &&[Definition, _] = NewModel->makeUnionDefinition(); - Definition.CustomName() = "my_cool_union"; + Definition.Name() = "my_cool_union"; auto &ThirdField = Definition.Fields()[2]; - ThirdField.CustomName() = "third_field"; + ThirdField.Name() = "third_field"; // Introduce a location of a field by embedding the type definition key and // the field index. @@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(TypeIDAsTheKey) { auto Type = NewModel->makeType(FieldLocation.at(ranks::TypeDefinition)); // Ensure the type we got is the same type we started with. - revng_check(Type->tryGetAsDefinition()->CustomName() == "my_cool_union"); + revng_check(Type->tryGetAsDefinition()->Name() == "my_cool_union"); // Ensure the key is encoded in the serialized form of the location. std::string Key = toString(Definition.key()); diff --git a/tests/unit/Model.cpp b/tests/unit/Model.cpp index fd9a82f0f..eb168be08 100644 --- a/tests/unit/Model.cpp +++ b/tests/unit/Model.cpp @@ -33,7 +33,7 @@ BOOST_AUTO_TEST_CASE(TestIntrospection) { Function TheFunction(MetaAddress::invalid()); // Use get - TheFunction.CustomName() = "FunctionName"; + TheFunction.Name() = "FunctionName"; revng_check(get<1>(TheFunction) == "FunctionName"); // Test std::tuple_size @@ -43,10 +43,10 @@ BOOST_AUTO_TEST_CASE(TestIntrospection) { static_assert(TraitedTupleLike); using TLT = TupleLikeTraits; static_assert(std::is_same_v &, - decltype(TheFunction.CustomName())>); + decltype(TheFunction.Name())>); revng_check(StringRef(TLT::Name) == "Function"); revng_check(StringRef(TLT::FullName) == "model::Function"); - revng_check(StringRef(TLT::FieldNames[1]) == "CustomName"); + revng_check(StringRef(TLT::FieldNames[1]) == "Name"); } BOOST_AUTO_TEST_CASE(TestPathAccess) { @@ -77,9 +77,9 @@ BOOST_AUTO_TEST_CASE(TestPathAccess) { 8); std::string Path = "/TypeDefinitions/" + toString(Typedef.key()) - + "/TypedefDefinition::OriginalName"; + + "/TypedefDefinition::Name"; auto *OriginalNamePointer = getByPath(Path, Binary); - revng_check(OriginalNamePointer == &Typedef.OriginalName()); + revng_check(OriginalNamePointer == &Typedef.Name()); Path = "/TypeDefinitions/" + toString(Typedef.key()); revng_check(getByPath(Path, Binary) == &Typedef); @@ -108,7 +108,7 @@ BOOST_AUTO_TEST_CASE(TestStringPathConversion) { TupleTreePath InvalidFunctionNamePath = InvalidFunctionPath; InvalidFunctionNamePath.push_back(size_t(1)); - auto MaybePath = stringAsPath("/Functions/:Invalid/CustomName"); + auto MaybePath = stringAsPath("/Functions/:Invalid/Name"); revng_check(MaybePath.value() == InvalidFunctionNamePath); auto CheckRoundTrip = [](const char *String) { @@ -191,8 +191,8 @@ BOOST_AUTO_TEST_CASE(TestModelDeduplication) { revng_check(Dedup() == 0); - Typedef1.OriginalName() = "MyUInt8"; - Typedef2.OriginalName() = "MyUInt8"; + Typedef1.Name() = "MyUInt8"; + Typedef2.Name() = "MyUInt8"; revng_check(Dedup() == 1); } @@ -200,18 +200,18 @@ BOOST_AUTO_TEST_CASE(TestModelDeduplication) { // Two structs { auto &Struct1 = Model->makeStructDefinition().first; - Struct1.Fields()[0].CustomName() = "FirstField"; + Struct1.Fields()[0].Name() = "FirstField"; Struct1.Fields()[0].Type() = UInt32.copy(); - Struct1.OriginalName() = "MyStruct"; + Struct1.Name() = "MyStruct"; auto &Struct2 = Model->makeStructDefinition().first; - Struct2.Fields()[0].CustomName() = "DifferentName"; + Struct2.Fields()[0].Name() = "DifferentName"; Struct2.Fields()[0].Type() = UInt32.copy(); - Struct2.OriginalName() = "MyStruct"; + Struct2.Name() = "MyStruct"; revng_check(Dedup() == 0); - Struct1.Fields()[0].CustomName() = Struct2.Fields()[0].CustomName(); + Struct1.Fields()[0].Name() = Struct2.Fields()[0].Name(); revng_check(Dedup() == 1); } @@ -226,8 +226,8 @@ BOOST_AUTO_TEST_CASE(TestModelDeduplication) { LeftStruct1.Fields()[0].Type() = Pointer::make(std::move(LeftType2), 8); LeftStruct2.Fields()[0].Type() = Pointer::make(std::move(LeftType1), 8); - LeftStruct1.OriginalName() = "LoopingStructs1"; - LeftStruct2.OriginalName() = "LoopingStructs2"; + LeftStruct1.Name() = "LoopingStructs1"; + LeftStruct2.Name() = "LoopingStructs2"; auto &&[RightStruct1, RightType1] = Model->makeStructDefinition(); auto &&[RightStruct2, RightType2] = Model->makeStructDefinition(); @@ -237,8 +237,8 @@ BOOST_AUTO_TEST_CASE(TestModelDeduplication) { auto DoublePtr = Pointer::make(Pointer::make(std::move(RightType1), 8), 8); RightStruct2.Fields()[0].Type() = std::move(DoublePtr); - RightStruct1.OriginalName() = "LoopingStructs1"; - RightStruct2.OriginalName() = "LoopingStructs2"; + RightStruct1.Name() = "LoopingStructs1"; + RightStruct2.Name() = "LoopingStructs2"; revng_check(Dedup() == 0); diff --git a/tests/unit/TypeBucket.cpp b/tests/unit/TypeBucket.cpp index 68fdbbd32..1d733073b 100644 --- a/tests/unit/TypeBucket.cpp +++ b/tests/unit/TypeBucket.cpp @@ -41,21 +41,21 @@ BOOST_AUTO_TEST_CASE(Multiple) { { model::TypeBucket Bucket = *Binary; auto &&[Type, Path] = Bucket.makeStructDefinition(); - Type.OriginalName() = "First"; + Type.Name() = "First"; Bucket.commit(); } { model::TypeBucket Bucket = *Binary; auto &&[Type, Path] = Bucket.makeStructDefinition(); - Type.OriginalName() = "Second"; + Type.Name() = "Second"; Bucket.commit(); } revng_check(Binary->TypeDefinitions().size() == 2); auto FirstIterator = Binary->TypeDefinitions().begin(); - revng_check((*FirstIterator)->OriginalName() == "First"); - revng_check((*std::next(FirstIterator))->OriginalName() == "Second"); + revng_check((*FirstIterator)->Name() == "First"); + revng_check((*std::next(FirstIterator))->Name() == "Second"); } BOOST_AUTO_TEST_CASE(Reused) { @@ -63,27 +63,27 @@ BOOST_AUTO_TEST_CASE(Reused) { model::TypeBucket Bucket = *Binary; auto &&[Type, Path] = Bucket.makeStructDefinition(); - Type.OriginalName() = "First"; + Type.Name() = "First"; Bucket.commit(); revng_check(Binary->TypeDefinitions().size() == 1); - revng_check((*Binary->TypeDefinitions().begin())->OriginalName() == "First"); + revng_check((*Binary->TypeDefinitions().begin())->Name() == "First"); auto &&[AnotherType, AP] = Bucket.makeStructDefinition(); - AnotherType.OriginalName() = "Second"; + AnotherType.Name() = "Second"; Bucket.drop(); revng_check(Binary->TypeDefinitions().size() == 1); - revng_check((*Binary->TypeDefinitions().begin())->OriginalName() == "First"); + revng_check((*Binary->TypeDefinitions().begin())->Name() == "First"); auto &&[OneMoreType, _] = Bucket.makeStructDefinition(); - OneMoreType.OriginalName() = "Third"; + OneMoreType.Name() = "Third"; Bucket.commit(); revng_check(Binary->TypeDefinitions().size() == 2); auto FirstIterator = Binary->TypeDefinitions().begin(); - revng_check((*FirstIterator)->OriginalName() == "First"); - revng_check((*std::next(FirstIterator))->OriginalName() == "Third"); + revng_check((*FirstIterator)->Name() == "First"); + revng_check((*std::next(FirstIterator))->Name() == "Third"); } BOOST_AUTO_TEST_CASE(Paths) { @@ -93,18 +93,18 @@ BOOST_AUTO_TEST_CASE(Paths) { { model::TypeBucket Bucket = *Binary; auto &&[Definition, Type] = Bucket.makeStructDefinition(); - Definition.OriginalName() = "Valid"; + Definition.Name() = "Valid"; revng_check(Binary->TypeDefinitions().size() == 0); // Not valid yet. - // revng_check(Type->tryGetAsDefinition()->OriginalName() == "Valid"); + // revng_check(Type->tryGetAsDefinition()->Name() == "Valid"); Bucket.commit(); revng_check(Binary->TypeDefinitions().size() == 1); // Becomes valid after the commit. - revng_check(Type->tryGetAsDefinition()->OriginalName() == "Valid"); + revng_check(Type->tryGetAsDefinition()->Name() == "Valid"); Saved = Type.copy(); - revng_check(Saved->tryGetAsDefinition()->OriginalName() == "Valid"); + revng_check(Saved->tryGetAsDefinition()->Name() == "Valid"); //`Type` gets destroyed here, } @@ -113,6 +113,6 @@ BOOST_AUTO_TEST_CASE(Paths) { revng_check(Binary->TypeDefinitions().size() == 1); auto TD = Binary->TypeDefinitions().begin(); model::TypeDefinition &SavedDef = *Saved->tryGetAsDefinition(); - revng_check(SavedDef.OriginalName() == (*TD)->OriginalName()); - revng_check(SavedDef.OriginalName() == "Valid"); + revng_check(SavedDef.Name() == (*TD)->Name()); + revng_check(SavedDef.Name() == "Valid"); } diff --git a/tests/unit/mlir_lit_tests/backend/model.yml b/tests/unit/mlir_lit_tests/backend/model.yml index 228c3e018..2cf4df415 100644 --- a/tests/unit/mlir_lit_tests/backend/model.yml +++ b/tests/unit/mlir_lit_tests/backend/model.yml @@ -7,7 +7,7 @@ Architecture: x86_64 TypeDefinitions: - ID: 1001 Kind: CABIFunctionDefinition - CustomName: "fun_0x40001001_t" + Name: "fun_0x40001001_t" ABI: SystemV_x86_64 Arguments: [] @@ -20,13 +20,13 @@ TypeDefinitions: Size: 4 Arguments: - Index: 0 - CustomName: "x" + Name: "x" Type: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - Index: 1 - CustomName: "y" + Name: "y" Type: Kind: PrimitiveType PrimitiveKind: Signed @@ -41,7 +41,7 @@ TypeDefinitions: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - CustomName: "rcx" + Name: "rcx" ReturnValues: - Location: rax_x86_64 Type: @@ -57,7 +57,7 @@ TypeDefinitions: ABI: SystemV_x86_64 Arguments: - Index: 0 - CustomName: "x" + Name: "x" Type: Kind: PrimitiveType PrimitiveKind: Signed @@ -70,28 +70,28 @@ TypeDefinitions: - ID: 2001 Kind: EnumDefinition - CustomName: "my_enum" + Name: "my_enum" UnderlyingType: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 Entries: - Value: 0 - CustomName: "my_enum_0" + Name: "my_enum_0" - ID: 2002 Kind: StructDefinition - CustomName: "my_struct" + Name: "my_struct" Size: 4 Fields: - Offset: 0 - CustomName: "x" + Name: "x" Type: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - Offset: 4 - CustomName: "y" + Name: "y" Type: Kind: PrimitiveType PrimitiveKind: Signed @@ -99,16 +99,16 @@ TypeDefinitions: - ID: 2003 Kind: UnionDefinition - CustomName: "my_union" + Name: "my_union" Fields: - Index: 0 - CustomName: "x" + Name: "x" Type: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - Index: 1 - CustomName: "y" + Name: "y" Type: Kind: PrimitiveType PrimitiveKind: Signed @@ -116,11 +116,11 @@ TypeDefinitions: - ID: 2004 Kind: StructDefinition - CustomName: "args_1003" + Name: "args_1003" Size: 4 Fields: - Offset: 0 - CustomName: "a" + Name: "a" Type: Kind: PrimitiveType PrimitiveKind: Signed @@ -128,11 +128,11 @@ TypeDefinitions: - ID: 2005 Kind: StructDefinition - CustomName: "frame_1005" + Name: "frame_1005" Size: 4 Fields: - Offset: 0 - CustomName: "a" + Name: "a" Type: Kind: PrimitiveType PrimitiveKind: Signed @@ -140,17 +140,17 @@ TypeDefinitions: - ID: 2006 Kind: StructDefinition - CustomName: "my_pair" + Name: "my_pair" Size: 8 Fields: - Offset: 0 - CustomName: "a" + Name: "a" Type: Kind: PrimitiveType PrimitiveKind: Signed Size: 4 - Offset: 4 - CustomName: "b" + Name: "b" Type: Kind: PrimitiveType PrimitiveKind: Signed @@ -158,31 +158,31 @@ TypeDefinitions: Functions: - Entry: "0x40001001:Code_x86_64" - CustomName: "fun_0x40001001" + Name: "fun_0x40001001" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1001-CABIFunctionDefinition" - Entry: "0x40001002:Code_x86_64" - CustomName: "fun_0x40001002" + Name: "fun_0x40001002" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1002-CABIFunctionDefinition" - Entry: "0x40001003:Code_x86_64" - CustomName: "fun_0x40001003" + Name: "fun_0x40001003" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1003-RawFunctionDefinition" - Entry: "0x40001004:Code_x86_64" - CustomName: "fun_0x40001004" + Name: "fun_0x40001004" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1004-CABIFunctionDefinition" - Entry: "0x40001005:Code_x86_64" - CustomName: "fun_0x40001005" + Name: "fun_0x40001005" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1005-CABIFunctionDefinition" @@ -191,8 +191,7 @@ Functions: Definition: "/TypeDefinitions/2005-StructDefinition" ImportedDynamicFunctions: - - OriginalName: "imported" - CustomName: "imported" + - Name: "imported" Prototype: Kind: DefinedType Definition: "/TypeDefinitions/1001-CABIFunctionDefinition" @@ -200,7 +199,7 @@ ImportedDynamicFunctions: Segments: - StartAddress: "0x40002001:Generic64" VirtualSize: 4 - CustomName: "seg_0x40002001" + Name: "seg_0x40002001" StartOffset: 0 FileSize: 4 IsReadable: true diff --git a/tests/unit/mlir_lit_tests/model-import/ArrayType.yml b/tests/unit/mlir_lit_tests/model-import/ArrayType.yml index 16fc6fa81..80b724234 100644 --- a/tests/unit/mlir_lit_tests/model-import/ArrayType.yml +++ b/tests/unit/mlir_lit_tests/model-import/ArrayType.yml @@ -23,7 +23,7 @@ TypeDefinitions: # CHECK: > - ID: 1001 Kind: StructDefinition - CustomName: "my_struct" + Name: "my_struct" Size: 1024 Fields: - Offset: 0 diff --git a/tests/unit/mlir_lit_tests/model-import/CABIFunctionType1.yml b/tests/unit/mlir_lit_tests/model-import/CABIFunctionType1.yml index c61aa2791..98140f240 100644 --- a/tests/unit/mlir_lit_tests/model-import/CABIFunctionType1.yml +++ b/tests/unit/mlir_lit_tests/model-import/CABIFunctionType1.yml @@ -15,6 +15,6 @@ TypeDefinitions: # CHECK: > - ID: 1001 Kind: CABIFunctionDefinition - CustomName: "my_function1" + Name: "my_function1" ABI: SystemV_x86_64 Arguments: [] diff --git a/tests/unit/mlir_lit_tests/model-import/CABIFunctionType2.yml b/tests/unit/mlir_lit_tests/model-import/CABIFunctionType2.yml index 57637926d..12a282962 100644 --- a/tests/unit/mlir_lit_tests/model-import/CABIFunctionType2.yml +++ b/tests/unit/mlir_lit_tests/model-import/CABIFunctionType2.yml @@ -15,7 +15,7 @@ TypeDefinitions: # CHECK: > - ID: 1002 Kind: CABIFunctionDefinition - CustomName: "my_function2" + Name: "my_function2" ABI: SystemV_x86_64 ReturnType: Kind: PrimitiveType diff --git a/tests/unit/mlir_lit_tests/model-import/EnumType.yml b/tests/unit/mlir_lit_tests/model-import/EnumType.yml index bc70bbe17..4e8b8aa78 100644 --- a/tests/unit/mlir_lit_tests/model-import/EnumType.yml +++ b/tests/unit/mlir_lit_tests/model-import/EnumType.yml @@ -23,7 +23,7 @@ TypeDefinitions: # CHECK: > - ID: 1104 Kind: EnumDefinition - CustomName: "my_enum1" + Name: "my_enum1" UnderlyingType: Kind: PrimitiveType PrimitiveKind: Signed @@ -49,7 +49,7 @@ TypeDefinitions: # CHECK: > - ID: 1108 Kind: EnumDefinition - CustomName: "my_enum2" + Name: "my_enum2" UnderlyingType: Kind: PrimitiveType PrimitiveKind: Signed @@ -73,7 +73,7 @@ TypeDefinitions: # CHECK: > - ID: 1204 Kind: EnumDefinition - CustomName: "my_enum3" + Name: "my_enum3" UnderlyingType: Kind: PrimitiveType PrimitiveKind: Unsigned @@ -95,7 +95,7 @@ TypeDefinitions: # CHECK: > - ID: 1208 Kind: EnumDefinition - CustomName: "my_enum4" + Name: "my_enum4" UnderlyingType: Kind: PrimitiveType PrimitiveKind: Unsigned diff --git a/tests/unit/mlir_lit_tests/model-import/RawFunctionType1.yml b/tests/unit/mlir_lit_tests/model-import/RawFunctionType1.yml index c384dd9ff..e62857a09 100644 --- a/tests/unit/mlir_lit_tests/model-import/RawFunctionType1.yml +++ b/tests/unit/mlir_lit_tests/model-import/RawFunctionType1.yml @@ -15,7 +15,7 @@ TypeDefinitions: # CHECK: > - ID: 1000 Kind: RawFunctionDefinition - CustomName: "my_function1" + Name: "my_function1" Architecture: x86_64 Arguments: [] ReturnValues: [] diff --git a/tests/unit/mlir_lit_tests/model-import/RawFunctionType2.yml b/tests/unit/mlir_lit_tests/model-import/RawFunctionType2.yml index 5f25ab818..5c1efdd2c 100644 --- a/tests/unit/mlir_lit_tests/model-import/RawFunctionType2.yml +++ b/tests/unit/mlir_lit_tests/model-import/RawFunctionType2.yml @@ -15,7 +15,7 @@ TypeDefinitions: # CHECK: > - ID: 1001 Kind: RawFunctionDefinition - CustomName: "my_function2" + Name: "my_function2" Architecture: x86_64 Arguments: - Location: rax_x86_64 diff --git a/tests/unit/mlir_lit_tests/model-import/RawFunctionType3.yml b/tests/unit/mlir_lit_tests/model-import/RawFunctionType3.yml index c7dd74a67..9f08cda62 100644 --- a/tests/unit/mlir_lit_tests/model-import/RawFunctionType3.yml +++ b/tests/unit/mlir_lit_tests/model-import/RawFunctionType3.yml @@ -7,7 +7,7 @@ Architecture: x86_64 TypeDefinitions: - ID: 201 Kind: StructDefinition - CustomName: my_struct + Name: my_struct Size: 8 Fields: - Offset: 0 @@ -55,7 +55,7 @@ TypeDefinitions: # CHECK: > - ID: 1002 Kind: RawFunctionDefinition - CustomName: "my_function3" + Name: "my_function3" Architecture: x86_64 Arguments: - Location: rax_x86_64 diff --git a/tests/unit/mlir_lit_tests/model-import/RecursiveStructType.yml b/tests/unit/mlir_lit_tests/model-import/RecursiveStructType.yml index f4fa187c9..ac86be717 100644 --- a/tests/unit/mlir_lit_tests/model-import/RecursiveStructType.yml +++ b/tests/unit/mlir_lit_tests/model-import/RecursiveStructType.yml @@ -22,7 +22,7 @@ TypeDefinitions: # CHECK: > - ID: 1001 Kind: StructDefinition - CustomName: "my_struct" + Name: "my_struct" Size: 4 Fields: - Offset: 0 diff --git a/tests/unit/mlir_lit_tests/model-import/StructType.yml b/tests/unit/mlir_lit_tests/model-import/StructType.yml index 0441bd79a..547827617 100644 --- a/tests/unit/mlir_lit_tests/model-import/StructType.yml +++ b/tests/unit/mlir_lit_tests/model-import/StructType.yml @@ -28,7 +28,7 @@ TypeDefinitions: # CHECK: > - ID: 1001 Kind: StructDefinition - CustomName: "my_struct" + Name: "my_struct" Size: 8 Fields: - Offset: 0 diff --git a/tests/unit/mlir_lit_tests/model-import/TypedefType.yml b/tests/unit/mlir_lit_tests/model-import/TypedefType.yml index 27f8b16a3..831ea9452 100644 --- a/tests/unit/mlir_lit_tests/model-import/TypedefType.yml +++ b/tests/unit/mlir_lit_tests/model-import/TypedefType.yml @@ -11,7 +11,7 @@ TypeDefinitions: # CHECK: > - ID: 0 Kind: TypedefDefinition - CustomName: "my_float" + Name: "my_float" UnderlyingType: Kind: PrimitiveType PrimitiveKind: Float @@ -24,7 +24,7 @@ TypeDefinitions: # CHECK: > - ID: 1 Kind: TypedefDefinition - CustomName: "my_generic" + Name: "my_generic" UnderlyingType: Kind: PrimitiveType PrimitiveKind: Generic @@ -37,7 +37,7 @@ TypeDefinitions: # CHECK: > - ID: 2 Kind: TypedefDefinition - CustomName: "my_int" + Name: "my_int" UnderlyingType: Kind: PrimitiveType PrimitiveKind: Signed @@ -50,7 +50,7 @@ TypeDefinitions: # CHECK: > - ID: 3 Kind: TypedefDefinition - CustomName: "my_number" + Name: "my_number" UnderlyingType: Kind: PrimitiveType PrimitiveKind: Number @@ -63,7 +63,7 @@ TypeDefinitions: # CHECK: > - ID: 4 Kind: TypedefDefinition - CustomName: "my_pon" + Name: "my_pon" UnderlyingType: Kind: PrimitiveType PrimitiveKind: PointerOrNumber @@ -76,7 +76,7 @@ TypeDefinitions: # CHECK: > - ID: 5 Kind: TypedefDefinition - CustomName: "my_uint" + Name: "my_uint" UnderlyingType: Kind: PrimitiveType PrimitiveKind: Unsigned @@ -89,7 +89,7 @@ TypeDefinitions: # CHECK: > - ID: 6 Kind: TypedefDefinition - CustomName: "my_void" + Name: "my_void" UnderlyingType: Kind: PrimitiveType PrimitiveKind: Void diff --git a/tests/unit/mlir_lit_tests/model-import/UnionType.yml b/tests/unit/mlir_lit_tests/model-import/UnionType.yml index bd1625126..06301240d 100644 --- a/tests/unit/mlir_lit_tests/model-import/UnionType.yml +++ b/tests/unit/mlir_lit_tests/model-import/UnionType.yml @@ -24,7 +24,7 @@ TypeDefinitions: # CHECK: > - ID: 1001 Kind: UnionDefinition - CustomName: "my_union" + Name: "my_union" Fields: - Index: 0 Type: