Skip to content

Commit 8a786ac

Browse files
sritejakvSanthoshMohan97fabianbs96
authored
Implementing On-The-Fly Reporting (#701)
* Analysis Printer (#17) * Initial Commit * AnalysisPrinter Second commit * Initial Commit * Integrate Printer with client Analysis and test * Addressing Review comments * Integrate AnalysisPrinter with all analyses and template class modified * vector emplace_back instead of push_back * Testcase for AnalysisPrinter * GroundTruth derived class initial commit * AnalysisPrinter Test complete and Test * fixing myphasartool file * Test pre-commit fix * Adding Test cases and fixing PR failure * 1.template params to N,D,L 2.remove AnalysisType param from AnalysisResults 3.rearranging class variables * 1.template params to N,D,L 2.remove AnalysisType param from AnalysisResults 3.rearranging class variables * Null AnalysisPrinter singleton * Adding AnalysisPrinter to IDETabulation Problem * making free (N,D,L)ToString functions * disable copy and move for analysis-printer * Default NullAnalysisPrinter and explicit print methods * removing SetAnalysisPrinter from client analyses and modified Testcase for AnalysisPrinter * Adding superclass for AnalysisPrinter * Addressing review comments and fixing PR build failure * fix: minors * fix: minor (clang-tidy) * fix: review feedback * misc: minor refactoring --------- Co-authored-by: SanthoshMohan <santhoshmohan0897@gmail.com> Co-authored-by: Sriteja Kummita <sriteja.ku@gmail.com> * OnTheFlyReporting Initial Commit * fix: review feedback * onTheFlyAnalysis makeUniquePtr * OnTheFlyReporting Initial Commit * onTheFlyAnalysis makeUniquePtr * addressing minor error in prev commit * Refactoring Warn Variable and Refactoring lambda flow for AnalysisPrinter * Integrating sourceMgr to AnalysisPrinter * Testcase for OnTheFlyAnalysisPrinting * Testcase for SourceMgrPrinter * MaybeUniquePtr for SourceMgrPrinter * Minor review comments * refactoring the printers * adding TODOs * more TODOs * Refactor AnalysisPrinter part1 * Refactor AnalysisPrinter part2 * dev: update AnalysisPrinterBase, integrate and fix tests * adding warning kind * fix ci * update codeowners for analysis-printer * Refactor SourceManagerPrinter * Minor in OTF Printer Test * fixing review feedback * fix l_t printing * Mandating analysisType to tyestate descriptions --------- Co-authored-by: SanthoshMohan <santhoshmohan0897@gmail.com> Co-authored-by: Fabian Schiebel <fabian.schiebel@iem.fraunhofer.de>
1 parent cd302d8 commit 8a786ac

35 files changed

+757
-213
lines changed

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Checks: '-*,
44
misc-*,
55
-misc-non-private-member-variables-in-classes,
66
-misc-no-recursion,
7+
-misc-use-anonymous-namespace,
78
readability-*,
89
-readability-function-cognitive-complexity,
910
-readability-else-after*,

.github/CODEOWNERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ Dockerfile @janniclas
2626
/.docker/ @janniclas
2727

2828
/include/phasar/Utils/Logger.h @MMory
29+
/include/phasar/Utils/AnalysisPrinterBase.h @sritejakv
30+
/include/phasar/Utils/DefaultAnalysisPrinter.h @sritejakv
31+
/include/phasar/Utils/NullAnalysisPrinter.h @sritejakv
32+
/include/phasar/Utils/OnTheFlyAnalysisPrinter.h @sritejakv
33+
/include/phasar/PhasarLLVM/Utils/SourceMgrPrinter.h @sritejakv
34+
/lib/PhasarLLVM/Utils/SourceMgrPrinter.cpp @sritejakv

include/phasar/DataFlow/IfdsIde/IDETabulationProblem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#include "phasar/DataFlow/IfdsIde/IFDSIDESolverConfig.h"
2020
#include "phasar/DataFlow/IfdsIde/InitialSeeds.h"
2121
#include "phasar/DataFlow/IfdsIde/SolverResults.h"
22-
#include "phasar/PhasarLLVM/Utils/NullAnalysisPrinter.h"
2322
#include "phasar/Utils/JoinLattice.h"
23+
#include "phasar/Utils/NullAnalysisPrinter.h"
2424
#include "phasar/Utils/Printer.h"
2525
#include "phasar/Utils/Soundness.h"
2626

include/phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/IDETypeStateAnalysis.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "phasar/PhasarLLVM/DataFlow/IfdsIde/LLVMZeroValue.h"
2020
#include "phasar/PhasarLLVM/Domain/LLVMAnalysisDomain.h"
2121
#include "phasar/PhasarLLVM/Pointer/LLVMAliasInfo.h"
22+
#include "phasar/PhasarLLVM/Utils/DataFlowAnalysisType.h"
2223
#include "phasar/Utils/ByRef.h"
2324
#include "phasar/Utils/JoinLattice.h"
2425
#include "phasar/Utils/Logger.h"
@@ -529,10 +530,9 @@ class IDETypeStateAnalysis
529530
if (const auto *Alloca =
530531
llvm::dyn_cast<llvm::AllocaInst>(Res.first)) {
531532
if (Res.second == TSD->error()) {
532-
Warning<IDETypeStateAnalysisDomain<TypeStateDescriptionTy>>
533-
Warn(&I, Res.first, TSD->error());
534533
// ERROR STATE DETECTED
535-
this->Printer->onResult(Warn);
534+
this->Printer->onResult(&I, Res.first, TSD->error(),
535+
TSD->analysisType());
536536
}
537537
}
538538
}
@@ -541,10 +541,9 @@ class IDETypeStateAnalysis
541541
if (const auto *Alloca =
542542
llvm::dyn_cast<llvm::AllocaInst>(Res.first)) {
543543
if (Res.second == TSD->error()) {
544-
Warning<IDETypeStateAnalysisDomain<TypeStateDescriptionTy>>
545-
Warn(&I, Res.first, TSD->error());
546544
// ERROR STATE DETECTED
547-
this->Printer->onResult(Warn);
545+
this->Printer->onResult(&I, Res.first, TSD->error(),
546+
TSD->analysisType());
548547
}
549548
}
550549
}
@@ -553,7 +552,7 @@ class IDETypeStateAnalysis
553552
}
554553
}
555554

