[clang] 8c6c606 - [Clang] Add a "#pragma unroll" test case for correct error reporting

Yuanfang Chen via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 16 13:03:51 PDT 2020


Author: Yuanfang Chen
Date: 2020-06-16T13:03:32-07:00
New Revision: 8c6c606cdc72c3ddd55f382d91ef1afc3cb9f2a8

URL: https://github.com/llvm/llvm-project/commit/8c6c606cdc72c3ddd55f382d91ef1afc3cb9f2a8
DIFF: https://github.com/llvm/llvm-project/commit/8c6c606cdc72c3ddd55f382d91ef1afc3cb9f2a8.diff

LOG: [Clang] Add a "#pragma unroll" test case for correct error reporting

For PR46336.

Added: 
    

Modified: 
    clang/test/Parser/pragma-unroll.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/Parser/pragma-unroll.cpp b/clang/test/Parser/pragma-unroll.cpp
index fb713812877e..c89cf49a0020 100644
--- a/clang/test/Parser/pragma-unroll.cpp
+++ b/clang/test/Parser/pragma-unroll.cpp
@@ -55,6 +55,15 @@ void test(int *List, int Length) {
 #pragma nounroll
 /* expected-error {{expected a for, while, or do-while loop to follow '#pragma nounroll'}} */ int l = Length;
 
+  switch (i) {
+  case 1:
+#pragma unroll
+/* expected-error {{expected a for, while, or do-while loop to follow '#pragma unroll'}} */ [[fallthrough]];
+  case 2:
+    for (int i = 0; i < 10; ++i);
+    break;
+  }
+
 #pragma unroll 4
 /* expected-error {{incompatible directives 'unroll(disable)' and '#pragma unroll(4)'}} */ #pragma clang loop unroll(disable)
   while (i-10 < Length) {


        


More information about the cfe-commits mailing list