themaplelab / swan Goto Github PK
View Code? Open in Web Editor NEWSwift Static Analysis Framework
License: Apache License 2.0
Swift Static Analysis Framework
License: Apache License 2.0
Currently, running the framework on an example Swift file will result in the following error:
<unknown>:0: error: error opening input file 'testFiles/test1-numLiterals.swift' (No such file or directory)
This arises when calling performFrontend.
With Karim and Julian.
I am trying to run SWAN on my machine and I encounter an error while running the example file because the system couldn't load a library called libcast.dylib
. Couldn't find any help regarding this library libcast.dylib
on Google.
[~/projects/maple-lab]$ ./swan-release/cli/run-swan-single -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDK
s/MacOSX.sdk -path ./swan-release/test-files/Simple.swift
Could not find shared library!
java.lang.UnsatisfiedLinkError: /Users/moazin/projects/maple-lab/swan-release/lib/libswiftWala.dylib: dlopen(/Users/moazin/projects/
s/maple-lab/swan-release/lib/libswiftWala.dylib, 1): Library not loaded: @rpath/libcast.dylib
Referenced from: /Users/moazin/projects/maple-lab/swan-release/lib/libswiftWala.dylib
Reason: image not found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817)
at java.lang.Runtime.load0(Runtime.java:810)
at java.lang.System.load(System.java:1086)
at ca.maple.swan.swift.translator.sil.SwiftTranslatorPathLoader.load(SwiftTranslatorPathLoader.java:39)
at ca.maple.swan.swift.translator.wala.SwiftToCAstTranslator.<clinit>(SwiftToCAstTranslator.java:55)
at ca.maple.swan.swift.server.SwiftAnalysisEngineServerDriver.generateSDG(SwiftAnalysisEngineServerDriver.java:110)
at ca.maple.swan.swift.test.GenericTester.doTest(GenericTester.java:66)
at ca.maple.swan.swift.test.GenericTester.<init>(GenericTester.java:50)
at ca.maple.swan.swift.test.GenericTester.main(GenericTester.java:182)
Exception in thread "main" java.lang.UnsatisfiedLinkError: ca.maple.swan.swift.translator.wala.SwiftToCAstTranslator.translateToCAstNodes(Ljava/util/ArrayList;)Lj
ava/util/ArrayList;
at ca.maple.swan.swift.translator.wala.SwiftToCAstTranslator.translateToCAstNodes(Native Method)
at ca.maple.swan.swift.translator.sil.RawData.setup(RawData.java:69)
at ca.maple.swan.swift.server.SwiftAnalysisEngineServerDriver.generateSDG(SwiftAnalysisEngineServerDriver.java:112)
at ca.maple.swan.swift.test.GenericTester.doTest(GenericTester.java:66)
at ca.maple.swan.swift.test.GenericTester.<init>(GenericTester.java:50)
at ca.maple.swan.swift.test.GenericTester.main(GenericTester.java:182)
I'm running macOS Catalina Version 10.15.6 and XCode Command Line Tools version is 12.3 (12C33). Java version is 1.8.0_271
Hi, I'm giving SWAN a spin on the Logger module of our project and processing the SIL fails with the following output:
pallzoltan@840G5-087 XXX % java -jar bin/swan/driver.jar ./swan-dir
[main] Parsing Logger.XXX.sil
ca.ualberta.maple.swan.parser.Error: ./swan-dir/Logger.XXX.sil:161:60: " expected
alloc_global @$s6Logger13ABCrashlyticsC6sharedACvpZ, loc * "/Users/pallzoltan/Work/XXX/Modules/Logger/Logger/ABCrashlytics.swift":11:23, scope 1 // id: %1
^
Please create a new issue with this exception at https://github.com/themaplelab/swan/issues/new.
at ca.ualberta.maple.swan.parser.SILParser.parseError(SILParser.scala:276)
at ca.ualberta.maple.swan.parser.SILParser.take(SILParser.scala:84)
at ca.ualberta.maple.swan.parser.SILParser.parseString(SILParser.scala:2869)
at ca.ualberta.maple.swan.parser.SILParser.parseLoc(SILParser.scala:2515)
at ca.ualberta.maple.swan.parser.SILParser.parseSourceInfo(SILParser.scala:2824)
at ca.ualberta.maple.swan.parser.SILParser.parseInstructionDef(SILParser.scala:408)
at ca.ualberta.maple.swan.parser.SILParser.parseInstructionDefs(SILParser.scala:390)
at ca.ualberta.maple.swan.parser.SILParser.parseBlock(SILParser.scala:380)
at ca.ualberta.maple.swan.parser.SILParser.$anonfun$3(SILParser.scala:369)
at ca.ualberta.maple.swan.parser.SILParser.parseManyBlocks(SILParser.scala:206)
at ca.ualberta.maple.swan.parser.SILParser.parseNilOrManyBlocks(SILParser.scala:195)
at ca.ualberta.maple.swan.parser.SILParser.parseFunction(SILParser.scala:369)
at ca.ualberta.maple.swan.parser.SILParser.parseModule(SILParser.scala:297)
at ca.ualberta.maple.swan.drivers.Driver.runner(Driver.scala:580)
at ca.ualberta.maple.swan.drivers.Driver.ca$ualberta$maple$swan$drivers$Driver$$_$go$1(Driver.scala:355)
at ca.ualberta.maple.swan.drivers.Driver.runActual$$anonfun$2(Driver.scala:362)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)
at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)
at scala.collection.AbstractIterable.foreach(Iterable.scala:919)
at ca.ualberta.maple.swan.drivers.Driver.runActual(Driver.scala:372)
at ca.ualberta.maple.swan.drivers.Driver.run(Driver.scala:318)
at picocli.CommandLine.executeUserObject(CommandLine.java:1939)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
at picocli.CommandLine.execute(CommandLine.java:2078)
at ca.ualberta.maple.swan.drivers.Driver$.main(Driver.scala:166)
at ca.ualberta.maple.swan.drivers.Driver.main(Driver.scala)
The code on line 11 creates a shared singleton:
public final class ABCrashlytics {
// MARK: - Public properties
public static let shared = ABCrashlytics() // Line 11
./gradlew build
gives me:
> Task :ca.ualberta.maple.swan.test:test
SPDSTests > testSPDSSwift() FAILED
java.io.IOException at SPDSTests.java:124
Caused by: java.io.IOException at SPDSTests.java:124
SPDSTests > testSPDSSIL() FAILED
java.io.IOException at SPDSTests.java:84
Caused by: java.io.IOException at SPDSTests.java:84
Playground > testSIL() FAILED
java.io.IOException at Playground.java:63
Caused by: java.io.IOException at Playground.java:63
Playground > testSwift() FAILED
java.io.IOException at Playground.java:93
Caused by: java.io.IOException at Playground.java:93
Tests > testSwiftFiles() FAILED
java.io.IOException at Tests.java:99
Caused by: java.io.IOException at Tests.java:99
Tests > testDriver() FAILED
java.io.IOException at Tests.java:111
Caused by: java.io.IOException at Tests.java:111
Tests > testSILModules() FAILED
java.io.IOException at Tests.java:46
Caused by: java.io.IOException at Tests.java:46
Tests > testLargeSILModules() FAILED
java.io.IOException at Tests.java:63
Caused by: java.io.IOException at Tests.java:63
11 tests completed, 8 failed
> Task :ca.ualberta.maple.swan.test:test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ca.ualberta.maple.swan.test:test'.
> There were failing tests. See the report at: file:///Users/abdulalib/Documents/swan/jvm/ca.ualberta.maple.swan.test/build/reports/tests/test/index.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 30s
30 actionable tasks: 16 executed, 14 up-to-date
Tests report attached:
Report.zip
if (!initialized) {
initialized = true;
initialize(env);
}
Must be removed in WALA/com.ibm.wala.cast/source/c/jni/CAstWrapper.cpp
(i.e. here) to make the new entry point work.
swift/lib/WALASupport/CMakeLists.txt and ./lib/FrontendTool/CMakeLists.txt contains hardcoded path "-I$ENV{JAVA_HOME}/include/darwin". Possible fix: change it to "-I$ENV{JAVA_HOME}/include/linux"
With the swift5-fix
branch, and checked out to this commit of the apple/swift
repo on May 2, I was able to get swan to build. However, between that commit and sometime on May 3, something changed and now we get the error below when building swan.
What I have tried:
apple/swift
and relevant dependency repos that are pulled in with update-checkout
--dry-run
of the old (May 2) swift and the latest'CMakeLists.txt
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :swift-wala-translator:externalBuildSwiftWalaSharedLibrary
-- Linker detection: ld64
-- Building with -fPIC
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/tiganov/Documents/CS/swift-source/swift-wala/com.ibm.wala.cast.swift/swift-wala-translator/build/external-build/swiftWala/osx_x86-64
[ 60%] Building CXX object lib/WALASupport/CMakeFiles/swiftWala.dir/SILWalaInstructionVisitor.cpp.o
[ 60%] Building CXX object lib/WALASupport/CMakeFiles/swiftWala.dir/WALAInstance.cpp.o
[ 60%] Building CXX object lib/WALASupport/CMakeFiles/swiftWala.dir/BasicBlockLabeller.cpp.o
In file included from /Users/tiganov/Documents/CS/swift-source/swift-wala/com.ibm.wala.cast.swift/swift-wala-translator/lib/WALASupport/BasicBlockLabeller.cpp:1:
In file included from /Users/tiganov/Documents/CS/swift-source/swift-wala/com.ibm.wala.cast.swift/swift-wala-translator/include/swift-wala/WALASupport/BasicBlockLabeller.h:5:
In file included from /Users/tiganov/Documents/CS/swift-source/swift/include/swift/SIL/SILBasicBlock.h:24:
In file included from /Users/tiganov/Documents/CS/swift-source/swift/include/swift/SIL/SILInstruction.h:35:
In file included from /Users/tiganov/Documents/CS/swift-source/swift/include/swift/SIL/SILLocation.h:18:
/Users/tiganov/Documents/CS/swift-source/swift/include/swift/Basic/SourceManager.h:18:10: fatal error: 'clang/Basic/FileManager.h' file not found
#include "clang/Basic/FileManager.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[3]: *** [lib/WALASupport/CMakeFiles/swiftWala.dir/BasicBlockLabeller.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
In file included from /Users/tiganov/Documents/CS/swift-source/swift-wala/com.ibm.wala.cast.swift/swift-wala-translator/lib/WALASupport/SILWalaInstructionVisitor.cpp:1:
In file included from /Users/tiganov/Documents/CS/swift-source/swift/include/swift/SIL/SILModule.h:28:
In file included from /Users/tiganov/Documents/CS/swift-source/swift/include/swift/SIL/SILCoverageMap.h:23:
In file included from /Users/tiganov/Documents/CS/swift-source/swift/include/swift/SIL/SILFunction.h:23:
In file included from /Users/tiganov/Documents/CS/swift-source/swift/include/swift/SIL/SILBasicBlock.h:24:
In file included from /Users/tiganov/Documents/CS/swift-source/swift/include/swift/SIL/SILInstruction.h:35:
In file included from /Users/tiganov/Documents/CS/swift-source/swift/include/swift/SIL/SILLocation.h:18:
/Users/tiganov/Documents/CS/swift-source/swift/include/swift/Basic/SourceManager.h:18:10: fatal error: 'clang/Basic/FileManager.h' file not found
#include "clang/Basic/FileManager.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Users/tiganov/Documents/CS/swift-source/swift-wala/com.ibm.wala.cast.swift/swift-wala-translator/lib/WALASupport/WALAInstance.cpp:10:
In file included from /Users/tiganov/Documents/CS/swift-source/swift/include/swift/SIL/SILModule.h:28:
In file included from /Users/tiganov/Documents/CS/swift-source/swift/include/swift/SIL/SILCoverageMap.h:23:
In file included from /Users/tiganov/Documents/CS/swift-source/swift/include/swift/SIL/SILFunction.h:23:
In file included from /Users/tiganov/Documents/CS/swift-source/swift/include/swift/SIL/SILBasicBlock.h:24:
In file included from /Users/tiganov/Documents/CS/swift-source/swift/include/swift/SIL/SILInstruction.h:35:
In file included from /Users/tiganov/Documents/CS/swift-source/swift/include/swift/SIL/SILLocation.h:18:
/Users/tiganov/Documents/CS/swift-source/swift/include/swift/Basic/SourceManager.h:18:10: fatal error: 'clang/Basic/FileManager.h' file not found
#include "clang/Basic/FileManager.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[3]: *** [lib/WALASupport/CMakeFiles/swiftWala.dir/SILWalaInstructionVisitor.cpp.o] Error 1
1 error generated.
make[3]: *** [lib/WALASupport/CMakeFiles/swiftWala.dir/WALAInstance.cpp.o] Error 1
make[2]: *** [lib/WALASupport/CMakeFiles/swiftWala.dir/all] Error 2
make[1]: *** [lib/WALASupport/CMakeFiles/swiftWala.dir/rule] Error 2
make: *** [swiftWala] Error 2
> Task :swift-wala-translator:externalBuildSwiftWalaSharedLibrary FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':swift-wala-translator:externalBuildSwiftWalaSharedLibrary'.
> Process 'command 'make'' finished with non-zero exit value 2
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.9/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 11s
3 actionable tasks: 1 executed, 2 up-to-date
Mis-managed merge of uasys/swift master caused WALA code to be included. Need to overwrite with a fresh apple/swift master.
Will not touch until Toronto Code Sprint is over.
It is located under includes/linux, so:
ln -s {$JAVA_HOME}/include/linux/jni_md.h {$JAVA_HOME}/include/jni_md.h
I ran into the following error while running tests in the tests folder:
./test.bash
โ FAILED
[main] Parsing test.swift.sil
ca.ualberta.maple.swan.parser.Error: swan-dir/test.swift.sil:81:1: identifier expected
[%0: escape! v** => %r.v**, escape! v**.c*.v** => %r.v**.c*.v**]
^
Please create a new issue with this exception at https://github.com/themaplelab/swan/issues/new.
at ca.ualberta.maple.swan.parser.SILParser.parseError(SILParser.scala:239)
at ca.ualberta.maple.swan.parser.SILParser.parseIdentifier(SILParser.scala:2284)
at ca.ualberta.maple.swan.parser.SILParser.parseBlock(SILParser.scala:339)
at ca.ualberta.maple.swan.parser.SILParser.$anonfun$parseFunction$3(SILParser.scala:332)
at ca.ualberta.maple.swan.parser.SILParser.parseMany(SILParser.scala:173)
at ca.ualberta.maple.swan.parser.SILParser.parseNilOrMany(SILParser.scala:163)
at ca.ualberta.maple.swan.parser.SILParser.parseFunction(SILParser.scala:332)
at ca.ualberta.maple.swan.parser.SILParser.parseModule(SILParser.scala:260)
at ca.ualberta.maple.swan.drivers.Driver.runner(Driver.scala:580)
at ca.ualberta.maple.swan.drivers.Driver.ca$ualberta$maple$swan$drivers$Driver$$go$1(Driver.scala:355)
at ca.ualberta.maple.swan.drivers.Driver.$anonfun$runActual$2(Driver.scala:362)
at ca.ualberta.maple.swan.drivers.Driver.$anonfun$runActual$2$adapted(Driver.scala:353)
at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)
at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)
at scala.collection.AbstractIterable.foreach(Iterable.scala:919)
at ca.ualberta.maple.swan.drivers.Driver.runActual(Driver.scala:353)
at ca.ualberta.maple.swan.drivers.Driver.run(Driver.scala:318)
at picocli.CommandLine.executeUserObject(CommandLine.java:1939)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
at picocli.CommandLine.execute(CommandLine.java:2078)
at ca.ualberta.maple.swan.drivers.Driver$.main(Driver.scala:166)
at ca.ualberta.maple.swan.drivers.Driver.main(Driver.scala)
Testing recursion
โ FAILED
[main] Parsing test.swift.sil
ca.ualberta.maple.swan.parser.Error: swan-dir/test.swift.sil:81:1: identifier expected
[%0: escape! v** => %r.v**, escape! v**.c*.v** => %r.v**.c*.v**]
^
Please create a new issue with this exception at https://github.com/themaplelab/swan/issues/new.
at ca.ualberta.maple.swan.parser.SILParser.parseError(SILParser.scala:239)
at ca.ualberta.maple.swan.parser.SILParser.parseIdentifier(SILParser.scala:2284)
at ca.ualberta.maple.swan.parser.SILParser.parseBlock(SILParser.scala:339)
at ca.ualberta.maple.swan.parser.SILParser.$anonfun$parseFunction$3(SILParser.scala:332)
at ca.ualberta.maple.swan.parser.SILParser.parseMany(SILParser.scala:173)
at ca.ualberta.maple.swan.parser.SILParser.parseNilOrMany(SILParser.scala:163)
at ca.ualberta.maple.swan.parser.SILParser.parseFunction(SILParser.scala:332)
at ca.ualberta.maple.swan.parser.SILParser.parseModule(SILParser.scala:260)
at ca.ualberta.maple.swan.drivers.Driver.runner(Driver.scala:580)
at ca.ualberta.maple.swan.drivers.Driver.ca$ualberta$maple$swan$drivers$Driver$$go$1(Driver.scala:355)
at ca.ualberta.maple.swan.drivers.Driver.$anonfun$runActual$2(Driver.scala:362)
at ca.ualberta.maple.swan.drivers.Driver.$anonfun$runActual$2$adapted(Driver.scala:353)
at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)
at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)
at scala.collection.AbstractIterable.foreach(Iterable.scala:919)
at ca.ualberta.maple.swan.drivers.Driver.runActual(Driver.scala:353)
at ca.ualberta.maple.swan.drivers.Driver.run(Driver.scala:318)
at picocli.CommandLine.executeUserObject(CommandLine.java:1939)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
at picocli.CommandLine.execute(CommandLine.java:2078)
at ca.ualberta.maple.swan.drivers.Driver$.main(Driver.scala:166)
at ca.ualberta.maple.swan.drivers.Driver.main(Driver.scala)
All of the old unused Wiki pages need to be archived.
The .so
/.dylib
that ca.maple.swan.translator
generates needs to be loaded here. I have tried using build.gradle
, and using the -D
flag, but I am unable to make it work.
The translator runs successfully but gives no output
in /Users/gojeffcho/Swift-Clean/swift-source/swift/tools/swift-remoteast-test/CMakeLists.txt:
$ENV{JAVA_HOME}/jre/lib/server/libjvm.dylib is for Mac (dynamic library) and does not work on Ubuntu
$ENV{JAVA_HOME}/jre/lib/amd64/server/libjvm.so works for Ubuntu (hard-coding it manually on Ubuntu builds at the moment)
SOLVE: Need a way to automatically detect host system and use the appropriate file.
@Leeleo3x I've upgraded to the latest Swift to get rid of the mess of build errors we have been running into for the past couple of weeks or so. That upgrade thankfully resolved those build issues. However, I'm now getting the following build error for swift-wala itself after running gradlew assemble
. It seems that the build does not know where LLVM is located, but I haven't really changed anything else, and I made sure that gradle.properties contains the correct paths per the build instructions.
Any ideas?
> Task :swift-wala-translator:externalBuildSwiftWalaSharedLibrary FAILED
CMake Error at /home/karim/workspace/swift-source/swift/cmake/modules/SwiftSharedCMakeConfig.cmake:16 (find_package):
-- Configuring incomplete, errors occurred!
Could not find a package configuration file provided by "LLVM" with any of
See also "/home/karim/workspace/swift-source/swan/com.ibm.wala.cast.swift/swift-wala-translator/build/external-build/swiftWala/linux_x86-64/CMakeFiles/CMakeOutput.log".
the following names:
LLVMConfig.cmake
llvm-config.cmake
Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set
"LLVM_DIR" to a directory containing one of the above files. If "LLVM"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
/home/karim/workspace/swift-source/swift/cmake/modules/SwiftSharedCMakeConfig.cmake:201 (swift_common_standalone_build_config_llvm)
cmake/modules/SwiftWalaSharedCMakeConfig.cmake:17 (swift_common_standalone_build_config)
CMakeLists.txt:11 (include)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':swift-wala-translator:externalBuildSwiftWalaSharedLibrary'.
> Process 'command 'cmake'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.9/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 0s
3 actionable tasks: 1 executed, 2 up-to-date
In WALASupport/CMakeLists.txt, there is a link to $ENV{JAVA_HOME}/include/darwin without checking the OS. This may potentially be a problem on Ubuntu.
@tiganov please update the README file to fix its title. SWAN means Swift Analysis and not Swift WALA :)
swift/tools/driver/CMakeLists.txt contains hardcoded path "/usr/libexec/java_home", which does not exist on ubuntu. Possible fix:
set_property(TARGET swift APPEND_STRING PROPERTY
LINK_FLAGS " $ENV{WALA_HOME}/com.ibm.wala.cast/target/classes/libcast.so -L$ENV{JAVA_HOME}/jre/lib/amd64/server/ -ljvm -rpath $ENV{JAVA_HOME}/jre/lib/amd64/server/")
The FrontendObserver has changed. I thought that we could simply call CompilerInstance.takeSILModule()
when configuredCompiler(...)
is called, but I then realized that the CompilerInstance does not yet contain the SILModule
at that point.
I don't think there is a way for us to get the SILModule
without having to change the Frontend ourselves, which would require forking the Swift repo, and that is not ideal.
I have submitted a post on the Swift forums.
Files affected:
Issue:
Coordinate a time to conference Julian with the new students.
Hi, I encountered this error today and the log
ca.ualberta.maple.swan.parser.Error: swan-dir/FileName. FileName:50:55: Failed to parse source info
%1 = alloc_stack $FileName, let, name "self", implicit, loc "patht":13:12, scope 1 // users: %8, %2, %46, %47
at ca.ualberta.maple.swan.parser.SILParser.parseError(SILParser.scala:239)
at ca.ualberta.maple.swan.parser.SILParser.parseSourceInfo(SILParser.scala:2651)
at ca.ualberta.maple.swan.parser.SILParser.parseInstructionDef(SILParser.scala:367)
at ca.ualberta.maple.swan.parser.SILParser.parseInstructionDefs(SILParser.scala:349)
at ca.ualberta.maple.swan.parser.SILParser.parseBlock(SILParser.scala:339)
at ca.ualberta.maple.swan.parser.SILParser.$anonfun$parseFunction$3(SILParser.scala:329)
at ca.ualberta.maple.swan.parser.SILParser.parseMany(SILParser.scala:173)
at ca.ualberta.maple.swan.parser.SILParser.parseNilOrMany(SILParser.scala:163)
at ca.ualberta.maple.swan.parser.SILParser.parseFunction(SILParser.scala:329)
at ca.ualberta.maple.swan.parser.SILParser.parseModule(SILParser.scala:260)
at ca.ualberta.maple.swan.drivers.Driver.runner(Driver.scala:587)
at ca.ualberta.maple.swan.drivers.Driver.ca$ualberta$maple$swan$drivers$Driver$$go$1(Driver.scala:366)
at ca.ualberta.maple.swan.drivers.Driver.$anonfun$runActual$2(Driver.scala:373)
at ca.ualberta.maple.swan.drivers.Driver.$anonfun$runActual$2$adapted(Driver.scala:364)
at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)
at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)
at scala.collection.AbstractIterable.foreach(Iterable.scala:919)
at ca.ualberta.maple.swan.drivers.Driver.runActual(Driver.scala:364)
at ca.ualberta.maple.swan.drivers.Driver.run(Driver.scala:329)
at picocli.CommandLine.executeUserObject(CommandLine.java:1939)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
at picocli.CommandLine.execute(CommandLine.java:2078)
at ca.ualberta.maple.swan.drivers.Driver$.main(Driver.scala:177)
at ca.ualberta.maple.swan.drivers.Driver.main(Driver.scala)
As stated in the how to apply the license these fields must be filled out.
https://www.apache.org/licenses/LICENSE-2.0#apply
Line 189 in ced0882
Hi there.
Repo with reproduce https://github.com/nekrich/swan-bug
When trying to execute driver, I got this:
[main] Parsing TestSwan.TestSwan.sil
ca.ualberta.maple.swan.parser.Error: swan-dir/TestSwan.TestSwan.sil:13:207: } expected
sil_scope 3 { loc "/path/ViewController.swift":13:17 parent @$s8TestSwan14ViewControllerC11viewDidLoadyyF : $@convention(method) (@guaranteed ViewController) -> () inlined_at 2 }
^
I was actually facing another issue and created a sample in order to reproduce ๐
, but got stuck.
My original issue:
ca.ualberta.maple.swan.parser.Error: swan-dir/AlgoliaSearchClient.AlgoliaSearchClient.sil:124:30: SWAN doesn't have parsing support for the increment_profiler_counter instruction.
Please file an issue at https://github.com/themaplelab/swan/issues/new
with this message and your project's code/SIL (if possible).
SWAN doesn't support SIL instructions that its authors have never or rarely encountered
or, for instance, new SIL instructions that have been recently added.
increment_profiler_counter 0, "/path/EnvironmentViewController.swift:$s9DebugTool25EnvironmentViewControllerC15currentEnvLabel33_07F122308C50CACA33EE1A89E0E429B7LLSo11NSTextFieldCvpfi", num_counters 1, hash 0, loc "/path/EnvironmentViewController.swift":12:47, scope 1 // id: %0
^
Please create a new issue with this exception at https://github.com/themaplelab/swan/issues/new.
I'm using Xcode 15.0.1.
Any tips on how to fix it on my side ๐?
I went through the translator, but I am confused about a few things.
NodeMap
needed? It seems to be used in findAndRemoveCAstNode
and for unique situations where a node must be removed. But I need a deeper explanation.findAndRemoveCAstNode
used for?&&
and ||
removed in getOperatorCAstType
? Are these simply not needed? SourceUpon dumping SIL of an Xcode project or a Swift file, an anomaly occurs.
In the context of Swift files, a SIL (Swift Intermediate Language) file is generated within the "lib" directory. To execute the analysis, this SIL file needs to be manually moved to the "swan-dir" directory.
However, when dealing with the Xcode project, the expected SIL dump is not found within the "lib" folder.
@mmroz @Leeleo3x any ideas?
Following the instructions in the README file on a Ubuntu machine, I got the following error after executing ./utils/build-script -d
when it starts compiling compiler-rt
:
[2686/2692] Performing configure step for 'compiler-rt'
-- The C compiler identification is Clang 5.0.0
-- The CXX compiler identification is Clang 5.0.0
-- The ASM compiler identification is Clang
-- Found assembler: /home/karim/swift-source/build/Ninja-DebugAssert/llvm-linux-x86_64/./bin/clang
-- Check for working C compiler: /home/karim/swift-source/build/Ninja-DebugAssert/llvm-linux-x86_64/./bin/clang
-- Check for working C compiler: /home/karim/swift-source/build/Ninja-DebugAssert/llvm-linux-x86_64/./bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/karim/swift-source/build/Ninja-DebugAssert/llvm-linux-x86_64/./bin/clang++
-- Check for working CXX compiler: /home/karim/swift-source/build/Ninja-DebugAssert/llvm-linux-x86_64/./bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for unwind.h
-- Looking for unwind.h - found
-- Found PythonInterp: /usr/bin/python2.7 (found version "2.7.15")
-- Performing Test COMPILER_RT_HAS_FPIC_FLAG
-- Performing Test COMPILER_RT_HAS_FPIC_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FPIE_FLAG
-- Performing Test COMPILER_RT_HAS_FPIE_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FNO_BUILTIN_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_BUILTIN_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG
-- Performing Test COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FUNWIND_TABLES_FLAG
-- Performing Test COMPILER_RT_HAS_FUNWIND_TABLES_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FNO_STACK_PROTECTOR_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_STACK_PROTECTOR_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FNO_SANITIZE_SAFE_STACK_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_SANITIZE_SAFE_STACK_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG
-- Performing Test COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FRTTI_FLAG
-- Performing Test COMPILER_RT_HAS_FRTTI_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FNO_RTTI_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_RTTI_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FFREESTANDING_FLAG
-- Performing Test COMPILER_RT_HAS_FFREESTANDING_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG - Success
-- Performing Test COMPILER_RT_HAS_STD_CXX11_FLAG
-- Performing Test COMPILER_RT_HAS_STD_CXX11_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC
-- Performing Test COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC - Success
-- Performing Test COMPILER_RT_HAS_FNO_LTO_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_LTO_FLAG - Success
-- Performing Test COMPILER_RT_HAS_MSSE3_FLAG
-- Performing Test COMPILER_RT_HAS_MSSE3_FLAG - Success
-- Performing Test COMPILER_RT_HAS_MSSE4_2_FLAG
-- Performing Test COMPILER_RT_HAS_MSSE4_2_FLAG - Success
-- Performing Test COMPILER_RT_HAS_SYSROOT_FLAG
-- Performing Test COMPILER_RT_HAS_SYSROOT_FLAG - Success
-- Performing Test COMPILER_RT_HAS_MCRC_FLAG
-- Performing Test COMPILER_RT_HAS_MCRC_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_FVISIBILITY_INLINES_HIDDEN_FLAG
-- Performing Test COMPILER_RT_HAS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
-- Performing Test COMPILER_RT_HAS_GR_FLAG
-- Performing Test COMPILER_RT_HAS_GR_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_GS_FLAG
-- Performing Test COMPILER_RT_HAS_GS_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_MT_FLAG
-- Performing Test COMPILER_RT_HAS_MT_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_Oy_FLAG
-- Performing Test COMPILER_RT_HAS_Oy_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG
-- Performing Test COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG - Success
-- Performing Test COMPILER_RT_HAS_G_FLAG
-- Performing Test COMPILER_RT_HAS_G_FLAG - Success
-- Performing Test COMPILER_RT_HAS_Zi_FLAG
-- Performing Test COMPILER_RT_HAS_Zi_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WALL_FLAG
-- Performing Test COMPILER_RT_HAS_WALL_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WERROR_FLAG
-- Performing Test COMPILER_RT_HAS_WERROR_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG
-- Performing Test COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG
-- Performing Test COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WC99_EXTENSIONS_FLAG
-- Performing Test COMPILER_RT_HAS_WC99_EXTENSIONS_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WGNU_FLAG
-- Performing Test COMPILER_RT_HAS_WGNU_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WNON_VIRTUAL_DTOR_FLAG
-- Performing Test COMPILER_RT_HAS_WNON_VIRTUAL_DTOR_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG
-- Performing Test COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG
-- Performing Test COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG
-- Performing Test COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG - Success
-- Performing Test COMPILER_RT_HAS_W4_FLAG
-- Performing Test COMPILER_RT_HAS_W4_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WX_FLAG
-- Performing Test COMPILER_RT_HAS_WX_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WD4146_FLAG
-- Performing Test COMPILER_RT_HAS_WD4146_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WD4291_FLAG
-- Performing Test COMPILER_RT_HAS_WD4291_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WD4221_FLAG
-- Performing Test COMPILER_RT_HAS_WD4221_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WD4391_FLAG
-- Performing Test COMPILER_RT_HAS_WD4391_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WD4722_FLAG
-- Performing Test COMPILER_RT_HAS_WD4722_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WD4800_FLAG
-- Performing Test COMPILER_RT_HAS_WD4800_FLAG - Failed
-- Looking for __func__
-- Looking for __func__ - found
-- Looking for fopen in c
-- Looking for fopen in c - found
-- Looking for dlopen in dl
-- Looking for dlopen in dl - found
-- Looking for shm_open in rt
-- Looking for shm_open in rt - found
-- Looking for pow in m
-- Looking for pow in m - found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Looking for __cxa_throw in stdc++
-- Looking for __cxa_throw in stdc++ - found
-- Looking for __i686__
-- Looking for __i686__ - not found
-- Looking for __i386__
-- Looking for __i386__ - not found
-- Compiler-RT supported architectures: x86_64
-- Looking for rpc/xdr.h
-- Looking for rpc/xdr.h - found
-- Looking for tirpc/rpc/xdr.h
-- Looking for tirpc/rpc/xdr.h - not found
-- Performing Test COMPILER_RT_HAS_STD_C11_FLAG
-- Performing Test COMPILER_RT_HAS_STD_C11_FLAG - Success
-- Performing Test COMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG
-- Performing Test COMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG - Success
-- Performing Test COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG
-- Performing Test COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FREESTANDING_FLAG
-- Performing Test COMPILER_RT_HAS_FREESTANDING_FLAG - Success
-- Performing Test COMPILER_RT_HAS_XRAY_COMPILER_FLAG
-- Performing Test COMPILER_RT_HAS_XRAY_COMPILER_FLAG - Success
-- Performing Test COMPILER_RT_HAS_ATOMIC_KEYWORD
-- Performing Test COMPILER_RT_HAS_ATOMIC_KEYWORD - Success
-- Builtin supported architectures: x86_64
CMake Error at lib/msan/tests/CMakeLists.txt:88 (msan_compile):
msan_compile Macro invoked with incorrect arguments for macro named:
msan_compile
Call Stack (most recent call first):
lib/msan/tests/CMakeLists.txt:134 (add_msan_tests_for_arch)
-- Performing Test COMPILER_RT_TARGET_HAS_ATOMICS
-- Performing Test COMPILER_RT_TARGET_HAS_ATOMICS - Success
-- Performing Test COMPILER_RT_TARGET_HAS_FCNTL_LCK
-- Performing Test COMPILER_RT_TARGET_HAS_FCNTL_LCK - Success
-- Performing Test HAS_THREAD_LOCAL
-- Performing Test HAS_THREAD_LOCAL - Success
-- Linker detection: GNU ld
-- Linker detection: GNU ld
-- Builtin supported architectures: x86_64
-- Configuring incomplete, errors occurred!
See also "/home/karim/swift-source/build/Ninja-DebugAssert/llvm-linux-x86_64/tools/clang/runtime/compiler-rt-bins/CMakeFiles/CMakeOutput.log".
See also "/home/karim/swift-source/build/Ninja-DebugAssert/llvm-linux-x86_64/tools/clang/runtime/compiler-rt-bins/CMakeFiles/CMakeError.log".
FAILED: tools/clang/runtime/compiler-rt-stamps/compiler-rt-configure
cd /home/karim/swift-source/build/Ninja-DebugAssert/llvm-linux-x86_64/tools/clang/runtime/compiler-rt-bins && /usr/bin/cmake -DCMAKE_C_COMPILER=/home/karim/swift-source/build/Ninja-DebugAssert/llvm-linux-x86_64/./bin/clang -DCMAKE_CXX_COMPILER=/home/karim/swift-source/build/Ninja-DebugAssert/llvm-linux-x86_64/./bin/clang++ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja -DLLVM_CONFIG_PATH=/home/karim/swift-source/build/Ninja-DebugAssert/llvm-linux-x86_64/./bin/llvm-config -DLLVM_LIT_ARGS=-sv -DCOMPILER_RT_OUTPUT_DIR=/home/karim/swift-source/build/Ninja-DebugAssert/llvm-linux-x86_64/./lib/clang/5.0.0 -DCOMPILER_RT_EXEC_OUTPUT_DIR=/home/karim/swift-source/build/Ninja-DebugAssert/llvm-linux-x86_64/./bin -DCOMPILER_RT_INSTALL_PATH:STRING=lib/clang/5.0.0 -DCOMPILER_RT_INCLUDE_TESTS=ON -DCMAKE_INSTALL_PREFIX=/usr -DLLVM_LIBDIR_SUFFIX= -DCMAKE_OSX_DEPLOYMENT_TARGET= -DCMAKE_OSX_SYSROOT:PATH= -DCOMPILER_RT_PREFIX=/home/karim/swift-source/build/Ninja-DebugAssert/llvm-linux-x86_64/projects/compiler-rt -DCOMPILER_RT_SRC_ROOT=/home/karim/swift-source/llvm/projects/compiler-rt -GNinja /home/karim/swift-source/llvm/projects/compiler-rt && /usr/bin/cmake -E touch /home/karim/swift-source/build/Ninja-DebugAssert/llvm-linux-x86_64/tools/clang/runtime/compiler-rt-stamps//compiler-rt-configure
[2688/2692] Linking CXX executable bin/c-index-test
ninja: build stopped: subcommand failed.
./utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting
I thought we've fixed this error ages ago.
A small quality/style is needed. I was inspired by apple/swift
repo's code quality, so I figure we should also make sure we have some guidelines we follow.
.gitignore
styling (example).#pragma once
to ifndef
..cpp
files. The header and implementation may need different descriptions.#include
s to be alphabetical.More tasks to come...
We should also find a style guide for the Java code.
Coordinate a conference call for Lydia and Chen to explain the current progress and structures.
Once issue #37 has been resolved, the build should probably be modified to only output one .so
/.dylib
. Unless there is a particular reason for doing this.
Currently, there are 4 output files in /ca.maple.swan.translator/build/
, each about ~500MB on macOS.
./install/swiftWala/osx_x86-64/lib/libswiftWala.dylib
./external-build/swiftWala/osx_x86-64/lib/libswiftWala.dylib
./libs/swiftWala/shared/libswiftWala.dylib
./libs/swiftWala/static/libswiftWala.dylib
Edit: ideally this would be /ca.maple.swan.translator/build/libs/swiftWala/shared/
since its OS independent and currently this path is relied upon. by SwiftToCAstTranslator.java
.
the JNI wrapper for WALA has a different extension on Ubuntu. It should be libcast.so for Ubuntu and libcast.jnilib for macOS.
affected files: swift/tools/swift-remoteast-test/CMakeLists.txt
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.