summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2017-03-24 09:11:57 +0000
committerChandler Carruth <chandlerc@gmail.com>2017-03-24 09:11:57 +0000
commit45bbe0117bee932c967de6d44984ea7dab8f36b5 (patch)
treef138defe1ddbfab8edbad2265af359e6339f6289 /clang/lib/AST/ASTContext.cpp
parent0387364c4c00277be875e1544d99492b0ea7820b (diff)
downloadbcm5719-llvm-45bbe0117bee932c967de6d44984ea7dab8f36b5.tar.gz
bcm5719-llvm-45bbe0117bee932c967de6d44984ea7dab8f36b5.zip
Revert r298491 and r298494 which changed Clang's handling of 'nonnull'
attributes. These patches don't work because we can't currently access the parameter information in a reliable way when building attributes. I thought this would be relatively straightforward to fix, but it seems not to be the case. Fixing this will requrie a substantial re-plumbing of machinery to allow attributes to be handled in this location, and several other fixes to the attribute machinery should probably be made at the same time. All of this will make the patch .... substantially more complicated. Reverting for now as there are active miscompiles caused by the current version. llvm-svn: 298695
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp44
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)
OpenPOWER on IntegriCloud