Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c95a419
Add alloc-sites-aware default problem + start adding IDEDroid-like fo…
fabianbs96 May 21, 2025
151b795
Merge branch development' into f-CFLFieldSens
fabianbs96 Jun 9, 2025
948a35d
Continue with CFL implementation (WIP)
fabianbs96 Jun 9, 2025
b791a94
Fully compiling CFL-field-sens IFDS implementation
fabianbs96 Jun 9, 2025
e555e1e
Add some simple unittests (WIP)
fabianbs96 Jun 10, 2025
9756c18
Add a hack to make the alias information partially field sensitive
fabianbs96 Jun 10, 2025
dbc413c
Change alias handling
fabianbs96 Jun 24, 2025
6e1e94a
Add more (passing) XTaint tests
Jan 23, 2026
02f08ab
Add sanitizer-customization-point + fix bug in combine() with EdgeIde…
Jan 23, 2026
a89f0fe
Merge branch 'development' into f-CFLFieldSens
Jan 27, 2026
5687866
Fix minor compilation issue
Jan 27, 2026
1b6b831
Out-comment unnecessary stuff
Jan 27, 2026
76a347c
Convert CFLFieldSensTest to testingSrcLocation + add logger to FieldS…
Jan 28, 2026
47d91a2
Optimize CFLFieldSensEdgeValue::applyTransforms
Jan 29, 2026
e0518f1
Some cleanup + optimize creation of CFLFieldSensEdgeFunction
Jan 29, 2026
2eefc33
minor
Jan 29, 2026
c984b22
Some optimizations
Feb 5, 2026
586cda4
Add corner case tests
Feb 5, 2026
a81dfac
Fix edge-cases in CFL-Fieldsens analysis + make corresponding tests (…
fabianbs96 Feb 9, 2026
2131919
Small tweak in CFLFieldSensTest + minor
Feb 16, 2026
da53695
Add structural sharing for Store- and Load sequences
Feb 19, 2026
5dd298d
Some cleanup + small enhancement to LatticeDomain-join
Feb 19, 2026
2f79629
Add some comment
Feb 19, 2026
0075ce2
Merge branch 'development' into f-CFLFieldSens
Feb 23, 2026
7ef50d9
Fix errors after merge
Feb 23, 2026
55a996e
minor
Feb 23, 2026
8407c00
Integrate CFL-fieldsens analysis into phasar-cli for IFDSTaintAnalysis
Feb 24, 2026
14de5b8
Rename cfl fieldsens analysis problem + introduce own namespace for it
Feb 24, 2026
5e0c88c
Add generic mechanism to filter IFDS analysis results field-sensitively
Feb 25, 2026
9bf5762
Properly handling non-existing value
Feb 25, 2026
ba96bc1
Add some comments + minor
Feb 25, 2026
813cde0
pre-commit
fabianbs96 Feb 25, 2026
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
41 changes: 35 additions & 6 deletions include/phasar/DataFlow/IfdsIde/EdgeFunctionUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ template <typename L> struct EdgeIdentity final {
[[nodiscard]] static EdgeFunction<l_t>
join(EdgeFunctionRef<EdgeIdentity> This,
const EdgeFunction<l_t> &OtherFunction);

friend llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, EdgeIdentity) {
return OS << "EdgeIdentity";
}
};

template <typename L> struct ConstantEdgeFunction {
Expand Down Expand Up @@ -151,6 +155,10 @@ template <typename L> struct AllBottom final {
{
return LHS.BottomValue == RHS.BottomValue;
}

friend llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, AllBottom) {
return OS << "AllBottom";
}
};

template <typename L> struct AllTop final {
Expand Down Expand Up @@ -189,10 +197,14 @@ template <typename L> struct AllTop final {
{
return LHS.TopValue == RHS.TopValue;
}

friend llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, AllTop) {
return OS << "AllTop";
}
};

