-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Implement -dump-minimization-hints
flag.
#133910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
cfa057b
This commit implements a CC1 flag `-dump-deserialized-declaration-ran…
VitaNuo 221d1df
Fix test on Windows
VitaNuo 1525fe8
Remove old test.
VitaNuo 14bd903
Handle source ranges where `isTokenRange() == true` (the end of this …
VitaNuo c71f0bd
Relex the token past the end location of the last token in the source…
VitaNuo b2a908f
Fix formatting.
VitaNuo 72c51cc
Simplify the code by using `Lexer::getAsCharRange` to advance to the …
VitaNuo 1fae62f
Rename the flag to `dump-minimization-hints` to make it more specific.
VitaNuo 6719743
Rename and fix the test.
VitaNuo 7243489
Address review comments.
VitaNuo f357e5e
Update the comment to explciitly mention that the column number of th…
VitaNuo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,79 @@ | ||
// RUN: rm -rf %t | ||
// RUN: mkdir -p %t | ||
// RUN: split-file %s %t | ||
// RUN: %clang_cc1 -xc++ -fmodules -fmodule-name=foo -fmodule-map-file=%t/foo.cppmap -emit-module %t/foo.cppmap -o %t/foo.pcm | ||
// RUN: %clang_cc1 -xc++ -fmodules -dump-minimization-hints=%t/decls -fmodule-file=%t/foo.pcm %t/foo.cpp -o %t/foo.o | ||
// RUN: cat %t/decls | ||
// RUN: cat %t/decls | FileCheck -check-prefix=RANGE %s | ||
// RANGE:{ | ||
// RANGE-NEXT: "required_ranges": [ | ||
// RANGE-NEXT: { | ||
// RANGE-NEXT: "file": "{{.+}}foo.h", | ||
// RANGE-NEXT: "range": [ | ||
// RANGE-NEXT: { | ||
// RANGE-NEXT: "from": { | ||
// RANGE-NEXT: "line": 1, | ||
// RANGE-NEXT: "column": 1 | ||
// RANGE-NEXT: }, | ||
// RANGE-NEXT: "to": { | ||
// RANGE-NEXT: "line": 9, | ||
// RANGE-NEXT: "column": 3 | ||
// RANGE-NEXT: } | ||
// RANGE-NEXT: }, | ||
// RANGE-NEXT: { | ||
// RANGE-NEXT: "from": { | ||
// RANGE-NEXT: "line": 11, | ||
// RANGE-NEXT: "column": 1 | ||
// RANGE-NEXT: }, | ||
// RANGE-NEXT: "to": { | ||
// RANGE-NEXT: "line": 11, | ||
// RANGE-NEXT: "column": 25 | ||
// RANGE-NEXT: } | ||
// RANGE-NEXT: }, | ||
// RANGE-NEXT: { | ||
// RANGE-NEXT: "from": { | ||
// RANGE-NEXT: "line": 13, | ||
// RANGE-NEXT: "column": 1 | ||
// RANGE-NEXT: }, | ||
// RANGE-NEXT: "to": { | ||
// RANGE-NEXT: "line": 15, | ||
// RANGE-NEXT: "column": 2 | ||
// RANGE-NEXT: } | ||
// RANGE-NEXT: } | ||
// RANGE-NEXT: ] | ||
// RANGE-NEXT: } | ||
// RANGE-NEXT: ] | ||
// RANGE-NEXT:} | ||
|
||
//--- foo.cppmap | ||
module foo { | ||
header "foo.h" | ||
export * | ||
} | ||
|
||
//--- foo.h | ||
class MyData { | ||
public: | ||
MyData(int val): value_(val) {} | ||
int getValue() const { | ||
return 5; | ||
} | ||
private: | ||
int value_; | ||
}; | ||
|
||
extern int global_value; | ||
|
||
int multiply(int a, int b) { | ||
return a * b; | ||
} | ||
|
||
//--- foo.cpp | ||
#include "foo.h" | ||
int global_value = 5; | ||
int main() { | ||
MyData data(5); | ||
int current_value = data.getValue(); | ||
int doubled_value = multiply(current_value, 2); | ||
int final_result = doubled_value + global_value; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.