After some discussion with Doug, we decided that it made a lot more sense
for __unknown_anytype resolution to destructively modify the AST.  So that's
what it does now, which significantly simplifies some of the implementation.
Normal member calls work pretty cleanly now, and I added support for
propagating unknown-ness through &.

llvm-svn: 129331
diff --git a/clang/lib/AST/ExprClassification.cpp b/clang/lib/AST/ExprClassification.cpp
index f90d59f..e94ae82 100644
--- a/clang/lib/AST/ExprClassification.cpp
+++ b/clang/lib/AST/ExprClassification.cpp
@@ -170,6 +170,9 @@
     // C++ [expr.prim.general]p3: The result is an lvalue if the entity is a
     //   function or variable and a prvalue otherwise.
   case Expr::DeclRefExprClass:
+    if (E->getType() == Ctx.UnknownAnyTy)
+      return isa<FunctionDecl>(cast<DeclRefExpr>(E)->getDecl())
+               ? Cl::CL_PRValue : Cl::CL_LValue;
     return ClassifyDecl(Ctx, cast<DeclRefExpr>(E)->getDecl());
     // We deal with names referenced from blocks the same way.
   case Expr::BlockDeclRefExprClass:
@@ -375,6 +378,10 @@
 }
 
 static Cl::Kinds ClassifyMemberExpr(ASTContext &Ctx, const MemberExpr *E) {
+  if (E->getType() == Ctx.UnknownAnyTy)
+    return (isa<FunctionDecl>(E->getMemberDecl())
+              ? Cl::CL_PRValue : Cl::CL_LValue);
+
   // Handle C first, it's easier.
   if (!Ctx.getLangOptions().CPlusPlus) {
     // C99 6.5.2.3p3