template <typename L, typename ConcreteEF>
EdgeFunction<L>
inline EdgeFunction<L>
defaultComposeOrNull(EdgeFunctionRef<ConcreteEF> This,
const EdgeFunction<L> &SecondFunction) noexcept {
if (llvm::isa<EdgeIdentity<L>>(SecondFunction)) {
Expand All @@ -205,7 +217,7 @@ defaultComposeOrNull(EdgeFunctionRef<ConcreteEF> This,
}

template <typename L>
EdgeFunction<L>
inline EdgeFunction<L>
defaultComposeOrNull(const EdgeFunction<L> &This,
const EdgeFunction<L> &SecondFunction) noexcept {
if (llvm::isa<EdgeIdentity<L>>(SecondFunction)) {
Expand Down Expand Up @@ -388,8 +400,8 @@ template <typename L, uint8_t N> struct JoinEdgeFunction {
/// Joining with EdgeIdentity will overapproximate to (AllBottom if N==0, else
/// JoinEdgeFunction).
template <typename L, uint8_t N = 0, typename ConcreteEF>
EdgeFunction<L> defaultJoinOrNull(EdgeFunctionRef<ConcreteEF> This,
const EdgeFunction<L> &OtherFunction) {
inline EdgeFunction<L> defaultJoinOrNull(EdgeFunctionRef<ConcreteEF> This,
const EdgeFunction<L> &OtherFunction) {
if (llvm::isa<AllBottom<L>>(OtherFunction)) {
return OtherFunction;
}
Expand All @@ -407,8 +419,8 @@ EdgeFunction<L> defaultJoinOrNull(EdgeFunctionRef<ConcreteEF> This,
}

template <typename L, uint8_t N = 0>
EdgeFunction<L> defaultJoinOrNull(const EdgeFunction<L> &This,
const EdgeFunction<L> &OtherFunction) {
inline EdgeFunction<L> defaultJoinOrNull(const EdgeFunction<L> &This,
const EdgeFunction<L> &OtherFunction) {
if (llvm::isa<AllBottom<L>>(OtherFunction) || llvm::isa<AllTop<L>>(This)) {
return OtherFunction;
}
Expand All @@ -426,6 +438,23 @@ EdgeFunction<L> defaultJoinOrNull(const EdgeFunction<L> &This,
return nullptr;
}

/// Similar to defaultJoinOrNull(), but does not handle This==OtherFunction and
/// EdgeIdentity.
template <typename L>
inline EdgeFunction<L>
defaultJoinOrNullNoId(const EdgeFunction<L> &This,
const EdgeFunction<L> &OtherFunction) {
if (llvm::isa<AllBottom<L>>(OtherFunction) || llvm::isa<AllTop<L>>(This)) {
return OtherFunction;
}
if (llvm::isa<AllTop<L>>(OtherFunction) || llvm::isa<AllBottom<L>>(This) ||
OtherFunction.referenceEquals(This)) {
return This;
}

return nullptr;
}

template <typename L>
EdgeFunction<L> EdgeIdentity<L>::join(EdgeFunctionRef<EdgeIdentity> This,
const EdgeFunction<L> &OtherFunction) {
Expand Down
18 changes: 18 additions & 0 deletions include/phasar/DataFlow/IfdsIde/IDETabulationProblem.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <set>
#include <string>
#include <type_traits>
#include <utility>

namespace psr {

Expand Down Expand Up @@ -122,6 +123,19 @@ class IDETabulationProblem : public FlowFunctions<AnalysisDomainTy, Container>,
}
}

[[nodiscard]] constexpr AnalysisPrinterBase<AnalysisDomainTy> &
printer() noexcept {
assert(Printer != nullptr);
return *Printer;
}

[[nodiscard]] constexpr MaybeUniquePtr<AnalysisPrinterBase<AnalysisDomainTy>>
consumePrinter() noexcept {
assert(Printer != nullptr);
return std::exchange(Printer,
NullAnalysisPrinter<AnalysisDomainTy>::getInstance());
}

/// Checks if the given data-flow fact is the special tautological lambda (or
/// zero) fact.
[[nodiscard]] virtual bool isZeroValue(d_t FlowFact) const noexcept {
Expand Down Expand Up @@ -177,6 +191,10 @@ class IDETabulationProblem : public FlowFunctions<AnalysisDomainTy, Container>,

[[nodiscard]] const db_t *getProjectIRDB() const noexcept { return IRDB; }

[[nodiscard]] llvm::ArrayRef<std::string> getEntryPoints() const noexcept {
return EntryPoints;
}

protected:
typename FlowFunctions<AnalysisDomainTy, Container>::FlowFunctionPtrType
generateFromZero(d_t FactToGenerate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ class IdBasedSolverResultsBase {
using const_iterator = iterator;
using difference_type = ptrdiff_t;

using key_type = d_t;
using mapped_type = l_t;
using value_type = std::pair<d_t, l_t>;

explicit RowView(
const detail::IterativeIDESolverResults<n_t, d_t, l_t> *Results,
const row_map_t *Row) noexcept
Expand Down
24 changes: 23 additions & 1 deletion include/phasar/Domain/LatticeDomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "phasar/Utils/ByRef.h"
#include "phasar/Utils/DebugOutput.h"
#include "phasar/Utils/JoinLattice.h"
#include "phasar/Utils/Macros.h"
#include "phasar/Utils/TypeTraits.h"

#include "llvm/ADT/Hashing.h"
Expand All @@ -22,6 +23,7 @@
#include "llvm/Support/raw_ostream.h"

#include <cstdint>
#include <functional>
#include <ostream>
#include <variant>

Expand Down Expand Up @@ -99,6 +101,13 @@ struct LatticeDomain : public std::variant<Top, L, Bottom> {
assert(std::holds_alternative<L>(*this));
return std::get<L>(*this);
}

template <typename TransformFn, typename... ArgsT>
void onValue(TransformFn Transform, ArgsT &&...Args) {
if (auto *Val = getValueOrNull()) {
std::invoke(std::move(Transform), *Val, PSR_FWD(Args)...);
}
}
};

template <typename L>
Expand Down Expand Up @@ -213,6 +222,14 @@ template <typename L> struct JoinLatticeTraits<LatticeDomain<L>> {
return LHS;
}

if constexpr (has_adl_join<l_t>) {
if (auto LhsPtr = LHS.getValueOrNull()) {
if (auto RhsPtr = RHS.getValueOrNull()) {
return psr::adl_join(*LhsPtr, *RhsPtr);
}
}
}

return Bottom{};
}
};
Expand Down Expand Up @@ -243,7 +260,12 @@ template <typename L> struct hash<psr::LatticeDomain<L>> {
return SIZE_MAX - 1;
}
assert(LD.getValueOrNull() != nullptr);
return std::hash<L>{}(*LD.getValueOrNull());
if constexpr (psr::is_std_hashable_v<L>) {
return std::hash<L>{}(*LD.getValueOrNull());
} else {
using llvm::hash_value;
return hash_value(*LD.getValueOrNull());
}
}
};
} // namespace std
Expand Down
Loading
Loading