[cfe-commits] r161621 - in /cfe/trunk: include/clang/StaticAnalyzer/Core/PathSensitive/Store.h lib/StaticAnalyzer/Core/ExprEngineC.cpp lib/StaticAnalyzer/Core/Store.cpp test/Analysis/derived-to-base.cpp

Matt Beaumont-Gay matthewbg at google.com
Thu Aug 9 15:36:56 PDT 2012


On Thu, Aug 9, 2012 at 2:24 PM, Jordan Rose <jordan_rose at apple.com> wrote:
> Author: jrose
> Date: Thu Aug  9 16:24:02 2012
> New Revision: 161621
>
> URL: http://llvm.org/viewvc/llvm-project?rev=161621&view=rev
> Log:
> [analyzer] A CXXBaseObjectRegion should correspond to a DIRECT base.
>
> An ASTContext's RecordLayoutInfo can only be used to look up offsets of
> direct base classes, and we need the offset to make non-symbolic bindings
> in RegionStore. This change makes sure that we have one layer of
> CXXBaseObjectRegion for each base we are casting through.
>
> This was causing crashes on an internal buildbot.
>
> Modified:
>     cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
>     cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp
>     cfe/trunk/lib/StaticAnalyzer/Core/Store.cpp
>     cfe/trunk/test/Analysis/derived-to-base.cpp
>
> Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h?rev=161621&r1=161620&r2=161621&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h (original)
> +++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h Thu Aug  9 16:24:02 2012
> @@ -115,7 +115,10 @@
>    virtual SVal ArrayToPointer(Loc Array) = 0;
>
>    /// Evaluates DerivedToBase casts.
> -  virtual SVal evalDerivedToBase(SVal derived, QualType basePtrType) = 0;
> +  virtual SVal evalDerivedToBase(SVal derived, const CastExpr *Cast);
> +
> +  /// Evaluates a derived-to-base cast through a single level of derivation.
> +  virtual SVal evalDerivedToBase(SVal derived, QualType derivedPtrType) = 0;

Looks like RegionStoreManager needs to be updated as well? GCC complains thusly:
include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:118:16: error:
'virtual clang::ento::SVal
clang::ento::StoreManager::evalDerivedToBase(clang::ento::SVal, const
clang::CastExpr*)' was hidden [-Werror=overloaded-virtual]
lib/StaticAnalyzer/Core/RegionStore.cpp:194:16: error:   by 'virtual
clang::ento::SVal
{anonymous}::RegionStoreManager::evalDerivedToBase(clang::ento::SVal,
clang::QualType)' [-Werror=overloaded-virtual]

-Matt



More information about the cfe-commits mailing list