r241019 - PR23942: a pure-specifier's integer literal must be spelled '0'
Richard Smith
richard at metafoo.co.uk
Mon Jun 29 18:58:54 PDT 2015
This should already be fixed; please try again with r241032.
On Mon, Jun 29, 2015 at 6:49 PM, Filipe Cabecinhas <filcab at gmail.com> wrote:
> Hi Richard,
>
> It looks like this rev caused all our bots (Mac, Windows, and Linux. Clean
> Release+Asserts builds) to fail:
>
> FAIL: Clang :: SemaCXX/override-in-system-header.cpp (6652 of 23274)
> ******************** TEST 'Clang :: SemaCXX/override-in-system-header.cpp'
> FAILED ********************
> Script:
> --
> /home/buildbot/Buildbot/Slave/builds/1.LLVM.Linux.Phase.2/llvm.obj/./bin/clang
> -cc1 -internal-isystem
> /home/buildbot/Buildbot/Slave/builds/1.LLVM.Linux.Phase.2/llvm.obj/bin/../lib/clang/3.7.0/include
> -nostdsysteminc -std=c++11 -isystem
> /home/buildbot/Buildbot/Slave/builds/1.LLVM.Linux.Phase.2/clang.src/test/SemaCXX/Inputs
> /home/buildbot/Buildbot/Slave/builds/1.LLVM.Linux.Phase.2/clang.src/test/SemaCXX/override-in-system-header.cpp
> -verify
> --
> Exit Code: 1
>
> Command Output (stderr):
> --
> error: 'error' diagnostics seen but not expected:
> Line 10: initializer on function does not look like a pure-specifier
> Line 17: initializer on function does not look like a pure-specifier
> 2 errors generated.
>
> --
>
> ********************
> Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
> Testing Time: 30.62s
> ********************
> Failing Tests (1):
> Clang :: SemaCXX/override-in-system-header.cpp
>
>
> Could you take a look?
>
> Thanks,
>
> Filipe
>
> On Mon, Jun 29, 2015 at 4:19 PM, Richard Smith <richard-llvm at metafoo.co.uk
> > wrote:
>
>> Author: rsmith
>> Date: Mon Jun 29 18:19:23 2015
>> New Revision: 241019
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=241019&view=rev
>> Log:
>> PR23942: a pure-specifier's integer literal must be spelled '0'
>>
>> Modified:
>> cfe/trunk/lib/Sema/SemaDecl.cpp
>> cfe/trunk/test/Parser/cxx-class.cpp
>>
>> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=241019&r1=241018&r2=241019&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Jun 29 18:19:23 2015
>> @@ -8783,6 +8783,19 @@ namespace {
>> }
>> }
>>
>> +/// Determine whether the given expression was formed from the token
>> '0'. This
>> +/// test is necessary to determine whether an initializer is really a
>> +/// pure-specifier.
>> +static bool isZeroToken(Sema &S, Expr *E) {
>> + auto *IL = dyn_cast<IntegerLiteral>(E);
>> + if (!IL || !!IL->getValue() ||
>> + !IL->getType()->isSpecificBuiltinType(BuiltinType::Int))
>> + return false;
>> +
>> + SmallString<8> Buffer;
>> + return S.PP.getSpelling(E->getLocStart(), Buffer) == "0";
>> +}
>> +
>> /// AddInitializerToDecl - Adds the initializer Init to the
>> /// declaration dcl. If DirectInit is true, this is C++ direct
>> /// initialization rather than copy initialization.
>> @@ -8799,9 +8812,11 @@ void Sema::AddInitializerToDecl(Decl *Re
>> // With declarators parsed the way they are, the parser cannot
>> // distinguish between a normal initializer and a pure-specifier.
>> // Thus this grotesque test.
>> - IntegerLiteral *IL;
>> - if ((IL = dyn_cast<IntegerLiteral>(Init)) && IL->getValue() == 0 &&
>> - Context.getCanonicalType(IL->getType()) == Context.IntTy)
>> + //
>> + // FIXME: The parser should instead treat anything that looks like a
>> + // pure-specifier as a pure-specifier, and Sema should convert it to
>> an
>> + // initializer when necessary, rather than doing things this way
>> around.
>> + if (!DirectInit && isZeroToken(*this, Init))
>> CheckPureMethod(Method, Init->getSourceRange());
>> else {
>> Diag(Method->getLocation(),
>> diag::err_member_function_initialization)
>>
>> Modified: cfe/trunk/test/Parser/cxx-class.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-class.cpp?rev=241019&r1=241018&r2=241019&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/test/Parser/cxx-class.cpp (original)
>> +++ cfe/trunk/test/Parser/cxx-class.cpp Mon Jun 29 18:19:23 2015
>> @@ -24,6 +24,16 @@ public:
>> ; // expected-warning{{extra ';' inside a class}}
>>
>> virtual int vf() const volatile = 0;
>> +
>> + virtual int vf0() = 0l; // expected-error {{does not look like a
>> pure-specifier}}
>> + virtual int vf1() = 1; // expected-error {{does not look like a
>> pure-specifier}}
>> + virtual int vf2() = 00; // expected-error {{does not look like a
>> pure-specifier}}
>> + virtual int vf3() = 0x0; // expected-error {{does not look like a
>> pure-specifier}}
>> + virtual int vf4() = 0.0; // expected-error {{does not look like a
>> pure-specifier}}
>> + virtual int vf5(){0}; // expected-error +{{}} expected-warning
>> {{unused}}
>> + virtual int vf5a(){0;}; // function definition, expected-warning
>> {{unused}}
>> + virtual int vf6()(0); // expected-error +{{}} expected-note +{{}}
>> + virtual int vf7() = { 0 }; // expected-error {{does not look like a
>> pure-specifier}}
>>
>> private:
>> int x,f(),y,g();
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150629/30dd897f/attachment.html>
More information about the cfe-commits
mailing list