[llvm-bugs] [Bug 32670] New: Improve diagnostic for hidden decls coming from non-modular headers
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Apr 14 18:09:05 PDT 2017
http://bugs.llvm.org/show_bug.cgi?id=32670
Bug ID: 32670
Summary: Improve diagnostic for hidden decls coming from
non-modular headers
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Modules
Assignee: unassignedclangbugs at nondot.org
Reporter: bruno.cardoso at gmail.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Created attachment 18290
--> http://bugs.llvm.org/attachment.cgi?id=18290&action=edit
testcase
The following code snippet leads to a very confusing error (also attached for
easy reproduction):
MessageTypes.h:
#ifndef ROOT_MessageTypes
#define ROOT_MessageTypes
enum EMessageTypes {
kROOTD_OPEN = 2004, //filename follows + mode
};
#endif
module.modulemap:
module "libNet.so" {
requires cplusplus
module "TMessage.h" { header "TMessage.h" export * }
module "TNetFile.h" { header "TNetFile.h" export * }
export *
}
Output:
TNetFile.cxx:1:10: remark: building module 'libNet.so' as
'/home/teemperor/Downloads/merge_enum/pcms/3MNDY7KURXTXS/libNet.so-141H35WZHCMDE.pcm'
[-Rmodule-build]
#include "TNetFile.h"
^
TNetFile.cxx:1:10: remark: finished building module 'libNet.so'
[-Rmodule-build]
TNetFile.cxx:2:10: error: declaration of 'kROOTD_OPEN' must be imported from
module 'libNet.so.TMessage.h' before it is required
auto v = kROOTD_OPEN;
^
In module 'libNet.so' imported from TNetFile.cxx:1:
./MessageTypes.h:5:4: note: previous declaration is here
kROOTD_OPEN = 2004, //filename follows + mode
^
1 error generated.
test.sh:
#!/bin/bash
CLANG="/opt/clang/inst/bin/clang"
rm -rf ./pcms/
# Normal clang invocation
#"$CLANG" -cc1 -triple x86_64-apple-macosx10.11.0 -fsyntax-only -I . -std=c++11
-x c++ TNetFile.cxx -nostdsysteminc
# Modules clang invocation
"$CLANG" -cc1 -triple x86_64-apple-macosx10.11.0 -fsyntax-only -I . -std=c++11
-fmodules -fimplicit-module-maps -fmodules-cache-path=./pcms/
-fcolor-diagnostics -fdiagnostics-show-option
-fdiagnostics-show-note-include-stack -x c++ TNetFile.cxx -nostdsysteminc
-Rmodule-build
TMessage.h:
#ifndef ROOT_TMessage
#define ROOT_TMessage
#include "MessageTypes.h"
#endif
TNetFile.cxx:
#include "TNetFile.h"
auto v = kROOTD_OPEN;
TNetFile.h:
#ifndef ROOT_TNetFile
#define ROOT_TNetFile
#include "MessageTypes.h"
#endif
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170415/b733874e/attachment.html>
More information about the llvm-bugs
mailing list