From b5f4854fb4aa8c488f21b4e1ef8831806e6862ec Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Thu, 22 Jan 2015 03:00:01 +0000 Subject: [PATCH] DIBuilder: Create a getHeaderIterator() helper, NFC Extract this so it can be reused. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226770 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/DebugInfo.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/llvm/IR/DebugInfo.h b/include/llvm/IR/DebugInfo.h index 459e1576193..13fa23c8fd6 100644 --- a/include/llvm/IR/DebugInfo.h +++ b/include/llvm/IR/DebugInfo.h @@ -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 T getHeaderFieldAs(unsigned Index) const { T Int; if (getHeaderField(Index).getAsInteger(0, Int)) -- 2.34.1