//===--- CollectMacros.h -----------------------------------------*- C++-*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_COLLECTMACROS_H #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_COLLECTMACROS_H #include "Protocol.h" #include "SourceCode.h" #include "index/SymbolID.h" #include "clang/Basic/SourceLocation.h" #include "clang/Lex/PPCallbacks.h" #include "clang/Lex/Preprocessor.h" #include "llvm/ADT/DenseMap.h" #include <cstddef> #include <string> namespace clang { namespace clangd { struct MacroOccurrence { … }; struct MainFileMacros { … }; /// Collects macro references (e.g. definitions, expansions) in the main file. /// It is used to: /// - collect macros in the preamble section of the main file (in Preamble.cpp) /// - collect macros after the preamble of the main file (in ParsedAST.cpp) class CollectMainFileMacros : public PPCallbacks { … }; /// Represents a `#pragma mark` in the main file. /// /// There can be at most one pragma mark per line. struct PragmaMark { … }; /// Collect all pragma marks from the main file. std::unique_ptr<PPCallbacks> collectPragmaMarksCallback(const SourceManager &, std::vector<PragmaMark> &Out); } // namespace clangd } // namespace clang #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_COLLECTMACROS_H