summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-06-11 15:29:10 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-06-11 15:29:10 +0000
commit447d2d12f0d4a41feeb88341bddbaa79c36a5103 (patch)
treeefd7e45d7573e9a35e90943042d388f6d9474dff
parent978460c12c7f7a186a58254509218d3aaa23a6ce (diff)
downloadbcm5719-llvm-447d2d12f0d4a41feeb88341bddbaa79c36a5103.tar.gz
bcm5719-llvm-447d2d12f0d4a41feeb88341bddbaa79c36a5103.zip
Fix variable name style. Don't cast to and from int.
This enables the compiler to see the enum and produce warnings about a switch not being fully covered. Fix one of these warnings. llvm-svn: 183749
-rw-r--r--llvm/include/llvm/Support/FileSystem.h13
-rw-r--r--llvm/lib/Object/ObjectFile.cpp2
2 files changed, 8 insertions, 7 deletions
diff --git a/llvm/include/llvm/Support/FileSystem.h b/llvm/include/llvm/Support/FileSystem.h
index 9c74554a858..f861f79e2c7 100644
--- a/llvm/include/llvm/Support/FileSystem.h
+++ b/llvm/include/llvm/Support/FileSystem.h
@@ -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;
};
/// @}
diff --git a/llvm/lib/Object/ObjectFile.cpp b/llvm/lib/Object/ObjectFile.cpp
index b5f666f27fa..3ec29bf7e75 100644
--- a/llvm/lib/Object/ObjectFile.cpp
+++ b/llvm/lib/Object/ObjectFile.cpp
@@ -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:
OpenPOWER on IntegriCloud