Skip to content

Commit deed378

Browse files
[SSAF] Add data structures for summary data of a single TU (llvm#176504)
1 parent d29aa30 commit deed378

2 files changed

Lines changed: 69 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//===- EntitySummary.h ------------------------------------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_CLANG_ANALYSIS_SCALABLE_TUSUMMARY_ENTITYSUMMARY_H
10+
#define LLVM_CLANG_ANALYSIS_SCALABLE_TUSUMMARY_ENTITYSUMMARY_H
11+
12+
#include "clang/Analysis/Scalable/Model/SummaryName.h"
13+
14+
namespace clang::ssaf {
15+
16+
/// Base class for analysis-specific summary data.
17+
class EntitySummary {
18+
private:
19+
SummaryName Summary;
20+
21+
protected:
22+
EntitySummary(SummaryName Summary) : Summary(std::move(Summary)) {}
23+
24+
public:
25+
SummaryName getSummaryName() const { return Summary; }
26+
27+
virtual ~EntitySummary() = default;
28+
};
29+
30+
} // namespace clang::ssaf
31+
32+
#endif // LLVM_CLANG_ANALYSIS_SCALABLE_TUSUMMARY_ENTITYSUMMARY_H
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//===- TUSummary.h ----------------------------------------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_CLANG_ANALYSIS_SCALABLE_TUSUMMARY_TUSUMMARY_H
10+
#define LLVM_CLANG_ANALYSIS_SCALABLE_TUSUMMARY_TUSUMMARY_H
11+
12+
#include "clang/Analysis/Scalable/Model/BuildNamespace.h"
13+
#include "clang/Analysis/Scalable/Model/EntityId.h"
14+
#include "clang/Analysis/Scalable/Model/EntityIdTable.h"
15+
#include "clang/Analysis/Scalable/Model/SummaryName.h"
16+
#include "clang/Analysis/Scalable/TUSummary/EntitySummary.h"
17+
#include <map>
18+
#include <memory>
19+
20+
namespace clang::ssaf {
21+
22+
/// Data extracted for a given translation unit and for a given set of analyses.
23+
class TUSummary {
24+
/// Identifies the translation unit.
25+
BuildNamespace TUNamespace;
26+
EntityIdTable IdTable;
27+
28+
std::map<SummaryName, std::map<EntityId, std::unique_ptr<EntitySummary>>>
29+
Data;
30+
31+
public:
32+
TUSummary(BuildNamespace TUNamespace) : TUNamespace(std::move(TUNamespace)) {}
33+
};
34+
35+
} // namespace clang::ssaf
36+
37+
#endif // LLVM_CLANG_ANALYSIS_SCALABLE_TUSUMMARY_TUSUMMARY_H

0 commit comments

Comments
 (0)