From d8766de6c176ad668ac6c370ad6187a876be5ec0 Mon Sep 17 00:00:00 2001 From: Fabian Schiebel Date: Sun, 21 Apr 2024 13:25:07 +0200 Subject: [PATCH] Optimizing deprecation warnings for getAsJson --- .../phasar/PhasarLLVM/ControlFlow/LLVMBasedBackwardICFG.h | 2 +- include/phasar/PhasarLLVM/ControlFlow/LLVMBasedICFG.h | 2 +- include/phasar/Pointer/AliasInfo.h | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/phasar/PhasarLLVM/ControlFlow/LLVMBasedBackwardICFG.h b/include/phasar/PhasarLLVM/ControlFlow/LLVMBasedBackwardICFG.h index 66fa5e34e..c9bbb5b99 100644 --- a/include/phasar/PhasarLLVM/ControlFlow/LLVMBasedBackwardICFG.h +++ b/include/phasar/PhasarLLVM/ControlFlow/LLVMBasedBackwardICFG.h @@ -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 &getCallGraphImpl() const noexcept; llvm::LLVMContext BackwardRetsCtx; diff --git a/include/phasar/PhasarLLVM/ControlFlow/LLVMBasedICFG.h b/include/phasar/PhasarLLVM/ControlFlow/LLVMBasedICFG.h index f1c03879a..471fba581 100644 --- a/include/phasar/PhasarLLVM/ControlFlow/LLVMBasedICFG.h +++ b/include/phasar/PhasarLLVM/ControlFlow/LLVMBasedICFG.h @@ -150,7 +150,7 @@ class LLVMBasedICFG : public LLVMBasedCFG, public ICFGBase { 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 &getCallGraphImpl() const noexcept { return CG; } diff --git a/include/phasar/Pointer/AliasInfo.h b/include/phasar/Pointer/AliasInfo.h index 576a7b529..d2941404b 100644 --- a/include/phasar/Pointer/AliasInfo.h +++ b/include/phasar/Pointer/AliasInfo.h @@ -141,7 +141,8 @@ class AliasInfoRef : public AnalysisPropertiesMixin> { VT->Print(AA, OS); } - [[nodiscard]] nlohmann::json getAsJson() const { + [[nodiscard, deprecated("Use printAsJson() instead")]] nlohmann::json + getAsJson() const { if (VT == nullptr) { return {}; } @@ -245,7 +246,10 @@ class AliasInfoRef : public AnalysisPropertiesMixin> { static_cast(AA)->print(OS); }, [](const void *AA) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated" return static_cast(AA)->getAsJson(); +#pragma GCC diagnostic pop }, [](const void *AA, llvm::raw_ostream &OS) { static_cast(AA)->printAsJson(OS);