[Support] Return an enum instead of an unsigned; NFC.
authorGeorge Burgess IV <george.burgess.iv@gmail.com>
Wed, 17 Jan 2018 03:12:06 +0000 (03:12 +0000)
committerGeorge Burgess IV <george.burgess.iv@gmail.com>
Wed, 17 Jan 2018 03:12:06 +0000 (03:12 +0000)
We seem to be (logically) returning ArchExtKinds here in all cases, so
the return type should reflect that.

The static_cast is necessary because `A.ID` is actually an `unsigned`,
presumably since we use `decltype(A)` to represent extended attributes
for both ARM and AArch64, which use distinct `ArchExtKinds`.

We can't trivially make the same change for ARM, because one of the
values it returns is the bitwise-or of two `ARM::ArchExtKind`s.

llvm-svn: 322613

llvm/include/llvm/Support/TargetParser.h
llvm/lib/Support/TargetParser.cpp

index 13b7bef..2c019e1 100644 (file)
@@ -203,7 +203,7 @@ StringRef getDefaultCPU(StringRef Arch);
 // Parser
 unsigned parseFPU(StringRef FPU);
 AArch64::ArchKind parseArch(StringRef Arch);
-unsigned parseArchExt(StringRef ArchExt);
+ArchExtKind parseArchExt(StringRef ArchExt);
 ArchKind parseCPUArch(StringRef CPU);
 ARM::ISAKind parseArchISA(StringRef Arch);
 ARM::EndianKind parseArchEndian(StringRef Arch);
index 6868415..5f288ff 100644 (file)
@@ -868,10 +868,10 @@ AArch64::ArchKind AArch64::parseArch(StringRef Arch) {
   return ArchKind::INVALID;
 }
 
-unsigned llvm::AArch64::parseArchExt(StringRef ArchExt) {
+AArch64::ArchExtKind llvm::AArch64::parseArchExt(StringRef ArchExt) {
   for (const auto A : AArch64ARCHExtNames) {
     if (ArchExt == A.getName())
-      return A.ID;
+      return static_cast<ArchExtKind>(A.ID);
   }
   return AArch64::AEK_INVALID;
 }