clang-tools  14.0.0git
PragmaCommentHandler.h
Go to the documentation of this file.
1 //===-- PragmaCommentHandler.h - find all symbols----------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_FIND_ALL_SYMBOLS_PRAGMA_COMMENT_HANDLER_H
10 #define LLVM_CLANG_TOOLS_EXTRA_FIND_ALL_SYMBOLS_PRAGMA_COMMENT_HANDLER_H
11 
12 #include "clang/Basic/SourceLocation.h"
13 #include "clang/Lex/Preprocessor.h"
14 #include <map>
15 
16 namespace clang {
17 namespace find_all_symbols {
18 
19 class HeaderMapCollector;
20 
21 /// PragmaCommentHandler parses pragma comment on include files to
22 /// determine when we should include a different header from the header that
23 /// directly defines a symbol.
24 ///
25 /// Currently it only supports IWYU private pragma:
26 /// https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUPragmas.md#iwyu-pragma-private
27 class PragmaCommentHandler : public clang::CommentHandler {
28 public:
29  PragmaCommentHandler(HeaderMapCollector *Collector) : Collector(Collector) {}
30 
31  bool HandleComment(Preprocessor &PP, SourceRange Range) override;
32 
33 private:
34  HeaderMapCollector *const Collector;
35 };
36 
37 } // namespace find_all_symbols
38 } // namespace clang
39 
40 #endif // LLVM_CLANG_TOOLS_EXTRA_FIND_ALL_SYMBOLS_PRAGMA_COMMENT_HANDLER_H
Range
CharSourceRange Range
SourceRange for the file name.
Definition: IncludeOrderCheck.cpp:38
clang::find_all_symbols::PragmaCommentHandler::PragmaCommentHandler
PragmaCommentHandler(HeaderMapCollector *Collector)
Definition: PragmaCommentHandler.h:29
clang::find_all_symbols::HeaderMapCollector
HeaderMappCollector collects all remapping header files.
Definition: HeaderMapCollector.h:22
clang::tidy::bugprone::PP
static Preprocessor * PP
Definition: BadSignalToKillThreadCheck.cpp:29
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
clang::find_all_symbols::PragmaCommentHandler
PragmaCommentHandler parses pragma comment on include files to determine when we should include a dif...
Definition: PragmaCommentHandler.h:27
clang::find_all_symbols::PragmaCommentHandler::HandleComment
bool HandleComment(Preprocessor &PP, SourceRange Range) override
Definition: PragmaCommentHandler.cpp:21