14using namespace ast_matchers;
21std::optional<std::string>
24 std::optional<Qualifiers> *QualifiersToAppend) {
29 "Expecting a VarDecl of type of pointer to object type");
38 case TypeLoc::ConstantArray:
39 case TypeLoc::IncompleteArray:
40 case TypeLoc::VariableArray:
41 case TypeLoc::DependentSizedArray:
42 case TypeLoc::Decayed:
43 assert(isa<ParmVarDecl>(VD) &&
"An array type shall not be treated as a "
44 "pointer type unless it decays.");
47 case TypeLoc::Pointer:
72 if (!PteEndOfTokenLoc.
isValid())
76 if (!
SM.isBeforeInTranslationUnit(PteEndOfTokenLoc, IdentLoc) &&
77 PteEndOfTokenLoc != IdentLoc) {
97std::optional<std::string>
100 std::optional<Qualifiers> *QualifiersToAppend) {
104 "Expecting a VarDecl of reference to pointer type");
110 "Expecting a VarDecl of type of pointer to object type");
120 case TypeLoc::ConstantArray:
121 case TypeLoc::IncompleteArray:
122 case TypeLoc::VariableArray:
123 case TypeLoc::DependentSizedArray:
124 case TypeLoc::LValueReference:
154 if (!PteEndOfTokenLoc.
isValid())
158 if (!
SM.isBeforeInTranslationUnit(PteEndOfTokenLoc, IdentLoc)) {
178 if (
D->getQualifier()) {
198std::optional<StringRef>
213 return getRangeText({ParmIdentBeginLoc, ParmIdentEndLoc},
SM, LangOpts);
220 std::optional<SourceLocation> LastCharLoc =
getPastLoc(
E,
SM, LangOpts);
std::optional< std::string > getPointee2TypeText(const DeclaratorDecl *VD, const SourceManager &SM, const LangOptions &LangOpts, std::optional< Qualifiers > *QualifiersToAppend)
Represents a character-granular source range.
static CharSourceRange getCharRange(SourceRange R)
SourceLocation getLocation() const
SourceLocation getBeginLoc() const LLVM_READONLY
Represents a ValueDecl that came out of a declarator.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
NestedNameSpecifier getQualifier() const
Retrieve the nested-name-specifier that qualifies the name of this declaration, if it was present in ...
TypeSourceInfo * getTypeSourceInfo() const
This represents one expression.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
static StringRef getSourceText(CharSourceRange Range, const SourceManager &SM, const LangOptions &LangOpts, bool *Invalid=nullptr)
Returns a string for the source that the range encompasses.
static bool isAtEndOfMacroExpansion(SourceLocation loc, const SourceManager &SM, const LangOptions &LangOpts, SourceLocation *MacroEnd=nullptr)
Returns true if the given MacroID location points at the last token of the macro expansion.
static SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset, const SourceManager &SM, const LangOptions &LangOpts)
Computes the source location just past the end of the token at this source location.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
Wrapper for source info for pointers.
A (possibly-)qualified type.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
SourceLocation getBeginLoc() const LLVM_READONLY
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
TypeLoc getNextTypeLoc() const
Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the TypeLoc is a PointerLoc and next Typ...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
TypeLocClass getTypeLocClass() const
SourceLocation getEndLoc() const
Get the end source location.
SourceLocation getBeginLoc() const
Get the begin source location.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
bool isFunctionPointerType() const
bool isPointerType() const
bool isReferenceType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
The JSON file list parser is used to communicate input to InstallAPI.
SourceLocation getVarDeclIdentifierLoc(const DeclaratorDecl *VD)
SourceLocation getBeginLocOfNestedIdentifier(const DeclaratorDecl *D)
std::optional< StringRef > getExprText(const Expr *E, const SourceManager &SM, const LangOptions &LangOpts)
std::optional< std::string > getPointeeTypeText(const DeclaratorDecl *VD, const SourceManager &SM, const LangOptions &LangOpts, std::optional< Qualifiers > *QualifiersToAppend)
std::optional< StringRef > getRangeText(SourceRange SR, const SourceManager &SM, const LangOptions &LangOpts)
std::optional< StringRef > getVarDeclIdentifierText(const DeclaratorDecl *VD, const SourceManager &SM, const LangOptions &LangOpts)
std::optional< SourceLocation > getPastLoc(const NodeTy *Node, const SourceManager &SM, const LangOptions &LangOpts)
Diagnostic wrappers for TextAPI types for error reporting.