Commit Graph

6113 Commits

Author SHA1 Message Date
Pietro Fezzardi f0a6184ac0 Propagate DebugLoc on CallInst and InvokeInst
With llvm-12 thera are more stringent requirement on the propagation of
DebugLoc on CallInst and InvokeInst.
Various CallInst and InvokeInst created during lifting did not fulfill
these requirements, causing the Module to not verify() with llvm-12.

This commit fixes the problem, properly propagating the debug locations.
2021-06-14 23:04:02 +02:00
Pietro Fezzardi 544b553e5c JumpTargetManger: swap constprop with instsimplify
Constant propagation has been dropped from llvm
2021-06-14 23:04:02 +02:00
Pietro Fezzardi 2448fec4a5 AVI: use new LVI API 2021-06-14 23:04:02 +02:00
Pietro Fezzardi 1e5cce6654 AVI: handle new SCEVType in switch 2021-06-14 23:04:02 +02:00
Pietro Fezzardi 12364e6d63 Update BinaryFile to new llvm::object APIs
This is required to compile against llvm-12
2021-06-14 23:04:02 +02:00
Pietro Fezzardi d3d4e1ea5e JumpTargetManager.cpp: include missing header
Before the addition of this include, the file failed to compile with
llvm-12.
2021-06-14 23:04:02 +02:00
Pietro Fezzardi 370dfdaf13 Update InlineFunction API to LLVM-12 2021-06-14 23:04:02 +02:00
Pietro Fezzardi f8d20946d8 RecursiveCoroutine: add noexcept where needed
Fix compilation error: the expression 'co_await
__promise.final_suspend()' is required to be non-throwing

This compilation error started being triggered when switching to
clang-12.
2021-06-14 23:04:02 +02:00
Alessandro Di Federico 1c403b5dd8 Merge branch 'feature/improve-model' 2021-06-09 20:25:59 +02:00
Pietro Fezzardi a7a55f974a Require TupleTreeCompatible concept on TupleTree 2021-06-09 20:13:27 +02:00
Pietro Fezzardi 3cb6dcd163 Move IsYamlizable generic lambda in TupleTree.h 2021-06-09 20:13:27 +02:00
Pietro Fezzardi 75bff8f29c Move CompositeScalar in YAMLTraits.h
Soon Binary.h will not be the only user.
This commit makes the same machinery usable elsewhere.
2021-06-09 20:13:27 +02:00
Pietro Fezzardi c9b3cdd88b Fix UpcastablePointer copy/move ctor/assignment 2021-06-09 20:13:27 +02:00
Pietro Fezzardi 4b7f383ea5 Conceptify YAMLTraits.h 2021-06-09 20:13:27 +02:00
Pietro Fezzardi 432b75f2ba TupleTreePath.h: fix copy/move ctors/assignments 2021-06-09 20:13:27 +02:00
Pietro Fezzardi 8557a30206 TupleTree: improve serialization 2021-06-09 20:13:27 +02:00
Pietro Fezzardi 83a629444a Default operator== for TupleTreePath 2021-06-09 20:13:27 +02:00
Pietro Fezzardi b78d52ac3c Add TupleTreeReference::operator==, ignoring Root 2021-06-09 20:13:27 +02:00
Pietro Fezzardi 88a48015dc TupleTree.h: require IsKeyedObjectContainer
Requires IsKeyedObjectContainer in TupleTree.h wherever possible,
instead of IsContainer. This enables using std::vectors.
In this way, they will not be diffed based on the key, but on the entire
vector. This is intended.
2021-06-09 20:13:27 +02:00
Pietro Fezzardi 0a293b5881 CallByPathVisitorWithInstance on UpcastablePointer
Add a specialization for
CallByPathVisitorWithInstance::visitContainerElement to handle cases
where the element of the container is an UpcastablePointer, that needs
to be unwrapped before visiting.

This fixes a problem causing bad TupleTree traversal with
TupleTreeReference. Specifically, CallByPathVisitorWithInstance did not
know how to visitContainerElement when the element of the container was
an UpcastablePointer. This caused the visit to always return nullptr
even when the TupleTreeReference was well-formed. This has been fixed by
adding an overload with proper concept constraint, that teaches
CallByPathVisitorWithInstance how to properly traverse
UpcastablePointers.
2021-06-09 20:13:27 +02:00
Pietro Fezzardi baeae84c65 UpcastablePointer: use std::is_void 2021-06-09 20:13:27 +02:00
Pietro Fezzardi b4395794dd KeyedObjectTraits: drop useless template parameter
The second template parameter, defaulted to void, was only used for
SFINAE with enable_if. Now that all uses of enable_if are gone replaced
by concepts, this parameter does not serve any purpose anymore.
2021-06-09 20:13:27 +02:00
Filippo Cremonese 478baf1f43 Fix use-after-free in InstructionTranslator 2021-06-09 18:42:56 +02:00
Filippo Cremonese 5004ec789e Fix multiple cppcoro issues
* Assert that the coroutine has reached its final suspension point
  when the destructor is called.
