[cfe-commits] r108354 - in /cfe/trunk: include/clang/AST/DeclBase.h include/clang/AST/Type.h lib/Frontend/PCHReader.cpp
Sebastian Redl
sebastian.redl at getdesigned.at
Wed Jul 14 13:26:45 PDT 2010
Author: cornedbee
Date: Wed Jul 14 15:26:45 2010
New Revision: 108354
URL: http://llvm.org/viewvc/llvm-project?rev=108354&view=rev
Log:
Increase the max PCH level for declarations to 7. Add a FromPCH flag to types.
Modified:
cfe/trunk/include/clang/AST/DeclBase.h
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/lib/Frontend/PCHReader.cpp
Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=108354&r1=108353&r2=108354&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Wed Jul 14 15:26:45 2010
@@ -92,7 +92,7 @@
/// These are meant as bitmasks, so that searches in
/// C++ can look into the "tag" namespace during ordinary lookup.
///
- /// Decl currently provides 16 bits of IDNS bits.
+ /// Decl currently provides 15 bits of IDNS bits.
enum IdentifierNamespace {
/// Labels, declared with 'x:' and referenced with 'goto x'.
IDNS_Label = 0x0001,
@@ -225,10 +225,10 @@
// PCHLevel - the "level" of precompiled header/AST file from which this
// declaration was built.
- unsigned PCHLevel : 2;
+ unsigned PCHLevel : 3;
/// IdentifierNamespace - This specifies what IDNS_* namespace this lives in.
- unsigned IdentifierNamespace : 16;
+ unsigned IdentifierNamespace : 15;
private:
#ifndef NDEBUG
@@ -358,14 +358,14 @@
unsigned getPCHLevel() const { return PCHLevel; }
/// \brief The maximum PCH level that any declaration may have.
- static const unsigned MaxPCHLevel = 3;
-
+ static const unsigned MaxPCHLevel = 7;
+
/// \brief Set the PCH level of this declaration.
void setPCHLevel(unsigned Level) {
- assert(Level < MaxPCHLevel && "PCH level exceeds the maximum");
+ assert(Level <= MaxPCHLevel && "PCH level exceeds the maximum");
PCHLevel = Level;
}
-
+
unsigned getIdentifierNamespace() const {
return IdentifierNamespace;
}
Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=108354&r1=108353&r2=108354&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Wed Jul 14 15:26:45 2010
@@ -786,19 +786,27 @@
/// \brief Linkage of this type.
mutable unsigned CachedLinkage : 2;
-
+
+ /// \brief FromPCH - Whether this type comes from a PCH file.
+ mutable bool FromPCH : 1;
+
+ /// \brief Set whether this type comes from a PCH file.
+ void setFromPCH(bool V = true) const {
+ FromPCH = V;
+ }
+
protected:
/// \brief Compute the linkage of this type.
virtual Linkage getLinkageImpl() const;
- enum { BitsRemainingInType = 20 };
+ enum { BitsRemainingInType = 19 };
// silence VC++ warning C4355: 'this' : used in base member initializer list
Type *this_() { return this; }
Type(TypeClass tc, QualType Canonical, bool dependent)
: CanonicalType(Canonical.isNull() ? QualType(this_(), 0) : Canonical),
TC(tc), Dependent(dependent), LinkageKnown(false),
- CachedLinkage(NoLinkage) {}
+ CachedLinkage(NoLinkage), FromPCH(false) {}
virtual ~Type() {}
virtual void Destroy(ASTContext& C);
friend class ASTContext;
@@ -806,6 +814,9 @@
public:
TypeClass getTypeClass() const { return static_cast<TypeClass>(TC); }
+ /// \brief Whether this type comes from a PCH file.
+ bool isFromPCH() const { return FromPCH; }
+
bool isCanonicalUnqualified() const {
return CanonicalType.getTypePtr() == this;
}
Modified: cfe/trunk/lib/Frontend/PCHReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReader.cpp?rev=108354&r1=108353&r2=108354&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReader.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReader.cpp Wed Jul 14 15:26:45 2010
@@ -2626,8 +2626,10 @@
Index -= pch::NUM_PREDEF_TYPE_IDS;
//assert(Index < TypesLoaded.size() && "Type index out-of-range");
- if (TypesLoaded[Index].isNull())
+ if (TypesLoaded[Index].isNull()) {
TypesLoaded[Index] = ReadTypeRecord(TypeOffsets[Index]);
+ TypesLoaded[Index]->setFromPCH();
+ }
return TypesLoaded[Index].withFastQualifiers(FastQuals);
}
More information about the cfe-commits
mailing list