MCPcopy Create free account
hub / github.com/FuzzAnything/PromptFuzz / create_object_from_literal

Method create_object_from_literal

src/analysis/dfa.rs:711–733  ·  view source on GitHub ↗
(&mut self, literal: &ast::Node)

Source from the content-addressed store, hash-verified

709 }
710
711 fn create_object_from_literal(&mut self, literal: &ast::Node) -> Result<Symbol<T>> {
712 let ctx = self.get_current_ctx();
713 let sym = match &literal.kind {
714 ast::Clang::CharacterLiteral(cl) => {
715 let ty = cl.r#type.clone();
716 Symbol::new(ty, ObjectState::Literal(Literal::Char(cl.clone())), ctx)
717 }
718 ast::Clang::StringLiteral(sl) => {
719 let ty = sl.r#type.clone();
720 Symbol::new(ty, ObjectState::Literal(Literal::String(sl.clone())), ctx)
721 }
722 ast::Clang::IntegerLiteral(il) => {
723 let ty = il.r#type.clone();
724 Symbol::new(ty, ObjectState::Literal(Literal::Int(il.clone())), ctx)
725 }
726 ast::Clang::FloatingLiteral(fl) => {
727 let ty = fl.r#type.clone();
728 Symbol::new(ty, ObjectState::Literal(Literal::Float(fl.clone())), ctx)
729 }
730 _ => unreachable!("require Literal stmt, received: {literal:#?}"),
731 };
732 Ok(sym)
733 }
734
735 pub fn create_object_for_call(&mut self, call: &ast::Node) -> Result<Symbol<T>> {
736 if let ast::Clang::CallExpr(ce) = &call.kind {

Callers 1

get_rvalueMethod · 0.80

Calls 2

LiteralEnum · 0.85
get_current_ctxMethod · 0.80

Tested by

no test coverage detected