17 Commits

Author SHA1 Message Date
Cyndy Ishida
7f65cc2aa4
[clang][modules] rename "AST" to precompiled in diagnostic messages NFCI (#142635)
As follow up to:
883130e333
2025-06-03 17:59:42 -07:00
David Green
9f7f4acbf0 [Clang][Modules] Add a target to build-explicit.cpp test. NFC
This test relies on two modules being different sizes, which is not always true
with different architectures. Make the test x86 specific at the moment to
ensure it does not fail spuriously.
2025-06-02 19:30:02 +01:00
Cyndy Ishida
3c9027c1d7
[clang][Modules] Clarify error message when size check fails in lookupModuleFile 2025-04-23 10:55:39 -07:00
Michael Spencer
be5c66d97d
[clang] Improve module out of date error message (#128103)
When a pcm file has a different size or modification time than it had
when it was written to another module's IMPORT table Clang emits:

`<pcm> is out of date and needs to be rebuilt: module file out of date`

This is difficult to understand what's happening because there are a lot
of reasons that a module file can be out of date. This changes the
latter part of that message to:

`module file has a different size or mtime than expected`

Which makes it clearer what the issue is. For future work it would be
nice if a more detailed explanation of the issue could be emitted as a
note instead.
2025-02-24 11:18:21 -08:00
Nuri Amari
7aa24915cb
[clang] Expand invalid PCM diagnostic (#69489)
Summary:

When a PCM file is loaded, it can go wrong in various ways. The current
diagnostic only produces the name of the malformed PCM, not why it is
malformed. Expand the diagnostic to display what went wrong!

There is only one call site for this diagnostic, and it already passes
the error message:


https://github.com/llvm/llvm-project/blob/main/clang/lib/Serialization/ASTReader.cpp#L4763-L4764

Test Plan:

The modified LIT test.

---------

Co-authored-by: Nuri Amari <nuriamari@fb.com>
2023-10-18 16:19:54 -07:00
Adrian Prantl
b3b5a7362c Fix a bug preventing the cause for a module file-not-found from being displayed
llvm-svn: 280010
2016-08-29 20:46:59 +00:00
Adrian Prantl
9a06a882bc Fix a bug preventing the cause of a module-out-of-date error from being printed
llvm-svn: 280009
2016-08-29 20:46:56 +00:00
Richard Smith
7e82e019c6 [modules] Flatten -fmodule-name= and -fmodule-implementation-of= into a single
option. Previously these options could both be used to specify that you were
compiling the implementation file of a module, with a different set of minor
bugs in each case.

This change removes -fmodule-implementation-of, and instead tracks a flag to
determine whether we're currently building a module. -fmodule-name now behaves
the same way that -fmodule-implementation-of previously did.

llvm-svn: 261372
2016-02-19 22:25:36 +00:00
NAKAMURA Takumi
4b81164810 clang/test/Modules: Satisfy win32 hosts due to dospath issue.
llvm-svn: 244427
2015-08-09 22:55:50 +00:00
Richard Smith
0f99d6a441 [modules] PR22534: Load files specified by -fmodule-file= eagerly. In particular, this avoids the need to re-parse module map files when using such a module.
llvm-svn: 244416
2015-08-09 08:48:41 +00:00
Richard Smith
47972afd10 [modules] Simplify -cc1 interface for enabling implicit module maps.
We used to have a flag to enable module maps, and two more flags to enable
implicit module maps. This is all redundant; we don't need any flag for
enabling module maps in the abstract, and we don't usually have -fno- flags for
-cc1. We now have just a single flag, -fimplicit-module-maps, that enables
implicitly searching the file system for module map files and loading them.

The driver interface is unchanged for now. We should probably rename
-fmodule-maps to -fimplicit-module-maps at some point.

llvm-svn: 239789
2015-06-16 00:08:24 +00:00
Richard Smith
7f330cdb31 Make module files passed to a module build via -fmodule-file= available to
consumers of that module.

Previously, such a file would only be available if the module happened to
actually import something from that module.

llvm-svn: 232583
2015-03-18 01:42:29 +00:00
Richard Smith
37bd29a5e6 Give better diagnostics when -fmodule-file= finds a bad file: if the file is
found indirectly, explain how we got there, and distinguish between 'file not
found' and 'file found but invalid'.

llvm-svn: 230839
2015-02-28 03:09:52 +00:00
Richard Smith
5b39075668 [modules] When explicitly importing a module, it's fine for the imported module
to be newer than we were expecting. That happens if .pcm's get moved between
file systems during a distributed build. (It's still not OK for them to actually
be different, though, so we still check the size and signature matches.)

llvm-svn: 222507
2014-11-21 05:37:20 +00:00
NAKAMURA Takumi
314df7a5aa clang/test/Modules/explicit-build.cpp: Tweak to meet win32's backslash.
llvm-svn: 220770
2014-10-28 11:34:29 +00:00
Richard Smith
d4b230b378 [modules] Load .pcm files specified by -fmodule-file lazily.
llvm-svn: 220731
2014-10-27 23:01:16 +00:00
Richard Smith
e842a47452 [modules] Initial support for explicitly loading .pcm files.
Implicit module builds are not well-suited to a lot of build systems. In
particular, they fare badly in distributed build systems, and they lead to
build artifacts that are not tracked as part of the usual dependency management
process. This change allows explicitly-built module files (which are already
supported through the -emit-module flag) to be explicitly loaded into a build,
allowing build systems to opt to manage module builds and dependencies
themselves.

This is only the first step in supporting such configurations, and it should
be considered experimental and subject to change or removal for now.

llvm-svn: 220359
2014-10-22 02:05:46 +00:00