[PATCH] D50877: [MS] Mangle a hash of the main file path into anonymous namespaces

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 17 11:38:28 PDT 2018


rnk marked an inline comment as done.
rnk added a comment.

Exactly, this makes our names match MSVC more closely. Their hash depends on the path to the main source file. It doesn't care if the file is in a header. However, they use the absolute path to the file instead of the (probably relative) path to the file passed by the build system on the command line. I think my approach of using the spelling of the path on the command line will play better with distributed build systems, since you can imagine multiple distributed workers compiling at different absolute paths.



================
Comment at: clang/lib/AST/MicrosoftMangle.cpp:389
+  if (FE) {
+    llvm::MD5 Hasher;
+    llvm::MD5::MD5Result Hash;
----------------
inglorion wrote:
> Instead of MD5, can we use xxhash (or whatever the fastest hash algorithm in LLVM is these days)? I don't think we need a particular hash algorithm, so we might as well go with the fastest one we have (as long as it does a good job avoiding collisions, of course).
Sure. It's not visible in the ABI, so we're free to change it at any point later.


https://reviews.llvm.org/D50877





More information about the cfe-commits mailing list