(arg: &Node, visitor: &Visitor)
| 463 | use super::*; |
| 464 | |
| 465 | pub fn is_file_name(arg: &Node, visitor: &Visitor) -> bool { |
| 466 | let arg = strip_prefix(arg); |
| 467 | let input_re = Regex::new(r"^input_file(\.\w+)?$").unwrap(); |
| 468 | let output_re = Regex::new(r"^output_file(\.\w+)?$").unwrap(); |
| 469 | if let Clang::StringLiteral(sl) = &arg.kind { |
| 470 | let value = sl.get_eval_value(); |
| 471 | // special case for sqlite3 and libmagic |
| 472 | if value == ":memory:" || value == "magic" { |
| 473 | return true; |
| 474 | } |
| 475 | if input_re.is_match(&value) || output_re.is_match(&value) { |
| 476 | return true; |
| 477 | } |
| 478 | } |
| 479 | if let Clang::DeclRefExpr(dre) = &arg.kind { |
| 480 | if let Some(init) = dre.get_var_init(visitor) { |
| 481 | return is_file_name(init, visitor); |
| 482 | } |
| 483 | } |
| 484 | false |
| 485 | } |
| 486 | |
| 487 | pub fn is_file_descriptor(arg: &Node, visitor: &Visitor) -> bool { |
| 488 | let arg = strip_prefix(arg); |
no test coverage detected