From 2e4db3d00ce680801fa82ed19fc750e280cb372d 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. llvm-svn: 226770 --- llvm/include/llvm/IR/DebugInfo.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/IR/DebugInfo.h b/llvm/include/llvm/IR/DebugInfo.h index 459e157..13fa23c 100644 --- a/llvm/include/llvm/IR/DebugInfo.h +++ b/llvm/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.7.4