Bug 1519636 - Reformat recent changes to the Google coding style. r=firefox-build-system-reviewers,mhentges,sylvestre

Reformat with clang-format version 12.0.1 (taskcluster-FYV2l5wGTseBAhiqf8cxfQ)

Differential Revision: https://phabricator.services.mozilla.com/D131114
This commit is contained in:
Andi-Bogdan Postelnicu 2021-11-16 08:07:29 +00:00
parent 551a6b105b
commit 1faa3d40cf
19 changed files with 58 additions and 78 deletions

View file

@ -34,7 +34,7 @@ void moz_wasm2c_trap_handler(const char* msg) {
// This indicates that the sandbox has run out of memory.
void moz_wasm2c_malloc_failed(uint32_t size) {
// We don't use the allocation size information for now
(void) size;
(void)size;
CrashReporter::AnnotateCrashReport(
CrashReporter::Annotation::WasmLibrarySandboxMallocFailed, true);

View file

@ -199,13 +199,15 @@ TEST(IntlString, ComposePairNFC)
ASSERT_EQ(String::ComposePairNFC(U'a', U'\u0308'), U'ä');
// Accented letter + a further accent
ASSERT_EQ(String::ComposePairNFC(U'ä', U'\u0304'), U'ǟ');
// Accented letter + a further accent, but doubly-accented form is not available
// Accented letter + a further accent, but doubly-accented form is not
// available
ASSERT_EQ(String::ComposePairNFC(U'ä', U'\u0301'), U'\0');
// These do not compose because although U+0344 has the decomposition <0308, 0301>
// (see below), it also has the Full_Composition_Exclusion property.
// These do not compose because although U+0344 has the decomposition <0308,
// 0301> (see below), it also has the Full_Composition_Exclusion property.
ASSERT_EQ(String::ComposePairNFC(U'\u0308', U'\u0301'), U'\0');
// Supplementary-plane letter + accent
ASSERT_EQ(String::ComposePairNFC(U'\U00011099', U'\U000110BA'), U'\U0001109A');
ASSERT_EQ(String::ComposePairNFC(U'\U00011099', U'\U000110BA'),
U'\U0001109A');
}
TEST(IntlString, DecomposeRawNFD)

View file

@ -221,10 +221,9 @@ class String final {
const unsigned MAX_DECOMP_LENGTH = 4;
UErrorCode error = U_ZERO_ERROR;
UChar decompUtf16[MAX_DECOMP_LENGTH];
int32_t len = unorm2_getRawDecomposition(normalizer,
static_cast<UChar32>(ab),
decompUtf16, MAX_DECOMP_LENGTH,
&error);
int32_t len =
unorm2_getRawDecomposition(normalizer, static_cast<UChar32>(ab),
decompUtf16, MAX_DECOMP_LENGTH, &error);
if (U_FAILURE(error) || len < 0) {
return 0;
}

View file

@ -20,8 +20,7 @@ void f(int x) {
}
void g(int x) {
if (x % 2)
f(x);
if (x % 2) f(x);
h(x);
}
@ -32,9 +31,7 @@ void h(int x) {
}
}
void leaf() {
asm("");
}
void leaf() { asm(""); }
void nonrecursive_root() {
leaf();
@ -43,8 +40,7 @@ void nonrecursive_root() {
}
void self_recursive(int x) {
if (x)
self_recursive(x - 1);
if (x) self_recursive(x - 1);
}
// Set up the graph
@ -66,44 +62,29 @@ extern void n7(int x);
extern void n8(int x);
extern void n9(int x);
void n1(int x) {
n2(x);
}
void n1(int x) { n2(x); }
void n2(int x) {
if (x)
n1(x - 1);
if (x) n1(x - 1);
n3(x);
}
void n4(int x) {
n5(x);
}
void n4(int x) { n5(x); }
void n5(int x) {
if (x)
n4(x - 1);
if (x) n4(x - 1);
n3(x);
}
void n3(int x) {
n6(x);
}
void n3(int x) { n6(x); }
void n6(int x) {
n7(x);
}
void n6(int x) { n7(x); }
void n7(int x) {
n8(x);
}
void n7(int x) { n8(x); }
void n8(int x) {
if (x)
n7(x - 1);
if (x) n7(x - 1);
n9(x);
}
void n9(int x) {
asm("");
}
void n9(int x) { asm(""); }

View file

@ -18,7 +18,7 @@ void GC() {
// js::RunScript.
namespace js {
void RunScript() { GC(); }
}
} // namespace js
struct Cell {
int f;
@ -138,7 +138,7 @@ class nsISupports {
class nsIPrincipal : public nsISupports {
public:
~nsIPrincipal() override {};
~nsIPrincipal() override{};
};
struct JSPrincipals {
@ -263,7 +263,7 @@ void f() {
{
nsJSPrincipals* princ = new nsJSPrincipals();
Cell* c18 = &cell;
delete princ; // Can GC
delete princ; // Can GC
use(c18);
}
@ -271,14 +271,14 @@ void f() {
nsJSPrincipals* princ = new nsJSPrincipals();
nsISupports* supp = static_cast<nsISupports*>(princ);
Cell* c19 = &cell;
delete supp; // Can GC
delete supp; // Can GC
use(c19);
}
{
auto* safe = new SafePrincipals();
Cell* c20 = &cell;
delete safe; // Cannot GC
delete safe; // Cannot GC
use(c20);
}
@ -286,7 +286,7 @@ void f() {
auto* safe = new SafePrincipals();
nsISupports* supp = static_cast<nsISupports*>(safe);
Cell* c21 = &cell;
delete supp; // Compiler thinks destructor can GC.
delete supp; // Compiler thinks destructor can GC.
use(c21);
}
}

View file

@ -15,7 +15,7 @@
#include "gc/Cell.h"
#include "gc/StoreBuffer.h"
#include "js/ComparisonOperators.h" // JS::detail::DefineComparisonOps
#include "js/ComparisonOperators.h" // JS::detail::DefineComparisonOps
#include "js/experimental/TypedData.h" // js::EnableIfABOVType
#include "js/HeapAPI.h"
#include "js/Id.h"

View file

@ -6981,7 +6981,7 @@ void CodeGenerator::visitNewObjectVMCall(LNewObject* lir) {
pushArg(ImmPtr(lir->mir()->resumePoint()->pc()));
pushArg(ImmGCPtr(lir->mir()->block()->info().script()));
using Fn = JSObject* (*)(JSContext*, HandleScript, const jsbytecode * pc);
using Fn = JSObject* (*)(JSContext*, HandleScript, const jsbytecode* pc);
callVM<Fn, NewObjectOperation>(lir);
break;
}

View file

@ -16,13 +16,13 @@
#include "jit/CompileWrappers.h" // CompileRuntime
#include "jit/JitFrames.h" // MinJITStackSize
#include "jit/shared/Assembler-shared.h"
#include "js/TypeDecls.h" // jsbytecode
#include "vm/BindingKind.h" // BindingLocation
#include "vm/BytecodeUtil.h" // JSOp
#include "vm/JSAtomState.h" // JSAtomState
#include "vm/JSFunction.h" // JSFunction
#include "vm/JSScript.h" // JSScript
#include "vm/Scope.h" // BindingIter
#include "js/TypeDecls.h" // jsbytecode
#include "vm/BindingKind.h" // BindingLocation
#include "vm/BytecodeUtil.h" // JSOp
#include "vm/JSAtomState.h" // JSAtomState
#include "vm/JSFunction.h" // JSFunction
#include "vm/JSScript.h" // JSScript
#include "vm/Scope.h" // BindingIter
namespace js {

View file

@ -182,7 +182,7 @@ struct TypeToRootType<Handle<T*>> {
static constexpr uint32_t result = rootType();
};
template <class T>
struct TypeToRootType<Handle<T> > {
struct TypeToRootType<Handle<T>> {
// Fail for Handle types that aren't specialized above.
};

View file

@ -10,7 +10,7 @@
#include "gc/Cell.h"
#include "gc/GCRuntime.h"
#include "js/ArrayBuffer.h" // JS::NewArrayBuffer
#include "js/ArrayBuffer.h" // JS::NewArrayBuffer
#include "js/experimental/TypedData.h"
#include "js/PropertyAndElement.h" // JS_DefineProperty, JS_GetProperty
#include "js/RootingAPI.h"
@ -26,8 +26,11 @@ static js::gc::CellColor GetColor(const JS::ArrayBufferOrView& view) {
return view.asObjectUnbarriered()->color();
}
static MOZ_MAYBE_UNUSED bool IsInsideNursery(gc::Cell* cell) { return !cell->isTenured(); }
static MOZ_MAYBE_UNUSED bool IsInsideNursery(const JS::ArrayBufferOrView& view) {
static MOZ_MAYBE_UNUSED bool IsInsideNursery(gc::Cell* cell) {
return !cell->isTenured();
}
static MOZ_MAYBE_UNUSED bool IsInsideNursery(
const JS::ArrayBufferOrView& view) {
return IsInsideNursery(view.asObjectUnbarriered());
}

View file

@ -2108,7 +2108,7 @@ UniquePtr<ParseTask> GlobalHelperThreadState::finishParseTaskCommon(
}
// Report any error or warnings generated during the parse.
for (UniquePtr<CompileError>& error: parseTask->errors.errors) {
for (UniquePtr<CompileError>& error : parseTask->errors.errors) {
error->throwError(cx);
}
if (parseTask->errors.overRecursed) {

View file

@ -26,7 +26,7 @@
#include "wasm/WasmBCDefs.h"
#include "wasm/WasmBCRegDefs.h"
#include "wasm/WasmBCStk.h"
#include "wasm/WasmConstants.h" // For MaxFrameSize
#include "wasm/WasmConstants.h" // For MaxFrameSize
// The stack frame.
//

View file

@ -2027,7 +2027,8 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest* request) {
return NS_OK;
}
void nsExternalAppHandler::RecordDownloadTelemetry(nsIChannel* aChannel, const char* aAction) {
void nsExternalAppHandler::RecordDownloadTelemetry(nsIChannel* aChannel,
const char* aAction) {
// Telemetry for helper app dialog
if (XRE_IsContentProcess()) {

View file

@ -273,7 +273,6 @@ class nsExternalAppHandler final : public nsIStreamListener,
void SetShouldCloseWindow() { mShouldCloseWindow = true; }
protected:
// Record telemetry about a download that was attempted.
void RecordDownloadTelemetry(nsIChannel* aChannel, const char* aAction);

View file

@ -219,9 +219,7 @@ static Maybe<nscolor> GetSystemColor(LookAndFeel::ColorID aId) {
class SelectionStyleProvider final {
public:
static SelectionStyleProvider* GetExistingInstance() {
return sInstance;
}
static SelectionStyleProvider* GetExistingInstance() { return sInstance; }
static SelectionStyleProvider* GetInstance() {
if (sHasShutDown) {

View file

@ -77,8 +77,8 @@ enum class CCReason : uint8_t {
// Low memory situation detected.
MEM_PRESSURE,
// IPC message to a content process to trigger a CC. The original reason is not
// tracked.
// IPC message to a content process to trigger a CC. The original reason is
// not tracked.
IPC_MESSAGE,
// Cycle collection on a worker. The triggering reason is not tracked.
@ -114,8 +114,8 @@ static inline const char* CCReasonToString(CCReason aReason) {
break;
FOR_EACH_CCREASON(SET_REASON_STR)
#undef SET_REASON_STR
default:
return "<unknown-reason>";
default:
return "<unknown-reason>";
}
}

View file

@ -1656,7 +1656,7 @@ nsLocalFile::IsExecutable(bool* aResult) {
#ifdef MOZ_WIDGET_COCOA
"fileloc", // File location files can be used to point to other
// files.
"inetloc", // Shouldn't be able to do the same, but can, due to
"inetloc", // Shouldn't be able to do the same, but can, due to
// macOS vulnerabilities.
#endif
"jar" // java application bundle

View file

@ -59,10 +59,9 @@ TEST(NSURLEscaping, NSURLEscapingTests)
// Pairs of URLs of the form (un-encoded, expected encoded result) to verify.
nsTArray<std::pair<nsCString, nsCString>> pairs{
{
// '#' in ref
"https://chat.mozilla.org/#/room/#macdev:mozilla.org"_ns,
"https://chat.mozilla.org/#/room/%23macdev:mozilla.org"_ns},
{// '#' in ref
"https://chat.mozilla.org/#/room/#macdev:mozilla.org"_ns,
"https://chat.mozilla.org/#/room/%23macdev:mozilla.org"_ns},
{
// '"' in ref
"https://example.com/path#ref_with_#_and\""_ns,

View file

@ -449,9 +449,7 @@ nsresult nsProcess::RunProcess(bool aBlocking, char** aMyArgv,
// can cause TSAN to complain about thread leaks. We handle this with a TSAN
// suppression, and route thread creation through this helper so that the
// suppression is as narrowly-scoped as possible.
PRThread*
nsProcess::CreateMonitorThread()
{
PRThread* nsProcess::CreateMonitorThread() {
return PR_CreateThread(PR_SYSTEM_THREAD, Monitor, this, PR_PRIORITY_NORMAL,
PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0);
}