clang  14.0.0git
Macros | Functions
ParseDecl.cpp File Reference
#include "clang/Parse/Parser.h"
#include "clang/Parse/RAIIObjectsForParser.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/PrettyDeclStackTrace.h"
#include "clang/Basic/AddressSpaces.h"
#include "clang/Basic/Attributes.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Parse/ParseDiagnostic.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/ParsedTemplate.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/SemaDiagnostic.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringSwitch.h"
#include "clang/Parse/AttrParserStringSwitches.inc"
#include "clang/Basic/OpenCLImageTypes.def"
Include dependency graph for ParseDecl.cpp:

Go to the source code of this file.

Macros

#define CLANG_ATTR_LATE_PARSED_LIST
 
#define CLANG_ATTR_IDENTIFIER_ARG_LIST
 
#define CLANG_ATTR_VARIADIC_IDENTIFIER_ARG_LIST
 
#define CLANG_ATTR_THIS_ISA_IDENTIFIER_ARG_LIST
 
#define CLANG_ATTR_TYPE_ARG_LIST
 
#define CLANG_ATTR_ARG_CONTEXT_LIST
 
#define IMAGE_READ_WRITE_TYPE(Type, Id, Ext)
 
#define IMAGE_WRITE_TYPE(Type, Id, Ext)
 
#define IMAGE_READ_TYPE(ImgType, Id, Ext)
 
#define GENERIC_IMAGE_TYPE(ImgType, Id)   case tok::kw_##ImgType##_t:
 
#define GENERIC_IMAGE_TYPE(ImgType, Id)   case tok::kw_##ImgType##_t:
 
#define GENERIC_IMAGE_TYPE(ImgType, Id)   case tok::kw_##ImgType##_t:
 

Functions

static StringRef normalizeAttrName (StringRef Name)
 Normalizes an attribute name by dropping prefixed and suffixed __. More...
 
static bool isAttributeLateParsed (const IdentifierInfo &II)
 isAttributeLateParsed - Return true if the attribute has arguments that require late parsing. More...
 
static bool FindLocsWithCommonFileID (Preprocessor &PP, SourceLocation StartLoc, SourceLocation EndLoc)
 Check if the a start and end source location expand to the same macro. More...
 
static bool attributeHasIdentifierArg (const IdentifierInfo &II)
 Determine whether the given attribute has an identifier argument. More...
 
static bool attributeHasVariadicIdentifierArg (const IdentifierInfo &II)
 Determine whether the given attribute has a variadic identifier argument. More...
 
static bool attributeTreatsKeywordThisAsIdentifier (const IdentifierInfo &II)
 Determine whether the given attribute treats kw_this as an identifier. More...
 
static bool attributeIsTypeArgAttr (const IdentifierInfo &II)
 Determine whether the given attribute parses a type argument. More...
 
static bool attributeParsedArgsUnevaluated (const IdentifierInfo &II)
 Determine whether the given attribute requires parsing its arguments in an unevaluated context or not. More...
 
static bool VersionNumberSeparator (const char Separator)
 
static bool isValidAfterIdentifierInDeclarator (const Token &T)
 isValidAfterIdentifierInDeclaratorAfterDeclSpec - Return true if the specified token is valid after the identifier in a declarator which immediately follows the declspec. More...
 
static void SetupFixedPointError (const LangOptions &LangOpts, const char *&PrevSpec, unsigned &DiagID, bool &isInvalid)
 
static bool isPtrOperatorToken (tok::TokenKind Kind, const LangOptions &Lang, DeclaratorContext TheContext)
 
static bool isPipeDeclerator (const Declarator &D)
 
static SourceLocation getMissingDeclaratorIdLoc (Declarator &D, SourceLocation Loc)
 

Macro Definition Documentation

◆ CLANG_ATTR_ARG_CONTEXT_LIST

#define CLANG_ATTR_ARG_CONTEXT_LIST

◆ CLANG_ATTR_IDENTIFIER_ARG_LIST

#define CLANG_ATTR_IDENTIFIER_ARG_LIST

◆ CLANG_ATTR_LATE_PARSED_LIST

#define CLANG_ATTR_LATE_PARSED_LIST

◆ CLANG_ATTR_THIS_ISA_IDENTIFIER_ARG_LIST

#define CLANG_ATTR_THIS_ISA_IDENTIFIER_ARG_LIST

◆ CLANG_ATTR_TYPE_ARG_LIST

#define CLANG_ATTR_TYPE_ARG_LIST

◆ CLANG_ATTR_VARIADIC_IDENTIFIER_ARG_LIST

#define CLANG_ATTR_VARIADIC_IDENTIFIER_ARG_LIST

◆ GENERIC_IMAGE_TYPE [1/3]

#define GENERIC_IMAGE_TYPE (   ImgType,
  Id 
)    case tok::kw_##ImgType##_t:

◆ GENERIC_IMAGE_TYPE [2/3]

