Bug 1302401 - This check is responsible for using the auto type specifier for variable declarations to improve code readability and maintainability. r=Waldo
authorSylvestre Ledru <sylvestre@debian.org>
Tue, 13 Sep 2016 14:23:04 +0200
changeset 315767 3d533ce7453235cb8796d7b3bef70a44b89ba0d3
parent 315766 7c71ddd0c30fa3f9de28f00297097a9a4b7de89a
child 315768 9c1d4bb7c4ee3b75b5a2c08f5bd1a213320ff335
push id20634
push usercbook@mozilla.com
push dateFri, 30 Sep 2016 10:10:13 +0000
treeherderfx-team@afe79b010d13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWaldo
bugs1302401
milestone52.0a1
Bug 1302401 - This check is responsible for using the auto type specifier for variable declarations to improve code readability and maintainability. r=Waldo MozReview-Commit-ID: 5elj65A6dzO
js/src/jit/LIR.h
js/src/jit/MIR.h
js/xpconnect/src/XPCMaps.h
--- a/js/src/jit/LIR.h
+++ b/js/src/jit/LIR.h
@@ -1809,17 +1809,18 @@ class LIRGraph
     }
     LBlock* getBlock(size_t i) {
         return &blocks_[i];
     }
     uint32_t numBlockIds() const {
         return mir_.numBlockIds();
     }
     MOZ_MUST_USE bool initBlock(MBasicBlock* mir) {
-        LBlock* lir = new (&blocks_[mir->id()]) LBlock(mir);
+        auto* block = &blocks_[mir->id()];
+        auto* lir = new (block) LBlock(mir);
         return lir->init(mir_.alloc());
     }
     uint32_t getVirtualRegister() {
         numVirtualRegisters_ += VREG_INCREMENT;
         return numVirtualRegisters_;
     }
     uint32_t numVirtualRegisters() const {
         // Virtual registers are 1-based, not 0-based, so add one as a
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -6175,17 +6175,17 @@ class MAbs
         specialization_ = type;
     }
 
   public:
     INSTRUCTION_HEADER(Abs)
     TRIVIAL_NEW_WRAPPERS
 
     static MAbs* NewAsmJS(TempAllocator& alloc, MDefinition* num, MIRType type) {
-        MAbs* ins = new(alloc) MAbs(num, type);
+        auto* ins = new(alloc) MAbs(num, type);
         if (type == MIRType::Int32)
             ins->implicitTruncate_ = true;
         return ins;
     }
     bool congruentTo(const MDefinition* ins) const override {
         return congruentIfOperandsEqual(ins);
     }
     bool fallible() const;
@@ -6713,17 +6713,17 @@ class MAdd : public MBinaryArithInstruct
 
   public:
     INSTRUCTION_HEADER(Add)
     TRIVIAL_NEW_WRAPPERS
 
     static MAdd* NewAsmJS(TempAllocator& alloc, MDefinition* left, MDefinition* right,
                           MIRType type)
     {
-        MAdd* add = new(alloc) MAdd(left, right);
+        auto* add = new(alloc) MAdd(left, right);
         add->specialization_ = type;
         add->setResultType(type);
         if (type == MIRType::Int32) {
             add->setTruncateKind(Truncate);
             add->setCommutative();
         }
         return add;
     }
@@ -6758,17 +6758,17 @@ class MSub : public MBinaryArithInstruct
 
   public:
     INSTRUCTION_HEADER(Sub)
     TRIVIAL_NEW_WRAPPERS
 
     static MSub* NewAsmJS(TempAllocator& alloc, MDefinition* left, MDefinition* right,
                           MIRType type, bool mustPreserveNaN = false)
     {
-        MSub* sub = new(alloc) MSub(left, right);
+        auto* sub = new(alloc) MSub(left, right);
         sub->specialization_ = type;
         sub->setResultType(type);
         sub->setMustPreserveNaN(mustPreserveNaN);
         if (type == MIRType::Int32)
             sub->setTruncateKind(Truncate);
         return sub;
     }
 
