summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-02-25 19:41:05 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-02-25 19:41:05 +0000
commit301416380e7ae3b2cc3e0b517504b46aa2b64a23 (patch)
treeaa978522a4e2298a94d1c0ada72a8799a1319b2b /clang/lib/Sema/SemaInit.cpp
parentbe8705bd3f6eaee7a00240a75dbe92092b4f35e1 (diff)
downloadbcm5719-llvm-301416380e7ae3b2cc3e0b517504b46aa2b64a23.tar.gz
bcm5719-llvm-301416380e7ae3b2cc3e0b517504b46aa2b64a23.zip
Remove the FIXME I introduced last night, and pull the logic for
marking selected overloads into the callers. This allows a few callers to skip it altogether (they would have anyways because they weren't interested in successful overloads) or defer until after further checks take place much like the check required for PR9323 to avoid marking unused copy constructors. llvm-svn: 126503
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r--clang/lib/Sema/SemaInit.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index d43ce5bb49c..5882da0eab4 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -2441,6 +2441,10 @@ static OverloadingResult TryRefInitWithConversionFunction(Sema &S,
FunctionDecl *Function = Best->Function;
+ // This is the overload that will actually be used for the initialization, so
+ // mark it as used.
+ S.MarkDeclarationReferenced(DeclLoc, Function);
+
// Compute the returned type of the conversion.
if (isa<CXXConversionDecl>(Function))
T2 = Function->getResultType();
@@ -3045,6 +3049,7 @@ static void TryUserDefinedConversion(Sema &S,
}
FunctionDecl *Function = Best->Function;
+ S.MarkDeclarationReferenced(DeclLoc, Function);
if (isa<CXXConstructorDecl>(Function)) {
// Add the user-defined conversion step. Any cv-qualification conversion is
@@ -3478,9 +3483,7 @@ static ExprResult CopyObject(Sema &S,
}
OverloadCandidateSet::iterator Best;
- switch (CandidateSet.BestViableFunction(S, Loc, Best,
- /*UserDefinedConversion=*/ false,
- IsExtraneousCopy)) {
+ switch (CandidateSet.BestViableFunction(S, Loc, Best)) {
case OR_Success:
break;
@@ -3544,6 +3547,8 @@ static ExprResult CopyObject(Sema &S,
return S.Owned(CurInitExpr);
}
+ S.MarkDeclarationReferenced(Loc, Constructor);
+
// Determine the arguments required to actually perform the
// constructor call (we might have derived-to-base conversions, or
// the copy constructor may have default arguments).
OpenPOWER on IntegriCloud