summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDeclCXX.cpp
diff options
context:
space:
mode:
authorVassil Vassilev <v.g.vassilev@gmail.com>2017-08-27 11:27:30 +0000
committerVassil Vassilev <v.g.vassilev@gmail.com>2017-08-27 11:27:30 +0000
commit3d05c56ef25ee3d7cf1741c226a60c4bc6d6dd1a (patch)
treedaecfa517c40a159955f47623ff24cae170cf996 /clang/lib/CodeGen/CGDeclCXX.cpp
parent4d54e543abd5d0a8b0a321f8c292252f4895693a (diff)
downloadbcm5719-llvm-3d05c56ef25ee3d7cf1741c226a60c4bc6d6dd1a.tar.gz
bcm5719-llvm-3d05c56ef25ee3d7cf1741c226a60c4bc6d6dd1a.zip
D34059: Get the file name for the symbol from the Module, not the SourceManager.
This allows multi-module / incremental compilation environments to have unique initializer symbols. Patch by Axel Naumann with minor modifications by me! llvm-svn: 311844
Diffstat (limited to 'clang/lib/CodeGen/CGDeclCXX.cpp')
-rw-r--r--clang/lib/CodeGen/CGDeclCXX.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp
index 98d9e364d9c..4db207cc2da 100644
--- a/clang/lib/CodeGen/CGDeclCXX.cpp
+++ b/clang/lib/CodeGen/CGDeclCXX.cpp
@@ -487,16 +487,12 @@ CodeGenModule::EmitCXXGlobalInitFunc() {
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
OpenPOWER on IntegriCloud