From 1b18a5ec2863d3345073576227fb67cbb6a4f13a Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Mon, 9 Sep 2013 16:39:06 +0000 Subject: CGDebugInfo: Hoist string allocation in a helper function. No functionality change. llvm-svn: 190314 --- clang/lib/CodeGen/CGDebugInfo.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'clang/lib/CodeGen/CGDebugInfo.h') diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h index 07e57af1208..d480d9bbc87 100644 --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -387,6 +387,16 @@ private: /// invalid then use current location. /// \param Force Assume DebugColumnInfo option is true. unsigned getColumnNumber(SourceLocation Loc, bool Force=false); + + /// internString - Allocate a copy of \p A using the DebugInfoNames allocator + /// and return a reference to it. If multiple arguments are given the strings + /// are concatenated. + StringRef internString(StringRef A, StringRef B = StringRef()) { + char *Data = DebugInfoNames.Allocate(A.size() + B.size()); + std::memcpy(Data, A.data(), A.size()); + std::memcpy(Data + A.size(), B.data(), B.size()); + return StringRef(Data, A.size() + B.size()); + } }; /// NoLocation - An RAII object that temporarily disables debug -- cgit v1.2.3