summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2015-01-21 01:49:01 +0000
committerHans Wennborg <hans@hanshq.net>2015-01-21 01:49:01 +0000
commitce3f23cc7f29c2d1c31f2d755373c409f22add31 (patch)
tree985e8ceb97b69cb54639e4efc1e0aacfeff9e03a
parente2b4aa19430a7f0eb9a166b701e40c3dc4cdd53b (diff)
Merging r226624:
------------------------------------------------------------------------ r226624 | rikka | 2015-01-20 16:04:19 -0800 (Tue, 20 Jan 2015) | 6 lines Correct all typos in the initialization arguments, even if one could not be corrected. This fixes PR22250, which exposed the bug where if there's more than one TypoExpr in the arguments, once one failed to be corrected none of the TypoExprs after it would be handled at all thanks to an early return. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@226635 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaDecl.cpp7
-rw-r--r--test/SemaCXX/typo-correction-delayed.cpp8
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index a2e5b98d48..b556f18b76 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -8828,11 +8828,12 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init,
});
if (Res.isInvalid()) {
VDecl->setInvalidDecl();
- return;
- }
- if (Res.get() != Args[Idx])
+ } else if (Res.get() != Args[Idx]) {
Args[Idx] = Res.get();
+ }
}
+ if (VDecl->isInvalidDecl())
+ return;
InitializationSequence InitSeq(*this, Entity, Kind, Args);
ExprResult Result = InitSeq.Perform(*this, Entity, Kind, Args, &DclT);
diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correction-delayed.cpp
index e028faad25..c5c23ba039 100644
--- a/test/SemaCXX/typo-correction-delayed.cpp
+++ b/test/SemaCXX/typo-correction-delayed.cpp
@@ -157,3 +157,11 @@ namespace PR22092 {
a = b ? : 0; // expected-error {{C++ requires a type specifier for all declarations}} \
// expected-error-re {{use of undeclared identifier 'b'{{$}}}}
}
+
+namespace PR22250 {
+// expected-error@+4 {{use of undeclared identifier 'size_t'; did you mean 'sizeof'?}}
+// expected-error-re@+3 {{use of undeclared identifier 'y'{{$}}}}
+// expected-error-re@+2 {{use of undeclared identifier 'z'{{$}}}}
+// expected-error@+1 {{expected ';' after top level declarator}}
+int getenv_s(size_t *y, char(&z)) {}
+}