forked from OSchip/llvm-project
Add 'invalid' as a Reference Kind so that unknown/invalid kind strings can return that fact to the caller for use in constructing an error message, rather that triggering an assertion.
llvm-svn: 158547
This commit is contained in:
parent
98bde98897
commit
7145cf6846
|
@ -71,13 +71,16 @@ Reference::Kind KindHandler_x86_64::stringToKind(StringRef str) {
|
|||
.Case("lazyTarget", lazyTarget)
|
||||
.Case("lazyImmediate", lazyImmediate)
|
||||
.Case("subordinateFDE", subordinateFDE)
|
||||
.Case("subordinateLSDA", subordinateLSDA);
|
||||
.Case("subordinateLSDA", subordinateLSDA)
|
||||
.Default(invalid);
|
||||
|
||||
llvm_unreachable("invalid x86_64 Reference kind");
|
||||
}
|
||||
|
||||
StringRef KindHandler_x86_64::kindToString(Reference::Kind kind) {
|
||||
switch ( (Kinds)kind ) {
|
||||
case invalid:
|
||||
return StringRef("invalid");
|
||||
case none:
|
||||
return StringRef("none");
|
||||
case branch32:
|
||||
|
@ -175,6 +178,9 @@ void KindHandler_x86_64::applyFixup(Kind kind, uint64_t addend,
|
|||
case subordinateLSDA:
|
||||
// do nothing
|
||||
break;
|
||||
case invalid:
|
||||
assert(0 && "invalid Reference Kind");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,13 +200,16 @@ Reference::Kind KindHandler_x86::stringToKind(StringRef str) {
|
|||
.Case("funcRel32", funcRel32)
|
||||
.Case("pointer32", pointer32)
|
||||
.Case("lazyTarget", lazyTarget)
|
||||
.Case("lazyImmediate", lazyImmediate);
|
||||
.Case("lazyImmediate", lazyImmediate)
|
||||
.Default(invalid);
|
||||
|
||||
llvm_unreachable("invalid x86 Reference kind");
|
||||
}
|
||||
|
||||
StringRef KindHandler_x86::kindToString(Reference::Kind kind) {
|
||||
switch ( (Kinds)kind ) {
|
||||
case invalid:
|
||||
return StringRef("invalid");
|
||||
case none:
|
||||
return StringRef("none");
|
||||
case branch32:
|
||||
|
@ -263,6 +272,9 @@ void KindHandler_x86::applyFixup(Kind kind, uint64_t addend, uint8_t *location,
|
|||
case subordinateLSDA:
|
||||
// do nothing
|
||||
break;
|
||||
case invalid:
|
||||
assert(0 && "invalid Reference Kind");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -287,13 +299,16 @@ Reference::Kind KindHandler_arm::stringToKind(StringRef str) {
|
|||
.Case("pointer32", pointer32)
|
||||
.Case("lazyTarget", lazyTarget)
|
||||
.Case("lazyImmediate", lazyImmediate)
|
||||
.Case("subordinateLSDA", subordinateLSDA);
|
||||
.Case("subordinateLSDA", subordinateLSDA)
|
||||
.Default(invalid);
|
||||
|
||||
llvm_unreachable("invalid ARM Reference kind");
|
||||
}
|
||||
|
||||
StringRef KindHandler_arm::kindToString(Reference::Kind kind) {
|
||||
switch ( (Kinds)kind ) {
|
||||
case invalid:
|
||||
return StringRef("invalid");
|
||||
case none:
|
||||
return StringRef("none");
|
||||
case thumbBranch22:
|
||||
|
@ -375,6 +390,9 @@ void KindHandler_arm::applyFixup(Kind kind, uint64_t addend, uint8_t *location,
|
|||
case subordinateLSDA:
|
||||
// do nothing
|
||||
break;
|
||||
case invalid:
|
||||
assert(0 && "invalid Reference Kind");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ protected:
|
|||
class KindHandler_x86_64 : public KindHandler {
|
||||
public:
|
||||
enum Kinds {
|
||||
invalid, // used to denote an error creating a Reference
|
||||
none,
|
||||
branch32, // CALL or JMP 32-bit pc-rel
|
||||
ripRel32, // RIP-rel access pc-rel to fix up location
|
||||
|
@ -83,6 +84,7 @@ public:
|
|||
class KindHandler_x86 : public KindHandler {
|
||||
public:
|
||||
enum Kinds {
|
||||
invalid, // used to denote an error creating a Reference
|
||||
none,
|
||||
branch32, // CALL or JMP 32-bit pc-rel
|
||||
abs32, // 32-bit absolute address embedded in instruction
|
||||
|
@ -109,6 +111,7 @@ public:
|
|||
class KindHandler_arm : public KindHandler {
|
||||
public:
|
||||
enum Kinds {
|
||||
invalid, // used to denote an error creating a Reference
|
||||
none,
|
||||
thumbBranch22, // thumb b or bl with 22/24-bits of displacement
|
||||
armBranch24, // arm b or bl with 24-bits of displacement
|
||||
|
|
Loading…
Reference in New Issue