Commit graph

157 commits

Author SHA1 Message Date
Tim Schumacher
874c7bba28 LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
Tim Schumacher
606a3982f3 LibCore: Move Stream-based file into the Core namespace 2023-02-13 00:50:07 +00:00
Tim Schumacher
a96339b72b LibCore: Move Stream-based sockets into the Core namespace 2023-02-13 00:50:07 +00:00
Tim Schumacher
d43a7eae54 LibCore: Rename File to DeprecatedFile
As usual, this removes many unused includes and moves used includes
further down the chain.
2023-02-13 00:50:07 +00:00
Ben Wiederhake
8a331d4fa0 Everywhere: Move AK/Debug.h include to using files or remove 2023-01-02 20:27:20 -05:00
Karol Kosek
4784ad66b2 HackStudio: Port to Core::Stream::File :^) 2022-12-20 10:58:54 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
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-06 08:54:33 +01:00
Tim Schumacher
ce2f1b845f Everywhere: Mark dependencies of most targets as PRIVATE
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-01 14:49:09 +00:00
Tim Schumacher
7834e26ddb Everywhere: Explicitly link all binaries against the LibC target
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-11-01 14:49:09 +00:00
Linus Groh
643faa1144 Everywhere: Fix two inconsistent serenity_lib() output names
- No underscores between word boundaries, i.e. `languageserver` and not
  `language_server` for LibLanguageServer
- All lowercase, i.e. `coredump` and not `Coredump` for LibCoredump
2022-07-03 22:59:13 +02:00
Itamar
b35293d945 LibCodeComprehension: Re-organize code comprehension related code
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-05-21 18:15:58 +02:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Itamar
9cd27d1e15 LanguageServers/Cpp: Add SemanticType::PreprocessorMacro
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-31 19:10:15 +02:00
Itamar
53c6c36fba LibGUI: Add AutocompleteProvider::TokenInfo::type_to_string() 2022-03-31 19:10:15 +02:00
Brian Gianforcaro
67fc81a65a Everywhere: Move cpp-tests under /home/anon/Tests 2022-03-20 22:20:59 +01:00
Itamar
7fa7c7d63c LanguageServers/Cpp: Make find declaration of enums work 2022-02-27 21:42:05 +01:00
Itamar
4335bd453d LanguageServers/Cpp: Make find declaration for a declaration node work
The CppComprehensionEngine can now find the declaration of a
declaration node of type class/namespace/function.
2022-02-27 21:42:05 +01:00
Itamar
fa384c8171 LanguageServers/Cpp: Make go to declaration of a namespace work
The CppComprehensionEngine can now find the declaration of a reference
to a namespace.
2022-02-27 21:42:05 +01:00
Itamar
3a71748e5d Userland: Rename IPC ClientConnection => ConnectionFromClient
This was done with CLion's automatic rename feature and with:
find . -name ClientConnection.h
    | rename 's/ClientConnection\.h/ConnectionFromClient.h/'

find . -name ClientConnection.cpp
    | rename 's/ClientConnection\.cpp/ConnectionFromClient.cpp/'
2022-02-25 22:35:12 +01:00
Itamar
cdfc530a99 LanguageServers/Cpp: Fix "complete_includes" language server test
Previously the target result was only a partial completion.
2022-02-23 00:48:44 +00:00
Itamar
7b42abccf2 LibCpp: Allow qualified names in AST Declaration nodes
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-23 00:48:44 +00:00
Lenny Maiorani
7070713ec8 DevTools: Use default constructors/destructors
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-02-16 07:33:15 -05:00
Itamar
33043f269d HackStudio: Add tokens_info_result() and tokens_info_result() IPC calls
These IPC calls are used in the communication with the language server
to fetch semantic information about the tokens in a code document.
2022-02-09 00:51:31 +01:00
Itamar
76000e9137 LanguageServers/Cpp: Make find_declaration_of() more flexible
Previously, find_declaration_of() only worked for AST nodes of type
Identifier. It now also works for declaration node, member variables
and function parameters.
2022-02-09 00:51:31 +01:00
Itamar
605becb28b LibCpp: Update regressions tests results
The LibCpp regression tests results have to be updated after tweaking
the token end position calculation logic of some token types.
2022-02-09 00:51:31 +01:00
sin-ack
2e1bbcb0fa LibCore+LibIPC+Everywhere: Return Stream::LocalSocket from LocalServer
This change unfortunately cannot be atomically made without a single
commit changing everything.

Most of the important changes are in LibIPC/Connection.cpp,
LibIPC/ServerConnection.cpp and LibCore/LocalServer.cpp.

The notable changes are:
- IPCCompiler now generates the decode and decode_message functions such
  that they take a Core::Stream::LocalSocket instead of the socket fd.
- IPC::Decoder now uses the receive_fd method of LocalSocket instead of
  doing system calls directly on the fd.
- IPC::ConnectionBase and related classes now use the Stream API
  functions.
- IPC::ServerConnection no longer constructs the socket itself; instead,
  a convenience macro, IPC_CLIENT_CONNECTION, is used in place of
  C_OBJECT and will generate a static try_create factory function for
  the ServerConnection subclass. The subclass is now responsible for
  passing the socket constructed in this function to its
  ServerConnection base; the socket is passed as the first argument to
  the constructor (as a NonnullOwnPtr<Core::Stream::LocalServer>) before
  any other arguments.
- The functionality regarding taking over sockets from SystemServer has
  been moved to LibIPC/SystemServerTakeover.cpp. The Core::LocalSocket
  implementation of this functionality hasn't been deleted due to my
  intention of removing this class in the near future and to reduce
  noise on this (already quite noisy) PR.
