diff options
author | Timur Iskhodzhanov <timurrrr@google.com> | 2013-07-30 09:46:19 +0000 |
---|---|---|
committer | Timur Iskhodzhanov <timurrrr@google.com> | 2013-07-30 09:46:19 +0000 |
commit | df7e7fb64296519a8a340b31eb0da9b3b67b4cb1 (patch) | |
tree | c939d63f5c01ba5667b47fb2f1b56dce83c351e8 /clang/lib/AST/MicrosoftMangle.cpp | |
parent | f3e218a02127420a49ba0f0712e6a25a235fd9be (diff) | |
download | bcm5719-llvm-df7e7fb64296519a8a340b31eb0da9b3b67b4cb1.tar.gz bcm5719-llvm-df7e7fb64296519a8a340b31eb0da9b3b67b4cb1.zip |
Add MicrosoftVFTableContext to AST
llvm-svn: 187409
Diffstat (limited to 'clang/lib/AST/MicrosoftMangle.cpp')
-rw-r--r-- | clang/lib/AST/MicrosoftMangle.cpp | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 90255da73ef..64e27f1f4ba 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -89,6 +89,8 @@ public: void mangleNumber(const llvm::APSInt &Value); void mangleType(QualType T, SourceRange Range, QualifierMangleMode QMM = QMM_Mangle); + void mangleFunctionType(const FunctionType *T, const FunctionDecl *D, + bool IsStructor, bool IsInstMethod); private: void disableBackReferences() { UseNameBackReferences = false; } @@ -122,8 +124,6 @@ private: #undef TYPE void mangleType(const TagType*); - void mangleFunctionType(const FunctionType *T, const FunctionDecl *D, - bool IsStructor, bool IsInstMethod); void mangleDecayedArrayType(const ArrayType *T, bool IsGlobal); void mangleArrayType(const ArrayType *T); void mangleFunctionClass(const FunctionDecl *FD); @@ -1781,13 +1781,30 @@ void MicrosoftMangleContext::mangleName(const NamedDecl *D, MicrosoftCXXNameMangler Mangler(*this, Out); return Mangler.mangle(D); } + void MicrosoftMangleContext::mangleThunk(const CXXMethodDecl *MD, const ThunkInfo &Thunk, - raw_ostream &) { - unsigned DiagID = getDiags().getCustomDiagID(DiagnosticsEngine::Error, - "cannot mangle thunk for this method yet"); - getDiags().Report(MD->getLocation(), DiagID); + raw_ostream &Out) { + // FIXME: this is not yet a complete implementation, but merely a + // reasonably-working stub to avoid crashing when required to emit a thunk. + MicrosoftCXXNameMangler Mangler(*this, Out); + Out << "\01?"; + Mangler.mangleName(MD); + if (Thunk.This.NonVirtual != 0) { + // FIXME: add support for protected/private or use mangleFunctionClass. + Out << "W"; + llvm::APSInt APSNumber(/*BitWidth=*/32 /*FIXME: check on x64*/, + /*isUnsigned=*/true); + APSNumber = -Thunk.This.NonVirtual; + Mangler.mangleNumber(APSNumber); + } else { + // FIXME: add support for protected/private or use mangleFunctionClass. + Out << "Q"; + } + // FIXME: mangle return adjustment? Most likely includes using an overridee FPT? + Mangler.mangleFunctionType(MD->getType()->castAs<FunctionProtoType>(), MD, false, true); } + void MicrosoftMangleContext::mangleCXXDtorThunk(const CXXDestructorDecl *DD, CXXDtorType Type, const ThisAdjustment &, |