[−][src]Struct haybale_pitchfork::Project
A Project
is a collection of LLVM code to be explored,
consisting of one or more LLVM modules.
Methods
impl Project
[src]
pub fn from_bc_path(path: impl AsRef<Path>) -> Result<Project, String>
[src]
Construct a new Project
from a path to an LLVM bitcode file
pub fn from_bc_paths<P>(
paths: impl IntoIterator<Item = P>
) -> Result<Project, String> where
P: AsRef<Path>,
[src]
paths: impl IntoIterator<Item = P>
) -> Result<Project, String> where
P: AsRef<Path>,
Construct a new Project
from multiple LLVM bitcode files
pub fn from_bc_dir(path: impl AsRef<Path>, extn: &str) -> Result<Project, Error>
[src]
Construct a new Project
from a path to a directory containing
LLVM bitcode files.
All files in the directory which have the extension extn
will
be parsed and added to the Project
.
pub fn from_bc_dir_with_blacklist(
path: impl AsRef<Path>,
extn: &str,
exclude: impl Fn(&Path) -> bool
) -> Result<Project, Error>
[src]
path: impl AsRef<Path>,
extn: &str,
exclude: impl Fn(&Path) -> bool
) -> Result<Project, Error>
Construct a new Project
from a path to a directory containing LLVM
bitcode files.
All files in the directory which have the extension extn
, except those
for which the provided exclude
closure returns true
, will be parsed
and added to the Project
.
pub fn add_bc_path(&mut self, path: impl AsRef<Path>) -> Result<(), String>
[src]
Add the code in the given LLVM bitcode file to the Project
pub fn add_bc_dir(
&mut self,
path: impl AsRef<Path>,
extn: &str
) -> Result<(), Error>
[src]
&mut self,
path: impl AsRef<Path>,
extn: &str
) -> Result<(), Error>
Add the code in the given directory to the Project
.
See Project::from_bc_dir()
.
pub fn add_bc_dir_with_blacklist(
&mut self,
path: impl AsRef<Path>,
extn: &str,
exclude: impl Fn(&Path) -> bool
) -> Result<(), Error>
[src]
&mut self,
path: impl AsRef<Path>,
extn: &str,
exclude: impl Fn(&Path) -> bool
) -> Result<(), Error>
Add the code in the given directory, except for blacklisted files, to the Project
.
See Project::from_bc_dir_with_blacklist()
.
pub fn all_functions(&self) -> impl Iterator<Item = (&Function, &Module)>
[src]
Iterate over all Function
s in the Project
.
Gives pairs which also indicate the Module
the Function
is defined in.
pub fn all_global_vars(
&self
) -> impl Iterator<Item = (&GlobalVariable, &Module)>
[src]
&self
) -> impl Iterator<Item = (&GlobalVariable, &Module)>
Iterate over all GlobalVariable
s in the Project
.
Gives pairs which also indicate the Module
the GlobalVariable
comes from.
pub fn all_global_aliases(
&self
) -> impl Iterator<Item = (&GlobalAlias, &Module)>
[src]
&self
) -> impl Iterator<Item = (&GlobalAlias, &Module)>
Iterate over all GlobalAlias
es in the Project
.
Gives pairs which also indicate the Module
the GlobalAlias
comes from.
pub fn all_named_struct_types(
&self
) -> impl Iterator<Item = (&String, Option<Type>, &Module)>
[src]
&self
) -> impl Iterator<Item = (&String, Option<Type>, &Module)>
Iterate over all named struct types in the Project
.
Gives triplets (name, Type, Module)
which indicate the struct's name,
type, and which module it comes from.
If the Type
in the triplet is None
, that means the struct type is
opaque; see
LLVM 9 docs on Opaque Structure Types.
pub fn active_module_names(&self) -> impl Iterator<Item = &String>
[src]
Get the names of the LLVM modules which have been parsed and loaded into
the Project
pub fn get_func_by_name(
&'p self,
name: &str
) -> Option<(&'p Function, &'p Module)>
[src]
&'p self,
name: &str
) -> Option<(&'p Function, &'p Module)>
Search the project for a function with the given name. If a matching function is found, return both it and the module it was found in.
For projects containing C++ or Rust code, you can pass either the mangled or demangled function name.
If you have a State
handy, you may want to use
state.get_func_by_name()
instead, which will get the appopriate
(potentially module-private) definition based on the current LLVM module.
pub fn get_named_struct_type_by_name(
&'p self,
name: &str
) -> Option<(&'p Option<Arc<RwLock<Type>>>, &'p Module)>
[src]
&'p self,
name: &str
) -> Option<(&'p Option<Arc<RwLock<Type>>>, &'p Module)>
Search the project for a named struct type with the given name. If a matching named struct type is found, return both it and the module it was found in.
If None
is returned, then no named struct type with the given name was
found in the project.
If Some(None, <module>)
is returned, that means the struct type is
opaque; see
LLVM 9 docs on Opaque Structure Types.
If the named struct type is defined in multiple modules in the Project
,
this returns one of them arbitrarily. However, it will only return
Some(None, <module>)
if all definitions are opaque; that is, it will
attempt to return some non-opaque definition if one exists, before
returning an opaque definition.
pub fn get_inner_struct_type_from_named(
&self,
ty: &Type
) -> Option<Arc<RwLock<Type>>>
[src]
&self,
ty: &Type
) -> Option<Arc<RwLock<Type>>>
Given a NamedStructType
, get the StructType
corresponding to the
actual definition of that NamedStructType
. This may be as simple as
upgrading the weak reference, but in the case of opaque struct types may
involve searching the Project
for a definition of the relevant struct.
Returns None
if the struct is fully opaque, meaning it has no
definition in the Project
.
Auto Trait Implementations
impl RefUnwindSafe for Project
impl Send for Project
impl Sync for Project
impl Unpin for Project
impl UnwindSafe for Project
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,