llvm.org GIT mirror llvm / c5198dc
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 Alexey Samsonov 6 years ago
2 changed file(s) with 3 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
4444 return StringRef(".loh");
4545 }
4646
47 static inline bool isValidMCLOHType(MCLOHType Kind) {
47 static inline bool isValidMCLOHType(unsigned Kind) {
4848 return Kind >= MCLOH_AdrpAdrp && Kind <= MCLOH_AdrpLdrGot;
4949 }
5050
39843984 // We successfully get a numeric value for the identifier.
39853985 // Check if it is valid.
39863986 int64_t Id = getParser().getTok().getIntVal();
3987 if (Id <= -1U && !isValidMCLOHType(Id))
3988 return TokError("invalid numeric identifier in directive");
39873989 Kind = (MCLOHType)Id;
3988 // Check that Id does not overflow MCLOHType.
3989 if (!isValidMCLOHType(Kind) || Id != Kind)
3990 return TokError("invalid numeric identifier in directive");
39913990 } else {
39923991 StringRef Name = getTok().getIdentifier();
39933992 // We successfully parse an identifier.