[PATCH] D61643: [PragmaHandler][NFC] Expose `#pragma` location

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 14 03:00:49 PDT 2019


lebedev.ri added inline comments.


================
Comment at: clang/docs/ClangPlugins.rst:58
     ExamplePragmaHandler() : PragmaHandler("example_pragma") { }
-    void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
+    void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
                       Token &PragmaTok) {
----------------
jdenny wrote:
> lebedev.ri wrote:
> > Hmm.
> > This will have effects on out-of-tree plugins that define pragmas.
> > I'm not sure how to proceed here, just notify cfe-dev and move on?
> We could do something like this in `PragmaHandler`:
> 
> ```
>   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
>                             Token &FirstToken) {
>     llvm_unreachable("deprecated HandlePragma unexpectedly called");
>   }
>   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
>                             Token &FirstToken) {
>     HandlePragma(PP, Introducer.Kind, FirstToken);
>   }
> ```
> 
> The derived class could override either one.  Unfortunately, if it didn't override either, the error is then at run time instead of compile time as it is now.
> 
> Whether this is worth it, I don't know.  Who's the right person to answer this question?
I think mailing cfe-dev will get this question the most visibility.
Though i //think// the solution will be to go with the current patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61643





More information about the cfe-commits mailing list