This is an archive of the discontinued LLVM Phabricator instance.

ObjCXX: Warn undeclared identifiers.
ClosedPublic

Authored by manmanren on Mar 24 2016, 1:43 PM.

Details

Summary

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.

Diff Detail

Event Timeline

manmanren updated this revision to Diff 51598.Mar 24 2016, 1:43 PM
manmanren retitled this revision from to ObjCXX: Warn undeclared identifiers..
manmanren updated this object.
manmanren added reviewers: rsmith, rjmccall.
manmanren added a subscriber: cfe-commits.

Oh, you know, this should really propagate all the dependence bits, not just instantiation-dependence. It would be safer, at least. You could probably find a contrived example involving value-dependence.

Oh, you know, this should really propagate all the dependence bits, not just instantiation-dependence. It would be safer, at least. You could probably find a contrived example involving value-dependence.

Thanks for the quick review, John!

I will propagate all the dependence bits and commit.

Cheers,
Manman

This revision was automatically updated to reflect the committed changes.