[PATCH] Initial support for Mach-O universal binaries in LLVMObject

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Tue Jun 18 06:54:37 PDT 2013


  There are a few things that need to be fixed, but LGTM.


================
Comment at: include/llvm/Object/Error.h:27
@@ -26,2 +26,3 @@
   success = 0,
+  arch_not_found,
   invalid_file_type,
----------------
You have to handle this in Error.cpp. I just made a change that should make this easier to notice.

================
Comment at: lib/Object/MachOObjectFile.cpp:1300
@@ -1299,3 +1299,3 @@
 
-unsigned MachOObjectFile::getArch() const {
-  switch (getCPUType(this)) {
+/* static */
+Triple::ArchType MachOObjectFile::getArch(uint32_t CPUType) {
----------------
I don't think we normally have comments like this.

================
Comment at: lib/Object/MachOUniversal.cpp:99
@@ +98,3 @@
+    NumberOfObjects(0) {
+  if (!source || source->getBufferSize() < macho::FatHeaderSize) {
+    ec = object_error::invalid_file_type;
----------------
No other object format checks if the buffer is null. The interface should probably take a reference, but for now just remove the check.

Please start variable names with uppercase letters.


================
Comment at: tools/llvm-nm/llvm-nm.cpp:412
@@ +411,3 @@
+    if (object::MachOUniversalBinary *UB =
+            dyn_cast<object::MachOUniversalBinary>(Bin.get())) {
+      for (object::MachOUniversalBinary::object_iterator
----------------
I think you can use just cast in here.


http://llvm-reviews.chandlerc.com/D978

BRANCH
  svn

ARCANIST PROJECT
  llvm



More information about the llvm-commits mailing list