aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r--lib/Sema/SemaExpr.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index c06f5a7b83..209afe330d 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -41,6 +41,20 @@
using namespace clang;
using namespace sema;
+/// \brief Determine whether the use of this declaration is valid, without
+/// emitting diagnostics.
+bool Sema::CanUseDecl(NamedDecl *D) {
+ // See if this is an auto-typed variable whose initializer we are parsing.
+ if (ParsingInitForAutoVars.count(D))
+ return false;
+
+ // See if this is a deleted function.
+ if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
+ if (FD->isDeleted())
+ return false;
+ }
+ return true;
+}
/// \brief Determine whether the use of this declaration is valid, and
/// emit any corresponding diagnostics.
@@ -51,9 +65,6 @@ using namespace sema;
/// used, or produce an error (and return true) if a C++0x deleted
/// function is being used.
///
-/// If IgnoreDeprecated is set to true, this should not warn about deprecated
-/// decls.
-///
/// \returns true if there was an error (this declaration cannot be
/// referenced), false otherwise.
///
@@ -5659,7 +5670,8 @@ Sema::CheckTransparentUnionArgumentConstraints(QualType ArgType,
}
Sema::AssignConvertType
-Sema::CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS) {
+Sema::CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS,
+ bool Diagnose) {
if (getLangOptions().CPlusPlus) {
if (!LHSType->isRecordType()) {
// C++ 5.17p3: If the left operand is not of class type, the
@@ -5667,7 +5679,7 @@ Sema::CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS) {
// cv-unqualified type of the left operand.
ExprResult Res = PerformImplicitConversion(RHS.get(),
LHSType.getUnqualifiedType(),
- AA_Assigning);
+ AA_Assigning, Diagnose);
if (Res.isInvalid())
return Incompatible;
Sema::AssignConvertType result = Compatible;
@@ -5681,7 +5693,7 @@ Sema::CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS) {
// FIXME: Currently, we fall through and treat C++ classes like C
// structures.
- }
+ }
// C99 6.5.16.1p1: the left operand is a pointer and the right is
// a null pointer constant.