[PATCH] D28832: Improve redefinition errors pointing to the same header.

Bruno Cardoso Lopes via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 14 18:05:57 PDT 2017


bruno updated this revision to Diff 95369.
bruno marked 2 inline comments as done.
bruno added a comment.

Updated the patch after Richard's comments:

Before
------

  In file included from x.c:2:
  Inputs4/C.h:3:5: error: redefinition of 'c'
  int c = 1;
      ^
  In module 'X' imported from x.c:1:
  Inputs4/C.h:3:5: note: previous definition is here
  int c = 1;
      ^
  1 error generated.

After
-----

  In file included from x.c:2:
  Inputs4/C.h:3:5: error: redefinition of 'c'
  int c = 1;
      ^
  In module 'X' imported from x.c:1:
  Inputs4/B.h:3:10: note: 'Inputs4/C.h' included multiple times, additional include site in header from module 'X.B'
  #include "C.h"
           ^
  Inputs4/module.modulemap:6:10: note: X.B defined here
    module B {
           ^
  x.c:2:10: note: 'Inputs4/C.h' included multiple times, additional include site here
  #include "C.h" // textual include
           ^
  1 error generated.


https://reviews.llvm.org/D28832

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/Sema/SemaDecl.cpp
  test/Modules/Inputs/SameHeader/A.h
  test/Modules/Inputs/SameHeader/B.h
  test/Modules/Inputs/SameHeader/C.h
  test/Modules/Inputs/SameHeader/module.modulemap
  test/Modules/redefinition-same-header.m
  test/Sema/redefinition-same-header.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28832.95369.patch
Type: text/x-patch
Size: 13956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170415/d141ceb2/attachment-0001.bin>


More information about the cfe-commits mailing list