clang  16.0.0git
RAIIObjectsForParser.h
Go to the documentation of this file.
1 //===--- RAIIObjectsForParser.h - RAII helpers for the parser ---*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines and implements the some simple RAII objects that are used
10 // by the parser to manage bits in recursion.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_PARSE_RAIIOBJECTSFORPARSER_H
15 #define LLVM_CLANG_PARSE_RAIIOBJECTSFORPARSER_H
16 
18 #include "clang/Parse/Parser.h"
21 #include "clang/Sema/Sema.h"
22 
23 namespace clang {
24  // TODO: move ParsingClassDefinition here.
25  // TODO: move TentativeParsingAction here.
26 
27  /// A RAII object used to temporarily suppress access-like
28  /// checking. Access-like checks are those associated with
29  /// controlling the use of a declaration, like C++ access control
30  /// errors and deprecation warnings. They are contextually
31  /// dependent, in that they can only be resolved with full
32  /// information about what's being declared. They are also
33  /// suppressed in certain contexts, like the template arguments of
34  /// an explicit instantiation. However, those suppression contexts
35  /// cannot necessarily be fully determined in advance; for
36  /// example, something starting like this:
37  /// template <> class std::vector<A::PrivateType>
38  /// might be the entirety of an explicit instantiation:
39  /// template <> class std::vector<A::PrivateType>;
40  /// or just an elaborated type specifier:
41  /// template <> class std::vector<A::PrivateType> make_vector<>();
42  /// Therefore this class collects all the diagnostics and permits
43  /// them to be re-delayed in a new context.
45  Sema &S;
46  sema::DelayedDiagnosticPool DiagnosticPool;
48  bool Active;
49 
50  public:
51  /// Begin suppressing access-like checks
52  SuppressAccessChecks(Parser &P, bool activate = true)
53  : S(P.getActions()), DiagnosticPool(nullptr) {
54  if (activate) {
55  State = S.PushParsingDeclaration(DiagnosticPool);
56  Active = true;
57  } else {
58  Active = false;
59  }
60  }
62  : S(Other.S), DiagnosticPool(std::move(Other.DiagnosticPool)),
63  State(Other.State), Active(Other.Active) {
64  Other.Active = false;
65  }
66  void operator=(SuppressAccessChecks &&Other) = delete;
67 
68  void done() {
69  assert(Active && "trying to end an inactive suppression");
70  S.PopParsingDeclaration(State, nullptr);
71  Active = false;
72  }
73 
74  void redelay() {
75  assert(!Active && "redelaying without having ended first");
76  if (!DiagnosticPool.pool_empty())
77  S.redelayDiagnostics(DiagnosticPool);
78  assert(DiagnosticPool.pool_empty());
79  }
80 
82  if (Active) done();
83  }
84  };
85 
86  /// RAII object used to inform the actions that we're
87  /// currently parsing a declaration. This is active when parsing a
88  /// variable's initializer, but not when parsing the body of a
89  /// class or function definition.
91  Sema &Actions;
92  sema::DelayedDiagnosticPool DiagnosticPool;
94  bool Popped;
95 
97  void operator=(const ParsingDeclRAIIObject &) = delete;
98 
99  public:
102  : Actions(P.getActions()), DiagnosticPool(nullptr) {
103  push();
104  }
105 
106  /// Creates a RAII object whose pool is optionally parented by another.
108  const sema::DelayedDiagnosticPool *parentPool)
109  : Actions(P.getActions()), DiagnosticPool(parentPool) {
110  push();
111  }
112 
113  /// Creates a RAII object and, optionally, initialize its
114  /// diagnostics pool by stealing the diagnostics from another
115  /// RAII object (which is assumed to be the current top pool).
117  : Actions(P.getActions()),
118  DiagnosticPool(other ? other->DiagnosticPool.getParent() : nullptr) {
119  if (other) {
120  DiagnosticPool.steal(other->DiagnosticPool);
121  other->abort();
122  }
123  push();
124  }
125 
127  abort();
128  }
129 
131  return DiagnosticPool;
132  }
134  return DiagnosticPool;
135  }
136 
137  /// Resets the RAII object for a new declaration.
138  void reset() {
139  abort();
140  push();
141  }
142 
143  /// Signals that the context was completed without an appropriate
144  /// declaration being parsed.
145  void abort() {
146  pop(nullptr);
147  }
148 
149  void complete(Decl *D) {
150  assert(!Popped && "ParsingDeclaration has already been popped!");
151  pop(D);
152  }
153 
154  /// Unregister this object from Sema, but remember all the
155  /// diagnostics that were emitted into it.
157  pop(nullptr);
158  }
159 
160  private:
161  void push() {
162  State = Actions.PushParsingDeclaration(DiagnosticPool);
163  Popped = false;
164  }
165 
166  void pop(Decl *D) {
167  if (!Popped) {
168  Actions.PopParsingDeclaration(State, D);
169  Popped = true;
170  }
171  }
172  };
173 
174  /// A class for parsing a DeclSpec.
175  class ParsingDeclSpec : public DeclSpec {
176  ParsingDeclRAIIObject ParsingRAII;
177 
178  public:
180  : DeclSpec(P.getAttrFactory()),
181  ParsingRAII(P, ParsingDeclRAIIObject::NoParent) {}
183  : DeclSpec(P.getAttrFactory()),
184  ParsingRAII(P, RAII) {}
185 
187  return ParsingRAII.getDelayedDiagnosticPool();
188  }
189 
190  void complete(Decl *D) {
191  ParsingRAII.complete(D);
192  }
193 
194  void abort() {
195  ParsingRAII.abort();
196  }
197  };
198 
199  /// A class for parsing a declarator.
200  class ParsingDeclarator : public Declarator {
201  ParsingDeclRAIIObject ParsingRAII;
202 
203  public:
205  const ParsedAttributes &DeclarationAttrs,
207  : Declarator(DS, DeclarationAttrs, C),
208  ParsingRAII(P, &DS.getDelayedDiagnosticPool()) {}
209 
210  const ParsingDeclSpec &getDeclSpec() const {
211  return static_cast<const ParsingDeclSpec&>(Declarator::getDeclSpec());
212  }
213 
215  return const_cast<ParsingDeclSpec&>(getDeclSpec());
216  }
217 
218  void clear() {
220  ParsingRAII.reset();
221  }
222 
223  void complete(Decl *D) {
224  ParsingRAII.complete(D);
225  }
226  };
227 
228  /// A class for parsing a field declarator.
230  ParsingDeclRAIIObject ParsingRAII;
231 
232  public:
234  const ParsedAttributes &DeclarationAttrs)
235  : FieldDeclarator(DS, DeclarationAttrs),
236  ParsingRAII(P, &DS.getDelayedDiagnosticPool()) {}
237 
238  const ParsingDeclSpec &getDeclSpec() const {
239  return static_cast<const ParsingDeclSpec&>(D.getDeclSpec());
240  }
241 
243  return const_cast<ParsingDeclSpec&>(getDeclSpec());
244  }
245 
246  void complete(Decl *D) {
247  ParsingRAII.complete(D);
248  }
249  };
250 
251  /// ExtensionRAIIObject - This saves the state of extension warnings when
252  /// constructed and disables them. When destructed, it restores them back to
253  /// the way they used to be. This is used to handle __extension__ in the
254  /// parser.
256  ExtensionRAIIObject(const ExtensionRAIIObject &) = delete;
257  void operator=(const ExtensionRAIIObject &) = delete;
258 
259  DiagnosticsEngine &Diags;
260  public:
261  ExtensionRAIIObject(DiagnosticsEngine &diags) : Diags(diags) {
263  }
264 
267  }
268  };
269 
270  /// ColonProtectionRAIIObject - This sets the Parser::ColonIsSacred bool and
271  /// restores it when destroyed. This says that "foo:" should not be
272  /// considered a possible typo for "foo::" for error recovery purposes.
274  Parser &P;
275  bool OldVal;
276  public:
278  : P(p), OldVal(P.ColonIsSacred) {
279  P.ColonIsSacred = Value;
280  }
281 
282  /// restore - This can be used to restore the state early, before the dtor
283  /// is run.
284  void restore() {
285  P.ColonIsSacred = OldVal;
286  }
287 
289  restore();
290  }
291  };
292 
293  /// Activates OpenMP parsing mode to preseve OpenMP specific annotation
294  /// tokens.
296  Parser &P;
297  bool OldVal;
298 
299  public:
301  : P(P), OldVal(P.OpenMPDirectiveParsing) {
302  P.OpenMPDirectiveParsing = Value;
303  }
304 
305  /// This can be used to restore the state early, before the dtor
306  /// is run.
307  void restore() { P.OpenMPDirectiveParsing = OldVal; }
308 
310  };
311 
312  /// RAII object that makes '>' behave either as an operator
313  /// or as the closing angle bracket for a template argument list.
315  bool &GreaterThanIsOperator;
316  bool OldGreaterThanIsOperator;
317  public:
318  GreaterThanIsOperatorScope(bool &GTIO, bool Val)
319  : GreaterThanIsOperator(GTIO), OldGreaterThanIsOperator(GTIO) {
320  GreaterThanIsOperator = Val;
321  }
322 
324  GreaterThanIsOperator = OldGreaterThanIsOperator;
325  }
326  };
327 
329  bool &InMessageExpression;
330  bool OldValue;
331 
332  public:
334  : InMessageExpression(P.InMessageExpression),
335  OldValue(P.InMessageExpression) {
336  InMessageExpression = Value;
337  }
338 
340  InMessageExpression = OldValue;
341  }
342  };
343 
344  /// RAII object that makes sure paren/bracket/brace count is correct
345  /// after declaration/statement parsing, even when there's a parsing error.
347  Parser &P;
348  unsigned short ParenCount, BracketCount, BraceCount;
349  public:
351  : P(p), ParenCount(p.ParenCount), BracketCount(p.BracketCount),
352  BraceCount(p.BraceCount) { }
353 
355  P.AngleBrackets.clear(P);
356  P.ParenCount = ParenCount;
357  P.BracketCount = BracketCount;
358  P.BraceCount = BraceCount;
359  }
360  };
361 
363  PoisonIdentifierRAIIObject Ident_AbnormalTermination;
364  PoisonIdentifierRAIIObject Ident_GetExceptionCode;
365  PoisonIdentifierRAIIObject Ident_GetExceptionInfo;
366  PoisonIdentifierRAIIObject Ident__abnormal_termination;
367  PoisonIdentifierRAIIObject Ident__exception_code;
368  PoisonIdentifierRAIIObject Ident__exception_info;
369  PoisonIdentifierRAIIObject Ident___abnormal_termination;
370  PoisonIdentifierRAIIObject Ident___exception_code;
371  PoisonIdentifierRAIIObject Ident___exception_info;
372  public:
374  : Ident_AbnormalTermination(Self.Ident_AbnormalTermination, NewValue),
375  Ident_GetExceptionCode(Self.Ident_GetExceptionCode, NewValue),
376  Ident_GetExceptionInfo(Self.Ident_GetExceptionInfo, NewValue),
377  Ident__abnormal_termination(Self.Ident__abnormal_termination, NewValue),
378  Ident__exception_code(Self.Ident__exception_code, NewValue),
379  Ident__exception_info(Self.Ident__exception_info, NewValue),
380  Ident___abnormal_termination(Self.Ident___abnormal_termination, NewValue),
381  Ident___exception_code(Self.Ident___exception_code, NewValue),
382  Ident___exception_info(Self.Ident___exception_info, NewValue) {
383  }
384  };
385 
386  /// RAII class that helps handle the parsing of an open/close delimiter
387  /// pair, such as braces { ... } or parentheses ( ... ).
389  Parser& P;
390  tok::TokenKind Kind, Close, FinalToken;
391  SourceLocation (Parser::*Consumer)();
392  SourceLocation LOpen, LClose;
393 
394  unsigned short &getDepth() {
395  switch (Kind) {
396  case tok::l_brace: return P.BraceCount;
397  case tok::l_square: return P.BracketCount;
398  case tok::l_paren: return P.ParenCount;
399  default: llvm_unreachable("Wrong token kind");
400  }
401  }
402 
403  bool diagnoseOverflow();
404  bool diagnoseMissingClose();
405 
406  public:
408  tok::TokenKind FinalToken = tok::semi)
409  : GreaterThanIsOperatorScope(p.GreaterThanIsOperator, true),
410  P(p), Kind(k), FinalToken(FinalToken)
411  {
412  switch (Kind) {
413  default: llvm_unreachable("Unexpected balanced token");
414  case tok::l_brace:
415  Close = tok::r_brace;
416  Consumer = &Parser::ConsumeBrace;
417  break;
418  case tok::l_paren:
419  Close = tok::r_paren;
420  Consumer = &Parser::ConsumeParen;
421  break;
422 
423  case tok::l_square:
424  Close = tok::r_square;
425  Consumer = &Parser::ConsumeBracket;
426  break;
427  }
428  }
429 
430  SourceLocation getOpenLocation() const { return LOpen; }
431  SourceLocation getCloseLocation() const { return LClose; }
432  SourceRange getRange() const { return SourceRange(LOpen, LClose); }
433 
434  bool consumeOpen() {
435  if (!P.Tok.is(Kind))
436  return true;
437 
438  if (getDepth() < P.getLangOpts().BracketDepth) {
439  LOpen = (P.*Consumer)();
440  return false;
441  }
442 
443  return diagnoseOverflow();
444  }
445 
446  bool expectAndConsume(unsigned DiagID = diag::err_expected,
447  const char *Msg = "",
448  tok::TokenKind SkipToTok = tok::unknown);
449  bool consumeClose() {
450  if (P.Tok.is(Close)) {
451  LClose = (P.*Consumer)();
452  return false;
453  } else if (P.Tok.is(tok::semi) && P.NextToken().is(Close)) {
454  SourceLocation SemiLoc = P.ConsumeToken();
455  P.Diag(SemiLoc, diag::err_unexpected_semi)
456  << Close << FixItHint::CreateRemoval(SourceRange(SemiLoc, SemiLoc));
457  LClose = (P.*Consumer)();
458  return false;
459  }
460 
461  return diagnoseMissingClose();
462  }
463  void skipToEnd();
464  };
465 } // end namespace clang
466 
467 #endif
clang::ParsingDeclSpec::ParsingDeclSpec
ParsingDeclSpec(Parser &P)
Definition: RAIIObjectsForParser.h:179
clang::ParsingDeclSpec
A class for parsing a DeclSpec.
Definition: RAIIObjectsForParser.h:175
clang::DiagnosticsEngine::IncrementAllExtensionsSilenced
void IncrementAllExtensionsSilenced()
Counter bumped when an extension block is/ encountered.
Definition: Diagnostic.h:784
clang::GreaterThanIsOperatorScope::~GreaterThanIsOperatorScope
~GreaterThanIsOperatorScope()
Definition: RAIIObjectsForParser.h:323
clang::SuppressAccessChecks::operator=
void operator=(SuppressAccessChecks &&Other)=delete
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:210
clang::InMessageExpressionRAIIObject::InMessageExpressionRAIIObject
InMessageExpressionRAIIObject(Parser &P, bool Value)
Definition: RAIIObjectsForParser.h:333
clang::InMessageExpressionRAIIObject
Definition: RAIIObjectsForParser.h:328
clang::ExtensionRAIIObject::~ExtensionRAIIObject
~ExtensionRAIIObject()
Definition: RAIIObjectsForParser.h:265
clang::ParsingDeclSpec::getDelayedDiagnosticPool
const sema::DelayedDiagnosticPool & getDelayedDiagnosticPool() const
Definition: RAIIObjectsForParser.h:186
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::ParsingDeclSpec::complete
void complete(Decl *D)
Definition: RAIIObjectsForParser.h:190
clang::ColonProtectionRAIIObject::ColonProtectionRAIIObject
ColonProtectionRAIIObject(Parser &p, bool Value=true)
Definition: RAIIObjectsForParser.h:277
clang::ColonProtectionRAIIObject::restore
void restore()
restore - This can be used to restore the state early, before the dtor is run.
Definition: RAIIObjectsForParser.h:284
clang::ParsingDeclRAIIObject::ParsingDeclRAIIObject
ParsingDeclRAIIObject(Parser &P, NoParent_t _)
Definition: RAIIObjectsForParser.h:101
clang::ParsingDeclRAIIObject::ParsingDeclRAIIObject
ParsingDeclRAIIObject(Parser &P, ParsingDeclRAIIObject *other)
Creates a RAII object and, optionally, initialize its diagnostics pool by stealing the diagnostics fr...
Definition: RAIIObjectsForParser.h:116
clang::ParsingDeclarator::ParsingDeclarator
ParsingDeclarator(Parser &P, const ParsingDeclSpec &DS, const ParsedAttributes &DeclarationAttrs, DeclaratorContext C)
Definition: RAIIObjectsForParser.h:204
clang::DiagnosticsEngine
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:192
clang::Parser
Parser - This implements a parser for the C family of languages.
Definition: Parser.h:60
clang::InMessageExpressionRAIIObject::~InMessageExpressionRAIIObject
~InMessageExpressionRAIIObject()
Definition: RAIIObjectsForParser.h:339
clang::ColonProtectionRAIIObject
ColonProtectionRAIIObject - This sets the Parser::ColonIsSacred bool and restores it when destroyed.
Definition: RAIIObjectsForParser.h:273
clang::ParsingDeclRAIIObject::abortAndRemember
void abortAndRemember()
Unregister this object from Sema, but remember all the diagnostics that were emitted into it.
Definition: RAIIObjectsForParser.h:156
clang::ParsingFieldDeclarator::complete
void complete(Decl *D)
Definition: RAIIObjectsForParser.h:246
clang::SuppressAccessChecks
A RAII object used to temporarily suppress access-like checking.
Definition: RAIIObjectsForParser.h:44
clang::ParenBraceBracketBalancer::ParenBraceBracketBalancer
ParenBraceBracketBalancer(Parser &p)
Definition: RAIIObjectsForParser.h:350
clang::BalancedDelimiterTracker
RAII class that helps handle the parsing of an open/close delimiter pair, such as braces { ....
Definition: RAIIObjectsForParser.h:388
clang::ParsingDeclarator::getMutableDeclSpec
ParsingDeclSpec & getMutableDeclSpec() const
Definition: RAIIObjectsForParser.h:214
clang::ParsingDeclRAIIObject::complete
void complete(Decl *D)
Definition: RAIIObjectsForParser.h:149
clang::sema::DelayedDiagnosticPool
A collection of diagnostics which were delayed.
Definition: DelayedDiagnostic.h:263
clang::Declarator::getDeclSpec
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
Definition: DeclSpec.h:1969
clang::ParenBraceBracketBalancer
RAII object that makes sure paren/bracket/brace count is correct after declaration/statement parsing,...
Definition: RAIIObjectsForParser.h:346
clang::sema::DelayedDiagnosticPool::steal
void steal(DelayedDiagnosticPool &pool)
Steal the diagnostics from the given pool.
Definition: DelayedDiagnostic.h:304
clang::ParsingDeclRAIIObject::ParsingDeclRAIIObject
ParsingDeclRAIIObject(Parser &P, const sema::DelayedDiagnosticPool *parentPool)
Creates a RAII object whose pool is optionally parented by another.
Definition: RAIIObjectsForParser.h:107
clang::BalancedDelimiterTracker::getCloseLocation
SourceLocation getCloseLocation() const
Definition: RAIIObjectsForParser.h:431
clang::ParsingOpenMPDirectiveRAII
Activates OpenMP parsing mode to preseve OpenMP specific annotation tokens.
Definition: RAIIObjectsForParser.h:295
clang::BalancedDelimiterTracker::expectAndConsume
bool expectAndConsume(unsigned DiagID=diag::err_expected, const char *Msg="", tok::TokenKind SkipToTok=tok::unknown)
Definition: Parser.cpp:2681
clang::ParsingOpenMPDirectiveRAII::~ParsingOpenMPDirectiveRAII
~ParsingOpenMPDirectiveRAII()
Definition: RAIIObjectsForParser.h:309
clang::PoisonSEHIdentifiersRAIIObject::PoisonSEHIdentifiersRAIIObject
PoisonSEHIdentifiersRAIIObject(Parser &Self, bool NewValue)
Definition: RAIIObjectsForParser.h:373
clang::ParsingFieldDeclarator::getDeclSpec
const ParsingDeclSpec & getDeclSpec() const
Definition: RAIIObjectsForParser.h:238
clang::sema::DelayedDiagnosticPool::pool_empty
bool pool_empty() const
Definition: DelayedDiagnostic.h:319
DelayedDiagnostic.h
clang::GreaterThanIsOperatorScope::GreaterThanIsOperatorScope
GreaterThanIsOperatorScope(bool &GTIO, bool Val)
Definition: RAIIObjectsForParser.h:318
clang::ParsingDeclarator::complete
void complete(Decl *D)
Definition: RAIIObjectsForParser.h:223
clang::Declarator::clear
void clear()
Reset the contents of this Declarator.
Definition: DeclSpec.h:2032
clang::ParsingDeclRAIIObject::abort
void abort()
Signals that the context was completed without an appropriate declaration being parsed.
Definition: RAIIObjectsForParser.h:145
clang::FieldDeclarator::D
Declarator D
Definition: DeclSpec.h:2678
clang::BalancedDelimiterTracker::consumeOpen
bool consumeOpen()
Definition: RAIIObjectsForParser.h:434
clang::ParenBraceBracketBalancer::~ParenBraceBracketBalancer
~ParenBraceBracketBalancer()
Definition: RAIIObjectsForParser.h:354
clang::ParsingOpenMPDirectiveRAII::restore
void restore()
This can be used to restore the state early, before the dtor is run.
Definition: RAIIObjectsForParser.h:307
clang::ParsingDeclRAIIObject::~ParsingDeclRAIIObject
~ParsingDeclRAIIObject()
Definition: RAIIObjectsForParser.h:126
clang::ParsingDeclRAIIObject::getDelayedDiagnosticPool
sema::DelayedDiagnosticPool & getDelayedDiagnosticPool()
Definition: RAIIObjectsForParser.h:130
Sema.h
clang::ExtensionRAIIObject::ExtensionRAIIObject
ExtensionRAIIObject(DiagnosticsEngine &diags)
Definition: RAIIObjectsForParser.h:261
clang::ParsingDeclRAIIObject::getDelayedDiagnosticPool
const sema::DelayedDiagnosticPool & getDelayedDiagnosticPool() const
Definition: RAIIObjectsForParser.h:133
clang::ParsingDeclSpec::ParsingDeclSpec
ParsingDeclSpec(Parser &P, ParsingDeclRAIIObject *RAII)
Definition: RAIIObjectsForParser.h:182
clang::SuppressAccessChecks::SuppressAccessChecks
SuppressAccessChecks(Parser &P, bool activate=true)
Begin suppressing access-like checks.
Definition: RAIIObjectsForParser.h:52
clang::ParsingDeclRAIIObject::reset
void reset()
Resets the RAII object for a new declaration.
Definition: RAIIObjectsForParser.h:138
clang::tok::TokenKind
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
Definition: TokenKinds.h:25
clang::SuppressAccessChecks::~SuppressAccessChecks
~SuppressAccessChecks()
Definition: RAIIObjectsForParser.h:81
P
StringRef P
Definition: ASTMatchersInternal.cpp:563
clang::DeclaratorContext
DeclaratorContext
Definition: DeclSpec.h:1784
clang::ParsingDeclRAIIObject
RAII object used to inform the actions that we're currently parsing a declaration.
Definition: RAIIObjectsForParser.h:90
clang::ParsingDeclSpec::abort
void abort()
Definition: RAIIObjectsForParser.h:194
clang::ParsingFieldDeclarator
A class for parsing a field declarator.
Definition: RAIIObjectsForParser.h:229
Value
Value
Definition: UninitializedValues.cpp:103
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:83
clang::ParsingDeclarator::getDeclSpec
const ParsingDeclSpec & getDeclSpec() const
Definition: RAIIObjectsForParser.h:210
clang::Sema
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:358
clang::ParsingDeclRAIIObject::NoParent
@ NoParent
Definition: RAIIObjectsForParser.h:100
clang::ParsedAttributes
ParsedAttributes - A collection of parsed attributes.
Definition: ParsedAttr.h:1023
clang::PoisonSEHIdentifiersRAIIObject
Definition: RAIIObjectsForParser.h:362
clang::BalancedDelimiterTracker::BalancedDelimiterTracker
BalancedDelimiterTracker(Parser &p, tok::TokenKind k, tok::TokenKind FinalToken=tok::semi)
Definition: RAIIObjectsForParser.h:407
clang::BalancedDelimiterTracker::getOpenLocation
SourceLocation getOpenLocation() const
Definition: RAIIObjectsForParser.h:430
clang::Sema::DelayedDiagnosticsState
Definition: Sema.h:933
clang::Sema::PopParsingDeclaration
void PopParsingDeclaration(ParsingDeclState state, Decl *decl)
Definition: SemaDeclAttr.cpp:9585
clang::PoisonIdentifierRAIIObject
An RAII object for [un]poisoning an identifier within a scope.
Definition: IdentifierTable.h:489
clang::SuppressAccessChecks::redelay
void redelay()
Definition: RAIIObjectsForParser.h:74
clang::ExtensionRAIIObject
ExtensionRAIIObject - This saves the state of extension warnings when constructed and disables them.
Definition: RAIIObjectsForParser.h:255
std
Definition: Format.h:4477
clang::BalancedDelimiterTracker::skipToEnd
void skipToEnd()
Definition: Parser.cpp:2717
clang
Definition: CalledOnceCheck.h:17
clang::ParsingOpenMPDirectiveRAII::ParsingOpenMPDirectiveRAII
ParsingOpenMPDirectiveRAII(Parser &P, bool Value=true)
Definition: RAIIObjectsForParser.h:300
clang::Declarator
Information about one declarator, including the parsed type information and the identifier.
Definition: DeclSpec.h:1834
clang::ParsingDeclarator::clear
void clear()
Definition: RAIIObjectsForParser.h:218
clang::FieldDeclarator
This little struct is used to capture information about structure field declarators,...
Definition: DeclSpec.h:2677
clang::FixItHint::CreateRemoval
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
Definition: Diagnostic.h:123
ParseDiagnostic.h
clang::BalancedDelimiterTracker::consumeClose
bool consumeClose()
Definition: RAIIObjectsForParser.h:449
clang::ParsingFieldDeclarator::getMutableDeclSpec
ParsingDeclSpec & getMutableDeclSpec() const
Definition: RAIIObjectsForParser.h:242
clang::ParsingDeclarator
A class for parsing a declarator.
Definition: RAIIObjectsForParser.h:200
clang::ParsingDeclRAIIObject::NoParent_t
NoParent_t
Definition: RAIIObjectsForParser.h:100
clang::GreaterThanIsOperatorScope
RAII object that makes '>' behave either as an operator or as the closing angle bracket for a templat...
Definition: RAIIObjectsForParser.h:314
clang::SuppressAccessChecks::done
void done()
Definition: RAIIObjectsForParser.h:68
true
#define true
Definition: stdbool.h:21
clang::ColonProtectionRAIIObject::~ColonProtectionRAIIObject
~ColonProtectionRAIIObject()
Definition: RAIIObjectsForParser.h:288
clang::BalancedDelimiterTracker::getRange
SourceRange getRange() const
Definition: RAIIObjectsForParser.h:432
clang::DeclSpec
Captures information about "declaration specifiers".
Definition: DeclSpec.h:230
clang::Sema::PushParsingDeclaration
ParsingDeclState PushParsingDeclaration(sema::DelayedDiagnosticPool &pool)
Definition: Sema.h:5287
clang::ParsingFieldDeclarator::ParsingFieldDeclarator
ParsingFieldDeclarator(Parser &P, const ParsingDeclSpec &DS, const ParsedAttributes &DeclarationAttrs)
Definition: RAIIObjectsForParser.h:233
ParsedTemplate.h
clang::DiagnosticsEngine::DecrementAllExtensionsSilenced
void DecrementAllExtensionsSilenced()
Definition: Diagnostic.h:785
clang::SuppressAccessChecks::SuppressAccessChecks
SuppressAccessChecks(SuppressAccessChecks &&Other)
Definition: RAIIObjectsForParser.h:61
Parser.h