Commit bc2e393b authored by evan.lucas's avatar evan.lucas Committed by Commit bot

[tools] Make gen-postmortem-metadata.py more reliable

Instead of basing matches off of whitespace, walk the inheritance chain and include any classes that inherit from Object.

R=machenbach@chromium.org,jkummerow@chromium.org
NOTRY=true

Review URL: https://codereview.chromium.org/1435643002

Cr-Commit-Position: refs/heads/master@{#31964}
parent 59a06418
...@@ -51,6 +51,7 @@ Daniel James <dnljms@gmail.com> ...@@ -51,6 +51,7 @@ Daniel James <dnljms@gmail.com>
Douglas Crosher <dtc-v8@scieneer.com> Douglas Crosher <dtc-v8@scieneer.com>
Dusan Milosavljevic <dusan.m.milosavljevic@gmail.com> Dusan Milosavljevic <dusan.m.milosavljevic@gmail.com>
Erich Ocean <erich.ocean@me.com> Erich Ocean <erich.ocean@me.com>
Evan Lucas <evan.lucas@help.com>
Fedor Indutny <fedor@indutny.com> Fedor Indutny <fedor@indutny.com>
Felix Geisendörfer <haimuiba@gmail.com> Felix Geisendörfer <haimuiba@gmail.com>
Filipe David Manana <fdmanana@gmail.com> Filipe David Manana <fdmanana@gmail.com>
......
...@@ -273,6 +273,20 @@ footer = ''' ...@@ -273,6 +273,20 @@ footer = '''
} }
''' '''
#
# Get the base class
#
def get_base_class(klass):
if (klass == 'Object'):
return klass;
if (not (klass in klasses)):
return None;
k = klasses[klass];
return get_base_class(k['parent']);
# #
# Loads class hierarchy and type information from "objects.h". # Loads class hierarchy and type information from "objects.h".
# #
...@@ -311,12 +325,14 @@ def load_objects(): ...@@ -311,12 +325,14 @@ def load_objects():
typestr += line; typestr += line;
continue; continue;
match = re.match('class (\w[^\s:]*)(: public (\w[^\s{]*))?\s*{', match = re.match('class (\w[^:]*)(: public (\w[^{]*))?\s*{\s*',
line); line);
if (match): if (match):
klass = match.group(1); klass = match.group(1).rstrip().lstrip();
pklass = match.group(3); pklass = match.group(3);
if (pklass):
pklass = pklass.rstrip().lstrip();
klasses[klass] = { 'parent': pklass }; klasses[klass] = { 'parent': pklass };
# #
...@@ -567,6 +583,9 @@ def emit_config(): ...@@ -567,6 +583,9 @@ def emit_config():
keys.sort(); keys.sort();
for klassname in keys: for klassname in keys:
pklass = klasses[klassname]['parent']; pklass = klasses[klassname]['parent'];
bklass = get_base_class(klassname);
if (bklass != 'Object'):
continue;
if (pklass == None): if (pklass == None):
continue; continue;
......
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