Delete temp files if compiled successfully
authorHomer Hsing <homer.xing@intel.com>
Thu, 21 Feb 2013 02:45:42 +0000 (10:45 +0800)
committerZhigang Gong <zhigang.gong@linux.intel.com>
Wed, 10 Apr 2013 06:52:33 +0000 (14:52 +0800)
If IR was compiled successfully, delete temp files.
My '/tmp' was full of '*.cl', '*.ll' files.
Now the temp files are gone, world is clean :)

Signed-off-by: Homer Hsing <homer.xing@intel.com>
Reviewed-by: Lu Guanqun <guanqun.lu@intel.com>
backend/src/backend/program.cpp

index 3597a0a..df0df28 100644 (file)
@@ -137,9 +137,12 @@ namespace gbe {
     while (fgets(msg, sizeof(msg), pipe))
       std::cout << msg;
     pclose(pipe);
+    remove(clName.c_str());
 
     // Now build the program from llvm
-    return gbe_program_new_from_llvm(llName.c_str(), stringSize, err, errSize);
+    gbe_program p = gbe_program_new_from_llvm(llName.c_str(), stringSize, err, errSize);
+    remove(llName.c_str());
+    return p;
   }
 
   static uint32_t programGetKernelNum(gbe_program gbeProgram) {