diff options
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 1 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 10 | ||||
-rw-r--r-- | lib/Sema/SemaInit.cpp | 11 | ||||
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 2 |
5 files changed, 15 insertions, 13 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 4c8d098158..97d1ea2cf1 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -2849,6 +2849,7 @@ static void handleCleanupAttr(Sema &S, Decl *D, const AttributeList &Attr) { CleanupAttr(Attr.getRange(), S.Context, FD, Attr.getAttributeSpellingListIndex())); S.MarkFunctionReferenced(Attr.getParameterLoc(), FD); + S.DiagnoseUseOfDecl(FD, Attr.getParameterLoc()); } /// Handle __attribute__((format_arg((idx)))) attribute based on diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index f6c6fe118e..191683d33d 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -11210,7 +11210,9 @@ void Sema::MarkMemberReferenced(MemberExpr *E) { if (Method->isPure()) OdrUse = false; } - MarkExprReferenced(*this, E->getMemberLoc(), E->getMemberDecl(), E, OdrUse); + SourceLocation Loc = E->getMemberLoc().isValid() ? + E->getMemberLoc() : E->getLocStart(); + MarkExprReferenced(*this, Loc, E->getMemberDecl(), E, OdrUse); } /// \brief Perform marking for a reference to an arbitrary declaration. It diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 7f24af8be1..49d66113dc 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -1376,10 +1376,14 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal, } // Mark the new and delete operators as referenced. - if (OperatorNew) + if (OperatorNew) { + DiagnoseUseOfDecl(OperatorNew, StartLoc); MarkFunctionReferenced(StartLoc, OperatorNew); - if (OperatorDelete) + } + if (OperatorDelete) { + DiagnoseUseOfDecl(OperatorDelete, StartLoc); MarkFunctionReferenced(StartLoc, OperatorDelete); + } // C++0x [expr.new]p17: // If the new expression creates an array of objects of class type, @@ -5335,12 +5339,12 @@ ExprResult Sema::BuildCXXMemberCallExpr(Expr *E, NamedDecl *FoundDecl, VK_RValue, OK_Ordinary); if (HadMultipleCandidates) ME->setHadMultipleCandidates(true); + MarkMemberReferenced(ME); QualType ResultType = Method->getResultType(); ExprValueKind VK = Expr::getValueKindForType(ResultType); ResultType = ResultType.getNonLValueExprType(Context); - MarkFunctionReferenced(Exp.get()->getLocStart(), Method); CXXMemberCallExpr *CE = new (Context) CXXMemberCallExpr(Context, ME, MultiExprArg(), ResultType, VK, Exp.get()->getLocEnd()); diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 0612c73f89..1b69872417 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -3262,10 +3262,9 @@ static OverloadingResult TryRefInitWithConversionFunction(Sema &S, return Result; FunctionDecl *Function = Best->Function; - - // This is the overload that will actually be used for the initialization, so - // mark it as used. - S.MarkFunctionReferenced(DeclLoc, Function); + // This is the overload that will be used for this initialization step if we + // use this initialization. Mark it as referenced. + Function->setReferenced(); // Compute the returned type of the conversion. if (isa<CXXConversionDecl>(Function)) @@ -3831,7 +3830,7 @@ static void TryUserDefinedConversion(Sema &S, } FunctionDecl *Function = Best->Function; - S.MarkFunctionReferenced(DeclLoc, Function); + Function->setReferenced(); bool HadMultipleCandidates = (CandidateSet.size() > 1); if (isa<CXXConstructorDecl>(Function)) { @@ -4609,8 +4608,6 @@ static ExprResult CopyObject(Sema &S, return S.Owned(CurInitExpr); } - S.MarkFunctionReferenced(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). diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 6fa4137970..c2e0d6f809 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -9916,7 +9916,6 @@ static ExprResult FinishOverloadedCallExpr(Sema &SemaRef, Scope *S, Expr *Fn, switch (OverloadResult) { case OR_Success: { FunctionDecl *FDecl = (*Best)->Function; - SemaRef.MarkFunctionReferenced(Fn->getExprLoc(), FDecl); SemaRef.CheckUnresolvedLookupAccess(ULE, (*Best)->FoundDecl); SemaRef.DiagnoseUseOfDecl(FDecl, ULE->getNameLoc()); Fn = SemaRef.FixOverloadedFunctionReference(Fn, (*Best)->FoundDecl, FDecl); @@ -10799,7 +10798,6 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE, Best)) { case OR_Success: Method = cast<CXXMethodDecl>(Best->Function); - MarkFunctionReferenced(UnresExpr->getMemberLoc(), Method); FoundDecl = Best->FoundDecl; CheckUnresolvedMemberAccess(UnresExpr, Best->FoundDecl); DiagnoseUseOfDecl(Best->FoundDecl, UnresExpr->getNameLoc()); |