-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang][deps] Make clang-scan-deps write modules in raw format
We have no use for debug info for the scanner modules, and writing raw ast files speeds up scanning ~15% in some cases. Note that the compile commands produced by the scanner will still build the obj format (if requested), and the scanner can *read* obj format pcms, e.g. from a PCH. rdar://108807592 Differential Revision: https://reviews.llvm.org/D149693
- Loading branch information
1 parent
3b01fa2
commit 8fe8d69
Showing
10 changed files
with
94 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Check that the scanner produces raw ast files, even when builds produce the | ||
// obj format, and that the scanner can read obj format from PCH and modules | ||
// imported by PCH. | ||
|
||
// Unsupported on AIX because we don't support the requisite "__clangast" | ||
// section in XCOFF yet. | ||
// UNSUPPORTED: target={{.*}}-aix{{.*}} | ||
|
||
// REQUIRES: shell | ||
|
||
// RUN: rm -rf %t && mkdir %t | ||
// RUN: cp %S/Inputs/modules-pch/* %t | ||
|
||
// Scan dependencies of the PCH: | ||
// | ||
// RUN: rm -f %t/cdb_pch.json | ||
// RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch/cdb_pch.json > %t/cdb_pch.json | ||
// RUN: clang-scan-deps -compilation-database %t/cdb_pch.json -format experimental-full \ | ||
// RUN: -module-files-dir %t/build > %t/result_pch.json | ||
|
||
// Explicitly build the PCH: | ||
// | ||
// RUN: %deps-to-rsp %t/result_pch.json --module-name=ModCommon1 > %t/mod_common_1.cc1.rsp | ||
// RUN: %deps-to-rsp %t/result_pch.json --module-name=ModCommon2 > %t/mod_common_2.cc1.rsp | ||
// RUN: %deps-to-rsp %t/result_pch.json --module-name=ModPCH > %t/mod_pch.cc1.rsp | ||
// RUN: %deps-to-rsp %t/result_pch.json --tu-index=0 > %t/pch.rsp | ||
// | ||
// RUN: %clang @%t/mod_common_1.cc1.rsp | ||
// RUN: %clang @%t/mod_common_2.cc1.rsp | ||
// RUN: %clang @%t/mod_pch.cc1.rsp | ||
// RUN: %clang @%t/pch.rsp | ||
|
||
// Scan dependencies of the TU: | ||
// | ||
// RUN: rm -f %t/cdb_tu.json | ||
// RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch/cdb_tu.json > %t/cdb_tu.json | ||
// RUN: clang-scan-deps -compilation-database %t/cdb_tu.json -format experimental-full \ | ||
// RUN: -module-files-dir %t/build > %t/result_tu.json | ||
|
||
// Explicitly build the TU: | ||
// | ||
// RUN: %deps-to-rsp %t/result_tu.json --module-name=ModTU > %t/mod_tu.cc1.rsp | ||
// RUN: %deps-to-rsp %t/result_tu.json --tu-index=0 > %t/tu.rsp | ||
// | ||
// RUN: %clang @%t/mod_tu.cc1.rsp | ||
// RUN: %clang @%t/tu.rsp | ||
|
||
// Check the module format for scanner modules: | ||
// | ||
// RUN: find %t/cache -name "*.pcm" -exec %clang_cc1 -module-file-info "{}" ";" | FileCheck %s -check-prefix=SCAN | ||
// SCAN: Module format: raw | ||
// SCAN: Module format: raw | ||
// SCAN: Module format: raw | ||
// SCAN: Module format: raw | ||
|
||
// Check the module format for built modules: | ||
// | ||
// RUN: find %t/build -name "*.pcm" -exec %clang_cc1 -module-file-info "{}" ";" | FileCheck %s -check-prefix=BUILD | ||
// BUILD: Module format: obj | ||
// BUILD: Module format: obj | ||
// BUILD: Module format: obj | ||
// BUILD: Module format: obj | ||
|
||
// FIXME: check pch format as well; -module-file-info does not work with a PCH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters