clang 23.0.0git
TUSummaryBuilder.cpp
Go to the documentation of this file.
1//===- TUSummaryBuilder.cpp -----------------------------------------------===//
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
14#include <memory>
15#include <utility>
16
17using namespace clang;
18using namespace ssaf;
19
22 EntityId Id = Summary.IdTable.getId(EN);
23 [[maybe_unused]] EntityLinkageType Link =
24 Summary.LinkageTable.try_emplace(Id, Linkage).first->second.getLinkage();
25 // Even if we had in the past a linkage, that must bee the same as we set now.
26 assert(Link == Linkage);
27 return Id;
28}
29
30std::pair<EntitySummary *, bool>
31TUSummaryBuilder::addSummaryImpl(EntityId Entity,
32 std::unique_ptr<EntitySummary> &&Data) {
33 auto &EntitySummaries = Summary.Data[Data->getSummaryName()];
34 auto [It, Inserted] = EntitySummaries.try_emplace(Entity, std::move(Data));
35 return {It->second.get(), Inserted};
36}
Lightweight opaque handle representing an entity in an EntityIdTable.
Definition EntityId.h:31
Uniquely identifies an entity in a program.
Definition EntityName.h:28
EntityId addEntity(const EntityName &EN, EntityLinkageType Linkage)
The JSON file list parser is used to communicate input to InstallAPI.
@ Link
'link' clause, allowed on 'declare' construct.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
Definition Linkage.h:24