[PATCH] Don't segfault in EmitCXXGlobalInitFunc when main file is a membuf
Richard Smith
richard at metafoo.co.uk
Sun Aug 24 22:02:46 PDT 2014
================
Comment at: lib/CodeGen/CGDeclCXX.cpp:415
@@ +414,3 @@
+ SourceManager &SM = Context.getSourceManager();
+ if (SM.getFileEntryForID(SM.getMainFileID())) {
+ // Include the filename in the symbol name. Including "sub_" matches gcc and
----------------
if (FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID())) {
================
Comment at: lib/CodeGen/CGDeclCXX.cpp:420
@@ +419,3 @@
+ SmallString<128> FileName(llvm::sys::path::filename(
+ SM.getFileEntryForID(SM.getMainFileID())->getName()));
+ for (size_t i = 0; i < FileName.size(); ++i) {
----------------
MainFile->getName()));
http://reviews.llvm.org/D5043
More information about the cfe-commits
mailing list