Skip to content

Commit 42f91ce

Browse files
Martin Moryvulder
authored andcommitted
various fixes in IDEExtendedTaintAnalysis
1 parent 70fb317 commit 42f91ce

21 files changed

Lines changed: 144 additions & 135 deletions

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/ExtendedTaintAnalysis/AbstractMemoryLocation.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,12 @@ namespace llvm {
214214

215215
template <> struct DenseMapInfo<psr::AbstractMemoryLocation> {
216216
static inline psr::AbstractMemoryLocation getEmptyKey() {
217-
return psr::AbstractMemoryLocation(
218-
DenseMapInfo<psr::detail::AbstractMemoryLocationImpl *>::getEmptyKey());
217+
return {
218+
DenseMapInfo<psr::detail::AbstractMemoryLocationImpl *>::getEmptyKey()};
219219
}
220220
static inline psr::AbstractMemoryLocation getTombstoneKey() {
221-
return psr::AbstractMemoryLocation(
222-
DenseMapInfo<
223-
psr::detail::AbstractMemoryLocationImpl *>::getTombstoneKey());
221+
return {DenseMapInfo<
222+
psr::detail::AbstractMemoryLocationImpl *>::getTombstoneKey()};
224223
}
225224
static unsigned getHashValue(psr::AbstractMemoryLocation Val) {
226225
return hash_value(Val);

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/ExtendedTaintAnalysis/AbstractMemoryLocationFactory.h

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class AbstractMemoryLocationFactoryBase {
9595
const detail::AbstractMemoryLocationImpl *
9696
getOrCreateImpl(const llvm::Value *V, unsigned BOUND);
9797

98-
const AbstractMemoryLocationImpl *CreateImpl(const llvm::Value *V,
98+
const AbstractMemoryLocationImpl *createImpl(const llvm::Value *V,
9999
unsigned BOUND);
100100
const AbstractMemoryLocationImpl *GetOrCreateZeroImpl() const;
101101
const AbstractMemoryLocationImpl *
@@ -141,7 +141,7 @@ class AbstractMemoryLocationFactory<AbstractMemoryLocation>
141141
: public detail::AbstractMemoryLocationFactoryBase {
142142

143143
AbstractMemoryLocation limit(const AbstractMemoryLocation &AML) {
144-
return AbstractMemoryLocation(limitImpl(AML.operator->()));
144+
return {limitImpl(AML.operator->())};
145145
}
146146

147147
public:
@@ -156,12 +156,12 @@ class AbstractMemoryLocationFactory<AbstractMemoryLocation>
156156
AbstractMemoryLocationFactory &
157157
operator=(const AbstractMemoryLocationFactory &) = delete;
158158

159-
[[nodiscard]] AbstractMemoryLocation Create(const llvm::Value *V,
159+
[[nodiscard]] AbstractMemoryLocation create(const llvm::Value *V,
160160
unsigned BOUND) {
161-
return AbstractMemoryLocation(CreateImpl(V, BOUND));
161+
return {createImpl(V, BOUND)};
162162
}
163-
[[nodiscard]] AbstractMemoryLocation GetOrCreateZero() const {
164-
return AbstractMemoryLocation(GetOrCreateZeroImpl());
163+
[[nodiscard]] AbstractMemoryLocation getOrCreateZero() const {
164+
return {getOrCreateZeroImpl()};
165165
}
166166

167167
/// Creates a decendant AbstractMemoryLocation by adding an indirection
@@ -170,19 +170,19 @@ class AbstractMemoryLocationFactory<AbstractMemoryLocation>
170170
[[nodiscard]] AbstractMemoryLocation
171171
withIndirectionOf(const AbstractMemoryLocation &AML,
172172
llvm::ArrayRef<ptrdiff_t> Ind) {
173-
return AbstractMemoryLocation(withIndirectionOfImpl(AML.operator->(), Ind));
173+
return {withIndirectionOfImpl(AML.operator->(), Ind)};
174174
}
175175

176176
[[nodiscard]] AbstractMemoryLocation
177177
withOffset(const AbstractMemoryLocation &AML,
178178
const llvm::GetElementPtrInst *Gep) {
179-
return AbstractMemoryLocation(withOffsetImpl(AML.operator->(), Gep));
179+
return {withOffsetImpl(AML.operator->(), Gep)};
180180
}
181181

182182
[[nodiscard]] AbstractMemoryLocation
183183
withOffsets(const AbstractMemoryLocation &AML,
184184
llvm::ArrayRef<ptrdiff_t> Offs) {
185-
return AbstractMemoryLocation(withOffsetsImpl(AML.operator->(), Offs));
185+
return {withOffsetsImpl(AML.operator->(), Offs)};
186186
}
187187

188188
/// Transfers the taint from AML (source at the callsite) seen as From to To
@@ -191,8 +191,7 @@ class AbstractMemoryLocationFactory<AbstractMemoryLocation>
191191
[[nodiscard]] AbstractMemoryLocation
192192
withTransferTo(const AbstractMemoryLocation &AML,
193193
const AbstractMemoryLocation &From, const llvm::Value *To) {
194-
return AbstractMemoryLocation(
195-
withTransferToImpl(AML.operator->(), From.operator->(), To));
194+
return {withTransferToImpl(AML.operator->(), From.operator->(), To)};
196195
}
197196

198197
/// Transfers the taint from AML (source at the return-site) to To(at the
@@ -201,8 +200,7 @@ class AbstractMemoryLocationFactory<AbstractMemoryLocation>
201200
[[nodiscard]] AbstractMemoryLocation
202201
withTransferFrom(const AbstractMemoryLocation &AML,
203202
const AbstractMemoryLocation &To) {
204-
return AbstractMemoryLocation(
205-
withTransferFromImpl(AML.operator->(), To.operator->()));
203+
return {withTransferFromImpl(AML.operator->(), To.operator->())};
206204
}
207205
};
208206

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/ExtendedTaintAnalysis/ComposeEdgeFunction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ComposeEdgeFunction : public EdgeFunctionBase {
2929
llvm::hash_code getHashCode() const override;
3030

3131
static inline bool classof(const EdgeFunctionBase *EF) {
32-
return EF->getKind() == Kind::Compose;
32+
return EF->getKind() == EFKind::Compose;
3333
}
3434
};
3535
} // namespace psr::XTaint

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/ExtendedTaintAnalysis/GenEdgeFunction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class GenEdgeFunction : public EdgeFunctionBase {
3636
inline const llvm::Instruction *getSanitizer() const { return Sani; }
3737

3838
static inline bool classof(const EdgeFunctionBase *EF) {
39-
return EF->getKind() == Kind::Gen;
39+
return EF->getKind() == EFKind::Gen;
4040
}
4141

4242
llvm::hash_code getHashCode() const override;

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/ExtendedTaintAnalysis/Helpers.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ EdgeFunction<EdgeDomain>::EdgeFunctionPtrType getAllSanitized();
5454
/// Have an own function for creating a flow/edge-function instance to allow
5555
/// fast migration to memory-management schemes other than std::shared_ptr
5656
template <typename FlowFunctionTy, typename... Args>
57-
inline std::shared_ptr<FlowFunctionTy> makeFF(Args &&...args) {
58-
return std::make_shared<FlowFunctionTy>(std::forward<Args>(args)...);
57+
inline std::shared_ptr<FlowFunctionTy> makeFF(Args &&...Arguments) {
58+
return std::make_shared<FlowFunctionTy>(std::forward<Args>(Arguments)...);
5959
}
6060
template <typename EdgeFunctionTy, typename... Args>
61-
inline std::shared_ptr<EdgeFunctionTy> makeEF(Args &&...args) {
62-
return std::make_shared<EdgeFunctionTy>(std::forward<Args>(args)...);
61+
inline std::shared_ptr<EdgeFunctionTy> makeEF(Args &&...Arguments) {
62+
return std::make_shared<EdgeFunctionTy>(std::forward<Args>(Arguments)...);
6363
}
6464

6565
} // namespace psr::XTaint

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/ExtendedTaintAnalysis/JoinConstEdgeFunction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class JoinConstEdgeFunction : public EdgeFunctionBase {
3636
llvm::hash_code getHashCode() const override;
3737

3838
inline static bool classof(const EdgeFunctionBase *EF) {
39-
return EF->getKind() == Kind::JoinConst;
39+
return EF->getKind() == EFKind::JoinConst;
4040
}
4141
};
4242
} // namespace psr::XTaint

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/ExtendedTaintAnalysis/JoinEdgeFunction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class JoinEdgeFunction : public EdgeFunctionBase {
8888
llvm::hash_code getHashCode() const override;
8989

9090
static inline bool classof(const EdgeFunctionBase *EF) {
91-
return EF->getKind() == Kind::Join;
91+
return EF->getKind() == EFKind::Join;
9292
}
9393
};
9494
} // namespace psr::XTaint

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/ExtendedTaintAnalysis/KillIfSanitizedEdgeFunction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class KillIfSanitizedEdgeFunction : public EdgeFunctionBase {
3333
llvm::hash_code getHashCode() const override;
3434

3535
inline static bool classof(const EdgeFunctionBase *EF) {
36-
return EF->getKind() == Kind::KillIfSani;
36+
return EF->getKind() == EFKind::KillIfSani;
3737
}
3838
};
3939

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/ExtendedTaintAnalysis/XTaintEdgeFunctionBase.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,25 @@ namespace psr::XTaint {
2525
class EdgeFunctionBase : public EdgeFunction<EdgeDomain>,
2626
public std::enable_shared_from_this<EdgeFunctionBase> {
2727
public:
28-
enum class Kind { Gen, Join, JoinConst, Compose, KillIfSani, Transfer };
28+
enum class EFKind { Gen, Join, JoinConst, Compose, KillIfSani, Transfer };
2929

3030
protected:
3131
BasicBlockOrdering &BBO;
3232

3333
private:
34-
const Kind kind;
34+
const EFKind Kind;
3535

3636
public:
3737
using l_t = EdgeDomain;
3838

39-
EdgeFunctionBase(Kind Kind, BasicBlockOrdering &BBO);
39+
EdgeFunctionBase(EFKind Kind, BasicBlockOrdering &BBO);
4040
~EdgeFunctionBase() override = default;
4141

4242
EdgeFunctionPtrType composeWith(EdgeFunctionPtrType SecondFunction) override;
4343
EdgeFunctionPtrType joinWith(EdgeFunctionPtrType OtherFunction) override;
4444

4545
/// The actualy kind of this edge function. Can be used in a type-switch.
46-
[[nodiscard]] inline Kind getKind() const { return kind; }
46+
[[nodiscard]] inline EFKind getKind() const { return Kind; }
4747

4848
virtual llvm::hash_code getHashCode() const = 0;
4949
};

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDEExtendedTaintAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class IDEExtendedTaintAnalysis
199199
DL((*IRDB->getAllModules().begin())->getDataLayout()), Bound(Bound),
200200
PostProcessed(DisableStrongUpdates),
201201
DisableStrongUpdates(DisableStrongUpdates) {
202-
base_t::ZeroValue = createZeroValue();
202+
base_t::ZeroValue = IDEExtendedTaintAnalysis::createZeroValue();
203203

204204
FactFactory.setDataLayout(DL);
205205

0 commit comments

Comments
 (0)