diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-05-22 19:43:45 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-05-22 19:43:45 +0000 |
| commit | aa803409c3bd3930126db630c29f63d42f255153 (patch) | |
| tree | 042106605c08352895ba4383ef97eae88b6b31aa /lib/AST/Type.cpp | |
| parent | 1ce08792766261dcaa25d8215f9d1c2f70d7b7e9 (diff) | |
Notes
Diffstat (limited to 'lib/AST/Type.cpp')
| -rw-r--r-- | lib/AST/Type.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 22d52bcd3f315..1e10094aeeea2 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -3531,7 +3531,7 @@ Optional<NullabilityKind> Type::getNullability(const ASTContext &context) const } while (true); } -bool Type::canHaveNullability() const { +bool Type::canHaveNullability(bool ResultIfUnknown) const { QualType type = getCanonicalTypeInternal(); switch (type->getTypeClass()) { @@ -3559,7 +3559,8 @@ bool Type::canHaveNullability() const { case Type::SubstTemplateTypeParmPack: case Type::DependentName: case Type::DependentTemplateSpecialization: - return true; + case Type::Auto: + return ResultIfUnknown; // Dependent template specializations can instantiate to pointer // types unless they're known to be specializations of a class @@ -3571,12 +3572,7 @@ bool Type::canHaveNullability() const { if (isa<ClassTemplateDecl>(templateDecl)) return false; } - return true; - - // auto is considered dependent when it isn't deduced. - case Type::Auto: - case Type::DeducedTemplateSpecialization: - return !cast<DeducedType>(type.getTypePtr())->isDeduced(); + return ResultIfUnknown; case Type::Builtin: switch (cast<BuiltinType>(type.getTypePtr())->getKind()) { @@ -3595,7 +3591,7 @@ bool Type::canHaveNullability() const { case BuiltinType::PseudoObject: case BuiltinType::UnknownAny: case BuiltinType::ARCUnbridgedCast: - return true; + return ResultIfUnknown; case BuiltinType::Void: case BuiltinType::ObjCId: @@ -3614,6 +3610,7 @@ bool Type::canHaveNullability() const { case BuiltinType::OMPArraySection: return false; } + llvm_unreachable("unknown builtin type"); // Non-pointer types. case Type::Complex: @@ -3629,6 +3626,7 @@ bool Type::canHaveNullability() const { case Type::FunctionProto: case Type::FunctionNoProto: case Type::Record: + case Type::DeducedTemplateSpecialization: case Type::Enum: case Type::InjectedClassName: case Type::PackExpansion: |
