mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Clean up static analyzer warnings.
Clang's static analyzer found several potential cases of undefined behavior, use of un-initialized values, and potentially null pointer dereferences in tablegen, Support, MC, and ADT. This cleans them up with specific assertions on the assumptions of the code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224154 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2569,8 +2569,10 @@ FindPatternInputsAndOutputs(TreePattern *I, TreePatternNode *Pat,
|
||||
I->error("set destination should be a register!");
|
||||
|
||||
DefInit *Val = dyn_cast<DefInit>(Dest->getLeafValue());
|
||||
if (!Val)
|
||||
if (!Val) {
|
||||
I->error("set destination should be a register!");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Val->getDef()->isSubClassOf("RegisterClass") ||
|
||||
Val->getDef()->isSubClassOf("ValueType") ||
|
||||
|
@@ -537,7 +537,7 @@ bool CodeGenInstAlias::tryAliasOpMatch(DagInit *Result, unsigned AliasOpNo,
|
||||
// If both are Operands with the same MVT, allow the conversion. It's
|
||||
// up to the user to make sure the values are appropriate, just like
|
||||
// for isel Pat's.
|
||||
if (InstOpRec->isSubClassOf("Operand") &&
|
||||
if (InstOpRec->isSubClassOf("Operand") && ADI &&
|
||||
ADI->getDef()->isSubClassOf("Operand")) {
|
||||
// FIXME: What other attributes should we check here? Identical
|
||||
// MIOperandInfo perhaps?
|
||||
|
@@ -146,6 +146,7 @@ void CodeGenRegister::buildObjectGraph(CodeGenRegBank &RegBank) {
|
||||
}
|
||||
|
||||
const std::string &CodeGenRegister::getName() const {
|
||||
assert(TheDef && "no def");
|
||||
return TheDef->getName();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user