|
27 | 27 |
|
28 | 28 | #include "phasar/Utils/LLVMIRToSrc.h" |
29 | 29 | #include "phasar/Utils/LLVMShorthands.h" |
| 30 | +#include "phasar/Utils/LLVMCXXShorthands.h" |
30 | 31 | #include "phasar/Utils/Logger.h" |
31 | 32 | #include "phasar/Utils/PAMMMacros.h" |
32 | 33 | #include "phasar/Utils/Utilities.h" |
@@ -55,37 +56,10 @@ IFDSConstAnalysis::getNormalFlowFunction(IFDSConstAnalysis::n_t Curr, |
55 | 56 | if (const auto *Store = llvm::dyn_cast<llvm::StoreInst>(Curr)) { |
56 | 57 | // If the store instruction sets up or updates the vtable, i.e. value |
57 | 58 | // operand is vtable pointer, ignore it! |
58 | | - // Setting up the vtable is counted towards the initialization of an |
59 | | - // object - the object stays immutable. |
60 | | - // To identifiy such a store instruction, we need to check the stored |
61 | | - // value, which is of i32 (...)** type, e.g. |
62 | | - // i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* |
63 | | - // @_ZTV5Child, i32 0, i32 2) to i32 (...)**) |
64 | | - // |
65 | | - // WARNING: The VTT could also be stored, which would make this analysis |
66 | | - // fail |
67 | | - if (const auto *CE = |
68 | | - llvm::dyn_cast<llvm::ConstantExpr>(Store->getValueOperand())) { |
69 | | - // llvm::ConstantExpr *CE = const_cast<llvm::ConstantExpr *>(ConstCE); |
70 | | - std::unique_ptr<llvm::Instruction, decltype(&deleteValue)> CEInst( |
71 | | - CE->getAsInstruction(), &deleteValue); |
72 | | - if (auto *CF = |
73 | | - llvm::dyn_cast<llvm::ConstantExpr>(CEInst->getOperand(0))) { |
74 | | - std::unique_ptr<llvm::Instruction, decltype(&deleteValue)> CFInst( |
75 | | - CF->getAsInstruction(), &deleteValue); |
76 | | - if (auto *VTable = |
77 | | - llvm::dyn_cast<llvm::GlobalVariable>(CFInst->getOperand(0))) { |
78 | | - if (VTable->hasName() && |
79 | | - llvm::demangle(VTable->getName().str()).find("vtable") != |
80 | | - string::npos) { |
81 | | - LOG_IF_ENABLE( |
82 | | - BOOST_LOG_SEV(lg::get(), DEBUG) |
83 | | - << "Store Instruction sets up or updates vtable - ignored!"); |
84 | | - return Identity<IFDSConstAnalysis::d_t>::getInstance(); |
85 | | - } |
86 | | - } |
87 | | - } |
88 | | - } /* end vtable set-up instruction */ |
| 59 | + if (isTouchVTableInst(Store)) { |
| 60 | + return Identity<IFDSConstAnalysis::d_t>::getInstance(); |
| 61 | + } |
| 62 | + |
89 | 63 | IFDSConstAnalysis::d_t PointerOp = Store->getPointerOperand(); |
90 | 64 | LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) |
91 | 65 | << "Pointer operand of store Instruction: " |
|
0 commit comments