diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-10-06 17:59:45 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-10-06 17:59:45 +0000 |
commit | a8f32e0965ee19ecc53cd796e34268377a20357c (patch) | |
tree | 5fcfab02b127c4a6f93721a0260612245f443f0c /lib/Sema/SemaCXXCast.cpp | |
parent | b299d3516d4722ef527b1070bb87133427e621a3 (diff) |
Refactor the code that walks a C++ inheritance hierarchy, searching
for bases, members, overridden virtual methods, etc. The operations
isDerivedFrom and lookupInBases are now provided by CXXRecordDecl,
rather than by Sema, so that CodeGen and other clients can use them
directly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83396 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCXXCast.cpp')
-rw-r--r-- | lib/Sema/SemaCXXCast.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp index 9822a44b0f..69d1f92a08 100644 --- a/lib/Sema/SemaCXXCast.cpp +++ b/lib/Sema/SemaCXXCast.cpp @@ -12,9 +12,9 @@ //===----------------------------------------------------------------------===// #include "Sema.h" -#include "SemaInherit.h" #include "clang/AST/ExprCXX.h" #include "clang/AST/ASTContext.h" +#include "clang/AST/CXXInheritance.h" #include "clang/Basic/PartialDiagnostic.h" #include "llvm/ADT/SmallVector.h" #include <set> @@ -610,8 +610,8 @@ TryStaticDowncast(Sema &Self, QualType SrcType, QualType DestType, return TC_NotApplicable; } - BasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/!CStyle, - /*DetectVirtual=*/true); + CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/!CStyle, + /*DetectVirtual=*/true); if (!Self.IsDerivedFrom(DestType, SrcType, Paths)) { return TC_NotApplicable; } @@ -652,13 +652,14 @@ TryStaticDowncast(Sema &Self, QualType SrcType, QualType DestType, } std::string PathDisplayStr; std::set<unsigned> DisplayedPaths; - for (BasePaths::paths_iterator PI = Paths.begin(), PE = Paths.end(); + for (CXXBasePaths::paths_iterator PI = Paths.begin(), PE = Paths.end(); PI != PE; ++PI) { if (DisplayedPaths.insert(PI->back().SubobjectNumber).second) { // We haven't displayed a path to this particular base // class subobject yet. PathDisplayStr += "\n "; - for (BasePath::const_reverse_iterator EI = PI->rbegin(),EE = PI->rend(); + for (CXXBasePath::const_reverse_iterator EI = PI->rbegin(), + EE = PI->rend(); EI != EE; ++EI) PathDisplayStr += EI->Base->getType().getAsString() + " -> "; PathDisplayStr += DestType.getAsString(); @@ -720,7 +721,7 @@ TryStaticMemberPointerUpcast(Sema &Self, QualType SrcType, QualType DestType, // B base of D QualType SrcClass(SrcMemPtr->getClass(), 0); QualType DestClass(DestMemPtr->getClass(), 0); - BasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/!CStyle, + CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/!CStyle, /*DetectVirtual=*/true); if (!Self.IsDerivedFrom(SrcClass, DestClass, Paths)) { return TC_NotApplicable; |