Skip to content
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

-i: Exclude ldc.* modules by default #3679

Merged
merged 1 commit into from
Mar 15, 2021
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 changes: 2 additions & 1 deletion dmd/compiler.d
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,11 @@ private void createMatchNodes()
}

// Add the default 1 depth matchers
MatcherNode[8] defaultDepth1MatchNodes = [
MatcherNode[10] defaultDepth1MatchNodes = [
MatcherNode(true, 1), MatcherNode(Id.std),
MatcherNode(true, 1), MatcherNode(Id.core),
MatcherNode(true, 1), MatcherNode(Id.etc),
MatcherNode(true, 1), MatcherNode(Id.ldc), // IN_LLVM
MatcherNode(true, 1), MatcherNode(Id.object),
];
{
Expand Down
29 changes: 29 additions & 0 deletions tests/driver/include_imports.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Make sure that -i includes an imported custom module, but excludes
// druntime and Phobos modules.

// Make sure it links and check the -v output:
// RUN: %ldc -I%S -i %s -v | FileCheck %s

// CHECK-NOT: {{^code .*}}
// CHECK: {{^code include_imports2}}
// CHECK-NOT: {{^code .*}}
// CHECK: {{^code include_imports}}
// CHECK-NOT: {{^code .*}}

static import core.stdc.math; // druntime
static import std.math; // Phobos
import ldc.attributes : assumeUsed; // LDC-specific druntime
import inputs.include_imports2 : bar;

@assumeUsed
void test(string s, double x)
{
const r1 = core.stdc.math.log(x);
const r2 = std.math.log(x);
bar();
}

void main()
{
test("abc", 0.5);
}
1 change: 1 addition & 0 deletions tests/driver/inputs/include_imports2.d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
void bar() {}