aboutsummaryrefslogtreecommitdiff
path: root/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h
diff options
context:
space:
mode:
authorMark Seaborn <mseaborn@chromium.org>2013-06-26 14:45:52 -0700
committerMark Seaborn <mseaborn@chromium.org>2013-06-26 14:45:52 -0700
commitdc80ae361ec894a266815c078d92c78233acf542 (patch)
tree7c14196694572389c80c32ef3afb50c8eb57cfdd /lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h
parente5a1ea0182c046ca81398e15488db2b2f7ba6105 (diff)
PNaCl wire format: Disallow duplicate FORWARDTYPEREFs for the same value ID
Change the reader to be stricter so that duplicate FORWARDTYPEREFs are rejected. Also fix typo in error message. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3507 TEST=see "Invalid FORWARDTYPEREF record" if EmitFnForwardTypeRef() is changed to produce unnecessary FORWARDTYPEREFs Review URL: https://codereview.chromium.org/17925002
Diffstat (limited to 'lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h')
-rw-r--r--lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h
index 5256e07134..cacd971286 100644
--- a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h
+++ b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h
@@ -77,8 +77,10 @@ public:
ValuePtrs.resize(N);
}
- // Gets or creates the forward reference value for Idx with the given type.
- Value *getOrCreateValueFwdRef(unsigned Idx, Type *Ty);
+ // Declares the type of the forward-referenced value Idx. Returns
+ // true if an error occurred. It is an error if Idx's type has
+ // already been declared.
+ bool createValueFwdRef(unsigned Idx, Type *Ty);
Constant *getConstantFwdRef(unsigned Idx, Type *Ty);
@@ -207,11 +209,6 @@ private:
(!AcceptSupportedBitcodeOnly && Header.IsReadable()));
}
Type *getTypeByID(unsigned ID);
- // Gets or creates the (function-level) forward referenced value for
- // ID with the given type.
- Value *getOrCreateFnValueByID(unsigned ID, Type *Ty) {
- return ValueList.getOrCreateValueFwdRef(ID, Ty);
- }
// Returns the value associated with ID. The value must already exist,
// or a forward referenced value created by getOrCreateFnVaueByID.
Value *getFnValueByID(unsigned ID) {