assert(!Canonical && "Shouldn't be in the map!")((!Canonical && "Shouldn't be in the map!") ? static_cast<void> (0) : __assert_fail ("!Canonical && \"Shouldn't be in the map!\"", "/tmp/buildd/llvm-toolchain-snapshot-5.0~svn300578/tools/clang/lib/AST/ASTContext.cpp", 672, __PRETTY_FUNCTION__));

default: llvm_unreachable("Not a floating point type!")::llvm::llvm_unreachable_internal("Not a floating point type!", "/tmp/buildd/llvm-toolchain-snapshot-5.0~svn300578/tools/clang/lib/AST/ASTContext.cpp", 1415);

llvm_unreachable("Should not see dependent types")::llvm::llvm_unreachable_internal("Should not see dependent types", "/tmp/buildd/llvm-toolchain-snapshot-5.0~svn300578/tools/clang/lib/AST/ASTContext.cpp", 1637);

assert(llvm::isPowerOf2_32(Align) && "Alignment must be power of 2")((llvm::isPowerOf2_32(Align) && "Alignment must be power of 2") ? static_cast<void> (0) : __assert_fail ("llvm::isPowerOf2_32(Align) && \"Alignment must be power of 2\"", "/tmp/buildd/llvm-toolchain-snapshot-5.0~svn300578/tools/clang/lib/AST/ASTContext.cpp", 1949, __PRETTY_FUNCTION__));

assert(!AT && "Shouldn't be in the map!")((!AT && "Shouldn't be in the map!") ? static_cast<void> (0) : __assert_fail ("!AT && \"Shouldn't be in the map!\"", "/tmp/buildd/llvm-toolchain-snapshot-5.0~svn300578/tools/clang/lib/AST/ASTContext.cpp", 2498, __PRETTY_FUNCTION__));

assert(!AT && "Shouldn't be in the map!")((!AT && "Shouldn't be in the map!") ? static_cast<void> (0) : __assert_fail ("!AT && \"Shouldn't be in the map!\"", "/tmp/buildd/llvm-toolchain-snapshot-5.0~svn300578/tools/clang/lib/AST/ASTContext.cpp", 2538, __PRETTY_FUNCTION__));

2539

2540

AT = new (*this, TypeAlignment) DecayedType(T, Decayed, Canonical);

2541

Types.push_back(AT);

2542

AdjustedTypes.InsertNode(AT, InsertPos);

2543

return QualType(AT, 0);

2544

}

2545

2546

/// getBlockPointerType - Return the uniqued reference to the type for

llvm_unreachable("type should never be variably-modified")::llvm::llvm_unreachable_internal("type should never be variably-modified", "/tmp/buildd/llvm-toolchain-snapshot-5.0~svn300578/tools/clang/lib/AST/ASTContext.cpp", 2773);

2774

2775

// These types can be variably-modified but should never need to

2776

// further decay.

2777

case Type::FunctionNoProto:

2778

case Type::FunctionProto:

2779

case Type::BlockPointer:

2780

case Type::MemberPointer:

2781

case Type::Pipe:

2782

return type;

2783

2784

// These types can be variably-modified. All these modifications

2785

// preserve structure except as noted by comments.

2786

// TODO: if we ever care about optimizing VLAs, there are no-op

2787

// optimizations available here.

2788

case Type::Pointer:

2789

result = getPointerType(getVariableArrayDecayedType(

2790

cast<PointerType>(ty)->getPointeeType()));

2791

break;

2792

2793

case Type::LValueReference: {

2794

const LValueReferenceType *lv = cast<LValueReferenceType>(ty);

2795

result = getLValueReferenceType(

2796

getVariableArrayDecayedType(lv->getPointeeType()),

2797

lv->isSpelledAsLValue());

2798

break;

2799

}

2800

2801

case Type::RValueReference: {

2802

const RValueReferenceType *lv = cast<RValueReferenceType>(ty);

2803

result = getRValueReferenceType(

2804

getVariableArrayDecayedType(lv->getPointeeType()));

2805

break;

2806

}

2807

2808

