Fix clang 5.0 by using type aliases for LLVM DenseSet/Map

When inlining the declaration for llvm::DenseSet/DenseMap in the mlir
namespace from a forward declaration, clang does not take the default
for the template parameters if their are declared later.

namespace llvm {
  template<typename Foo>
  class DenseMap;
}
namespace mlir {
  using llvm::DenseMap;
}
namespace llvm {
  template<typename Foo = int>
  class DenseMap {};
}

namespace mlir {
  DenseMap<> map;
}

PiperOrigin-RevId: 261495612
This commit is contained in:
Mehdi Amini 2019-08-03 11:35:22 -07:00 committed by A. Unique TensorFlower
parent 600c47e77b
commit 0c3923e1dc
4 changed files with 7 additions and 5 deletions

View File

@ -73,9 +73,13 @@ using llvm::isa_and_nonnull;
// Containers.
using llvm::ArrayRef;
using llvm::DenseMap;
using llvm::DenseMapInfo;
using llvm::DenseSet;
template <typename KeyT, typename ValueT,
typename KeyInfoT = DenseMapInfo<KeyT>,
typename BucketT = llvm::detail::DenseMapPair<KeyT, ValueT>>
using DenseMap = llvm::DenseMap<KeyT, ValueT, KeyInfoT, BucketT>;
template <typename ValueT, typename ValueInfoT = DenseMapInfo<ValueT>>
using DenseSet = llvm::DenseSet<ValueT, ValueInfoT>;
using llvm::MutableArrayRef;
using llvm::None;
using llvm::Optional;

View File

@ -26,6 +26,7 @@
#include "mlir/IR/Function.h"
#include "mlir/IR/Operation.h"
#include "mlir/Support/Functional.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Support/STLExtras.h"
#include "llvm/ADT/SetVector.h"
@ -35,7 +36,6 @@
using namespace mlir;
using llvm::DenseSet;
using llvm::SetVector;
static void getForwardSliceImpl(Operation *op,

View File

@ -143,7 +143,6 @@
/// ```
using llvm::dbgs;
using llvm::DenseSet;
using llvm::SetVector;
using namespace mlir;

View File

@ -539,7 +539,6 @@ using namespace mlir;
using functional::makePtrDynCaster;
using functional::map;
using llvm::dbgs;
using llvm::DenseSet;
using llvm::SetVector;
static llvm::cl::OptionCategory clOptionsCategory("vectorize options");