[cfe-commits] r166279 - in /cfe/trunk: lib/Frontend/VerifyDiagnosticConsumer.cpp test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp test/Frontend/verify.c test/Sema/compound-literal.c test/Sem

Sean Silva silvas at purdue.edu
Fri Oct 19 13:46:39 PDT 2012


-    void bar(Base&) {} // unexpected-note {{here}}
+    void bar(Base&) {} // FIXME: expected-note {{here}}

Where did this FIXME come from?

-- Sean Silva

On Fri, Oct 19, 2012 at 8:36 AM, Andy Gibbs <andyg1001 at hotmail.co.uk> wrote:
> Author: andyg
> Date: Fri Oct 19 07:36:49 2012
> New Revision: 166279
>
> URL: http://llvm.org/viewvc/llvm-project?rev=166279&view=rev
> Log:
> Fix directive parsing in VerifyDiagnosticConsumer so that it ensures that "expected" is at the start of the word and will no longer accept typos such as "junkexpected-*" as a valid "expected-*" directive.  A very few test-cases had to be amended to adhere to the new rule.
>
> Patch reviewed by David Blaikie.
>
> Modified:
>     cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp
>     cfe/trunk/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp
>     cfe/trunk/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp
>     cfe/trunk/test/Frontend/verify.c
>     cfe/trunk/test/Sema/compound-literal.c
>     cfe/trunk/test/Sema/vector-cast.c
>
> Modified: cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp?rev=166279&r1=166278&r2=166279&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp (original)
> +++ cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp Fri Oct 19 07:36:49 2012
> @@ -226,10 +226,22 @@
>
>    // Return true if string literal is found.
>    // When true, P marks begin-position of S in content.
> -  bool Search(StringRef S) {
> -    P = std::search(C, End, S.begin(), S.end());
> -    PEnd = P + S.size();
> -    return P != End;
> +  bool Search(StringRef S, bool EnsureStartOfWord = false) {
> +    do {
> +      P = std::search(C, End, S.begin(), S.end());
> +      PEnd = P + S.size();
> +      if (P == End)
> +        break;
> +      if (!EnsureStartOfWord
> +            // Check if string literal starts a new word.
> +            || P == Begin || isspace(P[-1])
> +            // Or it could be preceeded by the start of a comment.
> +            || (P > (Begin + 1) && (P[-1] == '/' || P[-1] == '*')
> +                                &&  P[-2] == '/'))
> +        return true;
> +      // Otherwise, skip and search again.
> +    } while (Advance());
> +    return false;
>    }
>
>    // Advance 1-past previous next/search.
> @@ -271,7 +283,7 @@
>    bool FoundDirective = false;
>    for (ParseHelper PH(S); !PH.Done();) {
>      // Search for token: expected
> -    if (!PH.Search("expected"))
> +    if (!PH.Search("expected", true))
>        break;
>      PH.Advance();
>
>
> Modified: cfe/trunk/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp?rev=166279&r1=166278&r2=166279&view=diff
> ==============================================================================
> --- cfe/trunk/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp (original)
> +++ cfe/trunk/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp Fri Oct 19 07:36:49 2012
> @@ -1,9 +1,9 @@
>  // RUN: %clang_cc1 -fsyntax-only -verify %s
>
> -void nondecl(int (*f)(int x = 5)) // {expected-error {{default arguments can only be specified}}}
> +void nondecl(int (*f)(int x = 5)) // expected-error {{default arguments can only be specified}}
>  {
> -  void (*f2)(int = 17)  // {expected-error {{default arguments can only be specified}}}
> -  = (void (*)(int = 42))f; // {expected-error {{default arguments can only be specified}}}
> +  void (*f2)(int = 17)  // expected-error {{default arguments can only be specified}}
> +  = (void (*)(int = 42))f; // expected-error {{default arguments can only be specified}}
>  }
>
>  struct X0 {
>
> Modified: cfe/trunk/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp?rev=166279&r1=166278&r2=166279&view=diff
> ==============================================================================
> --- cfe/trunk/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp (original)
> +++ cfe/trunk/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp Fri Oct 19 07:36:49 2012
> @@ -91,11 +91,11 @@
>
>  namespace PR12564 {
>    struct Base {
> -    void bar(Base&) {} // unexpected-note {{here}}
> +    void bar(Base&) {} // FIXME: expected-note {{here}}
>    };
>
>    struct Derived : Base {
>      // FIXME: This should be accepted.
> -    void foo(Derived& d) noexcept(noexcept(d.bar(d))) {} // unexpected-error {{cannot bind to a value of unrelated type}}
> +    void foo(Derived& d) noexcept(noexcept(d.bar(d))) {} // expected-error {{cannot bind to a value of unrelated type}}
>    };
>  }
>
> Modified: cfe/trunk/test/Frontend/verify.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/verify.c?rev=166279&r1=166278&r2=166279&view=diff
> ==============================================================================
> --- cfe/trunk/test/Frontend/verify.c (original)
> +++ cfe/trunk/test/Frontend/verify.c Fri Oct 19 07:36:49 2012
> @@ -22,7 +22,7 @@
>  #if 0
>  // expected-error {{should be ignored}}
>  #endif
> -
> +// eexpected-error {{should also be ignored: unrecognised directive}}
>  #error should not be ignored
>  // expected-error at -1 1+ {{should not be ignored}}
>
>
> Modified: cfe/trunk/test/Sema/compound-literal.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/compound-literal.c?rev=166279&r1=166278&r2=166279&view=diff
> ==============================================================================
> --- cfe/trunk/test/Sema/compound-literal.c (original)
> +++ cfe/trunk/test/Sema/compound-literal.c Fri Oct 19 07:36:49 2012
> @@ -6,15 +6,15 @@
>  static struct foo t = (struct foo){0,0};
>  static struct foo t1 = __builtin_choose_expr(0, (struct foo){0,0}, (struct foo){0,0});
>  static struct foo t2 = {0,0};
> -static struct foo t3 = t2; // -expected-error {{initializer element is not a compile-time constant}}
> +static struct foo t3 = t2; // expected-error {{initializer element is not a compile-time constant}}
>  static int *p = (int []){2,4};
>  static int x = (int){1};
>
> -static int *p2 = (int []){2,x}; // -expected-error {{initializer element is not a compile-time constant}}
> -static long *p3 = (long []){2,"x"}; // -expected-warning {{incompatible pointer to integer conversion initializing 'long' with an expression of type 'char [2]'}}
> +static int *p2 = (int []){2,x}; // expected-error {{initializer element is not a compile-time constant}}
> +static long *p3 = (long []){2,"x"}; // expected-warning {{incompatible pointer to integer conversion initializing 'long' with an expression of type 'char [2]'}}
>
> -typedef struct { } cache_t; // -expected-warning{{empty struct is a GNU extension}}
> -static cache_t clo_I1_cache = ((cache_t) { } ); // -expected-warning{{use of GNU empty initializer extension}}
> +typedef struct { } cache_t; // expected-warning{{empty struct is a GNU extension}}
> +static cache_t clo_I1_cache = ((cache_t) { } ); // expected-warning{{use of GNU empty initializer extension}}
>
>  typedef struct Test {int a;int b;} Test;
>  static Test* ll = &(Test) {0,0};
> @@ -27,11 +27,11 @@
>  }
>
>  struct Incomplete; // expected-note{{forward declaration of 'struct Incomplete'}}
> -struct Incomplete* I1 = &(struct Incomplete){1, 2, 3}; // -expected-error {{variable has incomplete type}}
> +struct Incomplete* I1 = &(struct Incomplete){1, 2, 3}; // expected-error {{variable has incomplete type}}
>  void IncompleteFunc(unsigned x) {
> -  struct Incomplete* I2 = (struct foo[x]){1, 2, 3}; // -expected-error {{variable-sized object may not be initialized}}
> -  (void){1,2,3}; // -expected-error {{variable has incomplete type}}
> -  (void(void)) { 0 }; // -expected-error{{illegal initializer type 'void (void)'}}
> +  struct Incomplete* I2 = (struct foo[x]){1, 2, 3}; // expected-error {{variable-sized object may not be initialized}}
> +  (void){1,2,3}; // expected-error {{variable has incomplete type}}
> +  (void(void)) { 0 }; // expected-error{{illegal initializer type 'void (void)'}}
>  }
>
>  // PR6080
>
> Modified: cfe/trunk/test/Sema/vector-cast.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/vector-cast.c?rev=166279&r1=166278&r2=166279&view=diff
> ==============================================================================
> --- cfe/trunk/test/Sema/vector-cast.c (original)
> +++ cfe/trunk/test/Sema/vector-cast.c Fri Oct 19 07:36:49 2012
> @@ -10,22 +10,22 @@
>    t2 v2;
>    t3 v3;
>
> -  v2 = (t2)v1; // -expected-error {{invalid conversion between vector type \
> +  v2 = (t2)v1; // expected-error {{invalid conversion between vector type \
>  't2' and 't1' of different size}}
> -  v1 = (t1)v2; // -expected-error {{invalid conversion between vector type \
> +  v1 = (t1)v2; // expected-error {{invalid conversion between vector type \
>  't1' and 't2' of different size}}
>    v3 = (t3)v2;
>
> -  v1 = (t1)(char *)10; // -expected-error {{invalid conversion between vector \
> +  v1 = (t1)(char *)10; // expected-error {{invalid conversion between vector \
>  type 't1' and scalar type 'char *'}}
>    v1 = (t1)(long long)10;
> -  v1 = (t1)(short)10; // -expected-error {{invalid conversion between vector \
> +  v1 = (t1)(short)10; // expected-error {{invalid conversion between vector \
>  type 't1' and integer type 'short' of different size}}
>
>    long long r1 = (long long)v1;
> -  short r2 = (short)v1; // -expected-error {{invalid conversion between vector \
> +  short r2 = (short)v1; // expected-error {{invalid conversion between vector \
>  type 't1' and integer type 'short' of different size}}
> -  char *r3 = (char *)v1; // -expected-error {{invalid conversion between vector\
> +  char *r3 = (char *)v1; // expected-error {{invalid conversion between vector\
>   type 't1' and scalar type 'char *'}}
>  }
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list