diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 8 | ||||
-rw-r--r-- | clang/lib/AST/RecordLayoutBuilder.cpp | 11 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 9 | ||||
-rw-r--r-- | clang/lib/Sema/SemaType.cpp | 2 |
4 files changed, 18 insertions, 12 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index f53a50e3145..95893a46164 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -137,10 +137,12 @@ ASTContext::getCanonicalTemplateTemplateParmDecl( CXXABI *ASTContext::createCXXABI(const TargetInfo &T) { if (!LangOpts.CPlusPlus) return NULL; - if (T.getCXXABI() == "microsoft") - return CreateMicrosoftCXXABI(*this); - else + switch (T.getCXXABI()) { + default: return CreateItaniumCXXABI(*this); + case CXXABI_Microsoft: + return CreateMicrosoftCXXABI(*this); + } } ASTContext::ASTContext(const LangOptions& LOpts, SourceManager &SM, diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp index 907c359ce4a..ff77561419e 100644 --- a/clang/lib/AST/RecordLayoutBuilder.cpp +++ b/clang/lib/AST/RecordLayoutBuilder.cpp @@ -1463,8 +1463,6 @@ RecordLayoutBuilder::ComputeKeyFunction(const CXXRecordDecl *RD) { // This class implements layout specific to the Microsoft ABI. class MSRecordLayoutBuilder: public RecordLayoutBuilder { - friend class ASTContext; - public: MSRecordLayoutBuilder(ASTContext& Ctx, EmptySubobjectMap *EmptySubobjects): RecordLayoutBuilder(Ctx, EmptySubobjects) {} @@ -1514,10 +1512,13 @@ const ASTRecordLayout &ASTContext::getASTRecordLayout(const RecordDecl *D) { // When compiling for Microsoft, use the special MS builder. RecordLayoutBuilder *Builder; - if (Target.getCXXABI() == "microsoft") - Builder = new MSRecordLayoutBuilder(*this, &EmptySubobjects); - else + switch (Target.getCXXABI()) { + default: Builder = new RecordLayoutBuilder(*this, &EmptySubobjects); + break; + case CXXABI_Microsoft: + Builder = new MSRecordLayoutBuilder(*this, &EmptySubobjects); + } Builder->Layout(RD); // FIXME: This is not always correct. See the part about bitfields at diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 72ec584f6c8..c0df55b808d 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -90,10 +90,13 @@ void CodeGenModule::createObjCRuntime() { } void CodeGenModule::createCXXABI() { - if (Context.Target.getCXXABI() == "microsoft") - ABI = CreateMicrosoftCXXABI(*this); - else + switch (Context.Target.getCXXABI()) { + default: ABI = CreateItaniumCXXABI(*this); + break; + case CXXABI_Microsoft: + ABI = CreateMicrosoftCXXABI(*this); + } } void CodeGenModule::Release() { diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index e3628c1d5f0..1fdb17f4d2a 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -897,7 +897,7 @@ QualType Sema::BuildMemberPointerType(QualType T, QualType Class, // type. In such cases, the compiler makes a worst-case assumption. // We make no such assumption right now, so emit an error if the // class isn't a complete type. - if (Context.Target.getCXXABI() == "microsoft" && + if (Context.Target.getCXXABI() == CXXABI_Microsoft && RequireCompleteType(Loc, Class, diag::err_incomplete_type)) return QualType(); |