Chris Lattner [Sun, 9 May 2010 05:36:05 +0000 (05:36 +0000)]
pchify CXXMemberCallExpr correctly. Before it would serialize
and deserialize as a CallExpr which is close, but ends up
deserializing with the wrong stmt class.
Douglas Gregor [Sat, 8 May 2010 23:34:38 +0000 (23:34 +0000)]
Fix a silly bootstrap-breaking thinko, where we were trying to convert
non-existent condition expressions to boolean values during template
instantiation.
Douglas Gregor [Sat, 8 May 2010 23:05:03 +0000 (23:05 +0000)]
Improve our handling of the -Wunused-variable warning in templates. In
particular, don't complain about unused variables that have dependent
type until instantiation time, so that we can look at the type of the
variable. Moreover, only complain about unused variables that have
neither a user-declared constructor nor a non-trivial destructor.
Anders Carlsson [Sat, 8 May 2010 22:35:05 +0000 (22:35 +0000)]
Add a SizeOfLargestEmptySubobject member to ASTRecordLayout. For C++ classes this will hold the largest empty subobject or 0 if the class doesn't have any empty subobjects.
Douglas Gregor [Sat, 8 May 2010 22:20:28 +0000 (22:20 +0000)]
When instantiating statements that involve conditions (if, while, do,
for, and switch), be careful to construct the full expressions as soon
as we perform template instantation, so we don't either forget to call
temporary destructors or destroy temporaries at the wrong time. This
is the template-instantiation analogue to r103187, during which I
hadn't realized that the issue would affect the handling of these
constructs differently inside and outside of templates.
Douglas Gregor [Sat, 8 May 2010 19:15:54 +0000 (19:15 +0000)]
Improve overload-candidate diagnostic for a function template that
failed because the explicitly-specified template arguments did not
match its template parameters, e.g.,
Douglas Gregor [Sat, 8 May 2010 18:13:28 +0000 (18:13 +0000)]
When template argument deduction fails because the call had too
many/too few arguments, use the same diagnostic we use for arity
mismatches in non-templates (but note that it's a function template).
Douglas Gregor [Sat, 8 May 2010 17:41:32 +0000 (17:41 +0000)]
When printing a non-viable overload candidate that failed due to
conflicting deduced template argument values, give a more specific
reason along with those values, e.g.,
Devang Patel [Fri, 7 May 2010 23:05:55 +0000 (23:05 +0000)]
If there is not any debug info for type then do not emit debug info for this variable.
A recent change to tightly verify debug info prepared by FE caught this.
This fixes unittest build.
Douglas Gregor [Fri, 7 May 2010 22:11:34 +0000 (22:11 +0000)]
Introduce a recursive AST visitor that makes it trivial to recursively
walk an entire AST, including all of the types, declarations,
statements, and expressions, and allowing one to easily override the
behavior of the walk at any particular node kind.
John McCall [Fri, 7 May 2010 22:08:54 +0000 (22:08 +0000)]
The FP constant evaluator was missing a few cases of unary operators that return floats
but whose operand isn't a float: specifically, __real__ and __imag__. Instead
of filtering these out, just implement them.
Chris Lattner [Fri, 7 May 2010 20:35:24 +0000 (20:35 +0000)]
clean up isBeforeInTranslationUnit by factoring out some common
code into a MoveUpIncludeHierarchy helper, and use the helper to
fix a case involving macros which regressed from my recent patch.
Douglas Gregor [Fri, 7 May 2010 19:42:26 +0000 (19:42 +0000)]
Reapply the reference-binding patch applied below, along with a fix to
ensure that we complete the type when we need to look at constructors
during reference binding.
When determining whether the two types involved in reference binding
are reference-compatible, reference-related, etc., do not complete the
type of the reference itself because it is not necessary to determine
well-formedness of the program. Complete the type that we are binding
to, since that can affect whether we know about a derived-to-base
conversion.
Chris Lattner [Fri, 7 May 2010 05:51:13 +0000 (05:51 +0000)]
reimplement the guts of SourceManager::isBeforeInTranslationUnit
to be algorithmically faster and avoid an std::map. This routine
basically boils down to finding the nearest common ancestor in a
tree, and we (implicitly) have information about nesting depth,
use it!
This wraps up rdar://7948633 - SourceManager::isBeforeInTranslationUnit has poor performance
Chris Lattner [Fri, 7 May 2010 01:17:07 +0000 (01:17 +0000)]
reimplement the caching in the SourceManager::isBeforeInTranslationUnit()
method to be correct. Right now it correctly computes the cache, then
goes ahead and computes the result the hard way, then asserts that they
match. Next I'll actually turn it on.
Douglas Gregor [Fri, 7 May 2010 00:28:31 +0000 (00:28 +0000)]
When determining whether the two types involved in reference binding
are reference-compatible, reference-related, etc., do not complete the
type of the reference itself because it is not necessary to determine
well-formedness of the program. Complete the type that we are binding
to, since that can affect whether we know about a derived-to-base
conversion.
Douglas Gregor [Thu, 6 May 2010 23:13:35 +0000 (23:13 +0000)]
Do not give implicitly-defined virtual members functions
available_externally linkage, since they may not have been given a
strong definition in another translation unit. Without this patch, the
following test case fails to link with a GCC-compiled libstdc++:
#include <sstream>
int main() { std::basic_stringbuf<char> bs; }
Douglas Gregor [Thu, 6 May 2010 22:18:21 +0000 (22:18 +0000)]
The global variable for the VTT might not have external linkage; allow
us to find local variables, too. Fixes the last remaining
Boost.Rational failure.
Douglas Gregor [Thu, 6 May 2010 17:25:47 +0000 (17:25 +0000)]
Rework our handling of temporary objects within the conditions of
if/switch/while/do/for statements. Previously, we would end up either:
(1) Forgetting to destroy temporaries created in the condition (!),
(2) Destroying the temporaries created in the condition *before*
converting the condition to a boolean value (or, in the case of a
switch statement, to an integral or enumeral value), or
(3) In a for statement, destroying the condition's temporaries at
the end of the increment expression (!).
We now destroy temporaries in conditions at the right times. This
required some tweaking of the Parse/Sema interaction, since the parser
was building full expressions too early in many places.
mike-m [Thu, 6 May 2010 14:11:13 +0000 (14:11 +0000)]
Reposition clang-builtin include/ to immediately precede /usr/include/,
matching gcc compiler. Fixes #include_next <...> shenanigans that lead to
file-not-found failures with <cstddef> on libstdc++ 4.3.[012].
Updated C++ include header search paths for various Debian/Ubuntu and Fedora
linux distros.
John McCall [Thu, 6 May 2010 09:25:57 +0000 (09:25 +0000)]
Push TypeSourceInfo::getTypeLoc() into a header file so that it's
inlineable. That header file has to be TypeLoc.h, which means that
TypeLoc.h needs to depend on Decl.h because TypeSourceInfo doesn't
have its own header. That could be remedied, though.
John McCall [Thu, 6 May 2010 08:58:33 +0000 (08:58 +0000)]
Rearchitect -Wconversion and -Wsign-compare. Instead of computing them
"bottom-up" when implicit casts and comparisons are inserted, compute them
"top-down" when the full expression is finished. Makes it easier to
coordinate warnings and thus implement -Wconversion for signedness
conversions without double-warning with -Wsign-compare. Also makes it possible
to realize that a signedness conversion is okay because the context is
performing the inverse conversion. Also simplifies some logic that was
trying to calculate the ultimate comparison/result type and getting it wrong.
Also fixes a problem with the C++ explicit casts which are often "implemented"
in the AST with a series of implicit cast expressions.
John McCall [Thu, 6 May 2010 08:49:23 +0000 (08:49 +0000)]
Remember the number of positive and negative bits used by the enumerators of
an enum in the enum decl itself. Use some spare bits from TagDecl for this
purpose.
Chris Lattner [Thu, 6 May 2010 05:50:07 +0000 (05:50 +0000)]
optimize builtin_isnan/isinf to not do an extraneous extension from
float -> double (which happens because they are modelled as int(...)
functions), and add a testcase for isinf.
Chris Lattner [Thu, 6 May 2010 05:35:16 +0000 (05:35 +0000)]
implement part of PR6083: codegen support for isinf. Like isnan,
this is generating correct but suboptimal (extra extend to double)
code for the float case. Will investigate next.
Remove a dependency on Frontend headers in the Driver library. Also saves
building and passing arguments to cc1 layer when setting values to their
defaults.
Zhongxing Xu [Thu, 6 May 2010 02:59:29 +0000 (02:59 +0000)]
Make -analyzer-inline-call not a separate analysis. Instead it's a boolean
flag now, and can be used with other analyses. Only turned it on for C++
methods for now.