Fixed merge-mistake where ActOnAccessSpecifier was called twice for every access specifier. The testcase has been changed to catch this too.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142186 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index 09f8ab2..472c64b 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -2147,11 +2147,6 @@
         SourceLocation EndLoc;
         if (Tok.is(tok::colon)) {
           EndLoc = Tok.getLocation();
-          if (Actions.ActOnAccessSpecifier(AS, ASLoc, EndLoc,
-                                           AccessAttrs.getList())) {
-            // found another attribute than only annotations
-            AccessAttrs.clear();
-          }
           ConsumeToken();
         } else if (Tok.is(tok::semi)) {
           EndLoc = Tok.getLocation();
@@ -2163,7 +2158,13 @@
           Diag(EndLoc, diag::err_expected_colon) 
             << FixItHint::CreateInsertion(EndLoc, ":");
         }
-        Actions.ActOnAccessSpecifier(AS, ASLoc, EndLoc);
+
+        if (Actions.ActOnAccessSpecifier(AS, ASLoc, EndLoc,
+                                         AccessAttrs.getList())) {
+          // found another attribute than only annotations
+          AccessAttrs.clear();
+        }
+
         continue;
       }