Browse Source

Adjust source code format and check scripts, format source codes in

directory 'mindspore/core'
tags/v0.7.0-beta
fary86 5 years ago
parent
commit
a7fc02cb60
7 changed files with 11 additions and 13 deletions
  1. +0
    -1
      mindspore/core/base/base_ref_utils.h
  2. +3
    -1
      mindspore/core/ir/anf.h
  3. +1
    -3
      mindspore/core/ir/pattern_matcher.h
  4. +0
    -1
      mindspore/core/ir/primitive.cc
  5. +1
    -1
      mindspore/core/utils/flags.h
  6. +3
    -3
      scripts/check_clang_format.sh
  7. +3
    -3
      scripts/format_source_code.sh

+ 0
- 1
mindspore/core/base/base_ref_utils.h View File

@@ -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 {


+ 3
- 1
mindspore/core/ir/anf.h View File

@@ -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.


+ 1
- 3
mindspore/core/ir/pattern_matcher.h View File

@@ -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); }



+ 0
- 1
mindspore/core/ir/primitive.cc View File

@@ -19,7 +19,6 @@
#include <utility>
#include "abstract/abstract_function.h"


namespace mindspore {

abstract::AbstractBasePtr Primitive::ToAbstract() {


+ 1
- 1
mindspore/core/utils/flags.h View File

@@ -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

+ 3
- 3
scripts/check_clang_format.sh View File

@@ -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__


+ 3
- 3
scripts/format_source_code.sh View File

@@ -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…
Cancel
Save