143356f56SNico Weber //===-- PragmaCommentHandler.h - find all symbols----------------*- C++ -*-===// 243356f56SNico Weber // 343356f56SNico Weber // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 443356f56SNico Weber // See https://llvm.org/LICENSE.txt for license information. 543356f56SNico Weber // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 643356f56SNico Weber // 743356f56SNico Weber //===----------------------------------------------------------------------===// 843356f56SNico Weber 943356f56SNico Weber #ifndef LLVM_CLANG_TOOLS_EXTRA_FIND_ALL_SYMBOLS_PRAGMA_COMMENT_HANDLER_H 1043356f56SNico Weber #define LLVM_CLANG_TOOLS_EXTRA_FIND_ALL_SYMBOLS_PRAGMA_COMMENT_HANDLER_H 1143356f56SNico Weber 1243356f56SNico Weber #include "clang/Basic/SourceLocation.h" 1343356f56SNico Weber #include "clang/Lex/Preprocessor.h" 1443356f56SNico Weber #include <map> 1543356f56SNico Weber 1643356f56SNico Weber namespace clang { 1743356f56SNico Weber namespace find_all_symbols { 1843356f56SNico Weber 1943356f56SNico Weber class HeaderMapCollector; 2043356f56SNico Weber 21*282dc72cSDmitri Gribenko /// PragmaCommentHandler parses pragma comment on include files to 2243356f56SNico Weber /// determine when we should include a different header from the header that 2343356f56SNico Weber /// directly defines a symbol. 2443356f56SNico Weber /// 2543356f56SNico Weber /// Currently it only supports IWYU private pragma: 2643356f56SNico Weber /// https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUPragmas.md#iwyu-pragma-private 2743356f56SNico Weber class PragmaCommentHandler : public clang::CommentHandler { 2843356f56SNico Weber public: PragmaCommentHandler(HeaderMapCollector * Collector)2943356f56SNico Weber PragmaCommentHandler(HeaderMapCollector *Collector) : Collector(Collector) {} 3043356f56SNico Weber 3143356f56SNico Weber bool HandleComment(Preprocessor &PP, SourceRange Range) override; 3243356f56SNico Weber 3343356f56SNico Weber private: 3443356f56SNico Weber HeaderMapCollector *const Collector; 3543356f56SNico Weber }; 3643356f56SNico Weber 3743356f56SNico Weber } // namespace find_all_symbols 3843356f56SNico Weber } // namespace clang 3943356f56SNico Weber 4043356f56SNico Weber #endif // LLVM_CLANG_TOOLS_EXTRA_FIND_ALL_SYMBOLS_PRAGMA_COMMENT_HANDLER_H 41