pub mod ast;
pub mod clang_abi_bridge;
pub mod clang_ast_import;
pub mod clang_libc;
pub mod clang_main;
pub mod clang_module_loader;
pub mod clang_pipeline;
pub mod clang_sema_checks;
pub mod clang_sysroot;
pub mod clang_target;
pub mod codegen;
pub mod diagnostics;
pub mod driver;
pub mod lexer;
pub mod libclang;
pub mod parser;
pub mod preprocessor;
pub mod sema;
pub mod token;
pub use diagnostics::DiagnosticEngine as Diagnostics;
pub use driver::{ClangDriver, CompileCommand};
pub use lexer::{SourceLocation, SourceManager};
pub use preprocessor::{MacroDefinition, PreprocessorState};
pub use clang_compiler_service_x86::CompilationDatabase;
pub mod clang_builtin_headers_x86;
pub mod clang_codecomplete_deep;
pub mod clang_codecomplete_x86;
pub mod clang_compile_bench;
pub mod clang_deep_cxx;
pub mod clang_deep_lexer;
pub mod clang_deep_sema_final;
pub mod clang_deep_sema_fix_x86;
pub mod clang_deep_sema_x86;
pub mod clang_diagnostics_x86;
pub mod clang_driver_jobs_x86;
pub mod clang_embedded_x86;
pub mod clang_header_search_x86;
pub mod clang_libcxx_full_x86;
pub mod clang_modules_full_x86;
pub mod clang_parse_ast_test_x86;
pub mod clang_parser_deep;
pub mod clang_pch_modules_x86;
pub mod clang_pipeline_x86;
pub mod clang_preprocessor_deep;
pub mod clang_preprocessor_x86;
pub mod clang_projects_combined_x86;
pub mod clang_refactor_x86;
pub mod clang_serialization_x86;
pub mod clang_stl_full_x86;
pub mod clang_sysroot_x86;
pub mod clang_test_harness_x86;
pub mod clang_toolchain_x86;
pub mod clang_tooling_full_x86;
pub mod clang_tools_full_x86;
pub mod constexpr;
pub mod coroutines_cpp;
pub mod cpp_ast;
pub mod cpp_codegen;
pub mod cpp_driver;
pub mod cpp_lexer;
pub mod cpp_modules;
pub mod cpp_parser;
pub mod cpp_token;
pub mod exception;
pub mod name_mangling;
pub mod overload;
pub mod rtti;
pub mod template;
pub mod vtable;
pub mod clang_cxx23_26_x86;
pub mod clang_e2e_pipeline;
pub mod clang_static_analyzer_x86;
pub mod clang_x86_codegen_full;
pub mod clang_x86_driver_full;
pub mod clang_x86_pipeline;
pub mod static_analyzer_x86;
pub mod clang_analysis_deep;
pub mod clang_analyzer_checkers_deep;
pub mod clang_build_systems_x86;
pub mod clang_compiler_service_x86;
pub mod clang_diag_renderer_x86;
pub mod clang_doc_x86;
pub mod clang_fixit_engine_x86;
pub mod clang_package_managers_x86;
pub mod clang_cloud_x86;
pub mod clang_concurrency_x86;
pub mod clang_database_x86;
pub mod clang_games_x86;
pub mod clang_golden_bridge;
pub mod clang_golden_path_tests;
pub mod clang_gui_x86;
pub mod clang_interop_x86;
pub mod clang_multimedia_x86;
pub mod clang_networking_x86;
pub mod clang_self_host_validation;
pub mod clang_selfhost;
pub mod clang_selfhost2;
pub mod clang_selfhost_x86;
pub mod clang_wasm_types;
pub mod clang_webassembly_x86;
pub mod clang_x86_e2e_pipeline_full;
pub mod clang_x86_e2e_tests;
pub use clang_analysis_deep::{
make_test_cfg,
make_x86_analysis_deep,
run_x86_analysis_deep,
run_x86_analysis_deep_plist,
run_x86_analysis_deep_sarif,
x86_analysis_checker_names,
AddrSinkAnalysis,
AlphaCPlusPlusDeleteChecker,
AlphaCPlusPlusEnumCastChecker,
AlphaCPlusPlusIteratorChecker,
AlphaCPlusPlusMoveChecker,
AlphaCPlusPlusSmartPtrChecker,
AlphaSecurityArrayBoundChecker,
AlphaSecurityMallocChecker,
AlphaSecurityRetValChecker,
AlphaSecurityTaintChecker,
AlphaUnixChrootChecker,
AlphaUnixCstringChecker,
AlphaUnixPthreadChecker,
AlphaUnixSimpleStreamChecker,
AlphaUnixStreamChecker,
AnalysisBlock,
AnalysisCFG,
AnalysisConfig,
AnalysisConsumer,
AnalysisOutputFormat,
AnalysisStmt,
BoolAssignmentChecker,
BugCategory,
BugOnConstraint,
BugReport,
BugSeverity,
CallAndMessageChecker,
CallSite,
Checker,
ConjuredKind,
Constraint,
ConstraintSolver,
DivZeroChecker,
DynamicTypeChecker,
ExplodedGraph,
ExplodedNode,
GraphStats,
IdenticalExprChecker,
InlineConfig,
NullDereferenceChecker,
NullabilityConstraint,
OptinAndroidChecker,
OptinFuchsiaChecker,
OptinMPIChecker,
OptinOSXAPI,
OptinOSXCocoa,
OptinOpenMPChecker,
OptinPerformanceFasterStringFind,
OptinPerformancePaddingChecker,
OptinPortabilityEndianChecker,
OptinWebKitChecker,
PlistConfig,
ProgramPoint,
ProgramPointKind,
ProgramState,
RangeConstraint,
ReturnPointerRangeChecker,
ReturnStackAddressChecker,
SarifConfig,
SizeofPointerChecker,
StackAddrLeakChecker,
SymConjured,
SymExpr,
SymRegion,
SymbolicExecutionEngine,
TaintConstraint,
TaintPropagation,
TaintSource,
UndefResultChecker,
UninitializedObjectChecker,
UnsafeBufferUsageChecker,
VLASizeChecker,
WorklistStrategy,
X86AnalysisDeep,
};
pub use ast::*;
pub use codegen::{compile_c, ClangCodeGen};
pub use diagnostics::{
ClangSourceLocation, DiagID, DiagMapping, DiagSeverity, DiagState, DiagnosticBuilder,
DiagnosticConsumer, DiagnosticEngine, DiagnosticNote, DiagnosticOptions,
DiagnosticOutputFormat, DiagnosticRenderer, ErrorMessageCatalog, FixItHint, SourceRange,
StructuredDiagnostic, TextDiagnosticPrinter, WarningGroupRegistry,
};
use driver::{compile_c_file, compile_c_string, compile_c_to_assembly};
pub use lexer::Lexer;
pub use libclang::*;
pub use parser::Parser;
pub use preprocessor::Preprocessor;
pub use sema::Sema;
pub use token::{Token, TokenKind};
pub use diagnostics::{ClangSourceFile, ClangSourceManager};
pub use lexer::SourceLocation as LexerSourceLocation;
pub use preprocessor::MacroDef;
pub use clang_pipeline::{CodeModel, PipelineResult, RelocModel};
pub use constexpr::{ConstEvalError, ConstExprEvaluator, ConstValue};
pub use coroutines_cpp::{CoroutineFrame, CoroutineLowering, CoroutineState, PromiseTypeDesc};
pub use cpp_ast::{
BaseSpecifier, CXXCompoundStmt, CXXDecl, CXXExpr, CXXMemberDecl, CXXName, CXXOperator,
CXXParamDecl, CXXRecordKind, CXXStmt, CXXTranslationUnit, CtorInit, EnumConstant,
LambdaCapture, NestedNameSpecifier, TemplateParamDecl,
};
pub use cpp_codegen::CXXCodeGen;
pub use cpp_driver::{compile_cpp_source, compile_cpp_with_options, CXXDriver, CXXStdLib};
pub use cpp_lexer::CppLexer;
pub use cpp_modules::{ModuleDecl as CppModuleDecl, ModuleImport, ModuleMap, ModuleName};
pub use cpp_parser::{parse_cpp, CppParser};
pub use cpp_token::{
cpp_keyword_lookup, AccessSpecifier as CppAccessSpecifier, CppStandard, CppTokenKind,
};
pub use exception::{EHCodeGen, PersonalityKind, ITANIUM_PERSONALITY_FN, LSDA};
pub use name_mangling::{demangle, mangle_simple_function, MangledName, Mangler};
pub use overload::{CandidateRank, CandidateViability, OverloadCandidate, OverloadResolver};
pub use rtti::{RttiBuilder, RttiDescriptor, RttiKind};
pub use template::{DeductionResult, TemplateDeductor, TemplateInstantiator};
pub use vtable::{ThunkGenerator, VtableBuilder, VtableEntry, VtableLayout};
pub use clang_deep_sema_x86::{
analyze_x86_function, analyze_x86_tu, contains_x86_message, make_x86_32_deep_sema,
make_x86_64_deep_sema, x86_assign, x86_binary, x86_call, x86_compound, x86_ident, x86_int_lit,
x86_make_function, x86_make_tu, x86_make_variable, x86_return, X86ConstExprError,
X86ConstValue, X86ConstexprEval, X86ConvKind, X86ConversionRank, X86ConversionResult,
X86DeclValidator, X86DeepSema, X86DiagCategory, X86DiagNote, X86DiagSeverity, X86Diagnostic,
X86DiagnosticEmitter, X86ExprValidator, X86FixIt, X86ImplicitConversion, X86InstantiationDepth,
X86LookupPhase, X86NameDependence, X86OverloadCandidate, X86OverloadResolution, X86ScopeEntry,
X86ScopeKind, X86ScopeManager, X86TemplateParam, X86TemplateSema, X86TypePromotion,
X86ValueCategory, X86_LP64_INT_SIZE, X86_LP64_LONG_SIZE, X86_LP64_POINTER_SIZE,
};
pub use clang_deep_sema_final::{
analyze_x86_tu_final, make_x86_32_deep_sema_final, make_x86_64_cxx17_deep_sema_final,
make_x86_64_deep_sema_final, x86_depth_stats, x86_eval_constexpr_final, X86ConceptChecker,
X86ConceptDef, X86ConceptResult, X86ConstexprStats, X86DeepSemaFinal, X86DeferredName,
X86DeferredNameKind, X86DependentNameResolver, X86DepthStats, X86DepthTracker,
X86EnhancedScope, X86EnhancedScopeEntry, X86EnhancedScopeKind, X86EnhancedScopeManager,
X86FinalConstExprError, X86FinalConstValue, X86FinalConstexprEval, X86FinalDependence,
X86InstantiationFrame, X86InstantiationKind, X86SfinaeContext, X86SfinaeError,
X86SfinaeHandler, X86SfinaeSeverity, X86TwoPhaseLookup, X86TwoPhaseResult,
X86_MAX_CONSTEXPR_DEPTH, X86_MAX_CONSTEXPR_STEPS, X86_MAX_SFINAE_CONTEXTS,
X86_MAX_TEMPLATE_DEPTH,
};
pub use clang_parse_ast_test_x86::{
compare_x86_ast, pretty_print_x86_ast, run_x86_parse_ast_tests, test_x86_ast_roundtrip,
X86AstComparator, X86AstNodeKind, X86AstPrettyPrinter, X86AstSerializer,
X86AstVerificationResult, X86CSnippets, X86CppSnippets, X86ExpectedAstNode, X86ParseASTTest,
};
pub use clang_pipeline_x86::{
make_x86_32_pipeline, make_x86_release_pipeline, x86_clang_compile,
x86_clang_compile_stop_after, x86_clang_compile_with_opts, X86ClangCompileOptions,
X86ClangDiagLevel, X86ClangDiagnostic, X86ClangDiagnosticEngine, X86ClangPipeline,
X86ClangResult, X86ClangStage, X86ClangStageResult, X86ClangStats, X86IncrementalTracker,
};
pub use clang_analyzer_checkers_deep::{
make_x86_deep_checkers, run_x86_checker, run_x86_deep_checkers, x86_checker_names,
X86AutosarChecker, X86BugproneChecker, X86CertCChecker, X86CertCppChecker, X86CheckerCategory,
X86CheckerConfig, X86CheckerDependency, X86CheckerDependencyManager, X86CheckerFinding,
X86CheckerResult, X86CheckerSeverity, X86CheckerSuppression, X86CheckerToggle,
X86ConcurrencyChecker, X86CoreGuidelinesChecker, X86DeepCheckers, X86DocumentationChecker,
X86MisraCChecker, X86ModernizeChecker, X86PerformanceChecker, X86PortabilityChecker,
X86ReadabilityChecker, X86SecurityChecker,
};
pub use clang_target::{
create_aarch64_machine, create_arm_machine, create_riscv32_machine, create_riscv64_machine,
create_target_machine, create_x86_64_machine, data_layout_for_triple, ClangABI, ClangOptLevel,
ClangTargetInfo, CpuFeatureDatabase, DebugInfoKind, FunctionAttrMapper, HostCpuDetector,
StackProtectorLevel, TargetCodeGenInfo, TargetFlags,
};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum CLangStandard {
C89,
C99,
C11,
C17,
C23,
Gnu89,
Gnu99,
Gnu11,
Gnu17,
}
impl Default for CLangStandard {
fn default() -> Self {
CLangStandard::C17
}
}
impl CLangStandard {
pub fn as_str(&self) -> &'static str {
match self {
Self::C89 => "c89",
Self::C99 => "c99",
Self::C11 => "c11",
Self::C17 => "c17",
Self::C23 => "c23",
Self::Gnu89 => "gnu89",
Self::Gnu99 => "gnu99",
Self::Gnu11 => "gnu11",
Self::Gnu17 => "gnu17",
}
}
pub fn from_str(s: &str) -> Option<Self> {
match s {
"c89" | "c90" => Some(Self::C89),
"c99" => Some(Self::C99),
"c11" => Some(Self::C11),
"c17" | "c18" => Some(Self::C17),
"c23" | "c2x" => Some(Self::C23),
"gnu89" => Some(Self::Gnu89),
"gnu99" => Some(Self::Gnu99),
"gnu11" => Some(Self::Gnu11),
"gnu17" => Some(Self::Gnu17),
_ => None,
}
}
pub fn is_gnu(&self) -> bool {
matches!(self, Self::Gnu89 | Self::Gnu99 | Self::Gnu11 | Self::Gnu17)
}
pub fn has_bool(&self) -> bool {
matches!(
self,
Self::C99 | Self::C11 | Self::C17 | Self::C23 | Self::Gnu99 | Self::Gnu11 | Self::Gnu17
)
}
pub fn has_long_long(&self) -> bool {
matches!(
self,
Self::C99 | Self::C11 | Self::C17 | Self::C23 | Self::Gnu99 | Self::Gnu11 | Self::Gnu17
)
}
}
#[derive(Debug, Clone)]
pub struct ClangOptions {
pub standard: CLangStandard,
pub optimize: bool,
pub debug_info: bool,
pub warnings: bool,
pub pedantic: bool,
pub wall: bool,
pub werror: bool,
pub verbose: bool,
pub includes: Vec<String>,
pub defines: Vec<(String, Option<String>)>,
pub output_file: Option<String>,
pub target_triple: String,
}
impl Default for ClangOptions {
fn default() -> Self {
Self {
standard: CLangStandard::C17,
optimize: true,
debug_info: false,
warnings: true,
pedantic: false,
wall: false,
werror: false,
verbose: false,
includes: Vec::new(),
defines: Vec::new(),
output_file: None,
target_triple: "x86_64-unknown-linux-gnu".into(),
}
}
}