18#include "llvm/ADT/SmallString.h"
19#include "llvm/Support/ErrorHandling.h"
37 const Decl *USRDecl = D;
41 if (
const auto *PVD = dyn_cast<ParmVarDecl>(D)) {
43 dyn_cast_or_null<FunctionDecl>(PVD->getParentFunctionOrMethod());
48 const auto ParamIdx = PVD->getFunctionScopeIndex();
49 llvm::raw_svector_ostream OS(Suffix);
86 const auto *ND = dyn_cast<NamedDecl>(D);
99 if (
const auto *PVD = dyn_cast<ParmVarDecl>(D)) {
100 if (
const auto *FD = llvm::dyn_cast_or_null<FunctionDecl>(
101 PVD->getParentFunctionOrMethod())) {
106 switch (ND->getFormalLinkage()) {
108 llvm_unreachable(
"Shouldn't be invalid");
123 llvm_unreachable(
"Unhandled clang::Linkage kind");
126std::optional<EntityName>
136std::optional<EntityName>
Decl - This represents one declaration (or definition), e.g.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Represents a function declaration or definition.
unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const
Returns a value indicating whether this function corresponds to a builtin function.
A single parameter index whose accessors require each use to make explicit the parameter index encodi...
Uniquely identifies an entity in a program.
Represents a hierarchical sequence of build namespaces.
bool generateUSRForDecl(const Decl *D, SmallVectorImpl< char > &Buf)
Generate a USR for a Decl, including the USR prefix.
std::optional< EntityName > getEntityNameForReturn(const FunctionDecl *FD)
Maps return entity of a function to an EntityName.
EntityLinkageType getLinkageForDecl(const Decl *D)
Computes the SSAF linkage of a declaration.
std::optional< EntityName > getQualifiedEntityNameForReturn(const FunctionDecl *FD, const NestedBuildNamespace &TUNamespace, const NestedBuildNamespace &LUNamespace)
Similar to getQualifiedEntityName, but for entities of function return values.
std::optional< EntityName > getQualifiedEntityName(const Decl *D, const NestedBuildNamespace &TUNamespace, const NestedBuildNamespace &LUNamespace)
Returns the EntityName qualified with the build namespaces it would carry after linking into LUNamesp...
std::optional< EntityName > getEntityName(const Decl *D)
Maps a declaration to an EntityName.
NestedBuildNamespace resolveNamespace(const NestedBuildNamespace &LUNamespace, const NestedBuildNamespace &TUNamespace, const NestedBuildNamespace &EntityNamespace, EntityLinkageType Linkage)
Computes the build namespace an entity should carry after linking, given its linkage.
@ Internal
static functions/variables, anonymous namespace
@ External
globally visible across translation units (including parameters of functions with external linkage)
bool isa(CodeGen::Address addr)
@ 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...
U cast(CodeGen::Address addr)