[clang] 4c484f1 - [llvm] Add a SFINAE template parameter to DenseMapInfo
Author: River Riddle Date: 2021-11-16T18:54:14Z New Revision: 4c484f11d355e4293f7b245a9330f0a1e89630ac URL: https://github.com/llvm/llvm-project/commit/4c484f11d355e4293f7b245a9330f0a1e89630ac DIFF: https://github.com/llvm/llvm-project/commit/4c484f11d355e4293f7b245a9330f0a1e89630ac.diff LOG: [llvm] Add a SFINAE template parameter to DenseMapInfo This allows for using SFINAE partial specialization for DenseMapInfo. In MLIR, this is particularly useful as it will allow for defining partial specializations that support all Attribute, Op, and Type classes without needing to specialize DenseMapInfo for each individual class. Differential Revision: https://reviews.llvm.org/D113641 Added: Modified: clang/include/clang/AST/TypeOrdering.h clang/include/clang/Basic/SourceLocation.h clang/include/clang/Sema/Sema.h lldb/include/lldb/Utility/ConstString.h llvm/include/llvm/ADT/APInt.h llvm/include/llvm/ADT/APSInt.h llvm/include/llvm/ADT/ArrayRef.h llvm/include/llvm/ADT/DenseMapInfo.h llvm/include/llvm/ADT/Hashing.h llvm/include/llvm/ADT/ImmutableList.h llvm/include/llvm/ADT/PointerIntPair.h llvm/include/llvm/ADT/StringRef.h llvm/include/llvm/BinaryFormat/WasmTraits.h llvm/include/llvm/CodeGen/SelectionDAGNodes.h llvm/include/llvm/IR/Attributes.h llvm/include/llvm/Support/TypeSize.h llvm/lib/Support/APInt.cpp llvm/unittests/ADT/DenseMapTest.cpp mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOps.h mlir/include/mlir/IR/Attributes.h mlir/include/mlir/IR/BuiltinOps.h mlir/include/mlir/IR/OpDefinition.h mlir/include/mlir/IR/Types.h mlir/include/mlir/Support/LLVM.h Removed: diff --git a/clang/include/clang/AST/TypeOrdering.h b/clang/include/clang/AST/TypeOrdering.h index 6630105136f5c..8037f98cc9651 100644 --- a/clang/include/clang/AST/TypeOrdering.h +++ b/clang/include/clang/AST/TypeOrdering.h @@ -34,7 +34,6 @@ struct QualTypeOrdering { } namespace llvm { - template struct DenseMapInfo; template<> struct DenseMapInfo { static inline clang::QualType getEmptyKey() { return clang::QualType(); } diff --git a/clang/include/clang/Basic/SourceLocation.h b/clang/include/clang/Basic/SourceLocation.h index ba2e9156a2b12..543245a811db5 100644 --- a/clang/include/clang/Basic/SourceLocation.h +++ b/clang/include/clang/Basic/SourceLocation.h @@ -23,8 +23,6 @@ namespace llvm { -template struct DenseMapInfo; - class FoldingSetNodeID; template struct FoldingSetTrait; @@ -467,7 +465,7 @@ namespace llvm { /// Define DenseMapInfo so that FileID's can be used as keys in DenseMap and /// DenseSets. template <> - struct DenseMapInfo { + struct DenseMapInfo { static clang::FileID getEmptyKey() { return {}; } @@ -488,7 +486,7 @@ namespace llvm { /// Define DenseMapInfo so that SourceLocation's can be used as keys in /// DenseMap and DenseSet. This trait class is eqivalent to /// DenseMapInfo which uses SourceLocation::ID is used as a key. - template <> struct DenseMapInfo { + template <> struct DenseMapInfo { static clang::SourceLocation getEmptyKey() { constexpr clang::SourceLocation::UIntTy Zero = 0; return clang::SourceLocation::getFromRawEncoding(~Zero); diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 5f5755ef13435..a159be2b5fb17 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -74,7 +74,6 @@ namespace llvm { class APSInt; - template struct DenseMapInfo; template class DenseSet; class SmallBitVector; struct InlineAsmIdentifierInfo; diff --git a/lldb/include/lldb/Utility/ConstString.h b/lldb/include/lldb/Utility/ConstString.h index 52d3556418f6c..2756f1fd72038 100644 --- a/lldb/include/lldb/Utility/ConstString.h +++ b/lldb/include/lldb/Utility/ConstString.h @@ -409,7 +409,7 @@ class ConstString { static size_t StaticMemorySize(); protected: - template friend struct ::llvm::DenseMapInfo; + template friend struct ::llvm::DenseMapInfo; /// Only used by DenseMapInfo. static ConstString FromStringPoolPointer(const char *ptr) { ConstString s; diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h index 71d75db91c103..595cd94b6b8f6 100644 --- a/llvm/include/llvm/ADT/APInt.h +++ b/llvm/include/llvm/ADT/APInt.h @@ -31,7 +31,7 @@ class raw_ostream; template class SmallVectorImpl; template class ArrayRef; template class Optional; -template struct DenseMapInfo; +template struct DenseMapInfo; class APInt; @@ -1817,7 +1817,7 @@ class LLVM_NODISCARD APInt { unsigned BitWidth; ///< The number of bits in this APInt. - friend struct DenseMapInfo; + friend struct DenseMapInfo; friend class APSInt; /// This constructor is used only internally for speed of construction of @@ -2251,7 +2251,7 @@ void StoreIntToMemory(const
[clang] 50d96f5 - [TableGen] Track reference locations of Records/RecordVals
Author: River Riddle Date: 2022-09-27T23:48:16-07:00 New Revision: 50d96f59d0966bdda6b3ac4f8964ed572435b847 URL: https://github.com/llvm/llvm-project/commit/50d96f59d0966bdda6b3ac4f8964ed572435b847 DIFF: https://github.com/llvm/llvm-project/commit/50d96f59d0966bdda6b3ac4f8964ed572435b847.diff LOG: [TableGen] Track reference locations of Records/RecordVals This is extremely useful for language tooling as it allows for providing go-to-def/find-references/etc. for many more situations than what is currently possible. Differential Revision: https://reviews.llvm.org/D134087 Added: Modified: clang/test/TableGen/redefined-group.td llvm/include/llvm/TableGen/Record.h llvm/lib/TableGen/TGLexer.cpp llvm/lib/TableGen/TGLexer.h llvm/lib/TableGen/TGParser.cpp llvm/lib/TableGen/TGParser.h llvm/test/TableGen/ConstraintChecking1.td llvm/test/TableGen/ConstraintChecking2.td llvm/test/TableGen/ConstraintChecking3.td llvm/test/TableGen/ConstraintChecking4.td llvm/test/TableGen/ConstraintChecking5.td llvm/test/TableGen/ConstraintChecking6.td llvm/test/TableGen/ConstraintChecking7.td llvm/test/TableGen/GlobalISelEmitter-setcc.td llvm/test/TableGen/RegisterClass.td llvm/test/TableGen/SchedModelError.td llvm/test/TableGen/generic-tables.td mlir/lib/Tools/tblgen-lsp-server/TableGenServer.cpp Removed: diff --git a/clang/test/TableGen/redefined-group.td b/clang/test/TableGen/redefined-group.td index 5ffeb3011978..558c6775ef4b 100644 --- a/clang/test/TableGen/redefined-group.td +++ b/clang/test/TableGen/redefined-group.td @@ -4,31 +4,31 @@ include "DiagnosticBase.inc" def NamedGroup : DiagGroup<"a">; def InNamedGroup1 : Warning<"">, InGroup>; def InNamedGroup2 : Warning<"">, InGroup < DiagGroup<"a"> >; -// CHECK: redefined-group.td:[[@LINE-3]]:1: error: group 'a' is defined more than once -// CHECK: redefined-group.td:[[@LINE-3]]:1: note: also implicitly defined here -// CHECK: redefined-group.td:[[@LINE-3]]:1: note: also implicitly defined here +// CHECK: redefined-group.td:[[@LINE-3]]:5: error: group 'a' is defined more than once +// CHECK: redefined-group.td:[[@LINE-3]]:5: note: also implicitly defined here +// CHECK: redefined-group.td:[[@LINE-3]]:5: note: also implicitly defined here def : DiagGroup<"b">; def InUnnamedGroup : Warning<"">, InGroup>; // CHECK: redefined-group.td:[[@LINE-2]]:1: error: group 'b' is defined more than once -// CHECK: redefined-group.td:[[@LINE-2]]:1: note: also implicitly defined here +// CHECK: redefined-group.td:[[@LINE-2]]:5: note: also implicitly defined here def ImplicitGroup1 : Warning<"">, InGroup>; def ImplicitGroup2 : Warning<"">, InGroup>; def ImplicitGroup3 : Warning<"">, InGroup>; -// CHECK: redefined-group.td:[[@LINE-4]]:1: error: group 'c' is implicitly defined more than once -// CHECK: redefined-group.td:[[@LINE-4]]:1: note: also implicitly defined here -// CHECK: redefined-group.td:[[@LINE-4]]:1: note: also implicitly defined here +// CHECK: redefined-group.td:[[@LINE-4]]:5: error: group 'c' is implicitly defined more than once +// CHECK: redefined-group.td:[[@LINE-4]]:5: note: also implicitly defined here +// CHECK: redefined-group.td:[[@LINE-4]]:5: note: also implicitly defined here def NamedAndUnnamed : DiagGroup<"d">; def : DiagGroup<"d">; -// CHECK: redefined-group.td:[[@LINE-2]]:1: error: group 'd' is defined more than once +// CHECK: redefined-group.td:[[@LINE-2]]:5: error: group 'd' is defined more than once // CHECK: redefined-group.td:[[@LINE-2]]:1: note: also defined here def : DiagGroup<"e">; def NamedAndUnnamed2 : DiagGroup<"e">; -// CHECK: redefined-group.td:[[@LINE-1]]:1: error: group 'e' is defined more than once +// CHECK: redefined-group.td:[[@LINE-1]]:5: error: group 'e' is defined more than once // CHECK: redefined-group.td:[[@LINE-3]]:1: note: also defined here def InGroupF1 : Warning<"">, InGroup>; @@ -38,6 +38,6 @@ def GroupF : DiagGroup<"f">; def InGroupF3 : Warning<"">, InGroup; def InGroupF4 : Warning<"">, InGroup>; // CHECK: redefined-group.td:[[@LINE-5]]:1: error: group 'f' is defined more than once -// CHECK: redefined-group.td:[[@LINE-7]]:1: note: also implicitly defined here -// CHECK: redefined-group.td:[[@LINE-6]]:1: note: also implicitly defined here -// CHECK: redefined-group.td:[[@LINE-4]]:1: note: also implicitly defined here +// CHECK: redefined-group.td:[[@LINE-7]]:5: note: also implicitly defined here +// CHECK: redefined-group.td:[[@LINE-6]]:5: note: also implicitly defined here +// CHECK: redefined-group.td:[[@LINE-4]]:5: note: also implicitly defined here diff --git a/llvm/include/llvm/TableGen/Record.h b/llvm/include/llvm/TableGen/Record.h index 50df38e695d7..2d44f39973e2 100644 --- a/llvm/include/llvm/TableGen/Record.h +++ b/llvm/include/llvm/TableGen/Record.h @@ -1478,6 +1478,9 @@ class RecordVal { Init *Value;
[clang] [libc] [llvm] [mlir] [TableGen] Change `getValueAsListOfDefs` return const pointer vector (PR #110713)
https://github.com/River707 approved this pull request. https://github.com/llvm/llvm-project/pull/110713 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [mlir] [mlir] Migrate away from std::nullopt (NFC) (PR #145523)
https://github.com/River707 approved this pull request. https://github.com/llvm/llvm-project/pull/145523 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [mlir] [mlir] Migrate away from std::nullopt (NFC) (PR #145523)
@@ -1060,7 +1060,7 @@ makeMatcherAutoMarshall(ReturnType (*Func)(), StringRef MatcherName) { BuildReturnTypeVector::build(RetTypes); return std::make_unique( matcherMarshall0, reinterpret_cast(Func), - MatcherName, RetTypes, std::nullopt); + MatcherName, RetTypes, ArrayRef()); River707 wrote: Was this meant to be included (given the `mlir` in the title) https://github.com/llvm/llvm-project/pull/145523 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits