r261459 - Lex: Change HeaderMapImpl::getString() to return StringRef, NFC
Duncan P. N. Exon Smith via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 20 15:12:52 PST 2016
Author: dexonsmith
Date: Sat Feb 20 17:12:51 2016
New Revision: 261459
URL: http://llvm.org/viewvc/llvm-project?rev=261459&view=rev
Log:
Lex: Change HeaderMapImpl::getString() to return StringRef, NFC
Modified:
cfe/trunk/include/clang/Lex/HeaderMap.h
cfe/trunk/lib/Lex/HeaderMap.cpp
Modified: cfe/trunk/include/clang/Lex/HeaderMap.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderMap.h?rev=261459&r1=261458&r2=261459&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/HeaderMap.h (original)
+++ cfe/trunk/include/clang/Lex/HeaderMap.h Sat Feb 20 17:12:51 2016
@@ -53,7 +53,7 @@ private:
unsigned getEndianAdjustedWord(unsigned X) const;
const HMapHeader &getHeader() const;
HMapBucket getBucket(unsigned BucketNo) const;
- const char *getString(unsigned StrTabIdx) const;
+ StringRef getString(unsigned StrTabIdx) const;
};
/// This class represents an Apple concept known as a 'header map'. To the
Modified: cfe/trunk/lib/Lex/HeaderMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderMap.cpp?rev=261459&r1=261458&r2=261459&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/HeaderMap.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderMap.cpp Sat Feb 20 17:12:51 2016
@@ -145,7 +145,7 @@ HMapBucket HeaderMapImpl::getBucket(unsi
/// getString - Look up the specified string in the string table. If the string
/// index is not valid, it returns an empty string.
-const char *HeaderMapImpl::getString(unsigned StrTabIdx) const {
+StringRef HeaderMapImpl::getString(unsigned StrTabIdx) const {
// Add the start of the string table to the idx.
StrTabIdx += getEndianAdjustedWord(getHeader().StringsOffset);
@@ -175,9 +175,9 @@ LLVM_DUMP_METHOD void HeaderMapImpl::dum
HMapBucket B = getBucket(i);
if (B.Key == HMAP_EmptyBucketKey) continue;
- const char *Key = getString(B.Key);
- const char *Prefix = getString(B.Prefix);
- const char *Suffix = getString(B.Suffix);
+ StringRef Key = getString(B.Key);
+ StringRef Prefix = getString(B.Prefix);
+ StringRef Suffix = getString(B.Suffix);
llvm::dbgs() << " " << i << ". " << Key << " -> '" << Prefix << "' '"
<< Suffix << "'\n";
}
More information about the cfe-commits
mailing list