[PATCH] D29753: [PCH] Avoid early VarDecl emission attempt if no owning module avaiable

Bruno Cardoso Lopes via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 1 11:30:31 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL296656: [PCH] Avoid VarDecl emission attempt if no owning module avaiable (authored by bruno).

Changed prior to commit:
  https://reviews.llvm.org/D29753?vs=87774&id=90212#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29753

Files:
  cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
  cfe/trunk/test/PCH/empty-def-fwd-struct.h


Index: cfe/trunk/test/PCH/empty-def-fwd-struct.h
===================================================================
--- cfe/trunk/test/PCH/empty-def-fwd-struct.h
+++ cfe/trunk/test/PCH/empty-def-fwd-struct.h
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -emit-pch -x c++-header %s -std=c++14 -o %t.pch
+// RUN: %clang_cc1 -emit-llvm-only -x c++ /dev/null -std=c++14 -include-pch %t.pch -o %t.o
+struct FVector;
+struct FVector {};
+struct FBox {
+  FVector Min;
+  FBox(int);
+};
+namespace {
+FBox InvalidBoundingBox(0);
+}
+
Index: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
===================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
@@ -2530,8 +2530,8 @@
 
   // An ImportDecl or VarDecl imported from a module will get emitted when
   // we import the relevant module.
-  if ((isa<ImportDecl>(D) || isa<VarDecl>(D)) && Ctx.DeclMustBeEmitted(D) &&
-      D->getImportedOwningModule())
+  if ((isa<ImportDecl>(D) || isa<VarDecl>(D)) && D->getImportedOwningModule() &&
+      Ctx.DeclMustBeEmitted(D))
     return false;
 
   if (isa<FileScopeAsmDecl>(D) || 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29753.90212.patch
Type: text/x-patch
Size: 1164 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170301/a35b6593/attachment.bin>


More information about the cfe-commits mailing list