diff options
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 1c1f78ad266..071537a051c 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -8499,14 +8499,13 @@ void ASTMutationListener::DeducedReturnType(const FunctionDecl *FD, /// to be an Integer Constant Expression. static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context, ASTContext::GetBuiltinTypeError &Error, - bool &RequiresICE, bool &OverrideNonnull, + bool &RequiresICE, bool AllowTypeModifiers) { // Modifiers. int HowLong = 0; bool Signed = false, Unsigned = false; RequiresICE = false; - OverrideNonnull = false; - + // Read the prefixed modifiers first. bool Done = false; while (!Done) { @@ -8515,9 +8514,6 @@ static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context, case 'I': RequiresICE = true; break; - case 'N': - OverrideNonnull = true; - break; case 'S': assert(!Unsigned && "Can't use both 'S' and 'U' modifiers!"); assert(!Signed && "Can't use 'S' modifier multiple times!"); @@ -8652,8 +8648,8 @@ static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context, assert(End != Str && "Missing vector size"); Str = End; - QualType ElementType = DecodeTypeFromStr(Str, Context, Error, RequiresICE, - OverrideNonnull, false); + QualType ElementType = DecodeTypeFromStr(Str, Context, Error, + RequiresICE, false); assert(!RequiresICE && "Can't require vector ICE"); // TODO: No way to make AltiVec vectors in builtins yet. @@ -8668,15 +8664,15 @@ static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context, assert(End != Str && "Missing vector size"); Str = End; - + QualType ElementType = DecodeTypeFromStr(Str, Context, Error, RequiresICE, - OverrideNonnull, false); + false); Type = Context.getExtVectorType(ElementType, NumElements); break; } case 'X': { QualType ElementType = DecodeTypeFromStr(Str, Context, Error, RequiresICE, - OverrideNonnull, false); + false); assert(!RequiresICE && "Can't require complex ICE"); Type = Context.getComplexType(ElementType); break; @@ -8758,37 +8754,27 @@ static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context, } /// GetBuiltinType - Return the type for the specified builtin. -QualType ASTContext::GetBuiltinType(unsigned Id, GetBuiltinTypeError &Error, - unsigned *IntegerConstantArgs, - bool *OverrideNonnullReturn, - unsigned *OverrideNonnullArgs) const { +QualType ASTContext::GetBuiltinType(unsigned Id, + GetBuiltinTypeError &Error, + unsigned *IntegerConstantArgs) const { const char *TypeStr = BuiltinInfo.getTypeString(Id); SmallVector<QualType, 8> ArgTypes; bool RequiresICE = false; - bool OverrideNonnull = false; Error = GE_None; - QualType ResType = DecodeTypeFromStr(TypeStr, *this, Error, RequiresICE, - OverrideNonnull, true); + QualType ResType = DecodeTypeFromStr(TypeStr, *this, Error, + RequiresICE, true); if (Error != GE_None) return QualType(); - - if (OverrideNonnullReturn) - *OverrideNonnullReturn = OverrideNonnull; + assert(!RequiresICE && "Result of intrinsic cannot be required to be an ICE"); - + while (TypeStr[0] && TypeStr[0] != '.') { - QualType Ty = DecodeTypeFromStr(TypeStr, *this, Error, RequiresICE, - OverrideNonnull, true); + QualType Ty = DecodeTypeFromStr(TypeStr, *this, Error, RequiresICE, true); if (Error != GE_None) return QualType(); - // If this argument should have any nonnull annotations overriden, fill in - // the bitmask. - if (OverrideNonnull && OverrideNonnullArgs) - *OverrideNonnullArgs |= 1 << ArgTypes.size(); - // If this argument is required to be an IntegerConstantExpression and the // caller cares, fill in the bitmask we return. if (RequiresICE && IntegerConstantArgs) |