1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00

Update _MSC_VER equality checks for msdiaNNN.dll

Use inequality instead of equality to defend against minor version
increases in _MSC_VER. An _MSC_VER value of 1901 should still use
msdia140.dll, as described in this blog post:
https://blogs.msdn.microsoft.com/vcblog/2016/10/05/visual-c-compiler-version/

llvm-svn: 284058
This commit is contained in:
Reid Kleckner 2016-10-12 21:51:14 +00:00
parent 7a8aed281b
commit e56bde4149

View File

@ -24,9 +24,7 @@
using namespace llvm; using namespace llvm;
using namespace llvm::pdb; using namespace llvm::pdb;
namespace { static Error ErrorFromHResult(HRESULT Result) {
Error ErrorFromHResult(HRESULT Result) {
switch (Result) { switch (Result) {
case E_PDB_NOT_FOUND: case E_PDB_NOT_FOUND:
return make_error<GenericError>(generic_error_code::invalid_path); return make_error<GenericError>(generic_error_code::invalid_path);
@ -44,7 +42,7 @@ Error ErrorFromHResult(HRESULT Result) {
} }
} }
Error LoadDIA(CComPtr<IDiaDataSource> &DiaDataSource) { static Error LoadDIA(CComPtr<IDiaDataSource> &DiaDataSource) {
if (SUCCEEDED(CoCreateInstance(CLSID_DiaSource, nullptr, CLSCTX_INPROC_SERVER, if (SUCCEEDED(CoCreateInstance(CLSID_DiaSource, nullptr, CLSCTX_INPROC_SERVER,
IID_IDiaDataSource, IID_IDiaDataSource,
reinterpret_cast<LPVOID *>(&DiaDataSource)))) reinterpret_cast<LPVOID *>(&DiaDataSource))))
@ -55,12 +53,11 @@ Error LoadDIA(CComPtr<IDiaDataSource> &DiaDataSource) {
#if !defined(_MSC_VER) #if !defined(_MSC_VER)
return llvm::make_error<GenericError>( return llvm::make_error<GenericError>(
"DIA is only supported when using MSVC."); "DIA is only supported when using MSVC.");
#endif #else
const wchar_t *msdia_dll = nullptr; const wchar_t *msdia_dll = nullptr;
#if _MSC_VER == 1900 #if _MSC_VER >= 1900 && _MSC_VER < 2000
msdia_dll = L"msdia140.dll"; // VS2015 msdia_dll = L"msdia140.dll"; // VS2015
#elif _MSC_VER == 1800 #elif _MSC_VER >= 1800
msdia_dll = L"msdia120.dll"; // VS2013 msdia_dll = L"msdia120.dll"; // VS2013
#else #else
#error "Unknown Visual Studio version." #error "Unknown Visual Studio version."
@ -71,8 +68,7 @@ Error LoadDIA(CComPtr<IDiaDataSource> &DiaDataSource) {
reinterpret_cast<LPVOID *>(&DiaDataSource)))) reinterpret_cast<LPVOID *>(&DiaDataSource))))
return ErrorFromHResult(HR); return ErrorFromHResult(HR);
return Error::success(); return Error::success();
} #endif
} }
DIASession::DIASession(CComPtr<IDiaSession> DiaSession) : Session(DiaSession) {} DIASession::DIASession(CComPtr<IDiaSession> DiaSession) : Session(DiaSession) {}