summaryrefslogtreecommitdiffstats
path: root/lib/Sema
diff options
context:
space:
mode:
authorKaelyn Takata <rikka@google.com>2015-01-07 21:16:39 +0000
committerKaelyn Takata <rikka@google.com>2015-01-07 21:16:39 +0000
commitd255266a066331d8d7d0808c0e0bc0cda33d647e (patch)
tree3e1a54410daa4c6d761462ba2636a5214f709039 /lib/Sema
parent044c7319f6df1f755647c4b76b421d0e20a2cbe3 (diff)
Handle OpaqueValueExprs more intelligently in the TransformTypos tree
transform. Also diagnose typos in the initializer of an invalid C++ declaration. Both issues were hit using the same line of test code, depending on whether the code was treated as C or C++. Fixes PR22092. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225389 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/SemaDecl.cpp4
-rw-r--r--lib/Sema/SemaExprCXX.cpp6
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 7264d82774..3af60cf299 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -8574,8 +8574,10 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init,
bool DirectInit, bool TypeMayContainAuto) {
// If there is no declaration, there was an error parsing it. Just ignore
// the initializer.
- if (!RealDecl || RealDecl->isInvalidDecl())
+ if (!RealDecl || RealDecl->isInvalidDecl()) {
+ CorrectDelayedTyposInExpr(Init);
return;
+ }
if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(RealDecl)) {
// With declarators parsed the way they are, the parser cannot
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 1e692ebe25..6351b7d115 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -6141,6 +6141,12 @@ public:
ExprResult TransformLambdaExpr(LambdaExpr *E) { return Owned(E); }
+ ExprResult TransformOpaqueValueExpr(OpaqueValueExpr *E) {
+ if (Expr *SE = E->getSourceExpr())
+ return TransformExpr(SE);
+ return BaseTransform::TransformOpaqueValueExpr(E);
+ }
+
ExprResult Transform(Expr *E) {
ExprResult Res;
while (true) {