[llvm-bugs] [Bug 37878] New: [Modules] Auto loading of modulemap in subdirectories
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jun 20 05:48:08 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=37878
Bug ID: 37878
Summary: [Modules] Auto loading of modulemap in subdirectories
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Modules
Assignee: unassignedclangbugs at nondot.org
Reporter: yukatkh at gmail.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Created attachment 20450
--> https://bugs.llvm.org/attachment.cgi?id=20450&action=edit
Reproducer
$ tar xvf subdirectory.tar
$ cd module
$ sudo cp input/module.modulemap /usr/include/foobar
$ ~/llvm-build/bin/clang -fmodules -fmodule-name Foo -I input main.cxx
I get:
/usr/include/foobar/module.modulemap:1:8: error: redefinition of module 'a'
module a { header "a.h" }
^
input/module.modulemap:1:8: note: previously defined here
module a { header "a.h" }
^
/usr/include/foobar/module.modulemap:2:8: error: redefinition of module 'b'
module b { header "b.h" }
^
input/module.modulemap:2:8: note: previously defined here
module b { header "b.h" }
^
2 errors generated.
In clang/lib/Lex/HeaderSearch.cpp HeaderSearch::lookupModule(StringRef
ModuleName, StringRef SearchName), if it couldn't find ModuleName in search
paths, it comes to this line
283 // Load all module maps in the immediate subdirectories of this search
284 // directory.
285 loadSubdirectoryModuleMaps(SearchDirs[Idx]);
Which results in iterating over all files in the search path subdirectories for
example "/usr/include/foobar" in this case. I think user don't expect Clang to
load modulemaps in subdirectories implicitly.
I could fix this error if I remove 285. Maybe we should add branch here like:
if (LangOpts.ObjC || LangOpts.ObjCpp) ?
--
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/20180620/801345a1/attachment-0001.html>
More information about the llvm-bugs
mailing list