[PATCH] Add a fallback mechanism for undefined atom.
Rui Ueyama
ruiu at google.com
Thu Sep 12 12:14:03 PDT 2013
================
Comment at: lib/ReaderWriter/Native/ReaderNative.cpp:932
@@ +931,3 @@
+ return nullptr;
+ if (!_fallback.get())
+ _fallback.reset(new SimpleUndefinedAtom(
----------------
Shankar Kalpathi Easwaran wrote:
> if (!_fallback) is sufficient.
done.
================
Comment at: lib/ReaderWriter/Native/ReaderNative.cpp:935-936
@@ +934,4 @@
+ *_file, _file->string(_ivarData->fallbackNameOffset)));
+ const lld::UndefinedAtom *ret = _fallback.get();
+ return ret;
+}
----------------
Shankar Kalpathi Easwaran wrote:
> return *_fallback
done.
================
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;
+};
+
----------------
Shankar Kalpathi Easwaran wrote:
> 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
done.
================
Comment at: lib/ReaderWriter/YAML/ReaderWriterYAML.cpp:962
@@ +961,3 @@
+ : _file(fileFromContext(io)), _name(), _canBeNull(canBeNullNever),
+ _fallback(0) {}
+
----------------
Shankar Kalpathi Easwaran wrote:
> _fallback(nullptr)
done.
================
Comment at: lib/ReaderWriter/YAML/ReaderWriterYAML.cpp:1009
@@ -1002,2 +1008,3 @@
lld::UndefinedAtom::canBeNullNever);
+ io.mapOptional("fallback", keys->_fallback, (const lld::UndefinedAtom *)0);
}
----------------
Shankar Kalpathi Easwaran wrote:
> (const lld::UndefinedAtom *)0) -> (const lld::UndefinedAtom *)nullptr)
done.
http://llvm-reviews.chandlerc.com/D1550
More information about the llvm-commits
mailing list