[cfe-dev] Marking declarations as invalid

Nathan Wilson via cfe-dev cfe-dev at lists.llvm.org
Thu Nov 5 14:30:02 PST 2015


I'm not trying to accomplish anything at the moment per se. Just make sure
I don't run into trouble, and where I would run into trouble by incorrectly
marking a FunctionDecl (or something else) as invalid.

For example, I have a check which may emit a diagnostic (SemaDecl.cpp
current lines 7595:7600):
if (isConstexpr) {
  Diag(D.getDeclSpec().getConstexprSpecLoc(),
       diag::err_concept_decl_invalid_specifiers)
      << 1 << 3;
  NewFD->setInvalidDecl(true);
}

Now, is it (un)necessary to mark the FunctionDecl as invalid here?

Below that check, at line 7865, we check to see if the declaration is
invalid which might get me into trouble when looking at a function template
specialization.





On Thu, Nov 5, 2015 at 4:01 PM, Ben Craig via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> I’ll turn the question around.
>
> What are you trying to accomplish?  Do you see a case where you would like
> to mark a declaration as invalid, but don’t know the right way?  Or do you
> want to do something extra in the cases that a declaration has been found
> as invalid?  The context may spur the right kind of conversation.
>
>
>
> Employee of Qualcomm Innovation Center, Inc.
>
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux
> Foundation Collaborative Project
>
>
>
> *From:* cfe-dev [mailto:cfe-dev-bounces at lists.llvm.org] *On Behalf Of *Nathan
> Wilson via cfe-dev
> *Sent:* Thursday, November 05, 2015 3:55 PM
> *To:* cfe-dev at lists.llvm.org
> *Subject:* Re: [cfe-dev] Marking declarations as invalid
>
>
>
> Hello,
>
>
>
> I wanted to follow up to see if anyone had any thoughts about this. I'd
> appreciate it.
>
>
>
> Thanks!
>
>
>
> On Thu, Oct 29, 2015 at 10:04 PM, Nathan Wilson <nwilson20 at gmail.com>
> wrote:
>
> Hi,
>
> Would someone mind explaining when (or when not) to mark a declaration,
> i.e. FunctionDecl or VarDecl, an invalid declaration?
>
> Then, if the declaration is marked invalid, at what do we look at/use that
> information?
>
>
>
> Thanks,
>
> Nate
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151105/31a027c1/attachment.html>


More information about the cfe-dev mailing list