diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-23 15:39:40 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-23 15:39:58 +0200 |
| commit | edcec15a728f2f8e4930dc0565f56a274c3fc0c1 (patch) | |
| tree | a16f71a0a6bd1f16e25f3866b3c56a3ce7551a26 /dev | |
| parent | 2eed4954c762bb8050e40798c3d9f1d3998324d1 (diff) | |
bug: figuring out why a segfault occurs after we exit main.
ubsan:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:926:60: runtime error: applying non-zero offset 18446744073709551536 to null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:926:60 in
drv: SIGSEGV: Please report this on the GitHub issues page
why?
- A bogus iterator gets passed to ::destroy inside the method.
next:
- Debug that inside lldb.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev')
| -rw-r--r-- | dev/LibCompiler/Backend/32x0.h | 4 | ||||
| -rw-r--r-- | dev/LibCompiler/Backend/64x0.h | 9 | ||||
| -rw-r--r-- | dev/LibCompiler/Frontend.h | 14 | ||||
| -rw-r--r-- | dev/LibCompiler/src/Asm/Assembler64x0.cc | 2 | ||||
| -rw-r--r-- | dev/LibCompiler/src/Asm/AssemblerARM64.cc | 2 | ||||
| -rw-r--r-- | dev/LibCompiler/src/Asm/AssemblerPowerPC.cc | 2 | ||||
| -rw-r--r-- | dev/LibCompiler/src/Cl/CCompiler64x0.cc | 2 | ||||
| -rw-r--r-- | dev/LibCompiler/src/Cl/CCompilerARM64.cc | 2 | ||||
| -rw-r--r-- | dev/LibCompiler/src/Cl/CCompilerPower64.cc | 2 | ||||
| -rw-r--r-- | dev/LibCompiler/src/Cl/CPlusPlusCompilerAMD64.cc | 155 |
10 files changed, 94 insertions, 100 deletions
diff --git a/dev/LibCompiler/Backend/32x0.h b/dev/LibCompiler/Backend/32x0.h index 240d885..2857a38 100644 --- a/dev/LibCompiler/Backend/32x0.h +++ b/dev/LibCompiler/Backend/32x0.h @@ -43,9 +43,9 @@ inline std::vector<CpuCode32x0> kOpcodes32x0 = { LC_ASM_OPCODE("psh", 0b0111011, 0b000, kAsmImmediate) // push to sp (2C) LC_ASM_OPCODE("pop", 0b0111011, 0b001, kAsmImmediate) // pop from sp. (1C) LC_ASM_OPCODE("lea", 0b0111011, 0b010, - kAsmImmediate) // setup stack and call, store address to CR (1C). + kAsmImmediate) // setup stack and call, store address to CR (1C). LC_ASM_OPCODE("ret", 0b0111011, 0b110, - kAsmImmediate) // return from procedure (2C). + kAsmImmediate) // return from procedure (2C). LC_ASM_OPCODE("uc", 0b0111111, 0b000, kAsmSyscall) // user call (1C) LC_ASM_OPCODE("kc", 0b0111111, 0b001, kAsmSyscall) // kernel call (1C) LC_ASM_OPCODE("int", 0b0111111, 0b010, kAsmSyscall) // raise interrupt (1C) diff --git a/dev/LibCompiler/Backend/64x0.h b/dev/LibCompiler/Backend/64x0.h index f7f0332..c68b6cf 100644 --- a/dev/LibCompiler/Backend/64x0.h +++ b/dev/LibCompiler/Backend/64x0.h @@ -35,9 +35,9 @@ inline std::vector<CpuOpcode64x0> kOpcodes64x0 = { LC_ASM_OPCODE("nop", 0b0000000, 0b0000000, kAsmNoArgs) // no-operation. LC_ASM_OPCODE("np", 0b0000000, 0b0000000, kAsmNoArgs) // no-operation. LC_ASM_OPCODE("jlr", 0b1110011, 0b0000111, - kAsmJump) // jump to linked return register + kAsmJump) // jump to linked return register LC_ASM_OPCODE("jrl", 0b1110011, 0b0001111, - kAsmJump) // jump from return register. + kAsmJump) // jump from return register. LC_ASM_OPCODE("mv", 0b0100011, 0b101, kAsmRegToReg) LC_ASM_OPCODE( "bg", 0b1100111, 0b111, kAsmRegToReg) LC_ASM_OPCODE("bl", 0b1100111, 0b011, kAsmRegToReg) LC_ASM_OPCODE("beq", 0b1100111, 0b000, kAsmRegToReg) @@ -52,9 +52,8 @@ inline std::vector<CpuOpcode64x0> kOpcodes64x0 = { LC_ASM_OPCODE("add", 0b0101011, 0b100, kAsmImmediate) LC_ASM_OPCODE("sub", 0b0101011, 0b101, kAsmImmediate) // add/sub with carry flag - LC_ASM_OPCODE("addc", 0b0101011, 0b110, kAsmImmediate) - LC_ASM_OPCODE("subc", 0b0101011, 0b111, kAsmImmediate) - LC_ASM_OPCODE("sc", 0b1110011, 0b00, kAsmSyscall)}; + LC_ASM_OPCODE("addc", 0b0101011, 0b110, kAsmImmediate) LC_ASM_OPCODE( + "subc", 0b0101011, 0b111, kAsmImmediate) LC_ASM_OPCODE("sc", 0b1110011, 0b00, kAsmSyscall)}; // \brief 64x0 register prefix // example: r32, r0 diff --git a/dev/LibCompiler/Frontend.h b/dev/LibCompiler/Frontend.h index 119b9fe..9f6fe71 100644 --- a/dev/LibCompiler/Frontend.h +++ b/dev/LibCompiler/Frontend.h @@ -81,22 +81,22 @@ enum KeywordKind { /// \brief Compiler keyword information struct. struct CompilerKeyword { - std::string keyword_name; - KeywordKind keyword_kind = kKeywordKindInvalid; + std::string keyword_name{""}; + KeywordKind keyword_kind{kKeywordKindInvalid}; }; + struct SyntaxLeafList final { struct SyntaxLeaf final { Int32 fUserType; + #ifdef LC_USE_STRUCTS CompilerKeyword fUserData; #else std::string fUserData; #endif - SyntaxLeaf() = default; - - std::string fUserValue; - struct SyntaxLeaf* fNext; + std::string fUserValue{""}; + struct SyntaxLeaf* fNext{nullptr}; }; std::vector<SyntaxLeaf> fLeafList; @@ -111,7 +111,7 @@ struct SyntaxLeafList final { /// \param haystack base string /// \param needle the string we search for. /// \return if we found it or not. -bool find_word(std::string haystack, std::string needle) noexcept; +BOOL find_word(std::string haystack, std::string needle) noexcept; /// find a word within strict conditions and returns a range of it. /// \param haystack diff --git a/dev/LibCompiler/src/Asm/Assembler64x0.cc b/dev/LibCompiler/src/Asm/Assembler64x0.cc index 9d07d99..8c1adb5 100644 --- a/dev/LibCompiler/src/Asm/Assembler64x0.cc +++ b/dev/LibCompiler/src/Asm/Assembler64x0.cc @@ -21,9 +21,9 @@ #include <LibCompiler/AE.h> #include <LibCompiler/Backend/64x0.h> -#include <LibCompiler/Util/LCClUtils.h> #include <LibCompiler/Frontend.h> #include <LibCompiler/PEF.h> +#include <LibCompiler/Util/LCClUtils.h> #include <algorithm> #include <filesystem> #include <fstream> diff --git a/dev/LibCompiler/src/Asm/AssemblerARM64.cc b/dev/LibCompiler/src/Asm/AssemblerARM64.cc index 5014a73..59df5a7 100644 --- a/dev/LibCompiler/src/Asm/AssemblerARM64.cc +++ b/dev/LibCompiler/src/Asm/AssemblerARM64.cc @@ -19,10 +19,10 @@ #include <LibCompiler/AE.h> #include <LibCompiler/Backend/Aarch64.h> -#include <LibCompiler/Util/LCAsmUtils.h> #include <LibCompiler/ErrorID.h> #include <LibCompiler/Frontend.h> #include <LibCompiler/PEF.h> +#include <LibCompiler/Util/LCAsmUtils.h> #include <LibCompiler/Version.h> #include <algorithm> #include <filesystem> diff --git a/dev/LibCompiler/src/Asm/AssemblerPowerPC.cc b/dev/LibCompiler/src/Asm/AssemblerPowerPC.cc index 1502205..bf7f115 100644 --- a/dev/LibCompiler/src/Asm/AssemblerPowerPC.cc +++ b/dev/LibCompiler/src/Asm/AssemblerPowerPC.cc @@ -19,10 +19,10 @@ #include <LibCompiler/AE.h> #include <LibCompiler/Backend/PowerPC.h> -#include <LibCompiler/Util/LCAsmUtils.h> #include <LibCompiler/ErrorID.h> #include <LibCompiler/Frontend.h> #include <LibCompiler/PEF.h> +#include <LibCompiler/Util/LCAsmUtils.h> #include <LibCompiler/Version.h> #include <algorithm> #include <filesystem> diff --git a/dev/LibCompiler/src/Cl/CCompiler64x0.cc b/dev/LibCompiler/src/Cl/CCompiler64x0.cc index 6ca680b..2d37227 100644 --- a/dev/LibCompiler/src/Cl/CCompiler64x0.cc +++ b/dev/LibCompiler/src/Cl/CCompiler64x0.cc @@ -11,9 +11,9 @@ /// TODO: none #include <LibCompiler/Backend/64x0.h> -#include <LibCompiler/Util/LCClUtils.h> #include <LibCompiler/Frontend.h> #include <LibCompiler/UUID.h> +#include <LibCompiler/Util/LCClUtils.h> #include <cstdio> #include <fstream> #include <iostream> diff --git a/dev/LibCompiler/src/Cl/CCompilerARM64.cc b/dev/LibCompiler/src/Cl/CCompilerARM64.cc index 9abdc8c..093c818 100644 --- a/dev/LibCompiler/src/Cl/CCompilerARM64.cc +++ b/dev/LibCompiler/src/Cl/CCompilerARM64.cc @@ -11,9 +11,9 @@ /// TODO: none #include <LibCompiler/Backend/Aarch64.h> -#include <LibCompiler/Util/LCClUtils.h> #include <LibCompiler/Frontend.h> #include <LibCompiler/UUID.h> +#include <LibCompiler/Util/LCClUtils.h> #include <cstdio> #include <fstream> #include <iostream> diff --git a/dev/LibCompiler/src/Cl/CCompilerPower64.cc b/dev/LibCompiler/src/Cl/CCompilerPower64.cc index d3dd81e..e0081f7 100644 --- a/dev/LibCompiler/src/Cl/CCompilerPower64.cc +++ b/dev/LibCompiler/src/Cl/CCompilerPower64.cc @@ -8,9 +8,9 @@ */ #include <LibCompiler/Backend/PowerPC.h> -#include <LibCompiler/Util/LCClUtils.h> #include <LibCompiler/Frontend.h> #include <LibCompiler/UUID.h> +#include <LibCompiler/Util/LCClUtils.h> #include <cstdio> #include <fstream> #include <iostream> diff --git a/dev/LibCompiler/src/Cl/CPlusPlusCompilerAMD64.cc b/dev/LibCompiler/src/Cl/CPlusPlusCompilerAMD64.cc index c99508c..993b7f6 100644 --- a/dev/LibCompiler/src/Cl/CPlusPlusCompilerAMD64.cc +++ b/dev/LibCompiler/src/Cl/CPlusPlusCompilerAMD64.cc @@ -17,9 +17,9 @@ // extern_segment, @autodelete { ... }, fn foo() -> auto { ... } #include <LibCompiler/Backend/X64.h> -#include <LibCompiler/Util/LCClUtils.h> #include <LibCompiler/Frontend.h> #include <LibCompiler/UUID.h> +#include <LibCompiler/Util/LCClUtils.h> /* NeKernel C++ Compiler Driver */ /* This is part of the LibCompiler. */ @@ -452,6 +452,8 @@ Boolean CompilerFrontendCPlusPlus::Compile(std::string text, std::string file) { std::string instr = "mov "; + std::vector<std::string> newVars; + if (typeFound && keyword.first.keyword_kind != LibCompiler::KeywordKind::kKeywordKindVariableInc && keyword.first.keyword_kind != LibCompiler::KeywordKind::kKeywordKindVariableDec) { @@ -538,12 +540,15 @@ Boolean CompilerFrontendCPlusPlus::Compile(std::string text, std::string file) { } } - kRegisterMap.push_back(varName); + newVars.push_back(varName); break; } - if (kKeywords[keyword.second - 1].keyword_kind == LibCompiler::kKeywordKindType || + kRegisterMap.insert(kRegisterMap.end(), newVars.begin(), newVars.end()); + + if (keyword.second > 0 && + kKeywords[keyword.second - 1].keyword_kind == LibCompiler::kKeywordKindType || kKeywords[keyword.second - 1].keyword_kind == LibCompiler::kKeywordKindTypePtr) { syntax_tree.fUserValue = "\n"; continue; @@ -621,6 +626,7 @@ Boolean CompilerFrontendCPlusPlus::Compile(std::string text, std::string file) { break; } + newVars.push_back(varName); break; } @@ -628,6 +634,8 @@ Boolean CompilerFrontendCPlusPlus::Compile(std::string text, std::string file) { Detail::print_error("Variable not declared: " + varName, file); } + kRegisterMap.insert(kRegisterMap.end(), newVars.begin(), newVars.end()); + break; } case LibCompiler::KeywordKind::kKeywordKindReturn: { @@ -727,7 +735,7 @@ class AssemblyCPlusPlusInterface final LC_ASSEMBLY_INTERFACE { std::ofstream out_fp(dest); - std::ifstream src_fp = std::ifstream(src); + std::ifstream src_fp = std::ifstream(src + ".pp"); std::string line_source; @@ -761,79 +769,65 @@ class AssemblyCPlusPlusInterface final LC_ASSEMBLY_INTERFACE { LIBCOMPILER_MODULE(CompilerCPlusPlusAMD64) { Boolean skip = false; - kKeywords.push_back({.keyword_name = "if", .keyword_kind = LibCompiler::kKeywordKindIf}); - kKeywords.push_back({.keyword_name = "else", .keyword_kind = LibCompiler::kKeywordKindElse}); - kKeywords.push_back({.keyword_name = "else if", .keyword_kind = LibCompiler::kKeywordKindElseIf}); - - kKeywords.push_back({.keyword_name = "class", .keyword_kind = LibCompiler::kKeywordKindClass}); - kKeywords.push_back({.keyword_name = "struct", .keyword_kind = LibCompiler::kKeywordKindClass}); - kKeywords.push_back( - {.keyword_name = "namespace", .keyword_kind = LibCompiler::kKeywordKindNamespace}); - kKeywords.push_back( - {.keyword_name = "typedef", .keyword_kind = LibCompiler::kKeywordKindTypedef}); - kKeywords.push_back({.keyword_name = "using", .keyword_kind = LibCompiler::kKeywordKindTypedef}); - kKeywords.push_back({.keyword_name = "{", .keyword_kind = LibCompiler::kKeywordKindBodyStart}); - kKeywords.push_back({.keyword_name = "}", .keyword_kind = LibCompiler::kKeywordKindBodyEnd}); - kKeywords.push_back({.keyword_name = "auto", .keyword_kind = LibCompiler::kKeywordKindVariable}); - kKeywords.push_back({.keyword_name = "int", .keyword_kind = LibCompiler::kKeywordKindType}); - kKeywords.push_back({.keyword_name = "bool", .keyword_kind = LibCompiler::kKeywordKindType}); - kKeywords.push_back({.keyword_name = "unsigned", .keyword_kind = LibCompiler::kKeywordKindType}); - kKeywords.push_back({.keyword_name = "short", .keyword_kind = LibCompiler::kKeywordKindType}); - kKeywords.push_back({.keyword_name = "char", .keyword_kind = LibCompiler::kKeywordKindType}); - kKeywords.push_back({.keyword_name = "long", .keyword_kind = LibCompiler::kKeywordKindType}); - kKeywords.push_back({.keyword_name = "float", .keyword_kind = LibCompiler::kKeywordKindType}); - kKeywords.push_back({.keyword_name = "double", .keyword_kind = LibCompiler::kKeywordKindType}); - kKeywords.push_back({.keyword_name = "void", .keyword_kind = LibCompiler::kKeywordKindType}); - - kKeywords.push_back( - {.keyword_name = "auto*", .keyword_kind = LibCompiler::kKeywordKindVariablePtr}); - kKeywords.push_back({.keyword_name = "int*", .keyword_kind = LibCompiler::kKeywordKindTypePtr}); - kKeywords.push_back({.keyword_name = "bool*", .keyword_kind = LibCompiler::kKeywordKindTypePtr}); - kKeywords.push_back( - {.keyword_name = "unsigned*", .keyword_kind = LibCompiler::kKeywordKindTypePtr}); - kKeywords.push_back({.keyword_name = "short*", .keyword_kind = LibCompiler::kKeywordKindTypePtr}); - kKeywords.push_back({.keyword_name = "char*", .keyword_kind = LibCompiler::kKeywordKindTypePtr}); - kKeywords.push_back({.keyword_name = "long*", .keyword_kind = LibCompiler::kKeywordKindTypePtr}); - kKeywords.push_back({.keyword_name = "float*", .keyword_kind = LibCompiler::kKeywordKindTypePtr}); - kKeywords.push_back( - {.keyword_name = "double*", .keyword_kind = LibCompiler::kKeywordKindTypePtr}); - kKeywords.push_back({.keyword_name = "void*", .keyword_kind = LibCompiler::kKeywordKindTypePtr}); - - kKeywords.push_back( - {.keyword_name = "(", .keyword_kind = LibCompiler::kKeywordKindFunctionStart}); - kKeywords.push_back({.keyword_name = ")", .keyword_kind = LibCompiler::kKeywordKindFunctionEnd}); - kKeywords.push_back( - {.keyword_name = "=", .keyword_kind = LibCompiler::kKeywordKindVariableAssign}); - kKeywords.push_back({.keyword_name = "+=", .keyword_kind = LibCompiler::kKeywordKindVariableInc}); - kKeywords.push_back({.keyword_name = "-=", .keyword_kind = LibCompiler::kKeywordKindVariableDec}); - kKeywords.push_back({.keyword_name = "const", .keyword_kind = LibCompiler::kKeywordKindConstant}); - kKeywords.push_back({.keyword_name = "*", .keyword_kind = LibCompiler::kKeywordKindPtr}); - kKeywords.push_back({.keyword_name = "->", .keyword_kind = LibCompiler::kKeywordKindPtrAccess}); - kKeywords.push_back({.keyword_name = ".", .keyword_kind = LibCompiler::kKeywordKindAccess}); - kKeywords.push_back({.keyword_name = ",", .keyword_kind = LibCompiler::kKeywordKindArgSeparator}); - kKeywords.push_back({.keyword_name = ";", .keyword_kind = LibCompiler::kKeywordKindEndInstr}); - kKeywords.push_back({.keyword_name = ":", .keyword_kind = LibCompiler::kKeywordKindSpecifier}); - kKeywords.push_back( - {.keyword_name = "public:", .keyword_kind = LibCompiler::kKeywordKindSpecifier}); - kKeywords.push_back( - {.keyword_name = "private:", .keyword_kind = LibCompiler::kKeywordKindSpecifier}); - kKeywords.push_back( - {.keyword_name = "protected:", .keyword_kind = LibCompiler::kKeywordKindSpecifier}); - kKeywords.push_back( - {.keyword_name = "final", .keyword_kind = LibCompiler::kKeywordKindSpecifier}); - kKeywords.push_back({.keyword_name = "return", .keyword_kind = LibCompiler::kKeywordKindReturn}); - kKeywords.push_back( - {.keyword_name = "/*", .keyword_kind = LibCompiler::kKeywordKindCommentMultiLineStart}); - kKeywords.push_back( - {.keyword_name = "*/", .keyword_kind = LibCompiler::kKeywordKindCommentMultiLineEnd}); - kKeywords.push_back( - {.keyword_name = "//", .keyword_kind = LibCompiler::kKeywordKindCommentInline}); - kKeywords.push_back({.keyword_name = "==", .keyword_kind = LibCompiler::kKeywordKindEq}); - kKeywords.push_back({.keyword_name = "!=", .keyword_kind = LibCompiler::kKeywordKindNotEq}); - kKeywords.push_back({.keyword_name = ">=", .keyword_kind = LibCompiler::kKeywordKindGreaterEq}); - kKeywords.push_back({.keyword_name = "<=", .keyword_kind = LibCompiler::kKeywordKindLessEq}); - - kErrorLimit = 100; + kKeywords.emplace_back("if", LibCompiler::kKeywordKindIf); + kKeywords.emplace_back("else", LibCompiler::kKeywordKindElse); + kKeywords.emplace_back("else if", LibCompiler::kKeywordKindElseIf); + + kKeywords.emplace_back("class", LibCompiler::kKeywordKindClass); + kKeywords.emplace_back("struct", LibCompiler::kKeywordKindClass); + kKeywords.emplace_back("namespace", LibCompiler::kKeywordKindNamespace); + kKeywords.emplace_back("typedef", LibCompiler::kKeywordKindTypedef); + kKeywords.emplace_back("using", LibCompiler::kKeywordKindTypedef); + kKeywords.emplace_back("{", LibCompiler::kKeywordKindBodyStart); + kKeywords.emplace_back("}", LibCompiler::kKeywordKindBodyEnd); + kKeywords.emplace_back("auto", LibCompiler::kKeywordKindVariable); + kKeywords.emplace_back("int", LibCompiler::kKeywordKindType); + kKeywords.emplace_back("bool", LibCompiler::kKeywordKindType); + kKeywords.emplace_back("unsigned", LibCompiler::kKeywordKindType); + kKeywords.emplace_back("short", LibCompiler::kKeywordKindType); + kKeywords.emplace_back("char", LibCompiler::kKeywordKindType); + kKeywords.emplace_back("long", LibCompiler::kKeywordKindType); + kKeywords.emplace_back("float", LibCompiler::kKeywordKindType); + kKeywords.emplace_back("double", LibCompiler::kKeywordKindType); + kKeywords.emplace_back("void", LibCompiler::kKeywordKindType); + + kKeywords.emplace_back("auto*", LibCompiler::kKeywordKindVariablePtr); + kKeywords.emplace_back("int*", LibCompiler::kKeywordKindTypePtr); + kKeywords.emplace_back("bool*", LibCompiler::kKeywordKindTypePtr); + kKeywords.emplace_back("unsigned*", LibCompiler::kKeywordKindTypePtr); + kKeywords.emplace_back("short*", LibCompiler::kKeywordKindTypePtr); + kKeywords.emplace_back("char*", LibCompiler::kKeywordKindTypePtr); + kKeywords.emplace_back("long*", LibCompiler::kKeywordKindTypePtr); + kKeywords.emplace_back("float*", LibCompiler::kKeywordKindTypePtr); + kKeywords.emplace_back("double*", LibCompiler::kKeywordKindTypePtr); + kKeywords.emplace_back("void*", LibCompiler::kKeywordKindTypePtr); + + kKeywords.emplace_back("(", LibCompiler::kKeywordKindFunctionStart); + kKeywords.emplace_back(")", LibCompiler::kKeywordKindFunctionEnd); + kKeywords.emplace_back("=", LibCompiler::kKeywordKindVariableAssign); + kKeywords.emplace_back("+=", LibCompiler::kKeywordKindVariableInc); + kKeywords.emplace_back("-=", LibCompiler::kKeywordKindVariableDec); + kKeywords.emplace_back("const", LibCompiler::kKeywordKindConstant); + kKeywords.emplace_back("*", LibCompiler::kKeywordKindPtr); + kKeywords.emplace_back("->", LibCompiler::kKeywordKindPtrAccess); + kKeywords.emplace_back(".", LibCompiler::kKeywordKindAccess); + kKeywords.emplace_back(",", LibCompiler::kKeywordKindArgSeparator); + kKeywords.emplace_back(";", LibCompiler::kKeywordKindEndInstr); + kKeywords.emplace_back(":", LibCompiler::kKeywordKindSpecifier); + kKeywords.emplace_back("public:", LibCompiler::kKeywordKindSpecifier); + kKeywords.emplace_back("private:", LibCompiler::kKeywordKindSpecifier); + kKeywords.emplace_back("protected:", LibCompiler::kKeywordKindSpecifier); + kKeywords.emplace_back("final", LibCompiler::kKeywordKindSpecifier); + kKeywords.emplace_back("return", LibCompiler::kKeywordKindReturn); + kKeywords.emplace_back("/*", LibCompiler::kKeywordKindCommentMultiLineStart); + kKeywords.emplace_back("*/", LibCompiler::kKeywordKindCommentMultiLineEnd); + kKeywords.emplace_back("//", LibCompiler::kKeywordKindCommentInline); + kKeywords.emplace_back("==", LibCompiler::kKeywordKindEq); + kKeywords.emplace_back("!=", LibCompiler::kKeywordKindNotEq); + kKeywords.emplace_back(">=", LibCompiler::kKeywordKindGreaterEq); + kKeywords.emplace_back("<=", LibCompiler::kKeywordKindLessEq); + + kErrorLimit = 0; kCompilerFrontend = new CompilerFrontendCPlusPlus(); kFactory.Mount(new AssemblyCPlusPlusInterface()); @@ -910,12 +904,13 @@ LIBCOMPILER_MODULE(CompilerCPlusPlusAMD64) { delete kCompilerFrontend; kCompilerFrontend = nullptr; - kRegisterMap.clear(); - kOriginMap.clear(); + kRegisterMap.shrink_to_fit(); + kKeywords.shrink_to_fit(); + kOriginMap.shrink_to_fit(); return LIBCOMPILER_SUCCESS; } // -// Last rev 8-1-24 +// Last rev 23-5-25 // |
