mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 21:24:00 +00:00
Debug Info: drop debug info via upgrading path if version number does not match.
Add a helper function getDebugInfoVersionFromModule to return the debug info version number for a module. "Verifier/module-flags-1.ll" checks for verification errors. It will seg fault when calling getDebugInfoVersionFromModule because of the incorrect format for module flags in the testing case. We make getModuleFlagsMetadata more robust by checking for error conditions. PR17982 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196158 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -318,11 +318,16 @@ getModuleFlagsMetadata(SmallVectorImpl<ModuleFlagEntry> &Flags) const {
|
||||
|
||||
for (unsigned i = 0, e = ModFlags->getNumOperands(); i != e; ++i) {
|
||||
MDNode *Flag = ModFlags->getOperand(i);
|
||||
ConstantInt *Behavior = cast<ConstantInt>(Flag->getOperand(0));
|
||||
MDString *Key = cast<MDString>(Flag->getOperand(1));
|
||||
Value *Val = Flag->getOperand(2);
|
||||
Flags.push_back(ModuleFlagEntry(ModFlagBehavior(Behavior->getZExtValue()),
|
||||
Key, Val));
|
||||
if (Flag->getNumOperands() >= 3 && isa<ConstantInt>(Flag->getOperand(0)) &&
|
||||
isa<MDString>(Flag->getOperand(1))) {
|
||||
// Check the operands of the MDNode before accessing the operands.
|
||||
// The verifier will actually catch these failures.
|
||||
ConstantInt *Behavior = cast<ConstantInt>(Flag->getOperand(0));
|
||||
MDString *Key = cast<MDString>(Flag->getOperand(1));
|
||||
Value *Val = Flag->getOperand(2);
|
||||
Flags.push_back(ModuleFlagEntry(ModFlagBehavior(Behavior->getZExtValue()),
|
||||
Key, Val));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user