summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCpp
AgeCommit message (Collapse)Author
2023-02-21LibCpp: Make C++ AST (mostly) const-correctAndreas Kling
I cheated and used const_cast to avoid dealing with the strange pattern where we sometimes do a delayed reparenting of an AST node.
2023-02-13LibCore: Rename `File` to `DeprecatedFile`Tim Schumacher
As usual, this removes many unused includes and moves used includes further down the chain.
2023-01-27AK: Remove StringBuilder::build() in favor of to_deprecated_string()Linus Groh
Having an alias function that only wraps another one is silly, and keeping the more obvious name should flush out more uses of deprecated strings. No behavior change.
2023-01-27LibCpp: Remove declarations for non-existent methodsSam Atkins
2023-01-27LibCpp: Parse 'using namespace' declarationsPoseydon42
This gets us a little bit closer to a fully capable C++ parser.
2023-01-09AK+Everywhere: Rename FlyString to DeprecatedFlyStringTimothy Flynn
DeprecatedFlyString relies heavily on DeprecatedString's StringImpl, so let's rename it to A) match the name of DeprecatedString, B) write a new FlyString class that is tied to String.
2022-12-06Everywhere: Rename to_{string => deprecated_string}() where applicableLinus Groh
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-12-03Everywhere: Run clang-formatLinus Groh
2022-11-27LibSyntax: Teach each highlighter about it's comment syntaxKyle Lanmon
2022-11-01Everywhere: Mark dependencies of most targets as PRIVATETim Schumacher
Otherwise, we end up propagating those dependencies into targets that link against that library, which creates unnecessary link-time dependencies. Also included are changes to readd now missing dependencies to tools that actually need them.
2022-11-01Everywhere: Explicitly link all binaries against the LibC targetTim Schumacher
Even though the toolchain implicitly links against -lc, it does not know where it should get LibC from except for the sysroot. In the case of Clang this causes it to pick up the LibC stub instead, which might be slightly outdated and feature missing symbols. This is currently not an issue that manifests because we pass through the dependency on LibC and other libraries by accident, which causes CMake to link against the LibC target (instead of just the library), and thus points the linker at the build output directory. Since we are looking to fix that in the upcoming commits, let's make sure that everything will still be able to find the proper LibC first.
2022-09-19LibCpp: Add .clang-format to disable clang-format for the LibCpp TestsBrian Gianforcaro
We don't format these files, as they might have been intentionally formatted differently from the normal serenity style for testing. So ignore them from our global style, so clang-format doesn't pick them up by accident.
2022-09-17Everywhere: Fix badly-formatted includesBen Wiederhake
2022-07-12Everywhere: Replace single-char StringView op. arguments with charssin-ack
This prevents us from needing a sv suffix, and potentially reduces the need to run generic code for a single character (as contains, starts_with, ends_with etc. for a char will be just a length and equality check). No functional changes.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-06-14LibCpp: Support "FIXME" for commentsFerhat Geçdoğan
2022-05-29Everywhere: Fix a bunch of typosLinus Groh
2022-05-21LibCodeComprehension: Re-organize code comprehension related codeItamar
This moves all code comprehension-related code to a new library, LibCodeComprehension. This also moves some types related to code comprehension tasks (such as autocomplete, find declaration) out of LibGUI and into LibCodeComprehension.
2022-04-17LibCpp: Parse inheritanceItamar
2022-04-09LibGfx: Move other font-related files to LibGfx/Font/Simon Wanner
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-31LanguageServers/Cpp: Add SemanticType::PreprocessorMacroItamar
This adds a new semantic token type, PreprocessorMacro. Calls to preprocessor macros will now be highlighted when semantic highlighting is enabled in Hack Studio.
2022-03-31LibCpp: Fix parsing of macro callsItamar
Previously, macro calls with 0 arguments where incorrectly parsed as calls to a macro with a single argument that doesn't contain any tokens.
2022-03-19LibCpp: Change class_name to use StringView instead of char const*Lenny Maiorani
This helps make the overall codebase consistent. `class_name()` in `Kernel` is always `StringView`, but not elsewhere. Additionally, this results in the `strlen` (which needs to be done when printing or other operations) always being computed at compile-time.
2022-03-10Libraries: Use default constructors/destructors in LibCppLenny Maiorani
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
2022-03-05LibCpp: Don't include parameter type in FunctionType::to_string if nullItamar
The type of a function parameter can be null if we failed to parse it. In such a case, calling to_string() on a FunctionType node used to cause a null dereference. This caused the language server to crash when processing AK/StdLibExtraDetails.h
2022-02-27LanguageServers/Cpp: Make find declaration of enums workItamar
2022-02-27LibCpp: Set end position for the return type node of FunctionType nodesItamar
Previously we didn't set the end position for the return type node of function FunctionType nodes. This caused a VERIFY failure crash when dumping an AST that contains such nodes.
2022-02-23Libraries/LibCpp: Add parser test for out-of-line function definitionsItamar
2022-02-23LibCpp: Allow qualified names in AST Declaration nodesItamar
Previously, the names of declarations where stored as a simple StringView. Because of that, we couldn't parse out-of-line function definitions, which have qualified names. For example, we couldn't parse the following snippet: ``` void MyClass::foo(){} ``` To fix this, we now store the name of a declaration with a ASTNode::Name node, which represents a qualified named.
2022-02-09LibCpp: Add SemanticSyntaxHighlighterItamar
The SemanticSyntaxHighlighter uses TokenInfo results from the language server to provide 'semantic' syntax highlighting, which provides more fin-grained text spans results. For example, the SemanticSyntaxHighlighter can color function calls, member fields references and user-defined types in different colors. With the simple lexer-only syntax highlighter, all of these tokens were given the same text highlighting span type. Since we have to provide immediate highlighting feedback to the user after each edit and before we get the result for the language server, we use a heuristic which computes the diff between the current tokens and the last known tokens with compete semantic information (We use LibDiff for this). This heuristic is not very performant, and starts feeling sluggish with bigger (~200 LOC) files. A possible future improvement would be only computing the diff for tokens in text ranges that have changes since the last commit.
2022-02-09LibCpp: Update regressions tests resultsItamar
The LibCpp regression tests results have to be updated after tweaking the token end position calculation logic of some token types.
2022-02-09LibCpp: Fix lexing of IncludePath tokenItamar
Previously, there was a duplicate IncludePath token in the lexing result.
2022-02-09LibCpp: Add Preprocessor:unprocessed_token()Itamar
2022-02-09LibCpp: Add public Parser::tokens() methodItamar
2022-02-09LibCpp: Fix end position calculation for various AST node typesItamar
Previously, the end position of the Type and Name nodes was incorrect. It was incorrectly set to the start position of the next unconsumed token. This commit adds a previous_token_end() method and uses it to correctly get the end position for these node types.
2022-02-09LibCpp: Fix parent of parameter type nodeItamar
Previously, the parent of a parameter's Type node was incorrectly set to the parent of the Parameter node. We now set the parent of the parameter's Type node to the Parameter node itself.
2022-02-09LibCpp: Fix Declaration::is_member()Itamar
Previously, Declaration::is_member() was just a stub that always returned false. It now works by checking whether the parent ASTNode is a declaration of a struct or a class type.
2022-02-07Userland: Undefine FOR_EACH_TOKEN_TYPE everywherekleines Filmröllchen
This was causing some macro redefinition errors after the headers ended up in the same file through some includes. The simple fix is to undefine the macro after use.
2022-01-25AK: Standardize the behaviour of GenericLexer::consume_until overloadsIdan Horowitz
Before this commit all consume_until overloads aside from the Predicate one would consume (and ignore) the stop char/string, while the Predicate overload would not, in order to keep behaviour consistent, the other overloads no longer consume the stop char/string as well.
2022-01-25AK: Add a consume_until(StringView) overload to GenericLexerIdan Horowitz
This allows us to skip a strlen call.
2021-12-05LibCpp: Cast unused smart-pointer return values to voidSam Atkins
2021-12-03LibCpp: Add "ignore invalid statements" option to PreprocessorItamar
When we run the Preprocessor from the CppComprehensionEngine of the language server, we don't want the preprocessor to crash if it encounters an invalid preprocessor statement (for example, an #endif statement without an accompanying previous #if statement). To achieve this, this commit adds an "ignore_invalid_statements" flag to the preprocessor which is set by the CppComprehensionEngine. Fixes #11064.
2021-11-30LibCpp: Update list of well-known C++ types to match current AKAndreas Kling
2021-11-30LibCpp: Use StringView for the known keywords arrayAndreas Kling
2021-11-29LibCpp: Fix copy paste typo in Parser::match_secondary_expressionBrian Gianforcaro
This was caught by SonarCloud.
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-09-28LibCpp: Remove redundant comparison to Token::Type::PipePipeBrian Gianforcaro
SonarCloud flagged this 'Identical sub-expressions on both sides of operator "||"'. When looking at the git history it looks like it was just a copy / paste mistake that happened when Token::Type::Arrow support was added.
2021-08-21LibCpp: Use lex_iterable() where applicableItamar