[opt-viewer] Don't fail with remarks without debug location
authorAdam Nemet <anemet@apple.com>
Mon, 14 Nov 2016 18:38:48 +0000 (18:38 +0000)
committerAdam Nemet <anemet@apple.com>
Mon, 14 Nov 2016 18:38:48 +0000 (18:38 +0000)
llvm-svn: 286861

llvm/utils/opt-viewer/opt-viewer.py

index ee5c7b5..bc30618 100755 (executable)
@@ -275,8 +275,8 @@ for input_file in args.yaml_files:
     f = open(input_file)
     docs = yaml.load_all(f)
     for remark in docs:
-        # Avoid duplicated remarks
-        if remark.key in all_remarks:
+        # Avoid remarks withoug debug location or if they are duplicated
+        if not hasattr(remark, 'DebugLoc') or remark.key in all_remarks:
             continue
         all_remarks[remark.key] = remark