27 return cast_if_present<CXXMethodDecl>(
41 auto *MD = dyn_cast<CXXMethodDecl>(FD);
42 if (MD && MD->isCXXInstanceMember())
67 if (ATL.
getAttrAs<clang::LifetimeBoundAttr>())
78 if (
const auto *ND = dyn_cast<NamespaceDecl>(DC))
80 StringRef Name = II->getName();
81 if (Name.size() >= 2 && Name.front() ==
'_' &&
93 if (
auto *Conv = dyn_cast_or_null<CXXConversionDecl>(Callee))
95 Callee->getParent()->hasAttr<OwnerAttr>())
103 if (!Callee->getIdentifier())
105 return llvm::StringSwitch<bool>(Callee->getName())
108 "begin",
"end",
"rbegin",
"rend",
"cbegin",
"cend",
"crbegin",
111 "c_str",
"data",
"get",
113 "find",
"equal_range",
"lower_bound",
"upper_bound"},
117 if (Callee->getReturnType()->isReferenceType()) {
118 if (!Callee->getIdentifier()) {
119 auto OO = Callee->getOverloadedOperator();
120 if (!Callee->getParent()->hasAttr<OwnerAttr>())
122 return OO == OverloadedOperatorKind::OO_Subscript ||
123 OO == OverloadedOperatorKind::OO_Star;
125 return llvm::StringSwitch<bool>(Callee->getName())
126 .Cases({
"front",
"back",
"at",
"top",
"value"},
true)
138 if (!RD->hasAttr<PointerAttr>() && !RD->hasAttr<OwnerAttr>())
142 return llvm::StringSwitch<bool>(FD->
getName())
143 .Cases({
"begin",
"rbegin",
"cbegin",
"crbegin"},
true)
144 .Cases({
"end",
"rend",
"cend",
"crend"},
true)
149 return llvm::StringSwitch<bool>(FD->
getName())
150 .Cases({
"get",
"any_cast"},
true)
175 bool Result = RD->hasAttr<
T>();
177 if (
auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(RD))
178 Result |= CTSD->getSpecializedTemplate()->getTemplatedDecl()->hasAttr<
T>();
Defines the clang::ASTContext interface.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
static bool hasSameType(QualType T1, QualType T2)
Determine whether the given types T1 and T2 are equivalent.
Type source information for an attributed type.
TypeLoc getModifiedLoc() const
The modified type, which is generally canonically different from the attribute type.
Represents a static or instance method of a struct/union/class.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool isStdNamespace() const
Decl - This represents one declaration (or definition), e.g.
bool isInStdNamespace() const
ASTContext & getASTContext() const LLVM_READONLY
DeclContext * getDeclContext()
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
TypeSourceInfo * getTypeSourceInfo() const
Represents a function declaration or definition.
const ParmVarDecl * getParamDecl(unsigned i) const
QualType getReturnType() const
FunctionDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
size_t param_size() const
One of these records is kept for each identifier that is lexed.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
A (possibly-)qualified type.
Base wrapper for a particular "section" of type source info.
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isPointerType() const
bool isReferenceType() const
const CXXRecordDecl * getPointeeCXXRecordDecl() const
If this is a pointer or reference to a RecordType, return the CXXRecordDecl that the type refers to.
bool isLValueReferenceType() const
bool isNullPtrType() const
static bool isRecordWithAttr(QualType Type)
bool isGslPointerType(QualType QT)
bool shouldTrackImplicitObjectArg(const CXXMethodDecl *Callee)
bool shouldTrackFirstArgument(const FunctionDecl *FD)
bool isAssignmentOperatorLifetimeBound(const CXXMethodDecl *CMD)
bool isPointerLikeType(QualType QT)
bool isNormalAssignmentOperator(const FunctionDecl *FD)
bool implicitObjectParamIsLifetimeBound(const FunctionDecl *FD)
const FunctionDecl * getDeclWithMergedLifetimeBoundAttrs(const FunctionDecl *FD)
bool isGslOwnerType(QualType QT)
bool isInStlNamespace(const Decl *D)
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
bool isCompoundAssignmentOperator(OverloadedOperatorKind Kind)
Determine if this is a compound assignment operator.
LLVM_READONLY bool isUppercase(unsigned char c)
Return true if this character is an uppercase ASCII letter: [A-Z].
@ Result
The result type of a method or function.
const FunctionProtoType * T