case Type::Atomic: {

2809

const AtomicType *at = cast<AtomicType>(ty);

2810

result = getAtomicType(getVariableArrayDecayedType(at->getValueType()));

// If the pipe element type isn't canonical, this won't be a canonical type

3367

// either, so fill in the canonical type field.

3368

QualType Canonical;

3369

if (!T.isCanonical()) {

3370

Canonical = getPipeType(getCanonicalType(T), ReadOnly);

3371

3372

// Get the new insert position for the node we care about.

3373

PipeType *NewIP = PipeTypes.FindNodeOrInsertPos(ID, InsertPos);

3374

assert(!NewIP && "Shouldn't be in the map!")((!NewIP && "Shouldn't be in the map!") ? static_cast<void> (0) : __assert_fail ("!NewIP && \"Shouldn't be in the map!\"", "/tmp/buildd/llvm-toolchain-snapshot-5.0~svn300578/tools/clang/lib/AST/ASTContext.cpp", 3374, __PRETTY_FUNCTION__));

default: llvm_unreachable("getFloatingRank(): not a floating type")::llvm::llvm_unreachable_internal("getFloatingRank(): not a floating type", "/tmp/buildd/llvm-toolchain-snapshot-5.0~svn300578/tools/clang/lib/AST/ASTContext.cpp", 5048);

5049

case BuiltinType::Half: return HalfRank;

5050

case BuiltinType::Float: return FloatRank;

5051

case BuiltinType::Double: return DoubleRank;

5052

case BuiltinType::LongDouble: return LongDoubleRank;

5053

case BuiltinType::Float128: return Float128Rank;

5054

}

5055

}

5056

5057

/// getFloatingTypeOfSizeWithinDomain - Returns a real floating

5058

/// point or a complex type (based on typeDomain/typeSize).

5059

/// 'typeDomain' is a real floating point or complex type.

5060

/// 'typeSize' is a real floating point or complex type.

5061

