summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-08-12 06:49:56 +0000
committerDouglas Gregor <dgregor@apple.com>2011-08-12 06:49:56 +0000
commit801c99d22d01d493b1073f95de1bced536897478 (patch)
tree254c874965b10b47c70462620650f9a16c888d2b /clang/lib/AST/ASTContext.cpp
parent5113dc8e549c3c5e324e9dd3ed3ef17338721130 (diff)
downloadbcm5719-llvm-801c99d22d01d493b1073f95de1bced536897478.tar.gz
bcm5719-llvm-801c99d22d01d493b1073f95de1bced536897478.zip
Switch the __int128_t and __uint128_t types over to predefined types
in the AST format, which are built lazily by the ASTContext when requested. llvm-svn: 137437
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 8a4c9d33382..cd7d5080e8f 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -221,7 +221,8 @@ ASTContext::ASTContext(const LangOptions& LOpts, SourceManager &SM,
TemplateSpecializationTypes(this_()),
DependentTemplateSpecializationTypes(this_()),
SubstTemplateTemplateParmPacks(this_()),
- GlobalNestedNameSpecifier(0), IsInt128Installed(false),
+ GlobalNestedNameSpecifier(0),
+ Int128Decl(0), UInt128Decl(0),
ObjCIdDecl(0), ObjCSelDecl(0), ObjCClassDecl(0),
CFConstantStringTypeDecl(0),
FILEDecl(0),
@@ -346,6 +347,33 @@ void ASTContext::PrintStats() const {
BumpAlloc.PrintStats();
}
+TypedefDecl *ASTContext::getInt128Decl() const {
+ if (!Int128Decl) {
+ TypeSourceInfo *TInfo = getTrivialTypeSourceInfo(Int128Ty);
+ Int128Decl = TypedefDecl::Create(const_cast<ASTContext &>(*this),
+ getTranslationUnitDecl(),
+ SourceLocation(),
+ SourceLocation(),
+ &Idents.get("__int128_t"),
+ TInfo);
+ }
+
+ return Int128Decl;
+}
+
+TypedefDecl *ASTContext::getUInt128Decl() const {
+ if (!UInt128Decl) {
+ TypeSourceInfo *TInfo = getTrivialTypeSourceInfo(UnsignedInt128Ty);
+ UInt128Decl = TypedefDecl::Create(const_cast<ASTContext &>(*this),
+ getTranslationUnitDecl(),
+ SourceLocation(),
+ SourceLocation(),
+ &Idents.get("__uint128_t"),
+ TInfo);
+ }
+
+ return UInt128Decl;
+}
void ASTContext::InitBuiltinType(CanQualType &R, BuiltinType::Kind K) {
BuiltinType *Ty = new (*this, TypeAlignment) BuiltinType(K);
OpenPOWER on IntegriCloud