================
@@ -1211,15 +1211,30 @@ void FactsGenerator::handleUse(const Expr *E) {
 // class and its bases. It represents the storage the field refers to, as
 // opposed to the field itself (covered by $this).
 void FactsGenerator::issueFieldPlaceholderLoans(
-    const CXXMethodDecl *MD, llvm::SmallVectorImpl<Fact *> &Facts) {
-  const CXXRecordDecl *ClassDecl = MD->getParent()->getDefinition();
-  if (!ClassDecl)
-    return;
+    const CXXRecordDecl *ClassDef, llvm::SmallVectorImpl<Fact *> &Facts) {
+  assert(ClassDef);
----------------
steakhal wrote:

This `assert` documents the precondition.
I could nest the check inside here - but I figured it's a reasonable assumption 
- hence I hoisted it to the callsite.
I have considered having a dispatching overload that would go from a MethodDecl 
to ClassDecl, but decided against to keep the public interface narrow.

https://github.com/llvm/llvm-project/pull/232867
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to