clang 20.0.0git
Classes | Public Member Functions | List of all members
clang::SourceLocationSequence Class Reference

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)
 

Detailed Description

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.

Member Function Documentation

◆ decode()

SourceLocation clang::SourceLocationSequence::decode ( EncodedTy  Encoded)
inline

◆ encode()

EncodedTy clang::SourceLocationSequence::encode ( SourceLocation  Loc)
inline

Definition at line 139 of file SourceLocationEncoding.h.

References Loc.


The documentation for this class was generated from the following file: