[cfe-commits] r155289 - in /cfe/trunk: lib/Serialization/ASTReader.cpp lib/Serialization/ASTWriter.cpp test/PCH/cxx11-exception-spec.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Sat Apr 21 10:47:48 PDT 2012
Author: rsmith
Date: Sat Apr 21 12:47:47 2012
New Revision: 155289
URL: http://llvm.org/viewvc/llvm-project?rev=155289&view=rev
Log:
Fix serialization of uninstantiated exception specifications. Patch by Li Kan,
test by me.
Added:
cfe/trunk/test/PCH/cxx11-exception-spec.cpp
Modified:
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=155289&r1=155288&r2=155289&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Sat Apr 21 12:47:47 2012
@@ -3866,6 +3866,9 @@
EPI.Exceptions = Exceptions.data();
} else if (EST == EST_ComputedNoexcept) {
EPI.NoexceptExpr = ReadExpr(*Loc.F);
+ } else if (EST == EST_Uninstantiated) {
+ EPI.ExceptionSpecDecl = ReadDeclAs<FunctionDecl>(*Loc.F, Record, Idx);
+ EPI.ExceptionSpecTemplate = ReadDeclAs<FunctionDecl>(*Loc.F, Record, Idx);
}
return Context.getFunctionType(ResultType, ParamTypes.data(), NumParams,
EPI);
Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=155289&r1=155288&r2=155289&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Sat Apr 21 12:47:47 2012
@@ -195,6 +195,9 @@
Writer.AddTypeRef(T->getExceptionType(I), Record);
} else if (T->getExceptionSpecType() == EST_ComputedNoexcept) {
Writer.AddStmt(T->getNoexceptExpr());
+ } else if (T->getExceptionSpecType() == EST_Uninstantiated) {
+ Writer.AddDeclRef(T->getExceptionSpecDecl(), Record);
+ Writer.AddDeclRef(T->getExceptionSpecTemplate(), Record);
}
Code = TYPE_FUNCTION_PROTO;
}
Added: cfe/trunk/test/PCH/cxx11-exception-spec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx11-exception-spec.cpp?rev=155289&view=auto
==============================================================================
--- cfe/trunk/test/PCH/cxx11-exception-spec.cpp (added)
+++ cfe/trunk/test/PCH/cxx11-exception-spec.cpp Sat Apr 21 12:47:47 2012
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -pedantic-errors -std=c++11 -emit-pch %s -o %t
+// RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t -verify %s
+
+#ifndef HEADER_INCLUDED
+
+#define HEADER_INCLUDED
+
+template<bool b> int f() noexcept(b) {}
+decltype(f<false>()) a;
+decltype(f<true>()) b;
+
+#else
+
+static_assert(!noexcept(f<false>()), "");
+static_assert(noexcept(f<true>()), "");
+
+#endif
More information about the cfe-commits
mailing list