Skip to content

Commit e08348f

Browse files
authored
Merge pull request #456 from secure-software-engineering/f-ClangTidyFixIDEXTaint
clang-tidy: Fix IDEXTaint
2 parents fcbfc99 + 4d9e949 commit e08348f

21 files changed

Lines changed: 171 additions & 176 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: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,17 @@ class AbstractMemoryLocationFactoryBase {
8989
const llvm::DataLayout *DL = nullptr;
9090

9191
const detail::AbstractMemoryLocationImpl *
92-
getOrCreateImpl(const llvm::Value *V, llvm::SmallVectorImpl<ptrdiff_t> &&Offs,
92+
getOrCreateImpl(const llvm::Value *V, llvm::ArrayRef<ptrdiff_t> Offs,
9393
unsigned BOUND);
9494

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);
100+
100101
[[nodiscard]] const AbstractMemoryLocationImpl *getOrCreateZeroImpl() const;
102+
101103
const AbstractMemoryLocationImpl *
102104
withIndirectionOfImpl(const AbstractMemoryLocationImpl *AML,
103105
llvm::ArrayRef<ptrdiff_t> Ind);
@@ -141,7 +143,7 @@ class AbstractMemoryLocationFactory<AbstractMemoryLocation>
141143
: public detail::AbstractMemoryLocationFactoryBase {
142144

143145
AbstractMemoryLocation limit(const AbstractMemoryLocation &AML) {
144-
return AbstractMemoryLocation(limitImpl(AML.operator->()));
146+
return {limitImpl(AML.operator->())};
145147
}
146148

147149
public:
@@ -156,12 +158,13 @@ class AbstractMemoryLocationFactory<AbstractMemoryLocation>
156158
AbstractMemoryLocationFactory &
157159
operator=(const AbstractMemoryLocationFactory &) = delete;
158160

159-
[[nodiscard]] AbstractMemoryLocation Create(const llvm::Value *V,
161+
[[nodiscard]] AbstractMemoryLocation create(const llvm::Value *V,
160162
unsigned BOUND) {
161-
return AbstractMemoryLocation(CreateImpl(V, BOUND));
163+
return {createImpl(V, BOUND)};
162164
}
163-
[[nodiscard]] AbstractMemoryLocation GetOrCreateZero() const {
164-
return AbstractMemoryLocation(getOrCreateZeroImpl());
165+
166+
[[nodiscard]] AbstractMemoryLocation getOrCreateZero() const {
167+
return {getOrCreateZeroImpl()};
165168
}
166169

167170
/// Creates a decendant AbstractMemoryLocation by adding an indirection
@@ -170,19 +173,19 @@ class AbstractMemoryLocationFactory<AbstractMemoryLocation>
170173
[[nodiscard]] AbstractMemoryLocation
171174
withIndirectionOf(const AbstractMemoryLocation &AML,
172175
llvm::ArrayRef<ptrdiff_t> Ind) {
173-
return AbstractMemoryLocation(withIndirectionOfImpl(AML.operator->(), Ind));
176+
return {withIndirectionOfImpl(AML.operator->(), Ind)};
174177
}
175178

176179
[[nodiscard]] AbstractMemoryLocation
177180
withOffset(const AbstractMemoryLocation &AML,
178181
const llvm::GetElementPtrInst *Gep) {
179-
return AbstractMemoryLocation(withOffsetImpl(AML.operator->(), Gep));
182+
return {withOffsetImpl(AML.operator->(), Gep)};
180183
}
181184

182185
[[nodiscard]] AbstractMemoryLocation
183186
withOffsets(const AbstractMemoryLocation &AML,
184187
llvm::ArrayRef<ptrdiff_t> Offs) {
185-
return AbstractMemoryLocation(withOffsetsImpl(AML.operator->(), Offs));
188+
return {withOffsetsImpl(AML.operator->(), Offs)};
186189
}
187190

188191
/// Transfers the taint from AML (source at the callsite) seen as From to To
@@ -191,8 +194,7 @@ class AbstractMemoryLocationFactory<AbstractMemoryLocation>
191194
[[nodiscard]] AbstractMemoryLocation
192195
withTransferTo(const AbstractMemoryLocation &AML,
193196
const AbstractMemoryLocation &From, const llvm::Value *To) {
194-
return AbstractMemoryLocation(
195-
withTransferToImpl(AML.operator->(), From.operator->(), To));
197+
return {withTransferToImpl(AML.operator->(), From.operator->(), To)};
196198
}
197199

198200
/// Transfers the taint from AML (source at the return-site) to To(at the
@@ -201,8 +203,7 @@ class AbstractMemoryLocationFactory<AbstractMemoryLocation>
201203
[[nodiscard]] AbstractMemoryLocation
202204
withTransferFrom(const AbstractMemoryLocation &AML,
203205
const AbstractMemoryLocation &To) {
204-
return AbstractMemoryLocation(
205-
withTransferFromImpl(AML.operator->(), To.operator->()));
206+
return {withTransferFromImpl(AML.operator->(), To.operator->())};
206207
}
207208
};
208209

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)