CPlusPlus: Make (sub-)languague selection more generic

Change-Id: I4e2df6992b446adec662ab07671acd41715e41fd
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
hjk
2013-10-06 02:41:22 +02:00
parent 0a600e041a
commit 2b532c73ee
23 changed files with 272 additions and 320 deletions

View File

@@ -347,7 +347,8 @@ FullySpecifiedType Bind::declarator(DeclaratorAST *ast, const FullySpecifiedType
std::swap(_declaratorId, declaratorId);
bool isAuto = false;
if (translationUnit()->cxx0xEnabled())
const bool cxx11Enabled = translationUnit()->languageFeatures().cxx11Enabled;
if (cxx11Enabled)
isAuto = type.isAuto();
for (SpecifierListAST *it = ast->attribute_list; it; it = it->next) {
@@ -369,8 +370,7 @@ FullySpecifiedType Bind::declarator(DeclaratorAST *ast, const FullySpecifiedType
}
if (!type->isFunctionType()) {
ExpressionTy initializer = this->expression(ast->initializer);
if (translationUnit()->cxx0xEnabled() && isAuto) {
if (cxx11Enabled && isAuto) {
type = initializer;
type.setAuto(true);
}
@@ -1249,7 +1249,7 @@ bool Bind::visit(ForeachStatementAST *ast)
DeclaratorIdAST *declaratorId = 0;
type = this->declarator(ast->declarator, type, &declaratorId);
const StringLiteral *initializer = 0;
if (type.isAuto() && translationUnit()->cxx0xEnabled()) {
if (type.isAuto() && translationUnit()->languageFeatures().cxx11Enabled) {
ExpressionTy exprType = this->expression(ast->expression);
ArrayType* arrayType = 0;
@@ -1299,7 +1299,7 @@ bool Bind::visit(RangeBasedForStatementAST *ast)
DeclaratorIdAST *declaratorId = 0;
type = this->declarator(ast->declarator, type, &declaratorId);
const StringLiteral *initializer = 0;
if (type.isAuto() && translationUnit()->cxx0xEnabled()) {
if (type.isAuto() && translationUnit()->languageFeatures().cxx11Enabled) {
ExpressionTy exprType = this->expression(ast->expression);
ArrayType* arrayType = 0;
@@ -2722,7 +2722,7 @@ bool Bind::visit(SimpleSpecifierAST *ast)
break;
case T_AUTO:
if (!translationUnit()->cxx0xEnabled()) {
if (!translationUnit()->languageFeatures().cxx11Enabled) {
if (_type.isAuto())
translationUnit()->error(ast->specifier_token, "duplicate `%s'", spell(ast->specifier_token));
}

View File

@@ -21,9 +21,10 @@
#include "Lexer.h"
#include "Token.h"
using namespace CPlusPlus;
namespace CPlusPlus {
static inline int classify2(const char *s, bool, bool) {
static inline int classify2(const char *s, LanguageFeatures)
{
if (s[0] == 'd') {
if (s[1] == 'o') {
return T_DO;
@@ -37,7 +38,8 @@ static inline int classify2(const char *s, bool, bool) {
return T_IDENTIFIER;
}
static inline int classify3(const char *s, bool q, bool) {
static inline int classify3(const char *s, LanguageFeatures features)
{
if (s[0] == 'a') {
if (s[1] == 's') {
if (s[2] == 'm') {
@@ -73,7 +75,7 @@ static inline int classify3(const char *s, bool q, bool) {
}
}
}
else if (q && s[0] == 'Q') {
else if (features.qtMocRunEnabled && s[0] == 'Q') {
if (s[1] == '_') {
if (s[2] == 'D') {
return T_Q_D;
@@ -86,7 +88,8 @@ static inline int classify3(const char *s, bool q, bool) {
return T_IDENTIFIER;
}
static inline int classify4(const char *s, bool q, bool) {
static inline int classify4(const char *s, LanguageFeatures features)
{
if (s[0] == 'a') {
if (s[1] == 'u') {
if (s[2] == 't') {
@@ -136,7 +139,7 @@ static inline int classify4(const char *s, bool q, bool) {
}
}
}
else if (q && s[1] == 'm') {
else if (features.qtKeywordsEnabled && s[1] == 'm') {
if (s[2] == 'i') {
if (s[3] == 't') {
return T_EMIT;
@@ -187,7 +190,7 @@ static inline int classify4(const char *s, bool q, bool) {
}
}
}
else if (q && s[0] == 'S') {
else if (features.qtEnabled && s[0] == 'S') {
if (s[1] == 'L') {
if (s[2] == 'O') {
if (s[3] == 'T') {
@@ -199,7 +202,8 @@ static inline int classify4(const char *s, bool q, bool) {
return T_IDENTIFIER;
}
static inline int classify5(const char *s, bool q, bool) {
static inline int classify5(const char *s, LanguageFeatures features)
{
if (s[0] == '_') {
if (s[1] == '_') {
if (s[2] == 'a') {
@@ -281,7 +285,7 @@ static inline int classify5(const char *s, bool q, bool) {
}
}
}
else if (q) {
else if (features.qtKeywordsEnabled) {
if (s[1] == 'l') {
if (s[2] == 'o') {
if (s[3] == 't') {
@@ -338,7 +342,8 @@ static inline int classify5(const char *s, bool q, bool) {
return T_IDENTIFIER;
}
static inline int classify6(const char *s, bool q, bool) {
static inline int classify6(const char *s, LanguageFeatures features)
{
if (s[0] == 'd') {
if (s[1] == 'e') {
if (s[2] == 'l') {
@@ -508,7 +513,7 @@ static inline int classify6(const char *s, bool q, bool) {
}
}
}
else if (q && s[0] == 'S') {
else if (features.qtKeywordsEnabled && s[0] == 'S') {
if (s[1] == 'I') {
if (s[2] == 'G') {
if (s[3] == 'N') {
@@ -521,7 +526,7 @@ static inline int classify6(const char *s, bool q, bool) {
}
}
}
else if (q && s[0] == 'Q') {
else if (features.qtKeywordsEnabled && s[0] == 'Q') {
if (s[1] == '_') {
if (s[2] == 'S') {
if (s[3] == 'L') {
@@ -546,7 +551,8 @@ static inline int classify6(const char *s, bool q, bool) {
return T_IDENTIFIER;
}
static inline int classify7(const char *s, bool q, bool x) {
static inline int classify7(const char *s, LanguageFeatures features)
{
if (s[0] == '_') {
if (s[1] == '_') {
if (s[2] == 'a') {
@@ -573,7 +579,7 @@ static inline int classify7(const char *s, bool q, bool x) {
}
}
}
else if (x && s[0] == 'a') {
else if (features.cxx11Enabled && s[0] == 'a') {
if (s[1] == 'l') {
if (s[2] == 'i') {
if (s[3] == 'g') {
@@ -623,7 +629,7 @@ static inline int classify7(const char *s, bool q, bool x) {
}
}
}
else if (x && s[0] == 'n') {
else if (features.cxx11Enabled && s[0] == 'n') {
if (s[1] == 'u') {
if (s[2] == 'l') {
if (s[3] == 'l') {
@@ -653,7 +659,7 @@ static inline int classify7(const char *s, bool q, bool x) {
}
}
}
else if (q && s[0] == 'f') {
else if (features.qtKeywordsEnabled && s[0] == 'f') {
if (s[1] == 'o') {
if (s[2] == 'r') {
if (s[3] == 'e') {
@@ -668,7 +674,7 @@ static inline int classify7(const char *s, bool q, bool x) {
}
}
}
else if (q && s[0] == 's') {
else if (features.qtEnabled && s[0] == 's') {
if (s[1] == 'i') {
if (s[2] == 'g') {
if (s[3] == 'n') {
@@ -728,7 +734,7 @@ static inline int classify7(const char *s, bool q, bool x) {
}
}
}
else if (q && s[0] == 'Q') {
else if (features.qtEnabled && s[0] == 'Q') {
if (s[1] == '_') {
if (s[2] == 'S') {
if (s[3] == 'L') {
@@ -768,7 +774,8 @@ static inline int classify7(const char *s, bool q, bool x) {
return T_IDENTIFIER;
}
static inline int classify8(const char *s, bool q, bool x) {
static inline int classify8(const char *s, LanguageFeatures features)
{
if (s[0] == '_') {
if (s[1] == '_') {
if (s[2] == 'i') {
@@ -814,7 +821,7 @@ static inline int classify8(const char *s, bool q, bool x) {
}
}
}
} else if (x && s[1] == 'h') {
} else if (features.cxx11Enabled && s[1] == 'h') {
if (s[2] == 'a') {
if (s[3] == 'r') {
if (s[4] == '1') {
@@ -838,7 +845,7 @@ static inline int classify8(const char *s, bool q, bool x) {
}
}
}
else if (x && s[0] == 'd') {
else if (features.cxx11Enabled && s[0] == 'd') {
if (s[1] == 'e') {
if (s[2] == 'c') {
if (s[3] == 'l') {
@@ -872,7 +879,7 @@ static inline int classify8(const char *s, bool q, bool x) {
}
}
}
else if (x && s[0] == 'n') {
else if (features.cxx11Enabled && s[0] == 'n') {
if (s[1] == 'o') {
if (s[2] == 'e') {
if (s[3] == 'x') {
@@ -989,7 +996,7 @@ static inline int classify8(const char *s, bool q, bool x) {
}
}
}
else if (q && s[0] == 'Q') {
else if (features.qtEnabled && s[0] == 'Q') {
if (s[1] == '_') {
if (s[2] == 'G') {
if (s[3] == 'A') {
@@ -1035,7 +1042,8 @@ static inline int classify8(const char *s, bool q, bool x) {
return T_IDENTIFIER;
}
static inline int classify9(const char *s, bool q, bool x) {
static inline int classify9(const char *s, LanguageFeatures features)
{
if (s[0] == '_') {
if (s[1] == '_') {
if (s[2] == 'c') {
@@ -1055,7 +1063,7 @@ static inline int classify9(const char *s, bool q, bool x) {
}
}
}
else if (x && s[0] == 'c') {
else if (features.cxx11Enabled && s[0] == 'c') {
if (s[1] == 'o') {
if (s[2] == 'n') {
if (s[3] == 's') {
@@ -1112,7 +1120,7 @@ static inline int classify9(const char *s, bool q, bool x) {
}
}
}
else if (q && s[0] == 'Q') {
else if (features.qtEnabled && s[0] == 'Q') {
if (s[1] == '_') {
if (s[2] == 'S') {
if (s[3] == 'I') {
@@ -1148,7 +1156,8 @@ static inline int classify9(const char *s, bool q, bool x) {
return T_IDENTIFIER;
}
static inline int classify10(const char *s, bool q, bool) {
static inline int classify10(const char *s, LanguageFeatures features)
{
if (s[0] == '_') {
if (s[1] == '_') {
if (s[2] == 'i') {
@@ -1242,7 +1251,7 @@ static inline int classify10(const char *s, bool q, bool) {
}
}
}
else if (q && s[0] == 'Q') {
else if (features.qtEnabled && s[0] == 'Q') {
if (s[1] == '_') {
if (s[2] == 'O') {
if (s[3] == 'V') {
@@ -1283,7 +1292,8 @@ static inline int classify10(const char *s, bool q, bool) {
return T_IDENTIFIER;
}
static inline int classify11(const char *s, bool q, bool) {
static inline int classify11(const char *s, LanguageFeatures features)
{
if (s[0] == '_') {
if (s[1] == '_') {
if (s[2] == 'a') {
@@ -1330,7 +1340,7 @@ static inline int classify11(const char *s, bool q, bool) {
}
}
}
else if (q && s[0] == 'Q') {
else if (features.qtEnabled && s[0] == 'Q') {
if (s[1] == '_') {
if (s[2] == 'I') {
if (s[3] == 'N') {
@@ -1356,7 +1366,8 @@ static inline int classify11(const char *s, bool q, bool) {
return T_IDENTIFIER;
}
static inline int classify12(const char *s, bool q, bool) {
static inline int classify12(const char *s, LanguageFeatures features)
{
if (s[0] == '_') {
if (s[1] == '_') {
if (s[2] == 'v') {
@@ -1382,7 +1393,7 @@ static inline int classify12(const char *s, bool q, bool) {
}
}
}
else if (q && s[0] == 'Q') {
else if (features.qtEnabled && s[0] == 'Q') {
if (s[1] == '_') {
if (s[2] == 'I') {
if (s[3] == 'N') {
@@ -1435,7 +1446,8 @@ static inline int classify12(const char *s, bool q, bool) {
return T_IDENTIFIER;
}
static inline int classify13(const char *s, bool, bool x) {
static inline int classify13(const char *s, LanguageFeatures features)
{
if (s[0] == '_') {
if (s[1] == '_') {
if (s[2] == 'a') {
@@ -1462,7 +1474,7 @@ static inline int classify13(const char *s, bool, bool x) {
}
}
}
} else if (x && s[0] == 's') {
} else if (features.cxx11Enabled && s[0] == 's') {
if (s[1] == 't') {
if (s[2] == 'a') {
if (s[3] == 't') {
@@ -1492,7 +1504,8 @@ static inline int classify13(const char *s, bool, bool x) {
return T_IDENTIFIER;
}
static inline int classify16(const char *s, bool, bool) {
static inline int classify16(const char *s, LanguageFeatures)
{
if (s[0] == 'r') {
if (s[1] == 'e') {
if (s[2] == 'i') {
@@ -1529,8 +1542,9 @@ static inline int classify16(const char *s, bool, bool) {
return T_IDENTIFIER;
}
static inline int classify14(const char *s, bool q, bool) {
if (q && s[0] == 'Q') {
static inline int classify14(const char *s, LanguageFeatures features)
{
if (features.qtEnabled && s[0] == 'Q') {
if (s[1] == '_') {
if (s[2] == 'P') {
if (s[3] == 'R') {
@@ -1562,8 +1576,9 @@ static inline int classify14(const char *s, bool q, bool) {
return T_IDENTIFIER;
}
static inline int classify18(const char *s, bool q, bool) {
if (q && s[0] == 'Q') {
static inline int classify18(const char *s, LanguageFeatures features)
{
if (features.qtEnabled && s[0] == 'Q') {
if (s[1] == '_') {
if (s[2] == 'P') {
if (s[3] == 'R') {
@@ -1603,8 +1618,9 @@ static inline int classify18(const char *s, bool q, bool) {
return T_IDENTIFIER;
}
static inline int classify19(const char *s, bool q, bool) {
if (q && s[0] == 'Q') {
static inline int classify19(const char *s, LanguageFeatures features)
{
if (features.qtEnabled && s[0] == 'Q') {
if (s[1] == '_') {
if (s[2] == 'D') {
if (s[3] == 'E') {
@@ -1647,24 +1663,24 @@ static inline int classify19(const char *s, bool q, bool) {
}
int Lexer::classify(const char *s, int n, bool q, bool x) {
int Lexer::classify(const char *s, int n, LanguageFeatures features) {
switch (n) {
case 2: return classify2(s, q, x);
case 3: return classify3(s, q, x);
case 4: return classify4(s, q, x);
case 5: return classify5(s, q, x);
case 6: return classify6(s, q, x);
case 7: return classify7(s, q, x);
case 8: return classify8(s, q, x);
case 9: return classify9(s, q, x);
case 10: return classify10(s, q, x);
case 11: return classify11(s, q, x);
case 12: return classify12(s, q, x);
case 13: return classify13(s, q, x);
case 14: return classify14(s, q, x);
case 16: return classify16(s, q, x);
case 18: return classify18(s, q, x);
case 19: return classify19(s, q, x);
case 2: return classify2(s, features);
case 3: return classify3(s, features);
case 4: return classify4(s, features);
case 5: return classify5(s, features);
case 6: return classify6(s, features);
case 7: return classify7(s, features);
case 8: return classify8(s, features);
case 9: return classify9(s, features);
case 10: return classify10(s, features);
case 11: return classify11(s, features);
case 12: return classify12(s, features);
case 13: return classify13(s, features);
case 14: return classify14(s, features);
case 16: return classify16(s, features);
case 18: return classify18(s, features);
case 19: return classify19(s, features);
default: return T_IDENTIFIER;
} // switch
}
@@ -1807,3 +1823,4 @@ int Lexer::classifyOperator(const char *s, int n) {
}
} // namespace CPlusPlus

View File

@@ -81,24 +81,6 @@ int Lexer::state() const
void Lexer::setState(int state)
{ _state = state; }
bool Lexer::qtMocRunEnabled() const
{ return f._qtMocRunEnabled; }
void Lexer::setQtMocRunEnabled(bool onoff)
{ f._qtMocRunEnabled = onoff; }
bool Lexer::cxx0xEnabled() const
{ return f._cxx0xEnabled; }
void Lexer::setCxxOxEnabled(bool onoff)
{ f._cxx0xEnabled = onoff; }
bool Lexer::objCEnabled() const
{ return f._objCEnabled; }
void Lexer::setObjCEnabled(bool onoff)
{ f._objCEnabled = onoff; }
bool Lexer::isIncremental() const
{ return f._isIncremental; }
@@ -557,7 +539,7 @@ void Lexer::scan_helper(Token *tok)
break;
default: {
if (f._objCEnabled) {
if (_languageFeatures.objCEnabled) {
if (ch == '@' && _yychar >= 'a' && _yychar <= 'z') {
const char *yytext = _currentChar;
@@ -780,7 +762,7 @@ void Lexer::scanIdentifier(Token *tok, unsigned extraProcessedChars)
yyinp();
int yylen = _currentChar - yytext;
if (f._scanKeywords)
tok->f.kind = classify(yytext, yylen, f._qtMocRunEnabled, f._cxx0xEnabled);
tok->f.kind = classify(yytext, yylen, _languageFeatures);
else
tok->f.kind = T_IDENTIFIER;

View File

@@ -45,15 +45,6 @@ public:
Control *control() const { return _control; }
TranslationUnit *translationUnit() const;
bool qtMocRunEnabled() const;
void setQtMocRunEnabled(bool onoff);
bool cxx0xEnabled() const;
void setCxxOxEnabled(bool onoff);
bool objCEnabled() const;
void setObjCEnabled(bool onoff);
void scan(Token *tok);
inline void operator()(Token *tok)
@@ -82,10 +73,13 @@ public:
bool isIncremental() const;
void setIncremental(bool isIncremental);
LanguageFeatures languageFeatures() const { return _languageFeatures; }
void setLanguageFeatures(LanguageFeatures features) { _languageFeatures = features; }
private:
void scan_helper(Token *tok);
void setSource(const char *firstChar, const char *lastChar);
static int classify(const char *string, int length, bool q, bool cxx0x);
static int classify(const char *string, int length, LanguageFeatures features);
static int classifyObjCAtKeyword(const char *s, int n);
static int classifyOperator(const char *string, int length);
@@ -111,9 +105,6 @@ private:
unsigned _scanCommentTokens: 1;
unsigned _scanKeywords: 1;
unsigned _scanAngleStringLiteralTokens: 1;
unsigned _qtMocRunEnabled: 1;
unsigned _cxx0xEnabled: 1;
unsigned _objCEnabled: 1;
};
TranslationUnit *_translationUnit;
@@ -129,6 +120,8 @@ private:
Flags f;
};
unsigned _currentLine;
LanguageFeatures _languageFeatures;
};
} // namespace CPlusPlus

View File

@@ -169,13 +169,11 @@ inline bool isRightAssociative(int tokenKind)
Parser::Parser(TranslationUnit *unit)
: _translationUnit(unit),
_control(_translationUnit->control()),
_pool(_translationUnit->memoryPool()),
_control(unit->control()),
_pool(unit->memoryPool()),
_languageFeatures(unit->languageFeatures()),
_tokenIndex(1),
_templateArguments(0),
_qtMocRunEnabled(false),
_cxx0xEnabled(false),
_objCEnabled(false),
_inFunctionBody(false),
_inObjCImplementationContext(false),
_inExpressionStatement(false),
@@ -186,24 +184,6 @@ Parser::Parser(TranslationUnit *unit)
Parser::~Parser()
{ }
bool Parser::qtMocRunEnabled() const
{ return _qtMocRunEnabled; }
void Parser::setQtMocRunEnabled(bool onoff)
{ _qtMocRunEnabled = onoff; }
bool Parser::cxx0xEnabled() const
{ return _cxx0xEnabled; }
void Parser::setCxxOxEnabled(bool onoff)
{ _cxx0xEnabled = onoff; }
bool Parser::objCEnabled() const
{ return _objCEnabled; }
void Parser::setObjCEnabled(bool onoff)
{ _objCEnabled = onoff; }
bool Parser::switchTemplateArguments(bool templateArguments)
{
bool previousTemplateArguments = _templateArguments;
@@ -336,7 +316,7 @@ bool Parser::skipUntilStatement()
case T_AT_TRY:
case T_AT_SYNCHRONIZED:
case T_AT_THROW:
if (objCEnabled())
if (_languageFeatures.objCEnabled)
return true;
default:
@@ -640,17 +620,17 @@ bool Parser::parseDeclaration(DeclarationAST *&node)
break;
case T_INLINE:
if (_cxx0xEnabled && LA(2) == T_NAMESPACE)
if (_languageFeatures.cxx11Enabled && LA(2) == T_NAMESPACE)
return parseNamespace(node);
return parseSimpleDeclaration(node);
case T_STATIC_ASSERT:
if (_cxx0xEnabled)
if (_languageFeatures.cxx11Enabled)
return parseStaticAssertDeclaration(node);
return parseSimpleDeclaration(node);
default: {
if (_objCEnabled && LA() == T___ATTRIBUTE__) {
if (_languageFeatures.objCEnabled && LA() == T___ATTRIBUTE__) {
const unsigned start = cursor();
SpecifierListAST *attributes = 0, **attr = &attributes;
while (parseAttributeSpecifier(*attr))
@@ -753,11 +733,11 @@ bool Parser::parseStaticAssertDeclaration(DeclarationAST *&node)
bool Parser::parseNamespace(DeclarationAST *&node)
{
DEBUG_THIS_RULE();
if (LA() != T_NAMESPACE && !(_cxx0xEnabled && LA() == T_INLINE && LA(2) == T_NAMESPACE))
if (LA() != T_NAMESPACE && !(_languageFeatures.cxx11Enabled && LA() == T_INLINE && LA(2) == T_NAMESPACE))
return false;
unsigned inline_token = 0;
if (cxx0xEnabled() && LA() == T_INLINE)
if (_languageFeatures.cxx11Enabled && LA() == T_INLINE)
inline_token = consumeToken();
unsigned namespace_token = consumeToken();
@@ -826,7 +806,7 @@ bool Parser::parseUsing(DeclarationAST *&node)
if (LA(2) == T_NAMESPACE)
return parseUsingDirective(node);
if (_cxx0xEnabled && LA(2) == T_IDENTIFIER && parseAliasDeclaration(node))
if (_languageFeatures.cxx11Enabled && LA(2) == T_IDENTIFIER && parseAliasDeclaration(node))
return true;
UsingAST *ast = new (_pool) UsingAST;
@@ -953,12 +933,13 @@ bool Parser::parseTemplateArgumentList(ExpressionListAST *&node)
ExpressionListAST **template_argument_ptr = &node;
ExpressionAST *template_argument = 0;
const bool cxx11Enabled = _languageFeatures.cxx11Enabled;
if (parseTemplateArgument(template_argument)) {
*template_argument_ptr = new (_pool) ExpressionListAST;
(*template_argument_ptr)->value = template_argument;
template_argument_ptr = &(*template_argument_ptr)->next;
if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT)
if (cxx11Enabled && LA() == T_DOT_DOT_DOT)
consumeToken(); // ### store this token in the AST
while (LA() == T_COMMA) {
@@ -969,7 +950,7 @@ bool Parser::parseTemplateArgumentList(ExpressionListAST *&node)
(*template_argument_ptr)->value = template_argument;
template_argument_ptr = &(*template_argument_ptr)->next;
if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT)
if (cxx11Enabled && LA() == T_DOT_DOT_DOT)
consumeToken(); // ### store this token in the AST
}
}
@@ -1230,7 +1211,7 @@ bool Parser::parseRefQualifier(unsigned &ref_qualifier)
{
DEBUG_THIS_RULE();
if (!_cxx0xEnabled)
if (!_languageFeatures.cxx11Enabled)
return false;
if (LA() == T_AMPER || LA() == T_AMPER_AMPER) {
@@ -1248,7 +1229,7 @@ bool Parser::parseOverrideFinalQualifiers(SpecifierListAST *&node)
{
DEBUG_THIS_RULE();
if (!_cxx0xEnabled)
if (!_languageFeatures.cxx11Enabled)
return false;
unsigned start = cursor();
@@ -1278,7 +1259,7 @@ bool Parser::parseOverrideFinalQualifiers(SpecifierListAST *&node)
bool Parser::parsePtrOperator(PtrOperatorListAST *&node)
{
DEBUG_THIS_RULE();
if (LA() == T_AMPER || (_cxx0xEnabled && LA() == T_AMPER_AMPER)) {
if (LA() == T_AMPER || (_languageFeatures.cxx11Enabled && LA() == T_AMPER_AMPER)) {
ReferenceAST *ast = new (_pool) ReferenceAST;
ast->reference_token = consumeToken();
node = new (_pool) PtrOperatorListAST(ast);
@@ -1319,7 +1300,7 @@ bool Parser::parseTemplateArgument(ExpressionAST *&node)
if (parseTypeId(node)) {
int index = 1;
if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT)
if (_languageFeatures.cxx11Enabled && LA() == T_DOT_DOT_DOT)
index = 2;
if (LA(index) == T_COMMA || maybeSplitGreaterGreaterToken(index) || LA(index) == T_GREATER)
@@ -1413,7 +1394,7 @@ bool Parser::parseCoreDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_sp
ptr_operators_tail = &(*ptr_operators_tail)->next;
if (LA() == T_COLON_COLON || LA() == T_IDENTIFIER || LA() == T_TILDE || LA() == T_OPERATOR
|| (_cxx0xEnabled && LA() == T_DOT_DOT_DOT && (LA(2) == T_COLON_COLON || LA(2) == T_IDENTIFIER))) {
|| (_languageFeatures.cxx11Enabled && LA() == T_DOT_DOT_DOT && (LA(2) == T_COLON_COLON || LA(2) == T_IDENTIFIER))) {
unsigned dot_dot_dot_token = 0;
@@ -1543,7 +1524,7 @@ bool Parser::parseDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specif
parseRefQualifier(ast->ref_qualifier_token);
parseExceptionSpecification(ast->exception_specification);
if (_cxx0xEnabled && ! node->ptr_operator_list && LA() == T_ARROW) {
if (_languageFeatures.cxx11Enabled && ! node->ptr_operator_list && LA() == T_ARROW) {
// only allow if there is 1 type spec, which has to be 'auto'
bool hasAuto = false;
for (SpecifierListAST *iter = decl_specifier_list; !hasAuto && iter; iter = iter->next) {
@@ -1690,12 +1671,12 @@ bool Parser::parseEnumSpecifier(SpecifierListAST *&node)
EnumSpecifierAST *ast = new (_pool) EnumSpecifierAST;
ast->enum_token = consumeToken();
if (_cxx0xEnabled && (LA() == T_CLASS || LA() == T_STRUCT))
if (_languageFeatures.cxx11Enabled && (LA() == T_CLASS || LA() == T_STRUCT))
ast->key_token = consumeToken();
parseName(ast->name);
if (_cxx0xEnabled && LA() == T_COLON) {
if (_languageFeatures.cxx11Enabled && LA() == T_COLON) {
ast->colon_token = consumeToken();
parseTypeSpecifier(ast->type_specifier_list);
}
@@ -1722,7 +1703,7 @@ bool Parser::parseEnumSpecifier(SpecifierListAST *&node)
match(T_COMMA, &comma_token);
}
match(T_RBRACE, &ast->rbrace_token);
} else if (!_cxx0xEnabled) {
} else if (!_languageFeatures.cxx11Enabled) {
return false;
}
@@ -1776,7 +1757,7 @@ bool Parser::parseTypenameTypeParameter(DeclarationAST *&node)
if (LA() == T_CLASS || LA() == T_TYPENAME) {
TypenameTypeParameterAST *ast = new (_pool) TypenameTypeParameterAST;
ast->classkey_token = consumeToken();
if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT)
if (_languageFeatures.cxx11Enabled && LA() == T_DOT_DOT_DOT)
ast->dot_dot_dot_token = consumeToken();
parseName(ast->name);
if (LA() == T_EQUAL) {
@@ -1802,7 +1783,7 @@ bool Parser::parseTemplateTypeParameter(DeclarationAST *&node)
ast->greater_token = consumeToken();
if (LA() == T_CLASS)
ast->class_token = consumeToken();
if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT)
if (_languageFeatures.cxx11Enabled && LA() == T_DOT_DOT_DOT)
ast->dot_dot_dot_token = consumeToken();
// parse optional name
@@ -1943,7 +1924,7 @@ bool Parser::parseParameterDeclaration(ParameterDeclarationAST *&node)
parseDeclaratorOrAbstractDeclarator(ast->declarator, decl_specifier_seq);
if (LA() == T_EQUAL) {
ast->equal_token = consumeToken();
if (!_cxx0xEnabled)
if (!_languageFeatures.cxx11Enabled)
parseLogicalOrExpression(ast->expression);
else
parseInitializerClause0x(ast->expression);
@@ -2036,7 +2017,7 @@ bool Parser::parseClassSpecifier(SpecifierListAST *&node)
parseBaseClause(base_clause_list);
if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT)
if (_languageFeatures.cxx11Enabled && LA() == T_DOT_DOT_DOT)
dot_dot_dot_token = consumeToken();
if (LA() != T_LBRACE) {
@@ -2455,7 +2436,7 @@ bool Parser::parseMemberSpecification(DeclarationAST *&node, ClassSpecifierAST *
return parseQtInterfaces(node);
case T_STATIC_ASSERT:
if (_cxx0xEnabled)
if (_languageFeatures.cxx11Enabled)
return parseStaticAssertDeclaration(node);
// fall-through
@@ -2475,7 +2456,7 @@ bool Parser::parseCtorInitializer(CtorInitializerAST *&node)
parseMemInitializerList(ast->member_initializer_list);
if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT)
if (_languageFeatures.cxx11Enabled && LA() == T_DOT_DOT_DOT)
ast->dot_dot_dot_token = consumeToken();
node = ast;
@@ -2525,7 +2506,7 @@ bool Parser::parseExceptionSpecification(ExceptionSpecificationAST *&node)
ast->rparen_token = consumeToken();
node = ast;
return true;
} else if (_cxx0xEnabled && LA() == T_NOEXCEPT) {
} else if (_languageFeatures.cxx11Enabled && LA() == T_NOEXCEPT) {
NoExceptSpecificationAST *ast = new (_pool) NoExceptSpecificationAST;
ast->noexcept_token = consumeToken();
if (LA() == T_LPAREN) {
@@ -2595,7 +2576,7 @@ bool Parser::parseInitDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_sp
}
rewind(colon_token);
} else if (isFunctionDeclarator && declaringClass && node->core_declarator && LA() == T_EQUAL && LA(3) == T_SEMICOLON) { // = 0, = delete, = default
if (!_cxx0xEnabled || LA(2) == T_NUMERIC_LITERAL) {
if (!_languageFeatures.cxx11Enabled || LA(2) == T_NUMERIC_LITERAL) {
parseInitializer(node->initializer, &node->equal_token);
} else {
node->equal_token = consumeToken();
@@ -2607,7 +2588,7 @@ bool Parser::parseInitDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_sp
id_expr->name = simple_name;
simple_name->identifier_token = consumeToken();
}
} else if (node->core_declarator && (LA() == T_EQUAL || (_cxx0xEnabled && !isFunctionDeclarator && LA() == T_LBRACE) || (! declaringClass && LA() == T_LPAREN))) {
} else if (node->core_declarator && (LA() == T_EQUAL || (_languageFeatures.cxx11Enabled && !isFunctionDeclarator && LA() == T_LBRACE) || (! declaringClass && LA() == T_LPAREN))) {
parseInitializer(node->initializer, &node->equal_token);
}
return true;
@@ -2648,7 +2629,7 @@ bool Parser::parseInitializer0x(ExpressionAST *&node, unsigned *equals_token)
{
DEBUG_THIS_RULE();
if ((_cxx0xEnabled && LA() == T_LBRACE) || LA() == T_EQUAL) {
if ((_languageFeatures.cxx11Enabled && LA() == T_LBRACE) || LA() == T_EQUAL) {
if (LA() == T_EQUAL)
*equals_token = cursor();
@@ -2695,7 +2676,7 @@ bool Parser::parseInitializerList0x(ExpressionListAST *&node)
(*expression_list_ptr)->value = expression;
expression_list_ptr = &(*expression_list_ptr)->next;
if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT && (LA(2) == T_COMMA || LA(2) == T_RBRACE || LA(2) == T_RPAREN))
if (_languageFeatures.cxx11Enabled && LA() == T_DOT_DOT_DOT && (LA(2) == T_COMMA || LA(2) == T_RBRACE || LA(2) == T_RPAREN))
consumeToken(); // ### create an argument pack
while (LA() == T_COMMA && LA(2) != T_RBRACE) {
@@ -2705,7 +2686,7 @@ bool Parser::parseInitializerList0x(ExpressionListAST *&node)
*expression_list_ptr = new (_pool) ExpressionListAST;
(*expression_list_ptr)->value = expression;
if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT && (LA(2) == T_COMMA || LA(2) == T_RBRACE || LA(2) == T_RPAREN))
if (_languageFeatures.cxx11Enabled && LA() == T_DOT_DOT_DOT && (LA(2) == T_COMMA || LA(2) == T_RBRACE || LA(2) == T_RPAREN))
consumeToken(); // ### create an argument pack
expression_list_ptr = &(*expression_list_ptr)->next;
@@ -2747,12 +2728,12 @@ bool Parser::parseMemInitializerList(MemInitializerListAST *&node)
if (LA() == T_LBRACE)
break;
else if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT && LA(2) == T_LBRACE)
else if (_languageFeatures.cxx11Enabled && LA() == T_DOT_DOT_DOT && LA(2) == T_LBRACE)
break;
else if (LA() == T_COMMA
|| (LA() == T_IDENTIFIER
&& (LA(2) == T_LPAREN || LA(2) == T_COLON_COLON || (_cxx0xEnabled && LA(2) == T_LBRACE)))) {
&& (LA(2) == T_LPAREN || LA(2) == T_COLON_COLON || (_languageFeatures.cxx11Enabled && LA(2) == T_LBRACE)))) {
if (LA() != T_COMMA)
error(cursor(), "expected `,'");
else
@@ -2766,7 +2747,7 @@ bool Parser::parseMemInitializerList(MemInitializerListAST *&node)
} else break;
}
if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT) {
if (_languageFeatures.cxx11Enabled && LA() == T_DOT_DOT_DOT) {
if (LA(2) != T_LBRACE)
error(cursor(), "expected `{'");
@@ -2792,10 +2773,10 @@ bool Parser::parseMemInitializer(MemInitializerListAST *&node)
if (LA() == T_LPAREN) {
parseExpressionListParen(ast->expression);
} else if (_cxx0xEnabled && LA() == T_LBRACE) {
} else if (_languageFeatures.cxx11Enabled && LA() == T_LBRACE) {
parseBracedInitList0x(ast->expression);
} else {
if (!_cxx0xEnabled)
if (!_languageFeatures.cxx11Enabled)
error(cursor(), "expected '('");
else
error(cursor(), "expected '(' or '{'");
@@ -2817,7 +2798,7 @@ bool Parser::parseTypeIdList(ExpressionListAST *&node)
(*expression_list_ptr)->value = typeId;
expression_list_ptr = &(*expression_list_ptr)->next;
if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT)
if (_languageFeatures.cxx11Enabled && LA() == T_DOT_DOT_DOT)
consumeToken(); // ### store this token
while (LA() == T_COMMA) {
@@ -2828,7 +2809,7 @@ bool Parser::parseTypeIdList(ExpressionListAST *&node)
(*expression_list_ptr)->value = typeId;
expression_list_ptr = &(*expression_list_ptr)->next;
if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT)
if (_languageFeatures.cxx11Enabled && LA() == T_DOT_DOT_DOT)
consumeToken(); // ### store this token
}
}
@@ -2842,7 +2823,7 @@ bool Parser::parseExpressionList(ExpressionListAST *&node)
{
DEBUG_THIS_RULE();
if (_cxx0xEnabled)
if (_languageFeatures.cxx11Enabled)
return parseInitializerList0x(node);
ExpressionListAST **expression_list_ptr = &node;
@@ -2914,7 +2895,7 @@ bool Parser::parseInitializerList(ExpressionListAST *&node)
}
}
if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT)
if (_languageFeatures.cxx11Enabled && LA() == T_DOT_DOT_DOT)
consumeToken(); // ### store this token
return true;
@@ -3112,13 +3093,13 @@ bool Parser::parseStatement(StatementAST *&node)
}
case T_AT_TRY:
return objCEnabled() && parseObjCTryStatement(node);
return _languageFeatures.objCEnabled && parseObjCTryStatement(node);
case T_AT_SYNCHRONIZED:
return objCEnabled() && parseObjCSynchronizedStatement(node);
return _languageFeatures.objCEnabled && parseObjCSynchronizedStatement(node);
case T_AT_THROW:
return objCEnabled() && parseObjCThrowStatement(node);
return _languageFeatures.objCEnabled && parseObjCThrowStatement(node);
case T_Q_D:
case T_Q_Q: {
@@ -3202,7 +3183,7 @@ bool Parser::parseReturnStatement(StatementAST *&node)
if (LA() == T_RETURN) {
ReturnStatementAST *ast = new (_pool) ReturnStatementAST;
ast->return_token = consumeToken();
if (_cxx0xEnabled && LA() == T_LBRACE)
if (_languageFeatures.cxx11Enabled && LA() == T_LBRACE)
parseBracedInitList0x(ast->expression);
else
parseExpression(ast->expression);
@@ -3249,7 +3230,7 @@ bool Parser::parseExpressionOrDeclarationStatement(StatementAST *&node)
|| LA() == T_TYPENAME
|| LA() == T_ENUM
|| lookAtClassKey()
|| (LA() == T_STATIC_ASSERT && _cxx0xEnabled)) {
|| (LA() == T_STATIC_ASSERT && _languageFeatures.cxx11Enabled)) {
return parseDeclarationStatement(node);
}
@@ -3442,7 +3423,7 @@ bool Parser::parseForStatement(StatementAST *&node)
unsigned startOfTypeSpecifier = cursor();
bool blocked = blockErrors(true);
if (objCEnabled()) {
if (_languageFeatures.objCEnabled) {
ObjCFastEnumerationAST *ast = new (_pool) ObjCFastEnumerationAST;
ast->for_token = for_token;
ast->lparen_token = lparen_token;
@@ -3482,7 +3463,7 @@ bool Parser::parseForStatement(StatementAST *&node)
rewind(startOfTypeSpecifier);
}
if (cxx0xEnabled()) {
if (_languageFeatures.cxx11Enabled) {
RangeBasedForStatementAST *ast = new (_pool) RangeBasedForStatementAST;
ast->for_token = for_token;
ast->lparen_token = lparen_token;
@@ -3665,7 +3646,7 @@ bool Parser::parseBlockDeclaration(DeclarationAST *&node)
return parseNamespaceAliasDefinition(node);
case T_STATIC_ASSERT:
if (_cxx0xEnabled)
if (_languageFeatures.cxx11Enabled)
return parseStaticAssertDeclaration(node);
// fall-through
@@ -3746,7 +3727,7 @@ bool Parser::lookAtStorageClassSpecifier() const
case T_TYPEDEF:
return true;
case T_CONSTEXPR:
if (_cxx0xEnabled)
if (_languageFeatures.cxx11Enabled)
return true;
// fall-through
default:
@@ -3944,7 +3925,7 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, ClassSpecifierAST *de
unsigned startOfTypeSpecifier = cursor();
if (! parseElaboratedTypeSpecifier(*decl_specifier_seq_ptr)
|| LA() == T_LBRACE
|| (_cxx0xEnabled && LA() == T_COLON)) {
|| (_languageFeatures.cxx11Enabled && LA() == T_COLON)) {
rewind(startOfTypeSpecifier);
if (! parseEnumSpecifier(*decl_specifier_seq_ptr)) {
error(startOfTypeSpecifier,
@@ -4301,7 +4282,7 @@ bool Parser::parsePrimaryExpression(ExpressionAST *&node)
return parseStringLiteral(node);
case T_NULLPTR:
if (_cxx0xEnabled)
if (_languageFeatures.cxx11Enabled)
return parsePointerLiteral(node);
// fall-through
@@ -4341,12 +4322,12 @@ bool Parser::parsePrimaryExpression(ExpressionAST *&node)
case T_LBRACKET: {
const unsigned lbracket_token = cursor();
if (_cxx0xEnabled) {
if (_languageFeatures.cxx11Enabled) {
if (parseLambdaExpression(node))
return true;
}
if (_objCEnabled) {
if (_languageFeatures.objCEnabled) {
rewind(lbracket_token);
return parseObjCExpression(node);
}
@@ -4828,7 +4809,7 @@ bool Parser::parseTypenameCallExpression(ExpressionAST *&node)
unsigned typename_token = consumeToken();
NameAST *name = 0;
if (parseName(name)
&& (LA() == T_LPAREN || (_cxx0xEnabled && LA() == T_LBRACE))) {
&& (LA() == T_LPAREN || (_languageFeatures.cxx11Enabled && LA() == T_LBRACE))) {
TypenameCallExpressionAST *ast = new (_pool) TypenameCallExpressionAST;
ast->typename_token = typename_token;
ast->name = name;
@@ -4889,7 +4870,7 @@ bool Parser::parseCorePostfixExpression(ExpressionAST *&node)
bool blocked = blockErrors(true);
if (lookAtBuiltinTypeSpecifier() &&
parseSimpleTypeSpecifier(type_specifier) &&
(LA() == T_LPAREN || (_cxx0xEnabled && LA() == T_LBRACE))) {
(LA() == T_LPAREN || (_languageFeatures.cxx11Enabled && LA() == T_LBRACE))) {
ExpressionAST *expr = 0;
if (LA() == T_LPAREN) {
parseExpressionListParen(expr);
@@ -4951,7 +4932,7 @@ bool Parser::parsePostfixExpression(ExpressionAST *&node)
match(T_RBRACKET, &ast->rbracket_token);
ast->base_expression = node;
node = ast;
} else if (_cxx0xEnabled && LA() == T_LBRACE && node->asIdExpression()) {
} else if (_languageFeatures.cxx11Enabled && LA() == T_LBRACE && node->asIdExpression()) {
// this is slightly inconsistent: simple-type-specifier '(' expression-list ')'
// gets parsed as a CallAST while simple-type-specifier brace-init-list
// is a TypenameCallExpressionAST
@@ -5020,7 +5001,7 @@ bool Parser::parseUnaryExpression(ExpressionAST *&node)
ast->sizeof_token = consumeToken();
// sizeof...(Args)
if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT && (LA(2) == T_IDENTIFIER || (LA(2) == T_LPAREN && LA(3) == T_IDENTIFIER
if (_languageFeatures.cxx11Enabled && LA() == T_DOT_DOT_DOT && (LA(2) == T_IDENTIFIER || (LA(2) == T_LPAREN && LA(3) == T_IDENTIFIER
&& LA(4) == T_RPAREN)))
ast->dot_dot_dot_token = consumeToken();
@@ -5046,7 +5027,7 @@ bool Parser::parseUnaryExpression(ExpressionAST *&node)
}
case T_ALIGNOF: {
if (!_cxx0xEnabled)
if (!_languageFeatures.cxx11Enabled)
break;
AlignofExpressionAST *ast = new (_pool) AlignofExpressionAST;
@@ -5211,7 +5192,7 @@ bool Parser::parseNewInitializer(ExpressionAST *&node)
DEBUG_THIS_RULE();
if (LA() == T_LPAREN)
return parseExpressionListParen(node);
else if (_cxx0xEnabled && LA() == T_LBRACE)
else if (_languageFeatures.cxx11Enabled && LA() == T_LBRACE)
return parseBracedInitList0x(node);
return false;
}
@@ -5436,7 +5417,7 @@ void Parser::parseExpressionWithOperatorPrecedence(ExpressionAST *&lhs, int minP
if (operPrecedence <= Prec::Conditional && isCPlusPlus) {
// in C++ you can put a throw in the right-most expression of a conditional expression,
// or an assignment, so some special handling:
if (_cxx0xEnabled) {
if (_languageFeatures.cxx11Enabled) {
if (!parseInitializerClause0x(rhs))
return;
} else {

View File

@@ -36,15 +36,6 @@ public:
Parser(TranslationUnit *translationUnit);
~Parser();
bool qtMocRunEnabled() const;
void setQtMocRunEnabled(bool onoff);
bool cxx0xEnabled() const;
void setCxxOxEnabled(bool onoff);
bool objCEnabled() const;
void setObjCEnabled(bool onoff);
bool parseTranslationUnit(TranslationUnitAST *&node);
public:
@@ -315,11 +306,9 @@ private:
TranslationUnit *_translationUnit;
Control *_control;
MemoryPool *_pool;
LanguageFeatures _languageFeatures;
unsigned _tokenIndex;
bool _templateArguments: 1;
bool _qtMocRunEnabled: 1;
bool _cxx0xEnabled: 1;
bool _objCEnabled: 1;
bool _inFunctionBody: 1;
bool _inObjCImplementationContext: 1;
bool _inExpressionStatement: 1;

View File

@@ -373,6 +373,22 @@ public:
};
};
struct LanguageFeatures
{
LanguageFeatures() : flags(0) {}
union {
unsigned int flags;
struct {
unsigned int qtEnabled : 1; // If Qt is used.
unsigned int qtMocRunEnabled : 1;
unsigned int qtKeywordsEnabled : 1; // If Qt is used but QT_NO_KEYWORDS defined
unsigned int cxx11Enabled : 1;
unsigned int objCEnabled : 1;
};
};
};
} // namespace CPlusPlus

View File

@@ -63,24 +63,6 @@ TranslationUnit::~TranslationUnit()
delete _pool;
}
bool TranslationUnit::qtMocRunEnabled() const
{ return f._qtMocRunEnabled; }
void TranslationUnit::setQtMocRunEnabled(bool onoff)
{ f._qtMocRunEnabled = onoff; }
bool TranslationUnit::cxx0xEnabled() const
{ return f._cxx0xEnabled; }
void TranslationUnit::setCxxOxEnabled(bool onoff)
{ f._cxx0xEnabled = onoff; }
bool TranslationUnit::objCEnabled() const
{ return f._objCEnabled; }
void TranslationUnit::setObjCEnabled(bool onoff)
{ f._objCEnabled = onoff; }
Control *TranslationUnit::control() const
{ return _control; }
@@ -157,9 +139,7 @@ void TranslationUnit::tokenize()
f._tokenized = true;
Lexer lex(this);
lex.setQtMocRunEnabled(f._qtMocRunEnabled);
lex.setCxxOxEnabled(f._cxx0xEnabled);
lex.setObjCEnabled(f._objCEnabled);
lex.setLanguageFeatures(_languageFeatures);
lex.setScanCommentTokens(true);
std::stack<unsigned> braces;
@@ -319,10 +299,6 @@ bool TranslationUnit::parse(ParseMode mode)
f._parsed = true;
Parser parser(this);
parser.setQtMocRunEnabled(f._qtMocRunEnabled);
parser.setCxxOxEnabled(f._cxx0xEnabled);
parser.setObjCEnabled(f._objCEnabled);
bool parsed = false;
switch (mode) {

View File

@@ -87,15 +87,6 @@ public:
return previous;
}
bool qtMocRunEnabled() const;
void setQtMocRunEnabled(bool onoff);
bool cxx0xEnabled() const;
void setCxxOxEnabled(bool onoff);
bool objCEnabled() const;
void setObjCEnabled(bool onoff);
void warning(unsigned index, const char *fmt, ...);
void error(unsigned index, const char *fmt, ...);
void fatal(unsigned index, const char *fmt, ...);
@@ -151,6 +142,9 @@ public:
bool maybeSplitGreaterGreaterToken(unsigned tokenIndex);
LanguageFeatures languageFeatures() const { return _languageFeatures; }
void setLanguageFeatures(LanguageFeatures features) { _languageFeatures = features; }
private:
struct PPLine {
unsigned offset;
@@ -203,14 +197,12 @@ private:
unsigned _parsed: 1;
unsigned _blockErrors: 1;
unsigned _skipFunctionBody: 1;
unsigned _qtMocRunEnabled: 1;
unsigned _cxx0xEnabled: 1;
unsigned _objCEnabled: 1;
};
union {
unsigned _flags;
Flags f;
};
LanguageFeatures _languageFeatures;
};
} // namespace CPlusPlus