clang 22.0.0git
SourceManager.cpp File Reference
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManagerInternals.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/AutoConvert.h"
#include "llvm/Support/Capacity.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <optional>
#include <tuple>
#include <utility>
#include <vector>

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "source-manager"

Functions

 STATISTIC (MaxUsedSLocBytes, "Maximum number of bytes used by source locations " "(both loaded and local).")
template<typename LocType>
static bool isInvalid (LocType Loc, bool *Invalid)
template<class T>
static constexpr T likelyhasbetween (T x, unsigned char m, unsigned char n)
static bool MoveUpTranslationUnitIncludeHierarchy (FileIDAndOffset &Loc, const SourceManager &SM)
 Given a decomposed source location, move it up the include/expansion stack to the parent source location within the same translation unit.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "source-manager"

Definition at line 48 of file SourceManager.cpp.

Function Documentation

◆ isInvalid()

◆ likelyhasbetween()

template<class T>
constexpr T likelyhasbetween ( T x,
unsigned char m,
unsigned char n )
inlinestaticconstexpr

Definition at line 1220 of file SourceManager.cpp.

References clang::T.

Referenced by clang::SrcMgr::LineOffsetMapping::get().

◆ MoveUpTranslationUnitIncludeHierarchy()

bool MoveUpTranslationUnitIncludeHierarchy ( FileIDAndOffset & Loc,
const SourceManager & SM )
static

Given a decomposed source location, move it up the include/expansion stack to the parent source location within the same translation unit.

If this is possible, return the decomposed version of the parent in Loc and return false. If Loc is a top-level entry, return true and don't modify it.

Definition at line 1980 of file SourceManager.cpp.

References SM.

Referenced by clang::SourceManager::isInTheSameTranslationUnit().

◆ STATISTIC()

STATISTIC ( MaxUsedSLocBytes ,
"Maximum number of bytes used by source locations " "(both loaded and local)."  )