38#ifndef CLANG_LIB_FORMAT_MACROS_H
39#define CLANG_LIB_FORMAT_MACROS_H
47#include "llvm/ADT/ArrayRef.h"
48#include "llvm/ADT/DenseMap.h"
49#include "llvm/ADT/SmallVector.h"
50#include "llvm/ADT/StringRef.h"
56struct UnwrappedLineNode;
105 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator,
110 bool defined(llvm::StringRef Name)
const;
117 bool hasArity(llvm::StringRef Name,
unsigned Arity)
const;
131 void parseDefinition(
const std::string &Macro);
135 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator;
138 llvm::StringMap<llvm::DenseMap<int, Definition>> FunctionLike;
139 llvm::StringMap<Definition> ObjectLike;
186 const llvm::DenseMap<
FormatToken *, std::unique_ptr<UnwrappedLine>>
202 bool finished()
const {
return ActiveExpansions.empty(); }
241 bool processNextReconstructed();
244 struct ReconstructedLine;
247 UnwrappedLine createUnwrappedLine(
const ReconstructedLine &Line,
int Level);
248 void debug(
const ReconstructedLine &Line,
int Level);
249 ReconstructedLine &parentLine();
250 ReconstructedLine *currentLine();
251 void debugParentMap()
const;
254 enum ReconstructorState {
259 ReconstructorState State = Start;
265 LineNode() =
default;
266 LineNode(FormatToken *Tok) : Tok(Tok) {}
267 FormatToken *Tok =
nullptr;
274 struct ReconstructedLine {
287 ReconstructedLine Result;
316 llvm::DenseMap<FormatToken *, FormatToken *>
317 SpelledParentToReconstructedParent;
325 std::list<UnwrappedLineNode>::iterator SpelledI;
327 std::list<UnwrappedLineNode>::iterator SpelledE;
333 struct MacroCallState {
334 MacroCallState(ReconstructedLine *Line, FormatToken *ParentLastToken,
335 FormatToken *MacroCallLParen);
337 ReconstructedLine *Line;
355 FormatToken *ParentLastToken;
358 FormatToken *MacroCallLParen;
377 const unsigned Level;
381 const llvm::DenseMap<FormatToken *, std::unique_ptr<UnwrappedLine>>
Implements an efficient mapping from strings to IdentifierInfo nodes.
This class handles loading and caching of source files into memory.
Token - This structure provides full information about a lexed token.