aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
diff options
context:
space:
mode:
authorNathan James <n.james93@hotmail.co.uk>2020-11-19 18:20:31 +0000
committerNathan James <n.james93@hotmail.co.uk>2020-11-19 18:20:32 +0000
commit617e8e5ee3bb3316baae7a69d74b5ff95031d571 (patch)
treeb2c18f6a410e4445b0840e0a540ca95c3dd14680 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
parent1ac9b548310c22ee558f04dd49d08ace0ccfb568 (diff)
downloadllvm-617e8e5ee3bb3316baae7a69d74b5ff95031d571.zip
llvm-617e8e5ee3bb3316baae7a69d74b5ff95031d571.tar.gz
llvm-617e8e5ee3bb3316baae7a69d74b5ff95031d571.tar.bz2
[clang-tidy] ElseAfterReturn check wont suggest fixes if preprocessor branches are involved
Consider this code: ``` if (Cond) { #ifdef X_SUPPORTED X(); #else return; #endif } else { Y(); } Z();``` In this example, if `X_SUPPORTED` is not defined, currently we'll get a warning from the else-after-return check. However If we apply that fix, and then the code is recompiled with `X_SUPPORTED` defined, we have inadvertently changed the behaviour of the if statement due to the else being removed. Code flow when `Cond` is `true` will be: ``` X(); Y(); Z();``` where as before the fix it was: ``` X(); Z();``` This patch adds checks that guard against `#endif` directives appearing between the control flow interrupter and the else and not applying the fix if they are detected. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D91485
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
0 files changed, 0 insertions, 0 deletions