38 Commits

Author SHA1 Message Date
Pietro Fezzardi 58e95d330f Drop assign_array macro
The macro is no longer necessary: the code now ensures we never
need to assign anything to an array, which would be ill-advised
nevertheless given that array-typed rvalues in C immediately
decay to pointers.
2026-05-08 11:37:10 +02:00
Pietro Fezzardi 85a9780d28 Drop bit_cast_to_array macro
The macro is no longer necessary: the code now ensures we never
need to bitcast anything to an array, which would be ill-advised
nevertheless given that array-typed rvalues in C immediately
decay to pointers.
2026-05-08 11:37:10 +02:00
Pietro Fezzardi 0251ddd37d Add assign_array and bit_cast_to_array
assign_array is necessary as a fallback for when the decompiled C
code may need assignments among array types. bit_cast_to_array is
necessary because when the target type of a bitcast is an array
the regular bit_cast macro is not enough.
2026-05-08 11:37:10 +02:00
Pietro Fezzardi 3bf02e6f60 Unify implementation of bit_cast, requiring typeof
Rework primitive-types.h so that the various bit_cast macros share
a single implementation based on `typeof`/`__typeof__`. As a
consequence both keywords are added to the model's reserved-name
set so that user identifiers cannot collide with them.
2026-05-08 11:37:10 +02:00
Pietro Fezzardi 21063f1844 NameBuilder: support opaque types
Teach NameBuilder and ModelCBuilder how to produce names and
references for opaque-array types: NameBuilder gains
opaqueTypeName(ByteSize), ModelCBuilder gains the matching
reference and definition tags. Both rely on the new
Configuration::OpaqueTypePrefix.
2026-05-08 11:37:10 +02:00
Lauri Vasama a37f3195d9 Homogenize static assertions in primitive-types.h 2026-04-08 11:12:41 +03:00
Lauri Vasama b062b23ad6 Include stddef.h in primitive-types.h 2026-04-08 11:12:41 +03:00
Ivan Krysak 729b025de3 CAttributes.h: move back to PTML
When `revng` and `revng-c` were being merged, this header founds its
way into `revngSupport` even though it makes more sense under the PTML
umbrella.
2026-03-27 07:19:27 +00:00
Ivan Krysak e706628a49 Rename Annotations.h into CAttributes.h 2026-03-27 07:19:27 +00:00
Ivan Krysak 7501ef998b NameBuilder: unconditionally ban some prefixes 2026-02-25 12:47:27 +01:00
Giacomo Vercesi 27f419c8cd Fix and ban namespace clobbering
Fix an instance where the `std` namespace got clobbered into the global
namespace by accident.
2026-02-16 10:34:38 +01:00
Lauri Vasama cb95b94785 Rename StackFrameVariableName 2026-02-13 08:41:39 +02:00
Alessandro Di Federico 5820908675 Remove and ban \file 2025-12-16 17:41:55 +01:00
Lauri Vasama d4114ae188 Implement bit_cast in Clift backend 2025-12-05 19:53:41 +02:00
Lauri Vasama bf5adce413 Overhaul Clift loop syntax, add break/continue 2025-10-21 09:15:40 +02:00
Ivan Krysak ecb9d76c64 Model: drop obsolete default value handling 2025-10-13 18:33:10 +03:00
Ivan Krysak 89282f31da Minor improvements 2025-10-13 18:33:10 +03:00
Lauri Vasama 653d451e6c Remove undef name configuration support
Also adds a model migration removing
Configuration.Naming.UndefinedValuePrefix.
2025-09-29 18:05:55 +03:00
Ivan Krysak b982ae68d0 NamingConfiguration: add UnnamedGotoLabelPrefix 2025-07-23 11:38:50 +02:00
Lauri Vasama a7eb86174b Add revng/Support/Identifier.h for id validation 2025-06-04 15:13:47 +02:00
Pietro Fezzardi 0426c773b2 CABIFunctionDefinition: drop array argument/return
This commit bans from the model array types in as argument or return
types in CABIFunctionDefinition.
CABIFunctionDefinition implies we're decompiling towards C, and C does
not support array arguments (passed by copy) nor array return types.

Banning these from the model reduces the number of situations where we
have to emit artificial array wrappers (not present in the model) around
types when printing C code, simplifying the handling of such situations
when translating to clift and in general in the decompilation pipeline.
2025-05-28 17:11:11 +02:00
Ivan Krysak 1622bb91a1 Introduce automatic names for dynamic functions 2025-04-24 13:22:14 +02:00
Ivan Krysak 79964eac74 Avoid ' misuse in error messages and comments 2025-04-17 16:41:21 +02:00
Ivan Krysak 83324fcf07 NameBuilder: improve documentation 2025-04-17 11:19:17 +03:00
Ivan Krysak e96e64f035 CNameBuilder: ban known llvm intrinsic names 2025-04-17 11:19:17 +03:00
Ivan Krysak 29554ef303 CNameBuilder: ban known helper names 2025-04-17 11:19:17 +03:00
Ivan Krysak 57b5eb7f98 NameBuilder: allow different name checkers 2025-04-17 11:19:17 +03:00
Ivan Krysak c9ade8d458 NameBuilder: report reason when renaming something 2025-04-17 11:19:17 +03:00
Ivan Krysak 355d4f634c NameBuilder: prevent collisions with macros 2025-04-17 11:19:17 +03:00
Ivan Krysak dce5c1a02c NamingConfiguration: pull more prefixes inside
Unify additional values that used to be hardcoded in the old backend
under the same naming configuration root.
2025-04-17 11:19:17 +03:00
Ivan Krysak af79a289d8 NamingConfiguration: add a new option
It's `ReserveNamesStartingWithUnderscore`.
2025-04-17 11:19:17 +03:00
Ivan Krysak 645cf7fc2e NameBuilder: sunset deduplication
This reworks NameBuilder to ease the transition to the system where
the model will be guaranteed to never contain any name collisions, both
between user-specified names and the automatic ones.
2025-04-15 16:35:42 +03:00
Ivan Krysak 6710dacfed Model: give path helpers a home 2025-04-15 16:35:42 +03:00
Ivan Krysak 705e4a5955 auto [...] -> auto &&[...] 2025-02-13 13:10:51 +02:00
Ivan Krysak 6c43cebc90 Model: let VerifyHelper depend on NameBuilder 2025-02-13 13:09:50 +02:00
Lauri Vasama 814e025ee2 Remove moves before return in NameBuilder.cpp 2025-01-02 11:25:32 +02:00
Ivan Krysak 672ee5df50 Replace std::string_view with llvm::StringRef 2024-11-06 15:43:13 +02:00
Ivan Krysak ad868f57ad Model: introduce name builder 2024-11-06 15:43:13 +02:00