r224173 - Implement feedback on r224172 in PR21899

Reid Kleckner reid at kleckner.net
Fri Dec 12 17:11:24 PST 2014


Author: rnk
Date: Fri Dec 12 19:11:23 2014
New Revision: 224173

URL: http://llvm.org/viewvc/llvm-project?rev=224173&view=rev
Log:
Implement feedback on r224172 in PR21899

Based on suggestions from Kaelyn.

Modified:
    cfe/trunk/lib/Sema/SemaExprCXX.cpp
    cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=224173&r1=224172&r2=224173&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Fri Dec 12 19:11:23 2014
@@ -6105,7 +6105,7 @@ public:
     auto Result = BaseTransform::RebuildCallExpr(Callee, LParenLoc, Args,
                                                  RParenLoc, ExecConfig);
     if (auto *OE = dyn_cast<OverloadExpr>(Callee)) {
-      if (!Result.isInvalid() && Result.get()) {
+      if (Result.isUsable()) {
         Expr *ResultCall = Result.get();
         if (auto *BE = dyn_cast<CXXBindTemporaryExpr>(ResultCall))
           ResultCall = BE->getSubExpr();

Modified: cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp?rev=224173&r1=224172&r2=224173&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp (original)
+++ cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp Fri Dec 12 19:11:23 2014
@@ -120,22 +120,13 @@ public:
   explicit SomeClass() : Kind(kSum) {}  // expected-error {{use of undeclared identifier 'kSum'; did you mean 'kNum'?}}
 };
 
-extern "C" int printf(const char *, ...);
-
 // There used to be an issue with typo resolution inside overloads.
-struct AssertionResult {
-  ~AssertionResult();
-  operator bool();
-  int val;
-};
-AssertionResult Compare(const char *a, const char *b);
-AssertionResult Compare(int a, int b);
-int main() {
+struct AssertionResult { ~AssertionResult(); };
+AssertionResult Overload(const char *a);
+AssertionResult Overload(int a);
+void UseOverload() {
   // expected-note at +1 {{'result' declared here}}
   const char *result;
   // expected-error at +1 {{use of undeclared identifier 'resulta'; did you mean 'result'?}}
-  if (AssertionResult ar = (Compare("value1", resulta)))
-    ;
-  else
-    printf("ar: %d\n", ar.val);
+  Overload(resulta);
 }





More information about the cfe-commits mailing list