summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclCXX.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2019-05-13 07:42:10 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2019-05-13 07:42:10 +0000
commit5c5be6b2f7fc00255d6169277354d040c74b3e4b (patch)
tree1bd5e93fa744a9eca5899a569fa680e2e6a65cdb /clang/lib/AST/DeclCXX.cpp
parentf3be557159c2eed6eeca008547cf5359960d62d0 (diff)
downloadbcm5719-llvm-5c5be6b2f7fc00255d6169277354d040c74b3e4b.tar.gz
bcm5719-llvm-5c5be6b2f7fc00255d6169277354d040c74b3e4b.zip
[c++20] P1064R0: Allow virtual function calls in constant expression
evaluation. llvm-svn: 360559
Diffstat (limited to 'clang/lib/AST/DeclCXX.cpp')
-rw-r--r--clang/lib/AST/DeclCXX.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index b9ecdc65720..f9f70ecb590 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -1946,8 +1946,8 @@ static bool recursivelyOverrides(const CXXMethodDecl *DerivedMD,
}
CXXMethodDecl *
-CXXMethodDecl::getCorrespondingMethodInClass(const CXXRecordDecl *RD,
- bool MayBeBase) {
+CXXMethodDecl::getCorrespondingMethodDeclaredInClass(const CXXRecordDecl *RD,
+ bool MayBeBase) {
if (this->getParent()->getCanonicalDecl() == RD->getCanonicalDecl())
return this;
@@ -1973,6 +1973,15 @@ CXXMethodDecl::getCorrespondingMethodInClass(const CXXRecordDecl *RD,
return MD;
}
+ return nullptr;
+}
+
+CXXMethodDecl *
+CXXMethodDecl::getCorrespondingMethodInClass(const CXXRecordDecl *RD,
+ bool MayBeBase) {
+ if (auto *MD = getCorrespondingMethodDeclaredInClass(RD, MayBeBase))
+ return MD;
+
for (const auto &I : RD->bases()) {
const RecordType *RT = I.getType()->getAs<RecordType>();
if (!RT)
OpenPOWER on IntegriCloud