r291600 - Serialize the UsesSEH bit on FunctionDecl

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 10 13:27:03 PST 2017


Author: rnk
Date: Tue Jan 10 15:27:03 2017
New Revision: 291600

URL: http://llvm.org/viewvc/llvm-project?rev=291600&view=rev
Log:
Serialize the UsesSEH bit on FunctionDecl

Fixes PR31539

Added:
    cfe/trunk/test/PCH/uses-seh.cpp
Modified:
    cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
    cfe/trunk/lib/Serialization/ASTWriterDecl.cpp

Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=291600&r1=291599&r2=291600&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Tue Jan 10 15:27:03 2017
@@ -748,6 +748,7 @@ void ASTDeclReader::VisitFunctionDecl(Fu
   FD->IsExplicitlyDefaulted = Record.readInt();
   FD->HasImplicitReturnZero = Record.readInt();
   FD->IsConstexpr = Record.readInt();
+  FD->UsesSEHTry = Record.readInt();
   FD->HasSkippedBody = Record.readInt();
   FD->IsLateTemplateParsed = Record.readInt();
   FD->setCachedLinkage(Linkage(Record.readInt()));

Modified: cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterDecl.cpp?rev=291600&r1=291599&r2=291600&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Tue Jan 10 15:27:03 2017
@@ -529,6 +529,7 @@ void ASTDeclWriter::VisitFunctionDecl(Fu
   Record.push_back(D->IsExplicitlyDefaulted);
   Record.push_back(D->HasImplicitReturnZero);
   Record.push_back(D->IsConstexpr);
+  Record.push_back(D->UsesSEHTry);
   Record.push_back(D->HasSkippedBody);
   Record.push_back(D->IsLateTemplateParsed);
   Record.push_back(D->getLinkageInternal());
@@ -2032,6 +2033,7 @@ void ASTWriter::WriteDeclAbbrevs() {
   Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ExplicitlyDefaulted
   Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ImplicitReturnZero
   Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Constexpr
+  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // UsesSEHTry
   Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // SkippedBody
   Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // LateParsed
   Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage

Added: cfe/trunk/test/PCH/uses-seh.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/uses-seh.cpp?rev=291600&view=auto
==============================================================================
--- cfe/trunk/test/PCH/uses-seh.cpp (added)
+++ cfe/trunk/test/PCH/uses-seh.cpp Tue Jan 10 15:27:03 2017
@@ -0,0 +1,29 @@
+// Make SEH works in PCH
+//
+// Test this without pch.
+// RUN: %clang_cc1 -fms-extensions -triple x86_64-windows-msvc -std=c++11 -include %s -emit-llvm -o - %s | FileCheck %s
+
+// Test with pch.
+// RUN: %clang_cc1 -fms-extensions -triple x86_64-windows-msvc -std=c++11 -emit-pch -o %t %s
+// RUN: %clang_cc1 -fms-extensions -triple x86_64-windows-msvc -std=c++11 -include-pch %t -emit-llvm -o - %s | FileCheck %s
+
+#ifndef HEADER
+#define HEADER
+
+int shouldCatch();
+inline int f() {
+  __try {
+  } __except (shouldCatch()) {
+  }
+  return 0;
+}
+int x = f();
+
+// CHECK: define linkonce_odr i32 @"\01?f@@YAHXZ"()
+// CHECK: define internal i32 @"\01?filt$0 at 0@f@@"({{.*}})
+
+#else
+
+// empty
+
+#endif




More information about the cfe-commits mailing list