forked from qt-creator/qt-creator
C++: Recognize C++11 constexpr
Change-Id: Iac8ba58404284f0d90fd5a3640eb9ccd7e98058d Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
21
src/libs/3rdparty/cplusplus/Keywords.cpp
vendored
21
src/libs/3rdparty/cplusplus/Keywords.cpp
vendored
@@ -945,7 +945,7 @@ static inline int classify8(const char *s, bool q, bool x) {
|
|||||||
return T_IDENTIFIER;
|
return T_IDENTIFIER;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int classify9(const char *s, bool q, bool) {
|
static inline int classify9(const char *s, bool q, bool x) {
|
||||||
if (s[0] == '_') {
|
if (s[0] == '_') {
|
||||||
if (s[1] == '_') {
|
if (s[1] == '_') {
|
||||||
if (s[2] == 'c') {
|
if (s[2] == 'c') {
|
||||||
@@ -965,6 +965,25 @@ static inline int classify9(const char *s, bool q, bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (x && s[0] == 'c') {
|
||||||
|
if (s[1] == 'o') {
|
||||||
|
if (s[2] == 'n') {
|
||||||
|
if (s[3] == 's') {
|
||||||
|
if (s[4] == 't') {
|
||||||
|
if (s[5] == 'e') {
|
||||||
|
if (s[6] == 'x') {
|
||||||
|
if (s[7] == 'p') {
|
||||||
|
if (s[8] == 'r') {
|
||||||
|
return T_CONSTEXPR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (s[0] == 'n') {
|
else if (s[0] == 'n') {
|
||||||
if (s[1] == 'a') {
|
if (s[1] == 'a') {
|
||||||
if (s[2] == 'm') {
|
if (s[2] == 'm') {
|
||||||
|
4
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
4
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
@@ -3413,6 +3413,10 @@ bool Parser::lookAtStorageClassSpecifier() const
|
|||||||
case T_MUTABLE:
|
case T_MUTABLE:
|
||||||
case T_TYPEDEF:
|
case T_TYPEDEF:
|
||||||
return true;
|
return true;
|
||||||
|
case T_CONSTEXPR:
|
||||||
|
if (_cxx0xEnabled)
|
||||||
|
return true;
|
||||||
|
// fall-through
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
1
src/libs/3rdparty/cplusplus/Token.h
vendored
1
src/libs/3rdparty/cplusplus/Token.h
vendored
@@ -111,6 +111,7 @@ enum Kind {
|
|||||||
T_CLASS,
|
T_CLASS,
|
||||||
T_CONST,
|
T_CONST,
|
||||||
T_CONST_CAST,
|
T_CONST_CAST,
|
||||||
|
T_CONSTEXPR,
|
||||||
T_CONTINUE,
|
T_CONTINUE,
|
||||||
T_DEFAULT,
|
T_DEFAULT,
|
||||||
T_DELETE,
|
T_DELETE,
|
||||||
|
Reference in New Issue
Block a user