summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorCharles Davis <cdavis@mines.edu>2010-08-19 02:18:14 +0000
committerCharles Davis <cdavis@mines.edu>2010-08-19 02:18:14 +0000
commit6bcb07ad7152237597f2bd1cde4d6a3075e8ac0c (patch)
tree3f987886b301a564df0b45c0df08f2830fcebe0d /clang/lib/AST
parenta0734c5fbd0fbc7ebd7d212aee91690ba99759b0 (diff)
downloadbcm5719-llvm-6bcb07ad7152237597f2bd1cde4d6a3075e8ac0c.tar.gz
bcm5719-llvm-6bcb07ad7152237597f2bd1cde4d6a3075e8ac0c.zip
Add some enum goodness as requested by Chris. Now instead of storing the
active C++ ABI as a raw string, we store it as an enum. This should improve performance somewhat. And yes, this time, I started from a clean build directory, and all the tests passed. :) llvm-svn: 111507
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/ASTContext.cpp8
-rw-r--r--clang/lib/AST/RecordLayoutBuilder.cpp11
2 files changed, 11 insertions, 8 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
OpenPOWER on IntegriCloud