aboutsummaryrefslogtreecommitdiff
path: root/gcc/d/dmd/dmodule.d
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/d/dmd/dmodule.d')
-rw-r--r--gcc/d/dmd/dmodule.d18
1 files changed, 9 insertions, 9 deletions
diff --git a/gcc/d/dmd/dmodule.d b/gcc/d/dmd/dmodule.d
index 022231c..59d4065 100644
--- a/gcc/d/dmd/dmodule.d
+++ b/gcc/d/dmd/dmodule.d
@@ -679,23 +679,23 @@ extern (C++) final class Module : Package
/* Preprocess the file if it's a .c file
*/
FileName filename = srcfile;
- bool ifile = false; // did we generate a .i file
- scope (exit)
- {
- if (ifile)
- File.remove(filename.toChars()); // remove generated file
- }
+ const(ubyte)[] srctext;
if (global.preprocess &&
FileName.equalsExt(srcfile.toString(), c_ext) &&
FileName.exists(srcfile.toString()))
{
- filename = global.preprocess(srcfile, loc, ifile, &defines); // run C preprocessor
+ /* Apply C preprocessor to the .c file, returning the contents
+ * after preprocessing
+ */
+ srctext = global.preprocess(srcfile, loc, defines).data;
}
+ else
+ srctext = global.fileManager.getFileContents(filename);
+ this.src = srctext;
- if (auto result = global.fileManager.lookup(filename))
+ if (srctext)
{
- this.src = result;
if (global.params.makeDeps.doOutput)
global.params.makeDeps.files.push(srcfile.toChars());
return true;