[cfe-commits] [Patch] -Wignored-qualifiers should point to	the	first ignored qualifier
    Douglas Gregor 
    dgregor at apple.com
       
    Wed Jun  1 13:20:50 PDT 2011
    
    
  
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
    
    
More information about the cfe-commits
mailing list