diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-12-10 05:29:38 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-12-10 05:29:38 +0000 |
commit | bfe648303aba4b80724098ece3bc02c6181af119 (patch) | |
tree | fbcb136230753077fab58ab83b87c652ea0d055f /clang/test | |
parent | 24c618e11065d28c5a87a87d982cc03d5e0462bf (diff) | |
download | llvm-bfe648303aba4b80724098ece3bc02c6181af119.zip llvm-bfe648303aba4b80724098ece3bc02c6181af119.tar.gz llvm-bfe648303aba4b80724098ece3bc02c6181af119.tar.bz2 |
Merging r196771:
------------------------------------------------------------------------
r196771 | majnemer | 2013-12-09 02:44:32 -0800 (Mon, 09 Dec 2013) | 17 lines
[-cxx-abi microsoft] Mangle large integral constants correctly
Testing has revealed that large integral constants (i.e. > INT64_MAX)
are always mangled as-if they are negative, even in places where it
would not make sense for them to be negative (like non-type template
parameters of type unsigned long long).
To address this, we change the way we model number mangling: always
mangle as-if our number is an int64_t. This should result in correct
results when we have large unsigned numbers.
N.B. Bizarrely, things that are 32-bit displacements like vbptr offsets
are mangled as-if they are unsigned 32-bit numbers. This is a pretty
egregious waste of space, it would be a 4x savings if we could mangle it
like a signed 32-bit number. Instead, we explicitly cast these
displacements to uint32_t and let the mangler proceed.
------------------------------------------------------------------------
llvm-svn: 196878
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CodeGenCXX/mangle-ms-templates.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/mangle-ms-templates.cpp b/clang/test/CodeGenCXX/mangle-ms-templates.cpp index 713f8e9..514f573 100644 --- a/clang/test/CodeGenCXX/mangle-ms-templates.cpp +++ b/clang/test/CodeGenCXX/mangle-ms-templates.cpp @@ -24,6 +24,18 @@ class IntTemplate { IntTemplate() {} }; +template<long long param> +class LongLongTemplate { + public: + LongLongTemplate() {} +}; + +template<unsigned long long param> +class UnsignedLongLongTemplate { + public: + UnsignedLongLongTemplate() {} +}; + template<> class BoolTemplate<true> { public: @@ -108,6 +120,32 @@ void template_mangling() { IntTemplate<65535> ffff; // CHECK: call {{.*}} @"\01??0?$IntTemplate@$0PPPP@@@QAE@XZ" // X64: call {{.*}} @"\01??0?$IntTemplate@$0PPPP@@@QEAA@XZ" + + IntTemplate<-1> neg_1; +// CHECK: call {{.*}} @"\01??0?$IntTemplate@$0?0@@QAE@XZ" +// X64: call {{.*}} @"\01??0?$IntTemplate@$0?0@@QEAA@XZ" + IntTemplate<-9> neg_9; +// CHECK: call {{.*}} @"\01??0?$IntTemplate@$0?8@@QAE@XZ" +// X64: call {{.*}} @"\01??0?$IntTemplate@$0?8@@QEAA@XZ" + IntTemplate<-10> neg_10; +// CHECK: call {{.*}} @"\01??0?$IntTemplate@$0?9@@QAE@XZ" +// X64: call {{.*}} @"\01??0?$IntTemplate@$0?9@@QEAA@XZ" + IntTemplate<-11> neg_11; +// CHECK: call {{.*}} @"\01??0?$IntTemplate@$0?L@@@QAE@XZ" +// X64: call {{.*}} @"\01??0?$IntTemplate@$0?L@@@QEAA@XZ" + + LongLongTemplate<-9223372036854775807LL-1LL> int64_min; +// CHECK: call {{.*}} @"\01??0?$LongLongTemplate@$0?IAAAAAAAAAAAAAAA@@@QAE@XZ" +// X64: call {{.*}} @"\01??0?$LongLongTemplate@$0?IAAAAAAAAAAAAAAA@@@QEAA@XZ" + LongLongTemplate<9223372036854775807LL> int64_max; +// CHECK: call {{.*}} @"\01??0?$LongLongTemplate@$0HPPPPPPPPPPPPPPP@@@QAE@XZ" +// X64: call {{.*}} @"\01??0?$LongLongTemplate@$0HPPPPPPPPPPPPPPP@@@QEAA@XZ" + UnsignedLongLongTemplate<18446744073709551615ULL> uint64_max; +// CHECK: call {{.*}} @"\01??0?$UnsignedLongLongTemplate@$0?0@@QAE@XZ" +// X64: call {{.*}} @"\01??0?$UnsignedLongLongTemplate@$0?0@@QEAA@XZ" + UnsignedLongLongTemplate<(unsigned long long)-1> uint64_neg_1; +// CHECK: call {{.*}} @"\01??0?$UnsignedLongLongTemplate@$0?0@@QAE@XZ" +// X64: call {{.*}} @"\01??0?$UnsignedLongLongTemplate@$0?0@@QEAA@XZ" } namespace space { |