diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2011-09-24 17:48:00 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2011-09-24 17:48:00 +0000 |
commit | 14b0c194b356a1204d081765b3e6699687bed97c (patch) | |
tree | 8bd766140d426e0fa68e81a88f130bc646b7aaa6 /include/clang/Sema | |
parent | 8713d4e874f2adc2928ebfb86c845574a14e3b3e (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 'include/clang/Sema')
-rw-r--r-- | include/clang/Sema/Initialization.h | 2 | ||||
-rw-r--r-- | include/clang/Sema/Overload.h | 1 | ||||
-rw-r--r-- | include/clang/Sema/Sema.h | 16 |
3 files changed, 12 insertions, 7 deletions
diff --git a/include/clang/Sema/Initialization.h b/include/clang/Sema/Initialization.h index 958183c3ef..ef592d2ab9 100644 --- a/include/clang/Sema/Initialization.h +++ b/include/clang/Sema/Initialization.h @@ -810,7 +810,7 @@ public: void AddConversionSequenceStep(const ImplicitConversionSequence &ICS, QualType T); - /// \brief Add a list-initialiation step + /// \brief Add a list-initialiation step. void AddListInitializationStep(QualType T); /// \brief Add a constructor-initialization step. diff --git a/include/clang/Sema/Overload.h b/include/clang/Sema/Overload.h index 214f8c0eb2..e4f923703b 100644 --- a/include/clang/Sema/Overload.h +++ b/include/clang/Sema/Overload.h @@ -464,6 +464,7 @@ namespace clang { bool isEllipsis() const { return getKind() == EllipsisConversion; } bool isAmbiguous() const { return getKind() == AmbiguousConversion; } bool isUserDefined() const { return getKind() == UserDefinedConversion; } + bool isFailure() const { return isBad() || isAmbiguous(); } /// Determines whether this conversion sequence has been /// initialized. Most operations should never need to query diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index a1887c2245..a7a0c2f7ae 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -1383,7 +1383,7 @@ public: QualType ResultType, Expr *Value, bool AllowNRVO = true); - + bool CanPerformCopyInitialization(const InitializedEntity &Entity, ExprResult Init); ExprResult PerformCopyInitialization(const InitializedEntity &Entity, @@ -2217,8 +2217,9 @@ public: //===--------------------------------------------------------------------===// // Expression Parsing Callbacks: SemaExpr.cpp. - bool DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc, - const ObjCInterfaceDecl *UnknownObjCClass=0); + bool CanUseDecl(NamedDecl *D); + bool DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc, + const ObjCInterfaceDecl *UnknownObjCClass = 0); std::string getDeletedOrUnavailableSuffix(const FunctionDecl *FD); bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD, ObjCMethodDecl *Getter, @@ -5580,7 +5581,8 @@ public: // CheckAssignmentOperands, and ActOnReturnStmt. Prior to type checking, // this routine performs the default function/array converions. AssignConvertType CheckSingleAssignmentConstraints(QualType LHSType, - ExprResult &RHS); + ExprResult &RHS, + bool Diagnose = true); // \brief If the lhs type is a transparent union, check whether we // can initialize the transparent union with the given expression. @@ -5593,11 +5595,13 @@ public: ExprResult PerformImplicitConversion(Expr *From, QualType ToType, AssignmentAction Action, - bool AllowExplicit = false); + bool AllowExplicit = false, + bool Diagnose = true); ExprResult PerformImplicitConversion(Expr *From, QualType ToType, AssignmentAction Action, bool AllowExplicit, - ImplicitConversionSequence& ICS); + ImplicitConversionSequence& ICS, + bool Diagnose = true); ExprResult PerformImplicitConversion(Expr *From, QualType ToType, const ImplicitConversionSequence& ICS, AssignmentAction Action, |