Changeset 105797 in webkit
- Timestamp:
- Jan 24, 2012 1:27:16 PM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r105796 r105797 1 2012-01-24 Kentaro Hara <haraken@chromium.org> 2 3 The cpp parser of prepare-ChangeLog cannot detect a change in classes and namespaces 4 https://bugs.webkit.org/show_bug.cgi?id=75531 5 6 Reviewed by David Kilzer. 7 8 Previously, the cpp parser of prepare-ChangeLog could not detect a change 9 outside methods. Consider the following cpp file. 10 11 namespace N { 12 int a; // this change does not appear on ChangeLog. 13 class C { 14 int b; // this change does not appear on ChangeLog. 15 void f() 16 { 17 int c; // this change appears on ChangeLog. 18 } 19 int d; // this change does not appear on ChangeLog. 20 }; 21 int e; // this change does not appear on ChangeLog. 22 }; 23 24 The previous prepare-ChangeLog outputs just methods in which a change is found: 25 (N::C::f): 26 27 This patch fixes prepare-ChangeLog so that it outputs namespaces, classes 28 and methods in which a change is found: 29 (N): 30 (N::C): 31 (N::C::f): 32 33 * Scripts/prepare-ChangeLog: 34 (get_function_line_ranges_for_cpp): Modified as described above. 35 36 * Scripts/webkitperl/prepare-ChangeLog_unittest/resources/cpp_unittests.cpp: Added test cases. 37 (Class104): 38 (Class105): 39 (Class106): 40 (Class106::func32): 41 (Class106::func33): 42 (NameSpace3): 43 (NameSpace4): 44 (NameSpace5): 45 (NameSpace6): 46 (Class107): 47 (NameSpace5::NameSpace6::Class107::func34): 48 * Scripts/webkitperl/prepare-ChangeLog_unittest/resources/cpp_unittests-expected.txt: 49 1 50 2012-01-24 Kentaro Hara <haraken@chromium.org> 2 51 -
trunk/Tools/Scripts/prepare-ChangeLog
r105796 r105797 621 621 my $brace_start = 0; 622 622 my $brace_end = 0; 623 my $namespace_start = -1; 623 624 my $skip_til_brace_or_semicolon = 0; 624 625 … … 696 697 my $selector = method_decl_to_selector ($potential_method_spec); 697 698 $potential_name = "${potential_method_char}\[${interface_name} ${selector}\]"; 698 699 699 700 $potential_method_spec = ""; 700 701 $potential_method_char = ""; 701 702 $in_method_declaration = 0; 702 703 703 704 $_ = $original; 704 705 s/^[^;{]*//; … … 712 713 } 713 714 714 715 715 716 # start of method declaration 716 717 if ((my $method_char, my $method_spec) = m&^([-+])([^0-9;][^;]*);?$&) { … … 732 733 my $selector = method_decl_to_selector ($potential_method_spec); 733 734 $potential_name = "${potential_method_char}\[${interface_name} ${selector}\]"; 734 735 735 736 $potential_method_spec = ""; 736 737 $potential_method_char = ""; … … 778 779 $skip_til_brace_or_semicolon = 0; 779 780 781 if ($namespace_start >= 0 and $namespace_start < $potential_start) { 782 push @ranges, [ $namespace_start . "", $potential_start - 1, $name ]; 783 } 784 780 785 if ($potential_namespace) { 781 786 push @namespaces, $potential_namespace; 782 787 $potential_namespace = ""; 788 $name = $namespaces[-1]; 789 $namespace_start = $. + 1; 783 790 next; 784 791 } … … 804 811 if ($1 eq "}") { 805 812 if (!$in_braces && @namespaces) { 813 if ($namespace_start >= 0 and $namespace_start < $.) { 814 push @ranges, [ $namespace_start . "", $. - 1, $name ]; 815 } 816 806 817 pop @namespaces; 818 if (@namespaces) { 819 $name = $namespaces[-1]; 820 $namespace_start = $. + 1; 821 } else { 822 $name = ""; 823 $namespace_start = -1; 824 } 807 825 next; 808 826 } … … 815 833 if (!$in_braces and $name) { 816 834 push @ranges, [ $start, $., $name ]; 817 $name = ""; 835 if (@namespaces) { 836 $name = $namespaces[-1]; 837 $namespace_start = $. + 1; 838 } else { 839 $name = ""; 840 $namespace_start = -1; 841 } 818 842 } 819 843 -
trunk/Tools/Scripts/webkitperl/prepare-ChangeLog_unittest/resources/cpp_unittests-expected.txt
r103669 r105797 136 136 ], 137 137 [ 138 '158', 139 '159', 140 'Class1' 141 ], 142 [ 138 143 '162', 139 144 '164', … … 176 181 ], 177 182 [ 183 '204', 184 '205', 185 'Struct1' 186 ], 187 [ 178 188 '208', 179 189 '210', … … 186 196 ], 187 197 [ 198 '219', 199 '219', 200 'NameSpace1' 201 ], 202 [ 188 203 '220', 189 204 '222', … … 191 206 ], 192 207 [ 208 '223', 209 '223', 210 'NameSpace1' 211 ], 212 [ 213 '228', 214 '228', 215 'NameSpace2' 216 ], 217 [ 193 218 '229', 194 219 '231', 195 220 'NameSpace1::NameSpace2::func31' 221 ], 222 [ 223 '232', 224 '232', 225 'NameSpace2' 226 ], 227 [ 228 '237', 229 '240', 230 'Class104' 231 ], 232 [ 233 '244', 234 '249', 235 'Class105' 236 ], 237 [ 238 '253', 239 '254', 240 'Class106' 241 ], 242 [ 243 '255', 244 '259', 245 'Class106::func32' 246 ], 247 [ 248 '260', 249 '261', 250 'Class106' 251 ], 252 [ 253 '262', 254 '266', 255 'Class106::func33' 256 ], 257 [ 258 '267', 259 '268', 260 'Class106' 261 ], 262 [ 263 '272', 264 '273', 265 'NameSpace3' 266 ], 267 [ 268 '275', 269 '276', 270 'NameSpace4' 271 ], 272 [ 273 '278', 274 '279', 275 'NameSpace3' 276 ], 277 [ 278 '283', 279 '284', 280 'NameSpace5' 281 ], 282 [ 283 '286', 284 '287', 285 'NameSpace6' 286 ], 287 [ 288 '289', 289 '290', 290 'Class107' 291 ], 292 [ 293 '291', 294 '295', 295 'NameSpace5::NameSpace6::Class107::func34' 296 ], 297 [ 298 '296', 299 '297', 300 'Class107' 301 ], 302 [ 303 '299', 304 '300', 305 'NameSpace6' 306 ], 307 [ 308 '302', 309 '303', 310 'NameSpace5' 196 311 ] 197 312 ] -
trunk/Tools/Scripts/webkitperl/prepare-ChangeLog_unittest/resources/cpp_unittests.cpp
r103669 r105797 233 233 } 234 234 } 235 236 class Class104 { 237 int a; 238 int b; 239 int c; 240 int d; 241 }; 242 243 class Class105 { 244 public: 245 int a; 246 int b; 247 private: 248 int c; 249 int d; 250 }; 251 252 class Class106 { 253 int a; 254 int b; 255 void func32() 256 { 257 int c; 258 int d; 259 } 260 int e; 261 int f; 262 void func33() 263 { 264 int g; 265 int h; 266 } 267 int i; 268 int j; 269 }; 270 271 namespace NameSpace3 { 272 int a; 273 int b; 274 namespace NameSpace4 { 275 int c; 276 int d; 277 }; 278 int e; 279 int f; 280 }; 281 282 namespace NameSpace5 { 283 int a; 284 int b; 285 namespace NameSpace6 { 286 int c; 287 int d; 288 class Class107 { 289 int e; 290 int f; 291 void func34() 292 { 293 int g; 294 int h; 295 } 296 int i; 297 int j; 298 }; 299 int k; 300 int ll; 301 }; 302 int m; 303 int n; 304 };
Note: See TracChangeset
for help on using the changeset viewer.