Downgrade complaints about calling unavailable functions to a warning
(as GCC does), except when we've performed overload resolution and
found an unavailable function: in this case, we actually error.
Merge the checking of unavailable functions with the checking for
deprecated functions. This unifies a bit of code, and makes sure that
we're checking for unavailable functions in the right places. Also,
this check can cause an error. We may, eventually, want an option to
make "unavailable" warnings into errors.
Implement much of the logic needed for C++0x deleted functions, which
are effectively the same as "unavailable" functions (but always cause
an error when referenced). However, we don't have the syntax to
specify deleted functions yet :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64955 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 4358051..39d049b 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -438,7 +438,8 @@
enum OverloadingResult {
OR_Success, ///< Overload resolution succeeded.
OR_No_Viable_Function, ///< No viable function found.
- OR_Ambiguous ///< Ambiguous candidates found.
+ OR_Ambiguous, ///< Ambiguous candidates found.
+ OR_Deleted ///< Overload resoltuion refers to a deleted function.
};
void AddOverloadCandidate(FunctionDecl *Function,
@@ -1022,15 +1023,8 @@
//===--------------------------------------------------------------------===//
// Expression Parsing Callbacks: SemaExpr.cpp.
- /// DiagnoseUseOfDeprecatedDecl - If the specified decl is deprecated or
- // unavailable, emit the corresponding diagnostics.
- inline void DiagnoseUseOfDeprecatedDecl(NamedDecl *D, SourceLocation Loc) {
- if (D->hasAttrs())
- DiagnoseUseOfDeprecatedDeclImpl(D, Loc);
- }
- void DiagnoseUseOfDeprecatedDeclImpl(NamedDecl *D, SourceLocation Loc);
+ bool DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc);
-
// Primary Expressions.
virtual OwningExprResult ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
IdentifierInfo &II,