forked from mindspore-Ecosystem/mindspore
Adjust source code format and check scripts, format source codes in
directory 'mindspore/core'
This commit is contained in:
parent
16079e6356
commit
a7fc02cb60
|
@ -21,7 +21,6 @@
|
|||
#include "ir/tensor.h"
|
||||
#include "base/base_ref.h"
|
||||
|
||||
|
||||
#ifndef MINDSPORE_CCSRC_UTILS_BASE_REF_UTILS_H
|
||||
#define MINDSPORE_CCSRC_UTILS_BASE_REF_UTILS_H
|
||||
namespace mindspore {
|
||||
|
|
|
@ -180,7 +180,9 @@ class AnfNode : public Base {
|
|||
bool HasUserData(const std::string &key) const { return user_data_.has(key); }
|
||||
|
||||
template <typename T>
|
||||
bool HasUserData() const { return user_data_.has(T::key); }
|
||||
bool HasUserData() const {
|
||||
return user_data_.has(T::key);
|
||||
}
|
||||
|
||||
protected:
|
||||
// Hold a weak ref to Graph as Graph also hold ref to AnfNode.
|
||||
|
|
|
@ -40,9 +40,7 @@ namespace mindspore {
|
|||
template <typename T>
|
||||
class PBase {
|
||||
public:
|
||||
bool CheckFunc(const PredicateFuncType &func, const AnfNodePtr &node) {
|
||||
return func(get_object().GetNode(node));
|
||||
}
|
||||
bool CheckFunc(const PredicateFuncType &func, const AnfNodePtr &node) { return func(get_object().GetNode(node)); }
|
||||
|
||||
const T &get_object() const { return *static_cast<const T *>(this); }
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include <utility>
|
||||
#include "abstract/abstract_function.h"
|
||||
|
||||
|
||||
namespace mindspore {
|
||||
|
||||
abstract::AbstractBasePtr Primitive::ToAbstract() {
|
||||
|
|
|
@ -23,6 +23,6 @@ extern const char GRAPH_FLAG_HAS_EFFECT[];
|
|||
extern const char GRAPH_FLAG_EFFECT_PATIAL_ORDER[];
|
||||
extern const char GRAPH_FLAG_RANDOM_EFFECT[];
|
||||
extern const char GRAPH_FLAG_SIDE_EFFECT[];
|
||||
}
|
||||
} // namespace mindspore
|
||||
|
||||
#endif // MINDSPORE_CORE_UTILS_FLAGS_H
|
||||
|
|
|
@ -86,12 +86,12 @@ cd "${SCRIPTS_PATH}/.." || exit 1
|
|||
CHECK_LIST_FILE='__checked_files_list__'
|
||||
|
||||
if [ "X${mode}" == "Xall" ]; then
|
||||
find mindspore/ccsrc -type f -name "*" | grep "\.h$\|\.cc$" > "${CHECK_LIST_FILE}" || true
|
||||
find mindspore/{ccsrc,core} -type f -name "*" | grep "\.h$\|\.cc$" > "${CHECK_LIST_FILE}" || true
|
||||
elif [ "X${mode}" == "Xchanged" ]; then
|
||||
# --diff-filter=ACMRTUXB will ignore deleted files in commit
|
||||
git diff --diff-filter=ACMRTUXB --name-only | grep "mindspore/ccsrc" | grep "\.h$\|\.cc$" > "${CHECK_LIST_FILE}" || true
|
||||
git diff --diff-filter=ACMRTUXB --name-only | grep "mindspore/ccsrc\|mindspore/core" | grep "\.h$\|\.cc$" > "${CHECK_LIST_FILE}" || true
|
||||
else # "X${mode}" == "Xlastcommit"
|
||||
git diff --diff-filter=ACMRTUXB --name-only HEAD~ HEAD | grep "mindspore/ccsrc" | grep "\.h$\|\.cc$" > "${CHECK_LIST_FILE}" || true
|
||||
git diff --diff-filter=ACMRTUXB --name-only HEAD~ HEAD | grep "mindspore/ccsrc\|mindspore/core" | grep "\.h$\|\.cc$" > "${CHECK_LIST_FILE}" || true
|
||||
fi
|
||||
|
||||
CHECK_RESULT_FILE=__code_format_check_result__
|
||||
|
|
|
@ -86,11 +86,11 @@ cd "${SCRIPTS_PATH}/.." || exit 1
|
|||
FMT_FILE_LIST='__format_files_list__'
|
||||
|
||||
if [[ "X${mode}" == "Xall" ]]; then
|
||||
find mindspore/ccsrc -type f -name "*" | grep "\.h$\|\.cc$" > "${FMT_FILE_LIST}" || true
|
||||
find mindspore/{ccsrc,core} -type f -name "*" | grep "\.h$\|\.cc$" > "${FMT_FILE_LIST}" || true
|
||||
elif [[ "X${mode}" == "Xchanged" ]]; then
|
||||
git diff --name-only | grep "mindspore/ccsrc" | grep "\.h$\|\.cc$" > "${FMT_FILE_LIST}" || true
|
||||
git diff --name-only | grep "mindspore/ccsrc\|mindspore/core" | grep "\.h$\|\.cc$" > "${FMT_FILE_LIST}" || true
|
||||
else # "X${mode}" == "Xlastcommit"
|
||||
git diff --name-only HEAD~ HEAD | grep "mindspore/ccsrc" | grep "\.h$\|\.cc$" > "${FMT_FILE_LIST}" || true
|
||||
git diff --name-only HEAD~ HEAD | grep "mindspore/ccsrc\|mindspore/core" | grep "\.h$\|\.cc$" > "${FMT_FILE_LIST}" || true
|
||||
fi
|
||||
|
||||
while read line; do
|
||||
|
|
Loading…
Reference in New Issue