[PATCH] D131651: [AST] [Modules] Introduce Decl::getNonTransparentDeclContext to handle exported friends
Erich Keane via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 11 06:24:48 PDT 2022
erichkeane accepted this revision.
erichkeane added a comment.
This revision is now accepted and ready to land.
LGTM, thanks!
================
Comment at: clang/lib/AST/DeclBase.cpp:1037
+ assert(getDeclContext());
+ return getDeclContext()->getNonTransparentContext();
+}
----------------
erichkeane wrote:
> so why are we calling this on our `DeclContext` here, which is the 'parent' of the current `Decl`? Shouldn't this be casting itself to `DeclContext` and calling this function on it, so we don't end up 'skipping' the first parent?
Ah, I see... `getNonTransparentContext` works differently from the other `getDeclContext` type functions in that it does NOT get the 1st parent, it will return the 'current' `DeclContext` if necessary. So casting it would be incorrect here. Strange that this works opposite of the rest, but looks like you're right :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131651/new/
https://reviews.llvm.org/D131651
More information about the cfe-commits
mailing list