r210615 - PR19996: don't crash if -Wuninitialized sees a c++1y lambda init-capture.

Richard Smith richard-llvm at metafoo.co.uk
Tue Jun 10 17:31:00 PDT 2014


Author: rsmith
Date: Tue Jun 10 19:31:00 2014
New Revision: 210615

URL: http://llvm.org/viewvc/llvm-project?rev=210615&view=rev
Log:
PR19996: don't crash if -Wuninitialized sees a c++1y lambda init-capture.

Modified:
    cfe/trunk/lib/Analysis/UninitializedValues.cpp
    cfe/trunk/test/SemaCXX/uninit-variables.cpp

Modified: cfe/trunk/lib/Analysis/UninitializedValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/UninitializedValues.cpp?rev=210615&r1=210614&r2=210615&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/UninitializedValues.cpp (original)
+++ cfe/trunk/lib/Analysis/UninitializedValues.cpp Tue Jun 10 19:31:00 2014
@@ -34,7 +34,7 @@ using namespace clang;
 
 static bool isTrackedVar(const VarDecl *vd, const DeclContext *dc) {
   if (vd->isLocalVarDecl() && !vd->hasGlobalStorage() &&
-      !vd->isExceptionVariable() &&
+      !vd->isExceptionVariable() && !vd->isInitCapture() &&
       vd->getDeclContext() == dc) {
     QualType ty = vd->getType();
     return ty->isScalarType() || ty->isVectorType();

Modified: cfe/trunk/test/SemaCXX/uninit-variables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/uninit-variables.cpp?rev=210615&r1=210614&r2=210615&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/uninit-variables.cpp (original)
+++ cfe/trunk/test/SemaCXX/uninit-variables.cpp Tue Jun 10 19:31:00 2014
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -Wuninitialized -fsyntax-only -fcxx-exceptions %s -verify
+// RUN: %clang_cc1 -fsyntax-only -Wuninitialized -fsyntax-only -fcxx-exceptions %s -verify -std=c++1y
 
 // Stub out types for 'typeid' to work.
 namespace std { class type_info {}; }
@@ -147,3 +147,6 @@ int test_const_ref() {
   consume_const_ref(n);
   return n; // expected-warning {{uninitialized when used here}}
 }
+
+// Don't crash here.
+auto PR19996 = [a=0]{int t; return a;};





More information about the cfe-commits mailing list