mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Debug info: Don't emit externally defined global variables.
rdar://problem/20507438 Swift SVN r28276
This commit is contained in:
@@ -1220,7 +1220,7 @@ llvm::GlobalVariable *LinkInfo::createVariable(IRGenModule &IGM,
|
||||
IGM.addUsedGlobal(var);
|
||||
}
|
||||
|
||||
if (IGM.DebugInfo)
|
||||
if (IGM.DebugInfo && ForDefinition)
|
||||
IGM.DebugInfo->
|
||||
emitGlobalVariableDeclaration(var,
|
||||
DebugName.empty() ? getName() : DebugName,
|
||||
|
||||
3
test/DebugInfo/Globals.swift
Normal file
3
test/DebugInfo/Globals.swift
Normal file
@@ -0,0 +1,3 @@
|
||||
// This module is imported by external-global.swift
|
||||
// RUN: true
|
||||
public var global : Int64 = 0
|
||||
7
test/DebugInfo/external-global.swift
Normal file
7
test/DebugInfo/external-global.swift
Normal file
@@ -0,0 +1,7 @@
|
||||
// RUN: rm -rf %t && mkdir -p %t
|
||||
// RUN: %target-swift-frontend -emit-module-path %t/Globals.swiftmodule %S/Globals.swift
|
||||
// RUN: %target-swift-frontend -I %t %s -g -emit-ir -o - | FileCheck %s
|
||||
import Globals
|
||||
// No debug info should be emitted for an externally defined global variable.
|
||||
// CHECK-NOT: !DIGlobalVariable({{.*}}global
|
||||
global = 23
|
||||
Reference in New Issue
Block a user