forked from qt-creator/qt-creator
Removed the MacroResolver
Unfortunately, the MacroResolver does not scale and we get pretty bad performances when parsing big projects.
This commit is contained in:
@@ -83,7 +83,6 @@ class Semantic;
|
||||
class Control;
|
||||
class MemoryPool;
|
||||
class DiagnosticClient;
|
||||
class MacroResolver;
|
||||
|
||||
class Identifier;
|
||||
class Literal;
|
||||
|
||||
@@ -59,11 +59,6 @@
|
||||
|
||||
CPLUSPLUS_BEGIN_NAMESPACE
|
||||
|
||||
MacroResolver::MacroResolver()
|
||||
{ }
|
||||
|
||||
MacroResolver::~MacroResolver()
|
||||
{ }
|
||||
|
||||
template <typename _Iterator>
|
||||
static void delete_map_entries(_Iterator first, _Iterator last)
|
||||
@@ -93,8 +88,7 @@ public:
|
||||
Data(Control *control)
|
||||
: control(control),
|
||||
translationUnit(0),
|
||||
diagnosticClient(0),
|
||||
macroResolver(0)
|
||||
diagnosticClient(0)
|
||||
{ }
|
||||
|
||||
~Data()
|
||||
@@ -539,7 +533,6 @@ public:
|
||||
Control *control;
|
||||
TranslationUnit *translationUnit;
|
||||
DiagnosticClient *diagnosticClient;
|
||||
MacroResolver *macroResolver;
|
||||
LiteralTable<Identifier> identifiers;
|
||||
LiteralTable<StringLiteral> stringLiterals;
|
||||
LiteralTable<NumericLiteral> numericLiterals;
|
||||
@@ -602,12 +595,6 @@ TranslationUnit *Control::switchTranslationUnit(TranslationUnit *unit)
|
||||
return previousTranslationUnit;
|
||||
}
|
||||
|
||||
MacroResolver *Control::macroResolver() const
|
||||
{ return d->macroResolver; }
|
||||
|
||||
void Control::setMacroResolver(MacroResolver *macroResolver)
|
||||
{ d->macroResolver = macroResolver; }
|
||||
|
||||
DiagnosticClient *Control::diagnosticClient() const
|
||||
{ return d->diagnosticClient; }
|
||||
|
||||
|
||||
@@ -55,18 +55,6 @@
|
||||
CPLUSPLUS_BEGIN_HEADER
|
||||
CPLUSPLUS_BEGIN_NAMESPACE
|
||||
|
||||
class CPLUSPLUS_EXPORT MacroResolver
|
||||
{
|
||||
MacroResolver(const MacroResolver &other);
|
||||
void operator = (const MacroResolver &other);
|
||||
|
||||
public:
|
||||
MacroResolver();
|
||||
virtual ~MacroResolver();
|
||||
|
||||
virtual bool isMacro(TranslationUnit *unit, unsigned tokenIndex) const = 0;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT Control
|
||||
{
|
||||
public:
|
||||
@@ -76,9 +64,6 @@ public:
|
||||
TranslationUnit *translationUnit() const;
|
||||
TranslationUnit *switchTranslationUnit(TranslationUnit *unit);
|
||||
|
||||
MacroResolver *macroResolver() const;
|
||||
void setMacroResolver(MacroResolver *macroResolver);
|
||||
|
||||
DiagnosticClient *diagnosticClient() const;
|
||||
void setDiagnosticClient(DiagnosticClient *diagnosticClient);
|
||||
|
||||
|
||||
@@ -244,14 +244,6 @@ void Parser::match(int kind, unsigned *token)
|
||||
}
|
||||
}
|
||||
|
||||
bool Parser::isMacro(unsigned tokenIndex) const
|
||||
{
|
||||
if (MacroResolver *r = _control->macroResolver())
|
||||
return r->isMacro(_translationUnit, tokenIndex);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Parser::parseClassOrNamespaceName(NameAST *&node)
|
||||
{
|
||||
if (LA() == T_IDENTIFIER) {
|
||||
@@ -2561,10 +2553,6 @@ bool Parser::parseBuiltinTypeSpecifier(SpecifierAST *&node)
|
||||
bool Parser::parseSimpleDeclaration(DeclarationAST *&node,
|
||||
bool acceptStructDeclarator)
|
||||
{
|
||||
if (LA() == T_IDENTIFIER && isMacro(cursor())) {
|
||||
// printf("***** found macro reference `%s'\n", tok().identifier->chars());
|
||||
}
|
||||
|
||||
unsigned qt_invokable_token = 0;
|
||||
if (acceptStructDeclarator && (LA() == T_Q_SIGNAL || LA() == T_Q_SLOT))
|
||||
qt_invokable_token = consumeToken();
|
||||
|
||||
@@ -286,8 +286,6 @@ private:
|
||||
inline void rewind(unsigned cursor)
|
||||
{ _tokenIndex = cursor; }
|
||||
|
||||
bool isMacro(unsigned tokenIndex) const;
|
||||
|
||||
private:
|
||||
TranslationUnit *_translationUnit;
|
||||
Control *_control;
|
||||
|
||||
Reference in New Issue
Block a user