Clang-tidy static analysis (#3222)
* Clang-tidy static analysis * Modernise checks * Google coding standard checks * Identifier renaming according to Google style
This commit is contained in:
@@ -8,21 +8,27 @@
|
||||
#ifndef XGBOOST_COMMON_COLUMN_MATRIX_H_
|
||||
#define XGBOOST_COMMON_COLUMN_MATRIX_H_
|
||||
|
||||
#define XGBOOST_TYPE_SWITCH(dtype, OP) \
|
||||
switch (dtype) { \
|
||||
case xgboost::common::uint32 : { \
|
||||
typedef uint32_t DType; \
|
||||
OP; break; \
|
||||
} \
|
||||
case xgboost::common::uint16 : { \
|
||||
typedef uint16_t DType; \
|
||||
OP; break; \
|
||||
} \
|
||||
case xgboost::common::uint8 : { \
|
||||
typedef uint8_t DType; \
|
||||
OP; break; \
|
||||
default: LOG(FATAL) << "don't recognize type flag" << dtype; \
|
||||
} \
|
||||
#define XGBOOST_TYPE_SWITCH(dtype, OP) \
|
||||
\
|
||||
switch(dtype) { \
|
||||
case xgboost::common::uint32: { \
|
||||
using DType = uint32_t; \
|
||||
OP; \
|
||||
break; \
|
||||
} \
|
||||
case xgboost::common::uint16: { \
|
||||
using DType = uint16_t; \
|
||||
OP; \
|
||||
break; \
|
||||
} \
|
||||
case xgboost::common::uint8: { \
|
||||
using DType = uint8_t; \
|
||||
OP; \
|
||||
break; \
|
||||
default: \
|
||||
LOG(FATAL) << "don't recognize type flag" << dtype; \
|
||||
} \
|
||||
\
|
||||
}
|
||||
|
||||
#include <type_traits>
|
||||
@@ -31,11 +37,12 @@ switch (dtype) { \
|
||||
#include "hist_util.h"
|
||||
#include "../tree/fast_hist_param.h"
|
||||
|
||||
using xgboost::tree::FastHistParam;
|
||||
|
||||
namespace xgboost {
|
||||
namespace common {
|
||||
|
||||
using tree::FastHistParam;
|
||||
|
||||
/*! \brief indicator of data type used for storing bin id's in a column. */
|
||||
enum DataType {
|
||||
uint8 = 1,
|
||||
@@ -78,7 +85,7 @@ class ColumnMatrix {
|
||||
slot of internal buffer. */
|
||||
packing_factor_ = sizeof(uint32_t) / static_cast<size_t>(this->dtype);
|
||||
|
||||
const bst_uint nfeature = static_cast<bst_uint>(gmat.cut->row_ptr.size() - 1);
|
||||
const auto nfeature = static_cast<bst_uint>(gmat.cut->row_ptr.size() - 1);
|
||||
const size_t nrow = gmat.row_ptr.size() - 1;
|
||||
|
||||
// identify type of each column
|
||||
|
||||
Reference in New Issue
Block a user