qdoc: Enable support for rvalue references in function signatures

qdoc interprets the double-ampersand in function parameters
using rvalue references (e.g. 'Type &&other') incorrectly
as a logical AND operator, resulting in a syntax error.

This change works around the issue by treating '&' the same
as '*', and defining Q_COMPILER_RVALUE_REFS for qdoc.

Task-number: QTBUG-32675
Change-Id: I499611f16f22c33ff5b878da0cd59d67ddf53d72
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Reviewed-by: Martin Smith <martin.smith@digia.com>
This commit is contained in:
Topi Reinio 2013-08-29 09:10:52 +02:00 committed by The Qt Project
parent df7944e7d7
commit 0023774411
2 changed files with 7 additions and 2 deletions

View File

@ -14,7 +14,8 @@ defines += Q_QDOC \
QT_DEPRECATED_* \
Q_NO_USING_KEYWORD \
__cplusplus \
Q_COMPILER_INITIALIZER_LISTS
Q_COMPILER_INITIALIZER_LISTS \
Q_COMPILER_RVALUE_REFS
Cpp.ignoretokens += \
PHONON_EXPORT \

View File

@ -237,7 +237,11 @@ int Tokenizer::getToken()
return getTokenAfterPreprocessor();
case '&':
yyCh = getChar();
if (yyCh == '&' || yyCh == '=') {
/*
Removed check for '&&', only interpret '&=' as an operator.
'&&' is also used for an rvalue reference. QTBUG-32675
*/
if (yyCh == '=') {
yyCh = getChar();
return Tok_SomeOperator;
}