[ObjCXX] Warn undeclared identifiers.
authorManman Ren <manman.ren@gmail.com>
Fri, 25 Mar 2016 18:43:46 +0000 (18:43 +0000)
committerManman Ren <manman.ren@gmail.com>
Fri, 25 Mar 2016 18:43:46 +0000 (18:43 +0000)
commit1c4005264685fce12cf2044bb74f09ff774866f1
treeba9de244f46c75e010bc509e96ba28789a2f416e
parentec5ea36891ae3b755a59e309962f820968656da9
[ObjCXX] Warn undeclared identifiers.

Instantiation dependence were not being handled correctly for OpqaueValueExpr
AST nodes. As a result, if an undeclared identifier was used in a CXXNewExpr
that is assigned to a ObjC property, there would be no error during parsing, and
there would be a crash during code gen. This patch makes sure that an error
will be issued during parsing in this case.

Before the fix, if CXXNewExpr has a typo, its InstantiationDependent will be
set to true, but if it is wrapped in a OpaqueValueExpr, the OpaqueValueExpr will
not be instantiation dependent, causing the TypoExpr not be to resolved. The fix
propagates InstantiationDependent to OpaqueValueExpr from its SourceExpr. It
also propagates the other instantiation bits.

rdar://24975562

Differential Revision: http://reviews.llvm.org/D18461

llvm-svn: 264444
clang/include/clang/AST/Expr.h
clang/include/clang/AST/Stmt.h
clang/test/SemaObjCXX/typo-correction.mm [new file with mode: 0644]