]> granicus.if.org Git - clang/commitdiff
Add some missing ProhibitAttributes calls to some declaration-like #pragmas.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 16 Sep 2013 21:17:44 +0000 (21:17 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 16 Sep 2013 21:17:44 +0000 (21:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190806 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseStmt.cpp
test/OpenMP/parallel_messages.cpp
test/SemaCXX/captured-statements.cpp

index b74ab2556911bf9df92862f234a7679876ed9204..8084a8fa5e71bc08707ec7b9aa7922ed7bfe4646 100644 (file)
@@ -303,9 +303,11 @@ Retry:
     return StmtEmpty();
 
   case tok::annot_pragma_captured:
+    ProhibitAttributes(Attrs);
     return HandlePragmaCaptured();
 
   case tok::annot_pragma_openmp:
+    ProhibitAttributes(Attrs);
     return ParseOpenMPDeclarativeOrExecutableDirective();
 
   }
index c046f873d1b69bfc00b88ad3c90162eac3525d7f..d991ccfc3806705b725c226c5082cb323349855e 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 -o - %s
 
 void foo() {
 }
@@ -44,6 +44,10 @@ int main(int argc, char **argv) {
     return 1; // expected-error {{cannot return from OpenMP region}}
   }
 
+  [[]] // expected-error {{an attribute list cannot appear here}}
+  #pragma omp parallel
+  for (int n = 0; n < 100; ++n) {}
+
   return 0;
 }
 
index dbb18a7b6765bb5008fdba7bbe087d798e59cb10..5fb686c3c913ad5177a17a8facd4381ec18a3caf 100644 (file)
@@ -164,3 +164,10 @@ void test_capture_variadic() {
   (void)captured_sum(1, 2, 3); // OK
   (void)captured_sum(1, 2, 3, 4, 5); // OK
 }
+
+void test_capture_with_attributes() {
+  [[]] // expected-error {{an attribute list cannot appear here}}
+  #pragma clang __debug captured
+  {
+  }
+}