summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-07-04 21:44:19 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-07-04 21:44:19 +0000
commite862cbc5f654641dc766f40e9970d6b2e12131bd (patch)
treed07b41dd54053d94d0859d08f5ba06f873f0fac4 /clang
parentccde6a02c8f68fd66739b26f0bee4e11bb89a5b9 (diff)
downloadbcm5719-llvm-e862cbc5f654641dc766f40e9970d6b2e12131bd.tar.gz
bcm5719-llvm-e862cbc5f654641dc766f40e9970d6b2e12131bd.zip
Don't try to install the __[u]int128_t identifier if it is already installed by PCHReader.
Currently, adding it to visible decls of a PCH'ed translation unit has no effect because adding visible decls before deserialization has no effect (the decls won't be visible). This will be fixed in a future commit; then it will force deserialization of visible decls, so avoid pointlessly installing it. llvm-svn: 107595
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/AST/ASTContext.h9
-rw-r--r--clang/include/clang/Frontend/PCHBitCodes.h4
-rw-r--r--clang/lib/AST/ASTContext.cpp4
-rw-r--r--clang/lib/Frontend/PCHReader.cpp3
-rw-r--r--clang/lib/Frontend/PCHWriter.cpp1
-rw-r--r--clang/lib/Sema/Sema.cpp4
6 files changed, 20 insertions, 5 deletions
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index 0a6b6cd45e6..0c36ad7b939 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -148,7 +148,10 @@ class ASTContext {
TemplateTemplateParmDecl *getCanonicalTemplateTemplateParmDecl(
TemplateTemplateParmDecl *TTP);
-
+
+ /// \brief Whether __[u]int128_t identifier is installed.
+ bool IsInt128Installed;
+
/// BuiltinVaListType - built-in va list type.
/// This is initially null and set by Sema::LazilyCreateBuiltin when
/// a builtin that takes a valist is encountered.
@@ -818,6 +821,10 @@ public:
/// purpose in characters.
CharUnits getObjCEncodingTypeSize(QualType t);
+ /// \brief Whether __[u]int128_t identifier is installed.
+ bool isInt128Installed() const { return IsInt128Installed; }
+ void setInt128Installed() { IsInt128Installed = true; }
+
/// This setter/getter represents the ObjC 'id' type. It is setup lazily, by
/// Sema. id is always a (typedef for a) pointer type, a pointer to a struct.
QualType getObjCIdType() const { return ObjCIdTypedefType; }
diff --git a/clang/include/clang/Frontend/PCHBitCodes.h b/clang/include/clang/Frontend/PCHBitCodes.h
index 9bb537a4908..3e11894474e 100644
--- a/clang/include/clang/Frontend/PCHBitCodes.h
+++ b/clang/include/clang/Frontend/PCHBitCodes.h
@@ -467,7 +467,9 @@ namespace clang {
/// \brief Objective-C "SEL" redefinition type
SPECIAL_TYPE_OBJC_SEL_REDEFINITION = 14,
/// \brief NSConstantString type
- SPECIAL_TYPE_NS_CONSTANT_STRING = 15
+ SPECIAL_TYPE_NS_CONSTANT_STRING = 15,
+ /// \brief Whether __[u]int128_t identifier is installed.
+ SPECIAL_TYPE_INT128_INSTALLED = 16
};
/// \brief Record codes for each kind of declaration.
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index f8f568cbb48..24ddb127bda 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -141,8 +141,8 @@ ASTContext::ASTContext(const LangOptions& LOpts, SourceManager &SM,
bool FreeMem, unsigned size_reserve) :
TemplateSpecializationTypes(this_()),
DependentTemplateSpecializationTypes(this_()),
- GlobalNestedNameSpecifier(0), CFConstantStringTypeDecl(0),
- NSConstantStringTypeDecl(0),
+ GlobalNestedNameSpecifier(0), IsInt128Installed(false),
+ CFConstantStringTypeDecl(0), NSConstantStringTypeDecl(0),
ObjCFastEnumerationStateTypeDecl(0), FILEDecl(0), jmp_bufDecl(0),
sigjmp_bufDecl(0), BlockDescriptorType(0), BlockDescriptorExtendedType(0),
NullTypeSourceInfo(QualType()),
diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp
index 198fd434c8c..27ca86f2f18 100644
--- a/clang/lib/Frontend/PCHReader.cpp
+++ b/clang/lib/Frontend/PCHReader.cpp
@@ -1769,6 +1769,9 @@ void PCHReader::InitializeContext(ASTContext &Ctx) {
Context->ObjCSelRedefinitionType = GetType(ObjCSelRedef);
if (unsigned String = SpecialTypes[pch::SPECIAL_TYPE_NS_CONSTANT_STRING])
Context->setNSConstantStringType(GetType(String));
+
+ if (SpecialTypes[pch::SPECIAL_TYPE_INT128_INSTALLED])
+ Context->setInt128Installed();
}
/// \brief Retrieve the name of the original source file name
diff --git a/clang/lib/Frontend/PCHWriter.cpp b/clang/lib/Frontend/PCHWriter.cpp
index 52db0ee1e7e..1177b9452b8 100644
--- a/clang/lib/Frontend/PCHWriter.cpp
+++ b/clang/lib/Frontend/PCHWriter.cpp
@@ -2159,6 +2159,7 @@ void PCHWriter::WritePCH(Sema &SemaRef, MemorizeStatCalls *StatCalls,
AddTypeRef(Context.getRawBlockdescriptorExtendedType(), Record);
AddTypeRef(Context.ObjCSelRedefinitionType, Record);
AddTypeRef(Context.getRawNSConstantStringType(), Record);
+ Record.push_back(Context.isInt128Installed());
Stream.EmitRecord(pch::SPECIAL_TYPES, Record);
// Keep writing types and declarations until all types and
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 3e23ad30300..6194c293d2b 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -46,7 +46,8 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
VAListTagName = PP.getIdentifierInfo("__va_list_tag");
- if (PP.getTargetInfo().getPointerWidth(0) >= 64) {
+ if (!Context.isInt128Installed() && // May be set by PCHReader.
+ PP.getTargetInfo().getPointerWidth(0) >= 64) {
TypeSourceInfo *TInfo;
// Install [u]int128_t for 64-bit targets.
@@ -61,6 +62,7 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
SourceLocation(),
&Context.Idents.get("__uint128_t"),
TInfo), TUScope);
+ Context.setInt128Installed();
}
OpenPOWER on IntegriCloud