mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 03:06:07 +00:00

Allow ODR for ObjC/C in the sense that we won't keep more that one definition around (merge them). However, ensure the decl pass the structural compatibility check in C11 6.2.7/1, for that, reuse the structural equivalence checks used by the ASTImporter. Few other considerations: - Create error diagnostics for tag types mismatches and thread them into the structural equivalence checks. - Note that by doing this we only support redefinition between types that are considered "compatible types" by C. This is mixed approach of the suggestions discussed in http://lists.llvm.org/pipermail/cfe-dev/2017-March/053257.html Differential Revision: https://reviews.llvm.org/D31778 rdar://problem/31909368 llvm-svn: 306918
13 lines
705 B
Objective-C
13 lines
705 B
Objective-C
// RUN: rm -rf %t.tmp
|
|
// RUN: %clang_cc1 -fsyntax-only -I %S/Inputs/SameHeader -fmodules \
|
|
// RUN: -fimplicit-module-maps -fmodules-cache-path=%t.tmp %s -verify
|
|
|
|
// expected-error@Inputs/SameHeader/C.h:3 {{redefinition of 'c'}}
|
|
// expected-note-re@Inputs/SameHeader/B.h:3 {{'{{.*}}C.h' included multiple times, additional include site in header from module 'X.B'}}
|
|
// expected-note@Inputs/SameHeader/module.modulemap:6 {{X.B defined here}}
|
|
// expected-note-re@redefinition-same-header.m:20 {{'{{.*}}C.h' included multiple times, additional include site here}}
|
|
// expected-warning@Inputs/SameHeader/C.h:9 {{typedef requires a name}}
|
|
|
|
#include "A.h" // maps to a modular
|
|
#include "C.h" // textual include
|