[PATCH] D18707: Make DIASession work if msdia*.dll isn't registered.

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 1 15:17:50 PDT 2016


thakis added inline comments.

================
Comment at: lib/DebugInfo/PDB/DIA/DIASession.cpp:37-47
@@ +36,13 @@
+  // version we're compiling against by comparing CLSIDs.
+  class DECLSPEC_UUID("3BFCEA48-620F-4B6B-81F7-B9AF75454C7D") DiaSource120;
+  class DECLSPEC_UUID("E6756135-1E65-4D17-8576-610761398C3C") DiaSource140;
+  const wchar_t *msdia_dll = nullptr;
+  if (CLSID_DiaSource == _uuidof(DiaSource120)) // VS2013
+    msdia_dll = L"msdia120.dll";
+  else if (CLSID_DiaSource == _uuidof(DiaSource140)) // VS2015
+    msdia_dll = L"msdia140.dll";
+
+  return msdia_dll &&
+         SUCCEEDED(NoRegCoCreate(msdia_dll, CLSID_DiaSource, IID_IDiaDataSource,
+                                 reinterpret_cast<LPVOID *>(&DiaDataSource)));
+}
----------------
zturner wrote:
> Why don't we just check `_MSC_VER`?  That looks equivalent to this whole guid comparison logic.  
> 
>     #if ((_MSC_VER/100) == 19)
>         msdia_dll = L"msdia140.dll";
>     #elif ((_MSC_VER/100) == 18)
>         msdia_dll = L"msdia120.dll";
> 
Sure, I can do that. The current approach works with compilers that don't set _MSC_VER as long as they understand _uuidof, but that's probably not a very important use case.

Done.


http://reviews.llvm.org/D18707





More information about the llvm-commits mailing list