aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/Mangle.h
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-10-07 01:45:02 +0000
committerAnders Carlsson <andersca@mac.com>2009-10-07 01:45:02 +0000
commitc4355b6883382b85cda3b7337587784dabf3450b (patch)
treec7259415334f343cfd10c9c7fe1fbaabd8844b4b /lib/CodeGen/Mangle.h
parent44da821078a5f09127a01f9aa01dd9dd9af9de86 (diff)
Mangle anonymous structs/unions correctly. Fixes PR5139.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83448 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/Mangle.h')
-rw-r--r--lib/CodeGen/Mangle.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/CodeGen/Mangle.h b/lib/CodeGen/Mangle.h
index 8ab5d5edf3..f05220c38b 100644
--- a/lib/CodeGen/Mangle.h
+++ b/lib/CodeGen/Mangle.h
@@ -20,6 +20,7 @@
#include "CGCXX.h"
#include "clang/AST/Type.h"
+#include "llvm/ADT/DenseMap.h"
namespace llvm {
class raw_ostream;
@@ -35,11 +36,21 @@ namespace clang {
class MangleContext {
ASTContext &Context;
+
+ llvm::DenseMap<const TagDecl *, uint64_t> AnonStructIds;
+
public:
explicit MangleContext(ASTContext &Context)
: Context(Context) { }
ASTContext &getASTContext() const { return Context; }
+
+ uint64_t getAnonymousStructId(const TagDecl *TD) {
+ std::pair<llvm::DenseMap<const TagDecl *,
+ uint64_t>::iterator, bool> Result =
+ AnonStructIds.insert(std::make_pair(TD, AnonStructIds.size()));
+ return Result.first->second;
+ }
};
bool mangleName(MangleContext &Context, const NamedDecl *D,