clang 20.0.0git
|
Serialized encoding of a sequence of SourceLocations. More...
#include "clang/Serialization/SourceLocationEncoding.h"
Classes | |
class | State |
This object establishes a SourceLocationSequence. More... | |
Public Member Functions | |
SourceLocation | decode (EncodedTy Encoded) |
EncodedTy | encode (SourceLocation Loc) |
Serialized encoding of a sequence of SourceLocations.
Optimized to produce small values when locations with the sequence are similar. Each element can be delta-encoded against the last nonzero element.
Sequences should be started by creating a SourceLocationSequence::State, and then passed around as SourceLocationSequence*. Example:
// establishes a sequence void EmitTopLevelThing() { SourceLocationSequence::State Seq; EmitContainedThing(Seq); EmitRecursiveThing(Seq); }
// optionally part of a sequence void EmitContainedThing(SourceLocationSequence *Seq = nullptr) { Record.push_back(SourceLocationEncoding::encode(SomeLoc, Seq)); }
// establishes a sequence if there isn't one already void EmitRecursiveThing(SourceLocationSequence *ParentSeq = nullptr) { SourceLocationSequence::State Seq(ParentSeq); Record.push_back(SourceLocationEncoding::encode(SomeLoc, Seq)); EmitRecursiveThing(Seq); }
Definition at line 96 of file SourceLocationEncoding.h.
|
inline |
Definition at line 136 of file SourceLocationEncoding.h.
References clang::SourceLocation::getFromRawEncoding().
|
inline |
Definition at line 139 of file SourceLocationEncoding.h.
References Loc.