Allow GNU-style attributes on lambda expressions.

llvm-svn: 203628
diff --git a/clang/test/Misc/ast-dump-attr.cpp b/clang/test/Misc/ast-dump-attr.cpp
index bb4be5b..dde7ba3 100644
--- a/clang/test/Misc/ast-dump-attr.cpp
+++ b/clang/test/Misc/ast-dump-attr.cpp
@@ -114,3 +114,18 @@
 int __attribute__((cdecl)) TestOne(void), TestTwo(void);
 // CHECK: FunctionDecl{{.*}}TestOne{{.*}}__attribute__((cdecl))
 // CHECK: FunctionDecl{{.*}}TestTwo{{.*}}__attribute__((cdecl))
+
+void func() {
+  auto Test = []() __attribute__((no_thread_safety_analysis)) {};
+  // CHECK: CXXMethodDecl{{.*}}operator() 'void (void) const'
+  // CHECK: NoThreadSafetyAnalysisAttr
+
+  // Because GNU's noreturn applies to the function type, and this lambda does
+  // not have a capture list, the call operator and the function pointer
+  // conversion should both be noreturn, but the method should not contain a
+  // NoReturnAttr because the attribute applied to the type.
+  auto Test2 = []() __attribute__((noreturn)) { while(1); };
+  // CHECK: CXXMethodDecl{{.*}}operator() 'void (void) __attribute__((noreturn)) const'
+  // CHECK-NOT: NoReturnAttr
+  // CHECK: CXXConversionDecl{{.*}}operator void (*)() __attribute__((noreturn))
+}
diff --git a/clang/test/Parser/cxx0x-lambda-expressions.cpp b/clang/test/Parser/cxx0x-lambda-expressions.cpp
index e4151dc..9ce24cb 100644
--- a/clang/test/Parser/cxx0x-lambda-expressions.cpp
+++ b/clang/test/Parser/cxx0x-lambda-expressions.cpp
@@ -67,6 +67,7 @@
 
   void attributes() {
     [] [[]] {}; // expected-error {{lambda requires '()' before attribute specifier}}
+    [] __attribute__((noreturn)) {}; // expected-error {{lambda requires '()' before attribute specifier}}
     []() [[]]
       mutable {}; // expected-error {{expected body of lambda expression}}
 
@@ -75,5 +76,10 @@
     []() mutable [[]] -> void {};
     []() mutable noexcept [[]] -> void {};
 
-}
+    // Testing GNU-style attributes on lambdas -- the attribute is specified
+    // before the mutable specifier instead of after (unlike C++11).
+    []() __attribute__((noreturn)) mutable { while(1); };
+    []() mutable
+      __attribute__((noreturn)) { while(1); }; // expected-error {{expected body of lambda expression}}
+  }
 };