@@ -810,10 +810,16 @@ amd_comgr_status_t AMDGPUCompiler::createTmpDirs() {
810810 return AMD_COMGR_STATUS_SUCCESS;
811811}
812812
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
813820// On windows fs::remove_directories takes huge time so use fs::remove.
814- amd_comgr_status_t removeDirectory (const StringRef DirName) {
815821 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;
817823 Dir.increment (EC)) {
818824 const StringRef Path = Dir->path ();
819825
@@ -843,25 +849,16 @@ amd_comgr_status_t removeDirectory(const StringRef DirName) {
843849 }
844850 }
845851
846- if (fs::remove (DirName )) {
852+ if (fs::remove (TmpDir )) {
847853 return AMD_COMGR_STATUS_ERROR;
848854 }
849855
850856 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
859858 if (fs::remove_directories (TmpDir)) {
860859 return AMD_COMGR_STATUS_ERROR;
861860 }
862861 return AMD_COMGR_STATUS_SUCCESS;
863- #else
864- return removeDirectory (TmpDir);
865862#endif
866863}
867864
0 commit comments