2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
**
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-05-06 15:05:37 +02:00
|
|
|
** Nokia at info@qt.nokia.com.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-02 12:01:29 +01:00
|
|
|
// Copyright (c) 2008 Roberto Raggi <roberto.raggi@gmail.com>
|
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
// of this software and associated documentation files (the "Software"), to deal
|
|
|
|
// in the Software without restriction, including without limitation the rights
|
|
|
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
// copies of the Software, and to permit persons to whom the Software is
|
|
|
|
// furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
// THE SOFTWARE.
|
|
|
|
|
|
|
|
#include "Control.h"
|
|
|
|
#include "Literals.h"
|
|
|
|
#include "LiteralTable.h"
|
|
|
|
#include "TranslationUnit.h"
|
|
|
|
#include "CoreTypes.h"
|
|
|
|
#include "Symbols.h"
|
|
|
|
#include "Names.h"
|
2009-11-23 12:42:28 +01:00
|
|
|
#include "TypeMatcher.h"
|
2009-11-30 18:13:08 +01:00
|
|
|
#include <map>
|
|
|
|
#include <set>
|
2010-08-10 14:40:27 +02:00
|
|
|
#include <algorithm>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-10-20 11:21:25 +02:00
|
|
|
using namespace CPlusPlus;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-11-30 18:13:08 +01:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
template <typename _Tp>
|
|
|
|
struct Compare;
|
|
|
|
|
|
|
|
template <> struct Compare<IntegerType>
|
|
|
|
{
|
|
|
|
bool operator()(const IntegerType &ty, const IntegerType &otherTy) const
|
|
|
|
{ return ty.kind() < otherTy.kind(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
template <> struct Compare<FloatType>
|
|
|
|
{
|
|
|
|
bool operator()(const FloatType &ty, const FloatType &otherTy) const
|
|
|
|
{ return ty.kind() < otherTy.kind(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
template <> struct Compare<PointerToMemberType>
|
|
|
|
{
|
|
|
|
bool operator()(const PointerToMemberType &ty, const PointerToMemberType &otherTy) const
|
|
|
|
{
|
|
|
|
if (ty.memberName() < otherTy.memberName())
|
|
|
|
return true;
|
|
|
|
|
|
|
|
else if (ty.memberName() == otherTy.memberName())
|
|
|
|
return ty.elementType() < otherTy.elementType();
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <> struct Compare<PointerType>
|
|
|
|
{
|
|
|
|
bool operator()(const PointerType &ty, const PointerType &otherTy) const
|
|
|
|
{
|
|
|
|
return ty.elementType() < otherTy.elementType();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <> struct Compare<ReferenceType>
|
|
|
|
{
|
|
|
|
bool operator()(const ReferenceType &ty, const ReferenceType &otherTy) const
|
|
|
|
{
|
|
|
|
return ty.elementType() < otherTy.elementType();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <> struct Compare<NamedType>
|
|
|
|
{
|
|
|
|
bool operator()(const NamedType &ty, const NamedType &otherTy) const
|
|
|
|
{
|
|
|
|
return ty.name() < otherTy.name();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <> struct Compare<ArrayType>
|
|
|
|
{
|
|
|
|
bool operator()(const ArrayType &ty, const ArrayType &otherTy) const
|
|
|
|
{
|
|
|
|
if (ty.size() < otherTy.size())
|
|
|
|
return true;
|
|
|
|
|
|
|
|
else if (ty.size() == otherTy.size())
|
|
|
|
return ty.elementType() < otherTy.elementType();
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-12-01 14:38:42 +01:00
|
|
|
template <> struct Compare<DestructorNameId>
|
|
|
|
{
|
|
|
|
bool operator()(const DestructorNameId &name, const DestructorNameId &otherName) const
|
|
|
|
{
|
|
|
|
return name.identifier() < otherName.identifier();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <> struct Compare<OperatorNameId>
|
|
|
|
{
|
|
|
|
bool operator()(const OperatorNameId &name, const OperatorNameId &otherName) const
|
|
|
|
{
|
|
|
|
return name.kind() < otherName.kind();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <> struct Compare<ConversionNameId>
|
|
|
|
{
|
|
|
|
bool operator()(const ConversionNameId &name, const ConversionNameId &otherName) const
|
|
|
|
{
|
|
|
|
return name.type() < otherName.type();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
template <> struct Compare<TemplateNameId>
|
|
|
|
{
|
|
|
|
bool operator()(const TemplateNameId &name, const TemplateNameId &otherName) const
|
|
|
|
{
|
|
|
|
const Identifier *id = name.identifier();
|
|
|
|
const Identifier *otherId = otherName.identifier();
|
|
|
|
|
|
|
|
if (id == otherId)
|
|
|
|
return std::lexicographical_compare(name.firstTemplateArgument(), name.lastTemplateArgument(),
|
|
|
|
otherName.firstTemplateArgument(), otherName.lastTemplateArgument());
|
|
|
|
|
|
|
|
return id < otherId;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
template <> struct Compare<QualifiedNameId>
|
|
|
|
{
|
|
|
|
bool operator()(const QualifiedNameId &name, const QualifiedNameId &otherName) const
|
|
|
|
{
|
2010-07-12 13:41:54 +02:00
|
|
|
if (name.base() == otherName.base())
|
|
|
|
return name.name() < otherName.name();
|
2009-12-01 14:38:42 +01:00
|
|
|
|
2010-07-12 13:41:54 +02:00
|
|
|
return name.base() < otherName.base();
|
2009-12-01 14:38:42 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <> struct Compare<SelectorNameId>
|
|
|
|
{
|
|
|
|
bool operator()(const SelectorNameId &name, const SelectorNameId &otherName) const
|
|
|
|
{
|
|
|
|
if (name.hasArguments() == otherName.hasArguments())
|
|
|
|
return std::lexicographical_compare(name.firstName(), name.lastName(),
|
|
|
|
otherName.firstName(), otherName.lastName());
|
|
|
|
|
|
|
|
return name.hasArguments() < otherName.hasArguments();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-11-30 18:13:08 +01:00
|
|
|
template <typename _Tp>
|
|
|
|
class Table: public std::set<_Tp, Compare<_Tp> >
|
|
|
|
{
|
2010-01-14 14:12:40 +01:00
|
|
|
typedef std::set<_Tp, Compare<_Tp> > _Base;
|
2009-11-30 18:13:08 +01:00
|
|
|
public:
|
|
|
|
_Tp *intern(const _Tp &element)
|
2010-01-14 14:12:40 +01:00
|
|
|
{ return const_cast<_Tp *>(&*_Base::insert(element).first); }
|
2009-11-30 18:13:08 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end of anonymous namespace
|
|
|
|
|
2010-02-09 15:36:00 +10:00
|
|
|
#ifdef Q_OS_SYMBIAN
|
2010-02-03 13:21:08 +10:00
|
|
|
//Symbian compiler has some difficulties to understand the templates.
|
|
|
|
static void delete_array_entries(std::vector<Symbol *> vt)
|
|
|
|
{
|
|
|
|
std::vector<Symbol *>::iterator it;
|
|
|
|
for (it = vt.begin(); it != vt.end(); ++it) {
|
|
|
|
delete *it;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
2009-11-30 17:37:08 +01:00
|
|
|
template <typename _Iterator>
|
|
|
|
static void delete_array_entries(_Iterator first, _Iterator last)
|
|
|
|
{
|
|
|
|
for (; first != last; ++first)
|
|
|
|
delete *first;
|
|
|
|
}
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
template <typename _Array>
|
|
|
|
static void delete_array_entries(const _Array &a)
|
2009-11-30 17:37:08 +01:00
|
|
|
{ delete_array_entries(a.begin(), a.end()); }
|
2010-02-03 13:21:08 +10:00
|
|
|
#endif
|
2009-11-23 12:42:28 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
class Control::Data
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Data(Control *control)
|
2010-06-04 10:48:38 +02:00
|
|
|
: control(control)
|
|
|
|
, translationUnit(0)
|
|
|
|
, diagnosticClient(0)
|
|
|
|
, deprecatedId(0)
|
|
|
|
, unavailableId(0)
|
|
|
|
, objcGetterId(0)
|
|
|
|
, objcSetterId(0)
|
|
|
|
, objcReadwriteId(0)
|
|
|
|
, objcReadonlyId(0)
|
|
|
|
, objcAssignId(0)
|
|
|
|
, objcRetainId(0)
|
|
|
|
, objcCopyId(0)
|
|
|
|
, objcNonatomicId(0)
|
2011-02-04 16:26:10 +01:00
|
|
|
, processor(0)
|
2009-10-20 13:50:36 +02:00
|
|
|
{}
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
~Data()
|
|
|
|
{
|
|
|
|
// symbols
|
2009-11-23 13:27:57 +01:00
|
|
|
delete_array_entries(symbols);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-12-01 14:38:42 +01:00
|
|
|
template <typename _Iterator>
|
|
|
|
const TemplateNameId *findOrInsertTemplateNameId(const Identifier *id, _Iterator first, _Iterator last)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-12-01 14:38:42 +01:00
|
|
|
return templateNameIds.intern(TemplateNameId(id, first, last));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
const DestructorNameId *findOrInsertDestructorNameId(const Identifier *id)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-12-01 14:38:42 +01:00
|
|
|
return destructorNameIds.intern(DestructorNameId(id));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-09-03 12:11:15 +02:00
|
|
|
const OperatorNameId *findOrInsertOperatorNameId(OperatorNameId::Kind kind)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-12-01 14:38:42 +01:00
|
|
|
return operatorNameIds.intern(OperatorNameId(kind));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
const ConversionNameId *findOrInsertConversionNameId(const FullySpecifiedType &type)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-12-01 14:38:42 +01:00
|
|
|
return conversionNameIds.intern(ConversionNameId(type));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-07-12 13:41:54 +02:00
|
|
|
const QualifiedNameId *findOrInsertQualifiedNameId(const Name *base, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-07-12 13:41:54 +02:00
|
|
|
return qualifiedNameIds.intern(QualifiedNameId(base, name));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-12-01 14:38:42 +01:00
|
|
|
template <typename _Iterator>
|
|
|
|
const SelectorNameId *findOrInsertSelectorNameId(_Iterator first, _Iterator last, bool hasArguments)
|
2009-07-31 16:03:48 +02:00
|
|
|
{
|
2009-12-01 14:38:42 +01:00
|
|
|
return selectorNameIds.intern(SelectorNameId(first, last, hasArguments));
|
2009-07-31 16:03:48 +02:00
|
|
|
}
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
IntegerType *findOrInsertIntegerType(int kind)
|
|
|
|
{
|
2009-11-30 18:13:08 +01:00
|
|
|
return integerTypes.intern(IntegerType(kind));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
FloatType *findOrInsertFloatType(int kind)
|
|
|
|
{
|
2009-11-30 18:13:08 +01:00
|
|
|
return floatTypes.intern(FloatType(kind));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
PointerToMemberType *findOrInsertPointerToMemberType(const Name *memberName, const FullySpecifiedType &elementType)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-11-30 18:13:08 +01:00
|
|
|
return pointerToMemberTypes.intern(PointerToMemberType(memberName, elementType));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-11-17 14:37:45 +01:00
|
|
|
PointerType *findOrInsertPointerType(const FullySpecifiedType &elementType)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-11-30 18:13:08 +01:00
|
|
|
return pointerTypes.intern(PointerType(elementType));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-03-23 12:11:33 +01:00
|
|
|
ReferenceType *findOrInsertReferenceType(const FullySpecifiedType &elementType, bool rvalueRef)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-03-23 12:11:33 +01:00
|
|
|
return referenceTypes.intern(ReferenceType(elementType, rvalueRef));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-11-23 12:42:28 +01:00
|
|
|
ArrayType *findOrInsertArrayType(const FullySpecifiedType &elementType, unsigned size)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-11-30 18:13:08 +01:00
|
|
|
return arrayTypes.intern(ArrayType(elementType, size));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
NamedType *findOrInsertNamedType(const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-11-30 18:13:08 +01:00
|
|
|
return namedTypes.intern(NamedType(name));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
Declaration *newDeclaration(unsigned sourceLocation, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-08-11 13:46:32 +02:00
|
|
|
Declaration *declaration = new Declaration(translationUnit, sourceLocation, name);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(declaration);
|
2008-12-02 12:01:29 +01:00
|
|
|
return declaration;
|
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
Argument *newArgument(unsigned sourceLocation, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-08-11 13:46:32 +02:00
|
|
|
Argument *argument = new Argument(translationUnit, sourceLocation, name);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(argument);
|
2008-12-02 12:01:29 +01:00
|
|
|
return argument;
|
|
|
|
}
|
|
|
|
|
2009-12-08 11:58:27 +01:00
|
|
|
TypenameArgument *newTypenameArgument(unsigned sourceLocation, const Name *name)
|
|
|
|
{
|
2010-08-11 13:46:32 +02:00
|
|
|
TypenameArgument *argument = new TypenameArgument(translationUnit, sourceLocation, name);
|
2009-12-08 11:58:27 +01:00
|
|
|
symbols.push_back(argument);
|
|
|
|
return argument;
|
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
Function *newFunction(unsigned sourceLocation, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-08-11 13:46:32 +02:00
|
|
|
Function *function = new Function(translationUnit, sourceLocation, name);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(function);
|
2008-12-02 12:01:29 +01:00
|
|
|
return function;
|
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
BaseClass *newBaseClass(unsigned sourceLocation, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-08-11 13:46:32 +02:00
|
|
|
BaseClass *baseClass = new BaseClass(translationUnit, sourceLocation, name);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(baseClass);
|
2008-12-02 12:01:29 +01:00
|
|
|
return baseClass;
|
|
|
|
}
|
|
|
|
|
|
|
|
Block *newBlock(unsigned sourceLocation)
|
|
|
|
{
|
|
|
|
Block *block = new Block(translationUnit, sourceLocation);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(block);
|
2008-12-02 12:01:29 +01:00
|
|
|
return block;
|
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
Class *newClass(unsigned sourceLocation, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-08-11 13:46:32 +02:00
|
|
|
Class *klass = new Class(translationUnit, sourceLocation, name);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(klass);
|
2008-12-02 12:01:29 +01:00
|
|
|
return klass;
|
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
Namespace *newNamespace(unsigned sourceLocation, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-08-11 13:46:32 +02:00
|
|
|
Namespace *ns = new Namespace(translationUnit, sourceLocation, name);
|
|
|
|
symbols.push_back(ns);
|
|
|
|
return ns;
|
|
|
|
}
|
|
|
|
|
|
|
|
Template *newTemplate(unsigned sourceLocation, const Name *name)
|
|
|
|
{
|
|
|
|
Template *ns = new Template(translationUnit, sourceLocation, name);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(ns);
|
2008-12-02 12:01:29 +01:00
|
|
|
return ns;
|
|
|
|
}
|
|
|
|
|
2010-05-05 10:18:11 +02:00
|
|
|
NamespaceAlias *newNamespaceAlias(unsigned sourceLocation, const Name *name)
|
|
|
|
{
|
2010-08-11 13:46:32 +02:00
|
|
|
NamespaceAlias *ns = new NamespaceAlias(translationUnit, sourceLocation, name);
|
2010-05-05 10:18:11 +02:00
|
|
|
symbols.push_back(ns);
|
|
|
|
return ns;
|
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
UsingNamespaceDirective *newUsingNamespaceDirective(unsigned sourceLocation, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-08-11 13:46:32 +02:00
|
|
|
UsingNamespaceDirective *u = new UsingNamespaceDirective(translationUnit, sourceLocation, name);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(u);
|
2008-12-02 12:01:29 +01:00
|
|
|
return u;
|
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
ForwardClassDeclaration *newForwardClassDeclaration(unsigned sourceLocation, const Name *name)
|
2009-02-16 15:43:24 +01:00
|
|
|
{
|
2010-08-11 13:46:32 +02:00
|
|
|
ForwardClassDeclaration *c = new ForwardClassDeclaration(translationUnit, sourceLocation, name);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(c);
|
2009-02-16 15:43:24 +01:00
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
2010-12-06 12:16:45 +01:00
|
|
|
QtPropertyDeclaration *newQtPropertyDeclaration(unsigned sourceLocation, const Name *name)
|
|
|
|
{
|
|
|
|
QtPropertyDeclaration *d = new QtPropertyDeclaration(translationUnit, sourceLocation, name);
|
|
|
|
symbols.push_back(d);
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
2010-12-06 13:10:09 +01:00
|
|
|
QtEnum *newQtEnum(unsigned sourceLocation, const Name *name)
|
|
|
|
{
|
|
|
|
QtEnum *d = new QtEnum(translationUnit, sourceLocation, name);
|
|
|
|
symbols.push_back(d);
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
ObjCBaseClass *newObjCBaseClass(unsigned sourceLocation, const Name *name)
|
2009-10-05 18:02:01 +02:00
|
|
|
{
|
|
|
|
ObjCBaseClass *c = new ObjCBaseClass(translationUnit, sourceLocation, name);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(c);
|
2009-10-05 18:02:01 +02:00
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
ObjCBaseProtocol *newObjCBaseProtocol(unsigned sourceLocation, const Name *name)
|
2009-10-05 18:02:01 +02:00
|
|
|
{
|
|
|
|
ObjCBaseProtocol *p = new ObjCBaseProtocol(translationUnit, sourceLocation, name);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(p);
|
2009-10-05 18:02:01 +02:00
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
ObjCClass *newObjCClass(unsigned sourceLocation, const Name *name)
|
2009-07-28 16:34:15 +02:00
|
|
|
{
|
|
|
|
ObjCClass *c = new ObjCClass(translationUnit, sourceLocation, name);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(c);
|
2009-07-28 16:34:15 +02:00
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
ObjCForwardClassDeclaration *newObjCForwardClassDeclaration(unsigned sourceLocation, const Name *name)
|
2009-07-28 16:34:15 +02:00
|
|
|
{
|
|
|
|
ObjCForwardClassDeclaration *fwd = new ObjCForwardClassDeclaration(translationUnit, sourceLocation, name);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(fwd);
|
2009-07-28 16:34:15 +02:00
|
|
|
return fwd;
|
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
ObjCProtocol *newObjCProtocol(unsigned sourceLocation, const Name *name)
|
2009-07-28 16:34:15 +02:00
|
|
|
{
|
|
|
|
ObjCProtocol *p = new ObjCProtocol(translationUnit, sourceLocation, name);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(p);
|
2009-07-28 16:34:15 +02:00
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
ObjCForwardProtocolDeclaration *newObjCForwardProtocolDeclaration(unsigned sourceLocation, const Name *name)
|
2009-07-28 16:34:15 +02:00
|
|
|
{
|
|
|
|
ObjCForwardProtocolDeclaration *fwd = new ObjCForwardProtocolDeclaration(translationUnit, sourceLocation, name);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(fwd);
|
2009-07-28 16:34:15 +02:00
|
|
|
return fwd;
|
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
ObjCMethod *newObjCMethod(unsigned sourceLocation, const Name *name)
|
2009-08-05 18:30:18 +02:00
|
|
|
{
|
|
|
|
ObjCMethod *method = new ObjCMethod(translationUnit, sourceLocation, name);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(method);
|
2009-08-05 18:30:18 +02:00
|
|
|
return method;
|
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
ObjCPropertyDeclaration *newObjCPropertyDeclaration(unsigned sourceLocation, const Name *name)
|
2009-11-11 09:32:05 +01:00
|
|
|
{
|
|
|
|
ObjCPropertyDeclaration *decl = new ObjCPropertyDeclaration(translationUnit, sourceLocation, name);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(decl);
|
2009-11-11 09:32:05 +01:00
|
|
|
return decl;
|
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
Enum *newEnum(unsigned sourceLocation, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-08-11 13:46:32 +02:00
|
|
|
Enum *e = new Enum(translationUnit, sourceLocation, name);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(e);
|
2008-12-02 12:01:29 +01:00
|
|
|
return e;
|
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
UsingDeclaration *newUsingDeclaration(unsigned sourceLocation, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-08-11 13:46:32 +02:00
|
|
|
UsingDeclaration *u = new UsingDeclaration(translationUnit, sourceLocation, name);
|
2009-11-23 13:27:57 +01:00
|
|
|
symbols.push_back(u);
|
2008-12-02 12:01:29 +01:00
|
|
|
return u;
|
|
|
|
}
|
|
|
|
|
|
|
|
Control *control;
|
|
|
|
TranslationUnit *translationUnit;
|
|
|
|
DiagnosticClient *diagnosticClient;
|
2009-11-23 12:42:28 +01:00
|
|
|
|
|
|
|
TypeMatcher matcher;
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
LiteralTable<Identifier> identifiers;
|
|
|
|
LiteralTable<StringLiteral> stringLiterals;
|
|
|
|
LiteralTable<NumericLiteral> numericLiterals;
|
|
|
|
|
|
|
|
// ### replace std::map with lookup tables. ASAP!
|
|
|
|
|
|
|
|
// names
|
2009-12-01 14:38:42 +01:00
|
|
|
Table<DestructorNameId> destructorNameIds;
|
|
|
|
Table<OperatorNameId> operatorNameIds;
|
|
|
|
Table<ConversionNameId> conversionNameIds;
|
|
|
|
Table<TemplateNameId> templateNameIds;
|
|
|
|
Table<QualifiedNameId> qualifiedNameIds;
|
|
|
|
Table<SelectorNameId> selectorNameIds;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
// types
|
|
|
|
VoidType voidType;
|
2009-11-30 18:13:08 +01:00
|
|
|
Table<IntegerType> integerTypes;
|
|
|
|
Table<FloatType> floatTypes;
|
|
|
|
Table<PointerToMemberType> pointerToMemberTypes;
|
|
|
|
Table<PointerType> pointerTypes;
|
|
|
|
Table<ReferenceType> referenceTypes;
|
|
|
|
Table<ArrayType> arrayTypes;
|
|
|
|
Table<NamedType> namedTypes;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
// symbols
|
2009-11-30 17:37:08 +01:00
|
|
|
std::vector<Symbol *> symbols;
|
2009-10-20 12:47:54 +02:00
|
|
|
|
2010-03-22 10:34:23 +01:00
|
|
|
const Identifier *deprecatedId;
|
2010-05-26 13:49:06 +02:00
|
|
|
const Identifier *unavailableId;
|
2009-10-20 12:47:54 +02:00
|
|
|
// ObjC context keywords:
|
2009-12-01 11:33:13 +01:00
|
|
|
const Identifier *objcGetterId;
|
|
|
|
const Identifier *objcSetterId;
|
|
|
|
const Identifier *objcReadwriteId;
|
|
|
|
const Identifier *objcReadonlyId;
|
|
|
|
const Identifier *objcAssignId;
|
|
|
|
const Identifier *objcRetainId;
|
|
|
|
const Identifier *objcCopyId;
|
|
|
|
const Identifier *objcNonatomicId;
|
2011-02-04 16:26:10 +01:00
|
|
|
TopLevelDeclarationProcessor *processor;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
Control::Control()
|
2009-10-20 13:50:36 +02:00
|
|
|
{
|
|
|
|
d = new Data(this);
|
|
|
|
|
2010-08-11 14:24:28 +02:00
|
|
|
d->deprecatedId = identifier("deprecated");
|
|
|
|
d->unavailableId = identifier("unavailable");
|
|
|
|
|
|
|
|
d->objcGetterId = identifier("getter");
|
|
|
|
d->objcSetterId = identifier("setter");
|
|
|
|
d->objcReadwriteId = identifier("readwrite");
|
|
|
|
d->objcReadonlyId = identifier("readonly");
|
|
|
|
d->objcAssignId = identifier("assign");
|
|
|
|
d->objcRetainId = identifier("retain");
|
|
|
|
d->objcCopyId = identifier("copy");
|
|
|
|
d->objcNonatomicId = identifier("nonatomic");
|
2009-10-20 13:50:36 +02:00
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
Control::~Control()
|
|
|
|
{ delete d; }
|
|
|
|
|
|
|
|
TranslationUnit *Control::translationUnit() const
|
|
|
|
{ return d->translationUnit; }
|
|
|
|
|
|
|
|
TranslationUnit *Control::switchTranslationUnit(TranslationUnit *unit)
|
|
|
|
{
|
|
|
|
TranslationUnit *previousTranslationUnit = d->translationUnit;
|
|
|
|
d->translationUnit = unit;
|
|
|
|
return previousTranslationUnit;
|
|
|
|
}
|
|
|
|
|
|
|
|
DiagnosticClient *Control::diagnosticClient() const
|
|
|
|
{ return d->diagnosticClient; }
|
|
|
|
|
|
|
|
void Control::setDiagnosticClient(DiagnosticClient *diagnosticClient)
|
|
|
|
{ d->diagnosticClient = diagnosticClient; }
|
|
|
|
|
2010-11-18 17:39:16 +01:00
|
|
|
const OperatorNameId *Control::findOperatorNameId(OperatorNameId::Kind operatorId) const
|
|
|
|
{
|
|
|
|
Table<OperatorNameId>::const_iterator i = d->operatorNameIds.find(operatorId);
|
|
|
|
if (i == d->operatorNameIds.end())
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return &*i;
|
|
|
|
}
|
|
|
|
|
2009-12-01 11:33:13 +01:00
|
|
|
const Identifier *Control::findIdentifier(const char *chars, unsigned size) const
|
2009-09-07 13:39:46 +02:00
|
|
|
{ return d->identifiers.findLiteral(chars, size); }
|
|
|
|
|
2010-08-11 14:24:28 +02:00
|
|
|
const Identifier *Control::identifier(const char *chars, unsigned size)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->identifiers.findOrInsertLiteral(chars, size); }
|
|
|
|
|
2010-08-11 14:24:28 +02:00
|
|
|
const Identifier *Control::identifier(const char *chars)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-11-23 11:56:44 +01:00
|
|
|
unsigned length = std::strlen(chars);
|
2010-08-11 14:24:28 +02:00
|
|
|
return identifier(chars, length);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2008-12-09 09:42:17 +01:00
|
|
|
Control::IdentifierIterator Control::firstIdentifier() const
|
|
|
|
{ return d->identifiers.begin(); }
|
|
|
|
|
|
|
|
Control::IdentifierIterator Control::lastIdentifier() const
|
|
|
|
{ return d->identifiers.end(); }
|
|
|
|
|
2009-06-05 12:08:36 +02:00
|
|
|
Control::StringLiteralIterator Control::firstStringLiteral() const
|
|
|
|
{ return d->stringLiterals.begin(); }
|
|
|
|
|
|
|
|
Control::StringLiteralIterator Control::lastStringLiteral() const
|
|
|
|
{ return d->stringLiterals.end(); }
|
|
|
|
|
|
|
|
Control::NumericLiteralIterator Control::firstNumericLiteral() const
|
|
|
|
{ return d->numericLiterals.begin(); }
|
|
|
|
|
|
|
|
Control::NumericLiteralIterator Control::lastNumericLiteral() const
|
|
|
|
{ return d->numericLiterals.end(); }
|
|
|
|
|
2010-08-11 14:24:28 +02:00
|
|
|
const StringLiteral *Control::stringLiteral(const char *chars, unsigned size)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->stringLiterals.findOrInsertLiteral(chars, size); }
|
|
|
|
|
2010-08-11 14:24:28 +02:00
|
|
|
const StringLiteral *Control::stringLiteral(const char *chars)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-11-23 11:56:44 +01:00
|
|
|
unsigned length = std::strlen(chars);
|
2010-08-11 14:24:28 +02:00
|
|
|
return stringLiteral(chars, length);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-08-11 14:24:28 +02:00
|
|
|
const NumericLiteral *Control::numericLiteral(const char *chars, unsigned size)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->numericLiterals.findOrInsertLiteral(chars, size); }
|
|
|
|
|
2010-08-11 14:24:28 +02:00
|
|
|
const NumericLiteral *Control::numericLiteral(const char *chars)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-11-23 11:56:44 +01:00
|
|
|
unsigned length = std::strlen(chars);
|
2010-08-11 14:24:28 +02:00
|
|
|
return numericLiteral(chars, length);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
const TemplateNameId *Control::templateNameId(const Identifier *id,
|
|
|
|
const FullySpecifiedType *const args,
|
|
|
|
unsigned argv)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-12-01 14:38:42 +01:00
|
|
|
return d->findOrInsertTemplateNameId(id, args, args + argv);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
const DestructorNameId *Control::destructorNameId(const Identifier *id)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->findOrInsertDestructorNameId(id); }
|
|
|
|
|
2010-09-03 12:11:15 +02:00
|
|
|
const OperatorNameId *Control::operatorNameId(OperatorNameId::Kind kind)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->findOrInsertOperatorNameId(kind); }
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
const ConversionNameId *Control::conversionNameId(const FullySpecifiedType &type)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->findOrInsertConversionNameId(type); }
|
|
|
|
|
2010-07-12 13:41:54 +02:00
|
|
|
const QualifiedNameId *Control::qualifiedNameId(const Name *base, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-07-12 13:41:54 +02:00
|
|
|
return d->findOrInsertQualifiedNameId(base, name);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
const SelectorNameId *Control::selectorNameId(const Name *const *names,
|
|
|
|
unsigned nameCount,
|
|
|
|
bool hasArguments)
|
2009-07-31 16:03:48 +02:00
|
|
|
{
|
2009-12-01 14:38:42 +01:00
|
|
|
return d->findOrInsertSelectorNameId(names, names + nameCount, hasArguments);
|
2009-07-31 16:03:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
VoidType *Control::voidType()
|
|
|
|
{ return &d->voidType; }
|
|
|
|
|
|
|
|
IntegerType *Control::integerType(int kind)
|
|
|
|
{ return d->findOrInsertIntegerType(kind); }
|
|
|
|
|
|
|
|
FloatType *Control::floatType(int kind)
|
|
|
|
{ return d->findOrInsertFloatType(kind); }
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
PointerToMemberType *Control::pointerToMemberType(const Name *memberName, const FullySpecifiedType &elementType)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->findOrInsertPointerToMemberType(memberName, elementType); }
|
|
|
|
|
2009-11-17 14:37:45 +01:00
|
|
|
PointerType *Control::pointerType(const FullySpecifiedType &elementType)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->findOrInsertPointerType(elementType); }
|
|
|
|
|
2010-03-23 12:11:33 +01:00
|
|
|
ReferenceType *Control::referenceType(const FullySpecifiedType &elementType, bool rvalueRef)
|
|
|
|
{ return d->findOrInsertReferenceType(elementType, rvalueRef); }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-11-23 12:42:28 +01:00
|
|
|
ArrayType *Control::arrayType(const FullySpecifiedType &elementType, unsigned size)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->findOrInsertArrayType(elementType, size); }
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
NamedType *Control::namedType(const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->findOrInsertNamedType(name); }
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
Argument *Control::newArgument(unsigned sourceLocation, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->newArgument(sourceLocation, name); }
|
|
|
|
|
2009-12-08 11:58:27 +01:00
|
|
|
TypenameArgument *Control::newTypenameArgument(unsigned sourceLocation, const Name *name)
|
|
|
|
{ return d->newTypenameArgument(sourceLocation, name); }
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
Function *Control::newFunction(unsigned sourceLocation, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->newFunction(sourceLocation, name); }
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
Namespace *Control::newNamespace(unsigned sourceLocation, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->newNamespace(sourceLocation, name); }
|
|
|
|
|
2010-08-11 13:46:32 +02:00
|
|
|
Template *Control::newTemplate(unsigned sourceLocation, const Name *name)
|
|
|
|
{ return d->newTemplate(sourceLocation, name); }
|
|
|
|
|
2010-05-05 10:18:11 +02:00
|
|
|
NamespaceAlias *Control::newNamespaceAlias(unsigned sourceLocation, const Name *name)
|
|
|
|
{ return d->newNamespaceAlias(sourceLocation, name); }
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
BaseClass *Control::newBaseClass(unsigned sourceLocation, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->newBaseClass(sourceLocation, name); }
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
Class *Control::newClass(unsigned sourceLocation, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->newClass(sourceLocation, name); }
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
Enum *Control::newEnum(unsigned sourceLocation, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->newEnum(sourceLocation, name); }
|
|
|
|
|
|
|
|
Block *Control::newBlock(unsigned sourceLocation)
|
|
|
|
{ return d->newBlock(sourceLocation); }
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
Declaration *Control::newDeclaration(unsigned sourceLocation, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->newDeclaration(sourceLocation, name); }
|
|
|
|
|
|
|
|
UsingNamespaceDirective *Control::newUsingNamespaceDirective(unsigned sourceLocation,
|
2009-12-01 12:46:15 +01:00
|
|
|
const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->newUsingNamespaceDirective(sourceLocation, name); }
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
UsingDeclaration *Control::newUsingDeclaration(unsigned sourceLocation, const Name *name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{ return d->newUsingDeclaration(sourceLocation, name); }
|
|
|
|
|
2009-02-16 15:43:24 +01:00
|
|
|
ForwardClassDeclaration *Control::newForwardClassDeclaration(unsigned sourceLocation,
|
2009-12-01 12:46:15 +01:00
|
|
|
const Name *name)
|
2009-02-16 15:43:24 +01:00
|
|
|
{ return d->newForwardClassDeclaration(sourceLocation, name); }
|
|
|
|
|
2010-12-06 12:16:45 +01:00
|
|
|
QtPropertyDeclaration *Control::newQtPropertyDeclaration(unsigned sourceLocation,
|
|
|
|
const Name *name)
|
|
|
|
{ return d->newQtPropertyDeclaration(sourceLocation, name); }
|
|
|
|
|
2010-12-06 13:10:09 +01:00
|
|
|
QtEnum *Control::newQtEnum(unsigned sourceLocation, const Name *name)
|
|
|
|
{ return d->newQtEnum(sourceLocation, name); }
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
ObjCBaseClass *Control::newObjCBaseClass(unsigned sourceLocation, const Name *name)
|
2009-10-05 18:02:01 +02:00
|
|
|
{ return d->newObjCBaseClass(sourceLocation, name); }
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
ObjCBaseProtocol *Control::newObjCBaseProtocol(unsigned sourceLocation, const Name *name)
|
2009-10-05 18:02:01 +02:00
|
|
|
{ return d->newObjCBaseProtocol(sourceLocation, name); }
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
ObjCClass *Control::newObjCClass(unsigned sourceLocation, const Name *name)
|
2009-07-28 16:34:15 +02:00
|
|
|
{ return d->newObjCClass(sourceLocation, name); }
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
ObjCForwardClassDeclaration *Control::newObjCForwardClassDeclaration(unsigned sourceLocation, const Name *name)
|
2009-07-28 16:34:15 +02:00
|
|
|
{ return d->newObjCForwardClassDeclaration(sourceLocation, name); }
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
ObjCProtocol *Control::newObjCProtocol(unsigned sourceLocation, const Name *name)
|
2009-07-28 16:34:15 +02:00
|
|
|
{ return d->newObjCProtocol(sourceLocation, name); }
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
ObjCForwardProtocolDeclaration *Control::newObjCForwardProtocolDeclaration(unsigned sourceLocation, const Name *name)
|
2009-07-28 16:34:15 +02:00
|
|
|
{ return d->newObjCForwardProtocolDeclaration(sourceLocation, name); }
|
2009-02-16 15:43:24 +01:00
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
ObjCMethod *Control::newObjCMethod(unsigned sourceLocation, const Name *name)
|
2009-08-05 18:30:18 +02:00
|
|
|
{ return d->newObjCMethod(sourceLocation, name); }
|
|
|
|
|
2009-12-01 12:46:15 +01:00
|
|
|
ObjCPropertyDeclaration *Control::newObjCPropertyDeclaration(unsigned sourceLocation, const Name *name)
|
2009-11-11 09:32:05 +01:00
|
|
|
{ return d->newObjCPropertyDeclaration(sourceLocation, name); }
|
|
|
|
|
2010-03-22 10:34:23 +01:00
|
|
|
const Identifier *Control::deprecatedId() const
|
|
|
|
{ return d->deprecatedId; }
|
|
|
|
|
2010-05-26 13:49:06 +02:00
|
|
|
const Identifier *Control::unavailableId() const
|
|
|
|
{ return d->unavailableId; }
|
|
|
|
|
2009-12-01 11:33:13 +01:00
|
|
|
const Identifier *Control::objcGetterId() const
|
2009-10-20 12:47:54 +02:00
|
|
|
{ return d->objcGetterId; }
|
|
|
|
|
2009-12-01 11:33:13 +01:00
|
|
|
const Identifier *Control::objcSetterId() const
|
2009-10-20 12:47:54 +02:00
|
|
|
{ return d->objcSetterId; }
|
|
|
|
|
2009-12-01 11:33:13 +01:00
|
|
|
const Identifier *Control::objcReadwriteId() const
|
2009-10-20 12:47:54 +02:00
|
|
|
{ return d->objcReadwriteId; }
|
|
|
|
|
2009-12-01 11:33:13 +01:00
|
|
|
const Identifier *Control::objcReadonlyId() const
|
2009-10-20 12:47:54 +02:00
|
|
|
{ return d->objcReadonlyId; }
|
|
|
|
|
2009-12-01 11:33:13 +01:00
|
|
|
const Identifier *Control::objcAssignId() const
|
2009-10-20 12:47:54 +02:00
|
|
|
{ return d->objcAssignId; }
|
|
|
|
|
2009-12-01 11:33:13 +01:00
|
|
|
const Identifier *Control::objcRetainId() const
|
2009-10-20 12:47:54 +02:00
|
|
|
{ return d->objcRetainId; }
|
|
|
|
|
2009-12-01 11:33:13 +01:00
|
|
|
const Identifier *Control::objcCopyId() const
|
2009-10-20 12:47:54 +02:00
|
|
|
{ return d->objcCopyId; }
|
2009-10-20 11:21:25 +02:00
|
|
|
|
2009-12-01 11:33:13 +01:00
|
|
|
const Identifier *Control::objcNonatomicId() const
|
2009-10-20 12:47:54 +02:00
|
|
|
{ return d->objcNonatomicId; }
|
2010-08-10 14:40:27 +02:00
|
|
|
|
2010-12-10 10:32:46 +01:00
|
|
|
Symbol **Control::firstSymbol() const
|
|
|
|
{
|
|
|
|
if (d->symbols.empty())
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return &*d->symbols.begin();
|
|
|
|
}
|
|
|
|
|
|
|
|
Symbol **Control::lastSymbol() const
|
|
|
|
{
|
|
|
|
if (d->symbols.empty())
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return &*d->symbols.begin() + d->symbols.size();
|
|
|
|
}
|
|
|
|
|
2010-08-10 14:40:27 +02:00
|
|
|
bool Control::hasSymbol(Symbol *symbol) const
|
|
|
|
{
|
|
|
|
return std::find(d->symbols.begin(), d->symbols.end(), symbol) != d->symbols.end();
|
|
|
|
}
|
2010-09-02 12:50:37 +02:00
|
|
|
|
|
|
|
void Control::squeeze()
|
|
|
|
{
|
|
|
|
d->numericLiterals.reset();
|
|
|
|
}
|
2011-02-04 16:26:10 +01:00
|
|
|
|
|
|
|
TopLevelDeclarationProcessor *Control::topLevelDeclarationProcessor() const
|
|
|
|
{
|
|
|
|
return d->processor;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Control::setTopLevelDeclarationProcessor(CPlusPlus::TopLevelDeclarationProcessor *processor)
|
|
|
|
{
|
|
|
|
d->processor = processor;
|
|
|
|
}
|