clang-tools  7.0.0
PragmaCommentHandler.h
Go to the documentation of this file.
1 //===-- PragmaCommentHandler.h - find all symbols----------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_CLANG_TOOLS_EXTRA_FIND_ALL_SYMBOLS_PRAGMA_COMMENT_HANDLER_H
11 #define LLVM_CLANG_TOOLS_EXTRA_FIND_ALL_SYMBOLS_PRAGMA_COMMENT_HANDLER_H
12 
13 #include "clang/Basic/SourceLocation.h"
14 #include "clang/Lex/Preprocessor.h"
15 #include <map>
16 
17 namespace clang {
18 namespace find_all_symbols {
19 
20 class HeaderMapCollector;
21 
22 /// \brief PragmaCommentHandler parses pragma comment on include files to
23 /// determine when we should include a different header from the header that
24 /// directly defines a symbol.
25 ///
26 /// Currently it only supports IWYU private pragma:
27 /// https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUPragmas.md#iwyu-pragma-private
28 class PragmaCommentHandler : public clang::CommentHandler {
29 public:
30  PragmaCommentHandler(HeaderMapCollector *Collector) : Collector(Collector) {}
31 
32  bool HandleComment(Preprocessor &PP, SourceRange Range) override;
33 
34 private:
35  HeaderMapCollector *const Collector;
36 };
37 
38 } // namespace find_all_symbols
39 } // namespace clang
40 
41 #endif // LLVM_CLANG_TOOLS_EXTRA_FIND_ALL_SYMBOLS_PRAGMA_COMMENT_HANDLER_H
HeaderMappCollector collects all remapping header files.
PragmaCommentHandler(HeaderMapCollector *Collector)
bool HandleComment(Preprocessor &PP, SourceRange Range) override
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
CharSourceRange Range
SourceRange for the file name.
PragmaCommentHandler parses pragma comment on include files to determine when we should include a dif...