[modules] Allow emission of update records for predefined __va_list_tag.

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.

llvm-svn: 273159
This commit is contained in:
Vassil Vassilev 2016-06-20 15:10:40 +00:00
parent 6d5dc402a1
commit cc218abe34
4 changed files with 19 additions and 4 deletions

View 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();

View File

@ -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) {}
};

View File

@ -0,0 +1 @@
module A { header "a.h" export * }

View File

@ -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