diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-10-16 01:40:34 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-10-16 01:40:34 +0000 |
commit | 002667c32ba09940b899edf78bbb93d8137a87e3 (patch) | |
tree | 6240e5cf8a1ccaff21ead0e85bd837bee78eae37 /clang/lib/AST/MicrosoftMangle.cpp | |
parent | d2b497b522c3b2524518aac1283da508e88d7700 (diff) | |
download | bcm5719-llvm-002667c32ba09940b899edf78bbb93d8137a87e3.tar.gz bcm5719-llvm-002667c32ba09940b899edf78bbb93d8137a87e3.zip |
On 32 bit windows, mangle stdcall and fastcall decls in clang.
This removes the dependency on the llvm mangler doing it for us. In isolation,
the benefit is that the testing of what mangling is applied is all in one place:
(C, C++) X (Itanium, Microsoft) are all handled by clang.
This also gives me hope that in the future the llvm mangler (and llvm-ar) will
not depend on TargetMachine.
llvm-svn: 192762
Diffstat (limited to 'clang/lib/AST/MicrosoftMangle.cpp')
-rw-r--r-- | clang/lib/AST/MicrosoftMangle.cpp | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 2c37709bcf1..7194536c526 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -179,8 +179,8 @@ class MicrosoftMangleContextImpl : public MicrosoftMangleContext { public: MicrosoftMangleContextImpl(ASTContext &Context, DiagnosticsEngine &Diags) : MicrosoftMangleContext(Context, Diags) {} - virtual bool shouldMangleDeclName(const NamedDecl *D); - virtual void mangleName(const NamedDecl *D, raw_ostream &Out); + virtual bool shouldMangleCXXName(const NamedDecl *D); + virtual void mangleCXXName(const NamedDecl *D, raw_ostream &Out); virtual void mangleThunk(const CXXMethodDecl *MD, const ThunkInfo &Thunk, raw_ostream &); @@ -211,16 +211,7 @@ private: } -bool MicrosoftMangleContextImpl::shouldMangleDeclName(const NamedDecl *D) { - // In C, functions with no attributes never need to be mangled. Fastpath them. - if (!getASTContext().getLangOpts().CPlusPlus && !D->hasAttrs()) - return false; - - // Any decl can be declared with __asm("foo") on it, and this takes precedence - // over all other naming in the .o file. - if (D->hasAttr<AsmLabelAttr>()) - return true; - +bool MicrosoftMangleContextImpl::shouldMangleCXXName(const NamedDecl *D) { if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { LanguageLinkage L = FD->getLanguageLinkage(); // Overloadable functions need mangling. @@ -281,14 +272,6 @@ void MicrosoftCXXNameMangler::mangle(const NamedDecl *D, // default, we emit an asm marker at the start so we get the name right. // Callers can override this with a custom prefix. - // Any decl can be declared with __asm("foo") on it, and this takes precedence - // over all other naming in the .o file. - if (const AsmLabelAttr *ALA = D->getAttr<AsmLabelAttr>()) { - // If we have an asm name, then we use it as the mangling. - Out << '\01' << ALA->getLabel(); - return; - } - // <mangled-name> ::= ? <name> <type-encoding> Out << Prefix; mangleName(D); @@ -1845,8 +1828,8 @@ void MicrosoftCXXNameMangler::mangleType(const AtomicType *T, << Range; } -void MicrosoftMangleContextImpl::mangleName(const NamedDecl *D, - raw_ostream &Out) { +void MicrosoftMangleContextImpl::mangleCXXName(const NamedDecl *D, + raw_ostream &Out) { assert((isa<FunctionDecl>(D) || isa<VarDecl>(D)) && "Invalid mangleName() call, argument is not a variable or function!"); assert(!isa<CXXConstructorDecl>(D) && !isa<CXXDestructorDecl>(D) && |