[PATCH] D15486: [RFC] Emit note pointing to a discarded qualifier [-Wincompatible-pointer-types-discards-qualifiers]

Adrian ZgorzaƂek via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 13 23:33:58 PST 2015


adek05 created this revision.
adek05 added a reviewer: jroelofs.
adek05 added a subscriber: cfe-commits.

Finding original declaration which is suffering from discarding a qualifier is somewhat tricky and it doesn't always make sense in all of the contexts that DiagnoseAssignmentResult is called.
I haven't figured out yet how to make this change work for ObjC Setters which I think is the only place left which should handle this diagnostic.
Current approach is sort of best-effort, but doesn't really guarantee much.

Alternative way to go would be to factor this extra diagnostic out and write it in a similar fashion to DiagnoseSelfAssignment and call it in some of the contexts when note could be useful.
The problem I see with that, is that it would have issues with handling overriden assignment operators or would not work for non built-in types.

http://reviews.llvm.org/D15486

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaInit.cpp
  lib/Sema/SemaPseudoObject.cpp
  lib/Sema/SemaStmt.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15486.42687.patch
Type: text/x-patch
Size: 6377 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151214/8dff06cc/attachment.bin>


More information about the cfe-commits mailing list