Improve the warning for cv-qualifiers on free functions, from Ahmed Charles!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142478 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 8cf25b6..57766f9 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -4031,6 +4031,8 @@
   DeclSpec DS(AttrFactory);
   bool RefQualifierIsLValueRef = true;
   SourceLocation RefQualifierLoc;
+  SourceLocation ConstQualifierLoc;
+  SourceLocation VolatileQualifierLoc;
   ExceptionSpecificationType ESpecType = EST_None;
   SourceRange ESpecRange;
   SmallVector<ParsedType, 2> DynamicExceptions;
@@ -4069,8 +4071,11 @@
 
       // Parse cv-qualifier-seq[opt].
       ParseTypeQualifierListOpt(DS, false /*no attributes*/);
-        if (!DS.getSourceRange().getEnd().isInvalid())
+        if (!DS.getSourceRange().getEnd().isInvalid()) {
           EndLoc = DS.getSourceRange().getEnd();
+          ConstQualifierLoc = DS.getConstSpecLoc();
+          VolatileQualifierLoc = DS.getVolatileSpecLoc();
+        }
 
       // Parse ref-qualifier[opt].
       if (Tok.is(tok::amp) || Tok.is(tok::ampamp)) {
@@ -4112,7 +4117,8 @@
                                              ParamInfo.data(), ParamInfo.size(),
                                              DS.getTypeQualifiers(),
                                              RefQualifierIsLValueRef,
-                                             RefQualifierLoc,
+                                             RefQualifierLoc, ConstQualifierLoc,
+                                             VolatileQualifierLoc,
                                              /*MutableLoc=*/SourceLocation(),
                                              ESpecType, ESpecRange.getBegin(),
                                              DynamicExceptions.data(),