[PragmaHandler] Expose `#pragma` location
authorJoel E. Denny <jdenny.ornl@gmail.com>
Tue, 21 May 2019 23:51:38 +0000 (23:51 +0000)
committerJoel E. Denny <jdenny.ornl@gmail.com>
Tue, 21 May 2019 23:51:38 +0000 (23:51 +0000)
commit6333880aae00e07c175e5672d8dfe468a5032f75
tree18a61169f0c3928c29fda247f1b94385b609a27f
parentf71dcea071a1be41e27d816b89425ba5bd6c7c59
[PragmaHandler] Expose `#pragma` location

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.

Reviewed By: ABataev, lebedev.ri, aaron.ballman

Differential Revision: https://reviews.llvm.org/D61643

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@361335 91177308-0d34-0410-b5e6-96231b3b80d8
docs/ClangPlugins.rst
examples/AnnotateFunctions/AnnotateFunctions.cpp
include/clang/Lex/Pragma.h
include/clang/Lex/Preprocessor.h
lib/Frontend/PrintPreprocessedOutput.cpp
lib/Lex/PPDirectives.cpp
lib/Lex/Pragma.cpp
lib/Parse/ParsePragma.cpp