[PATCH] D50793: [ASTImporter] Add test for importing CompoundAssignOperators

Raphael Isemann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 15 11:11:07 PDT 2018


teemperor created this revision.
Herald added a subscriber: martong.
Herald added a reviewer: a.sidorin.

Repository:
  rC Clang

https://reviews.llvm.org/D50793

Files:
  test/Import/compound-assign-op/Inputs/F.cpp
  test/Import/compound-assign-op/test.cpp


Index: test/Import/compound-assign-op/test.cpp
===================================================================
--- /dev/null
+++ test/Import/compound-assign-op/test.cpp
@@ -0,0 +1,45 @@
+// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s
+
+// CHECK: VarDecl
+// CHECK-NEXT: Integer
+// CHECK-NEXT: CompoundAssignOperator
+// CHECK-SAME: '+='
+
+// CHECK: VarDecl
+// CHECK-NEXT: Integer
+// CHECK-NEXT: CompoundAssignOperator
+// CHECK-SAME: '-='
+
+// CHECK: VarDecl
+// CHECK-NEXT: Integer
+// CHECK-NEXT: CompoundAssignOperator
+// CHECK-SAME: '*='
+
+// CHECK: VarDecl
+// CHECK-NEXT: Integer
+// CHECK-NEXT: CompoundAssignOperator
+// CHECK-SAME: '/='
+
+// CHECK: VarDecl
+// CHECK-NEXT: Integer
+// CHECK-NEXT: CompoundAssignOperator
+// CHECK-SAME: '&='
+
+// CHECK: VarDecl
+// CHECK-NEXT: Integer
+// CHECK-NEXT: CompoundAssignOperator
+// CHECK-SAME: '^='
+
+// CHECK: VarDecl
+// CHECK-NEXT: Integer
+// CHECK-NEXT: CompoundAssignOperator
+// CHECK-SAME: '<<='
+
+// CHECK: VarDecl
+// CHECK-NEXT: Integer
+// CHECK-NEXT: CompoundAssignOperator
+// CHECK-SAME: '>>='
+
+void expr() {
+  f();
+}
Index: test/Import/compound-assign-op/Inputs/F.cpp
===================================================================
--- /dev/null
+++ test/Import/compound-assign-op/Inputs/F.cpp
@@ -0,0 +1,18 @@
+void f() {
+  unsigned iadd_eq = 0U;
+  iadd_eq += 1U;
+  unsigned isub_eq = 0U;
+  isub_eq -= 1U;
+  unsigned imul_eq = 0U;
+  imul_eq *= 1U;
+  unsigned idiv_eq = 0U;
+  idiv_eq /= 1U;
+  unsigned iand_eq = 0U;
+  iand_eq &= 1U;
+  unsigned ixor_eq = 0U;
+  ixor_eq ^= 1U;
+  unsigned ilsh_eq = 0U;
+  ilsh_eq <<= 1U;
+  unsigned irsh_eq = 0U;
+  irsh_eq >>= 1U;
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50793.160862.patch
Type: text/x-patch
Size: 1718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180815/4d95fbe7/attachment.bin>


More information about the cfe-commits mailing list