-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
Add support for Semantic Analysis plugins #4430
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
08c3371
[NFC] cleanup plugins.cpp a little
JohanEngelen e86ef5b
Add support for semantic analysis (dlang frontend) plugins.
JohanEngelen 9cf7d91
fixups
JohanEngelen f1b38d7
Add visitor test plugin
JohanEngelen c1e895e
fixup non-plugin build
JohanEngelen 89f43fd
fixups
JohanEngelen fde0bf8
Fix symbol visibility issues on Linux for plugins
JohanEngelen 4256475
Reorder CMakeLists such that LDC_ENABLE_PLUGINS is available when add…
JohanEngelen 86e677a
fixup remnant from testing
JohanEngelen e566bdb
fixup host version check
JohanEngelen 582ebec
fix python when compiler is not LDC
JohanEngelen f7dbb67
disable plugin test for macOS x86(-64)
JohanEngelen 82b365e
Increase plugin ABI LDC version. (1.27.1 did not work on my Mac, but …
JohanEngelen c3b56d7
Add changelog entry, and fix order of plugins vs dcompute.
JohanEngelen b0d8748
Add ldc-build-plugin tool, and make use of it in plugins lit tests.
JohanEngelen a643e1d
Update Changelog
JohanEngelen 2c91ab1
try to fix CI by running tests multiple times
JohanEngelen a45b0d8
Add ldc-build-plugin to cross build packaging
JohanEngelen e3b605e
Reduce the buildflag impact, try to only make changes when needed (pl…
JohanEngelen 04fa0d5
[really re-add -fvisibility-inlines-hidden on Apple targets]
kinke 64655c2
[fix plugin tests flakiness]
kinke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// REQUIRES: Plugins | ||
|
||
// For some reason this test fails with missing symbol linking issues (or crash) with macOS on Intel x86 (but not for all CI testers...) | ||
// UNSUPPORTED: Darwin && host_X86 | ||
|
||
// RUN: split-file %s %t --leading-lines | ||
// RUN: %buildplugin %t/plugin.d -of=%t/plugin%so --buildDir=%t/build | ||
// RUN: %ldc -wi -c -o- --plugin=%t/plugin%so %t/testcase.d 2>&1 | FileCheck %t/testcase.d | ||
|
||
//--- plugin.d | ||
import dmd.dmodule : Module; | ||
import dmd.errors; | ||
import dmd.location; | ||
|
||
extern(C) void runSemanticAnalysis(Module m) { | ||
if (m.md) { | ||
warning(m.md.loc, "It works!"); | ||
} | ||
} | ||
|
||
//--- testcase.d | ||
// CHECK: testcase.d([[@LINE+1]]): Warning: It works! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So does the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, with |
||
module testcase; | ||
int testfunction(int i) { | ||
return i * 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,28 @@ | ||
import lit.formats | ||
import lit.util | ||
import os | ||
import sys | ||
import platform | ||
import string | ||
import re | ||
import subprocess | ||
import glob | ||
|
||
if (config.plugins_supported): | ||
config.available_features.add('Plugins') | ||
config.environment['LLVM_CONFIG'] = os.path.join(config.llvm_tools_dir, 'llvm-config') | ||
config.environment['LLVM_VERSION'] = str(config.llvm_version) | ||
|
||
# Set feature that tells us that the just-built LDC is ABI compatible with the host D compiler | ||
# For our tets, the required ABI compatibility seems OK since at least LDC 1.30. | ||
# If the compiler is built not by LDC but another compiler, then assume the ABI to be incompatible. | ||
command = [config.ldc2_bin, '--version'] | ||
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) | ||
text1 = p.stdout.readline() # Ex.: "LDC - the LLVM D compiler (1.33.0-git-716f627)" | ||
text2 = p.stdout.readline() # Ex.: " based on DMD v2.103.1 and LLVM 14.0.0" | ||
text3 = p.stdout.readline() # Ex.: " built with LDC - the LLVM D compiler (1.33.0-beta2)" | ||
host_version = re.compile(' built with LDC.* \(1\.([0-9]+).*\)').match(text3) | ||
if (host_version and int(host_version.group(1)) >= 30): # 30 = LDC 1.30 | ||
config.available_features.add('ABI_compatible_with_host_D') | ||
|
||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The macOS builds (both x64 and arm64) now produce something like ~500 warnings:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how the macOS CI testers are different from my macOS..... I don't see any of this, and also did not need to remove this flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's related to how LLVM was built. The CI build in our
llvm-project
fork is pretty standard though...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's see if I can only remove this flag for linux builds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it worked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UNIX
includesAPPLE
; I've pushed an according commit really testing macOS with that flag.