Commit 00838e08 authored by Lukasz Anforowicz's avatar Lukasz Anforowicz Committed by Commit Bot

Go back to unconditionally skipping fields in generated files.

bartekn@ has kindly identified r819402 as a source of performance
regression in rewriter runtime - the numbers below represent the time
(in minutes) of the 1st pass, 2nd pass and the total rewrite runtime:
Before crrev.com/c/2488744: 89, 89, 196
After crrev.com/c/2488744: 167, 165, 349

To improve rewrite performance, this CL goes back to unconditionally
skipping fields in generated files (i.e. partially reverts
crrev.com/c/2488744).  This is okay, because we have already gathered
and stored the statistics about the skipped fields in generated files
here:
https://drive.google.com/file/d/1L27GU76qZZspq-AVLdIamsl61FKazPuf/view?usp=sharing

Bug: 819402
Change-Id: Ie00b326c800ee68fabe64fd2ad12f18e69bc8f0f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2507233Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarBartek Nowierski <bartekn@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822790}
parent 3559d207
...@@ -906,7 +906,7 @@ int main(int argc, const char* argv[]) { ...@@ -906,7 +906,7 @@ int main(int argc, const char* argv[]) {
fieldDecl( fieldDecl(
allOf(hasType(supported_pointer_types_matcher), allOf(hasType(supported_pointer_types_matcher),
unless(anyOf(isExpansionInSystemHeader(), isInExternCContext(), unless(anyOf(isExpansionInSystemHeader(), isInExternCContext(),
isInThirdPartyLocation(), isInThirdPartyLocation(), isInGeneratedLocation(),
isInLocationListedInFilterFile(&paths_to_exclude), isInLocationListedInFilterFile(&paths_to_exclude),
isFieldDeclListedInFilterFile(&fields_to_exclude), isFieldDeclListedInFilterFile(&fields_to_exclude),
implicit_field_decl_matcher)))) implicit_field_decl_matcher))))
...@@ -1089,15 +1089,6 @@ int main(int argc, const char* argv[]) { ...@@ -1089,15 +1089,6 @@ int main(int argc, const char* argv[]) {
FilteredExprWriter global_destructor_writer(&output_helper, "global-scope"); FilteredExprWriter global_destructor_writer(&output_helper, "global-scope");
match_finder.addMatcher(global_destructor_matcher, &global_destructor_writer); match_finder.addMatcher(global_destructor_matcher, &global_destructor_writer);
// Matches rewritable fields in generated code - see the testcase in
// tests/gen-generated-code-test.cc
auto field_in_generated_code_matcher =
fieldDecl(allOf(field_decl_matcher, isInGeneratedLocation()));
FilteredExprWriter field_in_generated_code_writer(&output_helper,
"generated-code");
match_finder.addMatcher(field_in_generated_code_matcher,
&field_in_generated_code_writer);
// Matches CXXRecordDecls with a deleted operator new - e.g. // Matches CXXRecordDecls with a deleted operator new - e.g.
// StructWithNoOperatorNew below: // StructWithNoOperatorNew below:
// struct StructWithNoOperatorNew { // struct StructWithNoOperatorNew {
......
==== BEGIN EDITS ====
include-user-header:::/usr/local/google/home/lukasza/src/chromium4/src/tools/clang/rewrite_raw_ptr_fields/tests/gen/generated_header.h:::-1:::-1:::base/memory/checked_ptr.h
r:::/usr/local/google/home/lukasza/src/chromium4/src/tools/clang/rewrite_raw_ptr_fields/tests/gen/generated_header.h:::552:::5:::CheckedPtr<int>
r:::/usr/local/google/home/lukasza/src/chromium4/src/tools/clang/rewrite_raw_ptr_fields/tests/gen/generated_header.h:::570:::11:::CheckedPtr<SomeClass>
==== END EDITS ====
==== BEGIN FIELD FILTERS ====
GeneratedStruct::ptr_field # generated-code
GeneratedStruct::ptr_field2 # generated-code
==== END FIELD FILTERS ====
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file (and other gen-*-test.cc files) tests generation of output for
// --field-filter-file and therefore the expectations file
// (gen-char-expected.txt) needs to be compared against the raw output of the
// rewriter (rather than against the actual edits result). This makes the test
// incompatible with other tests, which require passing --apply-edits switch to
// test_tool.py and so to disable the test it is named *-test.cc rather than
// *-original.cc.
//
// To run the test use tools/clang/rewrite_raw_ptr_fields/tests/run_all_tests.py
// Fields in "gen/generated_header.h" should be emitted be emitted as candidates
// for the --field-filter-file.
#include "gen/generated_header.h"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment