aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/CXXInheritance.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard@metafoo.co.uk>2020-12-01 16:28:46 -0800
committerRichard Smith <richard@metafoo.co.uk>2020-12-01 16:35:03 -0800
commit1f40d60a3b7f310ff3f77bb8643a27d979a703cb (patch)
treebfa2fbaac6f6fbae73ef93316b1f83cf82b5d60d /clang/lib/AST/CXXInheritance.cpp
parent91843f79498dac6c2de734ac41a2ab1eb3676663 (diff)
downloadllvm-1f40d60a3b7f310ff3f77bb8643a27d979a703cb.zip
llvm-1f40d60a3b7f310ff3f77bb8643a27d979a703cb.tar.gz
llvm-1f40d60a3b7f310ff3f77bb8643a27d979a703cb.tar.bz2
Remove CXXBasePaths::found_decls and simplify and modernize its only
caller. This function did not satisfy its documented contract: it only considered the first lookup result on each base path, not all lookup results. It also performed unnecessary memory allocations. This change results in a minor change to our representation: we now include overridden methods that are found by any derived-to-base path (not involving another override) in the list of overridden methods for a function, rather than filtering out functions from bases that are both direct virtual bases and indirect virtual bases for which the indirect virtual base path contains another override for the function. (That filtering rule is part of the class-scope name lookup rules, and doesn't really have much to do with enumerating overridden methods.) The users of the list of overridden methods do not appear to rely on this filtering having happened, and it's simpler to not do it.
Diffstat (limited to 'clang/lib/AST/CXXInheritance.cpp')
-rw-r--r--clang/lib/AST/CXXInheritance.cpp23
1 files changed, 0 insertions, 23 deletions
diff --git a/clang/lib/AST/CXXInheritance.cpp b/clang/lib/AST/CXXInheritance.cpp
index 816b5d1..c87bcf31 100644
--- a/clang/lib/AST/CXXInheritance.cpp
+++ b/clang/lib/AST/CXXInheritance.cpp
@@ -33,29 +33,6 @@
using namespace clang;
-/// Computes the set of declarations referenced by these base
-/// paths.
-void CXXBasePaths::ComputeDeclsFound() {
- assert(NumDeclsFound == 0 && !DeclsFound &&
- "Already computed the set of declarations");
-
- llvm::SmallSetVector<NamedDecl *, 8> Decls;
- for (paths_iterator Path = begin(), PathEnd = end(); Path != PathEnd; ++Path)
- Decls.insert(Path->Decls.front());
-
- NumDeclsFound = Decls.size();
- DeclsFound = std::make_unique<NamedDecl *[]>(NumDeclsFound);
- std::copy(Decls.begin(), Decls.end(), DeclsFound.get());
-}
-
-CXXBasePaths::decl_range CXXBasePaths::found_decls() {
- if (NumDeclsFound == 0)
- ComputeDeclsFound();
-
- return decl_range(decl_iterator(DeclsFound.get()),
- decl_iterator(DeclsFound.get() + NumDeclsFound));
-}
-
/// isAmbiguous - Determines whether the set of paths provided is
/// ambiguous, i.e., there are two or more paths that refer to
/// different base class subobjects of the same type. BaseType must be