LLZK 0.1.0
Veridise's ZK Language IR
Loading...
Searching...
No Matches
ClangLexerContext Class Reference

RAII wrapper for Clang lexer infrastructure. More...

#include <CommonCAPIGen.h>

Classes

struct  Impl

Public Member Functions

 ClangLexerContext (mlir::StringRef source, mlir::StringRef bufferName="input")
 Construct a lexer context for the given source code.
clang::Lexer & getLexer () const
 Get the lexer instance.
clang::SourceManager & getSourceManager () const
 Get the source manager instance.
bool isValid () const
 Check if the lexer was successfully created.

Detailed Description

RAII wrapper for Clang lexer infrastructure.

This class simplifies setting up Clang's lexer for parsing C++ code snippets. It manages the lifetime of all required Clang objects (FileManager, SourceManager, DiagnosticsEngine, etc.) and provides easy access to the lexer.

The Lexer is used instead of the Parser so that comments preceding method declarations can be captured for documentation generation.

Definition at line 215 of file CommonCAPIGen.h.

Constructor & Destructor Documentation

◆ ClangLexerContext()

ClangLexerContext::ClangLexerContext ( mlir::StringRef source,
mlir::StringRef bufferName = "input" )
explicit

Construct a lexer context for the given source code.

Parameters
sourceThe C++ source code to lex
bufferNameOptional name for the memory buffer (for diagnostics)

Definition at line 134 of file CommonCAPIGen.cpp.

Member Function Documentation

◆ getLexer()

Lexer & ClangLexerContext::getLexer ( ) const

Get the lexer instance.

Returns
Reference to the Clang lexer

Definition at line 163 of file CommonCAPIGen.cpp.

◆ getSourceManager()

SourceManager & ClangLexerContext::getSourceManager ( ) const

Get the source manager instance.

Returns
Reference to the Clang source manager

Definition at line 168 of file CommonCAPIGen.cpp.

◆ isValid()

bool ClangLexerContext::isValid ( ) const
inline

Check if the lexer was successfully created.

Returns
true if the lexer is valid and ready to use

Definition at line 232 of file CommonCAPIGen.h.


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