aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-24 22:46:58 +0000
committerChris Lattner <sabre@nondot.org>2009-02-24 22:46:58 +0000
commit95e8d658fbea5b53c5e77c48f883fe6c9f7f620f (patch)
treecb2164280952f59c74a592f3d8d8073e43a02ba0 /lib/Sema/SemaInit.cpp
parentf71ae8d8024561f92dd7916363e7a791684563cc (diff)
Make CheckSingleInitializer a static function in SemaInit.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65397 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaInit.cpp')
-rw-r--r--lib/Sema/SemaInit.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 8f3a210efc..cb2fdd2736 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -35,25 +35,25 @@ static StringLiteral *IsStringInit(Expr *Init, QualType DeclType,
return 0;
}
-bool Sema::CheckSingleInitializer(Expr *&Init, QualType DeclType,
- bool DirectInit) {
+static bool CheckSingleInitializer(Expr *&Init, QualType DeclType,
+ bool DirectInit, Sema &S) {
// Get the type before calling CheckSingleAssignmentConstraints(), since
// it can promote the expression.
QualType InitType = Init->getType();
- if (getLangOptions().CPlusPlus) {
+ if (S.getLangOptions().CPlusPlus) {
// FIXME: I dislike this error message. A lot.
- if (PerformImplicitConversion(Init, DeclType, "initializing", DirectInit))
- return Diag(Init->getSourceRange().getBegin(),
- diag::err_typecheck_convert_incompatible)
- << DeclType << Init->getType() << "initializing"
- << Init->getSourceRange();
-
+ if (S.PerformImplicitConversion(Init, DeclType, "initializing", DirectInit))
+ return S.Diag(Init->getSourceRange().getBegin(),
+ diag::err_typecheck_convert_incompatible)
+ << DeclType << Init->getType() << "initializing"
+ << Init->getSourceRange();
return false;
}
- AssignConvertType ConvTy = CheckSingleAssignmentConstraints(DeclType, Init);
- return DiagnoseAssignmentResult(ConvTy, Init->getLocStart(), DeclType,
+ Sema::AssignConvertType ConvTy =
+ S.CheckSingleAssignmentConstraints(DeclType, Init);
+ return S.DiagnoseAssignmentResult(ConvTy, Init->getLocStart(), DeclType,
InitType, Init, "initializing");
}
@@ -163,7 +163,7 @@ bool Sema::CheckInitializerTypes(Expr *&Init, QualType &DeclType,
return Diag(Init->getLocStart(), diag::err_array_init_list_required)
<< Init->getSourceRange();
- return CheckSingleInitializer(Init, DeclType, DirectInit);
+ return CheckSingleInitializer(Init, DeclType, DirectInit, *this);
}
bool hadError = CheckInitList(InitList, DeclType);
@@ -676,7 +676,7 @@ void InitListChecker::CheckScalarType(InitListExpr *IList, QualType DeclType,
}
Expr *savExpr = expr; // Might be promoted by CheckSingleInitializer.
- if (SemaRef->CheckSingleInitializer(expr, DeclType, false))
+ if (CheckSingleInitializer(expr, DeclType, false, *SemaRef))
hadError = true; // types weren't compatible.
else if (savExpr != expr) {
// The type was promoted, update initializer list.