#include "clang/Lex/Preprocessor.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/FileSystemStatCache.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/Module.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/CodeCompletionHandler.h"
#include "clang/Lex/ExternalPreprocessorSource.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/LexDiagnostic.h"
#include "clang/Lex/Lexer.h"
#include "clang/Lex/LiteralSupport.h"
#include "clang/Lex/MacroArgs.h"
#include "clang/Lex/MacroInfo.h"
#include "clang/Lex/ModuleLoader.h"
#include "clang/Lex/Pragma.h"
#include "clang/Lex/PreprocessingRecord.h"
#include "clang/Lex/PreprocessorLexer.h"
#include "clang/Lex/PreprocessorOptions.h"
#include "clang/Lex/ScratchBuffer.h"
#include "clang/Lex/Token.h"
#include "clang/Lex/TokenLexer.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/Capacity.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
usingnamespaceclang;
static constexpr unsigned CheckPointStepSize = …;
LLVM_INSTANTIATE_REGISTRY(…)
ExternalPreprocessorSource::~ExternalPreprocessorSource() = default;
Preprocessor::Preprocessor(std::shared_ptr<PreprocessorOptions> PPOpts,
DiagnosticsEngine &diags, const LangOptions &opts,
SourceManager &SM, HeaderSearch &Headers,
ModuleLoader &TheModuleLoader,
IdentifierInfoLookup *IILookup, bool OwnsHeaders,
TranslationUnitKind TUKind)
: … { … }
Preprocessor::~Preprocessor() { … }
void Preprocessor::Initialize(const TargetInfo &Target,
const TargetInfo *AuxTarget) { … }
void Preprocessor::InitializeForModelFile() { … }
void Preprocessor::FinalizeForModelFile() { … }
void Preprocessor::DumpToken(const Token &Tok, bool DumpFlags) const { … }
void Preprocessor::DumpLocation(SourceLocation Loc) const { … }
void Preprocessor::DumpMacro(const MacroInfo &MI) const { … }
void Preprocessor::PrintStats() { … }
Preprocessor::macro_iterator
Preprocessor::macro_begin(bool IncludeExternalMacros) const { … }
size_t Preprocessor::getTotalMemory() const { … }
Preprocessor::macro_iterator
Preprocessor::macro_end(bool IncludeExternalMacros) const { … }
static bool MacroDefinitionEquals(const MacroInfo *MI,
ArrayRef<TokenValue> Tokens) { … }
StringRef Preprocessor::getLastMacroWithSpelling(
SourceLocation Loc,
ArrayRef<TokenValue> Tokens) const { … }
void Preprocessor::recomputeCurLexerKind() { … }
bool Preprocessor::SetCodeCompletionPoint(FileEntryRef File,
unsigned CompleteLine,
unsigned CompleteColumn) { … }
void Preprocessor::CodeCompleteIncludedFile(llvm::StringRef Dir,
bool IsAngled) { … }
void Preprocessor::CodeCompleteNaturalLanguage() { … }
StringRef Preprocessor::getSpelling(const Token &Tok,
SmallVectorImpl<char> &Buffer,
bool *Invalid) const { … }
void Preprocessor::CreateString(StringRef Str, Token &Tok,
SourceLocation ExpansionLocStart,
SourceLocation ExpansionLocEnd) { … }
SourceLocation Preprocessor::SplitToken(SourceLocation Loc, unsigned Length) { … }
Module *Preprocessor::getCurrentModule() { … }
Module *Preprocessor::getCurrentModuleImplementation() { … }
void Preprocessor::EnterMainSourceFile() { … }
void Preprocessor::setPCHThroughHeaderFileID(FileID FID) { … }
bool Preprocessor::isPCHThroughHeader(const FileEntry *FE) { … }
bool Preprocessor::creatingPCHWithThroughHeader() { … }
bool Preprocessor::usingPCHWithThroughHeader() { … }
bool Preprocessor::creatingPCHWithPragmaHdrStop() { … }
bool Preprocessor::usingPCHWithPragmaHdrStop() { … }
void Preprocessor::SkipTokensWhileUsingPCH() { … }
void Preprocessor::replayPreambleConditionalStack() { … }
void Preprocessor::EndSourceFile() { … }
IdentifierInfo *Preprocessor::LookUpIdentifierInfo(Token &Identifier) const { … }
void Preprocessor::SetPoisonReason(IdentifierInfo *II, unsigned DiagID) { … }
void Preprocessor::PoisonSEHIdentifiers(bool Poison) { … }
void Preprocessor::HandlePoisonedIdentifier(Token & Identifier) { … }
void Preprocessor::updateOutOfDateIdentifier(const IdentifierInfo &II) const { … }
bool Preprocessor::HandleIdentifier(Token &Identifier) { … }
void Preprocessor::Lex(Token &Result) { … }
void Preprocessor::LexTokensUntilEOF(std::vector<Token> *Tokens) { … }
bool Preprocessor::LexHeaderName(Token &FilenameTok, bool AllowMacroExpansion) { … }
void Preprocessor::CollectPpImportSuffix(SmallVectorImpl<Token> &Toks) { … }
bool Preprocessor::LexAfterModuleImport(Token &Result) { … }
void Preprocessor::makeModuleVisible(Module *M, SourceLocation Loc) { … }
bool Preprocessor::FinishLexStringLiteral(Token &Result, std::string &String,
const char *DiagnosticTag,
bool AllowMacroExpansion) { … }
bool Preprocessor::parseSimpleIntegerLiteral(Token &Tok, uint64_t &Value) { … }
void Preprocessor::addCommentHandler(CommentHandler *Handler) { … }
void Preprocessor::removeCommentHandler(CommentHandler *Handler) { … }
bool Preprocessor::HandleComment(Token &result, SourceRange Comment) { … }
void Preprocessor::emitMacroDeprecationWarning(const Token &Identifier) const { … }
void Preprocessor::emitRestrictExpansionWarning(const Token &Identifier) const { … }
void Preprocessor::emitRestrictInfNaNWarning(const Token &Identifier,
unsigned DiagSelection) const { … }
void Preprocessor::emitFinalMacroWarning(const Token &Identifier,
bool IsUndef) const { … }
bool Preprocessor::isSafeBufferOptOut(const SourceManager &SourceMgr,
const SourceLocation &Loc) const { … }
bool Preprocessor::enterOrExitSafeBufferOptOutRegion(
bool isEnter, const SourceLocation &Loc) { … }
bool Preprocessor::isPPInSafeBufferOptOutRegion() { … }
bool Preprocessor::isPPInSafeBufferOptOutRegion(SourceLocation &StartLoc) { … }
SmallVector<SourceLocation, 64>
Preprocessor::serializeSafeBufferOptOutMap() const { … }
bool Preprocessor::setDeserializedSafeBufferOptOutMap(
const SmallVectorImpl<SourceLocation> &SourceLocations) { … }
ModuleLoader::~ModuleLoader() = default;
CommentHandler::~CommentHandler() = default;
EmptylineHandler::~EmptylineHandler() = default;
CodeCompletionHandler::~CodeCompletionHandler() = default;
void Preprocessor::createPreprocessingRecord() { … }
const char *Preprocessor::getCheckPoint(FileID FID, const char *Start) const { … }