diff --git a/include/revng/PTML/CBuilder.h b/include/revng/PTML/CBuilder.h index 409a0f281..d7611b860 100644 --- a/include/revng/PTML/CBuilder.h +++ b/include/revng/PTML/CBuilder.h @@ -16,7 +16,6 @@ #include "revng/PTML/Doxygen.h" #include "revng/PTML/IndentedOstream.h" #include "revng/PTML/Tag.h" -#include "revng/PTML/TokenDefinitions.h" #include "revng/Pipeline/Location.h" #include "revng/Pipes/Ranks.h" diff --git a/include/revng/PTML/TokenDefinitions.h b/include/revng/PTML/TokenDefinitions.h deleted file mode 100644 index 1500dcea6..000000000 --- a/include/revng/PTML/TokenDefinitions.h +++ /dev/null @@ -1,64 +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/PTML/Tag.h" - -namespace tokenDefinition::types { - -using StringToken = llvm::SmallString<128>; -using TypeString = StringToken; - -} // namespace tokenDefinition::types - -/// Utility structure, used mainly in the C backend when generating variable -/// names in conjunction with PTML -/// It will have 2 Fields: -/// \property Declaration : Contains the string that's to be used when declaring -/// the variable. For example: -/// \code{.c} -/// int foo; -/// //^^^-- This is a declaration of foo -/// \endcode -/// \property Use : Contains the string that's to be used when using the -/// variable, such as: -/// \code{.c} -/// foo = bar + baz * bal; -/// // In this example foo, bar, baz and bal are "used" -/// \endcode -struct VariableTokens { -public: - tokenDefinition::types::StringToken Declaration; - tokenDefinition::types::StringToken Use; - -public: - VariableTokens() : Declaration(), Use() {} - VariableTokens(const ptml::Tag &Declaration, const ptml::Tag &Use) : - Declaration(Declaration.toString()), Use(Use.toString()) {} - VariableTokens(const llvm::StringRef Declaration, const llvm::StringRef Use) : - Declaration(Declaration), Use(Use) {} - VariableTokens(const llvm::StringRef Use) : Use(Use) {} - - bool hasDeclaration() const { return !Declaration.empty(); } -}; - -/// Addition to VariableTokens that also preserves the 'naked' variable name -/// in the \property VariableName -/// Used mainly with helper structs where the struct's name is otherwise not -/// trivially obtainable -struct VariableTokensWithName : public VariableTokens { -public: - tokenDefinition::types::StringToken VariableName; - -public: - template - VariableTokensWithName(const llvm::StringRef VariableName, - const T Declaration, - const T Use) : - VariableTokens(Declaration, Use), VariableName(VariableName) {} -}; diff --git a/lib/Backend/DecompileFunction.cpp b/lib/Backend/DecompileFunction.cpp index 97f686fa0..3cc329a19 100644 --- a/lib/Backend/DecompileFunction.cpp +++ b/lib/Backend/DecompileFunction.cpp @@ -88,7 +88,7 @@ namespace ranks = revng::ranks; namespace attributes = ptml::attributes; namespace tokens = ptml::c::tokens; -using tokenDefinition::types::StringToken; +using StringToken = llvm::SmallString<128>; using TokenMapT = std::map; using ModelTypesMap = std::map