[PATCH] D51115: [ASTImporter] Actually test ArrayInitLoopExpr in the array-init-loop-expr test.

Raphael Isemann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 22 11:20:04 PDT 2018


teemperor created this revision.
Herald added subscribers: cfe-commits, martong.
Herald added a reviewer: a.sidorin.

The `array-init-loop-expr` test is currently not testing the importing of ArrayInitLoopExprs.

This is because we import the `S` struct into the `test.cpp` context
and only do a copy-assignment in `test.cpp`, so the actual ArrayInitLoopExpr we wanted to
import is generated by clang directly in the target context. This means we actually
never test the importing of ArrayInitLoopExpr with this test, which becomes obvious
when looking at the missing test coverage for the respective  VisitArrayInitLoopExpr method.

This patch moves the copy-assignment of our struct to the `S.cpp` context, which means
that `test.cpp` now actually has to import the ArrayInitLoopExpr.


Repository:
  rC Clang

https://reviews.llvm.org/D51115

Files:
  test/Import/array-init-loop-expr/Inputs/S.cpp
  test/Import/array-init-loop-expr/test.cpp


Index: test/Import/array-init-loop-expr/test.cpp
===================================================================
--- test/Import/array-init-loop-expr/test.cpp
+++ test/Import/array-init-loop-expr/test.cpp
@@ -6,6 +6,5 @@
 // CHECK: ArrayInitIndexExpr
 
 void expr() {
-  S s;
-  S copy = s;
+  f();
 }
Index: test/Import/array-init-loop-expr/Inputs/S.cpp
===================================================================
--- test/Import/array-init-loop-expr/Inputs/S.cpp
+++ test/Import/array-init-loop-expr/Inputs/S.cpp
@@ -1,3 +1,8 @@
 class S {
   int a[10];
 };
+
+void f() {
+  S s;
+  S copy = s;
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51115.162004.patch
Type: text/x-patch
Size: 612 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180822/e844946c/attachment-0001.bin>


More information about the cfe-commits mailing list