Serialize the NoReturn bit on FunctionTypes for precompiled headers

llvm-svn: 91911
This commit is contained in:
Douglas Gregor 2009-12-22 18:11:50 +00:00
parent 71d7eaa87e
commit dc72875d25
4 changed files with 13 additions and 4 deletions

View File

@ -1854,17 +1854,18 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) {
}
case pch::TYPE_FUNCTION_NO_PROTO: {
if (Record.size() != 1) {
if (Record.size() != 2) {
Error("incorrect encoding of no-proto function type");
return QualType();
}
QualType ResultType = GetType(Record[0]);
return Context->getFunctionNoProtoType(ResultType);
return Context->getFunctionNoProtoType(ResultType, Record[1]);
}
case pch::TYPE_FUNCTION_PROTO: {
QualType ResultType = GetType(Record[0]);
unsigned Idx = 1;
bool NoReturn = Record[1];
unsigned Idx = 2;
unsigned NumParams = Record[Idx++];
llvm::SmallVector<QualType, 16> ParamTypes;
for (unsigned I = 0; I != NumParams; ++I)
@ -1880,7 +1881,7 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) {
return Context->getFunctionType(ResultType, ParamTypes.data(), NumParams,
isVariadic, Quals, hasExceptionSpec,
hasAnyExceptionSpec, NumExceptions,
Exceptions.data());
Exceptions.data(), NoReturn);
}
case pch::TYPE_UNRESOLVED_USING:

View File

@ -144,6 +144,7 @@ void PCHTypeWriter::VisitExtVectorType(const ExtVectorType *T) {
void PCHTypeWriter::VisitFunctionType(const FunctionType *T) {
Writer.AddTypeRef(T->getResultType(), Record);
Record.push_back(T->getNoReturnAttr());
}
void PCHTypeWriter::VisitFunctionNoProtoType(const FunctionNoProtoType *T) {

View File

@ -18,3 +18,8 @@ void test_g0(int *x, float * y) {
g0(y); // expected-warning{{incompatible pointer types passing 'float *', expected 'int *'}}
g0(x);
}
void __attribute__((noreturn)) test_abort(int code) {
do_abort(code);
}

View File

@ -4,3 +4,5 @@ int f0(int x, int y, ...);
float *f1(float x, float y);
void g0(int *);
void do_abort(int) __attribute__((noreturn));