mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Cleanup the simplify_type implementation.
As far as simplify_type is concerned, there are 3 kinds of smart pointers: * const correct: A 'const MyPtr<int> &' produces a 'const int*'. A 'MyPtr<int> &' produces a 'int *'. * always const: Even a 'MyPtr<int> &' produces a 'const int*'. * no const: Even a 'const MyPtr<int> &' produces a 'int*'. This patch then does the following: * Removes the unused specializations. Since they are unused, it is hard to know which kind should be implemented. * Make sure we don't drop const. * Fix the default forwarding so that const correct pointer only need one specialization. * Simplifies the existing specializations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178147 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -149,14 +149,14 @@ private:
|
||||
// casting operators.
|
||||
template<> struct simplify_type<Use> {
|
||||
typedef Value* SimpleType;
|
||||
static SimpleType getSimplifiedValue(const Use &Val) {
|
||||
return static_cast<SimpleType>(Val.get());
|
||||
static SimpleType getSimplifiedValue(Use &Val) {
|
||||
return Val.get();
|
||||
}
|
||||
};
|
||||
template<> struct simplify_type<const Use> {
|
||||
typedef Value* SimpleType;
|
||||
typedef /*const*/ Value* SimpleType;
|
||||
static SimpleType getSimplifiedValue(const Use &Val) {
|
||||
return static_cast<SimpleType>(Val.get());
|
||||
return Val.get();
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user