diff options
author | Chris Lattner <sabre@nondot.org> | 2007-04-26 03:27:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-04-26 03:27:58 +0000 |
commit | 198f34ac359c48018c6e1f784cf3770ead63b253 (patch) | |
tree | 1c1ad5f52cfed048089a3aec007ec27de6dac99f /lib/Bitcode/Writer/ValueEnumerator.cpp | |
parent | eb0107af86b9dde84cc1f57876f0cefc6707a919 (diff) |
move some code around, fix a bug in the reader reading globalinits (which
I just introduced), stub out function reading, purge aggregate values from
the value table before reading functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36463 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Writer/ValueEnumerator.cpp')
-rw-r--r-- | lib/Bitcode/Writer/ValueEnumerator.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Bitcode/Writer/ValueEnumerator.cpp b/lib/Bitcode/Writer/ValueEnumerator.cpp index 1172c4fa21..c22dbf7d54 100644 --- a/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -140,6 +140,22 @@ void ValueEnumerator::EnumerateType(const Type *Ty) { EnumerateType(*I); } +/// PurgeAggregateValues - If there are any aggregate values at the end of the +/// value list, remove them and return the count of the remaining values. If +/// there are none, return -1. +int ValueEnumerator::PurgeAggregateValues() { + // If there are no aggregate values at the end of the list, return -1. + if (Values.empty() || Values.back().first->getType()->isFirstClassType()) + return -1; + + // Otherwise, remove aggregate values... + while (!Values.empty() && !Values.back().first->getType()->isFirstClassType()) + Values.pop_back(); + + // ... and return the new size. + return Values.size(); +} + #if 0 |