[cfe-dev] [Patch] -Wignored-qualifiers should point to the *first* ignored qualifier

Hans Wennborg hans at chromium.org
Thu Apr 28 10:08:53 PDT 2011


In code such as "char* volatile const j()", Clang warns that "volatile
const" will be ignored, but the error currently points to the location
of "const". The attached patch makes the error point to the location
of the first  ignored qualifier.

Chandler: I've been looking at the FIXME in this code (it was added in
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?r1=126321&r2=126320&pathrev=126321),
and I'm not sure what you mean when you say that we should find a
range that encompass all the qualifiers instead.

Do you mean that Loc should be a SourceRange, covering all ignored
qualifiers? But Sema::Diag() only expects a SourceLocation, not a
range?

Or do you mean that the ConstFixIt, VolatileFixIt, RestrictFixIt
should be replaced by a single fixit, using to a range covering all
qualifiers? Does that make any real difference? Also, can we be sure
that these qualifiers are always consecutive (I'm too tired to think
that through at the moment).

Cheers,
Hans
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ignored-qualifiers.patch
Type: text/x-patch
Size: 2283 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110428/b67bf177/attachment.bin>


More information about the cfe-dev mailing list