Bug 411440 - Invalid/truncated values in YAML file generated by -export-fixes= with clang diagnostics
Summary: Invalid/truncated values in YAML file generated by -export-fixes= with clang ...
Status: RESOLVED FIXED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Sergio Martins
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-30 10:44 UTC by Nikolai Kosjar
Modified: 2019-09-01 14:42 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolai Kosjar 2019-08-30 10:44:33 UTC
I'm on current clazy master, commit 7a3d9cc18d96d22f8f3613396fc21a03f7f023d4

-export-fixes in combination with e.g. -Weverything seems to produce wrong yaml files:


/tmp/test % cat clazy.clang-diagnostic.cpp 
void g()
{
    int *i;
    ++i;
}

/tmp/test % /d2/clazy/trunk/installs/Release/bin/clazy-standalone -export-fixes=/tmp/yaml.txt clazy.clang-diagnostic.cpp -- -Weverything
/tmp/test/clazy.clang-diagnostic.cpp:1:6: warning: no previous prototype for function 'g' [-Wmissing-prototypes]
void g()
     ^
/tmp/test/clazy.clang-diagnostic.cpp:4:7: warning: variable 'i' is uninitialized when used here [-Wuninitialized]
    ++i;
      ^
/tmp/test/clazy.clang-diagnostic.cpp:3:11: note: initialize the variable 'i' to silence this warning
    int *i;
          ^
           = nullptr
2 warnings generated.

==> OK, output here looks fine



/tmp/test % cat /tmp/yaml.txt 
---
MainSourceFile:  '/tmp/test/clazy.clang-diagnostic.cpp'
Diagnostics:     
  - DiagnosticName:  ' previous prototype for function ''g'''
    Message:         'no previous prototype for function ''g'''
    FileOffset:      5
    FilePath:        '/tmp/test/clazy.clang-diagnostic.cpp'
    Replacements:    []
  - DiagnosticName:  'riable ''i'' is uninitialized when used here'
    Message:         'variable ''i'' is uninitialized when used here'
    FileOffset:      29
    FilePath:        '/tmp/test/clazy.clang-diagnostic.cpp'
    Replacements:    []
...

==> Ops, DiagnosticName should be a name, but it's a truncated version of the diagnostic message.
==> Ops, Message is also truncated.
Comment 1 Sergio Martins 2019-09-01 14:42:09 UTC
Git commit afc877b17297aedf9621bd61d850f60b34aece8f by Sergio Martins.
Committed on 01/09/2019 at 14:39.
Pushed by smartins into branch 'master'.

Fix exporting built-in warnings to yaml

The message didn't have the [checkName] tags

M  +16   -5    src/FixItExporter.cpp

https://commits.kde.org/clazy/afc877b17297aedf9621bd61d850f60b34aece8f