On Oct 17, 2011, at 9:17 AM, Ahmed Charles wrote:

> Thanks. Another thing, I'm trying to convince myself that nothing can
> come between const and volatile if both are there, is that true or is
> it possible to have a token between them? I.e. Should I have two
> fixits rather than one?

The grammar says

        parameters-and-qualifiers:
                ( parameter-declaration-clause ) attribute-specifier-seq[opt] 
cv-qualifier-seq[opt]
                ref-qualifier[opt] exception-specification[opt]

so nothing can come between the 'const' and 'volatile' except perhaps some 
whitespace and macro expansions that expand to nothing (neither of which we 
care about).

One other comment:

+                case Qualifiers::Const | Qualifiers::Volatile: {
+                    SourceLocation CLoc = Chunk.Fun.getConstQualifierLoc();
+                    SourceLocation VLoc = Chunk.Fun.getVolatileQualifierLoc();
+                    Range =
+                        SourceRange(std::min(CLoc, VLoc), std::max(CLoc, 
VLoc));
+                  }
+                  break;

The "min()" here doesn't actually do the right thing. You'll need to use 
SourceManager::isBeforeInTranslationUnit(). 

Otherwise, your patch is looking good, once it has a test case.

        - Doug
_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to