r187770 - Fixing commit r187768: Moved diagnosis of forward declarations of variable templates from Parser to Sema.

David Blaikie dblaikie at gmail.com
Mon Aug 5 22:42:05 PDT 2013


On Mon, Aug 5, 2013 at 10:39 PM, Larisse Voufo <lvoufo at google.com> wrote:
> On Mon, Aug 5, 2013 at 9:15 PM, David Blaikie <dblaikie at gmail.com> wrote:
>> On Mon, Aug 5, 2013 at 8:57 PM, Larisse Voufo <lvoufo at google.com> wrote:
>>>
>>> Author: lvoufo
>>> Date: Mon Aug  5 22:57:41 2013
>>> New Revision: 187770
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=187770&view=rev
>>> Log:
>>> Fixing commit r187768: Moved diagnosis of forward declarations of variable templates from Parser to Sema.
>>
>> At a glance this looks like a revert, rather than a 'fix' - is that the case?
>>
>
> It's both a revert and a 'fix'. The previous commit accidentally
> modified some files, which this commit reverted.
> The previous commit also added the changes that I had meant to add,
> which this commit did not revert.
> Am I missing something?

Nope, that's fine - guess I didn't look closely enough to spot the
changes you kept.

>
>>>
>>> Removed:
>>>     cfe/trunk/test/SemaCXX/function-pointer-arguments.cpp
>>> Modified:
>>>     cfe/trunk/include/clang/AST/DeclTemplate.h
>>>     cfe/trunk/lib/Sema/SemaOverload.cpp
>>>     cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
>>>     cfe/trunk/test/Driver/crash-report.c
>>>
>>> Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=187770&r1=187769&r2=187770&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
>>> +++ cfe/trunk/include/clang/AST/DeclTemplate.h Mon Aug  5 22:57:41 2013
>>> @@ -2560,7 +2560,7 @@ class VarTemplatePartialSpecializationDe
>>>    VarTemplatePartialSpecializationDecl()
>>>        : VarTemplateSpecializationDecl(VarTemplatePartialSpecialization),
>>>          TemplateParams(0), ArgsAsWritten(0), NumArgsAsWritten(0),
>>> -        SequenceNumber(SequenceNumber), InstantiatedFromMember(0, false) {}
>>> +        SequenceNumber(0), InstantiatedFromMember(0, false) {}
>>>
>>>  public:
>>>    static VarTemplatePartialSpecializationDecl *
>>>
>>> Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=187770&r1=187769&r2=187770&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
>>> +++ cfe/trunk/lib/Sema/SemaOverload.cpp Mon Aug  5 22:57:41 2013
>>> @@ -2584,17 +2584,9 @@ bool Sema::FunctionArgTypesAreEqual(cons
>>>    for (FunctionProtoType::arg_type_iterator O = OldType->arg_type_begin(),
>>>         N = NewType->arg_type_begin(),
>>>         E = OldType->arg_type_end(); O && (O != E); ++O, ++N) {
>>> -    if (!(*O)->isReferenceType() && !(*N)->isReferenceType()) {
>>> -      if (!Context.hasSameType(O->getUnqualifiedType(),
>>> -                               N->getUnqualifiedType())) {
>>> -        if (ArgPos) *ArgPos = O - OldType->arg_type_begin();
>>> -        return false;
>>> -      }
>>> -    } else {
>>> -      if (!Context.hasSameType(*O, *N)) {
>>> -        if (ArgPos) *ArgPos = O - OldType->arg_type_begin();
>>> -        return false;
>>> -      }
>>> +    if (!Context.hasSameType(*O, *N)) {
>>> +      if (ArgPos) *ArgPos = O - OldType->arg_type_begin();
>>> +      return false;
>>>      }
>>>    }
>>>    return true;
>>>
>>> Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=187770&r1=187769&r2=187770&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
>>> +++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Mon Aug  5 22:57:41 2013
>>> @@ -3461,6 +3461,7 @@ void Sema::InstantiateVariableDefinition
>>>                 VarSpec->getTemplateArgsInfo(), InstantiationDependent) &&
>>>             "Only instantiate variable template specializations that are "
>>>             "not type-dependent");
>>> +    (void)InstantiationDependent;
>>>
>>>      // Find the variable initialization that we'll be substituting.
>>>      assert(VarSpec->getSpecializedTemplate() &&
>>>
>>> Modified: cfe/trunk/test/Driver/crash-report.c
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/crash-report.c?rev=187770&r1=187769&r2=187770&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/test/Driver/crash-report.c (original)
>>> +++ cfe/trunk/test/Driver/crash-report.c Mon Aug  5 22:57:41 2013
>>> @@ -14,6 +14,9 @@
>>>
>>>  // RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH=1 %clang -fsyntax-only -x c /dev/null 2>&1 | FileCheck %s
>>>
>>> +// FIXME: Investigating. "fatal error: file 'nul' modified since it was first processed"
>>> +// XFAIL: mingw32
>>> +
>>>  #pragma clang __debug parser_crash
>>>  // CHECK: Preprocessed source(s) and associated run script(s) are located at:
>>>  // CHECK-NEXT: note: diagnostic msg: {{.*}}.c
>>>
>>> Removed: cfe/trunk/test/SemaCXX/function-pointer-arguments.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/function-pointer-arguments.cpp?rev=187769&view=auto
>>> ==============================================================================
>>> --- cfe/trunk/test/SemaCXX/function-pointer-arguments.cpp (original)
>>> +++ cfe/trunk/test/SemaCXX/function-pointer-arguments.cpp (removed)
>>> @@ -1,52 +0,0 @@
>>> -//RUN: %clang_cc1 -fsyntax-only -verify %s
>>> -
>>> -namespace PR16570 {
>>> -  int f1(int, int);
>>> -  int f2(const int, int);
>>> -  int f3(int&, int);
>>> -  int f4(const int&, int);
>>> -
>>> -  void good() {
>>> -    int(*g1)(int, int) = f1;
>>> -    int(*g2)(const int, int) = f1;
>>> -    int(*g3)(volatile int, int) = f1;
>>> -    int(*g4)(int, int) = f2;
>>> -    int(*g5)(const int, int) = f2;
>>> -    int(*g6)(volatile int, int) = f2;
>>> -    int(*g7)(int&, int) = f3;
>>> -    int(*g8)(const int&, int) = f4;
>>> -  }
>>> -
>>> -  void bad() {
>>> -    void (*g1)(int, int) = f1;
>>> -    // expected-error at -1 {{different return type ('void' vs 'int'}}
>>> -    const int (*g2)(int, int) = f1;
>>> -    // expected-error at -1 {{different return type ('const int' vs 'int')}}
>>> -
>>> -    int (*g3)(char, int) = f1;
>>> -    // expected-error at -1 {{type mismatch at 1st parameter ('char' vs 'int')}}
>>> -    int (*g4)(int, char) = f1;
>>> -    // expected-error at -1 {{type mismatch at 2nd parameter ('char' vs 'int')}}
>>> -
>>> -    int (*g5)(int) = f1;
>>> -    // expected-error at -1 {{different number of parameters (1 vs 2)}}
>>> -
>>> -    int (*g6)(int, int, int) = f1;
>>> -    // expected-error at -1 {{different number of parameters (3 vs 2)}}
>>> -
>>> -    int (*g7)(const int, char) = f1;
>>> -    // expected-error at -1 {{type mismatch at 2nd parameter ('char' vs 'int')}}
>>> -    int (*g8)(int, char) = f2;
>>> -    // expected-error at -1 {{type mismatch at 2nd parameter ('char' vs 'int')}}
>>> -    int (*g9)(const int&, char) = f3;
>>> -    // expected-error at -1 {{type mismatch at 1st parameter ('const int &' vs 'int &')}}
>>> -    int (*g10)(int&, char) = f4;
>>> -    // expected-error at -1 {{type mismatch at 1st parameter ('int &' vs 'const int &')}}
>>> -  }
>>> -
>>> -  typedef void (*F)(const char * __restrict__, int);
>>> -  void g(const char *, unsigned);
>>> -  F f = g;
>>> -  // expected-error at -1 {{type mismatch at 2nd parameter ('int' vs 'unsigned int')}}
>>> -
>>> -}
>>>
>>>
>>> _______________________________________________
>>> 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