summaryrefslogtreecommitdiffstats
path: root/source/slang/options.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-06-29 11:50:55 -0700
committerTim Foley <tfoley@nvidia.com>2017-06-29 13:18:32 -0700
commitf4d900dfb64d95f121dd8565dd269be061ef8509 (patch)
treee9aad4ff9a6111d828ae2e4b217dc8145cda56dd /source/slang/options.cpp
parent16613ed981fc5dc38966f5108e85b1aee36ef92f (diff)
Overhaul `RefPtr` and `String`
- `RefPtr` no longer tries to have distinct cases for interal-vs-external reference counts. Instead we always require an internal reference count. - Types the used `RefPtr` but weren't `RefObject` were made to inherit `RefObject` - The `ReferenceCounted` base class was removed, so that only `RefObject` remains - Implicit conversion from `RefPtr<T>` to `T*` added - This created some complicates for other types that relied on implicit conversions, so this isn't a net cleanup right now - The main type that got messed up by the above was `String`, which previously held a `RefPtr<char, ...>`. This change thus *also* includes a major overhaul of `String`: - `String` now holds all its data via indirection, using a `StringRepresentation` that is a `RefObject`. This object holds a length, capacity, and directly stores the character data in its allocation. This means that `sizeof(String)==sizeof(void*)` - It is now possible to directly mutate a `String` by appending to its representation (we just need to ensure it has a reference count of `1`, possibly by cloning it). This means that `StringBuilder` is now basically just an idomatic use of `String` - A couple operations that just return sub-ranges of a `String` now return `StringSlice` to avoid allocation when it isn't needed. This required more work. - Indices into strings changed from `int` to `UInt` (which is pointer-sized). This had a bunch of follow-on changes because the value `-1` sometimes needs to be special-cased in code that uses indices. Further cleanups are probably needed here.
Diffstat (limited to 'source/slang/options.cpp')
-rw-r--r--source/slang/options.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/slang/options.cpp b/source/slang/options.cpp
index 62b45e025..cced0f0ff 100644
--- a/source/slang/options.cpp
+++ b/source/slang/options.cpp
@@ -238,7 +238,7 @@ struct OptionsParser
}
else
{
- fprintf(stderr, "unknown code generation target '%S'\n", name.ToWString());
+ fprintf(stderr, "unknown code generation target '%S'\n", name.ToWString().begin());
exit(1);
}
@@ -302,7 +302,7 @@ struct OptionsParser
else if (name == "glslang") { passThrough = SLANG_PASS_THROUGH_GLSLANG; }
else
{
- fprintf(stderr, "unknown pass-through target '%S'\n", name.ToWString());
+ fprintf(stderr, "unknown pass-through target '%S'\n", name.ToWString().begin());
exit(1);
}
@@ -387,7 +387,7 @@ struct OptionsParser
}
else
{
- fprintf(stderr, "unknown command-line option '%S'\n", argStr.ToWString());
+ fprintf(stderr, "unknown command-line option '%S'\n", argStr.ToWString().begin());
// TODO: print a usage message
exit(1);
}