aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Bitcode
diff options
context:
space:
mode:
authorVictor Hernandez <vhernandez@apple.com>2010-01-12 23:37:59 +0000
committerVictor Hernandez <vhernandez@apple.com>2010-01-12 23:37:59 +0000
commit994a2045704601932467e5a773a589d8d3aee6f1 (patch)
tree9dcd88d5307e37a9667b0a8bd881b1b60a71c5dc /lib/Bitcode
parent86af65552172c9149996600bc3f55bed6f949c8a (diff)
downloadexternal_llvm-994a2045704601932467e5a773a589d8d3aee6f1.zip
external_llvm-994a2045704601932467e5a773a589d8d3aee6f1.tar.gz
external_llvm-994a2045704601932467e5a773a589d8d3aee6f1.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.cpp5
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;