diff options
author | Anders Carlsson <andersca@mac.com> | 2010-02-05 07:31:37 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-02-05 07:31:37 +0000 |
commit | f98574ba5cbb1c0bc80d66c411fabfd279e823c0 (patch) | |
tree | a312510d0c1793c28e5b1f8d0d1c685a4ba5608d /lib/CodeGen/Mangle.cpp | |
parent | 1df0ee91a9d55b5c2eb0d96e7590f1c8b8fe8734 (diff) |
Check in a mangle checker that's turned off by default.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95377 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/Mangle.cpp')
-rw-r--r-- | lib/CodeGen/Mangle.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp index 69752b923e..cb304960ce 100644 --- a/lib/CodeGen/Mangle.cpp +++ b/lib/CodeGen/Mangle.cpp @@ -26,6 +26,13 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/Support/ErrorHandling.h" #include "CGVtable.h" + +#define MANGLE_CHECKER 0 + +#if MANGLE_CHECKER +#include <cxxabi.h> +#endif + using namespace clang; using namespace CodeGen; @@ -69,6 +76,17 @@ public: const CXXDestructorDecl *D, CXXDtorType Type) : Context(C), Out(Res), Structor(getStructor(D)), StructorType(Type) { } +#if MANGLE_CHECKER + ~CXXNameMangler() { + if (Out.str()[0] == '\01') + return; + + int status = 0; + char *result = abi::__cxa_demangle(Out.str().str().c_str(), 0, 0, &status); + assert(status == 0 && "Could not demangle mangled name!"); + free(result); + } +#endif llvm::raw_svector_ostream &getStream() { return Out; } void mangle(const NamedDecl *D, llvm::StringRef Prefix = "_Z"); |