Fixes an obscure bug in importd block variable layout
information when imported variable is used
more than once. Originally though to be a bug in importing
block varibles. Fixes radar 8417746.
Daniel Dunbar [Fri, 10 Sep 2010 21:42:03 +0000 (21:42 +0000)]
Driver: Set TOOL_NO_EXPORTS when building a "production" compiler, we don't
currently expect that to be useful for plugins, and this is important for
startup performance:
--
ddunbar@lordcrumb:tmp$ touch empty.c
ddunbar@lordcrumb:tmp$ runN 100 ~/llvm.obj.64/Release/bin/clang -c empty.c
name avg min med max SD total
user 0.0054 0.0052 0.0054 0.0055 0.0000 0.5350
sys 0.0084 0.0090 0.0078 0.0087 0.0008 0.8390
wall 0.0149 0.0149 0.0149 0.0149 0.0003 1.4943
ddunbar@lordcrumb:tmp$ runN 100 ~/llvm.obj.64/Release/bin/clang -c empty.c
name avg min med max SD total
user 0.0036 0.0036 0.0036 0.0038 0.0000 0.3646
sys 0.0072 0.0071 0.0068 0.0070 0.0006 0.7158
wall 0.0123 0.0123 0.0122 0.0136 0.0003 1.2262
--
Make 'setProperty()', 'setBase()', and 'setLocation()' private in ObjCPropertyRefExpr, and friend ASTStmtReader so that it is the only class that can use them.
Tom Care [Fri, 10 Sep 2010 00:44:44 +0000 (00:44 +0000)]
Added AnalyzerStatsChecker, a path sensitive check that reports visitation statistics about analysis. Running clang with the -analyzer-stats flag will emit warnings containing the information. We can then run a postanalysis script to take this data and give useful information about how much the analyzer missed in a project.
property reference expression used on lhs of assignment
follows objective's semantics and is not overload'able
with an assignment operator. Fixes a crash and a missing
diagnostics. Radar 8379892.
Clean up obtuse wording of checker diagnostic of using an uninitialized value in a function call.
Fixes: <rdar://problem/8409480> “warning: Pass-by-value argument in function call is undefined” message can be improved
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113554 91177308-0d34-0410-b5e6-96231b3b80d8
Douglas Gregor [Thu, 9 Sep 2010 22:45:38 +0000 (22:45 +0000)]
When we parse a pragma, keep track of how that pragma was originally
spelled (#pragma, _Pragma, __pragma). In -E mode, use that information
to add appropriate newlines when translating _Pragma and __pragma into
#pragma, like GCC does. Fixes <rdar://problem/8412013>.
Douglas Gregor [Thu, 9 Sep 2010 21:42:20 +0000 (21:42 +0000)]
Teach libclang to walk the base and member initializers of a
constructor, in source order. Also introduces a new reference kind for
class members, which is used here (for member initializers) and will
also be used for designated initializers and offsetof.
Use FindReportInEquivalenceClass to identify all the nodes used for the trimmed graph (in BugReporter). This fixes a problem where a leak that happened to occur on both an exit() path and a non-exit() path was getting reported with the exit() path (which users don't care about).
This fixes:
<rdar://problem/8331641> leak reports should not show paths that end with exit() (but ones that don't end with exit())
Daniel Dunbar [Thu, 9 Sep 2010 17:38:22 +0000 (17:38 +0000)]
Frontend: Add -cxx-system-include option which can be used to specify an
explicit list for the C++ system include directories at the -cc1 level, as an
alternative to the horrible AddDefaultCPlusPlusIncludePaths().
Douglas Gregor [Thu, 9 Sep 2010 16:55:46 +0000 (16:55 +0000)]
Eliminate some unnecessary uses of TreeTransform::TemporaryBase. There
are still a few (legitimate, unfortunate) uses of this hack around,
but at least now there are fewer.
Douglas Gregor [Thu, 9 Sep 2010 16:33:13 +0000 (16:33 +0000)]
Eliminate the comma locations from all of the Sema routines that deal
with comma-separated lists. We never actually used the comma
locations, nor did we store them in the AST, but we did manage to
waste time during template instantiation to produce fake locations.
this fixes all analyser test failures in my gcc34-based
environment
how the cast result could bind to the non-const ref is
somewhat mysterious and remains to be investigated; to
avoid similar miscompilations (by gcc34 only?)
Rename GRState::getSVal() -> getRawSVal() and getSimplifiedSVal() -> getSVal().
The end result is now we eagarly constant-fold symbols in the analyzer that are perfectly constrained
to be a constant value. This allows us to recover some path-sensitivity in some cases by lowering
the required level of reasoning power needed to evaluate some expressions.
The net win from this change is that the false positive in PR 8015 is fixed, and we also
find more idempotent operations bugs.
We do, however, regress with the BugReporterVisitors, which need to be modified to understand
this constant folding (and look past it). This causes some diagnostic regressions in plist-output.m
which will get addressed in a future patch. plist-output.m is now marked XFAIL, while
plist-output-alternate.m now tests that the plist output is working, but with the suboptimal
diagnostics. This second test file will eventually be removed.
It appears that technically a null format string is not warned under -Wformat-nonliteral, as
the function processing the format string can decided whether or not to accept a null format string (e.g., asl_log). Fixes <rdar://problem/8269537>.
Tom Care [Thu, 9 Sep 2010 02:04:52 +0000 (02:04 +0000)]
Simplified reachability checking in IdempotentOperationChecker and added a helper function for path display.
- Created private class CFGReachabilityAnalysis, which provides cached reachability lookups in the CFG
- Simplified PathWasCompletelyAnalyzed to use the new reachability class
- Added getLastRelevantNodes function for future use with path displaying in BugReporter
Relax __attribute_((nonnull)) checking to allow the attribute on functions with no pointer arguments. GCC doesn't warn
in this case, and the attribute is trivially satisfied (and benign). Fixes <rdar://problem/8364828>.
Block ivar layout must assume that the 'isa'
field of the block descriptor is GC'able (scanned)
as this what the runtime expects (one can send it
messages). Radar 8394947.
Enhance -Wunreachable-code to not consider the 'default:' branch of a switch statement live if a switch on an enum value has
explicit 'case:' statements for each enum value.
Add 'filtered_pred_iterator' and 'filtered_succ_iterator' to CFGBlock. This allows a client
to selectively walk successors/predecessors based on commonly used filters. For starters, add
a filter to ignore 'default:' cases for SwitchStmts when all enum values are covered by CaseStmts.
When building SwitchStmts in Sema, record whether all the enum values of a switch(enum) where
covered by individual case statements. Flow-based analyses may wish to consult this information,
and recording this in the AST allows us to obviate reconstructing this information later when
we build the CFG.
Douglas Gregor [Wed, 8 Sep 2010 23:56:00 +0000 (23:56 +0000)]
Push the range associated with a nested-name-specifier further through
TreeTransform, since we were getting an empty source range where we
shouldn't. Sadly, the test case is Boost.Proto, and isn't worth
reducing.
Douglas Gregor [Wed, 8 Sep 2010 23:14:30 +0000 (23:14 +0000)]
Fix a few minor issues with parsing and semantic analysis of C++
typeid expressions:
- make sure we have a proper source location for the closing ')'
- cache the declaration of std::type_info once we've found it
Douglas Gregor [Wed, 8 Sep 2010 21:40:08 +0000 (21:40 +0000)]
Use the new-initialization code for initializing scalars with a
function-style cast. Previously, we had a (redundant, incorrect)
semantic-checking path for non-class types, which allowed
value-initialization of a reference type and then crashed.
PCH got a severe beating by the boost-using test case reported here: http://llvm.org/PR8099
Fix issues like:
-When PCH reading, make sure Decl's getASTContext() doesn't get called since a Decl in the parent hierarchy may be initializing.
-In ASTDeclReader::VisitFunctionDecl VisitRedeclarable should be called before using FunctionDecl's isCanonicalDecl()
-In ASTDeclReader::VisitRedeclarableTemplateDecl CommonOrPrev must be initialized before anything else.
John McCall [Wed, 8 Sep 2010 02:01:27 +0000 (02:01 +0000)]
Put the tautological-comparison-of-unsigned-against-zero warnings in
-Wtautological-compare instead of -Wsign-compare, which also implies turning
them on by default.
Sebastian Redl [Wed, 8 Sep 2010 00:48:43 +0000 (00:48 +0000)]
Allow (cv) void and incomplete arrays to be passed to the type traits.
Fixes PR8110, and thus PR8109, PR8097, and parts of PR8101, PR8105 and PR8107. Only a few traits have tests for incomplete arrays, since I'm not yet clear what the result for them should be; Howards wants to file a DR to change the standard.
Douglas Gregor [Wed, 8 Sep 2010 00:15:04 +0000 (00:15 +0000)]
Provide proper type-source location information for
CXXTemporaryObjectExpr, CXXScalarValueInitExpr, and
CXXUnresolvedConstructExpr, getting rid of a bunch of FIXMEs in the
process.
Local static block variable referecned in its
block-literal initializer expression causes IRgen to crash.
This patch fixes by saving it in StaticLocalDecl map
already used for such purposes. (radar 8390455).