diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-02-18 23:53:56 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-02-18 23:53:56 +0000 |
commit | 6ec3668a2608b63473207319f5ceff9bbd22ea51 (patch) | |
tree | 7e6ecc1b337dd577d5fd77345efe5ce18607fbf8 /lib/CodeGen/CodeGenModule.h | |
parent | d55979238d90067fa0a9eb2730db969f93ab9bca (diff) |
Address Chris's comments regarding C++ name mangling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64984 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.h')
-rw-r--r-- | lib/CodeGen/CodeGenModule.h | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index b54ee13df6..24453ccadc 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -18,6 +18,7 @@ #include "clang/AST/Attr.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringSet.h" #include "CGCall.h" @@ -81,14 +82,23 @@ class CodeGenModule { /// will name them and patch up conflicts when we release the module. std::vector< std::pair<llvm::Function*, std::string> > RuntimeFunctions; - /// GlobalDeclMap - Mapping of decl names global variables we have already - /// emitted. Note that the entries in this map are the actual globals and - /// therefore may not be of the same type as the decl, they should be - /// bitcasted on retrieval. Also note that the globals are keyed on their - /// source name, not the global name (which may change with attributes such as - /// asm-labels). This key to this map should be generated using - /// getMangledName(). - llvm::DenseMap<IdentifierInfo*, llvm::GlobalValue*> GlobalDeclMap; + /// GlobalDeclMap - Mapping of decl names (represented as unique + /// character pointers from either the identifier table or the set + /// of mangled names) to global variables we have already + /// emitted. Note that the entries in this map are the actual + /// globals and therefore may not be of the same type as the decl, + /// they should be bitcasted on retrieval. Also note that the + /// globals are keyed on their source name, not the global name + /// (which may change with attributes such as asm-labels). This key + /// to this map should be generated using getMangledName(). + llvm::DenseMap<const char*, llvm::GlobalValue*> GlobalDeclMap; + + /// \brief Contains the strings used for mangled names. + /// + /// FIXME: Eventually, this should map from the semantic/canonical + /// declaration for each global entity to its mangled name (if it + /// has one). + llvm::StringSet<> MangledNames; /// Aliases - List of aliases in module. These cannot be emitted until all the /// code has been seen, as they reference things by name instead of directly @@ -285,7 +295,7 @@ public: const Decl *TargetDecl, AttributeListType &PAL); - IdentifierInfo *getMangledName(const NamedDecl *ND) const; + const char *getMangledName(const NamedDecl *ND); private: |