[llvm] r226770 - DIBuilder: Create a getHeaderIterator() helper, NFC

Duncan P. N. Exon Smith dexonsmith at apple.com
Wed Jan 21 19:00:01 PST 2015


Author: dexonsmith
Date: Wed Jan 21 21:00:01 2015
New Revision: 226770

URL: http://llvm.org/viewvc/llvm-project?rev=226770&view=rev
Log:
DIBuilder: Create a getHeaderIterator() helper, NFC

Extract this so it can be reused.

Modified:
    llvm/trunk/include/llvm/IR/DebugInfo.h

Modified: llvm/trunk/include/llvm/IR/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=226770&r1=226769&r2=226770&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfo.h Wed Jan 21 21:00:01 2015
@@ -190,15 +190,19 @@ public:
                          DIHeaderFieldIterator());
   }
 
-  StringRef getHeaderField(unsigned Index) const {
+  DIHeaderFieldIterator getHeaderIterator(unsigned Index) const {
     // Since callers expect an empty string for out-of-range accesses, we can't
     // use std::advance() here.
     for (DIHeaderFieldIterator I(getHeader()), E; I != E; ++I, --Index)
       if (!Index)
-        return *I;
+        return I;
     return StringRef();
   }
 
+  StringRef getHeaderField(unsigned Index) const {
+    return *getHeaderIterator(Index);
+  }
+
   template <class T> T getHeaderFieldAs(unsigned Index) const {
     T Int;
     if (getHeaderField(Index).getAsInteger(0, Int))





More information about the llvm-commits mailing list