Remove comparison of this with nullptr

GCC6 optimizes it out, leading to crash.

Change-Id: I8425d456c1364929d135ce3860121b8098bab1f7
Reviewed-on: https://chromium-review.googlesource.com/413120
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Orgad Shaneh 2016-11-19 20:49:04 +02:00 committed by Mike Frysinger
parent 7a8980997d
commit 87e444e17d
2 changed files with 9 additions and 13 deletions

View File

@ -41,10 +41,7 @@ Section::Section(const Dump &dump)
: test_assembler::Section(dump.endianness()) { } : test_assembler::Section(dump.endianness()) { }
void Section::CiteLocationIn(test_assembler::Section *section) const { void Section::CiteLocationIn(test_assembler::Section *section) const {
if (this)
(*section).D32(size_).D32(file_offset_); (*section).D32(size_).D32(file_offset_);
else
(*section).D32(0).D32(0);
} }
void Stream::CiteStreamIn(test_assembler::Section *section) const { void Stream::CiteStreamIn(test_assembler::Section *section) const {
@ -272,8 +269,14 @@ Module::Module(const Dump &dump,
D32(version_info.file_subtype); D32(version_info.file_subtype);
D32(version_info.file_date_hi); D32(version_info.file_date_hi);
D32(version_info.file_date_lo); D32(version_info.file_date_lo);
if (cv_record)
cv_record->CiteLocationIn(this); cv_record->CiteLocationIn(this);
else
D32(0).D32(0);
if (misc_record)
misc_record->CiteLocationIn(this); misc_record->CiteLocationIn(this);
else
D32(0).D32(0);
D64(0).D64(0); D64(0).D64(0);
} }

View File

@ -138,13 +138,6 @@ class Section: public test_assembler::Section {
explicit Section(const Dump &dump); explicit Section(const Dump &dump);
// Append an MDLocationDescriptor referring to this section to SECTION. // Append an MDLocationDescriptor referring to this section to SECTION.
// If 'this' is NULL, append a descriptor with a zero length and MDRVA.
//
// (I couldn't find the language in the C++ standard that says that
// invoking member functions of a NULL pointer to a class type is
// bad, if such language exists. Having this function handle NULL
// 'this' is convenient, but if it causes trouble, it's not hard to
// do differently.)
void CiteLocationIn(test_assembler::Section *section) const; void CiteLocationIn(test_assembler::Section *section) const;
// Note that this section's contents are complete, and that it has // Note that this section's contents are complete, and that it has