Commit 22950ec3 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Match DenseMap/Set to our codebase

- add note + license
- put in our namespace
- change header guards
- make it match our lint style
- don't apply our formatting
parent 4b115c17
...@@ -300,7 +300,7 @@ endif() ...@@ -300,7 +300,7 @@ endif()
# format # format
file(GLOB_RECURSE FORMAT_FILES ${CMAKE_SOURCE_DIR}/src/*.h ${CMAKE_SOURCE_DIR}/src/*.cpp) file(GLOB_RECURSE FORMAT_FILES ${CMAKE_SOURCE_DIR}/src/*.h ${CMAKE_SOURCE_DIR}/src/*.cpp)
add_custom_target(format ${LLVM_TOOLS_BINARY_DIR}/clang-format -style=file -i ${FORMAT_FILES} DEPENDS clang-format WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src) add_custom_target(format ${CMAKE_SOURCE_DIR}/tools/do_format.sh ${LLVM_TOOLS_BINARY_DIR}/clang-format DEPENDS clang-format WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src)
add_custom_target(check-format ${CMAKE_SOURCE_DIR}/tools/check_format.sh ${LLVM_TOOLS_BINARY_DIR}/clang-format DEPENDS clang-format WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src) add_custom_target(check-format ${CMAKE_SOURCE_DIR}/tools/check_format.sh ${LLVM_TOOLS_BINARY_DIR}/clang-format DEPENDS clang-format WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src)
# lint # lint
......
// This file was copied from https://llvm.org/svn/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?p=230300
// and came with the following license:
//===- llvm/ADT/DenseMap.h - Dense probed hash table ------------*- C++ -*-===// //===- llvm/ADT/DenseMap.h - Dense probed hash table ------------*- C++ -*-===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
...@@ -11,15 +14,26 @@ ...@@ -11,15 +14,26 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef LLVM_ADT_DENSEMAP_H
#define LLVM_ADT_DENSEMAP_H
#include "llvm/ADT/DenseMapInfo.h" // Modifications were made for Pyston, using the following license:
#include "llvm/Support/AlignOf.h"
#include "llvm/Support/Compiler.h" // Copyright (c) 2014-2015 Dropbox, Inc.
#include "llvm/Support/MathExtras.h" //
#include "llvm/Support/PointerLikeTypeTraits.h" // Licensed under the Apache License, Version 2.0 (the "License");
#include "llvm/Support/type_traits.h" // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef PYSTON_CORE_FROMLLVM_DENSEMAP_H
#define PYSTON_CORE_FROMLLVM_DENSEMAP_H
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <climits> #include <climits>
...@@ -29,7 +43,17 @@ ...@@ -29,7 +43,17 @@
#include <new> #include <new>
#include <utility> #include <utility>
namespace llvm { #include "llvm/ADT/DenseMapInfo.h"
#include "llvm/Support/AlignOf.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/PointerLikeTypeTraits.h"
#include "llvm/Support/type_traits.h"
namespace pyston {
// This should only take effect for this header file:
using namespace llvm;
namespace detail { namespace detail {
// We extend a pair to allow users to override the bucket type with their own // We extend a pair to allow users to override the bucket type with their own
...@@ -1055,6 +1079,6 @@ capacity_in_bytes(const DenseMap<KeyT, ValueT, KeyInfoT> &X) { ...@@ -1055,6 +1079,6 @@ capacity_in_bytes(const DenseMap<KeyT, ValueT, KeyInfoT> &X) {
return X.getMemorySize(); return X.getMemorySize();
} }
} // end namespace llvm } // end namespace pyston
#endif #endif
// This file was copied from https://llvm.org/svn/llvm-project/llvm/trunk/include/llvm/ADT/DenseSet.h?p=230300
// and came with the following license:
//===- llvm/ADT/DenseSet.h - Dense probed hash table ------------*- C++ -*-===// //===- llvm/ADT/DenseSet.h - Dense probed hash table ------------*- C++ -*-===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
...@@ -11,12 +14,29 @@ ...@@ -11,12 +14,29 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef LLVM_ADT_DENSESET_H
#define LLVM_ADT_DENSESET_H
#include "llvm/ADT/DenseMap.h" // Modifications were made for Pyston, using the following license:
// Copyright (c) 2014-2015 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef PYSTON_CORE_FROMLLVM_DENSESET_H
#define PYSTON_CORE_FROMLLVM_DENSESET_H
#include "core/from_llvm/DenseMap.h"
namespace llvm { namespace pyston {
namespace detail { namespace detail {
struct DenseSetEmpty {}; struct DenseSetEmpty {};
...@@ -157,6 +177,6 @@ public: ...@@ -157,6 +177,6 @@ public:
} }
}; };
} // end namespace llvm } // end namespace pyston
#endif #endif
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu set -eu
failed=0 failed=0
for fn in $(find . -name '*.cpp' -o -name '*.h'); do for fn in $(find . -path ./core -prune -o -name '*.cpp' -print -o -name '*.h' -print); do
diff -u $fn <($1 -style=file $fn) || failed=1 diff -u $fn <($1 -style=file $fn) || failed=1
done done
......
#!/usr/bin/env bash
set -eu
for fn in $(find . -path ./core -prune -o -name '*.cpp' -print -o -name '*.h' -print); do
$1 -i --style=file $fn
done
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment