[PATCH] Add a fallback mechanism for undefined atom.

Shankar Kalpathi Easwaran shankarke at gmail.com
Thu Sep 12 09:26:41 PDT 2013



================
Comment at: lib/ReaderWriter/Native/NativeFileFormat.h:171-179
@@ -169,2 +170,11 @@
 
+//
+// The NCS_UndefinedAtomsV2 chunk contains an array of these structs
+//
+struct NativeUndefinedAtomIvarsV2 {
+  uint32_t  nameOffset;
+  uint32_t  flags;
+  uint32_t  fallbackNameOffset;
+};
+
 
----------------
We should just add the fallbackNameOffset to V1 (or) if you want to still do this, you could derive the second struct from the first one.

struct NativeUndefinedAtomIvarsV2 : public NativeUndefinedAtomIvarsV1

================
Comment at: lib/ReaderWriter/Native/ReaderNative.cpp:932
@@ +931,3 @@
+    return nullptr;
+  if (!_fallback.get())
+    _fallback.reset(new SimpleUndefinedAtom(
----------------
if (!_fallback) is sufficient.

================
Comment at: lib/ReaderWriter/Native/ReaderNative.cpp:935-936
@@ +934,4 @@
+        *_file, _file->string(_ivarData->fallbackNameOffset)));
+  const lld::UndefinedAtom *ret = _fallback.get();
+  return ret;
+}
----------------
return *_fallback

================
Comment at: lib/ReaderWriter/YAML/ReaderWriterYAML.cpp:962
@@ +961,3 @@
+        : _file(fileFromContext(io)), _name(), _canBeNull(canBeNullNever),
+          _fallback(0) {}
+
----------------
_fallback(nullptr)

================
Comment at: lib/ReaderWriter/YAML/ReaderWriterYAML.cpp:1009
@@ -1002,2 +1008,3 @@
                    lld::UndefinedAtom::canBeNullNever);
+    io.mapOptional("fallback", keys->_fallback, (const lld::UndefinedAtom *)0);
   }
----------------
 (const lld::UndefinedAtom *)0) ->  (const lld::UndefinedAtom *)nullptr)


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



More information about the llvm-commits mailing list