diff options
author | Leander Schulten <Leander.Schulten@rwth-aachen.de> | 2021-01-30 22:11:04 +0100 |
---|---|---|
committer | Leander Schulten <Leander.Schulten@rwth-aachen.de> | 2021-02-04 11:40:05 +0000 |
commit | 29207e3eebb5ea7597d4160bbf171f1cec0edd5c (patch) | |
tree | 2bddd9ccf4f8f26ad51ca074bef3f7c83c58c32f /src/libs/3rdparty/cplusplus/Bind.cpp | |
parent | 0e0c2ca91c53e7bca3c8ea0a1c047a87b0873ac7 (diff) |
CppEditor: Add Base Class Support for Generate Constructor QuickFix
Change-Id: Idd92229134609c0ac87aad030a6bb645ff4cce1b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/libs/3rdparty/cplusplus/Bind.cpp')
-rw-r--r-- | src/libs/3rdparty/cplusplus/Bind.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/libs/3rdparty/cplusplus/Bind.cpp b/src/libs/3rdparty/cplusplus/Bind.cpp index 5313bd2d91..4fb9427ace 100644 --- a/src/libs/3rdparty/cplusplus/Bind.cpp +++ b/src/libs/3rdparty/cplusplus/Bind.cpp @@ -1253,12 +1253,39 @@ const StringLiteral *Bind::asStringLiteral(const AST *ast) const int firstToken = ast->firstToken(); const int lastToken = ast->lastToken(); std::string buffer; + + const auto token = tokenAt(ast->firstToken()); + + if (token.isCharLiteral()) { + if (token.kind() == T_WIDE_CHAR_LITERAL) + buffer += 'L'; + else if (token.kind() == T_UTF16_CHAR_LITERAL) + buffer += 'u'; + else if (token.kind() == T_UTF32_CHAR_LITERAL) + buffer += 'U'; + buffer += '\''; + } else if (token.isStringLiteral()) { + if (token.kind() == T_WIDE_STRING_LITERAL) + buffer += 'L'; + else if (token.kind() == T_UTF16_STRING_LITERAL) + buffer += 'u'; + else if (token.kind() == T_UTF32_STRING_LITERAL) + buffer += 'U'; + else if (token.kind() == T_UTF8_STRING_LITERAL) + buffer += "u8"; + buffer += '"'; + } for (int index = firstToken; index != lastToken; ++index) { const Token &tk = tokenAt(index); if (index != firstToken && (tk.whitespace() || tk.newline())) buffer += ' '; buffer += tk.spell(); } + if (token.isCharLiteral()) + buffer += '\''; + else if (token.isStringLiteral()) + buffer += '"'; + return control()->stringLiteral(buffer.c_str(), int(buffer.size())); } |