/// 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,
// 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
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;
}
/// \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;
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;
}
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);
}