Browse Source

Updated the parser to work with calling convention changes introduced in the latest Clang revisions (r189412).

pull/53/merge
triton 12 years ago
parent
commit
aff25384fe
  1. 25
      src/Parser/Parser.cpp
  2. 3
      src/Parser/Parser.h

25
src/Parser/Parser.cpp

@ -1044,7 +1044,6 @@ static CppSharp::AST::CallingConvention ConvertCallConv(clang::CallingConv CC) @@ -1044,7 +1044,6 @@ static CppSharp::AST::CallingConvention ConvertCallConv(clang::CallingConv CC)
switch(CC)
{
case CC_Default:
case CC_C:
return CppSharp::AST::CallingConvention::C;
case CC_X86StdCall:
@ -1478,25 +1477,6 @@ CppSharp::AST::Enumeration^ Parser::WalkEnum(clang::EnumDecl* ED) @@ -1478,25 +1477,6 @@ CppSharp::AST::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 const clang::CodeGen::CGFunctionInfo& GetCodeGenFuntionInfo(
clang::CodeGen::CodeGenTypes* CodeGenTypes, clang::FunctionDecl* FD)
{
@ -1519,7 +1499,6 @@ void Parser::WalkFunction(clang::FunctionDecl* FD, CppSharp::AST::Function^ F, @@ -1519,7 +1499,6 @@ void Parser::WalkFunction(clang::FunctionDecl* FD, CppSharp::AST::Function^ F,
assert (FD->getBuiltinID() == 0);
auto FT = FD->getType()->getAs<FunctionType>();
auto CC = FT->getCallConv();
auto NS = GetNamespace(FD);
assert(NS && "Expected a valid namespace");
@ -1532,8 +1511,8 @@ void Parser::WalkFunction(clang::FunctionDecl* FD, CppSharp::AST::Function^ F, @@ -1532,8 +1511,8 @@ void Parser::WalkFunction(clang::FunctionDecl* FD, CppSharp::AST::Function^ F,
F->IsDependent = FD->isDependentContext();
F->IsPure = FD->isPure();
auto AbiCC = GetAbiCallConv(CC, FD->isCXXInstanceMember(), FD->isVariadic());
F->CallingConvention = ConvertCallConv(AbiCC);
auto CC = FT->getCallConv();
F->CallingConvention = ConvertCallConv(CC);
F->OperatorKind = GetOperatorKindFromDecl(FD->getDeclName());

3
src/Parser/Parser.h

@ -95,9 +95,6 @@ protected: @@ -95,9 +95,6 @@ protected:
CppSharp::AST::DeclarationContext^ GetNamespace(clang::Decl*, clang::DeclContext*);
CppSharp::AST::DeclarationContext^ GetNamespace(clang::Decl*);
clang::CallingConv GetAbiCallConv(clang::CallingConv CC,
bool IsInstMethod, bool IsVariadic);
void HandleDiagnostics(ParserResult^ res);
int Index;

Loading…
Cancel
Save