Bug 411859

Summary: YAML file genereated by -export-fixes does not contain DiagnosticMessage node/entity
Product: [Developer tools] clazy Reporter: Nikolai Kosjar <nikolai.kosjar>
Component: generalAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: RESOLVED NOT A BUG    
Severity: normal CC: smartins
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Nikolai Kosjar 2019-09-12 14:16:02 UTC
clazy generates e.g.:

---
MainSourceFile:  'FILE_PATH'
Diagnostics:
  - DiagnosticName:  clazy-qgetenv
    Message:         'qgetenv().isEmpty() allocates. Use qEnvironmentVariableIsEmpty() instead'
    FileOffset:      150
    FilePath:        'FILE_PATH'
    Replacements:
      ...
...

while clang-tidy generates:

---
MainSourceFile:  'FILE_PATH'
Diagnostics:
  - DiagnosticName:  modernize-use-nullptr
    DiagnosticMessage:
      Message:         use nullptr
      FilePath:        'FILE_PATH'
      FileOffset:      150
      Replacements:
         ....
...

Note that clazy does not produce a "DiagnosticMessage" node/entity.
Comment 1 Sergio Martins 2019-09-15 21:45:20 UTC
I've just tested:

$ clang-tidy -export-fixes=a.yaml -checks=modernize-use-override a.cpp --
$ cat a.yaml
---
MainSourceFile:  '/data/sources/clazy/a.cpp'
Diagnostics:     
  - DiagnosticName:  modernize-use-override
    Message:         'annotate this function with ''override'' or (rarely) ''final'''
    FileOffset:      79
    FilePath:        '/data/sources/clazy/a.cpp'
    Replacements:    
      - FilePath:        '/data/sources/clazy/a.cpp'
        Offset:          84
        Length:          0
        ReplacementText: ' override'
...
Comment 2 Sergio Martins 2019-09-15 21:45:51 UTC
clang-tidy 8.0.1
Comment 3 Nikolai Kosjar 2019-09-17 06:33:39 UTC
Sorry for not stating the used version earlier.

I can confirm your observation for clang-tidy 8.x. Apparently this was changed in a later version. clang-tidy from master/trunk generates the output I've mentioned.
Comment 4 Nikolai Kosjar 2019-09-17 06:36:14 UTC
Hmm, that this might be related to the LLVM version I build clazy against. Checking...
Comment 5 Nikolai Kosjar 2019-09-17 07:32:14 UTC
Yup, it depends on the llvm/clang version I have built clazy against.

The relevant change is https://github.com/llvm/llvm-project/commit/f2879d8a4877eafcdb12c852030746d175f8abbd and it will be part of the upcoming 9.0 release.

Closing this report as there is nothing todo for clazy.