ACAV f0ba4b7c9529
Abstract Syntax Tree (AST) visualization tool for C, C++, and Objective-C
Loading...
Searching...
No Matches
acav::SourceLocation Class Reference

Represents a specific position in source code. More...

#include <SourceLocation.h>

Public Member Functions

 SourceLocation (FileID fileId, unsigned line, unsigned column)
FileID fileID () const
unsigned line () const
unsigned column () const
bool isValid () const

Static Public Member Functions

static SourceLocation fromClang (const clang::SourceLocation &loc, const clang::SourceManager &sm, FileManager &fileMgr)
 Create SourceLocation from Clang's SourceLocation.
static void resetCache ()
 Reset internal caches (per extraction run).

Detailed Description

Represents a specific position in source code.

Uses FileID (compact integer) + line + column coordinates. FileID 0 = invalid (for compiler-generated code).

Memory layout: 12 bytes (4 + 4 + 4)

Definition at line 44 of file SourceLocation.h.

Constructor & Destructor Documentation

◆ SourceLocation()

acav::SourceLocation::SourceLocation ( FileID fileId,
unsigned line,
unsigned column )

Definition at line 61 of file SourceLocation.cpp.

Member Function Documentation

◆ column()

unsigned acav::SourceLocation::column ( ) const
inline

Definition at line 51 of file SourceLocation.h.

◆ fileID()

FileID acav::SourceLocation::fileID ( ) const
inline

Definition at line 49 of file SourceLocation.h.

◆ fromClang()

SourceLocation acav::SourceLocation::fromClang ( const clang::SourceLocation & loc,
const clang::SourceManager & sm,
FileManager & fileMgr )
static

Create SourceLocation from Clang's SourceLocation.

Parameters
locClang source location
smClang source manager
fileMgrFileManager for path registration
Returns
ACAV SourceLocation (may be invalid if loc is invalid)

Definition at line 64 of file SourceLocation.cpp.

References fromClang(), acav::FileManager::InvalidFileID, acav::FileManager::registerFile(), and acav::FileManager::tryGetFileId().

Referenced by fromClang(), and acav::SourceRange::fromClang().

◆ isValid()

bool acav::SourceLocation::isValid ( ) const
inline

Definition at line 52 of file SourceLocation.h.

◆ line()

unsigned acav::SourceLocation::line ( ) const
inline

Definition at line 50 of file SourceLocation.h.

◆ resetCache()

void acav::SourceLocation::resetCache ( )
static

Reset internal caches (per extraction run).

Definition at line 186 of file SourceLocation.cpp.

Referenced by acav::AstExtractorRunner::run().


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