r288089 - Avoid lambdas in default member initializers to work around clang bug

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 28 15:58:04 PST 2016


Author: rnk
Date: Mon Nov 28 17:58:04 2016
New Revision: 288089

URL: http://llvm.org/viewvc/llvm-project?rev=288089&view=rev
Log:
Avoid lambdas in default member initializers to work around clang bug

On Windows, Clang is mangling lambdas in default member initializers
incorrectly. See PR31197.

This is causing redness on the self-host bots. Work around the problem
locally so we aren't blind to further issues.

Modified:
    cfe/trunk/unittests/Tooling/LookupTest.cpp

Modified: cfe/trunk/unittests/Tooling/LookupTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/LookupTest.cpp?rev=288089&r1=288088&r2=288089&view=diff
==============================================================================
--- cfe/trunk/unittests/Tooling/LookupTest.cpp (original)
+++ cfe/trunk/unittests/Tooling/LookupTest.cpp Mon Nov 28 17:58:04 2016
@@ -13,18 +13,19 @@ using namespace clang;
 
 namespace {
 struct GetDeclsVisitor : TestVisitor<GetDeclsVisitor> {
-  std::function<void(CallExpr *)> OnCall = [&](CallExpr *Expr) {};
-  std::function<void(RecordTypeLoc)> OnRecordTypeLoc = [&](RecordTypeLoc Type) {
-  };
+  std::function<void(CallExpr *)> OnCall;
+  std::function<void(RecordTypeLoc)> OnRecordTypeLoc;
   SmallVector<Decl *, 4> DeclStack;
 
   bool VisitCallExpr(CallExpr *Expr) {
-    OnCall(Expr);
+    if (OnCall)
+      OnCall(Expr);
     return true;
   }
 
   bool VisitRecordTypeLoc(RecordTypeLoc Loc) {
-    OnRecordTypeLoc(Loc);
+    if (OnRecordTypeLoc)
+      OnRecordTypeLoc(Loc);
     return true;
   }
 




More information about the cfe-commits mailing list