From 9f73c5848bd58010b90adbe1b66f6a8b745dcfbe Mon Sep 17 00:00:00 2001 From: Leandro Melo <leandro.melo@nokia.com> Date: Fri, 18 Nov 2011 11:40:23 +0100 Subject: [PATCH] C++: Recognize C++11 constexpr Change-Id: Iac8ba58404284f0d90fd5a3640eb9ccd7e98058d Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com> --- src/libs/3rdparty/cplusplus/Keywords.cpp | 21 ++++++++++++++++++++- src/libs/3rdparty/cplusplus/Parser.cpp | 4 ++++ src/libs/3rdparty/cplusplus/Token.h | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/libs/3rdparty/cplusplus/Keywords.cpp b/src/libs/3rdparty/cplusplus/Keywords.cpp index 832639f4b0e..003566c414e 100644 --- a/src/libs/3rdparty/cplusplus/Keywords.cpp +++ b/src/libs/3rdparty/cplusplus/Keywords.cpp @@ -945,7 +945,7 @@ static inline int classify8(const char *s, bool q, bool x) { 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[1] == '_') { 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') { if (s[1] == 'a') { if (s[2] == 'm') { diff --git a/src/libs/3rdparty/cplusplus/Parser.cpp b/src/libs/3rdparty/cplusplus/Parser.cpp index d0e9dc7c60e..f89596cf08d 100644 --- a/src/libs/3rdparty/cplusplus/Parser.cpp +++ b/src/libs/3rdparty/cplusplus/Parser.cpp @@ -3413,6 +3413,10 @@ bool Parser::lookAtStorageClassSpecifier() const case T_MUTABLE: case T_TYPEDEF: return true; + case T_CONSTEXPR: + if (_cxx0xEnabled) + return true; + // fall-through default: return false; } diff --git a/src/libs/3rdparty/cplusplus/Token.h b/src/libs/3rdparty/cplusplus/Token.h index a55b8857264..88de833e318 100644 --- a/src/libs/3rdparty/cplusplus/Token.h +++ b/src/libs/3rdparty/cplusplus/Token.h @@ -111,6 +111,7 @@ enum Kind { T_CLASS, T_CONST, T_CONST_CAST, + T_CONSTEXPR, T_CONTINUE, T_DEFAULT, T_DELETE, -- GitLab