[PATCH] D106030: [Clang] add support for error+warning fn attrs
    Nick Desaulniers via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Thu Jul 15 12:48:47 PDT 2021
    
    
  
nickdesaulniers added a comment.
In D106030#2878897 <https://reviews.llvm.org/D106030#2878897>, @arsenm wrote:
> Adding something to the IR for the sole purpose of producing a diagnostic feels really weird. I'm not sure I see why the frontend can't see this attribute and directly warn
I interpreted this differently than @efriedma or @george.burgess.iv I think.  Rephrasing the question as:
> Do we really need to keep the diagnostic itself in the IR?
The answer is no; we can keep it strictly in the frontend, and reconstitute there; we have access to the FunctionDecl which has the attribute.  So I can rework this instead of `"user-diagnostic"="oh no"` IR Fn Attr, to be just `dontcall` (in IR) then have the frontend check the FunctionDecl for the text of the user provided diagnostic.
But if the question was more so:
> Why do we need this?
Then I think @efriedma and @george.burgess.iv provided adequate reasoning. Perhaps I can reuse some of their thoughts in the commit message / patch description?
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106030/new/
https://reviews.llvm.org/D106030
    
    
More information about the cfe-commits
mailing list