On Thu, Feb 4, 2016 at 8:12 PM, Saleem Abdulrasool via cfe-commits < cfe-commits@lists.llvm.org> wrote:
> Author: compnerd > Date: Thu Feb 4 22:12:40 2016 > New Revision: 259874 > > URL: http://llvm.org/viewvc/llvm-project?rev=259874&view=rev > Log: > CodeGen: correct Windows ARM C++ assertion > Id like to merge this to the 3.8 release. It only effects Windows ARM code generation, so should be quite safe. > Because the Decl is explicitly passed as nullptr further up the call > chain, it > is possible to invoke isa on a nullptr, which will assert. Guard against > the > nullptr. > > Take the opportunity to reuse the helper method rather than > re-implementing this > logic. > > Added: > cfe/trunk/test/CodeGenCXX/windows-on-arm-stack-probe-size.cpp > Modified: > cfe/trunk/lib/CodeGen/TargetInfo.cpp > > Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=259874&r1=259873&r2=259874&view=diff > > ============================================================================== > --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original) > +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Thu Feb 4 22:12:40 2016 > @@ -4889,9 +4889,6 @@ public: > }; > > class WindowsARMTargetCodeGenInfo : public ARMTargetCodeGenInfo { > - void addStackProbeSizeTargetAttribute(const Decl *D, llvm::GlobalValue > *GV, > - CodeGen::CodeGenModule &CGM) > const; > - > public: > WindowsARMTargetCodeGenInfo(CodeGenTypes &CGT, ARMABIInfo::ABIKind K) > : ARMTargetCodeGenInfo(CGT, K) {} > @@ -4900,18 +4897,6 @@ public: > CodeGen::CodeGenModule &CGM) const override; > }; > > -void WindowsARMTargetCodeGenInfo::addStackProbeSizeTargetAttribute( > - const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &CGM) > const { > - if (!isa<FunctionDecl>(D)) > - return; > - if (CGM.getCodeGenOpts().StackProbeSize == 4096) > - return; > - > - llvm::Function *F = cast<llvm::Function>(GV); > - F->addFnAttr("stack-probe-size", > - llvm::utostr(CGM.getCodeGenOpts().StackProbeSize)); > -} > - > void WindowsARMTargetCodeGenInfo::setTargetAttributes( > const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &CGM) > const { > ARMTargetCodeGenInfo::setTargetAttributes(D, GV, CGM); > > Added: cfe/trunk/test/CodeGenCXX/windows-on-arm-stack-probe-size.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/windows-on-arm-stack-probe-size.cpp?rev=259874&view=auto > > ============================================================================== > --- cfe/trunk/test/CodeGenCXX/windows-on-arm-stack-probe-size.cpp (added) > +++ cfe/trunk/test/CodeGenCXX/windows-on-arm-stack-probe-size.cpp Thu Feb > 4 22:12:40 2016 > @@ -0,0 +1,13 @@ > +// RUN: %clang_cc1 -triple thumbv7--windows-msvc -S -emit-llvm -o - -x > c++ %s | FileCheck %s > +// RUN: %clang_cc1 -triple thumbv7--windows-itanium -fno-use-cxa-atexit > -S -emit-llvm -o - -x c++ %s | FileCheck %s > + > +class C { > +public: > + ~C(); > +}; > + > +static C sc; > +void f(const C &ci) { sc = ci; } > + > +// CHECK: atexit > + > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > -- Saleem Abdulrasool compnerd (at) compnerd (dot) org
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits