llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.98k stars 11.55k forks source link

'run-clang-tidy.py' applies incorrectly fixes introducing compilation erros for "readability-braces-around-statements" - the last brace is missing #33242

Closed llvmbot closed 7 years ago

llvmbot commented 7 years ago
Bugzilla Link 33895
Resolution DUPLICATE
Resolved on Aug 03, 2017 08:08
Version unspecified
OS Linux
Attachments Input file
Reporter LLVM Bugzilla Contributor
CC @pepsiman

Extended Description

Tested on version 4.0

call: ./run-clang-tidy.py -fix -p build/ -checks=readability-braces-around-statements main.cpp

Input:

int main() { bool check1 = false; bool check2 = false;

if (!check1)
    if (!check2)
        return 1;

return 0;

}


After fixes:

int main() { bool check1 = false; bool check2 = false;

if (!check1) {
    if (!check2) {
        return 1;

}

return 0;

}

The last brace for the second if-statement is missing after applying fix.

pepsiman commented 7 years ago

This bug has been marked as a duplicate of bug llvm/llvm-project#27742

llvmbot commented 7 years ago

Tested on version 5.0 and there is also the same problem.

Problem does not exist if fixes are applied directly by 'clang-tidy' without running 'run-clang-tidy.py' script or without exporting fixes to a yaml file by option "-export-fixes=" and using 'clang-apply-replacements' afterwards.