Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: runtime/platform/globals.h

Issue 2470663006: Add .clang-format and run clang-format on runtime/platform. (Closed)
Patch Set: Remove default override for short functions Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/platform/floating_point_win.cc ('k') | runtime/platform/hashmap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/platform/globals.h
diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h
index 85032215236d5fa91cfea6757128f0bc11a7d9eb..cd7490169fa2c8220fbecc8937f1e9d6eacb0009 100644
--- a/runtime/platform/globals.h
+++ b/runtime/platform/globals.h
@@ -195,9 +195,7 @@ struct simd128_value_t {
v[0] = double_storage[0];
v[1] = double_storage[1];
}
- void writeTo(simd128_value_t* v) {
- *v = *this;
- }
+ void writeTo(simd128_value_t* v) { *v = *this; }
};
// Processor architecture detection. For more info on what's defined, see:
@@ -228,18 +226,17 @@ typedef simd128_value_t fpu_register_t;
typedef struct {
union {
uint32_t u;
- float f;
+ float f;
} data_[4];
} simd_value_t;
typedef simd_value_t fpu_register_t;
-#define simd_value_safe_load(addr) \
- (*reinterpret_cast<simd_value_t *>(addr))
+#define simd_value_safe_load(addr) (*reinterpret_cast<simd_value_t*>(addr))
#define simd_value_safe_store(addr, value) \
do { \
- reinterpret_cast<simd_value_t *>(addr)->data_[0] = value.data_[0]; \
- reinterpret_cast<simd_value_t *>(addr)->data_[1] = value.data_[1]; \
- reinterpret_cast<simd_value_t *>(addr)->data_[2] = value.data_[2]; \
- reinterpret_cast<simd_value_t *>(addr)->data_[3] = value.data_[3]; \
+ reinterpret_cast<simd_value_t*>(addr)->data_[0] = value.data_[0]; \
+ reinterpret_cast<simd_value_t*>(addr)->data_[1] = value.data_[1]; \
+ reinterpret_cast<simd_value_t*>(addr)->data_[2] = value.data_[2]; \
+ reinterpret_cast<simd_value_t*>(addr)->data_[3] = value.data_[3]; \
} while (0)
#elif defined(__MIPSEL__)
@@ -335,14 +332,12 @@ typedef simd128_value_t fpu_register_t;
// Verify that host and target architectures match, we cannot
// have a 64 bit Dart VM generating 32 bit code or vice-versa.
-#if defined(TARGET_ARCH_X64) || \
- defined(TARGET_ARCH_ARM64)
+#if defined(TARGET_ARCH_X64) || defined(TARGET_ARCH_ARM64)
#if !defined(ARCH_IS_64_BIT)
#error Mismatched Host/Target architectures.
#endif
-#elif defined(TARGET_ARCH_IA32) || \
- defined(TARGET_ARCH_ARM) || \
- defined(TARGET_ARCH_MIPS)
+#elif defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_ARM) || \
+ defined(TARGET_ARCH_MIPS)
#if !defined(ARCH_IS_32_BIT)
#error Mismatched Host/Target architectures.
#endif
@@ -350,9 +345,9 @@ typedef simd128_value_t fpu_register_t;
// Determine whether we will be using the simulator.
#if defined(TARGET_ARCH_IA32)
- // No simulator used.
+// No simulator used.
#elif defined(TARGET_ARCH_X64)
- // No simulator used.
+// No simulator used.
#elif defined(TARGET_ARCH_ARM)
#if !defined(HOST_ARCH_ARM)
#define USING_SIMULATOR 1
@@ -429,7 +424,7 @@ typedef simd128_value_t fpu_register_t;
// Usage: instead of writing 0x1234567890123456ULL
// write DART_2PART_UINT64_C(0x12345678,90123456);
#define DART_2PART_UINT64_C(a, b) \
- (((static_cast<uint64_t>(a) << 32) + 0x##b##u))
+ (((static_cast<uint64_t>(a) << 32) + 0x##b##u))
// Integer constants.
const int32_t kMinInt32 = 0x80000000;
@@ -457,11 +452,11 @@ typedef uint32_t classid_t;
// Byte sizes.
const int kWordSize = sizeof(word);
const int kDoubleSize = sizeof(double); // NOLINT
-const int kFloatSize = sizeof(float); // NOLINT
+const int kFloatSize = sizeof(float); // NOLINT
const int kQuadSize = 4 * kFloatSize;
const int kSimd128Size = sizeof(simd128_value_t); // NOLINT
-const int kInt32Size = sizeof(int32_t); // NOLINT
-const int kInt16Size = sizeof(int16_t); // NOLINT
+const int kInt32Size = sizeof(int32_t); // NOLINT
+const int kInt16Size = sizeof(int16_t); // NOLINT
#ifdef ARCH_IS_32_BIT
const int kWordSizeLog2 = 2;
const uword kUwordMax = kMaxUint32;
@@ -510,13 +505,13 @@ const intptr_t kIntptrMax = ~kIntptrMin;
// Time constants.
const int kMillisecondsPerSecond = 1000;
const int kMicrosecondsPerMillisecond = 1000;
-const int kMicrosecondsPerSecond = (kMicrosecondsPerMillisecond *
- kMillisecondsPerSecond);
+const int kMicrosecondsPerSecond =
+ (kMicrosecondsPerMillisecond * kMillisecondsPerSecond);
const int kNanosecondsPerMicrosecond = 1000;
-const int kNanosecondsPerMillisecond = (kNanosecondsPerMicrosecond *
- kMicrosecondsPerMillisecond);
-const int kNanosecondsPerSecond = (kNanosecondsPerMicrosecond *
- kMicrosecondsPerSecond);
+const int kNanosecondsPerMillisecond =
+ (kNanosecondsPerMicrosecond * kMicrosecondsPerMillisecond);
+const int kNanosecondsPerSecond =
+ (kNanosecondsPerMicrosecond * kMicrosecondsPerSecond);
// Helpers to scale micro second times to human understandable values.
inline double MicrosecondsToSeconds(int64_t micros) {
@@ -530,7 +525,7 @@ inline double MicrosecondsToMilliseconds(int64_t micros) {
// This should be used in the private: declarations for a class.
#if !defined(DISALLOW_COPY_AND_ASSIGN)
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
-private: \
+ private: \
TypeName(const TypeName&); \
void operator=(const TypeName&)
#endif // !defined(DISALLOW_COPY_AND_ASSIGN)
@@ -542,7 +537,7 @@ private: \
// containing only static methods.
#if !defined(DISALLOW_IMPLICIT_CONSTRUCTORS)
#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
-private: \
+ private: \
TypeName(); \
DISALLOW_COPY_AND_ASSIGN(TypeName)
#endif // !defined(DISALLOW_IMPLICIT_CONSTRUCTORS)
@@ -553,19 +548,20 @@ private: \
// platform/assert.h.
#if !defined(DISALLOW_ALLOCATION)
#define DISALLOW_ALLOCATION() \
-public: \
+ public: \
void operator delete(void* pointer) { \
fprintf(stderr, "unreachable code\n"); \
abort(); \
} \
-private: \
+ \
+ private: \
void* operator new(size_t size);
#endif // !defined(DISALLOW_ALLOCATION)
// The USE(x) template is used to silence C++ compiler warnings issued
// for unused variables.
template <typename T>
-static inline void USE(T) { }
+static inline void USE(T) {}
// Use implicit_cast as a safe version of static_cast or const_cast
@@ -585,15 +581,15 @@ static inline void USE(T) { }
// implicit_cast would have been part of the C++ standard library,
// but the proposal was submitted too late. It will probably make
// its way into the language in the future.
-template<typename To, typename From>
-inline To implicit_cast(From const &f) {
+template <typename To, typename From>
+inline To implicit_cast(From const& f) {
return f;
}
// Use like this: down_cast<T*>(foo);
-template<typename To, typename From> // use like this: down_cast<T*>(foo);
-inline To down_cast(From* f) { // so we only accept pointers
+template <typename To, typename From> // use like this: down_cast<T*>(foo);
+inline To down_cast(From* f) { // so we only accept pointers
// Ensures that To is a sub-type of From *. This test is here only
// for compile-time type checking, and has no overhead in an
// optimized build at run-time, as it will be optimized away completely.
@@ -647,12 +643,11 @@ inline D bit_cast(const S& source) {
// optimizations of GCC 4.4. Basically, GCC mindlessly relies on
// obscure details in the C++ standard that make reinterpret_cast
// virtually useless.
-template<class D, class S>
+template <class D, class S>
inline D bit_copy(const S& source) {
D destination;
// This use of memcpy is safe: source and destination cannot overlap.
- memcpy(&destination,
- reinterpret_cast<const void*>(&source),
+ memcpy(&destination, reinterpret_cast<const void*>(&source),
sizeof(destination));
return destination;
}
@@ -691,7 +686,7 @@ static inline T ReadUnaligned(const T* ptr) {
// N.B.: As the GCC manual states, "[s]ince non-static C++ methods
// have an implicit 'this' argument, the arguments of such methods
// should be counted from two, not one."
-#define PRINTF_ATTRIBUTE(string_index, first_to_check) \
+#define PRINTF_ATTRIBUTE(string_index, first_to_check) \
__attribute__((__format__(__printf__, string_index, first_to_check)))
#else
#define PRINTF_ATTRIBUTE(string_index, first_to_check)
« no previous file with comments | « runtime/platform/floating_point_win.cc ('k') | runtime/platform/hashmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698