QualType ASTContext::getFloatingTypeOfSizeWithinDomain(QualType Size,

5062

QualType Domain) const {

5063

FloatingRank EltRank = getFloatingRank(Size);

5064

if (Domain->isComplexType()) {

5065

switch (EltRank) {

5066

case HalfRank: llvm_unreachable("Complex half is not supported")::llvm::llvm_unreachable_internal("Complex half is not supported", "/tmp/buildd/llvm-toolchain-snapshot-5.0~svn300578/tools/clang/lib/AST/ASTContext.cpp", 5066);

default: llvm_unreachable("getIntegerRank(): not a built-in integer")::llvm::llvm_unreachable_internal("getIntegerRank(): not a built-in integer", "/tmp/buildd/llvm-toolchain-snapshot-5.0~svn300578/tools/clang/lib/AST/ASTContext.cpp", 5107);

5108

case BuiltinType::Bool:

5109

return 1 + (getIntWidth(BoolTy) << 3);

5110

case BuiltinType::Char_S:

5111

case BuiltinType::Char_U:

5112

case BuiltinType::SChar:

5113

case BuiltinType::UChar:

5114

return 2 + (getIntWidth(CharTy) << 3);

5115

case BuiltinType::Short:

5116

case BuiltinType::UShort:

5117

return 3 + (getIntWidth(ShortTy) << 3);

5118

case BuiltinType::Int:

5119

case BuiltinType::UInt:

5120

return 4 + (getIntWidth(IntTy) << 3);

5121

case BuiltinType::Long:

5122

case BuiltinType::ULong:

5123

return 5 + (getIntWidth(LongTy) << 3);

5124

case BuiltinType::LongLong:

5125

case BuiltinType::ULongLong:

5126

return 6 + (getIntWidth(LongLongTy) << 3);

5127

case BuiltinType::Int128:

5128

case BuiltinType::UInt128:

5129

return 7 + (getIntWidth(Int128Ty) << 3);

5130

}

5131

}

5132

5133

/// \brief Whether this is a promotable bitfield reference according

5134

/// to C99 6.3.1.1p2, bullet 2 (and GCC extensions).

5135

///

5136

/// \returns the type this bit-field will promote to, or NULL if no

5137

/// promotion occurs.

5138

QualType ASTContext::isPromotableBitField(Expr *E) const {

5139

if (E->isTypeDependent() || E->isValueDependent())

5140

return QualType();

5141

5142

// FIXME: We should not do this unless E->refersToBitField() is true. This

5143

// matters in C where getSourceBitField() will find bit-fields for various

llvm_unreachable("char type should fit into long long")::llvm::llvm_unreachable_internal("char type should fit into long long", "/tmp/buildd/llvm-toolchain-snapshot-5.0~svn300578/tools/clang/lib/AST/ASTContext.cpp", 5213);

llvm_unreachable("fell out of lifetime switch!")::llvm::llvm_unreachable_internal("fell out of lifetime switch!", "/tmp/buildd/llvm-toolchain-snapshot-5.0~svn300578/tools/clang/lib/AST/ASTContext.cpp", 5486);

assert(!RDecl->isUnion() && "Should not be called for unions")((!RDecl->isUnion() && "Should not be called for unions") ? static_cast<void> (0) : __assert_fail ("!RDecl->isUnion() && \"Should not be called for unions\"", "/tmp/buildd/llvm-toolchain-snapshot-5.0~svn300578/tools/clang/lib/AST/ASTContext.cpp", 6388, __PRETTY_FUNCTION__));

assert(rhsQID && "One of the LHS/RHS should be id<x>")((rhsQID && "One of the LHS/RHS should be id<x>") ? static_cast<void> (0) : __assert_fail ("rhsQID && \"One of the LHS/RHS should be id<x>\"", "/tmp/buildd/llvm-toolchain-snapshot-5.0~svn300578/tools/clang/lib/AST/ASTContext.cpp", 7305, __PRETTY_FUNCTION__));

7306

7307

if (const ObjCObjectPointerType *lhsOPT =

7308

lhs->getAsObjCInterfacePointerType()) {

7309

// If both the right and left sides have qualifiers.

7310

for (auto *lhsProto : lhsOPT->quals()) {

7311

bool match = false;

7312

7313

// when comparing an id<P> on rhs with a static type on lhs,

7314

// see if static class implements all of id's protocols, directly or

7315

// through its super class and categories.

7316

// First, lhs protocols in the qualifier list must be found, direct

7317

// or indirect in rhs's qualifier list or it is a mismatch.

7318

for (auto *rhsProto : rhsQID->quals()) {

7319

if (ProtocolCompatibleWithProtocol(lhsProto, rhsProto) ||

7320

(compare && ProtocolCompatibleWithProtocol(rhsProto, lhsProto))) {

7321

match = true;

7322

break;

7323

}

7324

}

7325

if (!match)

7326

returnfalse;

7327

}

7328

7329

// Static class's protocols, or its super class or category protocols

7330

// must be found, direct or indirect in rhs's qualifier list or it is a mismatch.

7331

if (ObjCInterfaceDecl *lhsID = lhsOPT->getInterfaceDecl()) {

7332

llvm::SmallPtrSet<ObjCProtocolDecl *, 8> LHSInheritedProtocols;

7333

CollectInheritedProtocols(lhsID, LHSInheritedProtocols);

7334

// This is rather dubious but matches gcc's behavior. If lhs has

7335

// no type qualifier and its class has no static protocol(s)

7336

// assume that it is mismatch.

7337

if (LHSInheritedProtocols.empty() && lhsOPT->qual_empty())

7338

returnfalse;

7339

for (auto *lhsProto : LHSInheritedProtocols) {

7340

bool match = false;

7341

for (auto *rhsProto : rhsQID->quals()) {

7342

if (ProtocolCompatibleWithProtocol(lhsProto, rhsProto) ||

7343

(compare && ProtocolCompatibleWithProtocol(rhsProto, lhsProto))) {

7344

match = true;

7345

break;

7346

}

7347

}

7348

if (!match)

7349

returnfalse;

7350

}

7351

}

7352

returntrue;

7353

}

7354

returnfalse;

7355

}

7356

7357

/// canAssignObjCInterfaces - Return true if the two interface types are

7358

/// compatible for assignment from RHS to LHS. This handles validation of any