1//===- TUSummaryExtractor.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_SCALABLESTATICANALYSIS_CORE_TUSUMMARY_TUSUMMARYEXTRACTOR_H
10#define LLVM_CLANG_SCALABLESTATICANALYSIS_CORE_TUSUMMARY_TUSUMMARYEXTRACTOR_H
11
12#include "clang/AST/ASTConsumer.h"
13#include "clang/AST/Decl.h"
14#include "clang/ScalableStaticAnalysis/Core/Model/EntityId.h"
15#include <optional>
16
17namespace clang::ssaf {
18class SSAFOptions;
19class TUSummaryBuilder;
20
21class TUSummaryExtractor : public ASTConsumer {
22public:
23 explicit TUSummaryExtractor(TUSummaryBuilder &Builder)
24 : SummaryBuilder(Builder) {}
25
26 /// Creates EntityName from the Decl, registers the entity, and sets its
27 /// linkage atomically.
28 /// \returns the EntityId, or std::nullopt if EntityName creation fails.
29 std::optional<EntityId> addEntity(const NamedDecl *D);
30
31 /// Creates EntityName for the return value of \p FD, registers the entity,
32 /// and sets its linkage atomically.
33 /// \returns the EntityId, or std::nullopt if EntityName creation fails.
34 std::optional<EntityId> addEntityForReturn(const FunctionDecl *FD);
35
36 /// \returns the \c SSAFOptions of the builder.
37 const SSAFOptions &getOptions() const;
38
39protected:
40 TUSummaryBuilder &SummaryBuilder;
41};
42
43} // namespace clang::ssaf
44
45#endif // LLVM_CLANG_SCALABLESTATICANALYSIS_CORE_TUSUMMARY_TUSUMMARYEXTRACTOR_H
46