[cfe-commits] r163402 - /cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
Jordan Rose
jordan_rose at apple.com
Fri Sep 7 11:36:17 PDT 2012
Author: jrose
Date: Fri Sep 7 13:36:17 2012
New Revision: 163402
URL: http://llvm.org/viewvc/llvm-project?rev=163402&view=rev
Log:
[analyzer] Don't use the address of a temporary CFGElement.
GCC destroys temporary objects more aggressively than clang, so this
results in incorrect behavior when compiling GCC Release builds.
We could avoid this issue under C++11 by preventing getAs from being
called when 'this' is an rvalue:
template<class ElemTy> const ElemTy *getAs() const & { ... }
template<class ElemTy> const ElemTy *getAs() const && = delete;
Unfortunately, we do not have compatibility macros for this behavior yet.
This will hopefully fix PR13760 and PR13762.
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp?rev=163402&r1=163401&r2=163402&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp Fri Sep 7 13:36:17 2012
@@ -514,7 +514,8 @@
return;
}
- const CFGStmt *CS = (*Block)[Idx].getAs<CFGStmt>();
+ CFGElement Elem = (*Block)[Idx];
+ const CFGStmt *CS = Elem.getAs<CFGStmt>();
const Stmt *St = CS ? CS->getStmt() : 0;
PostStmt Loc(St, N->getLocationContext());
More information about the cfe-commits
mailing list