Clang ++ -fmodules using types after #include <cstdint>

The following simple test file gives me a compile-time error with the end "master" from the Clang github mirror when compiling with -fmodules using the command shown below. I am wondering if this is a bug with the new experimental module function for Clang - maybe a problem with implementing module maps for the standard library - or if I am doing something wrong. An error will appear if I add -fbuiltin-module-map to the command. Interestingly, the error no longer appears if you substitute stdint.h for cstdint .

 #include <stdint.h> uint64_t foo; 

Here is my compilation command with an error message:

 anhall@leviathan : /Users/anhall/impersonal/code/llvm-reflexpr/install/bin/clang++ -o module-uint64_t-test.o -c module-uint64_t-test.cpp --std=c++1z -fmodules module-uint64_t-test.cpp:3:1: error: missing '#include <_types/_uint64_t.h>'; declaration of 'uint64_t' must be imported from module 'Darwin.POSIX._types._uint64_t' before it is required uint64_t foo; ^ /usr/include/_types/_uint64_t.h:31:28: note: previous declaration is here typedef unsigned long long uint64_t; 

Assembly information I use: from the Matus Chochlik fork of the github Clang mirror; but I am set to commit, which corresponds (at that time) to the chapter "master" in the original git mirror (in other words, it does not include commit from the Matus Chochlik branch "reflexpr"):

 anhall@leviathan : /Users/anhall/impersonal/code/llvm-reflexpr/install/bin/clang++ -v clang version 4.0.0 (https://github.com/matus-chochlik/clang.git 1fa85026bfc23f5cda0b89598bd2056b817ae9d4) (https://github.com/llvm-mirror/llvm.git 069db88a3b2cae52023664fdd30378d3adc26566) Target: x86_64-apple-darwin15.6.0 Thread model: posix InstalledDir: /Users/anhall/impersonal/code/llvm-reflexpr/install/bin 

(Note: suspecting that this was a mistake, I also emailed the above report to the LLVM administrators and intend to write it to Bugzilla LLVM if they respond and give me a login. But I thought I posted it here and also if it that I'm wrong or interesting to anyone who works with Clang C ++ 1z + modules support)

Change 1:

If I add -v to the compilation command line, it shows that it is really looking for my include assemblies and not the directories of another Clang assembly, for example:

 #include "..." search starts here: #include <...> search starts here: /Users/anhall/impersonal/code/llvm-reflexpr/install/bin/../include/c++/v1 /usr/local/include /Users/anhall/impersonal/code/llvm-reflexpr/install/bin/../lib/clang/4.0.0/include /usr/include /System/Library/Frameworks (framework directory) /Library/Frameworks (framework directory) End of search list. 

I don't know if the problem could be the interaction between my Clang assembly headers and the OS X system headers in /usr/local/include and /usr/include

+4
source share
1 answer

This was a problem in libC ++, which I fixed in r287690 . If you upgrade your own installation of Clang / libC ++, these problems should be fixed.

Over the past month, I fixed a number of problems using libC ++ with modules. I literally only got all the libC ++ tests that passed yesterday with the modules turned on.

+3
source

Source: https://habr.com/ru/post/1013020/


All Articles