On Jun 1, 2011, at 6:30 AM, Hans Wennborg wrote:

> 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, and tries to simplify the code a bit.
> 
> I posted this to the wrong list before [1] and didn't receive any
> response. I would be grateful for any feedback.


This is looking really good. The only issue I see is when comparing source 
locations with <, e.g.,

+    if (!Loc.isValid() || ConstQualLoc < Loc)
+      Loc = ConstQualLoc;

The < operator on SourceLocation doesn't necessarily mean "before in the 
translation"; it's a somewhat arbitrary total ordering useful mainly for use in 
std::map or std::set.

Instead, I suggest using SourceManager::isBeforeInTranslationUnit().

        - Doug
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to