[cfe-commits] r91911 - in /cfe/trunk: lib/Frontend/PCHReader.cpp lib/Frontend/PCHWriter.cpp test/PCH/functions.c test/PCH/functions.h

Douglas Gregor dgregor at apple.com
Tue Dec 22 10:11:50 PST 2009


Author: dgregor
Date: Tue Dec 22 12:11:50 2009
New Revision: 91911

URL: http://llvm.org/viewvc/llvm-project?rev=91911&view=rev
Log:
Serialize the NoReturn bit on FunctionTypes for precompiled headers

Modified:
    cfe/trunk/lib/Frontend/PCHReader.cpp
    cfe/trunk/lib/Frontend/PCHWriter.cpp
    cfe/trunk/test/PCH/functions.c
    cfe/trunk/test/PCH/functions.h

Modified: cfe/trunk/lib/Frontend/PCHReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReader.cpp?rev=91911&r1=91910&r2=91911&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PCHReader.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReader.cpp Tue Dec 22 12:11:50 2009
@@ -1854,17 +1854,18 @@
   }
 
   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 @@
     return Context->getFunctionType(ResultType, ParamTypes.data(), NumParams,
                                     isVariadic, Quals, hasExceptionSpec,
                                     hasAnyExceptionSpec, NumExceptions,
-                                    Exceptions.data());
+                                    Exceptions.data(), NoReturn);
   }
 
   case pch::TYPE_UNRESOLVED_USING:

Modified: cfe/trunk/lib/Frontend/PCHWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriter.cpp?rev=91911&r1=91910&r2=91911&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PCHWriter.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHWriter.cpp Tue Dec 22 12:11:50 2009
@@ -144,6 +144,7 @@
 
 void PCHTypeWriter::VisitFunctionType(const FunctionType *T) {
   Writer.AddTypeRef(T->getResultType(), Record);
+  Record.push_back(T->getNoReturnAttr());
 }
 
 void PCHTypeWriter::VisitFunctionNoProtoType(const FunctionNoProtoType *T) {

Modified: cfe/trunk/test/PCH/functions.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/functions.c?rev=91911&r1=91910&r2=91911&view=diff

==============================================================================
--- cfe/trunk/test/PCH/functions.c (original)
+++ cfe/trunk/test/PCH/functions.c Tue Dec 22 12:11:50 2009
@@ -18,3 +18,8 @@
   g0(y); // expected-warning{{incompatible pointer types passing 'float *', expected 'int *'}}
   g0(x); 
 }
+
+void __attribute__((noreturn)) test_abort(int code) {
+  do_abort(code);
+}
+  

Modified: cfe/trunk/test/PCH/functions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/functions.h?rev=91911&r1=91910&r2=91911&view=diff

==============================================================================
--- cfe/trunk/test/PCH/functions.h (original)
+++ cfe/trunk/test/PCH/functions.h Tue Dec 22 12:11:50 2009
@@ -4,3 +4,5 @@
 float *f1(float x, float y);
 
 void g0(int *);
+
+void do_abort(int) __attribute__((noreturn));





More information about the cfe-commits mailing list