16#include "llvm/Support/Casting.h"
23 const auto *ND = dyn_cast<NamedDecl>(D);
25 return EntityLinkageType::None;
36 if (
const auto *PVD = dyn_cast<ParmVarDecl>(D)) {
37 if (
const auto *FD = llvm::dyn_cast_or_null<FunctionDecl>(
38 PVD->getParentFunctionOrMethod())) {
43 switch (ND->getFormalLinkage()) {
45 llvm_unreachable(
"Shouldn't be invalid");
48 return EntityLinkageType::None;
50 return EntityLinkageType::Internal;
52 return EntityLinkageType::Internal;
54 return EntityLinkageType::Internal;
56 return EntityLinkageType::External;
58 return EntityLinkageType::External;
60 llvm_unreachable(
"Unhandled clang::Linkage kind");
70std::optional<EntityId>
Decl - This represents one declaration (or definition), e.g.
Represents a function declaration or definition.
This represents a decl that may have a name.
std::optional< EntityName > getEntityNameForReturn(const FunctionDecl *FD)
Maps return entity of a function to an EntityName.
std::optional< EntityName > getEntityName(const Decl *D)
Maps a declaration to an EntityName.
The JSON file list parser is used to communicate input to InstallAPI.
@ VisibleNone
No linkage according to the standard, but is visible from other translation units because of types de...
@ None
No linkage, which means that the entity is unique and can only be referred to from within its scope.
@ UniqueExternal
External linkage within a unique namespace.
@ Internal
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
@ External
External linkage, which indicates that the entity can be referred to from other translation units.
@ Module
Module linkage, which indicates that the entity can be referred to from other translation units withi...