llvm-project/clang
ZezhengLi d7969012e4 [C++20] [Modules] Check if modulemap exists to avoid crash in implicit used C++ module
An impilt used of C++ module without prebuild path may cause crash.

For example:

```
// ./dir1/C.cppm
export module C;
// ./dir2/B.cppm
export module B;
import C;
// ./A.cpp
import B;
import C;
```

When we compile A.cpp without the prebuild path of C.pcm, the compiler
will crash.

```
clang++ -std=c++20 --precompile -c ./dir1/C.cppm -o ./dir1/C.pcm
clang++ -std=c++20 --precompile -fprebuilt-module-path=./dir2  -c
./dir2/B.cppm -o ./dir2/B.pcm
clang++ -std=c++20 -fprebuilt-module-path=./dir2 A.cpp

```

The prebuilt path of module C is cached when import module B, and in the
function HeaderSearch::getCachedModuleFileName, the compiler try to get
the filename by modulemap without check if modulemap exists, and there
is no modulemap in C++ module.

Reviewed By: ChuanqiXu

Differential review: https://reviews.llvm.org/D119426
2022-02-11 11:22:50 +08:00
..
INPUTS
bindings Recommit: Compress formatting of array type names (int [4] -> int[4]) 2021-10-21 11:34:43 -07:00
cmake [CMake][Fuchsia] Only build iossim runtimes for arm64 2022-01-27 02:28:13 -08:00
docs Reland "[clang-cl] Support the /JMC flag" 2022-02-10 15:16:17 -08:00
examples replace clang LLVM_ENABLE_PLUGINS -> CLANG_PLUGIN_SUPPORT in tests 2022-02-09 17:31:34 -05:00
include Reland "[clang-cl] Support the /JMC flag" 2022-02-10 15:16:17 -08:00
lib [C++20] [Modules] Check if modulemap exists to avoid crash in implicit used C++ module 2022-02-11 11:22:50 +08:00
runtime Fix running orc-rt tests with LLVM_BUILD_EXTERNAL_COMPILER_RT 2022-01-25 08:27:40 -08:00
test [C++20] [Modules] Check if modulemap exists to avoid crash in implicit used C++ module 2022-02-11 11:22:50 +08:00
tools replace clang LLVM_ENABLE_PLUGINS -> CLANG_PLUGIN_SUPPORT in tests 2022-02-09 17:31:34 -05:00
unittests [clang-format] Do not remove required spaces when aligning tokens. 2022-02-10 19:15:27 +01:00
utils Allow parameter pack expansions and initializer lists in annotate attribute 2022-02-08 13:38:07 -05:00
www [analyzer][docs][NFC] Fix some broken links and some cosmetic changes 2022-02-09 10:22:28 +01:00
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt replace clang LLVM_ENABLE_PLUGINS -> CLANG_PLUGIN_SUPPORT in tests 2022-02-09 17:31:34 -05:00
CODE_OWNERS.TXT Add myself as a code owner for SYCL support 2021-09-20 09:32:25 +03:00
INSTALL.txt
LICENSE.TXT
ModuleInfo.txt
NOTES.txt
README.txt

README.txt

//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//

Welcome to Clang.  This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
compiler infrastructure project.

Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
different source-level tools.  One example of this is the Clang Static Analyzer.

If you're interested in more (including how to build Clang) it is best to read
the relevant web sites.  Here are some pointers:

Information on Clang:             http://clang.llvm.org/
Building and using Clang:         http://clang.llvm.org/get_started.html
Clang Static Analyzer:            http://clang-analyzer.llvm.org/
Information on the LLVM project:  http://llvm.org/

If you have questions or comments about Clang, a great place to discuss them is
on the Clang development mailing list:
  http://lists.llvm.org/mailman/listinfo/cfe-dev

If you find a bug in Clang, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/