summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2013-12-17 01:22:38 +0000
committerAlp Toker <alp@nuanti.com>2013-12-17 01:22:38 +0000
commit2dea15b53c41fc859662c83849372e83607c2d15 (patch)
treeae64260ed5e60ae151089176b98c731c7379cdfe /clang/lib/CodeGen/CodeGenModule.cpp
parent382b135d92872758c094590327beb5a327455ec4 (diff)
downloadbcm5719-llvm-2dea15b53c41fc859662c83849372e83607c2d15.tar.gz
bcm5719-llvm-2dea15b53c41fc859662c83849372e83607c2d15.zip
ASTContext: Refactor implicit record creation
Tidy up built-in record creation to reduce code duplication. Continuation of r197336. llvm-svn: 197452
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp18
1 files changed, 2 insertions, 16 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index e3ab9df9a67..0d6ba33aada 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -2413,16 +2413,6 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) {
return GV;
}
-static RecordDecl *
-CreateRecordDecl(const ASTContext &Ctx, RecordDecl::TagKind TK,
- DeclContext *DC, IdentifierInfo *Id) {
- SourceLocation Loc;
- if (Ctx.getLangOpts().CPlusPlus)
- return CXXRecordDecl::Create(Ctx, TK, DC, Loc, Loc, Id);
- else
- return RecordDecl::Create(Ctx, TK, DC, Loc, Loc, Id);
-}
-
llvm::Constant *
CodeGenModule::GetAddrOfConstantString(const StringLiteral *Literal) {
unsigned StringLength = 0;
@@ -2465,9 +2455,7 @@ CodeGenModule::GetAddrOfConstantString(const StringLiteral *Literal) {
if (!NSConstantStringType) {
// Construct the type for a constant NSString.
- RecordDecl *D = CreateRecordDecl(Context, TTK_Struct,
- Context.getTranslationUnitDecl(),
- &Context.Idents.get("__builtin_NSString"));
+ RecordDecl *D = Context.buildImplicitRecord("__builtin_NSString");
D->startDefinition();
QualType FieldTypes[3];
@@ -2543,9 +2531,7 @@ CodeGenModule::GetAddrOfConstantString(const StringLiteral *Literal) {
QualType CodeGenModule::getObjCFastEnumerationStateType() {
if (ObjCFastEnumerationStateType.isNull()) {
- RecordDecl *D = CreateRecordDecl(Context, TTK_Struct,
- Context.getTranslationUnitDecl(),
- &Context.Idents.get("__objcFastEnumerationState"));
+ RecordDecl *D = Context.buildImplicitRecord("__objcFastEnumerationState");
D->startDefinition();
QualType FieldTypes[] = {
OpenPOWER on IntegriCloud