summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-04-24 17:11:09 +0000
committerAnders Carlsson <andersca@mac.com>2010-04-24 17:11:09 +0000
commit7afe4245e27d0b44c7984d853c6d50f36e42ba04 (patch)
tree5516c69efa3b40cc475d1f7b6c9b45a4fc999026 /clang
parent0c509eeac7353a27bd5812136cc454b4e34c2ff1 (diff)
downloadbcm5719-llvm-7afe4245e27d0b44c7984d853c6d50f36e42ba04.tar.gz
bcm5719-llvm-7afe4245e27d0b44c7984d853c6d50f36e42ba04.zip
Pass the base specifiers through to CheckDerivedToBaseConversion. No functionality change yet.
llvm-svn: 102250
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/Sema.h4
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp29
-rw-r--r--clang/lib/Sema/SemaExpr.cpp2
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp2
-rw-r--r--clang/lib/Sema/SemaInit.cpp2
-rw-r--r--clang/lib/Sema/SemaOverload.cpp2
6 files changed, 26 insertions, 15 deletions
diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h
index 48b12b5712f..16c7e6c1e37 100644
--- a/clang/lib/Sema/Sema.h
+++ b/clang/lib/Sema/Sema.h
@@ -2596,12 +2596,14 @@ public:
bool CheckDerivedToBaseConversion(QualType Derived, QualType Base,
SourceLocation Loc, SourceRange Range,
+ CXXBaseSpecifierArray *BasePath = 0,
bool IgnoreAccess = false);
bool CheckDerivedToBaseConversion(QualType Derived, QualType Base,
unsigned InaccessibleBaseID,
unsigned AmbigiousBaseConvID,
SourceLocation Loc, SourceRange Range,
- DeclarationName Name);
+ DeclarationName Name,
+ CXXBaseSpecifierArray *BasePath);
std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths);
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index f1b1244b9e3..243d854a941 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -723,7 +723,8 @@ Sema::CheckDerivedToBaseConversion(QualType Derived, QualType Base,
unsigned InaccessibleBaseID,
unsigned AmbigiousBaseConvID,
SourceLocation Loc, SourceRange Range,
- DeclarationName Name) {
+ DeclarationName Name,
+ CXXBaseSpecifierArray *BasePath) {
// First, determine whether the path from Derived to Base is
// ambiguous. This is slightly more expensive than checking whether
// the Derived to Base conversion exists, because here we need to
@@ -742,10 +743,16 @@ Sema::CheckDerivedToBaseConversion(QualType Derived, QualType Base,
// Check that the base class can be accessed.
switch (CheckBaseClassAccess(Loc, Base, Derived, Paths.front(),
InaccessibleBaseID)) {
- case AR_accessible: return false;
- case AR_inaccessible: return true;
- case AR_dependent: return false;
- case AR_delayed: return false;
+ case AR_inaccessible:
+ return true;
+ case AR_accessible:
+ case AR_dependent:
+ case AR_delayed:
+ // Build a base path if necessary.
+ if (BasePath) {
+ // FIXME: Do this!
+ }
+ return false;
}
}
@@ -775,12 +782,14 @@ Sema::CheckDerivedToBaseConversion(QualType Derived, QualType Base,
bool
Sema::CheckDerivedToBaseConversion(QualType Derived, QualType Base,
SourceLocation Loc, SourceRange Range,
+ CXXBaseSpecifierArray *BasePath,
bool IgnoreAccess) {
return CheckDerivedToBaseConversion(Derived, Base,
IgnoreAccess ? 0
: diag::err_upcast_to_inaccessible_base,
diag::err_ambiguous_derived_to_base_conv,
- Loc, Range, DeclarationName());
+ Loc, Range, DeclarationName(),
+ BasePath);
}
@@ -5418,10 +5427,10 @@ bool Sema::CheckOverridingFunctionReturnType(const CXXMethodDecl *New,
// Check if we the conversion from derived to base is valid.
if (CheckDerivedToBaseConversion(NewClassTy, OldClassTy,
- diag::err_covariant_return_inaccessible_base,
- diag::err_covariant_return_ambiguous_derived_to_base_conv,
- // FIXME: Should this point to the return type?
- New->getLocation(), SourceRange(), New->getDeclName())) {
+ diag::err_covariant_return_inaccessible_base,
+ diag::err_covariant_return_ambiguous_derived_to_base_conv,
+ // FIXME: Should this point to the return type?
+ New->getLocation(), SourceRange(), New->getDeclName(), 0)) {
Diag(Old->getLocation(), diag::note_overridden_virtual_function);
return true;
}
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 02c41da30b2..683cd39012b 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1492,7 +1492,7 @@ Sema::PerformObjectMemberConversion(Expr *&From,
if (CheckDerivedToBaseConversion(FromRecordType,
DestRecordType,
FromLoc,
- FromRange,
+ FromRange, 0,
IgnoreAccess))
return true;
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 71d89147614..e3ffb24d755 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -1770,7 +1770,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
if (CheckDerivedToBaseConversion(From->getType(),
ToType.getNonReferenceType(),
From->getLocStart(),
- From->getSourceRange(),
+ From->getSourceRange(), 0,
IgnoreBaseAccess))
return true;
ImpCastExprToType(From, ToType.getNonReferenceType(),
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 90c8e3bac6c..5887c5e7e46 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -3461,7 +3461,7 @@ InitializationSequence::Perform(Sema &S,
bool IgnoreBaseAccess = Kind.isCStyleOrFunctionalCast();
if (S.CheckDerivedToBaseConversion(SourceType, Step->Type,
CurInitExpr->getLocStart(),
- CurInitExpr->getSourceRange(),
+ CurInitExpr->getSourceRange(), 0,
IgnoreBaseAccess))
return S.ExprError();
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 50afb7e1bca..5e5f23352ce 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -1357,7 +1357,7 @@ bool Sema::CheckPointerConversion(Expr *From, QualType ToType,
// ambiguous or inaccessible conversion.
if (CheckDerivedToBaseConversion(FromPointeeType, ToPointeeType,
From->getExprLoc(),
- From->getSourceRange(),
+ From->getSourceRange(), 0,
IgnoreBaseAccess))
return true;
OpenPOWER on IntegriCloud