mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-11 21:38:19 +00:00
Make isValidMCLOHType take unsigned instead of enum to avoid loading invalid enum values
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216797 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -45,7 +45,7 @@ static inline StringRef MCLOHDirectiveName() {
|
|||||||
return StringRef(".loh");
|
return StringRef(".loh");
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool isValidMCLOHType(MCLOHType Kind) {
|
static inline bool isValidMCLOHType(unsigned Kind) {
|
||||||
return Kind >= MCLOH_AdrpAdrp && Kind <= MCLOH_AdrpLdrGot;
|
return Kind >= MCLOH_AdrpAdrp && Kind <= MCLOH_AdrpLdrGot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3985,10 +3985,9 @@ bool AArch64AsmParser::parseDirectiveLOH(StringRef IDVal, SMLoc Loc) {
|
|||||||
// We successfully get a numeric value for the identifier.
|
// We successfully get a numeric value for the identifier.
|
||||||
// Check if it is valid.
|
// Check if it is valid.
|
||||||
int64_t Id = getParser().getTok().getIntVal();
|
int64_t Id = getParser().getTok().getIntVal();
|
||||||
Kind = (MCLOHType)Id;
|
if (Id <= -1U && !isValidMCLOHType(Id))
|
||||||
// Check that Id does not overflow MCLOHType.
|
|
||||||
if (!isValidMCLOHType(Kind) || Id != Kind)
|
|
||||||
return TokError("invalid numeric identifier in directive");
|
return TokError("invalid numeric identifier in directive");
|
||||||
|
Kind = (MCLOHType)Id;
|
||||||
} else {
|
} else {
|
||||||
StringRef Name = getTok().getIdentifier();
|
StringRef Name = getTok().getIdentifier();
|
||||||
// We successfully parse an identifier.
|
// We successfully parse an identifier.
|
||||||
|
Reference in New Issue
Block a user