2022-01-15 13:29:48 +03:30
Ben Wiederhake
8b8cd18482 HackStudio: Avoid unnecessary copies in CodeComprehensionEngine 2022-01-01 15:40:39 +01:00
Andreas Kling
971b3645ef LibIPC: Add IPC::take_over_accepted_client_from_system_server<Client>()
This is an encapsulation of the common work done by all of our
single-client IPC servers on startup:

    1. Create a Core::LocalSocket, taking over an accepted fd.
    2. Create an application-specific ClientConnection object,
       wrapping the socket.

It's not a huge change in terms of lines saved, but I do feel that it
improves expressiveness. :^)
2021-12-06 19:22:16 +01:00
Sam Atkins
d2024f04bd Userland: Cast unused BackgroundAction::construct() results to void
User code does not need to keep this alive, so casting to void is safe.
But maybe a bit weird.
2021-12-05 15:31:03 +01:00
Itamar
c3c2fe153b LibCpp: Add "ignore invalid statements" option to Preprocessor
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-12-03 15:38:21 +01:00
Brian Gianforcaro
cf4fa936be Everywhere: Use default execpromises argument for Core::System::pledge 2021-11-28 08:04:57 +01:00
Andreas Kling
c1a3968c66 LibCore: Make LocalSocket takeover mechanism return ErrorOr<T> 2021-11-23 11:33:36 +01:00
Andreas Kling
21a5fb0fa2 LibCore+LibSystem: Move syscall wrappers from LibSystem to LibCore
With this change, System::foo() becomes Core::System::foo().

Since LibCore builds on other systems than SerenityOS, we now have to
make sure that wrappers work with just a standard C library underneath.
2021-11-23 11:33:36 +01:00
Andreas Kling
c2b90bab9f LanguageServers/Shell: Port to LibMain :^) 2021-11-23 11:33:36 +01:00
Andreas Kling
54155f8c64 LanguageServers/Cpp: Port to LibMain :^) 2021-11-23 11:33:36 +01:00
Andreas Kling
8b1108e485 Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Ben Wiederhake
3796d417e0 Demos+DevTools+Games: Fix visibility of Object-derivative constructors
Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.
2021-11-02 22:56:53 +01:00
thislooksfun
8462234208 HackStudio: Don't close autocomplete after applying #include directories 2021-11-02 17:53:22 +01:00
thislooksfun
0be3f5b4ae HackStudio: Append a / when completing a directory 2021-11-02 17:53:22 +01:00
thislooksfun
8b3a2cdad9 HackStudio: Correctly handle nested paths
Previously the paths were concatinated incorrectly, so triggering
the autocomplete on `#include "foo/bar"` would never work. Now it
does. :^)
2021-11-02 17:53:22 +01:00
thislooksfun
a6a71869d7 HackStudio: Handle autocomplete inside #include's <> and "" 2021-11-02 17:53:22 +01:00
thislooksfun
f7f9d09e72 LibGUI: Remove GUI::AutocompleteProvider::Entry::kind
The only code using it was removed in the previous commit.
2021-11-02 17:53:22 +01:00
thislooksfun
f699dbdc3f HackStudio+LibGUI: Handle #include quotes and brackets in the engine
Previously we had a special case in order to auto-append quotes or
angle brackets to #include statements. After the previous commit this
is no longer necessary.
2021-11-02 17:53:22 +01:00
Nico Weber
6c9bc18a79 Userland: Fix typos 2021-10-01 01:18:52 +01:00
thankyouverycool
92fffc3abc LibGUI: Rename CallOnChange => AllowCallback and implement elsewhere
This is a helpful option to prevent unwanted side effects, distinguish
between user and programmatic input, etc. Sliders and SpinBoxes were
implementing it idiosyncratically, so let's generalize the API and
give Buttons and TextEditors the same ability.
2021-09-22 21:35:42 +02:00
Andreas Kling
eaf88cc78a AK: Rename create<T> => make_ref_counted<T>
And also try_create<T> => try_make_ref_counted<T>.

A global "create" was a bit much. The new name matches make<T> better,
which we've used for making single-owner objects since forever.
2021-09-03 02:36:09 +02:00
Itamar
9ae98bc81b LibCpp: Handle circular imports gracefully
This patch prevents CppComprehensionEngine from endlessly looping when
there's a circular #include in the code.

We now keep track of the set of currently processed files, and will not
re-process a file if it already exists in this set.
When we're done with processing a file it is removed from this set.

The pragma once directive is not yet implemented, but regardless a
mechanism that prevents #include loops even in the absence of
pragma once is desired.
2021-08-19 17:20:37 +02:00
Itamar
8505fcb8ae LibCpp: Understand preprocessor macro definition and invocation
The preprocessor now understands when a function-like macro is defined,
and can also parse calls to such macros.

The actual evaluation of function-like macros will be done in a
separate commit.
2021-08-14 12:40:55 +02:00
Itamar
9da9398bf0 LibCpp: Do macro substitution in the preprocessor instead of the parser
After this change, the parser is completely separated from preprocessor
concepts.
2021-08-07 21:24:11 +02:00
Itamar
0c4dc00f01 LibCpp: Import definitions from headers while processing
When the preprocessor encounters an #include statement it now adds
the preprocessor definitions that exist in the included header to its
own set of definitions.

We previously only aggregated the definitions from headers after
processing the source, which was less correct. (For example, there
could be an #ifdef that depends on a definition from another header).
2021-08-07 21:24:11 +02:00