fix hfuzz binary to be conform with the rest of the codebase again
This essentially removes the external file and fileids creation.
extern crate honggfuzz;
extern crate rcc;
-use rcc::codespan;
-use codespan::FileId;
-use rcc::{Files, Locatable};
+use rcc::Locatable;
use rcc::data::lex::{Keyword::*, Token};
use rcc::PreProcessorBuilder;
use std::default::Default;
-fn is_exotic_keyword(s: &str, file: FileId, files: &mut Files) -> bool {
- let (first, _) = PreProcessorBuilder::new(s, file, files).build().first_token();
+fn is_exotic_keyword(s: &str) -> bool {
+ let (first, _) = PreProcessorBuilder::new(s).build().first_token();
let first = match first {
Some(Locatable {
data: Token::Keyword(k),
@@ -31,12 +29,10 @@ fn main() {
loop {
fuzz!(|s: &[u8]| {
if let Ok(s) = std::str::from_utf8(s) {
- let mut files = Files::new();
- let file = files.add("<test-suite>", String::from(s).into());
- if !is_exotic_keyword(s, file, &mut files) {
+ if !is_exotic_keyword(s) {
let module = rcc::initialize_aot_module("<test-suite>".into());
let opt = Opt::default();
- let _ = rcc::compile(module, s, opt, file, &mut files);
+ let _ = rcc::compile(module, s, opt);
}
}
});
