summaryrefslogtreecommitdiffstats
path: root/clang/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
commit1e39bd944b615aa9d577f97cd84e05af1a611207 (patch)
treea62989830d9cbef29e54ce674292a24a4d78919e /clang/lib/CodeGen/Mangle.h
parentdb9fca7735974c6cd441a3c8a2d4da3e4ec12424 (diff)
downloadbcm5719-llvm-1e39bd944b615aa9d577f97cd84e05af1a611207.tar.gz
bcm5719-llvm-1e39bd944b615aa9d577f97cd84e05af1a611207.zip
Mangle anonymous structs/unions correctly. Fixes PR5139.
llvm-svn: 83448
Diffstat (limited to 'clang/lib/CodeGen/Mangle.h')
-rw-r--r--clang/lib/CodeGen/Mangle.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/Mangle.h b/clang/lib/CodeGen/Mangle.h
index 8ab5d5edf36..f05220c38b2 100644
--- a/clang/lib/CodeGen/Mangle.h
+++ b/clang/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,
OpenPOWER on IntegriCloud