[clang][ssaf] Drop llvm-RTTI support for now (#181198)
We discussed internally, and for now we will focus on an MVP and try to not complicate APIs unless that is strictly necessary.
This commit is contained in:
parent
1f404ec04d
commit
a1c4c1de05
@ -18,7 +18,6 @@
|
||||
#include "clang/Analysis/Scalable/Model/SummaryName.h"
|
||||
#include "clang/Analysis/Scalable/TUSummary/TUSummary.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/ExtensibleRTTI.h"
|
||||
|
||||
namespace clang::ssaf {
|
||||
|
||||
@ -28,8 +27,7 @@ class EntityName;
|
||||
class EntitySummary;
|
||||
|
||||
/// Abstract base class for serialization formats.
|
||||
class SerializationFormat
|
||||
: public llvm::RTTIExtends<SerializationFormat, llvm::RTTIRoot> {
|
||||
class SerializationFormat {
|
||||
public:
|
||||
virtual ~SerializationFormat() = default;
|
||||
|
||||
@ -38,8 +36,6 @@ public:
|
||||
virtual void writeTUSummary(const TUSummary &Summary,
|
||||
llvm::StringRef OutputDir) = 0;
|
||||
|
||||
static char ID; // For RTTIExtends.
|
||||
|
||||
protected:
|
||||
// Helpers providing access to implementation details of basic data structures
|
||||
// for efficient serialization/deserialization.
|
||||
|
||||
@ -10,17 +10,14 @@
|
||||
#define LLVM_CLANG_ANALYSIS_SCALABLE_TUSUMMARY_ENTITYSUMMARY_H
|
||||
|
||||
#include "clang/Analysis/Scalable/Model/SummaryName.h"
|
||||
#include "llvm/Support/ExtensibleRTTI.h"
|
||||
|
||||
namespace clang::ssaf {
|
||||
|
||||
/// Base class for analysis-specific summary data.
|
||||
class EntitySummary : public llvm::RTTIExtends<EntitySummary, llvm::RTTIRoot> {
|
||||
class EntitySummary {
|
||||
public:
|
||||
virtual ~EntitySummary() = default;
|
||||
virtual SummaryName getSummaryName() const = 0;
|
||||
|
||||
static char ID; // For RTTIExtends.
|
||||
};
|
||||
|
||||
} // namespace clang::ssaf
|
||||
|
||||
@ -7,9 +7,7 @@ add_clang_library(clangAnalysisScalable
|
||||
Model/BuildNamespace.cpp
|
||||
Model/EntityIdTable.cpp
|
||||
Model/EntityName.cpp
|
||||
Serialization/SerializationFormat.cpp
|
||||
Serialization/SerializationFormatRegistry.cpp
|
||||
TUSummary/EntitySummary.cpp
|
||||
TUSummary/ExtractorRegistry.cpp
|
||||
|
||||
LINK_LIBS
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
//===- SerializationFormat.cpp ----------------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Analysis/Scalable/Serialization/SerializationFormat.h"
|
||||
|
||||
using namespace clang::ssaf;
|
||||
|
||||
char SerializationFormat::ID = 0;
|
||||
@ -1,11 +0,0 @@
|
||||
//===- EntitySummary.cpp --------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Analysis/Scalable/TUSummary/EntitySummary.h"
|
||||
|
||||
char clang::ssaf::EntitySummary::ID = 0;
|
||||
@ -18,22 +18,19 @@ using SpecialFileRepresentation =
|
||||
MockSerializationFormat::SpecialFileRepresentation;
|
||||
|
||||
namespace {
|
||||
struct FancyAnalysisData final
|
||||
: llvm::RTTIExtends<FancyAnalysisData, EntitySummary> {
|
||||
struct FancyAnalysisData final : EntitySummary {
|
||||
SummaryName getSummaryName() const override {
|
||||
return SummaryName("FancyAnalysis");
|
||||
}
|
||||
|
||||
std::string Text;
|
||||
static char ID;
|
||||
};
|
||||
char FancyAnalysisData::ID = 0;
|
||||
} // namespace
|
||||
|
||||
static SpecialFileRepresentation
|
||||
serializeFancyAnalysis(const EntitySummary &Data,
|
||||
MockSerializationFormat &Format) {
|
||||
const auto &FancyAnalysis = llvm::cast<FancyAnalysisData>(Data);
|
||||
const auto &FancyAnalysis = static_cast<const FancyAnalysisData &>(Data);
|
||||
return SpecialFileRepresentation{/*MockRepresentation=*/FancyAnalysis.Text};
|
||||
}
|
||||
|
||||
|
||||
@ -27,10 +27,7 @@
|
||||
using namespace clang;
|
||||
using namespace ssaf;
|
||||
|
||||
char MockSerializationFormat::ID = 0;
|
||||
|
||||
MockSerializationFormat::MockSerializationFormat()
|
||||
: llvm::RTTIExtends<MockSerializationFormat, SerializationFormat>() {
|
||||
MockSerializationFormat::MockSerializationFormat() {
|
||||
for (const auto &FormatInfoEntry : llvm::Registry<FormatInfo>::entries()) {
|
||||
std::unique_ptr<FormatInfo> Info = FormatInfoEntry.instantiate();
|
||||
bool Inserted = FormatInfos.try_emplace(Info->ForSummary, *Info).second;
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
#include "clang/Analysis/Scalable/Model/SummaryName.h"
|
||||
#include "clang/Analysis/Scalable/Serialization/SerializationFormat.h"
|
||||
#include "llvm/ADT/STLFunctionalExtras.h"
|
||||
#include "llvm/Support/ExtensibleRTTI.h"
|
||||
#include <string>
|
||||
|
||||
namespace clang::ssaf {
|
||||
|
||||
class MockSerializationFormat final
|
||||
: public llvm::RTTIExtends<MockSerializationFormat, SerializationFormat> {
|
||||
class MockSerializationFormat final : public SerializationFormat {
|
||||
public:
|
||||
MockSerializationFormat();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user