#include "clang/Lex/PreprocessingRecord.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TokenKinds.h"
#include "clang/Lex/MacroInfo.h"
#include "clang/Lex/Token.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/Capacity.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstring>
#include <iterator>
#include <optional>
#include <utility>
#include <vector>
usingnamespaceclang;
ExternalPreprocessingRecordSource::~ExternalPreprocessingRecordSource() =
default;
InclusionDirective::InclusionDirective(PreprocessingRecord &PPRec,
InclusionKind Kind, StringRef FileName,
bool InQuotes, bool ImportedModule,
OptionalFileEntryRef File,
SourceRange Range)
: … { … }
PreprocessingRecord::PreprocessingRecord(SourceManager &SM) : … { … }
llvm::iterator_range<PreprocessingRecord::iterator>
PreprocessingRecord::getPreprocessedEntitiesInRange(SourceRange Range) { … }
static bool isPreprocessedEntityIfInFileID(PreprocessedEntity *PPE, FileID FID,
SourceManager &SM) { … }
bool PreprocessingRecord::isEntityInFileID(iterator PPEI, FileID FID) { … }
std::pair<int, int>
PreprocessingRecord::getPreprocessedEntitiesInRangeSlow(SourceRange Range) { … }
std::pair<unsigned, unsigned>
PreprocessingRecord::findLocalPreprocessedEntitiesInRange(
SourceRange Range) const { … }
namespace {
template <SourceLocation (SourceRange::*getRangeLoc)() const>
struct PPEntityComp { … };
}
unsigned PreprocessingRecord::findBeginLocalPreprocessedEntity(
SourceLocation Loc) const { … }
unsigned
PreprocessingRecord::findEndLocalPreprocessedEntity(SourceLocation Loc) const { … }
PreprocessingRecord::PPEntityID
PreprocessingRecord::addPreprocessedEntity(PreprocessedEntity *Entity) { … }
void PreprocessingRecord::SetExternalSource(
ExternalPreprocessingRecordSource &Source) { … }
unsigned PreprocessingRecord::allocateLoadedEntities(unsigned NumEntities) { … }
unsigned PreprocessingRecord::allocateSkippedRanges(unsigned NumRanges) { … }
void PreprocessingRecord::ensureSkippedRangesLoaded() { … }
void PreprocessingRecord::RegisterMacroDefinition(MacroInfo *Macro,
MacroDefinitionRecord *Def) { … }
PreprocessedEntity *PreprocessingRecord::getPreprocessedEntity(PPEntityID PPID){ … }
PreprocessedEntity *
PreprocessingRecord::getLoadedPreprocessedEntity(unsigned Index) { … }
MacroDefinitionRecord *
PreprocessingRecord::findMacroDefinition(const MacroInfo *MI) { … }
void PreprocessingRecord::addMacroExpansion(const Token &Id,
const MacroInfo *MI,
SourceRange Range) { … }
void PreprocessingRecord::Ifdef(SourceLocation Loc, const Token &MacroNameTok,
const MacroDefinition &MD) { … }
void PreprocessingRecord::Elifdef(SourceLocation Loc, const Token &MacroNameTok,
const MacroDefinition &MD) { … }
void PreprocessingRecord::Ifndef(SourceLocation Loc, const Token &MacroNameTok,
const MacroDefinition &MD) { … }
void PreprocessingRecord::Elifndef(SourceLocation Loc,
const Token &MacroNameTok,
const MacroDefinition &MD) { … }
void PreprocessingRecord::Defined(const Token &MacroNameTok,
const MacroDefinition &MD,
SourceRange Range) { … }
void PreprocessingRecord::SourceRangeSkipped(SourceRange Range,
SourceLocation EndifLoc) { … }
void PreprocessingRecord::MacroExpands(const Token &Id,
const MacroDefinition &MD,
SourceRange Range,
const MacroArgs *Args) { … }
void PreprocessingRecord::MacroDefined(const Token &Id,
const MacroDirective *MD) { … }
void PreprocessingRecord::MacroUndefined(const Token &Id,
const MacroDefinition &MD,
const MacroDirective *Undef) { … }
void PreprocessingRecord::InclusionDirective(
SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName,
bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File,
StringRef SearchPath, StringRef RelativePath, const Module *SuggestedModule,
bool ModuleImported, SrcMgr::CharacteristicKind FileType) { … }
size_t PreprocessingRecord::getTotalMemory() const { … }