diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2013-08-23 11:52:46 +0200 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2013-09-09 15:06:51 +0200 |
commit | 3eaf044045fb87d2611eb95e6c9885a862fbecb0 (patch) | |
tree | 22fe7ce74c3c28e531d2d55a56d524a2ee0e495c /src/libs/3rdparty/cplusplus/TranslationUnit.h | |
parent | b9c64a392ac2a693377eea92b82878b694cf9ae0 (diff) |
C++: replace a tree by a hash
Be more environment friendly by using less trees.
Change-Id: I54d3b23d697a3b72a6a803688a8da0eddaad3e17
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/libs/3rdparty/cplusplus/TranslationUnit.h')
-rw-r--r-- | src/libs/3rdparty/cplusplus/TranslationUnit.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/libs/3rdparty/cplusplus/TranslationUnit.h b/src/libs/3rdparty/cplusplus/TranslationUnit.h index fb4ee91b7c..bf182b0801 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 { @@ -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; |