[asterisk-scf-commits] asterisk-scf/integration/ice.git branch "inline-improvements" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Mon Mar 7 18:15:41 CST 2011
branch "inline-improvements" has been created
at 7b9c036e221b19b4a7f636e20a6ffaa4b6dacfef (commit)
- Log -----------------------------------------------------------------
commit 7b9c036e221b19b4a7f636e20a6ffaa4b6dacfef
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Mon Mar 7 18:14:50 2011 -0600
Generate constructors that take arguments and ice_staticId functions in the
header file so they can be inlined.
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 9442aea..996e7c4 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -1036,14 +1036,12 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
H << nl;
if(p->hasDefaultValues())
{
- H << nl << name << "();";
-
- C << sp << nl << fixKwd(p->scoped()).substr(2) << "::" << fixKwd(p->name()) << "() :";
- C.inc();
- writeDataMemberInitializers(C, dataMembers, _useWstring);
- C.dec();
- C << sb;
- C << eb;
+ H << nl << name << "() :";
+ H.inc();
+ writeDataMemberInitializers(H, dataMembers, _useWstring);
+ H.dec();
+ H << sb;
+ H << eb;
}
else
{
@@ -1056,14 +1054,12 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
H << sb;
if(p->hasDefaultValues())
{
- H << nl << name << "();";
-
- C << sp << nl << fixKwd(p->scoped()).substr(2) << "::" << fixKwd(p->name()) << "() :";
- C.inc();
- writeDataMemberInitializers(C, dataMembers, _useWstring);
- C.dec();
- C << sb;
- C << eb;
+ H << nl << name << "() :";
+ H.inc();
+ writeDataMemberInitializers(H, dataMembers, _useWstring);
+ H.dec();
+ H << sb;
+ H << eb;
}
}
@@ -1083,34 +1079,30 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
paramDecls.push_back(typeName + " __ice_" + (*q)->name());
}
- H << nl;
+ H << sp << nl;
if(paramDecls.size() == 1)
{
H << "explicit ";
}
- H << name << spar << types << epar << ';';
-
- C << sp << nl << fixKwd(p->scoped()).substr(2) << "::"
- << fixKwd(p->name()) << spar << paramDecls << epar << " :";
- C.inc();
+ H << fixKwd(p->name()) << spar << paramDecls << epar << " :";
+ H.inc();
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
if(q != dataMembers.begin())
{
- C << ',';
+ H << ',';
}
string memberName = fixKwd((*q)->name());
- C << nl << memberName << '(' << "__ice_" << (*q)->name() << ')';
+ H << nl << memberName << '(' << "__ice_" << (*q)->name() << ')';
}
- C.dec();
- C << sb;
- C << eb;
+ H.dec();
+ H << sb;
+ H << eb;
+ H << nl;
}
- H << sp;
-
return true;
}
@@ -1193,7 +1185,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
if(!p->isLocal())
{
//
- // None of these member functions is virtual!
+ // None of these member functions are virtual!
//
H << sp << nl << dllExport << "void __write(::IceInternal::BasicStream*) const;";
H << nl << dllExport << "void __read(::IceInternal::BasicStream*);";
@@ -3724,7 +3716,6 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
DataMemberList dataMembers = p->dataMembers();
DataMemberList allDataMembers = p->allDataMembers();
-
H << sp << nl << "class " << _dllExport << name << " : ";
H.useCurrentPosAsIndent();
if(bases.empty())
@@ -3775,7 +3766,6 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
H << nl << "typedef " << p->name() << "Prx ProxyType;";
}
H << nl << "typedef " << p->name() << "Ptr PointerType;";
- H << nl;
vector<string> params;
vector<string> allTypes;
@@ -3798,27 +3788,16 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
{
if(p->hasDefaultValues())
{
- H << nl << name << "();";
-
- C << sp << nl << scoped.substr(2) << "::" << name << "() :";
- C.inc();
- writeDataMemberInitializers(C, dataMembers, _useWstring);
- C.dec();
- C << sb;
- C << eb;
+ H << sp << nl << name << "() :";
+ H.inc();
+ writeDataMemberInitializers(H, dataMembers, _useWstring);
+ H.dec();
+ H << sb << eb;
}
else
{
- H << nl << name << "() {}";
- }
- if(!allParamDecls.empty())
- {
- H << nl;
- if(allParamDecls.size() == 1)
- {
- H << "explicit ";
- }
- H << name << spar << allTypes << epar << ';';
+ H << sp << nl << name << "()";
+ H << sb << eb;
}
/*
@@ -3862,6 +3841,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
*/
emitOneShotConstructor(p);
+ H << sp;
/*
* Strong guarantee
@@ -3989,7 +3969,11 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
H << nl << "virtual ::std::vector< ::std::string> ice_ids"
<< "(const ::Ice::Current& = ::Ice::Current()) const;";
H << nl << "virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::Current()) const;";
- H << nl << "static const ::std::string& ice_staticId();";
+ H << nl << "static const ::std::string& ice_staticId()";
+ H << sb;
+ H << nl << "static const ::std::string __ice_staticId = " << '"' << p->scoped() << '"' << ";";
+ H << nl << "return __ice_staticId;";
+ H << eb;
if(!dataMembers.empty())
{
H << sp;
@@ -4034,12 +4018,6 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
C << nl << "return " << flatName << '[' << scopedPos << "];";
C << eb;
- C << sp;
- C << nl << "const ::std::string&" << nl << scoped.substr(2) << "::ice_staticId()";
- C << sb;
- C << nl << "return " << flatName << '[' << scopedPos << "];";
- C << eb;
-
emitGCFunctions(p);
}
@@ -5044,7 +5022,7 @@ Slice::Gen::ObjectVisitor::emitVirtualBaseInitializers(const ClassDefPtr& p, boo
{
if(emitVirtualBaseInitializers(bases.front(), virtualInheritance))
{
- C << ',';
+ H << ',';
}
}
}
@@ -5061,18 +5039,18 @@ Slice::Gen::ObjectVisitor::emitVirtualBaseInitializers(const ClassDefPtr& p, boo
}
upcall += ")";
- C.zeroIndent();
- C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug";
- C.restoreIndent();
- C << nl << fixKwd(p->name()) << upcall;
- C.zeroIndent();
- C << nl << "#else";
- C.restoreIndent();
- C << nl << fixKwd(p->scoped()) << upcall;
- C.zeroIndent();
- C << nl << "#endif";
- C << nl;
- C.restoreIndent();
+ H.zeroIndent();
+ H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug";
+ H.restoreIndent();
+ H << nl << fixKwd(p->name()) << upcall;
+ H.zeroIndent();
+ H << nl << "#else";
+ H.restoreIndent();
+ H << nl << fixKwd(p->scoped()) << upcall;
+ H.zeroIndent();
+ H << nl << "#endif";
+ H << nl;
+ H.restoreIndent();
return true;
}
@@ -5081,21 +5059,25 @@ void
Slice::Gen::ObjectVisitor::emitOneShotConstructor(const ClassDefPtr& p)
{
DataMemberList allDataMembers = p->allDataMembers();
- DataMemberList::const_iterator q;
-
- vector<string> allParamDecls;
-
- for(q = allDataMembers.begin(); q != allDataMembers.end(); ++q)
- {
- string typeName = inputTypeToString((*q)->type(), (*q)->getMetaData(), _useWstring);
- allParamDecls.push_back(typeName + " __ice_" + (*q)->name());
- }
if(!allDataMembers.empty())
{
- C << sp << nl << fixKwd(p->scoped()).substr(2) << "::" << fixKwd(p->name())
- << spar << allParamDecls << epar << " :";
- C.inc();
+ DataMemberList::const_iterator q;
+ vector<string> allParamDecls;
+
+ for(q = allDataMembers.begin(); q != allDataMembers.end(); ++q)
+ {
+ string typeName = inputTypeToString((*q)->type(), (*q)->getMetaData(), _useWstring);
+ allParamDecls.push_back(typeName + " __ice_" + (*q)->name());
+ }
+
+ H << sp << nl;
+ if(allParamDecls.size() == 1)
+ {
+ H << "explicit ";
+ }
+ H << fixKwd(p->name()) << spar << allParamDecls << epar << " :";
+ H.inc();
DataMemberList dataMembers = p->dataMembers();
@@ -5107,28 +5089,28 @@ Slice::Gen::ObjectVisitor::emitOneShotConstructor(const ClassDefPtr& p)
{
if(!dataMembers.empty())
{
- C << ',';
+ H << ',';
}
}
}
if(!dataMembers.empty())
{
- C << nl;
+ H << nl;
}
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
if(q != dataMembers.begin())
{
- C << ',' << nl;
+ H << ',' << nl;
}
string memberName = fixKwd((*q)->name());
- C << memberName << '(' << "__ice_" << (*q)->name() << ')';
+ H << memberName << '(' << "__ice_" << (*q)->name() << ')';
}
- C.dec();
- C << sb;
- C << eb;
+ H.dec();
+ H << sb;
+ H << eb;
}
}
-----------------------------------------------------------------------
--
asterisk-scf/integration/ice.git
More information about the asterisk-scf-commits
mailing list