Douglas Gregor [Sun, 12 Sep 2010 08:07:23 +0000 (08:07 +0000)]
When performing overload resolution, only compare the final conversion
sequences for two conversion functions when in fact we are in the text
of initialization by a user-defined conversion sequences. Fixes PR8034.
Douglas Gregor [Sun, 12 Sep 2010 07:22:28 +0000 (07:22 +0000)]
Don't complain about useless user-defined conversion functions when
they were instantiated from a template. In template metaprogramming,
stuff happens. Fixes PR8065.
Douglas Gregor [Sun, 12 Sep 2010 05:24:55 +0000 (05:24 +0000)]
When diagnosing C++ [temp.expl.spec]p3 in C++98/03 mode, downgrade the
error to a warning if we're in a case that would be allowed in
C++0x. This "fixes" PR8084 by making Clang accept more code than GCC
and (non-strict) EDG do.
Also, add the missing test case for the C++0x semantics, which should
have been in r113717.
Douglas Gregor [Sun, 12 Sep 2010 05:08:28 +0000 (05:08 +0000)]
Implement C++0x semantics for [temp.expl.spec]p2, which loosens the
restrictions on out-of-line specializations to allow them anywhere in
an enclosing context. Motivated by PR8084.
Add basic support for Microsoft enum forward declaration.
Assigning an underlying integral type to an enum forward declaration will come in a next patch.
Douglas Gregor [Sun, 12 Sep 2010 04:28:07 +0000 (04:28 +0000)]
Implement the "note" in C++ [over.built]p1, which is actually meant to
be a semantic requirement that a built-in overloaded operator is not
added to the overload set of there is already a user-defined
overloaded operator with the same parameter types. Fixes PR8087.
Douglas Gregor [Sat, 11 Sep 2010 23:32:50 +0000 (23:32 +0000)]
Teach the EvaluatedExprVisitor and its client, which marks
declarations in potentially-evaluated subexpressions, about
recursion. Fixes the release-mode self-host failure I introduced in
r113700.
Douglas Gregor [Sat, 11 Sep 2010 20:30:02 +0000 (20:30 +0000)]
Update documentation to reflect the addition of support for in-class
initialization of static const floating-point data membmers (John's
patch, in r113663).
Douglas Gregor [Sat, 11 Sep 2010 20:24:53 +0000 (20:24 +0000)]
When parsing default function arguments, do not mark any declarations
used in the default function argument as "used". Instead, when we
actually use the default argument, make another pass over the
expression to mark any used declarations as "used" at that point. This
addresses two kinds of related problems:
1) We were marking some declarations "used" that shouldn't be,
because we were marking them too eagerly.
2) We were failing to mark some declarations as "used" when we
should, if the first time it was instantiated happened to be an
unevaluated context, we wouldn't mark them again at a later point.
I've also added a potentially-handy visitor class template
EvaluatedExprVisitor, which only visits the potentially-evaluated
subexpressions of an expression. I bet this would have been useful for
noexcept...
Douglas Gregor [Sat, 11 Sep 2010 18:05:19 +0000 (18:05 +0000)]
The two libclang crash-recovery tests that involve precompiled
preambles end up leaving the precompiled preambles around. This is by
design, since we do minimal cleanup during crash recovery. However,
it's unfortunate for testing, so introduce a hook that allows these
two tests to put the precompiled preamble somewhere where we can
delete them after testing.
Douglas Gregor [Sat, 11 Sep 2010 17:56:52 +0000 (17:56 +0000)]
If we fail to create a temporary file for the precompiled preamble,
just abort creation of the precompiled preamble rather than doing
silly things. This is the second part of the fix for the weird
preamble-related failures on Windows. Big thanks to Francois Pichet
for the great detective work!
Douglas Gregor [Sat, 11 Sep 2010 17:51:16 +0000 (17:51 +0000)]
Tweak GetPreamblePCHPath() to more closely match the behavior of the
Windows GetTempPath() function, and be sure to create the directory in
which the precompiled preamble will reside before creating the
temporary file itself.
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