#define GENERIC_IMAGE_TYPE (   ImgType,
  Id 
)    case tok::kw_##ImgType##_t:

◆ GENERIC_IMAGE_TYPE [3/3]

#define GENERIC_IMAGE_TYPE (   ImgType,
  Id 
)    case tok::kw_##ImgType##_t:

◆ IMAGE_READ_TYPE

#define IMAGE_READ_TYPE (   ImgType,
  Id,
  Ext 
)
Value:
case tok::kw_##ImgType##_t: \
if (!handleOpenCLImageKW(Ext, DeclSpec::TST_##ImgType##_t)) \
goto DoneWithDeclSpec; \
break;

◆ IMAGE_READ_WRITE_TYPE

#define IMAGE_READ_WRITE_TYPE (   Type,
  Id,
  Ext 
)

◆ IMAGE_WRITE_TYPE

#define IMAGE_WRITE_TYPE (   Type,
  Id,
  Ext 
)

Function Documentation

◆ attributeHasIdentifierArg()

static bool attributeHasIdentifierArg ( const IdentifierInfo II)
static

Determine whether the given attribute has an identifier argument.

Definition at line 277 of file ParseDecl.cpp.

References clang::IdentifierInfo::getName(), and normalizeAttrName().

◆ attributeHasVariadicIdentifierArg()

static bool attributeHasVariadicIdentifierArg ( const IdentifierInfo II)
static

Determine whether the given attribute has a variadic identifier argument.

Definition at line 286 of file ParseDecl.cpp.

References clang::IdentifierInfo::getName(), and normalizeAttrName().

◆ attributeIsTypeArgAttr()

static bool attributeIsTypeArgAttr ( const IdentifierInfo II)
static

Determine whether the given attribute parses a type argument.

Definition at line 304 of file ParseDecl.cpp.

References clang::IdentifierInfo::getName(), and normalizeAttrName().

◆ attributeParsedArgsUnevaluated()

static bool attributeParsedArgsUnevaluated ( const IdentifierInfo II)
static

Determine whether the given attribute requires parsing its arguments in an unevaluated context or not.

Definition at line 314 of file ParseDecl.cpp.

References clang::IdentifierInfo::getName(), and normalizeAttrName().

◆ attributeTreatsKeywordThisAsIdentifier()

static bool attributeTreatsKeywordThisAsIdentifier ( const IdentifierInfo II)
static

Determine whether the given attribute treats kw_this as an identifier.

Definition at line 295 of file ParseDecl.cpp.

References clang::IdentifierInfo::getName(), and normalizeAttrName().

◆ FindLocsWithCommonFileID()

static bool FindLocsWithCommonFileID ( Preprocessor PP,
SourceLocation  StartLoc,
SourceLocation  EndLoc 
)
static

◆ getMissingDeclaratorIdLoc()

static SourceLocation getMissingDeclaratorIdLoc ( Declarator D,
SourceLocation  Loc 
)
static

◆ isAttributeLateParsed()

static bool isAttributeLateParsed ( const IdentifierInfo II)
static

isAttributeLateParsed - Return true if the attribute has arguments that require late parsing.

Definition at line 81 of file ParseDecl.cpp.

References clang::IdentifierInfo::getName(), and normalizeAttrName().

◆ isPipeDeclerator()

static bool isPipeDeclerator ( const Declarator D)
static

◆ isPtrOperatorToken()

static bool isPtrOperatorToken ( tok::TokenKind  Kind,
const LangOptions Lang,
DeclaratorContext  TheContext 
)
static

◆ isValidAfterIdentifierInDeclarator()

static bool isValidAfterIdentifierInDeclarator ( const Token T)
static

isValidAfterIdentifierInDeclaratorAfterDeclSpec - Return true if the specified token is valid after the identifier in a declarator which immediately follows the declspec.

For example, these things are valid:

 int x   [             4];         // direct-declarator
 int x   (             int y);     // direct-declarator

int(int x ) // direct-declarator int x ; // simple-declaration int x = 17; // init-declarator-list int x , y; // init-declarator-list int x asm ("foo"); // init-declarator-list int x : 4; // struct-declarator int x { 5}; // C++'0x unified initializers

This is not, because 'x' does not immediately follow the declspec (though ')' happens to be valid anyway). int (x)

Definition at line 2563 of file ParseDecl.cpp.

References clang::Token::isOneOf().

◆ normalizeAttrName()

static StringRef normalizeAttrName ( StringRef  Name)
static

◆ SetupFixedPointError()

static void SetupFixedPointError ( const LangOptions LangOpts,
const char *&  PrevSpec,
unsigned DiagID,
bool isInvalid 
)
static

Definition at line 3025 of file ParseDecl.cpp.

References isInvalid().

◆ VersionNumberSeparator()

static bool VersionNumberSeparator ( const char  Separator)
static

Definition at line 888 of file ParseDecl.cpp.