Skip to content

Commit 961db8d

Browse files
committed
Merging r259874:
------------------------------------------------------------------------ r259874 | compnerd | 2016-02-04 20:12:40 -0800 (Thu, 04 Feb 2016) | 8 lines CodeGen: correct Windows ARM C++ assertion 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. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_38@261158 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 36ac462 commit 961db8d

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

lib/CodeGen/TargetInfo.cpp

-15
Original file line numberDiff line numberDiff line change
@@ -4868,9 +4868,6 @@ class ARMTargetCodeGenInfo : public TargetCodeGenInfo {
48684868
};
48694869

48704870
class WindowsARMTargetCodeGenInfo : public ARMTargetCodeGenInfo {
4871-
void addStackProbeSizeTargetAttribute(const Decl *D, llvm::GlobalValue *GV,
4872-
CodeGen::CodeGenModule &CGM) const;
4873-
48744871
public:
48754872
WindowsARMTargetCodeGenInfo(CodeGenTypes &CGT, ARMABIInfo::ABIKind K)
48764873
: ARMTargetCodeGenInfo(CGT, K) {}
@@ -4879,18 +4876,6 @@ class WindowsARMTargetCodeGenInfo : public ARMTargetCodeGenInfo {
48794876
CodeGen::CodeGenModule &CGM) const override;
48804877
};
48814878

4882-
void WindowsARMTargetCodeGenInfo::addStackProbeSizeTargetAttribute(
4883-
const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &CGM) const {
4884-
if (!isa<FunctionDecl>(D))
4885-
return;
4886-
if (CGM.getCodeGenOpts().StackProbeSize == 4096)
4887-
return;
4888-
4889-
llvm::Function *F = cast<llvm::Function>(GV);
4890-
F->addFnAttr("stack-probe-size",
4891-
llvm::utostr(CGM.getCodeGenOpts().StackProbeSize));
4892-
}
4893-
48944879
void WindowsARMTargetCodeGenInfo::setTargetAttributes(
48954880
const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &CGM) const {
48964881
ARMTargetCodeGenInfo::setTargetAttributes(D, GV, CGM);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %clang_cc1 -triple thumbv7--windows-msvc -S -emit-llvm -o - -x c++ %s | FileCheck %s
2+
// RUN: %clang_cc1 -triple thumbv7--windows-itanium -fno-use-cxa-atexit -S -emit-llvm -o - -x c++ %s | FileCheck %s
3+
4+
class C {
5+
public:
6+
~C();
7+
};
8+
9+
static C sc;
10+
void f(const C &ci) { sc = ci; }
11+
12+
// CHECK: atexit
13+

0 commit comments

Comments
 (0)