aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2011-09-24 17:48:00 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2011-09-24 17:48:00 +0000
commit14b0c194b356a1204d081765b3e6699687bed97c (patch)
tree8bd766140d426e0fa68e81a88f130bc646b7aaa6 /lib/Sema/SemaExpr.cpp
parent8713d4e874f2adc2928ebfb86c845574a14e3b3e (diff)
Give InitListChecker a verification-only mode, where it neither emits diagnostics nor
builds a semantic (structured) initializer list, just reports on whether it can match the given list to the target type. Use this mode for doing init list checking in the initial step of initialization, which will eventually allow us to do overload resolution based on the outcome. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140457 91177308-0d34-0410-b5e6-96231b3b80d8
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.