On Wed, Feb 28, 2018 at 8:21 PM, Richard Smith - zygoloid via
Phabricator via cfe-commits <cfe-commits@lists.llvm.org> wrote:
> ================
> Comment at: lib/Sema/SemaDecl.cpp:11986
> +      !FD->isDefined(Definition)
> +      && FD->getDeclContext()->isFileContext()) {
> +    // If this is a friend function defined in a class template, it does not
> ----------------
> `&&` on the end of the previous line, please.
>
> If the intent here is to detect non-member functions, using 
> `!FD->isCXXClassMember()` or `!isa<CXXMethodDecl>(FD)` would be clearer.

I just recently did something like this and finally settled on
`FD->getKind() == Decl::Function`. `FunctionDecl` now has two derived
types, `CXXMethodDecl` and `CXXDeductionGuideDecl`, so the negation on
`CXXMethodDecl` is no longer strictly enough.

I think it would be nice if `FunctionDecl` had an
`isNonMemberFunction()` (or whatever the formal term is) that did the
above-mentioned check for kind equality.

For what it's worth,
- Kim
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to