On 18.07.2012, at 22:03, David Blaikie <[email protected]> wrote: > On Wed, Jul 18, 2012 at 12:08 PM, Benjamin Kramer > <[email protected]> wrote: >> Author: d0k >> Date: Wed Jul 18 14:08:44 2012 >> New Revision: 160444 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=160444&view=rev >> Log: >> Remove trivial destructor from SVal. > > I notice you've found a few of these - was there any particular > approach you used? > > Would it be practical to implement a warning in Clang for this?
This was found by looking at the list of non-podlike instantiations of llvm::SmallVectorTemplateBase. It is bound to is_trivially_copyable when compiling with clang. Most of the cases were obviously heavyweight classes, but some stuck out. I think having a warning for trivial copy ctors, operator= and dtors would be a good thing, especially with the =default statement available in C++11. But I don't know how complicated it would be to implement warnings like that. - Ben > >> >> This enables the faster SmallVector in clang and also allows clang's unused >> variable warnings to be more effective. Fix the two instances that popped up. >> >> The RetainCountChecker change actually changes functionality, it would be >> nice >> if someone from the StaticAnalyzer folks could look at it. >> >> Modified: >> cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h >> cfe/trunk/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp >> cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp >> >> Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h?rev=160444&r1=160443&r2=160444&view=diff >> ============================================================================== >> --- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h >> (original) >> +++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h Wed >> Jul 18 14:08:44 2012 >> @@ -68,7 +68,6 @@ >> >> public: >> explicit SVal() : Data(0), Kind(0) {} >> - ~SVal() {} >> >> /// BufferTy - A temporary buffer to hold a set of SVals. >> typedef SmallVector<SVal,5> BufferTy; >> >> Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp?rev=160444&r1=160443&r2=160444&view=diff >> ============================================================================== >> --- cfe/trunk/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp (original) >> +++ cfe/trunk/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp Wed Jul 18 >> 14:08:44 2012 >> @@ -559,7 +559,6 @@ >> if (CE->getNumArgs() < 2) >> return State; >> >> - SVal x = State->getSVal(CE->getArg(1), C.getLocationContext()); >> // All arguments except for the very first one should get taint. >> for (unsigned int i = 1; i < CE->getNumArgs(); ++i) { >> // The arguments are pointer arguments. The data they are pointing at is >> >> Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp?rev=160444&r1=160443&r2=160444&view=diff >> ============================================================================== >> --- cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp (original) >> +++ cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp Wed Jul 18 >> 14:08:44 2012 >> @@ -3168,7 +3168,7 @@ >> // If the receiver is unknown, conjure a return value. >> SValBuilder &SVB = C.getSValBuilder(); >> unsigned Count = C.getCurrentBlockCount(); >> - SVal RetVal = SVB.getConjuredSymbolVal(0, CE, LCtx, ResultTy, Count); >> + RetVal = SVB.getConjuredSymbolVal(0, CE, LCtx, ResultTy, Count); >> } >> state = state->BindExpr(CE, LCtx, RetVal, false); >> >> >> >> _______________________________________________ >> cfe-commits mailing list >> [email protected] >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
