[MS] Mangle a hash of the main file path into anonymous namespaces
authorReid Kleckner <rnk@google.com>
Fri, 17 Aug 2018 20:59:27 +0000 (20:59 +0000)
committerReid Kleckner <rnk@google.com>
Fri, 17 Aug 2018 20:59:27 +0000 (20:59 +0000)
commitdf8dd61f2309124689b07844e47abddf46203d4e
tree32354278182035ccba0880108097a8da559b3473
parentf6e36ee83e1cd5c881b450561a021e834acc9810
[MS] Mangle a hash of the main file path into anonymous namespaces

Summary:
This is needed to avoid conflicts in mangled names for codeview types in
anonymous namespaces. In CodeView, types refer to each other typically
through forward declarations, which contain mangled names. These names
have to be unique, otherwise the debugger will look up the mangled name
and find the wrong definition.

Furthermore, ThinLTO will deduplicate the types, and debug info
verification can fail when the types have the wrong sizes. This is
PR38608.

Fixes PR38609.

Reviewers: majnemer, inglorion, hans

Subscribers: mehdi_amini, aprantl, JDevlieghere, dexonsmith, cfe-commits

Differential Revision: https://reviews.llvm.org/D50877

llvm-svn: 340079
14 files changed:
clang/lib/AST/MicrosoftMangle.cpp
clang/test/CodeGenCXX/cfi-cross-dso.cpp
clang/test/CodeGenCXX/cfi-icall.cpp
clang/test/CodeGenCXX/debug-info-thunk.cpp
clang/test/CodeGenCXX/dllexport.cpp
clang/test/CodeGenCXX/mangle-ms.cpp
clang/test/CodeGenCXX/microsoft-abi-structors.cpp
clang/test/CodeGenCXX/microsoft-abi-throw.cpp
clang/test/CodeGenCXX/microsoft-abi-thunks.cpp
clang/test/CodeGenCXX/microsoft-abi-vftables.cpp
clang/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp
clang/test/CodeGenCXX/msabi-swiftcall-cc.cpp
clang/test/CodeGenCXX/pragma-init_seg.cpp
clang/test/CodeGenCXX/type-metadata.cpp