summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.h
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-09-09 16:39:06 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-09-09 16:39:06 +0000
commit1b18a5ec2863d3345073576227fb67cbb6a4f13a (patch)
tree89a264bfc83c4432a129980bfaed7a43a691c350 /clang/lib/CodeGen/CGDebugInfo.h
parent7037021e78454ff191cd8c2bf796745fba844c2f (diff)
downloadbcm5719-llvm-1b18a5ec2863d3345073576227fb67cbb6a4f13a.tar.gz
bcm5719-llvm-1b18a5ec2863d3345073576227fb67cbb6a4f13a.zip
CGDebugInfo: Hoist string allocation in a helper function. No functionality change.
llvm-svn: 190314
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.h')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.h10
1 files changed, 10 insertions, 0 deletions
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<char>(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
OpenPOWER on IntegriCloud