Skip to content

Commit

Permalink
TypeTrait check current non functioning impl
Browse files Browse the repository at this point in the history
  • Loading branch information
mxHuber committed Apr 22, 2024
1 parent d8766de commit 4d079d8
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions include/phasar/Pointer/AliasInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,8 @@ class AliasInfoRef : public AnalysisPropertiesMixin<AliasInfoRef<V, N>> {
VT->Print(AA, OS);
}

[[nodiscard, deprecated("Use printAsJson() instead")]] nlohmann::json
getAsJson() const {
if (VT == nullptr) {
return {};
}

[[nodiscard]] nlohmann::json getAsJson() const {
assert(VT != nullptr);
return VT->GetAsJson(AA);
}

Expand Down Expand Up @@ -190,6 +186,16 @@ class AliasInfoRef : public AnalysisPropertiesMixin<AliasInfoRef<V, N>> {
assert(isa<T>() && "Invalid AliasInfo cast!");
return static_cast<T *>(AA);
}
/*
template <typename T>
[[nodiscard]] auto hasGetAsJsonImpl() -> decltype(nlohmann::json()) {
return static_cast<T *>(AA)->getAsJson();
}
*/

template <class T>
using hasGetAsJson =
decltype(std::declval<T &>().getAsJson(std::declval<nlohmann::json>()));

private:
struct VTable {
Expand Down Expand Up @@ -245,11 +251,10 @@ class AliasInfoRef : public AnalysisPropertiesMixin<AliasInfoRef<V, N>> {
[](const void *AA, llvm::raw_ostream &OS) {
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) noexcept {
/// TODO: hier bei Compile-Time checken ob getAsJson in dem ConcreteAA
/// existiert. Wenn nein, leeres json.
return hasGetAsJson(AA);
},
[](const void *AA, llvm::raw_ostream &OS) {
static_cast<const ConcreteAA *>(AA)->printAsJson(OS);
Expand Down

0 comments on commit 4d079d8

Please sign in to comment.