r280136 - PR29166: when merging declarations with typedef names for linkage purposes,

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 30 12:13:19 PDT 2016


Author: rsmith
Date: Tue Aug 30 14:13:18 2016
New Revision: 280136

URL: http://llvm.org/viewvc/llvm-project?rev=280136&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
    cfe/trunk/test/Modules/merge-name-for-linkage.cpp

Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=280136&r1=280135&r2=280136&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Tue Aug 30 14:13:18 2016
@@ -2887,7 +2887,7 @@ static NamedDecl *getDeclForMerging(Name
     return nullptr;
 
   if (auto *TND = dyn_cast<TypedefNameDecl>(Found))
-    return TND->getAnonDeclWithTypedefName();
+    return TND->getAnonDeclWithTypedefName(/*AnyRedecl*/true);
 
   return nullptr;
 }

Modified: cfe/trunk/test/Modules/merge-name-for-linkage.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/merge-name-for-linkage.cpp?rev=280136&r1=280135&r2=280136&view=diff
==============================================================================
--- cfe/trunk/test/Modules/merge-name-for-linkage.cpp (original)
+++ cfe/trunk/test/Modules/merge-name-for-linkage.cpp Tue Aug 30 14:13:18 2016
@@ -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"




More information about the cfe-commits mailing list