Browse Source

Revert "Support overriding the alignment of Clang's target info."

This reverts commit 0e1e9c971b.
pull/553/head
triton 10 years ago
parent
commit
d07b158a98
  1. 73
      src/CppParser/Parser.cpp
  2. 3
      src/Generator/Driver.cs

73
src/CppParser/Parser.cpp

@ -125,72 +125,6 @@ ConvertToClangTargetCXXABI(CppSharp::CppParser::AST::CppAbi abi) @@ -125,72 +125,6 @@ ConvertToClangTargetCXXABI(CppSharp::CppParser::AST::CppAbi abi)
llvm_unreachable("Unsupported C++ ABI.");
}
// We use this custom target info class to be able to set overrides to the default
// Clang triples info. The class has protected fields so we need to override it
// to be able to set the value of those fields.
class CustomTargetInfo : public clang::TargetInfo
{
CustomTargetInfo() = delete;
clang::TargetInfo& Base;
public:
CustomTargetInfo(clang::TargetInfo& TI) : clang::TargetInfo(TI), Base(TI) { }
/// \brief Appends the target-specific \#define values for this
/// target set to the specified buffer.
virtual void getTargetDefines(const clang::LangOptions &Opts,
clang::MacroBuilder &Builder) const
{
return Base.getTargetDefines(Opts, Builder);
}
/// Return information about target-specific builtins for
/// the current primary target, and info about which builtins are non-portable
/// across the current set of primary and secondary targets.
virtual void getTargetBuiltins(const clang::Builtin::Info *&Records,
unsigned &NumRecords) const
{
return Base.getTargetBuiltins(Records, NumRecords);
}
/// \brief Returns the kind of __builtin_va_list type that should be used
/// with this target.
virtual BuiltinVaListKind getBuiltinVaListKind() const
{
return Base.getBuiltinVaListKind();
}
/// \brief Returns a string of target-specific clobbers, in LLVM format.
virtual const char *getClobbers() const
{
return Base.getClobbers();
}
virtual void getGCCRegNames(const char * const *&Names,
unsigned &NumNames) const
{
}
virtual void getGCCRegAliases(const GCCRegAlias *&Aliases,
unsigned &NumAliases) const
{
}
virtual bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &info) const
{
return false;
}
void setParserTargetInfo(ParserTargetInfo info)
{
// TODO: Support other kinds of target overrides.
// For now this is all that has been needed.
if (info.DoubleAlign != 0)
this->DoubleAlign = info.DoubleAlign;
}
};
void Parser::SetupHeader()
{
using namespace clang;
@ -259,13 +193,6 @@ void Parser::SetupHeader() @@ -259,13 +193,6 @@ void Parser::SetupHeader()
TI = TargetInfo::CreateTargetInfo(C->getDiagnostics(), TO);
}
if (Opts->TargetInfo != 0)
{
auto CTI = new CustomTargetInfo(*TI);
CTI->setParserTargetInfo(*Opts->TargetInfo);
TI = CTI;
}
assert(TI && "Expected valid target info");
TI->setCXXABI(TargetABI);

3
src/Generator/Driver.cs

@ -139,8 +139,7 @@ namespace CppSharp @@ -139,8 +139,7 @@ namespace CppSharp
NoBuiltinIncludes = Options.NoBuiltinIncludes,
MicrosoftMode = Options.MicrosoftMode,
Verbose = Options.Verbose,
LanguageVersion = Options.LanguageVersion,
TargetInfo = Options.TargetInfo
LanguageVersion = Options.LanguageVersion
};
// This eventually gets passed to Clang's MSCompatibilityVersion, which

Loading…
Cancel
Save