|
LLZK 2.1.1
An open-source IR for Zero Knowledge (ZK) circuits
|
#include <mlir/TableGen/Dialect.h>#include <llvm/ADT/StringExtras.h>#include <llvm/ADT/StringRef.h>#include <llvm/ADT/StringSwitch.h>#include <llvm/Support/CommandLine.h>#include <llvm/Support/FormatVariadic.h>#include <memory>#include <string>Go to the source code of this file.
Classes | |
| class | ClangLexerContext |
| RAII wrapper for Clang lexer infrastructure. More... | |
| struct | MethodParameter |
| Structure to represent a parameter in a parsed method signature from an extraClassDeclaration More... | |
| struct | ExtraMethod |
| Structure to represent a parsed method signature from an extraClassDeclaration More... | |
| struct | Generator |
| Base class for C API generators. More... | |
| struct | HeaderGenerator |
| Generator for common C header file elements. More... | |
| struct | ImplementationGenerator |
| Generator for common C implementation file elements. More... | |
| struct | TestGenerator |
| Generator for common test implementation file elements. More... | |
Namespaces | |
| namespace | clang |
Functions | |
| template<typename S> | |
| void | warnSkipped (const S &methodName, const std::string &message) |
| Print warning about skipping a function. | |
| template<typename S> | |
| void | warnSkippedNoConversion (const S &methodName, const std::string &cppType) |
| Print warning about skipping a function due to no conversion of C++ type to C API type. | |
| std::string | toPascalCase (mlir::StringRef str) |
| Convert names separated by underscore or colon to PascalCase. | |
| bool | isIntegerType (mlir::StringRef type) |
| Check if a C++ type is a known integer type. | |
| bool | isPrimitiveType (mlir::StringRef cppType) |
| Check if a C++ type is a known primitive type. | |
| bool | isCppModifierKeyword (mlir::StringRef tokenText) |
| Check if a token text represents a C++ modifier/specifier keyword. | |
| bool | isCppLanguageConstruct (mlir::StringRef methodName) |
| Check if a method name represents a C++ control flow keyword or language construct. | |
| bool | isAPIntType (mlir::StringRef cppType) |
| Check if a C++ type is APInt. | |
| bool | isArrayRefType (mlir::StringRef cppType) |
| Check if a C++ type is an ArrayRef type. | |
| mlir::StringRef | extractArrayRefElementType (mlir::StringRef cppType) |
| Extract element type from ArrayRef<...> | |
| llvm::SmallVector< ExtraMethod > | parseExtraMethods (mlir::StringRef extraDecl) |
| Parse method declarations from an extraClassDeclaration using Clang's Lexer. | |
| bool | matchesMLIRClass (mlir::StringRef cppType, mlir::StringRef typeName) |
| Check if a C++ type matches an MLIR type pattern. | |
| std::optional< std::string > | tryCppTypeToCapiType (mlir::StringRef cppType) |
| Convert C++ type to MLIR C API type. | |
| std::string | mapCppTypeToCapiType (mlir::StringRef cppType) |
| Map C++ type to corresponding C API type. | |
| std::optional< std::string > | mapCapiTypeToBasicCppType (mlir::StringRef capiType) |
| Map C API type to corresponding basic (not dialect-defined) C++ type. | |
Variables | |
| constexpr bool | WARN_SKIPPED_METHODS = false |
| llvm::cl::OptionCategory | OpGenCat |
| llvm::cl::opt< std::string > | DialectName |
| llvm::cl::opt< std::string > | FunctionPrefix |
| llvm::cl::opt< bool > | GenIsA |
| llvm::cl::opt< bool > | GenOpBuild |
| llvm::cl::opt< bool > | GenOpOperandGetters |
| llvm::cl::opt< bool > | GenOpOperandSetters |
| llvm::cl::opt< bool > | GenOpAttributeGetters |
| llvm::cl::opt< bool > | GenOpAttributeSetters |
| llvm::cl::opt< bool > | GenOpRegionGetters |
| llvm::cl::opt< bool > | GenOpResultGetters |
| llvm::cl::opt< bool > | GenTypeOrAttrGet |
| llvm::cl::opt< bool > | GenTypeOrAttrParamGetters |
| llvm::cl::opt< bool > | GenExtraClassMethods |
|
inline |
Extract element type from ArrayRef<...>
Definition at line 197 of file CommonCAPIGen.h.
|
inline |
Check if a C++ type is APInt.
| cppType | The C++ type string to check |
Definition at line 181 of file CommonCAPIGen.h.
|
inline |
Check if a C++ type is an ArrayRef type.
| cppType | The C++ type string to check |
Definition at line 190 of file CommonCAPIGen.h.
|
inline |
Check if a method name represents a C++ control flow keyword or language construct.
| methodName | The method name to check |
Definition at line 162 of file CommonCAPIGen.h.
|
inline |
Check if a token text represents a C++ modifier/specifier keyword.
| tokenText | The token to check |
Definition at line 145 of file CommonCAPIGen.h.
|
inline |
Check if a C++ type is a known integer type.
| type | The type string to check |
Definition at line 100 of file CommonCAPIGen.h.
|
inline |
Check if a C++ type is a known primitive type.
| cppType | The C++ type string to check |
Definition at line 136 of file CommonCAPIGen.h.
| std::optional< std::string > mapCapiTypeToBasicCppType | ( | mlir::StringRef | capiType | ) |
Map C API type to corresponding basic (not dialect-defined) C++ type.
| capiType | The C API type to map |
| std::string mapCppTypeToCapiType | ( | mlir::StringRef | cppType | ) |
Map C++ type to corresponding C API type.
| cppType | The C++ type to map |
| bool matchesMLIRClass | ( | mlir::StringRef | cppType, |
| mlir::StringRef | typeName ) |
Check if a C++ type matches an MLIR type pattern.
| cppType | The C++ type to check |
| typeName | The MLIR type name to match against |
| llvm::SmallVector< ExtraMethod > parseExtraMethods | ( | mlir::StringRef | extraDecl | ) |
Parse method declarations from an extraClassDeclaration using Clang's Lexer.
| extraDecl | The C++ code from an extraClassDeclaration |
This function parses C++ method declarations to extract signatures that can be wrapped in C API functions. It identifies methods by looking for the pattern: [modifiers] <return_type> <identifier> '(' [params] ')' [const] ';'
Example input:
Example output:
|
inline |
Convert names separated by underscore or colon to PascalCase.
| str | The input string to convert (may contain underscores or colons) |
Examples: "no_inline" -> "NoInline" "::llzk::boolean::Type" -> "LlzkBooleanType"
Definition at line 75 of file CommonCAPIGen.h.
| std::optional< std::string > tryCppTypeToCapiType | ( | mlir::StringRef | cppType | ) |
Convert C++ type to MLIR C API type.
| cppType | The C++ type to convert |
|
inline |
Print warning about skipping a function.
Definition at line 30 of file CommonCAPIGen.h.
|
inline |
Print warning about skipping a function due to no conversion of C++ type to C API type.
Definition at line 38 of file CommonCAPIGen.h.
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
constexpr |
Definition at line 27 of file CommonCAPIGen.h.