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

Improve error messages #215

Merged
merged 6 commits into from
Oct 11, 2022
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
78 changes: 3 additions & 75 deletions .github/workflows/ci-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build-linux:
name: C++ CI - Linux
name: C++ CI
runs-on: ubuntu-22.04

steps:
Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:
uses: actions/cache@v3
with:
path: /home/runner/work/spice/llvm
key: llvm-15.0.2-linux-x64
key: llvm-15.0.2

- name: Setup LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -101,76 +101,4 @@ jobs:
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t ${{ secrets.CODECOV_TOKEN }}

build-windows:
name: C++ CI - Windows
runs-on: windows-2022

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11

- name: Setup latest GCC
shell: pwsh
run: |
choco uninstall mingw --all-versions
choco uninstall llvm --all-versions
Remove-Item -Recurse -Force C:/Strawberry
echo "Uninstalling done."
Invoke-WebRequest https://chillibits.com/files/gh/mingw64_12_2_0.7z -OutFile mingw64.7z
echo "Downloading done."
7z x mingw64.7z -oC:\mingw64
echo "Unpacking done."
Copy-Item -Path C:\mingw64\mingw64\bin\mingw32-make.exe -Destination C:\mingw64\mingw64\bin\make.exe
echo "All done."

- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@master

- name: Cache LLVM
id: cache-llvm
uses: actions/cache@v3
with:
path: D:/a/spice/spice/llvm
key: llvm-15.0.2-win-x86

- name: Setup LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
git clone --depth 1 --branch llvmorg-15.0.2 https://github.com/llvm/llvm-project.git llvm
setx /M PATH "%PATH%;C:\mingw64\mingw64\bin"
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
echo "Adding MinGW to path done."
mkdir ./llvm/build
cd ./llvm/build
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CXX_FLAGS_RELEASE="-O2" -GNinja -Wno-dev -Wattributes ../llvm
cmake --build . -j 4

- name: Download Libs
run: .\setup-libs.bat

- name: Build Test target
env:
LLVM_DIR: D:/a/spice/spice/llvm/build/lib/cmake/llvm
run: |
setx /M PATH "%PATH%;C:\mingw64\mingw64\bin"
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
echo "Adding MinGW to path done."
mkdir ./bin
cd ./bin
cmake -GNinja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DSPICE_LINK_STATIC=ON -DSPICE_VERSION="${{ steps.get_version.outputs.version }}" -DSPICE_BUILT_BY="ghactions" -DCMAKE_CXX_FLAGS_RELEASE="-O2" ..
cmake --build . --target spice -j 4

- name: Run Test target
env:
SPICE_STD_DIR: C:\Users\runneradmin\spice\spice\std
run: |
cd .\bin\test
.\spicetest false
./codecov -t ${{ secrets.CODECOV_TOKEN }}
5 changes: 1 addition & 4 deletions media/test-project/os-test.spice
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
f<int> main() {
string test = "Tested";
printf("%s\n", test.getRaw());
printf("%d\n", test.getLength());
printf("%d\n", test.getCapacity());
int test = "string";
}

/*f<int> main() {
Expand Down
370 changes: 175 additions & 195 deletions src/analyzer/AnalyzerVisitor.cpp

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/analyzer/AnalyzerVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ class AnalyzerVisitor : public AstVisitor {

// Private methods
SymbolType insertAnonStringStructSymbol(const AstNode *declNode);
void insertDestructorCall(const CodeLoc &codeLoc, SymbolTableEntry *varEntry);
void insertDestructorCall(const AstNode *node, SymbolTableEntry *varEntry);
SymbolType initExtStruct(SymbolTable *sourceScope, const std::string &structScopePrefix, const std::string &structName,
const std::vector<SymbolType> &templateTypes, const CodeLoc &codeLoc);
const std::vector<SymbolType> &templateTypes, const AstNode *node);
SymbolType initExtGlobal(SymbolTable *sourceScope, const std::string &globalScopePrefix, const std::string &globalName,
const CodeLoc &codeLoc);
const AstNode *node);
};
Loading