diff -U 3 -dHrN include/clang/Frontend/VerifyDiagnosticConsumer.h include/clang/Frontend/VerifyDiagnosticConsumer.h
--- include/clang/Frontend/VerifyDiagnosticConsumer.h	2012-06-25 16:30:27.000000000 +0200
+++ include/clang/Frontend/VerifyDiagnosticConsumer.h	2012-06-25 16:47:43.000000000 +0200
@@ -62,6 +62,16 @@
 ///   void f(); // expected-note 2 {{previous declaration is here}}
 /// \endcode
 ///
+/// Where the diagnostic is expected to occur a minimum number of times, this
+/// can be specified by appending a '+' to the number. Example:
+///
+///   void f(); // expected-note 0+ {{previous declaration is here}}
+///
+/// In this example, the diagnostic becomes optional, i.e. it will be swallowed
+/// if it occurs, but will not generate an error if it does not occur.  A range
+/// can also be specified by <n>-<m>.  As a short-hand, "one or more" can be
+/// specified simply by '+' instead of <n>.
+///
 /// Regex matching mode may be selected by appending '-re' to type. Example:
 ///
 ///   expected-error-re
@@ -83,14 +93,15 @@
   class Directive {
   public:
     static Directive* Create(bool RegexKind, const SourceLocation &Location,
-                             const std::string &Text, unsigned Count);
+                             const std::string &Text, unsigned Min,
+                             unsigned Max);
   public:
-    /// Constant representing one or more matches aka regex "+".
-    static const unsigned OneOrMoreCount =  UINT_MAX;
+    /// Constant representing n or more matches.
+    static const unsigned MaxCount = UINT_MAX;
 
     SourceLocation Location;
     const std::string Text;
-    unsigned Count;
+    unsigned Min, Max;
 
     virtual ~Directive() { }
 
@@ -103,8 +114,8 @@
 
   protected:
     Directive(const SourceLocation &Location, const std::string &Text,
-              unsigned Count)
-      : Location(Location), Text(Text), Count(Count) { }
+              unsigned Min, unsigned Max)
+      : Location(Location), Text(Text), Min(Min), Max(Max) { }
 
   private:
     Directive(const Directive&); // DO NOT IMPLEMENT
diff -U 3 -dHrN lib/Frontend/VerifyDiagnosticConsumer.cpp lib/Frontend/VerifyDiagnosticConsumer.cpp
--- lib/Frontend/VerifyDiagnosticConsumer.cpp	2012-06-25 16:30:27.000000000 +0200
+++ lib/Frontend/VerifyDiagnosticConsumer.cpp	2012-06-25 16:46:43.000000000 +0200
@@ -84,8 +84,8 @@
 class StandardDirective : public Directive {
 public:
   StandardDirective(const SourceLocation &Location, const std::string &Text,
-                    unsigned Count)
-    : Directive(Location, Text, Count) { }
+                    unsigned Min, unsigned Max)
+    : Directive(Location, Text, Min, Max) { }
 
   virtual bool isValid(std::string &Error) {
     // all strings are considered valid; even empty ones
@@ -102,8 +102,8 @@
 class RegexDirective : public Directive {
 public:
   RegexDirective(const SourceLocation &Location, const std::string &Text,
-                 unsigned Count)
-    : Directive(Location, Text, Count), Regex(Text) { }
+                 unsigned Min, unsigned Max)
+    : Directive(Location, Text, Min, Max), Regex(Text) { }
 
   virtual bool isValid(std::string &Error) {
     if (Regex.isValid(Error))
@@ -273,11 +273,26 @@
     PH.SkipWhitespace();
 
     // next optional token: positive integer or a '+'.
-    unsigned Count = 1;
-    if (PH.Next(Count))
+    unsigned Min = 1;
+    unsigned Max = 1;
+    if (PH.Next(Min)) {
       PH.Advance();
-    else if (PH.Next("+")) {
-      Count = Directive::OneOrMoreCount;
+      // a positive integer can be followed by a '+'
+      // meaning min or more, or by a '-' meaning a
+      // range from min to max.
+      if (PH.Next("+")) {
+        Max = Directive::MaxCount;
+        PH.Advance();
+      } else if (PH.Next("-")) {
+        PH.Advance();
+        if (PH.Next(Max)) PH.Advance();
+        if (Max < Min) Max = Min;
+      } else {
+        Max = Min;
+      }
+    } else if (PH.Next("+")) {
+      // '+' on its own means "1 or more"
+      Max = Directive::MaxCount;
       PH.Advance();
     }
 
@@ -317,7 +332,7 @@
       Text.assign(ContentBegin, ContentEnd);
 
     // construct new directive
-    Directive *D = Directive::Create(RegexKind, RealPos, Text, Count);
+    Directive *D = Directive::Create(RegexKind, RealPos, Text, Min, Max);
     std::string Error;
     if (D->isValid(Error))
       DL->push_back(D);
@@ -420,9 +435,8 @@
   for (DirectiveList::iterator I = Left.begin(), E = Left.end(); I != E; ++I) {
     Directive& D = **I;
     unsigned LineNo1 = SourceMgr.getPresumedLineNumber(D.Location);
-    bool FoundOnce = false;
 
-    for (unsigned i = 0; i < D.Count; ++i) {
+    for (unsigned i = 0; i < D.Max; ++i) {
       DiagList::iterator II, IE;
       for (II = Right.begin(), IE = Right.end(); II != IE; ++II) {
         unsigned LineNo2 = SourceMgr.getPresumedLineNumber(II->first);
@@ -434,18 +448,12 @@
           break;
       }
       if (II == IE) {
-        if (D.Count == D.OneOrMoreCount) {
-          if (!FoundOnce)
-            LeftOnly.push_back(*I);
-          // We are only interested in at least one match, so exit the loop.
-          break;
-        }
         // Not found.
+        if (i >= D.Min) break;
         LeftOnly.push_back(*I);
       } else {
         // Found. The same cannot be found twice.
         Right.erase(II);
-        FoundOnce = true;
       }
     }
   }
@@ -539,8 +547,9 @@
 }
 
 Directive* Directive::Create(bool RegexKind, const SourceLocation &Location,
-                             const std::string &Text, unsigned Count) {
+                             const std::string &Text, unsigned Min,
+                             unsigned Max) {
   if (RegexKind)
-    return new RegexDirective(Location, Text, Count);
-  return new StandardDirective(Location, Text, Count);
+    return new RegexDirective(Location, Text, Min, Max);
+  return new StandardDirective(Location, Text, Min, Max);
 }
