Skip to content

Commit

Permalink
Improve error messages (#215)
Browse files Browse the repository at this point in the history
* Start improving error messages

* Enable new error messages

* Update test refs

* Completely replace old error messages with new ones

* Update test refs

* Add line numbers to error messages
  • Loading branch information
marcauberer authored Oct 11, 2022
1 parent 4f55427 commit d0433c4
Show file tree
Hide file tree
Showing 124 changed files with 1,034 additions and 592 deletions.
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

0 comments on commit d0433c4

Please sign in to comment.