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