Merge remote-tracking branch 'origin/topic/timw/266-namespaces'

Merge adjustments:

- Preserved original `base_type_no_ref` argument type as ::TypeTag
- Removed superfluous #pragma guard around deprecated TableVal ctor
- Clarify NEWS regarding MetaHook{Pre,Post} deprecations
- Simplify some `::zeek::` qualifications to just `zeek::`
- Prefixed FORWARD_DECLARE_NAMESPACED macro with ZEEK_

* origin/topic/timw/266-namespaces:
  Disable some deprecation diagnostics for GCC
  Rename BroType to Type
  Update NEWS
  Review cleanup
  Move Type types to zeek namespace
  Move Flare/Pipe from the bro namespace to zeek::detail
  Move Attr to the zeek::detail namespace
  Move Trigger into the zeek::detail namespace
  Move ID to the zeek::detail namespace
  Move Anon.h into zeek::detail namespace
  Mark all of the aliased classes in plugin/Plugin.h deprecated, and fix all of the plugins that were using them
  Move all of the base plugin classes into the zeek::plugin namespace
  Expr: move all classes into zeek::detail
  Stmt: move Stmt classes into zeek::detail namespace
  Add utility macro for creating namespaced aliases for classes
This commit is contained in:
Jon Siwek 2020-06-11 23:12:02 -07:00
commit d4f3cad7d1
256 changed files with 4277 additions and 3501 deletions

View file

@ -13,53 +13,55 @@
#include "TraverseTypes.h"
template <class T> class IntrusivePtr;
class ID;
class BroType;
class ListVal;
namespace zeek { class Type; }
using BroType [[deprecated("Remove in v4.1. Use zeek::Type instead.")]] = zeek::Type;
ZEEK_FORWARD_DECLARE_NAMESPACED(ID, zeek::detail);
class Scope : public BroObj {
public:
explicit Scope(IntrusivePtr<ID> id,
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> al);
explicit Scope(IntrusivePtr<zeek::detail::ID> id,
std::unique_ptr<std::vector<IntrusivePtr<zeek::detail::Attr>>> al);
const IntrusivePtr<ID>& Find(std::string_view name) const;
const IntrusivePtr<zeek::detail::ID>& Find(std::string_view name) const;
template<typename N>
[[deprecated("Remove in v4.1. Use Find().")]]
ID* Lookup(N&& name) const
zeek::detail::ID* Lookup(N&& name) const
{ return Find(name).get(); }
template<typename N, typename I>
void Insert(N&& name, I&& id) { local[std::forward<N>(name)] = std::forward<I>(id); }
IntrusivePtr<ID> Remove(std::string_view name);
IntrusivePtr<zeek::detail::ID> Remove(std::string_view name);
[[deprecated("Remove in v4.1. Use GetID().")]]
ID* ScopeID() const { return scope_id.get(); }
zeek::detail::ID* ScopeID() const { return scope_id.get(); }
const IntrusivePtr<ID>& GetID() const
const IntrusivePtr<zeek::detail::ID>& GetID() const
{ return scope_id; }
const std::unique_ptr<std::vector<IntrusivePtr<Attr>>>& Attrs() const
const std::unique_ptr<std::vector<IntrusivePtr<zeek::detail::Attr>>>& Attrs() const
{ return attrs; }
[[deprecated("Remove in v4.1. Use GetReturnTrype().")]]
BroType* ReturnType() const { return return_type.get(); }
zeek::Type* ReturnType() const { return return_type.get(); }
const IntrusivePtr<BroType>& GetReturnType() const
const IntrusivePtr<zeek::Type>& GetReturnType() const
{ return return_type; }
size_t Length() const { return local.size(); }
const auto& Vars() { return local; }
IntrusivePtr<ID> GenerateTemporary(const char* name);
IntrusivePtr<zeek::detail::ID> GenerateTemporary(const char* name);
// Returns the list of variables needing initialization, and
// removes it from this Scope.
std::vector<IntrusivePtr<ID>> GetInits();
std::vector<IntrusivePtr<zeek::detail::ID>> GetInits();
// Adds a variable to the list.
void AddInit(IntrusivePtr<ID> id)
void AddInit(IntrusivePtr<zeek::detail::ID> id)
{ inits.emplace_back(std::move(id)); }
void Describe(ODesc* d) const override;
@ -67,27 +69,27 @@ public:
TraversalCode Traverse(TraversalCallback* cb) const;
protected:
IntrusivePtr<ID> scope_id;
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> attrs;
IntrusivePtr<BroType> return_type;
std::map<std::string, IntrusivePtr<ID>, std::less<>> local;
std::vector<IntrusivePtr<ID>> inits;
IntrusivePtr<zeek::detail::ID> scope_id;
std::unique_ptr<std::vector<IntrusivePtr<zeek::detail::Attr>>> attrs;
IntrusivePtr<zeek::Type> return_type;
std::map<std::string, IntrusivePtr<zeek::detail::ID>, std::less<>> local;
std::vector<IntrusivePtr<zeek::detail::ID>> inits;
};
extern bool in_debug;
// If no_global is true, don't search in the default "global" namespace.
extern const IntrusivePtr<ID>& lookup_ID(const char* name, const char* module,
bool no_global = false,
bool same_module_only = false,
bool check_export = true);
extern const IntrusivePtr<zeek::detail::ID>& lookup_ID(const char* name, const char* module,
bool no_global = false,
bool same_module_only = false,
bool check_export = true);
extern IntrusivePtr<ID> install_ID(const char* name, const char* module_name,
bool is_global, bool is_export);
extern IntrusivePtr<zeek::detail::ID> install_ID(const char* name, const char* module_name,
bool is_global, bool is_export);
extern void push_scope(IntrusivePtr<ID> id,
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> attrs);
extern void push_scope(IntrusivePtr<zeek::detail::ID> id,
std::unique_ptr<std::vector<IntrusivePtr<zeek::detail::Attr>>> attrs);
extern void push_existing_scope(Scope* scope);
// Returns the one popped off.