From 7a2e903e0a520933a44b24bd7517fa0f3f837ced Mon Sep 17 00:00:00 2001 From: 2over12 Date: Thu, 22 Sep 2022 13:54:01 -0400 Subject: [PATCH 1/2] dont assume added as function if no exception was thrown in decl case --- libraries/doctest/src | 1 + 1 file changed, 1 insertion(+) create mode 160000 libraries/doctest/src diff --git a/libraries/doctest/src b/libraries/doctest/src new file mode 160000 index 000000000..f0ab4e793 --- /dev/null +++ b/libraries/doctest/src @@ -0,0 +1 @@ +Subproject commit f0ab4e793fa863d4a5929ff263ddd3bebec8767e From d7eecbecee3279401fb62795be926a0a6e16dfea Mon Sep 17 00:00:00 2001 From: Francesco Bertolaccini Date: Fri, 23 Sep 2022 16:43:41 +0200 Subject: [PATCH 2/2] Store type string alongside LLVM types in spec --- include/anvill/Declarations.h | 6 ++++++ lib/JSON.cpp | 2 ++ 2 files changed, 8 insertions(+) diff --git a/include/anvill/Declarations.h b/include/anvill/Declarations.h index 537dac533..777fc7b1c 100644 --- a/include/anvill/Declarations.h +++ b/include/anvill/Declarations.h @@ -66,6 +66,9 @@ struct ValueDecl { // Type of this value. llvm::Type *type{nullptr}; + + // Untranslated type string of this value. + std::string type_string; }; // A value declaration corresponding with a named parameter. @@ -105,6 +108,9 @@ struct VariableDecl { // `0x14` there is also an `int`. llvm::Type *type{nullptr}; + // Untranslated type string of this variable. + std::string type_string; + // Address of this global variable. std::uint64_t address{0}; diff --git a/lib/JSON.cpp b/lib/JSON.cpp index 1dea0a896..3da895f9b 100644 --- a/lib/JSON.cpp +++ b/lib/JSON.cpp @@ -361,6 +361,7 @@ JSONTranslator::DecodeValue(const llvm::json::Object *obj, const char *desc, if (auto maybe_type_str = obj->getString("type")) { std::string spec = maybe_type_str->str(); + decl.type_string = spec; auto type_spec_res = type_translator.DecodeFromString(spec); if (!type_spec_res.Succeeded()) { std::stringstream ss; @@ -754,6 +755,7 @@ JSONTranslator::DecodeGlobalVar(const llvm::json::Object *obj) const { anvill::VariableDecl decl; decl.type = type; + decl.type_string = spec; decl.address = address; return decl; }