[PATCH] D19570: [PDB] Parse module information from the DBI stream

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 18:38:44 PDT 2016


ruiu added inline comments.

================
Comment at: lib/DebugInfo/PDB/Raw/ModInfo.cpp:64
@@ +63,3 @@
+  StringRef getObjectFileName() const {
+    return StringRef(getModuleName().end() + 1);
+  }
----------------
zturner wrote:
> majnemer wrote:
> > Incrementing an iterator past end looks suspicious.
> In the general case I agree, but in this case we have two null terminated strings stored back to back in a variable length structure, so this seems like the most elegant way to express that.  Otherwise it's going to end up just being equivalent code but more verbose, since I will have to save off the module name into a temporary, then call module.data() + module.length() + 1.
Yeah, I agree with Zach. This is where we intentionally overrun the end of the array to access stuff next to the string. This makes me wonder if C++ supports flexible array members.


http://reviews.llvm.org/D19570





More information about the llvm-commits mailing list