Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use strict;
- my %willbe_types1 = (
- PassRefPtrWillBeRawPtr => "RawPtr",
- PassOwnPtrWillBeRawPtr => "RawPtr",
- WillBeGarbageCollectedObject => "XXXXXX",
- );
- my %willbe_types2 = (
- RefCountedWillBeGarbageCollected => "GarbageCollected",
- RefCountedWillBeGarbageCollectedFinalized => "GarbageCollectedFinalized",
- RefCountedWillBeRefCountedGarbageCollected => "RefCountedGarbageCollected",
- RefCountedGarbageCollectedWillBeGarbageCollectedFinalized => "GarbageCollectedFinalized",
- RefCountedWillBeNoBase => "DummyBase",
- RefCountedGarbageCollectedWillBeNoBase => "DummyBase",
- ThreadSafeRefCountedWillBeGarbageCollected => "GarbageCollected",
- ThreadSafeRefCountedWillBeGarbageCollectedFinalized => "GarbageCollectedFinalized",
- PersistentWillBeMember => "Member",
- CrossThreadPersistentWillBeMember => "Member",
- RefPtrWillBePersistent => "Persistent",
- RefPtrWillBeRawPtr => "RawPtr",
- RefPtrWillBeMember => "Member",
- RefPtrWillBeWeakMember => "WeakMember",
- RefPtrWillBeWeakPersistent => "WeakPersistent",
- RefPtrWillBeCrossThreadPersistent => "CrossThreadPersistent",
- RawPtrWillBeMember => "Member",
- RawPtrWillBePersistent => "Persistent",
- RawPtrWillBeWeakMember => "WeakMember",
- RawPtrWillBeWeakPersistent => "WeakPersistent",
- RawPtrWillBeUntracedMember => "UntracedMember",
- OwnPtrWillBeCrossThreadPersistent => "CrossThreadPersistent",
- OwnPtrWillBeMember => "Member",
- OwnPtrWillBePersistent => "Persistent",
- OwnPtrWillBeRawPtr => "RawPtr",
- WeakPtrWillBeCrossThreadWeakPersistent => "CrossThreadWeakPersistent",
- WeakPtrWillBeMember => "Member",
- WeakPtrWillBeRawPtr => "RawPtr",
- WeakPtrWillBeWeakMember => "WeakMember",
- WeakPtrWillBeWeakPersistent => "WeakPersistent",
- NoBaseWillBeGarbageCollected => "GarbageCollected",
- NoBaseWillBeGarbageCollectedFinalized => "GarbageCollectedFinalized",
- NoBaseWillBeRefCountedGarbageCollected => "RefCountedGarbageCollected",
- PersistentHeapHashMapWillBeHeapHashMap => "HeapHashMap",
- PersistentHeapHashSetWillBeHeapHashSet => "HeapHashSet",
- PersistentHeapDequeWillBeHeapDeque => "HeapDeque",
- PersistentHeapVectorWillBeHeapVector => "HeapVector",
- WILL_BE_USING_GARBAGE_COLLECTED_MIXIN => "USING_GARBAGE_COLLECTED_MIXIN",
- WILL_BE_USING_PRE_FINALIZER => "USING_PRE_FINALIZER",
- );
- my %willbe_types3 = (
- WillBeGarbageCollected => "GarbageCollected",
- WillBeHeapHashMap => "HeapHashMap",
- WillBePersistentHeapHashMap => "PersistentHeapHashMap",
- WillBeHeapHashSet => "HeapHashSet",
- WillBePersistentHeapHashSet => "PersistentHeapHashSet",
- WillBeHeapLinkedHashSet => "HeapLinkedHashSet",
- WillBePersistentHeapLinkedHashSet => "PersistentHeapLinkedHashSet",
- WillBeHeapListHashSet => "HeapListHashSet",
- WillBePersistentHeapListHashSet => "PersistentHeapListHashSet",
- WillBeHeapVector => "HeapVector",
- WillBePersistentHeapVector => "PersistentHeapVector",
- WillBeHeapDeque => "HeapDeque",
- WillBePersistentHeapDeque => "PersistentHeapDeque",
- WillBeHeapHashCountedSet => "HeapHashCountedSet",
- WillBePersistentHeapHashCountedSet => "PersistentHeapHashCountedSet",
- WillBeGarbageCollectedMixin => "GarbageCollectedMixin",
- WillBeHeapSupplement => "HeapSupplement",
- WillBeHeapSupplementable => "HeapSupplementable",
- WillBeHeapTerminatedArray => "HeapTerminatedArray",
- WillBeHeapTerminatedArrayBuilder => "HeapTerminatedArrayBuilder",
- WillBeHeapLinkedStack => "HeapLinkedStack",
- );
- my %willbe_types4 = (
- XXXXXX => "WillBeGarbageCollectedObject",
- );
- my @removed_macros = qw(
- USING_FAST_MALLOC_WILL_BE_REMOVED
- USING_FAST_MALLOC_WITH_TYPE_NAME_WILL_BE_REMOVED
- DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED
- DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED
- DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED
- EAGERLY_FINALIZE_WILL_BE_REMOVED
- );
- my @adoptref_types = qw(
- adoptRefWillBeNoop
- adoptPtrWillBeNoop
- );
- for my $key (keys %willbe_types1) {
- my $command = "grep -rl '" . $key . "' * | grep -v '\\.pl' | grep -v 'platform/heap/' | xargs sed -i 's/" . $key . "/" . $willbe_types1{$key} . "/g'";
- print $command , $/;
- system $command;
- }
- for my $key (keys %willbe_types2) {
- my $command = "grep -rl '" . $key . "' * | grep -v '\\.pl' | grep -v 'platform/heap/' | xargs sed -i 's/" . $key . "/" . $willbe_types2{$key} . "/g'";
- print $command , $/;
- system $command;
- }
- for my $key (keys %willbe_types3) {
- my $command = "grep -rl '" . $key . "' * | grep -v '\\.pl' | grep -v 'platform/heap/' | xargs sed -i 's/" . $key . "/" . $willbe_types3{$key} . "/g'";
- print $command , $/;
- system $command;
- }
- for my $key (keys %willbe_types4) {
- my $command = "grep -rl '" . $key . "' * | grep -v '\\.pl' | grep -v 'platform/heap/' | xargs sed -i 's/" . $key . "/" . $willbe_types4{$key} . "/g'";
- print $command , $/;
- system $command;
- }
- my $command = "grep -rl DummyBase | grep -v '\\.pl' | grep -v 'platform/heap/' | xargs sed -i 's/public\\s\\+DummyBase<\\([^>]\\+\\)>,\\?\\s\\+//g'";
- print $command, $/;
- system $command;
- my @files = `grep -rl 'DummyBase<' | grep -v '\\.pl' | grep -v 'platform/heap/'`;
- die if @files;
- for my $macro (@removed_macros) {
- my $command = "grep -rl '" . $macro . "' * | grep -v '\\.pl' | grep -v 'platform/heap/'";
- print $command, $/;
- my @files = `$command`;
- for my $file (@files) {
- my $str = "";
- my $skipped = 0;
- print $file;
- chomp $file;
- open FH, "<", $file or die;
- while (my $line = <FH>) {
- if ($skipped && $line =~ /^[\s\t]*\n$/) {
- next;
- }
- $skipped = 0;
- if ($line =~ /${macro}/) {
- if ($line =~ /^[\s\t]*${macro}(\([^()]*\))?;?\s*\n$/) {
- $skipped = 1;
- next;
- } else {
- $line =~ s/[\s\t]*${macro}(\([^()]*\))?;?//;
- }
- }
- $str .= $line;
- }
- close FH;
- open FH, ">", $file or die;
- print FH $str;
- close FH;
- }
- }
- my $openclose;
- $openclose = qr/\([^()]*(?:(??{$openclose})[^()]*)*\)/;
- for my $type (@adoptref_types) {
- my $command = "grep -rl '" . $type . "' * | grep -v '\\.pl' | grep -v 'platform/heap/'";
- print $command, $/;
- my @files = `$command`;
- for my $file (@files) {
- print $file;
- chomp $file;
- open FH, "<", $file or die;
- my @lines = <FH>;
- my $str = join "", @lines;
- $str =~ s/${type}\s*($openclose)/\1/mg;
- close FH;
- open FH, ">", $file or die;
- print FH $str;
- close FH;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment