diff options
author | Bill Wendling <isanbard@gmail.com> | 2009-03-09 05:04:40 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2009-03-09 05:04:40 +0000 |
commit | ccbdc7ab82792ac5d7863ef086f11fb010d88073 (patch) | |
tree | 8fd761b3482c8df9272eac68f507776b394f2d32 /include | |
parent | bce6091d95b7fd56d7c6760b0de54fb6c4300539 (diff) | |
download | external_llvm-ccbdc7ab82792ac5d7863ef086f11fb010d88073.zip external_llvm-ccbdc7ab82792ac5d7863ef086f11fb010d88073.tar.gz external_llvm-ccbdc7ab82792ac5d7863ef086f11fb010d88073.tar.bz2 |
Pass in a std::string when getting the names of debugging things. This cuts down
on the number of times a std::string is created and copied.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66396 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/DebugInfo.h | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h index 91e64d8..c1be646 100644 --- a/include/llvm/Analysis/DebugInfo.h +++ b/include/llvm/Analysis/DebugInfo.h @@ -40,7 +40,7 @@ namespace llvm { /// not, the debug info is corrupt and we ignore it. DIDescriptor(GlobalVariable *GV, unsigned RequiredTag); - std::string getStringField(unsigned Elt) const; + const std::string &getStringField(unsigned Elt, std::string &Result) const; unsigned getUnsignedField(unsigned Elt) const { return (unsigned)getUInt64Field(Elt); } @@ -106,9 +106,15 @@ namespace llvm { explicit DICompileUnit(GlobalVariable *GV = 0); unsigned getLanguage() const { return getUnsignedField(2); } - std::string getFilename() const { return getStringField(3); } - std::string getDirectory() const { return getStringField(4); } - std::string getProducer() const { return getStringField(5); } + const std::string &getFilename(std::string &F) const { + return getStringField(3, F); + } + const std::string &getDirectory(std::string &F) const { + return getStringField(4, F); + } + const std::string &getProducer(std::string &F) const { + return getStringField(5, F); + } /// isMain - Each input file is encoded as a separate compile unit in LLVM /// debugging information output. However, many target specific tool chains @@ -121,7 +127,9 @@ namespace llvm { bool isMain() const { return getUnsignedField(6); } bool isOptimized() const { return getUnsignedField(7); } - std::string getFlags() const { return getStringField(8); } + const std::string &getFlags(std::string &F) const { + return getStringField(8, F); + } unsigned getRunTimeVersion() const { return getUnsignedField(9); } /// Verify - Verify that a compile unit is well formed. @@ -138,7 +146,9 @@ namespace llvm { public: explicit DIEnumerator(GlobalVariable *GV = 0); - std::string getName() const { return getStringField(1); } + const std::string &getName(std::string &F) const { + return getStringField(1, F); + } uint64_t getEnumValue() const { return getUInt64Field(2); } }; @@ -182,7 +192,9 @@ namespace llvm { virtual ~DIType() {} DIDescriptor getContext() const { return getDescriptorField(1); } - std::string getName() const { return getStringField(2); } + const std::string &getName(std::string &F) const { + return getStringField(2, F); + } DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); } unsigned getLineNumber() const { return getUnsignedField(4); } uint64_t getSizeInBits() const { return getUInt64Field(5); } @@ -264,9 +276,15 @@ namespace llvm { virtual ~DIGlobal() {} DIDescriptor getContext() const { return getDescriptorField(2); } - std::string getName() const { return getStringField(3); } - std::string getDisplayName() const { return getStringField(4); } - std::string getLinkageName() const { return getStringField(5); } + const std::string &getName(std::string &F) const { + return getStringField(3, F); + } + const std::string &getDisplayName(std::string &F) const { + return getStringField(4, F); + } + const std::string &getLinkageName(std::string &F) const { + return getStringField(5, F); + } DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(6); } unsigned getLineNumber() const { return getUnsignedField(7); } DIType getType() const { return getFieldAs<DIType>(8); } @@ -313,7 +331,9 @@ namespace llvm { explicit DIVariable(GlobalVariable *GV = 0); DIDescriptor getContext() const { return getDescriptorField(1); } - std::string getName() const { return getStringField(2); } + const std::string &getName(std::string &F) const { + return getStringField(2, F); + } DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); } unsigned getLineNumber() const { return getUnsignedField(4); } DIType getType() const { return getFieldAs<DIType>(5); } |