clang-format suggestion

This commit is contained in:
Philippe Canal 2017-08-24 09:22:27 -05:00 committed by sftnight
parent 38c4b902cf
commit 6c368913e7
4 changed files with 44 additions and 49 deletions

View File

@ -10,8 +10,8 @@
#ifndef CLING_ORDERED_MAP_H
#define CLING_ORDERED_MAP_H
#include <unordered_map>
#include <cassert>
#include <unordered_map>
namespace cling {
namespace utils {
@ -23,8 +23,7 @@ namespace utils {
/// additional parameter to 'erase' so that a mapped value can be moved into
/// local storage before erasing the iterator occurs.
///
template <typename Key, typename Value>
class OrderedMap {
template <typename Key, typename Value> class OrderedMap {
typedef std::unordered_map<Key, Value> map_t;
// Would this be faster as a std::unoredered_map<Key, size_t> for erasure?
typedef std::vector<typename map_t::const_iterator> order_t;

View File

@ -103,7 +103,6 @@ IncrementalExecutor::IncrementalExecutor(clang::DiagnosticsEngine& diags,
// Keep in source: ~unique_ptr<ClingJIT> needs ClingJIT
IncrementalExecutor::~IncrementalExecutor() {}
void IncrementalExecutor::shuttingDown() {
// It is legal to register an atexit handler from within another atexit
// handler and furthor-more the standard says they need to run in reverse
@ -301,8 +300,7 @@ void IncrementalExecutor::runAndRemoveStaticDestructors(Transaction* T) {
{
cling::internal::SpinLockGuard slg(m_AtExitFuncsSpinLock);
auto Itr = m_AtExitFuncs.find(T->getModule());
if (Itr == m_AtExitFuncs.end())
return;
if (Itr == m_AtExitFuncs.end()) return;
m_AtExitFuncs.erase(Itr, &Local);
} // end of spin lock lifetime block.

View File

@ -22,11 +22,11 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringRef.h"
#include <vector>
#include <unordered_set>
#include <atomic>
#include <map>
#include <memory>
#include <atomic>
#include <unordered_set>
#include <vector>
namespace clang {
class DiagnosticsEngine;
@ -93,8 +93,8 @@ namespace cling {
///\param [in] fromT - The unloading of this transaction will trigger the
/// atexit function.
///
CXAAtExitElement(void (*func) (void*), void* arg):
m_Func(func), m_Arg(arg) {}
CXAAtExitElement(void (*func)(void*), void* arg)
: m_Func(func), m_Arg(arg) {}
void operator()() const { (*m_Func)(m_Arg); }
};

View File

@ -32,11 +32,15 @@ atexit(atexit_1);
at_quick_exit(atexit_2);
.undo
// Make sure at_quick_exit is resolved correctly (mangling issues on gcc < 5)
// Make sure at_quick_exit is resolved correctly (mangling issues on gcc <
// 5)
// CHECK-NEXT: atexit_2
// Test reverse ordering in a single transaction.
static void atexitA() { printf("atexitA\n"); }
static void
atexitA() {
printf("atexitA\n");
}
static void atexitB() { printf("atexitB\n"); }
static void atexitC() { printf("atexitC\n"); }
{
@ -67,15 +71,9 @@ static void atexit_f() {
}
at_quick_exit(atexit_f);
void atExit0 () {
printf("atExit0\n");
}
void atExit1 () {
printf("atExit1\n");
}
void atExit2 () {
printf("atExit2\n");
}
void atExit0() { printf("atExit0\n"); }
void atExit1() { printf("atExit1\n"); }
void atExit2() { printf("atExit2\n"); }
void atExitA() {
printf("atExitA\n");
std::atexit(&atExit0);