Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(869)

Unified Diff: lib/Transforms/NaCl/FlattenGlobals.cpp

Issue 29743003: Add passes for applying SFI sandboxing at the LLVM IR level Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Retry upload Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/Transforms/NaCl/CMakeLists.txt ('k') | lib/Transforms/NaCl/ReplacePtrsWithInts.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Transforms/NaCl/FlattenGlobals.cpp
diff --git a/lib/Transforms/NaCl/FlattenGlobals.cpp b/lib/Transforms/NaCl/FlattenGlobals.cpp
index 6f9ceb35961d760be9676bf7641ecf902bd9ec61..dadd5195b86631b7d6b18198a9b57a1e85d104f0 100644
--- a/lib/Transforms/NaCl/FlattenGlobals.cpp
+++ b/lib/Transforms/NaCl/FlattenGlobals.cpp
@@ -136,6 +136,9 @@ static void ExpandConstant(DataLayout *DL, Constant *Val,
SmallVector<Value *, 8> Indexes(CE->op_begin() + 1, CE->op_end());
*ResultOffset += DL->getIndexedOffset(CE->getOperand(0)->getType(),
Indexes);
+ } else if (CE->getOpcode() == Instruction::Add &&
+ isa<ConstantInt>(CE->getOperand(1))) {
+ *ResultOffset += cast<ConstantInt>(CE->getOperand(1))->getZExtValue();
} else if (CE->getOpcode() == Instruction::BitCast ||
CE->getOpcode() == Instruction::IntToPtr) {
// Nothing more to do.
« no previous file with comments | « lib/Transforms/NaCl/CMakeLists.txt ('k') | lib/Transforms/NaCl/ReplacePtrsWithInts.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698