* Ensure the move assignment operator takes an rvalue reference.
* Explicitly delete the copy assignment operator.
2021-06-09 18:42:34 +02:00
Antonio Frighetto 1e68b6e665 EnforceABI: drop handleRoot
Unmaintained code has been removed.
2021-06-09 18:39:43 +02:00
Antonio Frighetto 67b6bc491b BinaryFile: always relocate addresses
Always relocating addresses allows to include symbols on
dynamically linked position independent objects as well.
2021-06-09 18:15:16 +02:00
Matteo Giordano 04c5b5c5c3 MetaAddress.cpp: fix on fields processing order
Adjusted methods `MetaAddress::toConstant()` and
`MetaAddress::fromConstant()` in processing the order of MetaAddress
field.
2021-06-09 18:14:16 +02:00
Ivan Krysak bc8c8f82d2 Prevent separation of 'main' headers into group 0
The prevention mechanism uses a dummy suffix:
'_THIS_SEQUENCE_IS_NEVER_GOING_TO_HAPPEN'.
2021-06-09 18:05:20 +02:00
Pietro Fezzardi dfd81a017d Use std::has_single_bit and std::bit_ceil 2021-06-09 14:37:37 +02:00
Ivan Krysak 2e214bc661 Add an include category for Qt headers 2021-06-08 17:03:58 +02:00
Pietro Fezzardi 260df31adc ASTBuildAnalysis.cpp: fix emission of ternary 2021-05-31 12:23:32 +02:00
Pietro Fezzardi 65907f892f decompileFunction: add pass required by llvm-12 2021-05-28 17:45:59 +02:00
Pietro Fezzardi 2fea7e3076 TypeFlowGraphWriter: update to llvm-12 API 2021-05-27 17:14:25 +02:00
Pietro Fezzardi 36e42855a5 PromoteStackPointer.cpp: fix deprecated include
This caused compilation error with llvm-12.
2021-05-27 17:14:25 +02:00
Pietro Fezzardi 9d3216970a IRASTTypeTranslation: handle new llvm-12 types 2021-05-27 17:14:25 +02:00
Pietro Fezzardi dde8af9b53 GenerateAst.h: update DomTree API for children
The old getChildren API is gone in llvm-12.
2021-05-27 17:14:25 +02:00
Pietro Fezzardi 80f1e2fd6d Explictly convert llvm::StringRef to std::string
Implicit conversion is not available anymore in llvm-12.
2021-05-27 17:14:25 +02:00
Pietro Fezzardi a5b42ea913 DLATypeSystem.cpp: update scc_iterator API 2021-05-27 17:14:25 +02:00
Pietro Fezzardi a63d1768ee DLACreateIntraProceduralTypes: add missing include 2021-05-27 17:14:25 +02:00
Pietro Fezzardi 8494034931 ASTBuildAnalysis.cpp: explicitly handle new kinds 2021-05-27 17:14:25 +02:00
Pietro Fezzardi 73ee5e8c34 Update to clang-12 API for AST creation 2021-05-27 17:14:25 +02:00
Pietro Fezzardi 798ea21963 Replace constprop with instsimplify
Constant Propagation has been dropped by llvm-12
2021-05-27 16:07:49 +02:00
Pietro Fezzardi edc2fe5c84 DLAPass.h: remove deprecated include
This caused compilation error with llvm-12
2021-05-27 15:06:38 +02:00
Pietro Fezzardi 3436ed4125 DLATypeSystem.h: add missing include
This was causing compilation error with llvm-12
2021-05-27 15:04:03 +02:00
Alvise de Faveri e8dfaa3a86 DLA: Fix missing AccessLayout field in structs
The BaseLayout should be the fist field of each StructLayout, but it
is never really added.
2021-05-21 18:50:58 +02:00
Pietro Fezzardi 13170f0a2a DLARemoveTransitiveInheritanceEdges: fix UAF
Accessing NextChildPos is not safe if Pushed is true.
This commit switches the conditions so that NextChildPos is never
accessed unsafely thanks to short-circuiting.
This fixes a use-after-free bug, that was activate when calling tryPush
triggered realloc on the Stack.
2021-05-19 10:31:07 +02:00
Pietro Fezzardi 7b59291576 Add custom destructor for dla::LayoutTypeSystem
This prevents from leaking nodes when destroying the LayoutTypeSystem
itself.
2021-05-19 10:31:07 +02:00
Pietro Fezzardi e4c857185f LayoutTypeSystem: fix memory leak
Not calling the destructor of LayoutTypeSystemNode before their
deallocation was leaking pairs of Successors and Predecessors.

This commit fixes it by explicitly destructing LayoutTypeSystemNodes.
2021-05-19 10:31:07 +02:00
Pietro Fezzardi 7d4a1ba467 DLATypeSystem: fix use-after-poison false positive
This commit fixes a use-after-poison false-positive report from ASAN.

This was due to misuse of SpecificBumpPtrAllocator together with
__asan_poison_memory_region.
The region was poisoned but not deallocated, which caused a the false
positive when trying to destroy and deallocate it in the destructor of
LayoutTypeSystem.

This was fixed by switching to plain BumpPtrAllocator, and properly
calling the Deallocate method, which wraps its own battle-tested ASAN
logic.
2021-05-18 12:15:53 +02:00
Pietro Fezzardi af8a47fe93 test_reachabilitypass: fix memory leak 2021-05-18 11:46:01 +02:00