[llvm] r328177 - [PDB] Get more DIA table enumerators

Aaron Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 21 20:57:06 PDT 2018


Author: asmith
Date: Wed Mar 21 20:57:06 2018
New Revision: 328177

URL: http://llvm.org/viewvc/llvm-project?rev=328177&view=rev
Log:
[PDB] Get more DIA table enumerators

Rename the original function and make it a static template.

Modified:
    llvm/trunk/lib/DebugInfo/PDB/DIA/DIASession.cpp

Modified: llvm/trunk/lib/DebugInfo/PDB/DIA/DIASession.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/DIA/DIASession.cpp?rev=328177&r1=328176&r2=328177&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/DIA/DIASession.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/DIA/DIASession.cpp Wed Mar 21 20:57:06 2018
@@ -327,9 +327,10 @@ std::unique_ptr<IPDBEnumTables> DIASessi
   return llvm::make_unique<DIAEnumTables>(DiaEnumerator);
 }
 
-static CComPtr<IDiaEnumInjectedSources>
-getEnumInjectedSources(IDiaSession &Session) {
-  CComPtr<IDiaEnumInjectedSources> EIS;
+template <class T>
+static CComPtr<T>
+getTableEnumerator(IDiaSession &Session) {
+  CComPtr<T> Enumerator;
   CComPtr<IDiaEnumTables> ET;
   CComPtr<IDiaTable> Table;
   ULONG Count = 0;
@@ -340,15 +341,16 @@ getEnumInjectedSources(IDiaSession &Sess
   while (ET->Next(1, &Table, &Count) == S_OK && Count == 1) {
     // There is only one table that matches the given iid
     if (S_OK ==
-        Table->QueryInterface(__uuidof(IDiaEnumInjectedSources), (void **)&EIS))
+        Table->QueryInterface(__uuidof(T), (void **)&Enumerator))
       break;
     Table.Release();
   }
-  return EIS;
+  return Enumerator;
 }
 std::unique_ptr<IPDBEnumInjectedSources>
 DIASession::getInjectedSources() const {
-  CComPtr<IDiaEnumInjectedSources> Files = getEnumInjectedSources(*Session);
+  CComPtr<IDiaEnumInjectedSources> Files =
+      getTableEnumerator<IDiaEnumInjectedSources>(*Session);
   if (!Files)
     return nullptr;
 




More information about the llvm-commits mailing list