@@ -810,10 +810,16 @@ amd_comgr_status_t AMDGPUCompiler::createTmpDirs() {
810
810
return AMD_COMGR_STATUS_SUCCESS;
811
811
}
812
812
813
+ amd_comgr_status_t AMDGPUCompiler::removeTmpDirs () {
814
+ if (TmpDir.empty ()) {
815
+ return AMD_COMGR_STATUS_SUCCESS;
816
+ }
817
+ ProfilePoint Point (" RemoveDir" );
818
+
819
+ #ifdef _WIN32
813
820
// On windows fs::remove_directories takes huge time so use fs::remove.
814
- amd_comgr_status_t removeDirectory (const StringRef DirName) {
815
821
std::error_code EC;
816
- for (fs::directory_iterator Dir (DirName , EC), DirEnd; Dir != DirEnd && !EC;
822
+ for (fs::directory_iterator Dir (TmpDir , EC), DirEnd; Dir != DirEnd && !EC;
817
823
Dir.increment (EC)) {
818
824
const StringRef Path = Dir->path ();
819
825
@@ -843,25 +849,16 @@ amd_comgr_status_t removeDirectory(const StringRef DirName) {
843
849
}
844
850
}
845
851
846
- if (fs::remove (DirName )) {
852
+ if (fs::remove (TmpDir )) {
847
853
return AMD_COMGR_STATUS_ERROR;
848
854
}
849
855
850
856
return AMD_COMGR_STATUS_SUCCESS;
851
- }
852
-
853
- amd_comgr_status_t AMDGPUCompiler::removeTmpDirs () {
854
- if (TmpDir.empty ()) {
855
- return AMD_COMGR_STATUS_SUCCESS;
856
- }
857
- ProfilePoint Point (" RemoveDir" );
858
- #ifndef _WIN32
857
+ #else
859
858
if (fs::remove_directories (TmpDir)) {
860
859
return AMD_COMGR_STATUS_ERROR;
861
860
}
862
861
return AMD_COMGR_STATUS_SUCCESS;
863
- #else
864
- return removeDirectory (TmpDir);
865
862
#endif
866
863
}
867
864
0 commit comments