Simplify file handling code.

Removes dependency of a DMD class and is compatible with LLVM 3.x.