pub struct Clang { /* private fields */ }Expand description
Builder that generates RDL from C/C++ headers using libclang.
Implementations§
Source§impl Clang
impl Clang
Sourcepub fn scrape(&self, plan: &ScrapePlan) -> Summary
pub fn scrape(&self, plan: &ScrapePlan) -> Summary
Run the plan, replaying this builder once per architecture and merging the results.
Source§impl Clang
impl Clang
Sourcepub fn input(&mut self, input: impl AsRef<Path>) -> &mut Self
pub fn input(&mut self, input: impl AsRef<Path>) -> &mut Self
Adds an input header (.h) file or directory.
Sourcepub fn input_text(&mut self, input: &str) -> &mut Self
pub fn input_text(&mut self, input: &str) -> &mut Self
Adds inline source text to compile instead of a file on disk.
Sourcepub fn input_texts<I, S>(&mut self, inputs: I) -> &mut Self
pub fn input_texts<I, S>(&mut self, inputs: I) -> &mut Self
Adds inline source texts to compile instead of files on disk.
Sourcepub fn reference(&mut self, input: impl AsRef<Path>) -> &mut Self
pub fn reference(&mut self, input: impl AsRef<Path>) -> &mut Self
Adds a reference winmd file or directory.
Sourcepub fn references<I, S>(&mut self, inputs: I) -> &mut Self
pub fn references<I, S>(&mut self, inputs: I) -> &mut Self
Adds multiple reference winmd files or directories.
Sourcepub fn reference_bytes(&mut self, input: &[u8]) -> &mut Self
pub fn reference_bytes(&mut self, input: &[u8]) -> &mut Self
Adds a reference winmd from memory.
Sourcepub fn reference_byte_sets<I, B>(&mut self, inputs: I) -> &mut Self
pub fn reference_byte_sets<I, B>(&mut self, inputs: I) -> &mut Self
Adds reference winmds from memory.
Sourcepub fn reference_default(&mut self) -> &mut Self
pub fn reference_default(&mut self) -> &mut Self
Adds the default Windows metadata as references.
Sourcepub fn output(&mut self, output: impl AsRef<Path>) -> &mut Self
pub fn output(&mut self, output: impl AsRef<Path>) -> &mut Self
Sets the output .rdl file path.
Sourcepub fn namespace(&mut self, namespace: &str) -> &mut Self
pub fn namespace(&mut self, namespace: &str) -> &mut Self
Sets the namespace for the generated types.
Sourcepub fn library(&mut self, library: &str) -> &mut Self
pub fn library(&mut self, library: &str) -> &mut Self
Sets the library name recorded for imported functions.
Sourcepub fn drop_lib_less(&mut self) -> &mut Self
pub fn drop_lib_less(&mut self) -> &mut Self
Drops functions with no resolved import library; leave off without .lib inputs.
Sourcepub fn resolution_input(&mut self, input: impl AsRef<Path>) -> &mut Self
pub fn resolution_input(&mut self, input: impl AsRef<Path>) -> &mut Self
Adds a winmd used only to classify ABI::Windows::* projection declarations.
Sourcepub fn resolution_inputs<I, S>(&mut self, inputs: I) -> &mut Self
pub fn resolution_inputs<I, S>(&mut self, inputs: I) -> &mut Self
Adds winmds used only to classify ABI::Windows::* projection declarations.
Sourcepub fn resolution_bytes(&mut self, input: &[u8]) -> &mut Self
pub fn resolution_bytes(&mut self, input: &[u8]) -> &mut Self
Adds a resolution-only winmd from memory.
Sourcepub fn resolution_byte_sets<I, B>(&mut self, inputs: I) -> &mut Self
pub fn resolution_byte_sets<I, B>(&mut self, inputs: I) -> &mut Self
Adds resolution-only winmds from memory.
Sourcepub fn resolution_default(&mut self) -> &mut Self
pub fn resolution_default(&mut self) -> &mut Self
Adds the default Windows Runtime metadata as a resolution-only input.
Sourcepub fn libraries<I, K, V>(&mut self, libraries: I) -> &mut Self
pub fn libraries<I, K, V>(&mut self, libraries: I) -> &mut Self
Adds symbol -> DLL overrides for functions.
Prefer per-DLL .lib files over umbrella/apiset libraries for real DLL names.
Sourcepub fn resolved_library(&self, symbol: &str) -> Option<&str>
pub fn resolved_library(&self, symbol: &str) -> Option<&str>
Returns the DLL currently mapped to a function symbol.
Sourcepub fn import_library(
&mut self,
path: impl AsRef<Path>,
) -> Result<&mut Self, Error>
pub fn import_library( &mut self, path: impl AsRef<Path>, ) -> Result<&mut Self, Error>
Reads a COFF import library and adds its symbol -> DLL mappings.
Sourcepub fn filter(&mut self, filter: &str) -> &mut Self
pub fn filter(&mut self, filter: &str) -> &mut Self
Adds a normalized header path suffix to the inclusion filter.
Sourcepub fn filters<I, S>(&mut self, filters: I) -> &mut Self
pub fn filters<I, S>(&mut self, filters: I) -> &mut Self
Adds multiple header path suffixes to the inclusion filter.
Sourcepub fn arg<S: AsRef<str>>(&mut self, arg: S) -> &mut Self
pub fn arg<S: AsRef<str>>(&mut self, arg: S) -> &mut Self
Adds a compiler argument to pass to libclang.
Sourcepub fn args<I>(&mut self, args: I) -> &mut Self
pub fn args<I>(&mut self, args: I) -> &mut Self
Adds multiple compiler arguments to pass to libclang.
Sourcepub fn target(&mut self, target: &str) -> &mut Self
pub fn target(&mut self, target: &str) -> &mut Self
Sets the target triple used for all clang invocations.
Sourcepub fn scope(&mut self, scope: &str) -> &mut Self
pub fn scope(&mut self, scope: &str) -> &mut Self
Adds a header directory segment that acts as a root for the reachability sweep.
Sourcepub fn scopes<I, S>(&mut self, scopes: I) -> &mut Self
pub fn scopes<I, S>(&mut self, scopes: I) -> &mut Self
Adds multiple header directory segments as roots for the reachability sweep.
Sourcepub fn scope_header(&mut self, header: &str) -> &mut Self
pub fn scope_header(&mut self, header: &str) -> &mut Self
Marks a header as a sweep root regardless of SDK directory.
Sourcepub fn scope_headers<I, S>(&mut self, headers: I) -> &mut Self
pub fn scope_headers<I, S>(&mut self, headers: I) -> &mut Self
Marks multiple headers as sweep roots regardless of SDK directory.
Sourcepub fn exclude_header(&mut self, header: &str) -> &mut Self
pub fn exclude_header(&mut self, header: &str) -> &mut Self
Drops a named header partition before the reachability sweep.
Sourcepub fn exclude_headers<I, S>(&mut self, headers: I) -> &mut Self
pub fn exclude_headers<I, S>(&mut self, headers: I) -> &mut Self
Drops multiple named header partitions before the reachability sweep.
Sourcepub fn symbol(&mut self, symbol: &str) -> &mut Self
pub fn symbol(&mut self, symbol: &str) -> &mut Self
Restricts root emission to a named function symbol.
Sourcepub fn symbols<I, S>(&mut self, symbols: I) -> &mut Self
pub fn symbols<I, S>(&mut self, symbols: I) -> &mut Self
Restricts root emission to the named function symbols.
Sourcepub fn version() -> Result<String, Error>
pub fn version() -> Result<String, Error>
Returns the version string reported by the loaded libclang.
Sourcepub fn write(&self) -> Result<(), Error>
pub fn write(&self) -> Result<(), Error>
Generates the RDL and writes it to the configured output.
Sourcepub fn write_by_header(&self) -> Result<(), Error>
pub fn write_by_header(&self) -> Result<(), Error>
Writes one flat-root RDL file per defining header.