clang: clang::SourceLocationSequence Class Reference (original) (raw)

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.