Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHansruedi Patzen2018-05-28 09:03:00 -0400
committerHansruedi Patzen2018-05-29 02:24:51 -0400
commitf65fa5b7c5d60ac6701626b4d05167c26390215f (patch)
treec24538872f6962df33b752e030d0edc5d1fc5ae2 /core/org.eclipse.cdt.core/parser/org
parenteb197ea3c72fe47ed95cb3ba70e63c79dd2a0dd4 (diff)
downloadorg.eclipse.cdt-f65fa5b7c5d60ac6701626b4d05167c26390215f.tar.gz
org.eclipse.cdt-f65fa5b7c5d60ac6701626b4d05167c26390215f.tar.xz
org.eclipse.cdt-f65fa5b7c5d60ac6701626b4d05167c26390215f.zip
Bug 535196: [C++17] Support *this in lambda capture
Implementation and tests. Change-Id: If32911514eb62078215b5f06be12289fa571e9a3 Signed-off-by: Hansruedi Patzen <hansruedi.patzen@hsr.ch>
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ExpressionWriter.java3
2 files changed, 10 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
index 575083028c..f4564c30b1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
@@ -2122,11 +2122,18 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
switch (LT(1)) {
case IToken.t_this:
+ result.setIsByReference(true);
return setRange(result, offset, consume().getEndOffset());
case IToken.tAMPER:
consume();
referenceCapture = true;
break;
+ case IToken.tSTAR:
+ if (LT(2) == IToken.t_this) {
+ consume();
+ return setRange(result, offset, consume().getEndOffset());
+ }
+ break;
}
final IASTName identifier = identifier();
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ExpressionWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ExpressionWriter.java
index 7816cef8d3..eec6ecfe32 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ExpressionWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ExpressionWriter.java
@@ -570,6 +570,9 @@ public class ExpressionWriter extends NodeWriter{
private void writeCapture(ICPPASTCapture capture) {
if (capture.capturesThisPointer()) {
+ if (!capture.isByReference()) {
+ scribe.print(STAR_OP);
+ }
scribe.print(THIS);
} else {
if (capture instanceof ICPPASTInitCapture) {

Back to the top