diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 047627a5ff6..b4bc61b7243 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -988,8 +988,11 @@ static StringRef getDIEStringAttr(DIE *Die, unsigned Attr) { /// a trailing NULL with the string. static void addStringToHash(MD5 &Hash, StringRef Str) { DEBUG(dbgs() << "Adding string " << Str << " to hash.\n"); - Hash.update(Str); - Hash.update('\0'); + HashValue SVal((const uint8_t *)Str.data(), Str.size()); + const uint8_t NB = '\0'; + HashValue NBVal((const uint8_t *)&NB, 1); + Hash.update(SVal); + Hash.update(NBVal); } // FIXME: These are copied and only slightly modified out of LEB128.h.