diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-02-17 19:04:48 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-17 16:04:48 -0800 |
| commit | 360d4f7a17a066cc878cdb2c558464bfdeaa3418 (patch) | |
| tree | 99133158bb0cae370c70ce060344ca1acbe958a2 /tests/diagnostics | |
| parent | e59aee131b6d51236613bc374cfa2d5f3b54efe1 (diff) | |
More #line improvements (#1713)
* #include an absolute path didn't work - because paths were taken to always be relative.
* WIP: First pass in supporting output of line error information.
* Add support for lexing to better be able to indicate SourceLocation information.
* Fix lexer usage in DiagnosticSink in C++ extractor.
* Update diagnostics tests to have line location info.
* Fixed test expected output that now have source location information in them.
* Better handling of tab.
* Fix test expected results for tabbing change.
* DiagnosticLexer -> DiagnosticSink::SourceLocationLexer
Added line continuation tests.
* Fix typo.
* Added String::appendRepeatedChar
* Change to rerun tests.
* Added source locations to IR dumping.
* Output column for IR dump source loc.
* Add support for closing brace location to AST.
Use closing brace location in lowering when adding return void.
* Set the source location through SourceLoc - simplifies identifying if current loc is valid.
* Copy terminator sloc.
* Test for improved #line handling.
* Made writer the last parameter for dumpIR.
Small improvements to comments.
* Disable sloc output on dump IR by default.
* Fix issue with #line and inlining.
* Fix for output with improved #line output.
* Small comment change - mainly to kick off TC build.
Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'tests/diagnostics')
| -rw-r--r-- | tests/diagnostics/local-line.slang | 45 | ||||
| -rw-r--r-- | tests/diagnostics/local-line.slang.expected | 1 |
2 files changed, 46 insertions, 0 deletions
diff --git a/tests/diagnostics/local-line.slang b/tests/diagnostics/local-line.slang new file mode 100644 index 000000000..1cdeba7e4 --- /dev/null +++ b/tests/diagnostics/local-line.slang @@ -0,0 +1,45 @@ +//TEST:SIMPLE_LINE:-entry computeMain -target spirv -stage compute +//TEST:SIMPLE_LINE:-entry computeMain -target dxil -profile cs_6_0 +//TEST:SIMPLE_LINE:-entry computeMain -target dxbc -stage compute +//TEST:SIMPLE_LINE:-entry computeMain -target dll -stage compute +//TEST:SIMPLE_LINE:-entry computeMain -target ptx -stage compute + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<int> outputBuffer; + +int doThing(int a, int b) +{ + while (b >= 0) + { + a + += + a; + } + + return a; +} + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + int a = dispatchThreadID.x; + int b = dispatchThreadID.y; + int c = dispatchThreadID.z; + int d = a + b * c; + int e = d + c / 2; + + for (int i = 0; i < b; ++i) + { + if (e > 10 && i & 2) + { + a += b; b -= c; c += c; d = d + e + a; e = a; + } + else + { + a = e; b = c + c; d += d + __SyntaxError(); e = doThing(e, dispatchThreadID.x); + + } + } + + outputBuffer[dispatchThreadID.x] = a + b + c + d + e; +} diff --git a/tests/diagnostics/local-line.slang.expected b/tests/diagnostics/local-line.slang.expected new file mode 100644 index 000000000..a2720097d --- /dev/null +++ b/tests/diagnostics/local-line.slang.expected @@ -0,0 +1 @@ +39 |
