c++ - view the default functions generated by a compiler? -
Is there a way to see the default functions generated by a compiler (for example, the default copy constructor, default assignment operator) VC ++ 2008 for the class which does not define them?
With the compiler, you can see them by passing I hope that whatever you have asked. Let's change the code and look again. Note how the contract code constructor of To obtain the generated code, you can use the virtual machine Intermediate can get out of the language. Check the generated code for: Now, I do not understand the intermediate language (which has been defined). But you can translate that code into C. using the llvm compiler: Tada! Notice how this sets the virtual table pointer in the copy constructor and the default constructor. Hope this will help. -st-dump
[js @ HOST2 cpp] $ cat main1.cpp struct A { }; [Js @ HOST2 cpp] $ clag ++ - cc 1 -st-dump man 1 cpp typingfaces four * __ baltin__w_list; Structure A {Public: Structure A; Inline A (); Inline A (structure is a const & amp;;); Inline structure A and operator = (structure a const & amp;;); Inline Zero ~ A (); }; [Js @ HOST2 CPP] $
[js @ HOST2 cpp] $ cat main1.cpp structure M {M (M & M); }; Structure A {Mm; }; [Js @ HOST2 cpp] $ clag ++ - cc 1 -st-dump man 1 cpp typingfaces four * __ baltin_value_list; Structure M {Public: Straight M; M (Structure M & amp;); Inline structure M and operator = (Structure M const & amp;;); Inline zero ~ m (); }; Structure A {Public: Structure A; Structure MM; Inline A (); Inline A (Structure A and;); Inline structure A and operator = (structure a const & amp;;); Inline Zero ~ A (); }; [Js @ HOST2 cpp] $
A
is now a non-constant reference parameter because one of its members (Member m
), and that M
has not been declared as a default constructor
struct A {virtual zeros f (); Int a; }; AF () {AA; A = A (); Return; } // def-ctor, assignment and copy-CTO [js @ HOST2 cpp] using $ clang ++ -cc1 -O1 -emit-llvm -o - main1.cpp | C ++ filt [snippet] Define linkonce_odr void @ a :: a () (% struct.A * nocapture% this) nounwind align 2 {enter:% 0 = getelementptr inbounds% struct.A *% this, i32 0 , I32 0; & Lt; I8 *** & gt; [Uses = 1] Store i8 ** GatementElector Inbound ([3 x i8 *] * @vtable for A, i32 0, i32 2), i8 ***% 0 ret zero} linkonce_odr% struct.A * Define @A: operator = (a const & amp;) (% struct.A *% this,% struct.A * nocapture) alignname nounwind 2 {enter:% tmp = getelementptr inbounds% struct.A * % This, i32 0, i32 1; & Lt; I32 * & gt; [# Usage = 1]% tmp2 = getelementptr inbounds% struct.A *% 0, i32 0, i32 1; & Lt; I32 * & gt; [# Usage = 1]% tmp3 = Load i32 *% tmp2; & Lt; I32 & gt; [Uses = 1] Store i32% tmp3, i32 *% tmp ret% struct.A *% this} Defined linkonce_odr Zero @ A :: A (a const & amp; (% struct.A * nocapture% This,% struct. A * encryption) Align novevnence 2 {Enter:% tmp = gateetext inbound% strait. A *% A, iOS 0, iOS 1; & Lt; I32 * & gt; [# Usage = 1]% tmp2 = getelementptr inbounds% struct.A *% 0, i32 0, i32 1; & Lt; I32 * & gt; [# Usage = 1]% tmp3 = Load i32 *% tmp2; & Lt; I32 & gt; [Uses = 1] Store i32% tmp3, i32 *% tmp% 1 = getelementptr inbounds% struct.A *% this, i32 0, i32 0; & Lt; I8 *** & gt; [# Uses = 1] Store i8 ** GatementElector Inbound ([3 x i8 *] * @vtable for A, i32 0, i322), i8 ***% 1Art zero}
< / Pre>
[js @ HOST2 cpp] $ clang ++ -cc1 -O1 -emit-llvm -o - main1. Cpp | Llc -march = c -o - | C ++ filt [snippet] void A :: A () (struct l_struct.A * llvm_cbe_this) {* ((& amp; llvm_cbe_this-> Field 0)) = ((& amp; _ZTV1A.array [(Signed Ent 2u)])); Return; } Struct l_struct.A * A :: operator = (a const & amp;) (struct l_struct.A * llvm_cbe_this, struct l_struct.A * llvm_cbe_tmp__1) {unsigned int llvm_cbe_tmp3; Llvm_cbe_tmp3 = * ((& amp; llvm_cbe_tmp__1- & gt; Field 1)); * ((& Amp; llvm_cbe_this-> Field 1)) = llvm_cbe_tmp3; Return llvm_cbe_this; } Zero A: A (a const & amp; l (structure l_struct.A * llvm_cbe_this, struct l_struct.A * llvm_cbe_tmp__2) {unsigned int llvm_cbe_tmp3; Llvm_cbe_tmp3 = * ((& amp; llvm_cbe_tmp__2-> Field 1)); * ((& Amp; llvm_cbe_this-> Field 1)) = llvm_cbe_tmp3; * ((& Amp; llvm_cbe_this-> Field 0)) = ((& amp; _ZTV1A.array [((signed Ent) 2u)]))); Return; }
Comments
Post a Comment