[PATCH] D34059: Get the file name for the symbol from the Module, not the SourceManager.
Vassil Vassilev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 9 09:33:14 PDT 2017
v.g.vassilev created this revision.
This allows multi-module / incremental compilation environments to have unique initializer symbols.
Patch by Axel Naumann!
Repository:
rL LLVM
https://reviews.llvm.org/D34059
Files:
lib/CodeGen/CGDeclCXX.cpp
Index: lib/CodeGen/CGDeclCXX.cpp
===================================================================
--- lib/CodeGen/CGDeclCXX.cpp
+++ lib/CodeGen/CGDeclCXX.cpp
@@ -449,16 +449,12 @@
PrioritizedCXXGlobalInits.clear();
}
- SmallString<128> FileName;
- SourceManager &SM = Context.getSourceManager();
- if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID())) {
- // Include the filename in the symbol name. Including "sub_" matches gcc and
- // makes sure these symbols appear lexicographically behind the symbols with
- // priority emitted above.
- FileName = llvm::sys::path::filename(MainFile->getName());
- } else {
+ // Include the filename in the symbol name. Including "sub_" matches gcc and
+ // makes sure these symbols appear lexicographically behind the symbols with
+ // priority emitted above.
+ SmallString<128> FileName = llvm::sys::path::filename(getModule().getName());
+ if (FileName.empty())
FileName = "<null>";
- }
for (size_t i = 0; i < FileName.size(); ++i) {
// Replace everything that's not [a-zA-Z0-9._] with a _. This set happens
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34059.102048.patch
Type: text/x-patch
Size: 1120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170609/ae53e0b3/attachment.bin>
More information about the cfe-commits
mailing list