556-
this->Printer->onFinalize(OS);
555+
this->Printer->onFinalize();
557556
}
558557

559558
private:

include/phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/TypeStateDescriptions/CSTDFILEIOTypeStateDescription.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class CSTDFILEIOTypeStateDescription
7272
[[nodiscard]] TypeStateDescription::State uninit() const override;
7373
[[nodiscard]] TypeStateDescription::State start() const override;
7474
[[nodiscard]] TypeStateDescription::State error() const override;
75+
[[nodiscard]] DataFlowAnalysisType analysisType() const override;
7576
};
7677

7778
extern template class IDETypeStateAnalysis<CSTDFILEIOTypeStateDescription>;

include/phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/TypeStateDescriptions/OpenSSLEVPKDFCTXDescription.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ class OpenSSLEVPKDFCTXDescription
102102
[[nodiscard]] State uninit() const override;
103103
[[nodiscard]] State start() const override;
104104
[[nodiscard]] State error() const override;
105+
[[nodiscard]] DataFlowAnalysisType analysisType() const override;
105106
/*
106107
/// Checks all callSites, where a EVP_KDF object needs to be in a
107108
/// certain state, such that the state transition for EVP_KDF_CTX is valid.

include/phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/TypeStateDescriptions/OpenSSLEVPKDFDescription.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ class OpenSSLEVPKDFDescription
8585
[[nodiscard]] TypeStateDescription::State start() const override;
8686

8787
[[nodiscard]] TypeStateDescription::State error() const override;
88+
89+
[[nodiscard]] DataFlowAnalysisType analysisType() const override;
8890
};
8991

9092
} // namespace psr

include/phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/TypeStateDescriptions/OpenSSLSecureHeapDescription.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class OpenSSLSecureHeapDescription
7272
[[nodiscard]] TypeStateDescription::State uninit() const override;
7373
[[nodiscard]] TypeStateDescription::State start() const override;
7474
[[nodiscard]] TypeStateDescription::State error() const override;
75+
[[nodiscard]] DataFlowAnalysisType analysisType() const override;
7576
};
7677

7778
} // namespace psr

include/phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/TypeStateDescriptions/OpenSSLSecureMemoryDescription.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class OpenSSLSecureMemoryDescription
4141
[[nodiscard]] TypeStateDescription::State uninit() const override;
4242
[[nodiscard]] TypeStateDescription::State start() const override;
4343
[[nodiscard]] TypeStateDescription::State error() const override;
44+
[[nodiscard]] DataFlowAnalysisType analysisType() const override;
4445
};
4546

4647
} // namespace psr

include/phasar/PhasarLLVM/DataFlow/IfdsIde/Problems/TypeStateDescriptions/TypeStateDescription.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#ifndef PHASAR_PHASARLLVM_DATAFLOW_IFDSIDE_PROBLEMS_TYPESTATEDESCRIPTIONS_TYPESTATEDESCRIPTION_H
1111
#define PHASAR_PHASARLLVM_DATAFLOW_IFDSIDE_PROBLEMS_TYPESTATEDESCRIPTIONS_TYPESTATEDESCRIPTION_H
1212

13+
#include "phasar/PhasarLLVM/Utils/DataFlowAnalysisType.h"
14+
1315
#include "llvm/IR/InstrTypes.h"
1416

1517
#include <set>
@@ -28,6 +30,7 @@ struct TypeStateDescriptionBase {
2830
getConsumerParamIdx(llvm::StringRef F) const = 0;
2931
[[nodiscard]] virtual std::set<int>
3032
getFactoryParamIdx(llvm::StringRef F) const = 0;
33+
[[nodiscard]] virtual DataFlowAnalysisType analysisType() const = 0;
3134
};
3235

3336
/**

0 commit comments

Comments
 (0)