clang: include/clang/Basic/AttributeCommonInfo.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_CLANG_BASIC_ATTRIBUTECOMMONINFO_H

15#define LLVM_CLANG_BASIC_ATTRIBUTECOMMONINFO_H

16

19

21

22class ASTRecordWriter;

23class IdentifierInfo;

24

26public:

27

29

31

32

34

35

37

38

40

41

43

44

46

47

49

50

51

52

54

55

57

58

59

63#define PARSED_ATTR(NAME) AT_##NAME,

64#include "clang/Sema/AttrParsedAttrList.inc"

65#undef PARSED_ATTR

69 };

71

72private:

77

78 LLVM_PREFERRED_TYPE(Kind)

79 unsigned AttrKind : 16;

80

81 LLVM_PREFERRED_TYPE(Syntax)

82 unsigned SyntaxUsed : 4;

83 LLVM_PREFERRED_TYPE(bool)

84 unsigned SpellingIndex : 4;

85 LLVM_PREFERRED_TYPE(bool)

86 unsigned IsAlignas : 1;

87 LLVM_PREFERRED_TYPE(bool)

88 unsigned IsRegularKeywordAttribute : 1;

89

90protected:

92

93public:

94

95

97 public:

98 constexpr Form(Syntax SyntaxUsed, unsigned SpellingIndex, bool IsAlignas,

99 bool IsRegularKeywordAttribute)

100 : SyntaxUsed(SyntaxUsed), SpellingIndex(SpellingIndex),

101 IsAlignas(IsAlignas),

102 IsRegularKeywordAttribute(IsRegularKeywordAttribute) {}

105 IsAlignas(Tok == tok::kw_alignas),

107

112

118 static Form Keyword(bool IsAlignas, bool IsRegularKeywordAttribute) {

120 IsRegularKeywordAttribute);

121 }

126

127 private:

130 IsAlignas(0), IsRegularKeywordAttribute(0) {}

131

132 LLVM_PREFERRED_TYPE(Syntax)

133 unsigned SyntaxUsed : 4;

134 unsigned SpellingIndex : 4;

135 LLVM_PREFERRED_TYPE(bool)

136 unsigned IsAlignas : 1;

137 LLVM_PREFERRED_TYPE(bool)

138 unsigned IsRegularKeywordAttribute : 1;

139 };

140

144 : AttrName(AttrName), ScopeName(ScopeName), AttrRange(AttrRange),

145 ScopeLoc(ScopeLoc), AttrKind(AttrKind),

146 SyntaxUsed(FormUsed.getSyntax()),

147 SpellingIndex(FormUsed.getSpellingIndex()),

151 "Invalid syntax!");

152 }

153

158 AttrName, ScopeName, AttrRange, ScopeLoc,

160 FormUsed) {}

161

163 Form FormUsed)

165 FormUsed) {}

166

169 FormUsed) {}

170

173

177 return Form(getSyntax(), SpellingIndex, IsAlignas,

178 IsRegularKeywordAttribute);

179 }

185

186 bool hasScope() const { return ScopeName; }

189

190

191

192

194

197

200

202

204

206

207

208

209

210

212 }

213

214

215

218 }

219

221

224 }

225

227

230 }

231

234 "Spelling cannot be found");

236 ? SpellingIndex

237 : calculateAttributeSpellingListIndex();

238 }

240

243

244private:

245

246

247

248 unsigned calculateAttributeSpellingListIndex() const;

249

251

252 unsigned getAttributeSpellingListIndexRaw() const { return SpellingIndex; }

253

254protected:

257 }

258};

259

261 switch (Kind) {

262 default:

263 return false;

264#define KEYWORD_ATTRIBUTE(NAME, HASARG, ...) \

265 case tok::kw_##NAME: \

266 return HASARG;

267#include "clang/Basic/RegularKeywordAttrInfo.inc"

268#undef KEYWORD_ATTRIBUTE

269 }

270}

271

272}

273

274#endif

enum clang::sema::@1725::IndirectLocalPathEntry::EntryKind Kind

Defines the clang::SourceLocation class and associated facilities.

Defines the clang::TokenKind enum and support functions.

An object for streaming information to a record.

Combines information about the source-code form of an attribute, including its syntax and spelling.

static Form HLSLAnnotation()

unsigned getSpellingIndex() const

static Form Keyword(bool IsAlignas, bool IsRegularKeywordAttribute)

constexpr Form(Syntax SyntaxUsed, unsigned SpellingIndex, bool IsAlignas, bool IsRegularKeywordAttribute)

static Form ContextSensitiveKeyword()

bool isRegularKeywordAttribute() const

constexpr Form(tok::TokenKind Tok)

SourceLocation getScopeLoc() const

bool isAttributeSpellingListCalculated() const

AttributeCommonInfo(const IdentifierInfo *AttrName, SourceRange AttrRange, Form FormUsed)

bool isMicrosoftAttribute() const

bool isClangScope() const

void setAttributeSpellingListIndex(unsigned V)

std::string getNormalizedFullName() const

Gets the normalized full name, which consists of both scope and name and with surrounding underscores...

Syntax

The style used to specify an attribute.

@ AS_Keyword

__ptr16, alignas(...), etc.

@ AS_Declspec

__declspec(...)

@ AS_ContextSensitiveKeyword

Context-sensitive version of a keyword attribute.

@ AS_HLSLAnnotation

:

@ AS_Implicit

The attibute has no source code manifestation and is only created implicitly.

@ AS_Microsoft

[uuid("...")] class Foo

AttributeCommonInfo(SourceRange AttrRange, Kind K, Form FormUsed)

bool isCXX11Attribute() const

AttributeCommonInfo(const IdentifierInfo *AttrName, const IdentifierInfo *ScopeName, SourceRange AttrRange, SourceLocation ScopeLoc, Kind AttrKind, Form FormUsed)

bool isDeclspecAttribute() const

SourceRange getRange() const

bool isC23Attribute() const

void setRange(SourceRange R)

void setAttrName(const IdentifierInfo *AttrNameII)

unsigned getAttributeSpellingListIndex() const

const IdentifierInfo * getScopeName() const

bool isContextSensitiveKeywordAttribute() const

AttributeCommonInfo(AttributeCommonInfo &&)=default

bool isGNUAttribute() const

bool isRegularKeywordAttribute() const

bool isKeywordAttribute() const

SourceLocation getLoc() const

const IdentifierInfo * getAttrName() const

AttributeCommonInfo(const IdentifierInfo *AttrName, const IdentifierInfo *ScopeName, SourceRange AttrRange, SourceLocation ScopeLoc, Form FormUsed)

AttributeCommonInfo(const AttributeCommonInfo &)=default

static constexpr unsigned SpellingNotCalculated

bool isStandardAttributeSyntax() const

The attribute is spelled [[]] in either C or C++ mode, including standard attributes spelled with a k...

Kind getParsedKind() const

One of these records is kept for each identifier that is lexed.

Scope - A scope is a transient data structure that is used while parsing the program.

Encodes a location in the source.

A trivial tuple used to represent a source range.

SourceLocation getBegin() const

TokenKind

Provides a simple uniform namespace for tokens from all C languages.

The JSON file list parser is used to communicate input to InstallAPI.

bool doesKeywordAttributeTakeArgs(tok::TokenKind Kind)