Fixes Bug: https://bugs.llvm.org/show_bug.cgi?id=27061
Details
Diff Detail
- Repository
- rC Clang
- Build Status
Buildable 21248 Build 21248: arc lint + arc unit
Event Timeline
lib/Sema/SemaChecking.cpp | ||
---|---|---|
10413–10416 | This is essentially the only new code. AnalyzeCompoundAssignment was moved in order to be able to call DiagnoseFloatingImpCast (it's defined above). The rest is a small refactoring of the conditionals. |
lib/Sema/SemaChecking.cpp | ||
---|---|---|
10411 | Add a comment explaining this conditional as well?
With the comment, it might be cleaner to read if you expand the negation: !ResultBT || !RBT || !RBT->isFloatingPoint() |
lib/Sema/SemaChecking.cpp | ||
---|---|---|
10411 | ResultBT and RBT are pointers that may be null and need to be checked. The previous code did this before accessing them, I've just moved the checks to be sooner. If !RBT (if it's nullptr), then !RBT->isFloatingPoint() would be a null deref, so unfortunately I can not expand it as recommended. |
lib/Sema/SemaChecking.cpp | ||
---|---|---|
10411 | oops, nevermind |
lib/Sema/SemaChecking.cpp | ||
---|---|---|
10424 | This looks incorrect to me -- this is testing the rank difference and that it is in a system macro (the ! was dropped). If this didn't cause any tests to fail, we should add a test that would fail for it. |
lib/Sema/SemaChecking.cpp | ||
---|---|---|
10424 | Thanks for the code review! Sorry, I don't understand what you mean by "rank difference"? F16 vs F32 vs F64 vs F128 etc? When you say "this looks incorrect," are you commenting on the code I added (Lines 10415 to 10418) or the prexisting code that I moved (Lines 10420-10427)? Good catch on dropping the !, that was definitely not intentional (and now I'm curious if dw in vim will delete (! together), will add back. I'm happy to add a test for the system macro, but I also don't know what that is. Can you explain? |
lib/Sema/SemaChecking.cpp | ||
---|---|---|
10424 | Sorry, my explanation may have been confusing. A better way to phrase it would have been "this isn't doing what the old code used to do, and I don't think you intended to change it." I was talking about the ! that disappeared. I think you can use linemarker directives to get this to happen: # 1 "systemheader.h" 1 3 #define MACRO # 1 "test_file.c" 2 // Your code that uses MACRO. |
Thanks for the info, I found https://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html helpful. How does this look?
Add a comment explaining this conditional as well?
With the comment, it might be cleaner to read if you expand the negation: !ResultBT || !RBT || !RBT->isFloatingPoint()