Skip to content

Commit

Permalink
Optimizing deprecation warnings for getAsJson
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianbs96 committed Apr 21, 2024
1 parent f630ebe commit d8766de
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class LLVMBasedBackwardICFG : public LLVMBasedBackwardCFG,
getReturnSitesOfCallAtImpl(n_t Inst) const;
void printImpl(llvm::raw_ostream &OS) const;
void printAsJsonImpl(llvm::raw_ostream &OS) const;
[[nodiscard]] nlohmann::json getAsJsonImpl() const;
[[nodiscard, deprecated]] nlohmann::json getAsJsonImpl() const;
[[nodiscard]] const CallGraph<n_t, f_t> &getCallGraphImpl() const noexcept;

llvm::LLVMContext BackwardRetsCtx;
Expand Down
2 changes: 1 addition & 1 deletion include/phasar/PhasarLLVM/ControlFlow/LLVMBasedICFG.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class LLVMBasedICFG : public LLVMBasedCFG, public ICFGBase<LLVMBasedICFG> {
getReturnSitesOfCallAtImpl(n_t Inst) const;
void printImpl(llvm::raw_ostream &OS) const;
void printAsJsonImpl(llvm::raw_ostream &OS) const;
[[nodiscard]] nlohmann::json getAsJsonImpl() const;
[[nodiscard, deprecated]] nlohmann::json getAsJsonImpl() const;
[[nodiscard]] const CallGraph<n_t, f_t> &getCallGraphImpl() const noexcept {
return CG;
}
Expand Down
6 changes: 5 additions & 1 deletion include/phasar/Pointer/AliasInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ class AliasInfoRef : public AnalysisPropertiesMixin<AliasInfoRef<V, N>> {
VT->Print(AA, OS);
}

[[nodiscard]] nlohmann::json getAsJson() const {
[[nodiscard, deprecated("Use printAsJson() instead")]] nlohmann::json
getAsJson() const {
if (VT == nullptr) {
return {};
}
Expand Down Expand Up @@ -245,7 +246,10 @@ class AliasInfoRef : public AnalysisPropertiesMixin<AliasInfoRef<V, N>> {
static_cast<const ConcreteAA *>(AA)->print(OS);
},
[](const void *AA) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated"
return static_cast<const ConcreteAA *>(AA)->getAsJson();
#pragma GCC diagnostic pop
},
[](const void *AA, llvm::raw_ostream &OS) {
static_cast<const ConcreteAA *>(AA)->printAsJson(OS);
Expand Down

0 comments on commit d8766de

Please sign in to comment.