Fix variable name style. Don't cast to and from int.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 11 Jun 2013 15:29:10 +0000 (15:29 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 11 Jun 2013 15:29:10 +0000 (15:29 +0000)
This enables the compiler to see the enum and produce warnings about a switch
not being fully covered. Fix one of these warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183749 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/FileSystem.h
lib/Object/ObjectFile.cpp

index 9c74554a858da91b9e4de39d410e91b4d0b87915..f861f79e2c71cd10e249b44335dbaa92f7d4643a 100644 (file)
@@ -181,7 +181,7 @@ public:
 /// file_magic - An "enum class" enumeration of file types based on magic (the first
 ///         N bytes of the file).
 struct file_magic {
-  enum _ {
+  enum Impl {
     unknown = 0,              ///< Unrecognized file
     bitcode,                  ///< Bitcode file
     archive,                  ///< ar style archive file
@@ -204,16 +204,15 @@ struct file_magic {
   };
 
   bool is_object() const {
-    return v_ == unknown ? false : true;
+    return V == unknown ? false : true;
   }
 
-  file_magic() : v_(unknown) {}
-  file_magic(_ v) : v_(v) {}
-  explicit file_magic(int v) : v_(_(v)) {}
-  operator int() const {return v_;}
+  file_magic() : V(unknown) {}
+  file_magic(Impl V) : V(V) {}
+  operator Impl() const { return V; }
 
 private:
-  int v_;
+  Impl V;
 };
 
 /// @}
index b5f666f27fa068328c027ff68c4afe53dc7c0609..3ec29bf7e75e78cb57049ffd5d9474fb4668fc62 100644 (file)
@@ -44,6 +44,8 @@ ObjectFile *ObjectFile::createObjectFile(MemoryBuffer *Object) {
   sys::fs::file_magic Type = sys::fs::identify_magic(Object->getBuffer());
   switch (Type) {
   case sys::fs::file_magic::unknown:
+  case sys::fs::file_magic::bitcode:
+  case sys::fs::file_magic::archive:
     return 0;
   case sys::fs::file_magic::elf_relocatable:
   case sys::fs::file_magic::elf_executable: