1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski *
3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file
5*b1cdbd2cSJim Jagielski * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file
7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski *
11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski *
13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the
17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski * under the License.
19*b1cdbd2cSJim Jagielski *
20*b1cdbd2cSJim Jagielski *************************************************************/
21*b1cdbd2cSJim Jagielski
22*b1cdbd2cSJim Jagielski
23*b1cdbd2cSJim Jagielski
24*b1cdbd2cSJim Jagielski // MARKER(update_precomp.py): autogen include statement, do not remove
25*b1cdbd2cSJim Jagielski #include "precompiled_idlc.hxx"
26*b1cdbd2cSJim Jagielski #include <idlc/idlc.hxx>
27*b1cdbd2cSJim Jagielski #include <idlc/errorhandler.hxx>
28*b1cdbd2cSJim Jagielski #include <idlc/astscope.hxx>
29*b1cdbd2cSJim Jagielski #include <idlc/astmodule.hxx>
30*b1cdbd2cSJim Jagielski #include <idlc/astservice.hxx>
31*b1cdbd2cSJim Jagielski #include <idlc/astconstants.hxx>
32*b1cdbd2cSJim Jagielski #include <idlc/astexception.hxx>
33*b1cdbd2cSJim Jagielski #include <idlc/astunion.hxx>
34*b1cdbd2cSJim Jagielski #include <idlc/astenum.hxx>
35*b1cdbd2cSJim Jagielski #include <idlc/astinterface.hxx>
36*b1cdbd2cSJim Jagielski #include <idlc/astoperation.hxx>
37*b1cdbd2cSJim Jagielski #include <idlc/astbasetype.hxx>
38*b1cdbd2cSJim Jagielski #include "idlc/astdeclaration.hxx"
39*b1cdbd2cSJim Jagielski #include "idlc/astparameter.hxx"
40*b1cdbd2cSJim Jagielski #include "idlc/astsequence.hxx"
41*b1cdbd2cSJim Jagielski #include "idlc/asttype.hxx"
42*b1cdbd2cSJim Jagielski #include "idlc/asttypedef.hxx"
43*b1cdbd2cSJim Jagielski
44*b1cdbd2cSJim Jagielski #include "osl/diagnose.h"
45*b1cdbd2cSJim Jagielski
46*b1cdbd2cSJim Jagielski using namespace ::rtl;
47*b1cdbd2cSJim Jagielski
scopeAsDecl(AstScope * pScope)48*b1cdbd2cSJim Jagielski AstDeclaration* SAL_CALL scopeAsDecl(AstScope* pScope)
49*b1cdbd2cSJim Jagielski {
50*b1cdbd2cSJim Jagielski if (pScope == NULL) return NULL;
51*b1cdbd2cSJim Jagielski
52*b1cdbd2cSJim Jagielski switch( pScope->getScopeNodeType() )
53*b1cdbd2cSJim Jagielski {
54*b1cdbd2cSJim Jagielski case NT_service:
55*b1cdbd2cSJim Jagielski case NT_singleton:
56*b1cdbd2cSJim Jagielski return (AstService*)(pScope);
57*b1cdbd2cSJim Jagielski case NT_module:
58*b1cdbd2cSJim Jagielski case NT_root:
59*b1cdbd2cSJim Jagielski return (AstModule*)(pScope);
60*b1cdbd2cSJim Jagielski case NT_constants:
61*b1cdbd2cSJim Jagielski return (AstConstants*)(pScope);
62*b1cdbd2cSJim Jagielski case NT_interface:
63*b1cdbd2cSJim Jagielski return (AstInterface*)(pScope);
64*b1cdbd2cSJim Jagielski case NT_operation:
65*b1cdbd2cSJim Jagielski return (AstOperation*)(pScope);
66*b1cdbd2cSJim Jagielski case NT_exception:
67*b1cdbd2cSJim Jagielski return (AstException*)(pScope);
68*b1cdbd2cSJim Jagielski case NT_union:
69*b1cdbd2cSJim Jagielski return (AstUnion*)(pScope);
70*b1cdbd2cSJim Jagielski case NT_struct:
71*b1cdbd2cSJim Jagielski return (AstStruct*)(pScope);
72*b1cdbd2cSJim Jagielski case NT_enum:
73*b1cdbd2cSJim Jagielski return (AstEnum*)(pScope);
74*b1cdbd2cSJim Jagielski default:
75*b1cdbd2cSJim Jagielski return NULL;
76*b1cdbd2cSJim Jagielski }
77*b1cdbd2cSJim Jagielski }
78*b1cdbd2cSJim Jagielski
declAsScope(AstDeclaration * pDecl)79*b1cdbd2cSJim Jagielski AstScope* SAL_CALL declAsScope(AstDeclaration* pDecl)
80*b1cdbd2cSJim Jagielski {
81*b1cdbd2cSJim Jagielski if (pDecl == NULL) return NULL;
82*b1cdbd2cSJim Jagielski
83*b1cdbd2cSJim Jagielski switch(pDecl->getNodeType())
84*b1cdbd2cSJim Jagielski {
85*b1cdbd2cSJim Jagielski case NT_interface:
86*b1cdbd2cSJim Jagielski return (AstInterface*)(pDecl);
87*b1cdbd2cSJim Jagielski case NT_service:
88*b1cdbd2cSJim Jagielski case NT_singleton:
89*b1cdbd2cSJim Jagielski return (AstService*)(pDecl);
90*b1cdbd2cSJim Jagielski case NT_module:
91*b1cdbd2cSJim Jagielski case NT_root:
92*b1cdbd2cSJim Jagielski return (AstModule*)(pDecl);
93*b1cdbd2cSJim Jagielski case NT_constants:
94*b1cdbd2cSJim Jagielski return (AstConstants*)(pDecl);
95*b1cdbd2cSJim Jagielski case NT_exception:
96*b1cdbd2cSJim Jagielski return (AstException*)(pDecl);
97*b1cdbd2cSJim Jagielski case NT_union:
98*b1cdbd2cSJim Jagielski return (AstUnion*)(pDecl);
99*b1cdbd2cSJim Jagielski case NT_struct:
100*b1cdbd2cSJim Jagielski return (AstStruct*)(pDecl);
101*b1cdbd2cSJim Jagielski case NT_enum:
102*b1cdbd2cSJim Jagielski return (AstEnum*)(pDecl);
103*b1cdbd2cSJim Jagielski case NT_operation:
104*b1cdbd2cSJim Jagielski return (AstOperation*)(pDecl);
105*b1cdbd2cSJim Jagielski default:
106*b1cdbd2cSJim Jagielski return NULL;
107*b1cdbd2cSJim Jagielski }
108*b1cdbd2cSJim Jagielski }
109*b1cdbd2cSJim Jagielski
predefineXInterface(AstModule * pRoot)110*b1cdbd2cSJim Jagielski static void SAL_CALL predefineXInterface(AstModule* pRoot)
111*b1cdbd2cSJim Jagielski {
112*b1cdbd2cSJim Jagielski // define the modules com::sun::star::uno
113*b1cdbd2cSJim Jagielski AstModule* pParentScope = pRoot;
114*b1cdbd2cSJim Jagielski AstModule* pModule = new AstModule(OString("com"), pParentScope);
115*b1cdbd2cSJim Jagielski pModule->setPredefined(true);
116*b1cdbd2cSJim Jagielski pParentScope->addDeclaration(pModule);
117*b1cdbd2cSJim Jagielski pParentScope = pModule;
118*b1cdbd2cSJim Jagielski pModule = new AstModule(OString("sun"), pParentScope);
119*b1cdbd2cSJim Jagielski pModule->setPredefined(true);
120*b1cdbd2cSJim Jagielski pParentScope->addDeclaration(pModule);
121*b1cdbd2cSJim Jagielski pParentScope = pModule;
122*b1cdbd2cSJim Jagielski pModule = new AstModule(OString("star"), pParentScope);
123*b1cdbd2cSJim Jagielski pModule->setPredefined(true);
124*b1cdbd2cSJim Jagielski pParentScope->addDeclaration(pModule);
125*b1cdbd2cSJim Jagielski pParentScope = pModule;
126*b1cdbd2cSJim Jagielski pModule = new AstModule(OString("uno"), pParentScope);
127*b1cdbd2cSJim Jagielski pModule->setPredefined(true);
128*b1cdbd2cSJim Jagielski pParentScope->addDeclaration(pModule);
129*b1cdbd2cSJim Jagielski pParentScope = pModule;
130*b1cdbd2cSJim Jagielski
131*b1cdbd2cSJim Jagielski // define XInterface
132*b1cdbd2cSJim Jagielski AstInterface* pInterface = new AstInterface(OString("XInterface"), NULL, pParentScope);
133*b1cdbd2cSJim Jagielski pInterface->setDefined();
134*b1cdbd2cSJim Jagielski pInterface->setPredefined(true);
135*b1cdbd2cSJim Jagielski pInterface->setPublished();
136*b1cdbd2cSJim Jagielski pParentScope->addDeclaration(pInterface);
137*b1cdbd2cSJim Jagielski
138*b1cdbd2cSJim Jagielski // define XInterface::queryInterface
139*b1cdbd2cSJim Jagielski AstOperation* pOp = new AstOperation(0, (AstType*)(pRoot->lookupPrimitiveType(ET_any)),
140*b1cdbd2cSJim Jagielski OString("queryInterface"), pInterface);
141*b1cdbd2cSJim Jagielski AstParameter* pParam = new AstParameter(DIR_IN, false,
142*b1cdbd2cSJim Jagielski (AstType*)(pRoot->lookupPrimitiveType(ET_type)),
143*b1cdbd2cSJim Jagielski OString("aType"), pOp);
144*b1cdbd2cSJim Jagielski pOp->addDeclaration(pParam);
145*b1cdbd2cSJim Jagielski pInterface->addMember(pOp);
146*b1cdbd2cSJim Jagielski
147*b1cdbd2cSJim Jagielski // define XInterface::acquire
148*b1cdbd2cSJim Jagielski pOp = new AstOperation(1, (AstType*)(pRoot->lookupPrimitiveType(ET_void)),
149*b1cdbd2cSJim Jagielski OString("acquire"), pInterface);
150*b1cdbd2cSJim Jagielski pInterface->addMember(pOp);
151*b1cdbd2cSJim Jagielski
152*b1cdbd2cSJim Jagielski // define XInterface::release
153*b1cdbd2cSJim Jagielski pOp = new AstOperation(1, (AstType*)(pRoot->lookupPrimitiveType(ET_void)),
154*b1cdbd2cSJim Jagielski OString("release"), pInterface);
155*b1cdbd2cSJim Jagielski pInterface->addMember(pOp);
156*b1cdbd2cSJim Jagielski }
157*b1cdbd2cSJim Jagielski
initializePredefinedTypes(AstModule * pRoot)158*b1cdbd2cSJim Jagielski static void SAL_CALL initializePredefinedTypes(AstModule* pRoot)
159*b1cdbd2cSJim Jagielski {
160*b1cdbd2cSJim Jagielski AstBaseType* pPredefined = NULL;
161*b1cdbd2cSJim Jagielski if ( pRoot )
162*b1cdbd2cSJim Jagielski {
163*b1cdbd2cSJim Jagielski pPredefined = new AstBaseType(ET_long, OString("long"), pRoot);
164*b1cdbd2cSJim Jagielski pRoot->addDeclaration(pPredefined);
165*b1cdbd2cSJim Jagielski
166*b1cdbd2cSJim Jagielski pPredefined = new AstBaseType(ET_ulong, OString("unsigned long"), pRoot);
167*b1cdbd2cSJim Jagielski pRoot->addDeclaration(pPredefined);
168*b1cdbd2cSJim Jagielski
169*b1cdbd2cSJim Jagielski pPredefined = new AstBaseType(ET_hyper, OString("hyper"), pRoot);
170*b1cdbd2cSJim Jagielski pRoot->addDeclaration(pPredefined);
171*b1cdbd2cSJim Jagielski
172*b1cdbd2cSJim Jagielski pPredefined = new AstBaseType(ET_uhyper, OString("unsigned hyper"), pRoot);
173*b1cdbd2cSJim Jagielski pRoot->addDeclaration(pPredefined);
174*b1cdbd2cSJim Jagielski
175*b1cdbd2cSJim Jagielski pPredefined = new AstBaseType(ET_short, OString("short"), pRoot);
176*b1cdbd2cSJim Jagielski pRoot->addDeclaration(pPredefined);
177*b1cdbd2cSJim Jagielski
178*b1cdbd2cSJim Jagielski pPredefined = new AstBaseType(ET_ushort, OString("unsigned short"), pRoot);
179*b1cdbd2cSJim Jagielski pRoot->addDeclaration(pPredefined);
180*b1cdbd2cSJim Jagielski
181*b1cdbd2cSJim Jagielski pPredefined = new AstBaseType(ET_float, OString("float"), pRoot);
182*b1cdbd2cSJim Jagielski pRoot->addDeclaration(pPredefined);
183*b1cdbd2cSJim Jagielski
184*b1cdbd2cSJim Jagielski pPredefined = new AstBaseType(ET_double, OString("double"), pRoot);
185*b1cdbd2cSJim Jagielski pRoot->addDeclaration(pPredefined);
186*b1cdbd2cSJim Jagielski
187*b1cdbd2cSJim Jagielski pPredefined = new AstBaseType(ET_char, OString("char"), pRoot);
188*b1cdbd2cSJim Jagielski pRoot->addDeclaration(pPredefined);
189*b1cdbd2cSJim Jagielski
190*b1cdbd2cSJim Jagielski pPredefined = new AstBaseType(ET_byte, OString("byte"), pRoot);
191*b1cdbd2cSJim Jagielski pRoot->addDeclaration(pPredefined);
192*b1cdbd2cSJim Jagielski
193*b1cdbd2cSJim Jagielski pPredefined = new AstBaseType(ET_any, OString("any"), pRoot);
194*b1cdbd2cSJim Jagielski pRoot->addDeclaration(pPredefined);
195*b1cdbd2cSJim Jagielski
196*b1cdbd2cSJim Jagielski pPredefined = new AstBaseType(ET_string, OString("string"), pRoot);
197*b1cdbd2cSJim Jagielski pRoot->addDeclaration(pPredefined);
198*b1cdbd2cSJim Jagielski
199*b1cdbd2cSJim Jagielski pPredefined = new AstBaseType(ET_type, OString("type"), pRoot);
200*b1cdbd2cSJim Jagielski pRoot->addDeclaration(pPredefined);
201*b1cdbd2cSJim Jagielski
202*b1cdbd2cSJim Jagielski pPredefined = new AstBaseType(ET_boolean, OString("boolean"), pRoot);
203*b1cdbd2cSJim Jagielski pRoot->addDeclaration(pPredefined);
204*b1cdbd2cSJim Jagielski
205*b1cdbd2cSJim Jagielski pPredefined = new AstBaseType(ET_void, OString("void"), pRoot);
206*b1cdbd2cSJim Jagielski pRoot->addDeclaration(pPredefined);
207*b1cdbd2cSJim Jagielski }
208*b1cdbd2cSJim Jagielski }
209*b1cdbd2cSJim Jagielski
Idlc(Options * pOptions)210*b1cdbd2cSJim Jagielski Idlc::Idlc(Options* pOptions)
211*b1cdbd2cSJim Jagielski : m_pOptions(pOptions)
212*b1cdbd2cSJim Jagielski , m_bIsDocValid(sal_False)
213*b1cdbd2cSJim Jagielski , m_bIsInMainfile(sal_True)
214*b1cdbd2cSJim Jagielski , m_published(false)
215*b1cdbd2cSJim Jagielski , m_errorCount(0)
216*b1cdbd2cSJim Jagielski , m_warningCount(0)
217*b1cdbd2cSJim Jagielski , m_lineNumber(0)
218*b1cdbd2cSJim Jagielski , m_parseState(PS_NoState)
219*b1cdbd2cSJim Jagielski {
220*b1cdbd2cSJim Jagielski m_pScopes = new AstStack();
221*b1cdbd2cSJim Jagielski // init root object after construction
222*b1cdbd2cSJim Jagielski m_pRoot = NULL;
223*b1cdbd2cSJim Jagielski m_pErrorHandler = new ErrorHandler();
224*b1cdbd2cSJim Jagielski m_bGenerateDoc = m_pOptions->isValid("-C");
225*b1cdbd2cSJim Jagielski }
226*b1cdbd2cSJim Jagielski
~Idlc()227*b1cdbd2cSJim Jagielski Idlc::~Idlc()
228*b1cdbd2cSJim Jagielski {
229*b1cdbd2cSJim Jagielski if (m_pRoot)
230*b1cdbd2cSJim Jagielski delete m_pRoot;
231*b1cdbd2cSJim Jagielski if (m_pScopes)
232*b1cdbd2cSJim Jagielski delete m_pScopes;
233*b1cdbd2cSJim Jagielski if (m_pErrorHandler)
234*b1cdbd2cSJim Jagielski delete m_pErrorHandler;
235*b1cdbd2cSJim Jagielski }
236*b1cdbd2cSJim Jagielski
init()237*b1cdbd2cSJim Jagielski void Idlc::init()
238*b1cdbd2cSJim Jagielski {
239*b1cdbd2cSJim Jagielski if ( m_pRoot )
240*b1cdbd2cSJim Jagielski delete m_pRoot;
241*b1cdbd2cSJim Jagielski
242*b1cdbd2cSJim Jagielski m_pRoot = new AstModule(NT_root, OString(), NULL);
243*b1cdbd2cSJim Jagielski
244*b1cdbd2cSJim Jagielski // push the root node on the stack
245*b1cdbd2cSJim Jagielski m_pScopes->push(m_pRoot);
246*b1cdbd2cSJim Jagielski initializePredefinedTypes(m_pRoot);
247*b1cdbd2cSJim Jagielski predefineXInterface(m_pRoot);
248*b1cdbd2cSJim Jagielski }
249*b1cdbd2cSJim Jagielski
reset()250*b1cdbd2cSJim Jagielski void Idlc::reset()
251*b1cdbd2cSJim Jagielski {
252*b1cdbd2cSJim Jagielski m_bIsDocValid = sal_False;
253*b1cdbd2cSJim Jagielski m_bIsInMainfile = sal_True;
254*b1cdbd2cSJim Jagielski m_published = false;
255*b1cdbd2cSJim Jagielski
256*b1cdbd2cSJim Jagielski m_errorCount = 0;
257*b1cdbd2cSJim Jagielski m_warningCount = 0;
258*b1cdbd2cSJim Jagielski m_lineNumber = 0;
259*b1cdbd2cSJim Jagielski m_parseState = PS_NoState;
260*b1cdbd2cSJim Jagielski
261*b1cdbd2cSJim Jagielski m_fileName = OString();
262*b1cdbd2cSJim Jagielski m_mainFileName = OString();
263*b1cdbd2cSJim Jagielski m_realFileName = OString();
264*b1cdbd2cSJim Jagielski m_documentation = OString();
265*b1cdbd2cSJim Jagielski
266*b1cdbd2cSJim Jagielski m_pScopes->clear();
267*b1cdbd2cSJim Jagielski if ( m_pRoot)
268*b1cdbd2cSJim Jagielski delete m_pRoot;
269*b1cdbd2cSJim Jagielski
270*b1cdbd2cSJim Jagielski m_pRoot = new AstModule(NT_root, OString(), NULL);
271*b1cdbd2cSJim Jagielski
272*b1cdbd2cSJim Jagielski // push the root node on the stack
273*b1cdbd2cSJim Jagielski m_pScopes->push(m_pRoot);
274*b1cdbd2cSJim Jagielski initializePredefinedTypes(m_pRoot);
275*b1cdbd2cSJim Jagielski }
276*b1cdbd2cSJim Jagielski
isDocValid()277*b1cdbd2cSJim Jagielski sal_Bool Idlc::isDocValid()
278*b1cdbd2cSJim Jagielski {
279*b1cdbd2cSJim Jagielski if ( m_bGenerateDoc )
280*b1cdbd2cSJim Jagielski return m_bIsDocValid;
281*b1cdbd2cSJim Jagielski return sal_False;;
282*b1cdbd2cSJim Jagielski }
283*b1cdbd2cSJim Jagielski
284*b1cdbd2cSJim Jagielski static Idlc* pStaticIdlc = NULL;
285*b1cdbd2cSJim Jagielski
idlc()286*b1cdbd2cSJim Jagielski Idlc* SAL_CALL idlc()
287*b1cdbd2cSJim Jagielski {
288*b1cdbd2cSJim Jagielski return pStaticIdlc;
289*b1cdbd2cSJim Jagielski }
290*b1cdbd2cSJim Jagielski
setIdlc(Options * pOptions)291*b1cdbd2cSJim Jagielski Idlc* SAL_CALL setIdlc(Options* pOptions)
292*b1cdbd2cSJim Jagielski {
293*b1cdbd2cSJim Jagielski if ( pStaticIdlc )
294*b1cdbd2cSJim Jagielski {
295*b1cdbd2cSJim Jagielski delete pStaticIdlc;
296*b1cdbd2cSJim Jagielski }
297*b1cdbd2cSJim Jagielski pStaticIdlc = new Idlc(pOptions);
298*b1cdbd2cSJim Jagielski pStaticIdlc->init();
299*b1cdbd2cSJim Jagielski return pStaticIdlc;
300*b1cdbd2cSJim Jagielski }
301*b1cdbd2cSJim Jagielski
resolveTypedefs(AstDeclaration const * type)302*b1cdbd2cSJim Jagielski AstDeclaration const * resolveTypedefs(AstDeclaration const * type) {
303*b1cdbd2cSJim Jagielski if (type != 0) {
304*b1cdbd2cSJim Jagielski while (type->getNodeType() == NT_typedef) {
305*b1cdbd2cSJim Jagielski type = static_cast< AstTypeDef const * >(type)->getBaseType();
306*b1cdbd2cSJim Jagielski }
307*b1cdbd2cSJim Jagielski }
308*b1cdbd2cSJim Jagielski return type;
309*b1cdbd2cSJim Jagielski }
310*b1cdbd2cSJim Jagielski
deconstructAndResolveTypedefs(AstDeclaration const * type,sal_Int32 * rank)311*b1cdbd2cSJim Jagielski AstDeclaration const * deconstructAndResolveTypedefs(
312*b1cdbd2cSJim Jagielski AstDeclaration const * type, sal_Int32 * rank)
313*b1cdbd2cSJim Jagielski {
314*b1cdbd2cSJim Jagielski *rank = 0;
315*b1cdbd2cSJim Jagielski for (;;) {
316*b1cdbd2cSJim Jagielski if (type == 0) {
317*b1cdbd2cSJim Jagielski return 0;
318*b1cdbd2cSJim Jagielski }
319*b1cdbd2cSJim Jagielski switch (type->getNodeType()) {
320*b1cdbd2cSJim Jagielski case NT_typedef:
321*b1cdbd2cSJim Jagielski type = static_cast< AstTypeDef const * >(type)->getBaseType();
322*b1cdbd2cSJim Jagielski break;
323*b1cdbd2cSJim Jagielski case NT_sequence:
324*b1cdbd2cSJim Jagielski ++(*rank);
325*b1cdbd2cSJim Jagielski type = static_cast< AstSequence const * >(type)->getMemberType();
326*b1cdbd2cSJim Jagielski break;
327*b1cdbd2cSJim Jagielski default:
328*b1cdbd2cSJim Jagielski return type;
329*b1cdbd2cSJim Jagielski }
330*b1cdbd2cSJim Jagielski }
331*b1cdbd2cSJim Jagielski }
332*b1cdbd2cSJim Jagielski
resolveInterfaceTypedefs(AstType const * type)333*b1cdbd2cSJim Jagielski AstInterface const * resolveInterfaceTypedefs(AstType const * type) {
334*b1cdbd2cSJim Jagielski AstDeclaration const * decl = resolveTypedefs(type);
335*b1cdbd2cSJim Jagielski OSL_ASSERT(decl->getNodeType() == NT_interface);
336*b1cdbd2cSJim Jagielski return static_cast< AstInterface const * >(decl);
337*b1cdbd2cSJim Jagielski }
338