Skip to content

Fix the hash function for SILDebugScopes to handle the empty scopes #9461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,064 changes: 1,677 additions & 1,387 deletions lib/IRGen/IRGenDebugInfo.cpp

Large diffs are not rendered by default.

282 changes: 24 additions & 258 deletions lib/IRGen/IRGenDebugInfo.h

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions lib/IRGen/IRGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ static clang::CodeGenerator *createClangCodeGenerator(ASTContext &Context,
CGO.setDebugInfo(clang::codegenoptions::DebugInfoKind::DebugLineTablesOnly);
break;
case IRGenDebugInfoKind::ASTTypes:
// TODO: Enable -gmodules for the clang code generator.
case IRGenDebugInfoKind::DwarfTypes:
CGO.DebugTypeExtRefs = true;
CGO.setDebugInfo(clang::codegenoptions::DebugInfoKind::FullDebugInfo);
break;
}
Expand Down Expand Up @@ -380,7 +380,8 @@ IRGenModule::IRGenModule(IRGenerator &irgen,
UseSwiftCC = (SwiftCC == llvm::CallingConv::Swift);

if (IRGen.Opts.DebugInfoKind > IRGenDebugInfoKind::None)
DebugInfo = new IRGenDebugInfo(IRGen.Opts, *CI, *this, Module, SF);
DebugInfo = IRGenDebugInfo::createIRGenDebugInfo(IRGen.Opts, *CI, *this,
Module, SF);

initClangTypeConverter();

Expand Down
1 change: 1 addition & 0 deletions lib/IRGen/IRGenSIL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
//===----------------------------------------------------------------------===//

#define DEBUG_TYPE "irgensil"
#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Instructions.h"
Expand Down
19 changes: 9 additions & 10 deletions test/DebugInfo/ImportClangSubmodule.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// RUN: rm -rf %t && mkdir -p %t
// REQUIRES: OS=macosx
// RUN: %target-swift-frontend -emit-ir %s -g -I %S/Inputs -o - | %FileCheck %s

// RUN: %target-swift-frontend -emit-ir %s -g -o - | %FileCheck %s
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Bar",
// CHECK-SAME: scope: ![[SUBMODULE:[0-9]+]]

// CHECK: !DIImportedEntity(
// CHECK: tag: DW_TAG_imported_module{{.*}}entity: ![[C:.*]], line: [[@LINE+1]])
import Darwin.C
// CHECK: ![[SUBMODULE]] = !DIModule(scope: ![[CLANGMODULE:[0-9]+]],
// CHECK-SAME: name: "SubModule",
// CHECK: ![[CLANGMODULE]] = !DIModule(scope: null, name: "ClangModule",
// CHECK: !DIImportedEntity({{.*}}, entity: ![[SUBMODULE]], line: [[@LINE+1]])
import ClangModule.SubModule

let irrational = sqrt(2 as Double)

// CHECK: ![[C]] = !DIModule(scope: ![[Darwin:.*]], name: "C",
// CHECK: ![[Darwin]] = !DIModule(scope: null, name: "Darwin",
let bar = Bar()
1 change: 1 addition & 0 deletions test/DebugInfo/Inputs/SubModule.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
struct Bar {};
5 changes: 5 additions & 0 deletions test/DebugInfo/Inputs/module.map
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
module ClangModule {
header "ClangModule.h"
export *
module SubModule {
header "SubModule.h"
export *
}
}
5 changes: 3 additions & 2 deletions test/DebugInfo/test-foundation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ class MyObject : NSObject {
var MyArr = NSArray()
// IMPORT-CHECK: filename: "test-foundation.swift"
// IMPORT-CHECK-DAG: [[FOUNDATION:[0-9]+]] = !DIModule({{.*}} name: "Foundation",{{.*}} includePath:
// IMPORT-CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "NSArray", scope: ![[FOUNDATION]]
// IMPORT-CHECK-DAG: !DIImportedEntity(tag: DW_TAG_imported_module, {{.*}}entity: ![[FOUNDATION]]
// IMPORT-CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "NSArray", scope: ![[NSARRAY:[0-9]+]]
// IMPORT-CHECK-DAG: ![[NSARRAY]] = !DIModule(scope: ![[FOUNDATION:[0-9]+]], name: "NSArray"
// IMPORT-CHECK-DAG: !DIImportedEntity(tag: DW_TAG_imported_module, {{.*}}entity: ![[FOUNDATION]]

func foo(_ obj: MyObject) {
return obj.foo(obj)
Expand Down