@@ -6936,17 +6936,17 @@ class MDiv : public MBinaryArithInstruct
     }
     static MDiv* New(TempAllocator& alloc, MDefinition* left, MDefinition* right, MIRType type) {
         return new(alloc) MDiv(left, right, type);
     }
     static MDiv* NewAsmJS(TempAllocator& alloc, MDefinition* left, MDefinition* right,
                           MIRType type, bool unsignd, bool trapOnError = false,
                           bool mustPreserveNaN = false)
     {
-        MDiv* div = new(alloc) MDiv(left, right, type);
+        auto* div = new(alloc) MDiv(left, right, type);
         div->unsigned_ = unsignd;
         div->trapOnError_ = trapOnError;
         if (trapOnError)
             div->setGuard(); // not removable because of possible side-effects.
         div->setMustPreserveNaN(mustPreserveNaN);
         if (type == MIRType::Int32)
             div->setTruncateKind(Truncate);
         return div;
@@ -7063,17 +7063,17 @@ class MMod : public MBinaryArithInstruct
   public:
     INSTRUCTION_HEADER(Mod)
     static MMod* New(TempAllocator& alloc, MDefinition* left, MDefinition* right) {
         return new(alloc) MMod(left, right, MIRType::Value);
     }
     static MMod* NewAsmJS(TempAllocator& alloc, MDefinition* left, MDefinition* right,
                           MIRType type, bool unsignd, bool trapOnError = false)
     {
-        MMod* mod = new(alloc) MMod(left, right, type);
+        auto* mod = new(alloc) MMod(left, right, type);
         mod->unsigned_ = unsignd;
         mod->trapOnError_ = trapOnError;
         if (trapOnError)
             mod->setGuard(); // not removable because of possible side-effects.
         if (type == MIRType::Int32)
             mod->setTruncateKind(Truncate);
         return mod;
     }
@@ -8888,17 +8888,17 @@ class MNot
             cacheOperandMightEmulateUndefined(constraints);
     }
 
     void cacheOperandMightEmulateUndefined(CompilerConstraintList* constraints);
 
   public:
     static MNot* NewAsmJS(TempAllocator& alloc, MDefinition* input) {
         MOZ_ASSERT(input->type() == MIRType::Int32 || input->type() == MIRType::Int64);
-        MNot* ins = new(alloc) MNot(input);
+        auto* ins = new(alloc) MNot(input);
         ins->setResultType(MIRType::Int32);
         return ins;
     }
 
     INSTRUCTION_HEADER(Not)
     TRIVIAL_NEW_WRAPPERS
 
     MDefinition* foldsTo(TempAllocator& alloc) override;
@@ -11713,17 +11713,17 @@ class MGetDOMProperty
 
   public:
     INSTRUCTION_HEADER(GetDOMProperty)
     NAMED_OPERANDS((0, object))
 
     static MGetDOMProperty* New(TempAllocator& alloc, const JSJitInfo* info, MDefinition* obj,
                                 MDefinition* guard, MDefinition* globalGuard)
     {
-        MGetDOMProperty* res = new(alloc) MGetDOMProperty(info);
+        auto* res = new(alloc) MGetDOMProperty(info);
         if (!res || !res->init(alloc, obj, guard, globalGuard))
             return nullptr;
         return res;
     }
 
     JSJitGetterOp fun() const {
         return info_->getter;
     }
@@ -11787,17 +11787,17 @@ class MGetDOMMember : public MGetDOMProp
     }
 
   public:
     INSTRUCTION_HEADER(GetDOMMember)
 
     static MGetDOMMember* New(TempAllocator& alloc, const JSJitInfo* info, MDefinition* obj,
                               MDefinition* guard, MDefinition* globalGuard)
     {
-        MGetDOMMember* res = new(alloc) MGetDOMMember(info);
+        auto* res = new(alloc) MGetDOMMember(info);
         if (!res || !res->init(alloc, obj, guard, globalGuard))
             return nullptr;
         return res;
     }
 
     bool possiblyCalls() const override {
         return false;
     }
--- a/js/xpconnect/src/XPCMaps.h
+++ b/js/xpconnect/src/XPCMaps.h
@@ -29,17 +29,17 @@ class JSObject2WrappedJSMap
 {
     using Map = js::HashMap<JS::Heap<JSObject*>,
                             nsXPCWrappedJS*,
                             js::MovableCellHasher<JS::Heap<JSObject*>>,
                             InfallibleAllocPolicy>;
 
 public:
     static JSObject2WrappedJSMap* newMap(int length) {
-        JSObject2WrappedJSMap* map = new JSObject2WrappedJSMap();
+        auto* map = new JSObject2WrappedJSMap();
         if (!map->mTable.init(length)) {
             // This is a decent estimate of the size of the hash table's
             // entry storage. The |2| is because on average the capacity is
             // twice the requested length.
             NS_ABORT_OOM(length * 2 * sizeof(Map::Entry));
         }
         return map;
     }
@@ -587,17 +587,17 @@ class JSObject2JSObjectMap
 {
     using Map = JS::GCHashMap<JS::Heap<JSObject*>,
                               JS::Heap<JSObject*>,
                               js::MovableCellHasher<JS::Heap<JSObject*>>,
                               js::SystemAllocPolicy>;
 
 public:
     static JSObject2JSObjectMap* newMap(int length) {
-        JSObject2JSObjectMap* map = new JSObject2JSObjectMap();
+        auto* map = new JSObject2JSObjectMap();
         if (!map->mTable.init(length)) {
             // This is a decent estimate of the size of the hash table's
             // entry storage. The |2| is because on average the capacity is
             // twice the requested length.
             NS_ABORT_OOM(length * 2 * sizeof(Map::Entry));
         }
         return map;
     }