[cfe-commits] r169705 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/TargetInfo.h include/clang/Sema/Sema.h lib/Basic/Targets.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclAttr.cpp lib/Sema/SemaDeclCXX.cpp test/SemaCXX/virtual-override-x64.cpp test/SemaCXX/virtual-override-x86.cpp
Aaron Ballman
aaron at aaronballman.com
Mon Dec 10 16:07:29 PST 2012
CC_Default is used when there is no specified calling convention, but
the answer to "what is the default calling convention" shouldn't be
"it's default." So the changes clarified that -- the default calling
convention (when no convention is specified) is CC_Default, but when
you ask the target "what is your default calling convention", the
answer is a concrete calling convention.
I do believe the usage is correct this way.
~Aaron
On Mon, Dec 10, 2012 at 6:23 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> On Sun, Dec 9, 2012 at 9:45 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
>> Author: aaronballman
>> Date: Sun Dec 9 11:45:41 2012
>> New Revision: 169705
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=169705&view=rev
>> Log:
>> Virtual method overrides can no longer have mismatched calling conventions. This fixes PR14339.
>>
>> Added:
>> cfe/trunk/test/SemaCXX/virtual-override-x64.cpp
>> cfe/trunk/test/SemaCXX/virtual-override-x86.cpp
>> Modified:
>> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> cfe/trunk/include/clang/Basic/TargetInfo.h
>> cfe/trunk/include/clang/Sema/Sema.h
>> cfe/trunk/lib/Basic/Targets.cpp
>> cfe/trunk/lib/Sema/SemaDecl.cpp
>> cfe/trunk/lib/Sema/SemaDeclAttr.cpp
>> cfe/trunk/lib/Sema/SemaDeclCXX.cpp
>>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=169705&r1=169704&r2=169705&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Sun Dec 9 11:45:41 2012
>> @@ -1135,6 +1135,10 @@
>> "than the function it overrides}1,2">;
>> def note_overridden_virtual_function : Note<
>> "overridden virtual function is here">;
>> +def err_conflicting_overriding_cc_attributes : Error<
>> + "virtual function %0 has different calling convention attributes "
>> + "%diff{($) than the function it overrides (which has calling convention $)|"
>> + "than the function it overrides}1,2">;
>>
>> def err_covariant_return_inaccessible_base : Error<
>> "invalid covariant return for virtual function: %1 is a "
>>
>> Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=169705&r1=169704&r2=169705&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
>> +++ cfe/trunk/include/clang/Basic/TargetInfo.h Sun Dec 9 11:45:41 2012
>> @@ -742,13 +742,19 @@
>>
>> bool isBigEndian() const { return BigEndian; }
>>
>> + enum CallingConvMethodType {
>> + CCMT_Unknown,
>> + CCMT_Member,
>> + CCMT_NonMember
>> + };
>> +
>> /// \brief Gets the default calling convention for the given target and
>> /// declaration context.
>> - virtual CallingConv getDefaultCallingConv() const {
>> + virtual CallingConv getDefaultCallingConv(CallingConvMethodType MT) const {
>> // Not all targets will specify an explicit calling convention that we can
>> // express. This will always do the right thing, even though it's not
>> // an explicit calling convention.
>> - return CC_Default;
>> + return CC_C;
>> }
>
> You're messing with the usage of CC_Default in a really weird way. In
> what cases do we still use it? Are you sure it still works the way
> it's supposed to?
>
> -Eli
More information about the cfe-commits
mailing list