diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-05-07 15:00:33 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-07 15:00:33 -0400 |
| commit | c16abd4fe1bda5ebcd50dbb22f30c6be43bb885f (patch) | |
| tree | d127a9bd48708d909ab36efdd2ac0d9956f7541b /source/slang/slang-diagnostics.cpp | |
| parent | 9245460adaf739c5a4d85f7f477b65fcd07d595b (diff) | |
Enhanced C++ extractor (#1340)
* Extractor builds without any reference to syntax (as it will be helping to produce this!).
* Change macros to include the super class.
* Added indexOf(const UnownedSubString& in) to UnownedSubString.
Refactored extractor
* Output a macro for each type with the extracted info - can be used during injection in class
* Simplify the header file - as can get super type and last from macro now
* Store the 'origin' of a definition
* Some small tidy ups to the extractor.
* Improve comments on the extractor options.
* Made CPPExtractor own SourceOrigins
* Small fixes around SourceOrigin.
* Small tidy up around macroOrign
Diffstat (limited to 'source/slang/slang-diagnostics.cpp')
| -rw-r--r-- | source/slang/slang-diagnostics.cpp | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/source/slang/slang-diagnostics.cpp b/source/slang/slang-diagnostics.cpp index bb8b63540..615312661 100644 --- a/source/slang/slang-diagnostics.cpp +++ b/source/slang/slang-diagnostics.cpp @@ -1,9 +1,7 @@ // slang-diagnostics.cpp #include "slang-diagnostics.h" -#include "slang-compiler.h" #include "slang-name.h" -#include "slang-syntax.h" #include <assert.h> @@ -65,34 +63,6 @@ void printDiagnosticArg(StringBuilder& sb, Name* name) } -void printDiagnosticArg(StringBuilder& sb, Decl* decl) -{ - sb << getText(decl->getName()); -} - -void printDiagnosticArg(StringBuilder& sb, Type* type) -{ - sb << type->ToString(); -} - -void printDiagnosticArg(StringBuilder& sb, Val* val) -{ - sb << val->ToString(); -} - -void printDiagnosticArg(StringBuilder& sb, TypeExp const& type) -{ - sb << type.type->ToString(); -} - -void printDiagnosticArg(StringBuilder& sb, QualType const& type) -{ - if (type.type) - sb << type.type->ToString(); - else - sb << "<null>"; -} - void printDiagnosticArg(StringBuilder& sb, TokenType tokenType) { sb << TokenTypeToString(tokenType); @@ -103,50 +73,11 @@ void printDiagnosticArg(StringBuilder& sb, Token const& token) sb << token.Content; } -void printDiagnosticArg(StringBuilder& sb, CodeGenTarget val) -{ - switch( val ) - { - default: - sb << "<unknown>"; - break; - -#define CASE(TAG, STR) case CodeGenTarget::TAG: sb << STR; break - CASE(GLSL, "glsl"); - CASE(HLSL, "hlsl"); - CASE(SPIRV, "spirv"); - CASE(SPIRVAssembly, "spriv-assembly"); - CASE(DXBytecode, "dxbc"); - CASE(DXBytecodeAssembly, "dxbc-assembly"); - CASE(DXIL, "dxil"); - CASE(DXILAssembly, "dxil-assembly"); -#undef CASE - } -} - - - -SourceLoc const& getDiagnosticPos(SyntaxNode const* syntax) -{ - return syntax->loc; -} - SourceLoc const& getDiagnosticPos(Token const& token) { return token.loc; } -SourceLoc const& getDiagnosticPos(TypeExp const& typeExp) -{ - return typeExp.exp->loc; -} - -SourceLoc const& getDiagnosticPos(IRInst* inst) -{ - return inst->sourceLoc; -} - - // Take the format string for a diagnostic message, along with its arguments, and turn it into a static void formatDiagnosticMessage(StringBuilder& sb, char const* format, int argCount, DiagnosticArg const* const* args) { |
