]> granicus.if.org Git - clang/commitdiff
[modules] Allow emission of update records for predefined __va_list_tag.
authorVassil Vassilev <v.g.vassilev@gmail.com>
Mon, 20 Jun 2016 15:10:40 +0000 (15:10 +0000)
committerVassil Vassilev <v.g.vassilev@gmail.com>
Mon, 20 Jun 2016 15:10:40 +0000 (15:10 +0000)
Handles the cases where old __va_list_tag is coming from a module and the new
is not, needing an update record.

Fixes https://llvm.org/bugs/show_bug.cgi?id=27890

Patch by Cristina Cristescu, Richard Smith and me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273159 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Serialization/ASTWriter.cpp
test/Modules/Inputs/PR27890/a.h [new file with mode: 0644]
test/Modules/Inputs/PR27890/module.modulemap [new file with mode: 0644]
test/Modules/pr27890.cpp [new file with mode: 0644]

index 0c9264f403242eeb83d1f3ab7beeb02ebd453feb..30b4a3ebe2ef3d74c9fdfe83e524b87f014b612f 100644 (file)
@@ -5654,10 +5654,6 @@ static bool isImportedDeclContext(ASTReader *Chain, const Decl *D) {
   if (D->isFromASTFile())
     return true;
 
-  // If we've not loaded any modules, this can't be imported.
-  if (!Chain || !Chain->getModuleManager().size())
-    return false;
-
   // The predefined __va_list_tag struct is imported if we imported any decls.
   // FIXME: This is a gross hack.
   return D == D->getASTContext().getVaListTagDecl();
diff --git a/test/Modules/Inputs/PR27890/a.h b/test/Modules/Inputs/PR27890/a.h
new file mode 100644 (file)
index 0000000..9c6e562
--- /dev/null
@@ -0,0 +1,9 @@
+template <class DataType> DataType values(DataType) { __builtin_va_list ValueArgs; return DataType(); }
+
+template <class DataType>
+class opt {
+public:
+  template <class Mods>
+  opt(Mods) {}
+};
+
diff --git a/test/Modules/Inputs/PR27890/module.modulemap b/test/Modules/Inputs/PR27890/module.modulemap
new file mode 100644 (file)
index 0000000..85074e8
--- /dev/null
@@ -0,0 +1 @@
+module A { header "a.h" export * }
diff --git a/test/Modules/pr27890.cpp b/test/Modules/pr27890.cpp
new file mode 100644 (file)
index 0000000..8bb9a9f
--- /dev/null
@@ -0,0 +1,9 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -std=c++11 -I%S/Inputs/PR27890 -verify %s
+// RUN: %clang_cc1 -std=c++11 -fmodules -fmodule-map-file=%S/Inputs/PR27890/module.modulemap -fmodules-cache-path=%t -I%S/Inputs/PR27890 -verify %s
+
+#include "a.h"
+enum ActionType {};
+opt<ActionType> a(values(""));
+
+// expected-no-diagnostics
\ No newline at end of file