2009-12-10 08:21:05 +08:00
|
|
|
//===--- RAIIObjectsForParser.h - RAII helpers for the parser ---*- C++ -*-===//
|
2008-10-20 14:45:43 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2009-12-10 08:21:05 +08:00
|
|
|
// This file defines and implements the some simple RAII objects that are used
|
|
|
|
// by the parser to manage bits in recursion.
|
2008-10-20 14:45:43 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:25:19 +08:00
|
|
|
#ifndef LLVM_CLANG_LIB_PARSE_RAIIOBJECTSFORPARSER_H
|
|
|
|
#define LLVM_CLANG_LIB_PARSE_RAIIOBJECTSFORPARSER_H
|
2008-10-20 14:45:43 +08:00
|
|
|
|
2009-01-29 13:15:15 +08:00
|
|
|
#include "clang/Parse/ParseDiagnostic.h"
|
2012-05-07 14:16:41 +08:00
|
|
|
#include "clang/Parse/Parser.h"
|
|
|
|
#include "clang/Sema/DelayedDiagnostic.h"
|
|
|
|
#include "clang/Sema/Sema.h"
|
2008-10-20 14:45:43 +08:00
|
|
|
|
|
|
|
namespace clang {
|
2009-12-10 08:44:03 +08:00
|
|
|
// TODO: move ParsingClassDefinition here.
|
|
|
|
// TODO: move TentativeParsingAction here.
|
2012-05-07 14:16:41 +08:00
|
|
|
|
2012-05-07 14:16:58 +08:00
|
|
|
/// \brief A RAII object used to temporarily suppress access-like
|
|
|
|
/// checking. Access-like checks are those associated with
|
|
|
|
/// controlling the use of a declaration, like C++ access control
|
|
|
|
/// errors and deprecation warnings. They are contextually
|
|
|
|
/// dependent, in that they can only be resolved with full
|
|
|
|
/// information about what's being declared. They are also
|
|
|
|
/// suppressed in certain contexts, like the template arguments of
|
|
|
|
/// an explicit instantiation. However, those suppression contexts
|
|
|
|
/// cannot necessarily be fully determined in advance; for
|
|
|
|
/// example, something starting like this:
|
|
|
|
/// template <> class std::vector<A::PrivateType>
|
|
|
|
/// might be the entirety of an explicit instantiation:
|
|
|
|
/// template <> class std::vector<A::PrivateType>;
|
|
|
|
/// or just an elaborated type specifier:
|
|
|
|
/// template <> class std::vector<A::PrivateType> make_vector<>();
|
|
|
|
/// Therefore this class collects all the diagnostics and permits
|
|
|
|
/// them to be re-delayed in a new context.
|
|
|
|
class SuppressAccessChecks {
|
|
|
|
Sema &S;
|
|
|
|
sema::DelayedDiagnosticPool DiagnosticPool;
|
|
|
|
Sema::ParsingDeclState State;
|
|
|
|
bool Active;
|
|
|
|
|
|
|
|
public:
|
|
|
|
/// Begin suppressing access-like checks
|
|
|
|
SuppressAccessChecks(Parser &P, bool activate = true)
|
2014-05-21 14:02:52 +08:00
|
|
|
: S(P.getActions()), DiagnosticPool(nullptr) {
|
2012-05-07 14:16:58 +08:00
|
|
|
if (activate) {
|
|
|
|
State = S.PushParsingDeclaration(DiagnosticPool);
|
|
|
|
Active = true;
|
|
|
|
} else {
|
|
|
|
Active = false;
|
|
|
|
}
|
|
|
|
}
|
2015-05-01 01:20:30 +08:00
|
|
|
SuppressAccessChecks(SuppressAccessChecks &&Other)
|
|
|
|
: S(Other.S), DiagnosticPool(std::move(Other.DiagnosticPool)),
|
|
|
|
State(Other.State), Active(Other.Active) {
|
|
|
|
Other.Active = false;
|
|
|
|
}
|
|
|
|
void operator=(SuppressAccessChecks &&Other) = delete;
|
2012-05-07 14:16:58 +08:00
|
|
|
|
|
|
|
void done() {
|
|
|
|
assert(Active && "trying to end an inactive suppression");
|
2014-05-21 14:02:52 +08:00
|
|
|
S.PopParsingDeclaration(State, nullptr);
|
2012-05-07 14:16:58 +08:00
|
|
|
Active = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void redelay() {
|
|
|
|
assert(!Active && "redelaying without having ended first");
|
|
|
|
if (!DiagnosticPool.pool_empty())
|
|
|
|
S.redelayDiagnostics(DiagnosticPool);
|
|
|
|
assert(DiagnosticPool.pool_empty());
|
|
|
|
}
|
|
|
|
|
|
|
|
~SuppressAccessChecks() {
|
|
|
|
if (Active) done();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-05-07 14:16:41 +08:00
|
|
|
/// \brief RAII object used to inform the actions that we're
|
|
|
|
/// currently parsing a declaration. This is active when parsing a
|
|
|
|
/// variable's initializer, but not when parsing the body of a
|
|
|
|
/// class or function definition.
|
|
|
|
class ParsingDeclRAIIObject {
|
|
|
|
Sema &Actions;
|
|
|
|
sema::DelayedDiagnosticPool DiagnosticPool;
|
|
|
|
Sema::ParsingDeclState State;
|
|
|
|
bool Popped;
|
|
|
|
|
2015-02-16 06:54:08 +08:00
|
|
|
ParsingDeclRAIIObject(const ParsingDeclRAIIObject &) = delete;
|
|
|
|
void operator=(const ParsingDeclRAIIObject &) = delete;
|
2012-05-07 14:16:41 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
enum NoParent_t { NoParent };
|
|
|
|
ParsingDeclRAIIObject(Parser &P, NoParent_t _)
|
2014-05-21 14:02:52 +08:00
|
|
|
: Actions(P.getActions()), DiagnosticPool(nullptr) {
|
2012-05-07 14:16:41 +08:00
|
|
|
push();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Creates a RAII object whose pool is optionally parented by another.
|
|
|
|
ParsingDeclRAIIObject(Parser &P,
|
|
|
|
const sema::DelayedDiagnosticPool *parentPool)
|
|
|
|
: Actions(P.getActions()), DiagnosticPool(parentPool) {
|
|
|
|
push();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Creates a RAII object and, optionally, initialize its
|
|
|
|
/// diagnostics pool by stealing the diagnostics from another
|
|
|
|
/// RAII object (which is assumed to be the current top pool).
|
|
|
|
ParsingDeclRAIIObject(Parser &P, ParsingDeclRAIIObject *other)
|
|
|
|
: Actions(P.getActions()),
|
2014-05-21 14:02:52 +08:00
|
|
|
DiagnosticPool(other ? other->DiagnosticPool.getParent() : nullptr) {
|
2012-05-07 14:16:41 +08:00
|
|
|
if (other) {
|
|
|
|
DiagnosticPool.steal(other->DiagnosticPool);
|
|
|
|
other->abort();
|
|
|
|
}
|
|
|
|
push();
|
|
|
|
}
|
|
|
|
|
|
|
|
~ParsingDeclRAIIObject() {
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
|
|
|
sema::DelayedDiagnosticPool &getDelayedDiagnosticPool() {
|
|
|
|
return DiagnosticPool;
|
|
|
|
}
|
|
|
|
const sema::DelayedDiagnosticPool &getDelayedDiagnosticPool() const {
|
|
|
|
return DiagnosticPool;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Resets the RAII object for a new declaration.
|
|
|
|
void reset() {
|
|
|
|
abort();
|
|
|
|
push();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Signals that the context was completed without an appropriate
|
|
|
|
/// declaration being parsed.
|
|
|
|
void abort() {
|
2014-05-21 14:02:52 +08:00
|
|
|
pop(nullptr);
|
2012-05-07 14:16:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void complete(Decl *D) {
|
|
|
|
assert(!Popped && "ParsingDeclaration has already been popped!");
|
|
|
|
pop(D);
|
|
|
|
}
|
|
|
|
|
2012-05-07 14:16:58 +08:00
|
|
|
/// Unregister this object from Sema, but remember all the
|
|
|
|
/// diagnostics that were emitted into it.
|
|
|
|
void abortAndRemember() {
|
2014-05-21 14:02:52 +08:00
|
|
|
pop(nullptr);
|
2012-05-07 14:16:41 +08:00
|
|
|
}
|
|
|
|
|
2012-05-07 14:16:58 +08:00
|
|
|
private:
|
2012-05-07 14:16:41 +08:00
|
|
|
void push() {
|
|
|
|
State = Actions.PushParsingDeclaration(DiagnosticPool);
|
|
|
|
Popped = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void pop(Decl *D) {
|
|
|
|
if (!Popped) {
|
|
|
|
Actions.PopParsingDeclaration(State, D);
|
|
|
|
Popped = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/// A class for parsing a DeclSpec.
|
|
|
|
class ParsingDeclSpec : public DeclSpec {
|
|
|
|
ParsingDeclRAIIObject ParsingRAII;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ParsingDeclSpec(Parser &P)
|
|
|
|
: DeclSpec(P.getAttrFactory()),
|
|
|
|
ParsingRAII(P, ParsingDeclRAIIObject::NoParent) {}
|
|
|
|
ParsingDeclSpec(Parser &P, ParsingDeclRAIIObject *RAII)
|
|
|
|
: DeclSpec(P.getAttrFactory()),
|
|
|
|
ParsingRAII(P, RAII) {}
|
|
|
|
|
|
|
|
const sema::DelayedDiagnosticPool &getDelayedDiagnosticPool() const {
|
|
|
|
return ParsingRAII.getDelayedDiagnosticPool();
|
|
|
|
}
|
|
|
|
|
|
|
|
void complete(Decl *D) {
|
|
|
|
ParsingRAII.complete(D);
|
|
|
|
}
|
|
|
|
|
|
|
|
void abort() {
|
|
|
|
ParsingRAII.abort();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/// A class for parsing a declarator.
|
|
|
|
class ParsingDeclarator : public Declarator {
|
|
|
|
ParsingDeclRAIIObject ParsingRAII;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ParsingDeclarator(Parser &P, const ParsingDeclSpec &DS, TheContext C)
|
|
|
|
: Declarator(DS, C), ParsingRAII(P, &DS.getDelayedDiagnosticPool()) {
|
|
|
|
}
|
|
|
|
|
|
|
|
const ParsingDeclSpec &getDeclSpec() const {
|
|
|
|
return static_cast<const ParsingDeclSpec&>(Declarator::getDeclSpec());
|
|
|
|
}
|
|
|
|
|
|
|
|
ParsingDeclSpec &getMutableDeclSpec() const {
|
|
|
|
return const_cast<ParsingDeclSpec&>(getDeclSpec());
|
|
|
|
}
|
|
|
|
|
|
|
|
void clear() {
|
|
|
|
Declarator::clear();
|
|
|
|
ParsingRAII.reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void complete(Decl *D) {
|
|
|
|
ParsingRAII.complete(D);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-08-09 07:04:35 +08:00
|
|
|
/// A class for parsing a field declarator.
|
|
|
|
class ParsingFieldDeclarator : public FieldDeclarator {
|
|
|
|
ParsingDeclRAIIObject ParsingRAII;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ParsingFieldDeclarator(Parser &P, const ParsingDeclSpec &DS)
|
|
|
|
: FieldDeclarator(DS), ParsingRAII(P, &DS.getDelayedDiagnosticPool()) {
|
|
|
|
}
|
|
|
|
|
|
|
|
const ParsingDeclSpec &getDeclSpec() const {
|
|
|
|
return static_cast<const ParsingDeclSpec&>(D.getDeclSpec());
|
|
|
|
}
|
|
|
|
|
|
|
|
ParsingDeclSpec &getMutableDeclSpec() const {
|
|
|
|
return const_cast<ParsingDeclSpec&>(getDeclSpec());
|
|
|
|
}
|
|
|
|
|
|
|
|
void complete(Decl *D) {
|
|
|
|
ParsingRAII.complete(D);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-10-20 14:45:43 +08:00
|
|
|
/// ExtensionRAIIObject - This saves the state of extension warnings when
|
|
|
|
/// constructed and disables them. When destructed, it restores them back to
|
|
|
|
/// the way they used to be. This is used to handle __extension__ in the
|
|
|
|
/// parser.
|
|
|
|
class ExtensionRAIIObject {
|
2015-02-16 06:54:08 +08:00
|
|
|
ExtensionRAIIObject(const ExtensionRAIIObject &) = delete;
|
|
|
|
void operator=(const ExtensionRAIIObject &) = delete;
|
2012-09-16 04:20:27 +08:00
|
|
|
|
2011-09-26 07:23:43 +08:00
|
|
|
DiagnosticsEngine &Diags;
|
2008-10-20 14:45:43 +08:00
|
|
|
public:
|
2011-09-26 07:23:43 +08:00
|
|
|
ExtensionRAIIObject(DiagnosticsEngine &diags) : Diags(diags) {
|
2009-04-15 15:01:18 +08:00
|
|
|
Diags.IncrementAllExtensionsSilenced();
|
2008-10-20 14:45:43 +08:00
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-10-20 14:45:43 +08:00
|
|
|
~ExtensionRAIIObject() {
|
2009-04-15 15:01:18 +08:00
|
|
|
Diags.DecrementAllExtensionsSilenced();
|
2008-10-20 14:45:43 +08:00
|
|
|
}
|
|
|
|
};
|
2009-12-10 08:32:41 +08:00
|
|
|
|
|
|
|
/// ColonProtectionRAIIObject - This sets the Parser::ColonIsSacred bool and
|
|
|
|
/// restores it when destroyed. This says that "foo:" should not be
|
|
|
|
/// considered a possible typo for "foo::" for error recovery purposes.
|
|
|
|
class ColonProtectionRAIIObject {
|
|
|
|
Parser &P;
|
|
|
|
bool OldVal;
|
|
|
|
public:
|
2009-12-10 10:08:07 +08:00
|
|
|
ColonProtectionRAIIObject(Parser &p, bool Value = true)
|
|
|
|
: P(p), OldVal(P.ColonIsSacred) {
|
|
|
|
P.ColonIsSacred = Value;
|
2009-12-10 08:32:41 +08:00
|
|
|
}
|
|
|
|
|
2009-12-10 08:38:54 +08:00
|
|
|
/// restore - This can be used to restore the state early, before the dtor
|
|
|
|
/// is run.
|
|
|
|
void restore() {
|
2009-12-10 08:32:41 +08:00
|
|
|
P.ColonIsSacred = OldVal;
|
|
|
|
}
|
2009-12-10 08:38:54 +08:00
|
|
|
|
|
|
|
~ColonProtectionRAIIObject() {
|
|
|
|
restore();
|
|
|
|
}
|
2009-12-10 08:32:41 +08:00
|
|
|
};
|
|
|
|
|
2009-12-10 08:44:03 +08:00
|
|
|
/// \brief RAII object that makes '>' behave either as an operator
|
|
|
|
/// or as the closing angle bracket for a template argument list.
|
2009-12-11 05:50:21 +08:00
|
|
|
class GreaterThanIsOperatorScope {
|
2009-12-10 08:44:03 +08:00
|
|
|
bool &GreaterThanIsOperator;
|
|
|
|
bool OldGreaterThanIsOperator;
|
2009-12-11 05:50:21 +08:00
|
|
|
public:
|
2009-12-10 08:44:03 +08:00
|
|
|
GreaterThanIsOperatorScope(bool >IO, bool Val)
|
|
|
|
: GreaterThanIsOperator(GTIO), OldGreaterThanIsOperator(GTIO) {
|
|
|
|
GreaterThanIsOperator = Val;
|
|
|
|
}
|
|
|
|
|
|
|
|
~GreaterThanIsOperatorScope() {
|
|
|
|
GreaterThanIsOperator = OldGreaterThanIsOperator;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-09-15 22:51:05 +08:00
|
|
|
class InMessageExpressionRAIIObject {
|
|
|
|
bool &InMessageExpression;
|
|
|
|
bool OldValue;
|
|
|
|
|
|
|
|
public:
|
|
|
|
InMessageExpressionRAIIObject(Parser &P, bool Value)
|
|
|
|
: InMessageExpression(P.InMessageExpression),
|
|
|
|
OldValue(P.InMessageExpression) {
|
|
|
|
InMessageExpression = Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
~InMessageExpressionRAIIObject() {
|
|
|
|
InMessageExpression = OldValue;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-06-17 18:52:18 +08:00
|
|
|
/// \brief RAII object that makes sure paren/bracket/brace count is correct
|
|
|
|
/// after declaration/statement parsing, even when there's a parsing error.
|
|
|
|
class ParenBraceBracketBalancer {
|
|
|
|
Parser &P;
|
|
|
|
unsigned short ParenCount, BracketCount, BraceCount;
|
|
|
|
public:
|
|
|
|
ParenBraceBracketBalancer(Parser &p)
|
|
|
|
: P(p), ParenCount(p.ParenCount), BracketCount(p.BracketCount),
|
|
|
|
BraceCount(p.BraceCount) { }
|
|
|
|
|
|
|
|
~ParenBraceBracketBalancer() {
|
|
|
|
P.ParenCount = ParenCount;
|
|
|
|
P.BracketCount = BracketCount;
|
|
|
|
P.BraceCount = BraceCount;
|
|
|
|
}
|
|
|
|
};
|
2011-04-28 09:08:34 +08:00
|
|
|
|
|
|
|
class PoisonSEHIdentifiersRAIIObject {
|
|
|
|
PoisonIdentifierRAIIObject Ident_AbnormalTermination;
|
|
|
|
PoisonIdentifierRAIIObject Ident_GetExceptionCode;
|
|
|
|
PoisonIdentifierRAIIObject Ident_GetExceptionInfo;
|
|
|
|
PoisonIdentifierRAIIObject Ident__abnormal_termination;
|
|
|
|
PoisonIdentifierRAIIObject Ident__exception_code;
|
|
|
|
PoisonIdentifierRAIIObject Ident__exception_info;
|
|
|
|
PoisonIdentifierRAIIObject Ident___abnormal_termination;
|
|
|
|
PoisonIdentifierRAIIObject Ident___exception_code;
|
|
|
|
PoisonIdentifierRAIIObject Ident___exception_info;
|
|
|
|
public:
|
|
|
|
PoisonSEHIdentifiersRAIIObject(Parser &Self, bool NewValue)
|
|
|
|
: Ident_AbnormalTermination(Self.Ident_AbnormalTermination, NewValue),
|
|
|
|
Ident_GetExceptionCode(Self.Ident_GetExceptionCode, NewValue),
|
|
|
|
Ident_GetExceptionInfo(Self.Ident_GetExceptionInfo, NewValue),
|
|
|
|
Ident__abnormal_termination(Self.Ident__abnormal_termination, NewValue),
|
|
|
|
Ident__exception_code(Self.Ident__exception_code, NewValue),
|
|
|
|
Ident__exception_info(Self.Ident__exception_info, NewValue),
|
|
|
|
Ident___abnormal_termination(Self.Ident___abnormal_termination, NewValue),
|
|
|
|
Ident___exception_code(Self.Ident___exception_code, NewValue),
|
|
|
|
Ident___exception_info(Self.Ident___exception_info, NewValue) {
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-06-07 05:18:07 +08:00
|
|
|
/// \brief RAII class that helps handle the parsing of an open/close delimiter
|
|
|
|
/// pair, such as braces { ... } or parentheses ( ... ).
|
|
|
|
class BalancedDelimiterTracker : public GreaterThanIsOperatorScope {
|
|
|
|
Parser& P;
|
2013-05-13 12:18:18 +08:00
|
|
|
tok::TokenKind Kind, Close, FinalToken;
|
2012-06-07 05:18:07 +08:00
|
|
|
SourceLocation (Parser::*Consumer)();
|
|
|
|
SourceLocation LOpen, LClose;
|
|
|
|
|
|
|
|
unsigned short &getDepth() {
|
|
|
|
switch (Kind) {
|
|
|
|
case tok::l_brace: return P.BraceCount;
|
|
|
|
case tok::l_square: return P.BracketCount;
|
|
|
|
case tok::l_paren: return P.ParenCount;
|
|
|
|
default: llvm_unreachable("Wrong token kind");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
enum { MaxDepth = 256 };
|
|
|
|
|
|
|
|
bool diagnoseOverflow();
|
|
|
|
bool diagnoseMissingClose();
|
|
|
|
|
|
|
|
public:
|
2013-05-13 12:18:18 +08:00
|
|
|
BalancedDelimiterTracker(Parser& p, tok::TokenKind k,
|
2013-12-19 03:10:49 +08:00
|
|
|
tok::TokenKind FinalToken = tok::semi)
|
2012-06-07 05:18:07 +08:00
|
|
|
: GreaterThanIsOperatorScope(p.GreaterThanIsOperator, true),
|
2013-12-19 03:10:49 +08:00
|
|
|
P(p), Kind(k), FinalToken(FinalToken)
|
2012-06-07 05:18:07 +08:00
|
|
|
{
|
|
|
|
switch (Kind) {
|
|
|
|
default: llvm_unreachable("Unexpected balanced token");
|
|
|
|
case tok::l_brace:
|
|
|
|
Close = tok::r_brace;
|
|
|
|
Consumer = &Parser::ConsumeBrace;
|
|
|
|
break;
|
|
|
|
case tok::l_paren:
|
|
|
|
Close = tok::r_paren;
|
|
|
|
Consumer = &Parser::ConsumeParen;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case tok::l_square:
|
|
|
|
Close = tok::r_square;
|
|
|
|
Consumer = &Parser::ConsumeBracket;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SourceLocation getOpenLocation() const { return LOpen; }
|
|
|
|
SourceLocation getCloseLocation() const { return LClose; }
|
|
|
|
SourceRange getRange() const { return SourceRange(LOpen, LClose); }
|
|
|
|
|
|
|
|
bool consumeOpen() {
|
|
|
|
if (!P.Tok.is(Kind))
|
|
|
|
return true;
|
|
|
|
|
2013-02-22 09:59:51 +08:00
|
|
|
if (getDepth() < P.getLangOpts().BracketDepth) {
|
2012-06-07 05:18:07 +08:00
|
|
|
LOpen = (P.*Consumer)();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return diagnoseOverflow();
|
|
|
|
}
|
2014-01-01 11:08:43 +08:00
|
|
|
|
|
|
|
bool expectAndConsume(unsigned DiagID = diag::err_expected,
|
2012-06-07 05:18:07 +08:00
|
|
|
const char *Msg = "",
|
|
|
|
tok::TokenKind SkipToTok = tok::unknown);
|
|
|
|
bool consumeClose() {
|
|
|
|
if (P.Tok.is(Close)) {
|
|
|
|
LClose = (P.*Consumer)();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return diagnoseMissingClose();
|
|
|
|
}
|
|
|
|
void skipToEnd();
|
|
|
|
};
|
|
|
|
|
2009-12-10 08:32:41 +08:00
|
|
|
} // end namespace clang
|
2008-10-20 14:45:43 +08:00
|
|
|
|
|
|
|
#endif
|