Browse Source

Deal properly with calling conventions by resolving CC_Default conventions.

pull/1/head
triton 12 years ago
parent
commit
e4df985659
  1. 23
      src/Parser/Parser.cpp
  2. 3
      src/Parser/Parser.h

23
src/Parser/Parser.cpp

@ -1067,6 +1067,25 @@ Cxxi::Enumeration^ Parser::WalkEnum(clang::EnumDecl* ED)
//-----------------------------------// //-----------------------------------//
clang::CallingConv Parser::GetAbiCallConv(clang::CallingConv CC,
bool IsInstMethod,
bool IsVariadic)
{
using namespace clang;
// TODO: Itanium ABI
if (CC == CC_Default) {
if (IsInstMethod) {
CC = AST->getDefaultCXXMethodCallConv(IsVariadic);
} else {
CC = CC_C;
}
}
return CC;
}
static Cxxi::CallingConvention ConvertCallConv(clang::CallingConv CC) static Cxxi::CallingConvention ConvertCallConv(clang::CallingConv CC)
{ {
using namespace clang; using namespace clang;
@ -1109,7 +1128,9 @@ void Parser::WalkFunction(clang::FunctionDecl* FD, Cxxi::Function^ F,
F->Namespace = NS; F->Namespace = NS;
F->IsVariadic = FD->isVariadic(); F->IsVariadic = FD->isVariadic();
F->IsInline = FD->isInlined(); F->IsInline = FD->isInlined();
F->CallingConvention = ConvertCallConv(CC);
auto AbiCC = GetAbiCallConv(CC, FD->isCXXInstanceMember(), FD->isVariadic());
F->CallingConvention = ConvertCallConv(AbiCC);
TypeLoc RTL; TypeLoc RTL;
if (auto TSI = FD->getTypeSourceInfo()) if (auto TSI = FD->getTypeSourceInfo())

3
src/Parser/Parser.h

@ -132,6 +132,9 @@ protected:
Cxxi::TranslationUnit^ GetModule(clang::SourceLocation Loc); Cxxi::TranslationUnit^ GetModule(clang::SourceLocation Loc);
Cxxi::Namespace^ GetNamespace(const clang::NamedDecl*); Cxxi::Namespace^ GetNamespace(const clang::NamedDecl*);
clang::CallingConv GetAbiCallConv(clang::CallingConv CC,
bool IsInstMethod, bool IsVariadic);
int Index; int Index;
gcroot<Cxxi::Library^> Lib; gcroot<Cxxi::Library^> Lib;
llvm::OwningPtr<clang::CompilerInstance> C; llvm::OwningPtr<clang::CompilerInstance> C;

Loading…
Cancel
Save