[PATCH] D81474: Handle delayed-template-parsing functions imported into a non-dtp TU

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 12 07:34:30 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG05ed3efc2ac7: Handle delayed-template-parsing functions imported into a non-dtp TU (authored by sammccall).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81474/new/

https://reviews.llvm.org/D81474

Files:
  clang/lib/Parse/Parser.cpp
  clang/test/PCH/delayed-template-parsing.cpp


Index: clang/test/PCH/delayed-template-parsing.cpp
===================================================================
--- /dev/null
+++ clang/test/PCH/delayed-template-parsing.cpp
@@ -0,0 +1,14 @@
+// Check any combination of delayed-template-parsing between PCH and TU works.
+// RUN: %clang_cc1 %s -emit-pch -o %t.pch
+// RUN: %clang_cc1 -fdelayed-template-parsing %s -emit-pch -o %t.delayed.pch
+// RUN: %clang_cc1 -DMAIN_FILE -include-pch %t.pch %s
+// RUN: %clang_cc1 -DMAIN_FILE -fdelayed-template-parsing -include-pch %t.pch %s
+// RUN: %clang_cc1 -DMAIN_FILE -include-pch %t.delayed.pch %s
+// RUN: %clang_cc1 -DMAIN_FILE -fdelayed-template-parsing -include-pch %t.delayed.pch %s
+
+#ifndef MAIN_FILE
+template <typename T>
+T successor(T Value) { return Value + 1; }
+#else
+int x = successor(42);
+#endif
Index: clang/lib/Parse/Parser.cpp
===================================================================
--- clang/lib/Parse/Parser.cpp
+++ clang/lib/Parse/Parser.cpp
@@ -652,9 +652,7 @@
     }
 
     // Late template parsing can begin.
-    if (getLangOpts().DelayedTemplateParsing)
-      Actions.SetLateTemplateParser(LateTemplateParserCallback, nullptr,
-                                    this);
+    Actions.SetLateTemplateParser(LateTemplateParserCallback, nullptr, this);
     if (!PP.isIncrementalProcessingEnabled())
       Actions.ActOnEndOfTranslationUnit();
     //else don't tell Sema that we ended parsing: more input might come.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81474.270400.patch
Type: text/x-patch
Size: 1459 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200612/a09e4fa0/attachment.bin>


More information about the cfe-commits mailing list