diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-08-23 18:10:53 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-08-23 18:10:53 +0000 |
commit | e5d5393efc2230de2c1d0261eb822a48e98254f3 (patch) | |
tree | 14a40d4c4b7ab6b9d96243b1a8c0534495b59a34 /clang/lib/StaticAnalyzer/Core/Environment.cpp | |
parent | adba9be7c5c201a7f54e173a210ab1efdd2311dd (diff) | |
download | bcm5719-llvm-e5d5393efc2230de2c1d0261eb822a48e98254f3.tar.gz bcm5719-llvm-e5d5393efc2230de2c1d0261eb822a48e98254f3.zip |
[analyzer] Support C++ default arguments if they are literal values.
A CXXDefaultArgExpr wraps an Expr owned by a ParmVarDecl belonging to the
called function. In general, ExprEngine and Environment ought to treat this
like a ParenExpr or other transparent wrapper expression, with the inside
expression evaluated first.
However, if we call the same function twice, we'd produce a CFG that contains
the same wrapped expression twice, and we're not set up to handle that. I've
added a FIXME to the CFG builder to come back to that, but meanwhile we can
at least handle expressions that don't need to be explicitly evaluated:
literals. This probably handles many common uses of default parameters:
true/false, null, etc.
Part of PR13385 / <rdar://problem/12156507>
llvm-svn: 162453
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/Environment.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/Environment.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/Environment.cpp b/clang/lib/StaticAnalyzer/Core/Environment.cpp index 52644f7702f..534f37858c7 100644 --- a/clang/lib/StaticAnalyzer/Core/Environment.cpp +++ b/clang/lib/StaticAnalyzer/Core/Environment.cpp @@ -99,6 +99,9 @@ SVal Environment::getSVal(const EnvironmentEntry &Entry, case Stmt::SubstNonTypeTemplateParmExprClass: E = cast<SubstNonTypeTemplateParmExpr>(E)->getReplacement(); continue; + case Stmt::CXXDefaultArgExprClass: + E = cast<CXXDefaultArgExpr>(E)->getExpr(); + continue; case Stmt::ObjCStringLiteralClass: { MemRegionManager &MRMgr = svalBuilder.getRegionManager(); const ObjCStringLiteral *SL = cast<ObjCStringLiteral>(E); |