From: Richard Smith Date: Tue, 30 Aug 2016 19:13:18 +0000 (+0000) Subject: PR29166: when merging declarations with typedef names for linkage purposes, X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3fb1a8554de714cf7e01b8b57b4d073d170676da;p=platform%2Fupstream%2Fllvm.git PR29166: when merging declarations with typedef names for linkage purposes, don't assume that the anonymous struct will be part of the most recent declaration of the typedef. llvm-svn: 280136 --- diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index e00c956..620e1fe 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -2887,7 +2887,7 @@ static NamedDecl *getDeclForMerging(NamedDecl *Found, return nullptr; if (auto *TND = dyn_cast(Found)) - return TND->getAnonDeclWithTypedefName(); + return TND->getAnonDeclWithTypedefName(/*AnyRedecl*/true); return nullptr; } diff --git a/clang/test/Modules/merge-name-for-linkage.cpp b/clang/test/Modules/merge-name-for-linkage.cpp index da1664c..75534bd 100644 --- a/clang/test/Modules/merge-name-for-linkage.cpp +++ b/clang/test/Modules/merge-name-for-linkage.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/merge-name-for-linkage -verify %s // expected-no-diagnostics typedef union {} pthread_mutex_t; +typedef pthread_mutex_t pthread_mutex_t; #include "a.h" pthread_mutex_t x; #include "b.h"