summaryrefslogtreecommitdiff
path: root/src/libs/3rdparty
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/3rdparty')
-rw-r--r--src/libs/3rdparty/botan/botan.pri2
-rw-r--r--src/libs/3rdparty/cplusplus/Bind.cpp24
-rw-r--r--src/libs/3rdparty/cplusplus/Control.cpp6
-rw-r--r--src/libs/3rdparty/cplusplus/Names.cpp21
-rw-r--r--src/libs/3rdparty/cplusplus/Parser.cpp71
-rw-r--r--src/libs/3rdparty/cplusplus/Parser.h2
-rw-r--r--src/libs/3rdparty/cplusplus/Scope.cpp4
-rw-r--r--src/libs/3rdparty/cplusplus/Symbol.cpp35
-rw-r--r--src/libs/3rdparty/cplusplus/Symbol.h7
-rw-r--r--src/libs/3rdparty/cplusplus/Symbols.cpp6
-rw-r--r--src/libs/3rdparty/cplusplus/Templates.cpp8
-rw-r--r--src/libs/3rdparty/cplusplus/Token.cpp2
-rw-r--r--src/libs/3rdparty/cplusplus/TranslationUnit.cpp14
-rw-r--r--src/libs/3rdparty/cplusplus/TranslationUnit.h25
-rw-r--r--src/libs/3rdparty/cplusplus/cplusplus.pri4
15 files changed, 158 insertions, 73 deletions
diff --git a/src/libs/3rdparty/botan/botan.pri b/src/libs/3rdparty/botan/botan.pri
index 3c65676629..3ff57ded1b 100644
--- a/src/libs/3rdparty/botan/botan.pri
+++ b/src/libs/3rdparty/botan/botan.pri
@@ -36,7 +36,7 @@ win32 {
win32-msvc* {
QMAKE_CXXFLAGS += -wd4251 -wd4290 -wd4250
- DEFINES += BOTAN_BUILD_COMPILER_IS_MSVC BOTAN_TARGET_OS_HAS_GMTIME_S
+ DEFINES += BOTAN_BUILD_COMPILER_IS_MSVC BOTAN_TARGET_OS_HAS_GMTIME_S _SCL_SECURE_NO_WARNINGS
} else {
QMAKE_CFLAGS += -fpermissive -finline-functions -Wno-long-long
QMAKE_CXXFLAGS += -fpermissive -finline-functions -Wno-long-long
diff --git a/src/libs/3rdparty/cplusplus/Bind.cpp b/src/libs/3rdparty/cplusplus/Bind.cpp
index 183bebdef1..0defcc0a1f 100644
--- a/src/libs/3rdparty/cplusplus/Bind.cpp
+++ b/src/libs/3rdparty/cplusplus/Bind.cpp
@@ -1142,11 +1142,11 @@ const StringLiteral *Bind::asStringLiteral(unsigned firstToken, unsigned lastTok
std::string buffer;
for (unsigned index = firstToken; index != lastToken; ++index) {
const Token &tk = tokenAt(index);
- if (tk.whitespace() || tk.newline())
+ if (index != firstToken && (tk.whitespace() || tk.newline()))
buffer += ' ';
buffer += tk.spell();
}
- return control()->stringLiteral(buffer.c_str(), buffer.size());
+ return control()->stringLiteral(buffer.c_str(), unsigned(buffer.size()));
}
// StatementAST
@@ -1168,7 +1168,7 @@ bool Bind::visit(QtMemberDeclarationAST *ast)
privateClass += nameId->identifier()->chars();
privateClass += "Private";
- const Name *privName = control()->identifier(privateClass.c_str(), privateClass.size());
+ const Name *privName = control()->identifier(privateClass.c_str(), unsigned(privateClass.size()));
declTy.setType(control()->namedType(privName));
}
}
@@ -1262,7 +1262,7 @@ bool Bind::visit(ForeachStatementAST *ast)
unsigned endOfExpression = ast->expression->lastToken();
const StringLiteral *sl = asStringLiteral(startOfExpression, endOfExpression);
const std::string buff = std::string("*") + sl->chars() + ".begin()";
- initializer = control()->stringLiteral(buff.c_str(), buff.size());
+ initializer = control()->stringLiteral(buff.c_str(), unsigned(buff.size()));
}
}
@@ -1312,7 +1312,7 @@ bool Bind::visit(RangeBasedForStatementAST *ast)
unsigned endOfExpression = ast->expression->lastToken();
const StringLiteral *sl = asStringLiteral(startOfExpression, endOfExpression);
const std::string buff = std::string("*") + sl->chars() + ".begin()";
- initializer = control()->stringLiteral(buff.c_str(), buff.size());
+ initializer = control()->stringLiteral(buff.c_str(), unsigned(buff.size()));
}
}
@@ -1861,7 +1861,7 @@ bool Bind::visit(SimpleDeclarationAST *ast)
setDeclSpecifiers(decl, type);
if (Function *fun = decl->type()->asFunctionType()) {
- fun->setScope(_scope);
+ fun->setEnclosingScope(_scope);
fun->setSourceLocation(sourceLocation, translationUnit());
setDeclSpecifiers(fun, type);
@@ -2591,7 +2591,7 @@ bool Bind::visit(ObjCSelectorAST *ast) // ### review
}
if (! arguments.empty()) {
- _name = control()->selectorNameId(&arguments[0], arguments.size(), hasArgs);
+ _name = control()->selectorNameId(&arguments[0], unsigned(arguments.size()), hasArgs);
ast->name = _name;
}
@@ -2676,7 +2676,7 @@ bool Bind::visit(TemplateIdAST *ast)
_name = control()->templateNameId(id, isSpecialization);
else
_name = control()->templateNameId(id, isSpecialization, &templateArguments[0],
- templateArguments.size());
+ unsigned(templateArguments.size()));
ast->name = _name;
return false;
@@ -3016,18 +3016,10 @@ bool Bind::visit(EnumSpecifierAST *ast)
this->enumerator(it->value, e);
}
- if (ast->stray_comma_token /* && ! translationUnit()->cxx0xEnabled()*/) {
- const Token &tk = tokenAt(ast->stray_comma_token);
- if (! tk.generated())
- translationUnit()->warning(ast->stray_comma_token,
- "commas at the end of enumerator lists are a C++0x-specific feature");
- }
-
(void) switchScope(previousScope);
return false;
}
-
// PtrOperatorAST
bool Bind::visit(PointerToMemberAST *ast)
{
diff --git a/src/libs/3rdparty/cplusplus/Control.cpp b/src/libs/3rdparty/cplusplus/Control.cpp
index e274a20906..42028ae4ed 100644
--- a/src/libs/3rdparty/cplusplus/Control.cpp
+++ b/src/libs/3rdparty/cplusplus/Control.cpp
@@ -584,7 +584,7 @@ const Identifier *Control::identifier(const char *chars, unsigned size)
const Identifier *Control::identifier(const char *chars)
{
- unsigned length = std::strlen(chars);
+ const unsigned length = unsigned(std::strlen(chars));
return identifier(chars, length);
}
@@ -611,7 +611,7 @@ const StringLiteral *Control::stringLiteral(const char *chars, unsigned size)
const StringLiteral *Control::stringLiteral(const char *chars)
{
- unsigned length = std::strlen(chars);
+ const unsigned length = unsigned(std::strlen(chars));
return stringLiteral(chars, length);
}
@@ -620,7 +620,7 @@ const NumericLiteral *Control::numericLiteral(const char *chars, unsigned size)
const NumericLiteral *Control::numericLiteral(const char *chars)
{
- unsigned length = std::strlen(chars);
+ const unsigned length = unsigned(std::strlen(chars));
return numericLiteral(chars, length);
}
diff --git a/src/libs/3rdparty/cplusplus/Names.cpp b/src/libs/3rdparty/cplusplus/Names.cpp
index 4d92110284..7f26ea1ad6 100644
--- a/src/libs/3rdparty/cplusplus/Names.cpp
+++ b/src/libs/3rdparty/cplusplus/Names.cpp
@@ -100,7 +100,7 @@ const Identifier *TemplateNameId::identifier() const
{ return _identifier; }
unsigned TemplateNameId::templateArgumentCount() const
-{ return _templateArguments.size(); }
+{ return unsigned(_templateArguments.size()); }
const FullySpecifiedType &TemplateNameId::templateArgumentAt(unsigned index) const
{ return _templateArguments[index]; }
@@ -130,10 +130,23 @@ bool TemplateNameId::isEqualTo(const Name *other) const
bool TemplateNameId::Compare::operator()(const TemplateNameId *name,
const TemplateNameId *other) const
{
+ if (name == 0)
+ return other != 0;
+ if (other == 0)
+ return false;
+ if (name == other)
+ return false;
+
const Identifier *id = name->identifier();
const Identifier *otherId = other->identifier();
- if (id == otherId) {
+ if (id == 0)
+ return otherId != 0;
+ if (otherId == 0)
+ return false;
+
+ const int c = std::strcmp(id->chars(), otherId->chars());
+ if (c == 0) {
// we have to differentiate TemplateNameId with respect to specialization or instantiation
if (name->isSpecialization() == other->isSpecialization()) {
return std::lexicographical_compare(name->firstTemplateArgument(),
@@ -145,7 +158,7 @@ bool TemplateNameId::Compare::operator()(const TemplateNameId *name,
}
}
- return id < otherId;
+ return c < 0;
}
OperatorNameId::OperatorNameId(Kind kind)
@@ -217,7 +230,7 @@ const Identifier *SelectorNameId::identifier() const
}
unsigned SelectorNameId::nameCount() const
-{ return _names.size(); }
+{ return unsigned(_names.size()); }
const Name *SelectorNameId::nameAt(unsigned index) const
{ return _names[index]; }
diff --git a/src/libs/3rdparty/cplusplus/Parser.cpp b/src/libs/3rdparty/cplusplus/Parser.cpp
index 9c6804219b..b67920266f 100644
--- a/src/libs/3rdparty/cplusplus/Parser.cpp
+++ b/src/libs/3rdparty/cplusplus/Parser.cpp
@@ -333,7 +333,9 @@ bool Parser::skipUntilStatement()
case T_USING:
return true;
+ case T_AT_TRY:
case T_AT_SYNCHRONIZED:
+ case T_AT_THROW:
if (objCEnabled())
return true;
@@ -3106,9 +3108,15 @@ bool Parser::parseStatement(StatementAST *&node)
return true;
}
+ case T_AT_TRY:
+ return objCEnabled() && parseObjCTryStatement(node);
+
case T_AT_SYNCHRONIZED:
return objCEnabled() && parseObjCSynchronizedStatement(node);
+ case T_AT_THROW:
+ return objCEnabled() && parseObjCThrowStatement(node);
+
case T_Q_D:
case T_Q_Q: {
QtMemberDeclarationAST *ast = new (_pool) QtMemberDeclarationAST;
@@ -4404,6 +4412,52 @@ bool Parser::parseObjCStringLiteral(ExpressionAST *&node)
return true;
}
+/// objc-try-catch-statement:
+/// @try compound-statement objc-catch-list[opt]
+/// @try compound-statement objc-catch-list[opt] @finally compound-statement
+///
+/// objc-catch-list:
+/// @catch ( parameter-declaration ) compound-statement
+/// objc-catch-list @catch ( catch-parameter-declaration ) compound-statement
+/// catch-parameter-declaration:
+/// parameter-declaration
+/// '...' [OBJC2]
+///
+bool Parser::parseObjCTryStatement(StatementAST *& /*node*/)
+{
+ DEBUG_THIS_RULE();
+ if (LA() != T_AT_TRY)
+ return false;
+
+ /*try_token =*/ consumeToken();
+ StatementAST *body_statment;
+ parseCompoundStatement(body_statment);
+ while (LA() == T_AT_CATCH) {
+ /*catch_token =*/ consumeToken();
+ unsigned lparen_token;
+ match(T_LPAREN, &lparen_token);
+ if (LA() == T_DOT_DOT_DOT) {
+ /*unsigned ellipsis_token =*/ consumeToken();
+ } else {
+ ParameterDeclarationAST *exception_decl;
+ parseParameterDeclaration(exception_decl);
+ }
+ unsigned rparen_token;
+ match(T_RPAREN, &rparen_token);
+ StatementAST *catch_statement;
+ parseCompoundStatement(catch_statement);
+ }
+
+ if (LA() == T_AT_FINALLY) {
+ StatementAST *finally_statement;
+ parseCompoundStatement(finally_statement);
+ }
+
+ return true;
+}
+
+/// objc-synchronized-statement:
+/// @synchronized expression ;
bool Parser::parseObjCSynchronizedStatement(StatementAST *&node)
{
DEBUG_THIS_RULE();
@@ -4422,6 +4476,23 @@ bool Parser::parseObjCSynchronizedStatement(StatementAST *&node)
return true;
}
+/// objc-throw-statement:
+/// @ throw expression ;
+bool Parser::parseObjCThrowStatement(StatementAST *&/*node*/)
+{
+ DEBUG_THIS_RULE();
+ if (LA() != T_AT_THROW)
+ return false;
+
+ /*throw_token =*/ consumeToken();
+ ExpressionAST *thrown_expression;
+ parseExpression(thrown_expression);
+ unsigned semicolon_token;
+ match(T_SEMICOLON, &semicolon_token);
+
+ return true;
+}
+
bool Parser::parseObjCEncodeExpression(ExpressionAST *&node)
{
DEBUG_THIS_RULE();
diff --git a/src/libs/3rdparty/cplusplus/Parser.h b/src/libs/3rdparty/cplusplus/Parser.h
index 978b1f99a1..1d505024e5 100644
--- a/src/libs/3rdparty/cplusplus/Parser.h
+++ b/src/libs/3rdparty/cplusplus/Parser.h
@@ -222,7 +222,9 @@ public:
bool parseObjCProtocol(DeclarationAST *&node,
SpecifierListAST *attributes = 0);
+ bool parseObjCTryStatement(StatementAST *&node);
bool parseObjCSynchronizedStatement(StatementAST *&node);
+ bool parseObjCThrowStatement(StatementAST *&node);
bool parseObjCEncodeExpression(ExpressionAST *&node);
bool parseObjCProtocolExpression(ExpressionAST *&node);
bool parseObjCSelectorExpression(ExpressionAST *&node);
diff --git a/src/libs/3rdparty/cplusplus/Scope.cpp b/src/libs/3rdparty/cplusplus/Scope.cpp
index 66d422ad35..ab1ba2710d 100644
--- a/src/libs/3rdparty/cplusplus/Scope.cpp
+++ b/src/libs/3rdparty/cplusplus/Scope.cpp
@@ -109,7 +109,7 @@ SymbolTable::~SymbolTable()
void SymbolTable::enterSymbol(Symbol *symbol)
{
- CPP_ASSERT(! symbol->_scope || symbol->enclosingScope() == _owner, return);
+ CPP_ASSERT(! symbol->_enclosingScope || symbol->enclosingScope() == _owner, return);
if (++_symbolCount == _allocatedSymbols) {
_allocatedSymbols <<= 1;
@@ -120,7 +120,7 @@ void SymbolTable::enterSymbol(Symbol *symbol)
}
symbol->_index = _symbolCount;
- symbol->_scope = _owner;
+ symbol->_enclosingScope = _owner;
_symbols[_symbolCount] = symbol;
if (_symbolCount * 5 >= _hashSize * 3)
diff --git a/src/libs/3rdparty/cplusplus/Symbol.cpp b/src/libs/3rdparty/cplusplus/Symbol.cpp
index f5506b8c89..cb55c559b0 100644
--- a/src/libs/3rdparty/cplusplus/Symbol.cpp
+++ b/src/libs/3rdparty/cplusplus/Symbol.cpp
@@ -87,7 +87,7 @@ private:
Symbol::Symbol(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
: _name(0),
- _scope(0),
+ _enclosingScope(0),
_next(0),
_fileId(0),
_sourceLocation(0),
@@ -107,7 +107,7 @@ Symbol::Symbol(TranslationUnit *translationUnit, unsigned sourceLocation, const
Symbol::Symbol(Clone *clone, Subst *subst, Symbol *original)
: _name(clone->name(original->_name, subst)),
- _scope(0),
+ _enclosingScope(0),
_next(0),
_fileId(clone->control()->stringLiteral(original->fileName(), original->fileNameLength())),
_sourceLocation(original->_sourceLocation),
@@ -231,22 +231,22 @@ const Identifier *Symbol::identifier() const
}
Scope *Symbol::enclosingScope() const
-{ return _scope; }
+{ return _enclosingScope; }
-void Symbol::setScope(Scope *scope)
+void Symbol::setEnclosingScope(Scope *scope)
{
- CPP_CHECK(! _scope);
- _scope = scope;
+ CPP_CHECK(! _enclosingScope);
+ _enclosingScope = scope;
}
-void Symbol::resetScope()
+void Symbol::resetEnclosingScope()
{
- _scope = 0;
+ _enclosingScope = 0;
}
Namespace *Symbol::enclosingNamespace() const
{
- for (Scope *s = _scope; s; s = s->enclosingScope()) {
+ for (Scope *s = _enclosingScope; s; s = s->enclosingScope()) {
if (Namespace *ns = s->asNamespace())
return ns;
}
@@ -255,7 +255,7 @@ Namespace *Symbol::enclosingNamespace() const
Template *Symbol::enclosingTemplate() const
{
- for (Scope *s = _scope; s; s = s->enclosingScope()) {
+ for (Scope *s = _enclosingScope; s; s = s->enclosingScope()) {
if (Template *templ = s->asTemplate())
return templ;
}
@@ -264,7 +264,7 @@ Template *Symbol::enclosingTemplate() const
Class *Symbol::enclosingClass() const
{
- for (Scope *s = _scope; s; s = s->enclosingScope()) {
+ for (Scope *s = _enclosingScope; s; s = s->enclosingScope()) {
if (Class *klass = s->asClass())
return klass;
}
@@ -273,7 +273,7 @@ Class *Symbol::enclosingClass() const
Enum *Symbol::enclosingEnum() const
{
- for (Scope *s = _scope; s; s = s->enclosingScope()) {
+ for (Scope *s = _enclosingScope; s; s = s->enclosingScope()) {
if (Enum *e = s->asEnum())
return e;
}
@@ -282,7 +282,7 @@ Enum *Symbol::enclosingEnum() const
Function *Symbol::enclosingFunction() const
{
- for (Scope *s = _scope; s; s = s->enclosingScope()) {
+ for (Scope *s = _enclosingScope; s; s = s->enclosingScope()) {
if (Function *fun = s->asFunction())
return fun;
}
@@ -291,18 +291,13 @@ Function *Symbol::enclosingFunction() const
Block *Symbol::enclosingBlock() const
{
- for (Scope *s = _scope; s; s = s->enclosingScope()) {
+ for (Scope *s = _enclosingScope; s; s = s->enclosingScope()) {
if (Block *block = s->asBlock())
return block;
}
return 0;
}
-Scope *Symbol::scope() const
-{
- return _scope;
-}
-
unsigned Symbol::index() const
{ return _index; }
@@ -430,7 +425,7 @@ void Symbol::copy(Symbol *other)
_hashCode = other->_hashCode;
_storage = other->_storage;
_visibility = other->_visibility;
- _scope = other->_scope;
+ _enclosingScope = other->_enclosingScope;
_index = other->_index;
_next = other->_next;
_fileId = other->_fileId;
diff --git a/src/libs/3rdparty/cplusplus/Symbol.h b/src/libs/3rdparty/cplusplus/Symbol.h
index 30cd28797b..919268b14b 100644
--- a/src/libs/3rdparty/cplusplus/Symbol.h
+++ b/src/libs/3rdparty/cplusplus/Symbol.h
@@ -290,9 +290,8 @@ public:
/// Returns the enclosing Block scope.
Block *enclosingBlock() const;
- Scope *scope() const;
- void setScope(Scope *enclosingScope); // ### make me private
- void resetScope(); // ### make me private
+ void setEnclosingScope(Scope *enclosingScope); // ### make me private
+ void resetEnclosingScope(); // ### make me private
void setSourceLocation(unsigned sourceLocation, TranslationUnit *translationUnit); // ### make me private
void visitSymbol(SymbolVisitor *visitor);
@@ -305,7 +304,7 @@ protected:
private:
const Name *_name;
- Scope *_scope;
+ Scope *_enclosingScope;
Symbol *_next;
const StringLiteral *_fileId;
unsigned _sourceLocation;
diff --git a/src/libs/3rdparty/cplusplus/Symbols.cpp b/src/libs/3rdparty/cplusplus/Symbols.cpp
index 6101e51485..dc20da15aa 100644
--- a/src/libs/3rdparty/cplusplus/Symbols.cpp
+++ b/src/libs/3rdparty/cplusplus/Symbols.cpp
@@ -722,7 +722,7 @@ bool Class::matchType0(const Type *otherType, TypeMatcher *matcher) const
}
unsigned Class::baseClassCount() const
-{ return _baseClasses.size(); }
+{ return unsigned(_baseClasses.size()); }
BaseClass *Class::baseClassAt(unsigned index) const
{ return _baseClasses.at(index); }
@@ -885,7 +885,7 @@ void ObjCClass::setBaseClass(ObjCBaseClass *baseClass)
{ _baseClass = baseClass; }
unsigned ObjCClass::protocolCount() const
-{ return _protocols.size(); }
+{ return unsigned(_protocols.size()); }
ObjCBaseProtocol *ObjCClass::protocolAt(unsigned index) const
{ return _protocols.at(index); }
@@ -951,7 +951,7 @@ ObjCProtocol::~ObjCProtocol()
{}
unsigned ObjCProtocol::protocolCount() const
-{ return _protocols.size(); }
+{ return unsigned(_protocols.size()); }
ObjCBaseProtocol *ObjCProtocol::protocolAt(unsigned index) const
{ return _protocols.at(index); }
diff --git a/src/libs/3rdparty/cplusplus/Templates.cpp b/src/libs/3rdparty/cplusplus/Templates.cpp
index 8e9e2d8170..2e9772e191 100644
--- a/src/libs/3rdparty/cplusplus/Templates.cpp
+++ b/src/libs/3rdparty/cplusplus/Templates.cpp
@@ -188,7 +188,7 @@ Symbol *CloneSymbol::cloneSymbol(Symbol *symbol, Subst *subst)
SymbolSubstPair symbolSubstPair = std::make_pair(symbol, subst);
if (_cache.find(symbolSubstPair) != _cache.end()) {
Symbol *cachedSymbol = _cache[symbolSubstPair];
- if (cachedSymbol->scope() == symbol->scope())
+ if (cachedSymbol->enclosingScope() == symbol->enclosingScope())
return cachedSymbol;
}
@@ -443,7 +443,7 @@ void CloneName::visit(const TemplateNameId *name)
_name = _control->templateNameId(_clone->identifier(name->identifier()), name->isSpecialization());
else
_name = _control->templateNameId(_clone->identifier(name->identifier()), name->isSpecialization(),
- &args[0], args.size());
+ &args[0], unsigned(args.size()));
}
void CloneName::visit(const DestructorNameId *name)
@@ -473,7 +473,7 @@ void CloneName::visit(const SelectorNameId *name)
std::vector<const Name *> names(name->nameCount());
for (unsigned i = 0; i < names.size(); ++i)
names[i] = _clone->name(name->nameAt(i), _subst);
- _name = _control->selectorNameId(&names[0], names.size(), name->hasArguments());
+ _name = _control->selectorNameId(&names[0], unsigned(names.size()), name->hasArguments());
}
@@ -531,7 +531,7 @@ Symbol *Clone::instantiate(Template *templ, const FullySpecifiedType *const args
}
}
if (Symbol *inst = symbol(templ->declaration(), &subst)) {
- inst->setScope(templ->enclosingScope());
+ inst->setEnclosingScope(templ->enclosingScope());
return inst;
}
return 0;
diff --git a/src/libs/3rdparty/cplusplus/Token.cpp b/src/libs/3rdparty/cplusplus/Token.cpp
index ed3319aeab..ab6d3c0317 100644
--- a/src/libs/3rdparty/cplusplus/Token.cpp
+++ b/src/libs/3rdparty/cplusplus/Token.cpp
@@ -23,7 +23,7 @@
using namespace CPlusPlus;
-static const char *token_names[] = {
+const char *token_names[] = {
(""), ("<error>"),
("<C++ comment>"), ("<C++ doxy comment>"),
diff --git a/src/libs/3rdparty/cplusplus/TranslationUnit.cpp b/src/libs/3rdparty/cplusplus/TranslationUnit.cpp
index 79b5af059c..0ecb9827f8 100644
--- a/src/libs/3rdparty/cplusplus/TranslationUnit.cpp
+++ b/src/libs/3rdparty/cplusplus/TranslationUnit.cpp
@@ -117,7 +117,7 @@ const char *TranslationUnit::spell(unsigned index) const
}
unsigned TranslationUnit::commentCount() const
-{ return _comments->size(); }
+{ return unsigned(_comments->size()); }
const Token &TranslationUnit::commentAt(unsigned index) const
{ return _comments->at(index); }
@@ -266,11 +266,11 @@ void TranslationUnit::tokenize()
}
goto _Lrecognize;
} else if (tk.f.kind == T_LBRACE) {
- braces.push(_tokens->size());
+ braces.push(unsigned(_tokens->size()));
} else if (tk.f.kind == T_RBRACE && ! braces.empty()) {
const unsigned open_brace_index = braces.top();
braces.pop();
- (*_tokens)[open_brace_index].close_brace = _tokens->size();
+ (*_tokens)[open_brace_index].close_brace = unsigned(_tokens->size());
} else if (tk.isComment()) {
_comments->push_back(tk);
continue; // comments are not in the regular token stream
@@ -298,7 +298,7 @@ void TranslationUnit::tokenize()
for (; ! braces.empty(); braces.pop()) {
unsigned open_brace_index = braces.top();
- (*_tokens)[open_brace_index].close_brace = _tokens->size();
+ (*_tokens)[open_brace_index].close_brace = unsigned(_tokens->size());
}
}
@@ -428,8 +428,7 @@ void TranslationUnit::getPosition(unsigned tokenOffset,
// If this token is expanded we already have the information directly from the expansion
// section header. Otherwise, we need to calculate it.
- std::map<unsigned, std::pair<unsigned, unsigned> >::const_iterator it =
- _expandedLineColumn.find(tokenOffset);
+ TokenLineColumn::const_iterator it = _expandedLineColumn.find(tokenOffset);
if (it != _expandedLineColumn.end()) {
lineNumber = it->second.first;
columnNumber = it->second.second + 1;
@@ -554,8 +553,7 @@ bool TranslationUnit::maybeSplitGreaterGreaterToken(unsigned tokenIndex)
_tokens->insert(_tokens->begin() + tokenIndex + 1, newGreater);
- std::map<unsigned, std::pair<unsigned, unsigned> >::const_iterator it =
- _expandedLineColumn.find(tok.offset);
+ TokenLineColumn::const_iterator it = _expandedLineColumn.find(tok.offset);
if (it != _expandedLineColumn.end()) {
const std::pair<unsigned, unsigned> newPosition(it->second.first, it->second.second + 1);
_expandedLineColumn.insert(std::make_pair(newGreater.offset, newPosition));
diff --git a/src/libs/3rdparty/cplusplus/TranslationUnit.h b/src/libs/3rdparty/cplusplus/TranslationUnit.h
index fb4ee91b7c..d6816b99a2 100644
--- a/src/libs/3rdparty/cplusplus/TranslationUnit.h
+++ b/src/libs/3rdparty/cplusplus/TranslationUnit.h
@@ -27,7 +27,18 @@
#include "DiagnosticClient.h"
#include <cstdio>
#include <vector>
-#include <map>
+
+#if !(__cplusplus > 199711L || __GXX_EXPERIMENTAL_CXX0X__ || _MSC_VER >= 1600 || defined( _LIBCPP_VERSION ))
+#define USE_TR1
+#endif
+
+#if defined(_MSC_VER) && _MSC_VER < 1600
+# include <map>
+#elif defined(USE_TR1)
+# include <tr1/unordered_map>
+#else
+# include <unordered_map>
+#endif
namespace CPlusPlus {
@@ -52,7 +63,7 @@ public:
void setSource(const char *source, unsigned size);
- unsigned tokenCount() const { return _tokens->size(); }
+ unsigned tokenCount() const { return unsigned(_tokens->size()); }
const Token &tokenAt(unsigned index) const { return _tokens->at(index); }
int tokenKind(unsigned index) const { return _tokens->at(index).f.kind; }
const char *spell(unsigned index) const;
@@ -175,7 +186,15 @@ private:
std::vector<Token> *_comments;
std::vector<unsigned> _lineOffsets;
std::vector<PPLine> _ppLines;
- std::map<unsigned, std::pair<unsigned, unsigned> > _expandedLineColumn; // TODO: Replace this for a hash
+#if defined(_MSC_VER) && _MSC_VER < 1600
+ // MSVC2008 and earlier do not implement TR1.
+ typedef std::map<unsigned, std::pair<unsigned, unsigned> > TokenLineColumn;
+#elif defined(USE_TR1)
+ typedef std::tr1::unordered_map<unsigned, std::pair<unsigned, unsigned> > TokenLineColumn;
+#else
+ typedef std::unordered_map<unsigned, std::pair<unsigned, unsigned> > TokenLineColumn;
+#endif
+ TokenLineColumn _expandedLineColumn;
MemoryPool *_pool;
AST *_ast;
TranslationUnit *_previousTranslationUnit;
diff --git a/src/libs/3rdparty/cplusplus/cplusplus.pri b/src/libs/3rdparty/cplusplus/cplusplus.pri
index e179f54c89..004ef4014e 100644
--- a/src/libs/3rdparty/cplusplus/cplusplus.pri
+++ b/src/libs/3rdparty/cplusplus/cplusplus.pri
@@ -1,7 +1,3 @@
-
-DEPENDPATH += $$PWD
-INCLUDEPATH += $$PWD
-
HEADERS += \
$$PWD/cppassert.h \
$$PWD/CPlusPlus.h \