[PATCH] D130308: [clang] extend getCommonSugaredType to merge sugar nodes

Matheus Izvekov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 7 17:31:32 PDT 2022


mizvekov marked 4 inline comments as done.
mizvekov added inline comments.


================
Comment at: clang/lib/AST/ASTContext.cpp:12141
 static Decl *getCommonDecl(Decl *X, Decl *Y) {
-  if (X == Y)
-    return X;
-  assert(declaresSameEntity(X, Y));
+  if (!declaresSameEntity(X, Y))
+    return nullptr;
----------------
erichkeane wrote:
> same concerns about null here.  I find myself wondering if this 'getCommonX' should take/return references when possible.
Null is a valid input on this one. We change this function to now accept unrelated decls, and return null in that case as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130308/new/

https://reviews.llvm.org/D130308



More information about the cfe-commits mailing list