mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
Reformat Zeek in Spicy style
This largely copies over Spicy's `.clang-format` configuration file. The one place where we deviate is header include order since Zeek depends on headers being included in a certain order.
This commit is contained in:
parent
7b8e7ed72c
commit
f5a76c1aed
786 changed files with 131714 additions and 153609 deletions
|
@ -6,57 +6,55 @@
|
|||
#include "zeek/script_opt/CPP/Util.h"
|
||||
#include "zeek/script_opt/ProfileFunc.h"
|
||||
|
||||
namespace zeek::detail
|
||||
{
|
||||
namespace zeek::detail {
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <class T> void CPPTracker<T>::AddKey(IntrusivePtr<T> key, p_hash_type h)
|
||||
{
|
||||
if ( HasKey(key) )
|
||||
return;
|
||||
template<class T>
|
||||
void CPPTracker<T>::AddKey(IntrusivePtr<T> key, p_hash_type h) {
|
||||
if ( HasKey(key) )
|
||||
return;
|
||||
|
||||
if ( map2.count(h) == 0 )
|
||||
{
|
||||
auto index = keys.size();
|
||||
keys.push_back(key);
|
||||
if ( map2.count(h) == 0 ) {
|
||||
auto index = keys.size();
|
||||
keys.push_back(key);
|
||||
|
||||
map2[h] = index;
|
||||
reps[h] = key.get();
|
||||
}
|
||||
map2[h] = index;
|
||||
reps[h] = key.get();
|
||||
}
|
||||
|
||||
ASSERT(h != 0); // check for hash botches
|
||||
ASSERT(h != 0); // check for hash botches
|
||||
|
||||
map[key.get()] = h;
|
||||
}
|
||||
map[key.get()] = h;
|
||||
}
|
||||
|
||||
template <class T> string CPPTracker<T>::KeyName(const T* key)
|
||||
{
|
||||
ASSERT(HasKey(key));
|
||||
template<class T>
|
||||
string CPPTracker<T>::KeyName(const T* key) {
|
||||
ASSERT(HasKey(key));
|
||||
|
||||
auto hash = map[key];
|
||||
ASSERT(hash != 0);
|
||||
auto hash = map[key];
|
||||
ASSERT(hash != 0);
|
||||
|
||||
auto rep = reps[hash];
|
||||
auto gi = gi_s.find(rep);
|
||||
if ( gi != gi_s.end() )
|
||||
return gi->second->Name();
|
||||
auto rep = reps[hash];
|
||||
auto gi = gi_s.find(rep);
|
||||
if ( gi != gi_s.end() )
|
||||
return gi->second->Name();
|
||||
|
||||
auto index = map2[hash];
|
||||
string ind = Fmt(index);
|
||||
string full_name;
|
||||
auto index = map2[hash];
|
||||
string ind = Fmt(index);
|
||||
string full_name;
|
||||
|
||||
if ( single_global )
|
||||
full_name = base_name + "__CPP[" + ind + "]";
|
||||
else
|
||||
full_name = base_name + "_" + ind + "__CPP";
|
||||
if ( single_global )
|
||||
full_name = base_name + "__CPP[" + ind + "]";
|
||||
else
|
||||
full_name = base_name + "_" + ind + "__CPP";
|
||||
|
||||
return full_name;
|
||||
}
|
||||
return full_name;
|
||||
}
|
||||
|
||||
// Instantiate the templates we'll need.
|
||||
template class CPPTracker<Type>;
|
||||
template class CPPTracker<Attributes>;
|
||||
template class CPPTracker<Expr>;
|
||||
|
||||
} // zeek::detail
|
||||
} // namespace zeek::detail
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue