[llvm] r197600 - Add a unit test for loading an object file via a file descriptor. Patch by Pete Cooper.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Dec 18 19:38:57 PST 2013


> +  if (Archive *Arc = dyn_cast<Archive>(Binary.get())) {
> +    (void)Arc;
> +    errs() << "ERROR: Loaded archive, was expecting object file\n";
> +  } else if (ObjectFile *Obj = dyn_cast<ObjectFile>(Binary.get())) {
> +    (void)Obj;
> +  } else {
> +    outs() << "ERROR: Unknown file type\n";
> +    exit(1);
> +  }

Why not isa instead of dyn_cast.

Also, why the unit test? llvm-ar, for example, uses this api, so it is
tested via lit.

Cheers,
Rafael



More information about the llvm-commits mailing list