LibRegex: Annotate classes with export macro for hidden visibility

This fix demos the gradual opt-in migration process libraries can
take to switch to explicit symbol exports via the FOO_API macros.
This commit is contained in:
ayeteadoe 2025-05-09 18:35:19 -07:00 committed by Andrew Kaster
commit a3754a7bf1
Notes: github-actions[bot] 2025-05-12 09:23:32 +00:00
6 changed files with 15 additions and 13 deletions

View file

@ -10,5 +10,5 @@ if(SERENITYOS)
list(APPEND SOURCES C/Regex.cpp)
endif()
serenity_lib(LibRegex regex)
serenity_lib(LibRegex regex EXPLICIT_SYMBOL_EXPORT)
target_link_libraries(LibRegex PRIVATE LibUnicode)

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/Types.h>
#include <LibRegex/Export.h>
namespace regex {
struct CompareTypeAndValuePair;

View file

@ -142,7 +142,7 @@ struct CompareTypeAndValuePair {
class OpCode;
struct StringTable {
struct REGEX_API StringTable {
StringTable();
~StringTable();
StringTable(StringTable const&) = default;
@ -176,7 +176,7 @@ struct StringTable {
HashMap<ByteCodeValueType, FlyString> m_inverse_table;
};
class ByteCode : public DisjointChunks<ByteCodeValueType> {
class REGEX_API ByteCode : public DisjointChunks<ByteCodeValueType> {
using Base = DisjointChunks<ByteCodeValueType>;
public:

View file

@ -9,6 +9,7 @@
#include <AK/Forward.h>
#include <AK/GenericLexer.h>
#include <AK/StringView.h>
#include <LibRegex/Forward.h>
namespace regex {
@ -64,7 +65,7 @@ private:
StringView m_value {};
};
class Lexer : public GenericLexer {
class REGEX_API Lexer : public GenericLexer {
public:
Lexer();
explicit Lexer(StringView source);

View file

@ -32,7 +32,7 @@ struct Block {
static constexpr size_t const c_max_recursion = 5000;
struct RegexResult final {
struct REGEX_API RegexResult final {
bool success { false };
size_t count { 0 };
Vector<Match> matches;
@ -44,10 +44,10 @@ struct RegexResult final {
};
template<class Parser>
class Regex;
class REGEX_API Regex;
template<class Parser>
class Matcher final {
class REGEX_API Matcher final {
public:
Matcher(Regex<Parser> const* pattern, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {})
@ -78,7 +78,7 @@ private:
};
template<class Parser>
class Regex final {
class REGEX_API Regex final {
public:
ByteString pattern_value;
regex::Parser::Result parser_result;

View file

@ -50,7 +50,7 @@ struct NamedCaptureGroup {
size_t alternative_id;
};
class Parser {
class REGEX_API Parser {
public:
struct Result {
ByteCode bytecode;
@ -137,7 +137,7 @@ protected:
ParserState m_parser_state;
};
class AbstractPosixParser : public Parser {
class REGEX_API AbstractPosixParser : public Parser {
protected:
explicit AbstractPosixParser(Lexer& lexer)
: Parser(lexer)
@ -152,7 +152,7 @@ protected:
ALWAYS_INLINE bool parse_bracket_expression(Vector<CompareTypeAndValuePair>&, size_t&);
};
class PosixBasicParser final : public AbstractPosixParser {
class REGEX_API PosixBasicParser final : public AbstractPosixParser {
public:
explicit PosixBasicParser(Lexer& lexer)
: AbstractPosixParser(lexer)
@ -181,7 +181,7 @@ private:
size_t m_current_capture_group_depth { 0 };
};
class PosixExtendedParser final : public AbstractPosixParser {
class REGEX_API PosixExtendedParser final : public AbstractPosixParser {
constexpr static auto default_options = static_cast<PosixFlags>(AllFlags::SingleLine) | static_cast<PosixFlags>(AllFlags::Internal_ConsiderNewline);
public:
@ -208,7 +208,7 @@ private:
ALWAYS_INLINE bool parse_repetition_symbol(ByteCode&, size_t&);
};
class ECMA262Parser final : public Parser {
class REGEX_API ECMA262Parser final : public Parser {
constexpr static ECMAScriptOptions default_options = static_cast<ECMAScriptFlags>(AllFlags::Internal_ConsiderNewline);
public: