From ca1f93a916ce6b984cba402c8d3710988f2b618f Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 27 Mar 2023 13:57:42 -0400 Subject: Using SourceMap for location output (#2736) * #include an absolute path didn't work - because paths were taken to always be relative. * WIP using SourceMap with SourceManager. * Add a test to check obfuscation map is working. --------- Co-authored-by: Yong He --- tests/serialization/obfuscated-check-loc.slang | 36 ++++++++++++++++++++++ .../obfuscated-check-loc.slang.expected | 6 ++++ 2 files changed, 42 insertions(+) create mode 100644 tests/serialization/obfuscated-check-loc.slang create mode 100644 tests/serialization/obfuscated-check-loc.slang.expected (limited to 'tests/serialization') diff --git a/tests/serialization/obfuscated-check-loc.slang b/tests/serialization/obfuscated-check-loc.slang new file mode 100644 index 000000000..8575a2650 --- /dev/null +++ b/tests/serialization/obfuscated-check-loc.slang @@ -0,0 +1,36 @@ +//TEST:SIMPLE:-target cpp -stage compute -entry computeMain -obfuscate -source-map -line-directive-mode none + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +#if 0 +[DllExport] +String getString() +{ + return "Hello!"; +} +#endif + +int silly(int a) +{ + int t = 0; + [ForceUnroll(10)] + while ( a > 0) + { + t = t + t + a; + } + return t; +} + +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + int x = int(dispatchThreadID.x); + + //String v = getString(); + int v = silly(x); + + outputBuffer[x] = v; + +} + diff --git a/tests/serialization/obfuscated-check-loc.slang.expected b/tests/serialization/obfuscated-check-loc.slang.expected new file mode 100644 index 000000000..0743b437a --- /dev/null +++ b/tests/serialization/obfuscated-check-loc.slang.expected @@ -0,0 +1,6 @@ +result code = -1 +standard error = { +tests/serialization/obfuscated-check-loc.slang(18): error 40020: loop does not terminate within the limited number of iterations, unrolling is aborted. +} +standard output = { +} -- cgit v1.2.3