[PATCH] D34301: [Sema] Make sure the definition of a referenced virtual function is emitted when it is final
Vedant Kumar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 12 11:38:29 PDT 2017
vsk added a comment.
I suggest changing the API for 'canDevirtualizeCall' a bit but this is looking great overall. The code movement and test case changes look good.
================
Comment at: include/clang/AST/DeclCXX.h:1902
+ bool canDevirtualizeCall(const Expr *Base, bool IsAppleKext,
+ CXXMethodDecl *&DM);
+
----------------
Something like `CXXMethodDecl *getDevirtualizedMethod(...)` would fit in better with the current API. E.g, getCorrespondingMethodInClass is done this way (and returns nullptr when a method is not found).
================
Comment at: lib/AST/DeclCXX.cpp:1693
+ const CXXMethodDecl *DM;
+ return ::canDevirtualizeCall(Base, this, IsAppleKext, DM);
+}
----------------
Instead of templating canDevirtualizeCall, you could do something like `const_cast<CXXMethodDecl *>(this)->getDevirtualizedMethod(...)`.
https://reviews.llvm.org/D34301
More information about the cfe-commits
mailing list