From: Argyrios Kyrtzidis Date: Fri, 4 Nov 2011 15:58:13 +0000 (+0000) Subject: In C++ keep unavailable function calls in the AST, like in C/ObjC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0d579b6a3f555c0e37e84e517c81eb9244fef099;p=clang In C++ keep unavailable function calls in the AST, like in C/ObjC. This allows the migrator to visit and fix them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143699 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/ARCMigrate/TransGCCalls.cpp b/lib/ARCMigrate/TransGCCalls.cpp index 71dc6dc357..9c3faae395 100644 --- a/lib/ARCMigrate/TransGCCalls.cpp +++ b/lib/ARCMigrate/TransGCCalls.cpp @@ -40,6 +40,7 @@ public: Transaction Trans(TA); TA.clearDiagnostic(diag::err_unavailable, diag::err_unavailable_message, + diag::err_ovl_deleted_call, // ObjC++ DRE->getSourceRange()); TA.replace(DRE->getSourceRange(), "CFBridgingRelease"); } diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 153c0f8c24..4db75a3bda 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -8761,6 +8761,13 @@ Sema::BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, << getDeletedOrUnavailableSuffix(Best->Function) << Fn->getSourceRange(); CandidateSet.NoteCandidates(*this, OCD_AllCandidates, Args, NumArgs); + + // We emitted an error for the unvailable/deleted function call but keep + // the call in the AST. + FunctionDecl *FDecl = Best->Function; + Fn = FixOverloadedFunctionReference(Fn, Best->FoundDecl, FDecl); + return BuildResolvedCallExpr(Fn, FDecl, LParenLoc, Args, NumArgs, + RParenLoc, ExecConfig); } break; } diff --git a/test/ARCMT/GC.m b/test/ARCMT/GC.m index 90e0b458b2..c82095c3a9 100644 --- a/test/ARCMT/GC.m +++ b/test/ARCMT/GC.m @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result // RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-gc-only -x objective-c %s > %t // RUN: diff %t %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-gc-only -x objective-c++ %s > %t +// RUN: diff %t %s.result #include "Common.h" diff --git a/test/ARCMT/GC.m.result b/test/ARCMT/GC.m.result index 1055aa3338..cdf6431dbf 100644 --- a/test/ARCMT/GC.m.result +++ b/test/ARCMT/GC.m.result @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result // RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-gc-only -x objective-c %s > %t // RUN: diff %t %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-gc-only -x objective-c++ %s > %t +// RUN: diff %t %s.result #include "Common.h"