[PATCH] D61643: [PragmaHandler][NFC] Expose `#pragma` location
Joel E. Denny via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 7 09:41:36 PDT 2019
jdenny created this revision.
jdenny added reviewers: ABataev, lebedev.ri.
Herald added a subscriber: jdoerfert.
Herald added a project: clang.
Currently, a pragma AST node's recorded location starts at the
namespace token (such as `omp` in the case of OpenMP) after the
`#pragma` token, and the `#pragma` location isn't available. However,
the `#pragma` location can be useful when, for example, rewriting a
directive using Clang's Rewrite facility.
This patch makes `#pragma` locations available in any `PragmaHandler`
but it doesn't yet make use of them.
This patch also uses the new `struct PragmaIntroducer` to simplify
`Preprocessor::HandlePragmaDirective`. It doesn't do the same for
`PPCallbacks::PragmaDirective` because that changes the API documented
in `clang-tools-extra/docs/pp-trace.rst`, and I'm not sure about
backward compatibility guarantees there.
This patch was forked from D61509 <https://reviews.llvm.org/D61509>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D61643
Files:
clang/docs/ClangPlugins.rst
clang/examples/AnnotateFunctions/AnnotateFunctions.cpp
clang/include/clang/Lex/Pragma.h
clang/include/clang/Lex/Preprocessor.h
clang/lib/Frontend/PrintPreprocessedOutput.cpp
clang/lib/Lex/PPDirectives.cpp
clang/lib/Lex/Pragma.cpp
clang/lib/Parse/ParsePragma.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61643.198489.patch
Type: text/x-patch
Size: 37359 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190507/3e8b733c/attachment-0001.bin>
More information about the cfe-commits
mailing list