diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-02-13 00:10:09 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-02-13 00:10:09 +0000 |
commit | 5f2bfd4811996abb783aa6c7254c56baa6930e8c (patch) | |
tree | 77e1aff5cfa03a6500ad8a965a27f8b485e61adc /lib/CodeGen/CGDecl.cpp | |
parent | 30510abee628c645285e01cfd4779610d46a822c (diff) |
Add basic support for C++ name mangling according to the Itanium C++
ABI to the CodeGen library. Since C++ code-generation is so
incomplete, we can't exercise much of this mangling code. However, a
few smoke tests show that it's doing the same thing as GCC. When C++
codegen matures, we'll extend the ABI tester to verify name-mangling
as well, and complete the implementation here.
At this point, the major client of name mangling is in the uses of the
new "overloadable" attribute in C, which allows overloading. Any
"overloadable" function in C (or in an extern "C" block in C++) will
be mangled the same way that the corresponding C++ function would be
mangled.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64413 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | lib/CodeGen/CGDecl.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp index a32b78dedb..3b912ce3d6 100644 --- a/lib/CodeGen/CGDecl.cpp +++ b/lib/CodeGen/CGDecl.cpp @@ -101,7 +101,7 @@ CodeGenFunction::GenerateStaticBlockVarDecl(const VarDecl &D, std::string ContextName; if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(CurFuncDecl)) - ContextName = FD->getNameAsString(); + ContextName = CGM.getMangledName(FD)->getName(); else if (isa<ObjCMethodDecl>(CurFuncDecl)) ContextName = std::string(CurFn->getNameStart(), CurFn->getNameStart() + CurFn->getNameLen()); @@ -164,7 +164,7 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) { // A normal fixed sized variable becomes an alloca in the entry block. const llvm::Type *LTy = ConvertType(Ty); llvm::AllocaInst *Alloc = - CreateTempAlloca(LTy, D.getIdentifier()->getName()); + CreateTempAlloca(LTy, CGM.getMangledName(&D)->getName()); unsigned align = getContext().getTypeAlign(Ty); if (const AlignedAttr* AA = D.getAttr<AlignedAttr>()) align = std::max(align, AA->getAlignment()); |