Bladeren bron

Expose detailed commit information in "dxc -help" on Linux (#1486)

Lei Zhang 7 jaren geleden
bovenliggende
commit
c8423c6f92
1 gewijzigde bestanden met toevoegingen van 7 en 5 verwijderingen
  1. 7 5
      tools/clang/tools/dxc/dxc.cpp

+ 7 - 5
tools/clang/tools/dxc/dxc.cpp

@@ -1008,6 +1008,8 @@ HRESULT DxcContext::GetDxcDiaTable(IDxcLibrary *pLibrary, IDxcBlob *pTargetBlob,
 #endif // _WIN32
 
 bool GetDLLFileVersionInfo(const char *dllPath, unsigned int *version) {
+  // This function is used to get version information from the DLL file.
+  // This information in is not available through a Unix interface.
 #ifdef _WIN32
   DWORD dwVerHnd = 0;
   DWORD size = GetFileVersionInfoSize(dllPath, &dwVerHnd);
@@ -1027,12 +1029,8 @@ bool GetDLLFileVersionInfo(const char *dllPath, unsigned int *version) {
           }
       }
   }
-  return false;
-#else
-  // This function is used to get version information from the DLL file.
-  // This information in is not available through a Unix interface.
-  return false;
 #endif // _WIN32
+  return false;
 }
 
 // Collects compiler/validator version info
@@ -1064,22 +1062,26 @@ void DxcContext::GetCompilerVersionInfo(llvm::raw_string_ostream &OS) {
       OS << compilerName << ": " << 1 << "." << 0;
     }
 
+#ifdef _WIN32
     unsigned int version[4];
     if (GetDLLFileVersionInfo(compilerName, version)) {
       // unofficial version always have file version 3.7.0.0
       if (version[0] == 3 && version[1] == 7 && version[2] == 0 &&
           version[3] == 0) {
+#endif // _WIN32
         OS << "(dev"
 #ifdef SUPPORT_QUERY_GIT_COMMIT_INFO
            << ";" << commitCount << "-"
            << (commitHash.m_pData ? commitHash.m_pData : "<unknown-git-hash>")
 #endif // SUPPORT_QUERY_GIT_COMMIT_INFO
            << ")";
+#ifdef _WIN32
       } else {
         OS << "(" << version[0] << "." << version[1] << "." << version[2] << "."
            << version[3] << ")";
       }
     }
+#endif // _WIN32
   }
   // Print validator if exists
   DxcDllSupport DxilSupport;