From 53f9d7cbf5e0c0f9445e7e7af382a546de2f4a89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 14 Jul 2016 12:37:13 +0100 Subject: build: Fix build with LLVM 3.8 --- clang-plugin/gerror-checker.cpp | 36 ++++++++++++++++++++++++++++++++++++ clang-plugin/type-manager.cpp | 5 ++++- 2 files changed, 40 insertions(+), 1 deletion(-) (limited to 'clang-plugin') diff --git a/clang-plugin/gerror-checker.cpp b/clang-plugin/gerror-checker.cpp index 11e4abc..43c341b 100644 --- a/clang-plugin/gerror-checker.cpp +++ b/clang-plugin/gerror-checker.cpp @@ -764,7 +764,11 @@ GErrorChecker::_assert_gerror_set (SVal error_location, const SourceRange &source_range) const { if (error_location.getAs ()) { +#if HAVE_LLVM_3_8 + ExplodedNode *error_node = context.generateErrorNode (state); +#else ExplodedNode *error_node = context.generateSink (state); +#endif this->_initialise_bug_reports (); auto R = llvm::make_unique (*this->_use_uninitialised, @@ -789,7 +793,11 @@ GErrorChecker::_assert_gerror_set (SVal error_location, state->assume (error_location.castAs ()); if (null_state && !not_null_state && !null_allowed) { /* Definitely NULL. */ +#if HAVE_LLVM_3_8 + ExplodedNode *error_node = context.generateErrorNode (state); +#else ExplodedNode *error_node = context.generateSink (state); +#endif this->_initialise_bug_reports (); auto R = llvm::make_unique (*this->_free_cleared, @@ -818,7 +826,11 @@ GErrorChecker::_assert_gerror_set (SVal error_location, const ErrorState *error_state = _error_map_get (state, error_sym); if (error_state != NULL && error_state->isFreed ()) { +#if HAVE_LLVM_3_8 + ExplodedNode *error_node = context.generateErrorNode (state); +#else ExplodedNode *error_node = context.generateSink (state); +#endif this->_initialise_bug_reports (); auto R = llvm::make_unique (*this->_double_free, @@ -830,7 +842,13 @@ GErrorChecker::_assert_gerror_set (SVal error_location, return false; } else if (error_state != NULL && !error_state->isSet ()) { +#if HAVE_LLVM_3_8 + ExplodedNode *error_node = context.generateErrorNode (state); +#else ExplodedNode *error_node = context.generateSink (state); +#endif + + this->_initialise_bug_reports (); auto R = llvm::make_unique (*this->_free_cleared, @@ -911,7 +929,13 @@ GErrorChecker::_assert_gerror_unset (SVal error_location, /* Branch on whether the GError* is NULL. If it isn’t NULL, there’s a * bug. */ if (error_location.getAs () && !undef_allowed) { +#if HAVE_LLVM_3_8 + ExplodedNode *error_node = context.generateErrorNode (state); +#else ExplodedNode *error_node = context.generateSink (state); +#endif + + this->_initialise_bug_reports (); auto R = llvm::make_unique (*this->_use_uninitialised, @@ -946,7 +970,13 @@ GErrorChecker::_assert_gerror_unset (SVal error_location, const ErrorState *error_state = _error_map_get (state, error_sym); if (error_state != NULL && error_state->isSet ()) { +#if HAVE_LLVM_3_8 + ExplodedNode *error_node = context.generateErrorNode (state); +#else ExplodedNode *error_node = context.generateSink (state); +#endif + + this->_initialise_bug_reports (); auto R = llvm::make_unique (*this->_overwrite_set, @@ -959,7 +989,13 @@ GErrorChecker::_assert_gerror_unset (SVal error_location, return false; } else if (error_state != NULL && error_state->isFreed () && !undef_allowed) { +#if HAVE_LLVM_3_8 + ExplodedNode *error_node = context.generateErrorNode (state); +#else ExplodedNode *error_node = context.generateSink (state); +#endif + + this->_initialise_bug_reports (); auto R = llvm::make_unique (*this->_overwrite_freed, diff --git a/clang-plugin/type-manager.cpp b/clang-plugin/type-manager.cpp index 5e81422..42ce5fa 100644 --- a/clang-plugin/type-manager.cpp +++ b/clang-plugin/type-manager.cpp @@ -47,7 +47,10 @@ TypeManager::find_type_by_name (const std::string name) return (*cached).second; } -#ifdef HAVE_LLVM_3_5 +#ifdef HAVE_LLVM_3_8 + for (SmallVectorImpl::const_iterator it = this->_context.getTypes ().begin (), + ie = this->_context.getTypes ().end (); it != ie; ++it) { +#elif HAVE_LLVM_3_5 for (SmallVectorImpl::const_iterator it = this->_context.types ().begin (), ie = this->_context.types ().end (); it != ie; ++it) { #else /* if !HAVE_LLVM_3_5 */ -- cgit v1.2.1