diff options
| author | Victor Hernandez <vhernandez@apple.com> | 2010-01-12 23:37:59 +0000 |
|---|---|---|
| committer | Victor Hernandez <vhernandez@apple.com> | 2010-01-12 23:37:59 +0000 |
| commit | fddd336434fb476e74356788d1fb39f952a50e0e (patch) | |
| tree | 9dcd88d5307e37a9667b0a8bd881b1b60a71c5dc /lib/Bitcode | |
| parent | c244ae65b53cfbd544b960c4ed1c344f729ea728 (diff) | |
| download | external_llvm-fddd336434fb476e74356788d1fb39f952a50e0e.zip external_llvm-fddd336434fb476e74356788d1fb39f952a50e0e.tar.gz external_llvm-fddd336434fb476e74356788d1fb39f952a50e0e.tar.bz2 | |
Make WriteConstants() more robust against stray values in ValueEnumerator's ValueList
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93270 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode')
| -rw-r--r-- | lib/Bitcode/Writer/BitcodeWriter.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 26c922a..fd1bade 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -688,6 +688,11 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal, Record.clear(); continue; } + + // Ignore all values in ValueList except for Constants. + if (V && (isa<Instruction>(V) || isa<Argument>(V))) + continue; + const Constant *C = cast<Constant>(V); unsigned Code = -1U; unsigned AbbrevToUse = 0; |
