Skip to content

Commit

Permalink
more TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
sritejakv committed Feb 9, 2024
1 parent 29e7b8a commit 6741866
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
22 changes: 8 additions & 14 deletions include/phasar/PhasarLLVM/Utils/SourceMgrPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <llvm/ADT/StringMap.h>
#include <llvm/ADT/StringRef.h>
#include <llvm/Support/SourceMgr.h>
#include <llvm/Support/raw_ostream.h> // quoting style
#include <llvm/Support/raw_ostream.h> /// TODO: quoting style

namespace psr {
template <typename AnalysisDomainTy>
Expand All @@ -29,22 +29,16 @@ class SourceMgrPrinter : public AnalysisPrinterBase<AnalysisDomainTy> {
auto BufIdOpt = getSourceBufId(getFilePathFromIR(Warn.Instr));
if (BufIdOpt.has_value()) {
/// TODO: getLineAndColFromIR call only once
/// TODO:Configuration options for warning or error
SrcMgr.PrintMessage(*OS,
SrcMgr.FindLocForLineAndColumn(
BufIdOpt.value(),
getLineAndColFromIR(Warn.Instr).first,
getLineAndColFromIR(Warn.Instr).second),
llvm::SourceMgr::DK_Warning,

GetPrintMessage(Warn.AnalysisType));
/// TODO: Configuration options for warning or error
SrcMgr.PrintMessage(
*OS,
SrcMgr.FindLocForLineAndColumn(
BufIdOpt.value(), getLineAndColFromIR(Warn.Instr).first,
getLineAndColFromIR(Warn.Instr).second),
llvm::SourceMgr::DK_Warning, GetPrintMessage(Warn.AnalysisType));
}
}

/// TODO: use non-virtual function to call virtual function with default
/// parameters +
/// TODO: templace magic - #include "memory_resource"

/// TODO: move this to cpp file and refactor the imports
std::optional<unsigned> getSourceBufId(llvm::StringRef FileName) {
if (auto It = FileNameIDMap.find(FileName); It != FileNameIDMap.end()) {
Expand Down
5 changes: 4 additions & 1 deletion include/phasar/Utils/AnalysisPrinterBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace psr {

// move warning to default analysis printer
/// TODO: move warning to default analysis printer
template <typename AnalysisDomainTy> struct Warning {
using n_t = typename AnalysisDomainTy::n_t;
using d_t = typename AnalysisDomainTy::d_t;
Expand All @@ -27,6 +27,9 @@ template <typename AnalysisDomainTy> struct Warning {

template <typename AnalysisDomainTy> class AnalysisPrinterBase {
public:
/// TODO: use non-virtual function to call virtual function with default
/// parameters +
/// TODO: templace magic - #include "memory_resource"
virtual void onResult(Warning<AnalysisDomainTy> /*Warn*/) = 0;
virtual void onInitialize() = 0;
virtual void onFinalize() = 0;
Expand Down

0 comments on commit 6741866

Please sign in to comment.