summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorJay Foad <jay.foad@gmail.com>2011-06-22 08:50:06 +0000
committerJay Foad <jay.foad@gmail.com>2011-06-22 08:50:06 +0000
commit2a4a6fecf0b8c92223f8fdf19545b564b7d3fcde (patch)
tree09f247bb053efcc97691d90d131c424a76ba1db3 /include/llvm
parent4383c282af954e4f65ae3b77c891fa41a4960a2a (diff)
downloadllvm-2a4a6fecf0b8c92223f8fdf19545b564b7d3fcde.tar.gz
llvm-2a4a6fecf0b8c92223f8fdf19545b564b7d3fcde.tar.bz2
llvm-2a4a6fecf0b8c92223f8fdf19545b564b7d3fcde.tar.xz
Extend ConstantUniqueMap with a new template parameter ValRefType,
representing a constant reference to ValType. Normally this is just "const ValType &", but when ValType is a std::vector we want to use ArrayRef as the reference type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133611 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/ADT/ArrayRef.h7
-rw-r--r--include/llvm/InlineAsm.h7
2 files changed, 11 insertions, 3 deletions
diff --git a/include/llvm/ADT/ArrayRef.h b/include/llvm/ADT/ArrayRef.h
index 97e42cb266..a7e268b099 100644
--- a/include/llvm/ADT/ArrayRef.h
+++ b/include/llvm/ADT/ArrayRef.h
@@ -125,6 +125,13 @@ namespace llvm {
}
/// @}
+ /// @name Conversion operators
+ /// @{
+ operator std::vector<T>() const {
+ return std::vector<T>(Data, Data+Length);
+ }
+
+ /// @}
};
// ArrayRefs can be treated like a POD type.
diff --git a/include/llvm/InlineAsm.h b/include/llvm/InlineAsm.h
index ed8f0f7f61..0d8608605d 100644
--- a/include/llvm/InlineAsm.h
+++ b/include/llvm/InlineAsm.h
@@ -25,15 +25,16 @@ class PointerType;
class FunctionType;
class Module;
struct InlineAsmKeyType;
-template<class ValType, class TypeClass, class ConstantClass, bool HasLargeKey>
+template<class ValType, class ValRefType, class TypeClass, class ConstantClass,
+ bool HasLargeKey>
class ConstantUniqueMap;
template<class ConstantClass, class TypeClass, class ValType>
struct ConstantCreator;
class InlineAsm : public Value {
friend struct ConstantCreator<InlineAsm, PointerType, InlineAsmKeyType>;
- friend class ConstantUniqueMap<InlineAsmKeyType, PointerType, InlineAsm,
- false>;
+ friend class ConstantUniqueMap<InlineAsmKeyType, const InlineAsmKeyType&,
+ PointerType, InlineAsm, false>;
InlineAsm(const InlineAsm &); // do not implement
void operator=(const InlineAsm&); // do not implement