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

Joel E. Denny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 7 10:42:03 PDT 2019


jdenny marked an inline comment as done.
jdenny 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) {
----------------
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?


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