aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.h
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2021-03-05 10:49:47 -0800
committerSriraman Tallam <tmsriram@google.com>2021-03-05 13:32:17 -0800
commit78d0e91865f6038adb23ec272c3e1e7e1525057f (patch)
tree979cfe0411d8350be0954038fa45c1e13fe9050c /clang/lib/CodeGen/CodeGenModule.h
parent7d26916859e9357bc27f96975f33cda0c5657d88 (diff)
downloadllvm-78d0e91865f6038adb23ec272c3e1e7e1525057f.zip
llvm-78d0e91865f6038adb23ec272c3e1e7e1525057f.tar.gz
llvm-78d0e91865f6038adb23ec272c3e1e7e1525057f.tar.bz2
Refactor -funique-internal-linakge-names implementation.
The option -funique-internal-linkage-names was added in D73307 and D78243 as a LLVM early pass to insert a unique suffix to internal linkage functions and vars. The unique suffix was the hash of the module path. However, we found that this can be done more cleanly in clang early and the fixes that need to be done later can be completely avoided. The fixes in particular are trying to modify the DW_AT_linkage_name and finding the right place to insert the pass. This patch ressurects the original implementation proposed in D73307 which was reviewed and then ditched in favor of the pass based approach. Differential Revision: https://reviews.llvm.org/D96109
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h
index a224383..ad43244 100644
--- a/clang/lib/CodeGen/CodeGenModule.h
+++ b/clang/lib/CodeGen/CodeGenModule.h
@@ -28,6 +28,7 @@
#include "clang/Basic/NoSanitizeList.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/XRayLists.h"
+#include "clang/Lex/PreprocessorOptions.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
@@ -72,7 +73,6 @@ class VarDecl;
class LangOptions;
class CodeGenOptions;
class HeaderSearchOptions;
-class PreprocessorOptions;
class DiagnosticsEngine;
class AnnotateAttr;
class CXXDestructorDecl;
@@ -311,6 +311,7 @@ private:
const TargetInfo &Target;
std::unique_ptr<CGCXXABI> ABI;
llvm::LLVMContext &VMContext;
+ std::string ModuleNameHash = "";
std::unique_ptr<CodeGenTBAA> TBAA;
@@ -586,6 +587,8 @@ public:
/// Return true iff an Objective-C runtime has been configured.
bool hasObjCRuntime() { return !!ObjCRuntime; }
+ const std::string &getModuleNameHash() const { return ModuleNameHash; }
+
/// Return a reference to the configured OpenCL runtime.
CGOpenCLRuntime &getOpenCLRuntime() {
assert(OpenCLRuntime != nullptr);