r233508 - Add check for kind of UnqualifiedId in Declarator::isStaticMember()

Richard Smith richard at metafoo.co.uk
Sat Apr 25 17:35:00 PDT 2015


On 25 Apr 2015 4:10 am, "Daniel Sanders" <Daniel.Sanders at imgtec.com> wrote:
>
> Hi Richard,
>
> I'd like to merge this patch into the LLVM 3.6.1 release. Is this merge
ok with you?

Yes, approved.

________________________________________
> From: cfe-commits-bounces at cs.uiuc.edu [cfe-commits-bounces at cs.uiuc.edu]
on behalf of Petar Jovanovic
> Sent: 30 March 2015 01:43
> To: cfe-commits at cs.uiuc.edu
> Subject: r233508 - Add check for kind of UnqualifiedId in
 Declarator::isStaticMember()
>
> Author: petarj
> Date: Sun Mar 29 19:43:56 2015
> New Revision: 233508
>
> URL: http://llvm.org/viewvc/llvm-project?rev=233508&view=rev
> Log:
> Add check for kind of UnqualifiedId in Declarator::isStaticMember()
>
> Method CXXMethodDecl::isStaticOverloadedOperator expects Operator field
> from the struct OperatorFunctionId, which is a member of the union in
> the class UnqualifiedId. If the kind of UnqualifiedId is not checked,
> there is no guarantee that the value that this method receives will be
> correct, because it can be the value of another union member and not
> OperatorFunctionId.
>
> This bug manifests itself when running make check-all on mips64 BE.
>
> This fix resolves the following regression tests:
> Clang :: CXX/special/class.dtor/p9.cpp
> Clang :: CodeGenCXX/2006-09-12-OpaqueStructCrash.cpp
> Clang :: CodeGenCXX/ctor-dtor-alias.cpp
> Clang :: CodeGenCXX/debug-info-windows-dtor.cpp
> Clang :: CodeGenCXX/dllexport-members.cpp
> Clang :: CodeGenCXX/dllexport.cpp
>
> Patch by Violeta Vukobrat.
>
> Differential Revision:  http://reviews.llvm.org/D8437
>
> Modified:
>     cfe/trunk/lib/Sema/DeclSpec.cpp
>
> Modified: cfe/trunk/lib/Sema/DeclSpec.cpp
> URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=233508&r1=233507&r2=233508&view=diff
>
==============================================================================
> --- cfe/trunk/lib/Sema/DeclSpec.cpp (original)
> +++ cfe/trunk/lib/Sema/DeclSpec.cpp Sun Mar 29 19:43:56 2015
> @@ -345,8 +345,9 @@ bool Declarator::isDeclarationOfFunction
>  bool Declarator::isStaticMember() {
>    assert(getContext() == MemberContext);
>    return getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_static ||
> -         CXXMethodDecl::isStaticOverloadedOperator(
> -             getName().OperatorFunctionId.Operator);
> +         (getName().Kind == UnqualifiedId::IK_OperatorFunctionId &&
> +          CXXMethodDecl::isStaticOverloadedOperator(
> +              getName().OperatorFunctionId.Operator));
>  }
>
>  bool DeclSpec::hasTagDefinition() const {
>
>
> _______________________________________________
> 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/20150425/26bf4f09/attachment.html>


More information about the cfe-commits mailing list