aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/cplusplus
diff options
context:
space:
mode:
authorLeander Schulten <Leander.Schulten@rwth-aachen.de>2021-01-30 22:11:04 +0100
committerLeander Schulten <Leander.Schulten@rwth-aachen.de>2021-02-04 11:40:05 +0000
commit29207e3eebb5ea7597d4160bbf171f1cec0edd5c (patch)
tree2bddd9ccf4f8f26ad51ca074bef3f7c83c58c32f /src/libs/3rdparty/cplusplus
parent0e0c2ca91c53e7bca3c8ea0a1c047a87b0873ac7 (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')
-rw-r--r--src/libs/3rdparty/cplusplus/Bind.cpp27
-rw-r--r--src/libs/3rdparty/cplusplus/Symbols.h1
2 files changed, 28 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()));
}
diff --git a/src/libs/3rdparty/cplusplus/Symbols.h b/src/libs/3rdparty/cplusplus/Symbols.h
index bfb645d1c0..eb926a1b86 100644
--- a/src/libs/3rdparty/cplusplus/Symbols.h
+++ b/src/libs/3rdparty/cplusplus/Symbols.h
@@ -544,6 +544,7 @@ public:
int baseClassCount() const;
BaseClass *baseClassAt(int index) const;
void addBaseClass(BaseClass *baseClass);
+ const std::vector<BaseClass *> &baseClasses() const { return _baseClasses; }
// Symbol's interface
FullySpecifiedType type() const override;