r251729 - Sema: correct typo recovery with blocks
Saleem Abdulrasool via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 30 17:39:15 PDT 2015
Author: compnerd
Date: Fri Oct 30 19:39:15 2015
New Revision: 251729
URL: http://llvm.org/viewvc/llvm-project?rev=251729&view=rev
Log:
Sema: correct typo recovery with blocks
Handle blocks in the tree transform for the typo correction as otherwise, the
capture may miss. This would trigger an assertion. Thanks to Doug Gregor for
the help with this!
Fixes PR25001.
Added:
cfe/trunk/test/SemaCXX/typo-correction-blocks.c
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=251729&r1=251728&r2=251729&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Fri Oct 30 19:39:15 2015
@@ -6545,6 +6545,8 @@ public:
ExprResult TransformLambdaExpr(LambdaExpr *E) { return Owned(E); }
+ ExprResult TransformBlockExpr(BlockExpr *E) { return Owned(E); }
+
ExprResult Transform(Expr *E) {
ExprResult Res;
while (true) {
Added: cfe/trunk/test/SemaCXX/typo-correction-blocks.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/typo-correction-blocks.c?rev=251729&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/typo-correction-blocks.c (added)
+++ cfe/trunk/test/SemaCXX/typo-correction-blocks.c Fri Oct 30 19:39:15 2015
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -triple i386-apple-macosx -fblocks -fsyntax-only -verify %s
+
+extern int h(int *);
+extern void g(int, void (^)(void));
+extern int fuzzys; // expected-note {{'fuzzys' declared here}}
+
+static void f(void *v) {
+ g(fuzzy, ^{ // expected-error {{did you mean 'fuzzys'}}
+ int i = h(v);
+ });
+}
+
More information about the cfe-commits
mailing list