Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,12 @@ namespace llvm {

template <> struct DenseMapInfo<psr::AbstractMemoryLocation> {
static inline psr::AbstractMemoryLocation getEmptyKey() {
return psr::AbstractMemoryLocation(
DenseMapInfo<psr::detail::AbstractMemoryLocationImpl *>::getEmptyKey());
return {
DenseMapInfo<psr::detail::AbstractMemoryLocationImpl *>::getEmptyKey()};
}
static inline psr::AbstractMemoryLocation getTombstoneKey() {
return psr::AbstractMemoryLocation(
DenseMapInfo<
psr::detail::AbstractMemoryLocationImpl *>::getTombstoneKey());
return {DenseMapInfo<
psr::detail::AbstractMemoryLocationImpl *>::getTombstoneKey()};
}
static unsigned getHashValue(psr::AbstractMemoryLocation Val) {
return hash_value(Val);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,17 @@ class AbstractMemoryLocationFactoryBase {
const llvm::DataLayout *DL = nullptr;

const detail::AbstractMemoryLocationImpl *
getOrCreateImpl(const llvm::Value *V, llvm::SmallVectorImpl<ptrdiff_t> &&Offs,
getOrCreateImpl(const llvm::Value *V, llvm::ArrayRef<ptrdiff_t> Offs,
unsigned BOUND);

const detail::AbstractMemoryLocationImpl *
getOrCreateImpl(const llvm::Value *V, unsigned BOUND);

const AbstractMemoryLocationImpl *CreateImpl(const llvm::Value *V,
const AbstractMemoryLocationImpl *createImpl(const llvm::Value *V,
unsigned BOUND);

[[nodiscard]] const AbstractMemoryLocationImpl *getOrCreateZeroImpl() const;

const AbstractMemoryLocationImpl *
withIndirectionOfImpl(const AbstractMemoryLocationImpl *AML,
llvm::ArrayRef<ptrdiff_t> Ind);
Expand Down Expand Up @@ -141,7 +143,7 @@ class AbstractMemoryLocationFactory<AbstractMemoryLocation>
: public detail::AbstractMemoryLocationFactoryBase {

AbstractMemoryLocation limit(const AbstractMemoryLocation &AML) {
return AbstractMemoryLocation(limitImpl(AML.operator->()));
return {limitImpl(AML.operator->())};
}

public:
Expand All @@ -156,12 +158,13 @@ class AbstractMemoryLocationFactory<AbstractMemoryLocation>
AbstractMemoryLocationFactory &
operator=(const AbstractMemoryLocationFactory &) = delete;

[[nodiscard]] AbstractMemoryLocation Create(const llvm::Value *V,
[[nodiscard]] AbstractMemoryLocation create(const llvm::Value *V,
unsigned BOUND) {
return AbstractMemoryLocation(CreateImpl(V, BOUND));
return {createImpl(V, BOUND)};
}
[[nodiscard]] AbstractMemoryLocation GetOrCreateZero() const {
return AbstractMemoryLocation(getOrCreateZeroImpl());

[[nodiscard]] AbstractMemoryLocation getOrCreateZero() const {
return {getOrCreateZeroImpl()};
}

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

[[nodiscard]] AbstractMemoryLocation
withOffset(const AbstractMemoryLocation &AML,
const llvm::GetElementPtrInst *Gep) {
return AbstractMemoryLocation(withOffsetImpl(AML.operator->(), Gep));
return {withOffsetImpl(AML.operator->(), Gep)};
}

[[nodiscard]] AbstractMemoryLocation
withOffsets(const AbstractMemoryLocation &AML,
llvm::ArrayRef<ptrdiff_t> Offs) {
return AbstractMemoryLocation(withOffsetsImpl(AML.operator->(), Offs));
return {withOffsetsImpl(AML.operator->(), Offs)};
}

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

/// Transfers the taint from AML (source at the return-site) to To(at the
Expand All @@ -201,8 +203,7 @@ class AbstractMemoryLocationFactory<AbstractMemoryLocation>
[[nodiscard]] AbstractMemoryLocation
withTransferFrom(const AbstractMemoryLocation &AML,
const AbstractMemoryLocation &To) {
return AbstractMemoryLocation(
withTransferFromImpl(AML.operator->(), To.operator->()));
return {withTransferFromImpl(AML.operator->(), To.operator->())};
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ComposeEdgeFunction : public EdgeFunctionBase {
llvm::hash_code getHashCode() const override;

static inline bool classof(const EdgeFunctionBase *EF) {
return EF->getKind() == Kind::Compose;
return EF->getKind() == EFKind::Compose;
}
};
} // namespace psr::XTaint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class GenEdgeFunction : public EdgeFunctionBase {
inline const llvm::Instruction *getSanitizer() const { return Sani; }

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

llvm::hash_code getHashCode() const override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ EdgeFunction<EdgeDomain>::EdgeFunctionPtrType getAllSanitized();
/// Have an own function for creating a flow/edge-function instance to allow
/// fast migration to memory-management schemes other than std::shared_ptr
template <typename FlowFunctionTy, typename... Args>
inline std::shared_ptr<FlowFunctionTy> makeFF(Args &&...args) {
return std::make_shared<FlowFunctionTy>(std::forward<Args>(args)...);
inline std::shared_ptr<FlowFunctionTy> makeFF(Args &&...Arguments) {
return std::make_shared<FlowFunctionTy>(std::forward<Args>(Arguments)...);
}
template <typename EdgeFunctionTy, typename... Args>
inline std::shared_ptr<EdgeFunctionTy> makeEF(Args &&...args) {
return std::make_shared<EdgeFunctionTy>(std::forward<Args>(args)...);
inline std::shared_ptr<EdgeFunctionTy> makeEF(Args &&...Arguments) {
return std::make_shared<EdgeFunctionTy>(std::forward<Args>(Arguments)...);
}

} // namespace psr::XTaint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class JoinConstEdgeFunction : public EdgeFunctionBase {
llvm::hash_code getHashCode() const override;

inline static bool classof(const EdgeFunctionBase *EF) {
return EF->getKind() == Kind::JoinConst;
return EF->getKind() == EFKind::JoinConst;
}
};
} // namespace psr::XTaint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class JoinEdgeFunction : public EdgeFunctionBase {
llvm::hash_code getHashCode() const override;

static inline bool classof(const EdgeFunctionBase *EF) {
return EF->getKind() == Kind::Join;
return EF->getKind() == EFKind::Join;
}
};
} // namespace psr::XTaint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class KillIfSanitizedEdgeFunction : public EdgeFunctionBase {
llvm::hash_code getHashCode() const override;

inline static bool classof(const EdgeFunctionBase *EF) {
return EF->getKind() == Kind::KillIfSani;
return EF->getKind() == EFKind::KillIfSani;
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@ namespace psr::XTaint {
class EdgeFunctionBase : public EdgeFunction<EdgeDomain>,
public std::enable_shared_from_this<EdgeFunctionBase> {
public:
enum class Kind { Gen, Join, JoinConst, Compose, KillIfSani, Transfer };
enum class EFKind { Gen, Join, JoinConst, Compose, KillIfSani, Transfer };

protected:
BasicBlockOrdering &BBO;

private:
const Kind kind;
const EFKind Kind;

public:
using l_t = EdgeDomain;

EdgeFunctionBase(Kind Kind, BasicBlockOrdering &BBO);
EdgeFunctionBase(EFKind Kind, BasicBlockOrdering &BBO);
~EdgeFunctionBase() override = default;

EdgeFunctionPtrType composeWith(EdgeFunctionPtrType SecondFunction) override;
EdgeFunctionPtrType joinWith(EdgeFunctionPtrType OtherFunction) override;

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

virtual llvm::hash_code getHashCode() const = 0;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class IDEExtendedTaintAnalysis
DL((*IRDB->getAllModules().begin())->getDataLayout()), Bound(Bound),
PostProcessed(DisableStrongUpdates),
DisableStrongUpdates(DisableStrongUpdates) {
base_t::ZeroValue = createZeroValue();
base_t::ZeroValue = IDEExtendedTaintAnalysis::createZeroValue();

FactFactory.setDataLayout(DL);

Expand Down
4 changes: 2 additions & 2 deletions include/phasar/Utils/Utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ template <typename Fn> class scope_exit {
template <typename Fn> scope_exit(Fn) -> scope_exit<Fn>;

// Copied from "https://en.cppreference.com/w/cpp/utility/variant/visit"
template <class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
template <class... Ts> struct Overloaded : Ts... { using Ts::operator()...; };

// explicit deduction guide (not needed as of C++20)
template <class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
template <class... Ts> Overloaded(Ts...) -> Overloaded<Ts...>;

/// Based on the reference implementation of std::remove_if
/// "https://en.cppreference.com/w/cpp/algorithm/remove" and optimized for the
Expand Down
Loading