Debug info: Don't emit externally defined global variables.

rdar://problem/20507438

Swift SVN r28276
This commit is contained in:
Adrian Prantl
2015-05-07 18:14:55 +00:00
parent 38be24cd53
commit de7de7db9c
3 changed files with 11 additions and 1 deletions

View File

@@ -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,

View File

@@ -0,0 +1,3 @@
// This module is imported by external-global.swift
// RUN: true
public var global : Int64 = 0

View 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