-
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.
[C++20] [Modules] [Reduced BMI] Write Special Decl Lazily
ASTWrite would write some special records for the consumer of the AST can get the information easily. This is fine. But currently all the special records are written eagerly, which is conflicting with reduced BMI. In reduced BMI, we hope to write things as less as possible. It is not a goal for reduced BMI to retain all the informations. So in this patch we won't record the special declarations eagerly before we starting write. But only writing the sepcial records after we writes decls and types, then only the reached declarations will be collected.
- Loading branch information
1 parent
83cc605
commit 7ec342b
Showing
3 changed files
with
98 additions
and
35 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
27 changes: 27 additions & 0 deletions
27
clang/test/Modules/reduced-bmi-empty-module-purview-std.cppm
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,27 @@ | ||
// Test that we won't write additional information from std namespace by default | ||
// into the Reduced BMI if the module purview is empty. | ||
// | ||
// RUN: rm -rf %t | ||
// RUN: mkdir -p %t | ||
// RUN: split-file %s %t | ||
// | ||
// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-reduced-module-interface -o %t/A.pcm | ||
// RUN: llvm-bcanalyzer --dump --disable-histogram --show-binary-blobs %t/A.pcm > %t/A.dump | ||
// RUN: cat %t/A.dump | FileCheck %t/A.cppm | ||
|
||
//--- std.h | ||
namespace std { | ||
typedef decltype(sizeof(0)) size_t; | ||
enum class align_val_t : std::size_t {}; | ||
|
||
class bad_alloc { }; | ||
} | ||
|
||
//--- A.cppm | ||
module; | ||
#include "std.h" | ||
export module A; | ||
|
||
// CHECK-NOT: <DECL_NAMESPACE | ||
// CHECK-NOT: <DECL_CONTEXT_LEXICAL | ||
// CHECK-NOT: <DELAYED_NAMESPACE_LEXICAL_VISIBLE_RECORD |