Commit Graph

13576 Commits

Author SHA1 Message Date
Chris Lattner b7e7f722a2 pchify CXXMemberCallExpr correctly. Before it would serialize
and deserialize as a CallExpr which is close, but ends up
deserializing with the wrong stmt class.

llvm-svn: 103371
2010-05-09 05:36:05 +00:00
Anders Carlsson 82828a31f6 Cleanup.
llvm-svn: 103370
2010-05-09 05:03:38 +00:00
Douglas Gregor 62c281a873 Be more careful about picking a template parameter when we fail to substitute explicit template arguments into a function template
llvm-svn: 103369
2010-05-09 01:26:06 +00:00
David Chisnall e0b5b3a1c5 Tweaked selector mangling again (GNU runtime).
llvm-svn: 103368
2010-05-09 01:01:43 +00:00
Douglas Gregor 6d319c62c5 Fix a silly bootstrap-breaking thinko, where we were trying to convert
non-existent condition expressions to boolean values during template
instantiation.

llvm-svn: 103364
2010-05-08 23:34:38 +00:00
Anders Carlsson 15837f8f63 Actually compute the empty subobject sizes. No functionality change yet.
llvm-svn: 103363
2010-05-08 23:06:26 +00:00
Douglas Gregor 14f232ea20 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.

llvm-svn: 103362
2010-05-08 23:05:03 +00:00
Douglas Gregor 0bbe94d6df Don't complain about an __builtin_va_arg expression's result being
unused, since the operation has side effects.

llvm-svn: 103360
2010-05-08 22:41:50 +00:00
Anders Carlsson 2357bfd9d0 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.
llvm-svn: 103359
2010-05-08 22:35:05 +00:00
Douglas Gregor ff73a9e380 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.

Fixes a regression in Boost.Function.

llvm-svn: 103357
2010-05-08 22:20:28 +00:00
David Chisnall 2ec6cff9d0 Fixed linkage problem from last commit (GNU runtime).
llvm-svn: 103355
2010-05-08 21:55:04 +00:00
David Chisnall 0a24fd3744 Tweaked selector generation (GNU runtime). Removed the use of GlobalAliases in the generated bitcode.
llvm-svn: 103353
2010-05-08 20:58:05 +00:00
Douglas Gregor b02d6b3b94 Don't destroy the data associated with an overload resolution candidate; it's ASTContext-allocated now
llvm-svn: 103350
2010-05-08 20:20:05 +00:00
Douglas Gregor 90cf2c98bb Record template argument deduction failures for member function
templates and conversion function templates. 

llvm-svn: 103349
2010-05-08 20:18:54 +00:00
Douglas Gregor d09efd43d3 When printing an overload candidate that failed due to SFINAE, print a
specific message that includes the template arguments, e.g.,

test/SemaTemplate/overload-candidates.cpp:27:20: note: candidate template
      ignored: substitution failure [with T = int *]
  typename T::type get_type(const T&); // expected-note{{candidate ...
                   ^

llvm-svn: 103348
2010-05-08 20:07:26 +00:00
Douglas Gregor 1d72edd7c5 Improve overload-candidate diagnostic for a function template that
failed because the explicitly-specified template arguments did not
match its template parameters, e.g.,

test/SemaTemplate/overload-candidates.cpp:18:8: note: candidate
template
      ignored: invalid explicitly-specified argument for template
      parameter 'I'
  void get(const T&);
       ^
test/SemaTemplate/overload-candidates.cpp:20:8: note: candidate
template
      ignored: invalid explicitly-specified argument for 1st template
      parameter
  void get(const T&);
       ^

llvm-svn: 103344
2010-05-08 19:15:54 +00:00
Douglas Gregor 564767cf39 A leak is better than a double-free while I figure out how to address
this issue.

llvm-svn: 103343
2010-05-08 18:32:25 +00:00
Douglas Gregor 461761d68f Minor cleanup, and ban copying of OverloadCandidateSets. No
functionality change. 

llvm-svn: 103342
2010-05-08 18:20:53 +00:00
Douglas Gregor 02eb4835ce 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).

llvm-svn: 103341
2010-05-08 18:13:28 +00:00
Douglas Gregor 3626a5cac2 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.,

test/SemaTemplate/overload-candidates.cpp:4:10: note: candidate template
      ignored: deduced conflicting types for parameter 'T' ('int' vs. 'long')
const T& min(const T&, const T&); 
         ^

llvm-svn: 103339
2010-05-08 17:41:32 +00:00
Douglas Gregor 5597ab4076 When we encounter a non-dependent type during template instantiation,
mark any declarations we see inside of that type as
"referenced". Fixes PR7079.

llvm-svn: 103323
2010-05-07 23:12:07 +00:00
Devang Patel 67eba80672 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.

llvm-svn: 103320
2010-05-07 23:05:55 +00:00
Douglas Gregor e0c5497935 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.

llvm-svn: 103308
2010-05-07 22:11:34 +00:00
John McCall b1fb0d3610 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.

Fixes <rdar://problem/7958272>.

llvm-svn: 103307
2010-05-07 22:08:54 +00:00
Chris Lattner ca025db769 add PCH support for a bunch of C++ Decls, patch by
Andrew Sutton!

llvm-svn: 103301
2010-05-07 21:43:38 +00:00
John McCall eb3e4f3481 Make that null-dereference fix a little clearer by rearranging some code.
llvm-svn: 103298
2010-05-07 21:34:32 +00:00
John McCall 06f0e09756 Fix a potential null dereference in the pointer-to-bool evaluator; caught by
Eli Friedman.

llvm-svn: 103297
2010-05-07 21:01:17 +00:00
John McCall 45d55e4f26 Change the pointer / lvalue constant evaluators to build into a target reference
and return a bool.

llvm-svn: 103296
2010-05-07 21:00:08 +00:00
Chris Lattner a99fa1aee1 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.

llvm-svn: 103288
2010-05-07 20:35:24 +00:00
Douglas Gregor 496e8b345c 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. 

Re-fixes PR7080.

llvm-svn: 103283
2010-05-07 19:42:26 +00:00
Fariborz Jahanian 7828ab1ed9 Minor mod. to my last patch.
llvm-svn: 103280
2010-05-07 18:59:54 +00:00
Fariborz Jahanian fdf474b05e Fixes a Code gen crash trying to use a dot-syntax for
a property of a c++ class object (radar 7957369).

llvm-svn: 103279
2010-05-07 18:56:13 +00:00
Devang Patel ba4ad7f2fd Avoid use of DIDescriptor::getNode(). Use overloaded operators instead.
llvm-svn: 103273
2010-05-07 18:12:35 +00:00
John McCall 93d91dcdb7 Change the complex constant evaluator to return a bool instead of an APValue.
llvm-svn: 103268
2010-05-07 17:22:02 +00:00
Douglas Gregor dda3f33987 Add missing #include
llvm-svn: 103260
2010-05-07 15:59:09 +00:00
Douglas Gregor 56f14e575d Revert r103220. It seems to be breaking self-host
llvm-svn: 103259
2010-05-07 15:55:52 +00:00
Douglas Gregor 542ad31597 Add a stub frontend action for BoostCon, for next week's workshop.
llvm-svn: 103258
2010-05-07 15:41:56 +00:00
Rafael Espindola a1f9cc1bec Fix PR4386 by implementing gcc's old behaviour (4.2) when initializing
variables with a comparison of a function pointer with 0.

llvm-svn: 103253
2010-05-07 15:18:43 +00:00
Sebastian Redl fa1f70f338 A correct fix for bug 6466.
llvm-svn: 103250
2010-05-07 09:25:11 +00:00
Sebastian Redl 2e702738bb And finally, revert the accidental check-in part of the previous reversion. I'm on a roll.
llvm-svn: 103249
2010-05-07 09:11:09 +00:00
Sebastian Redl 0b4e312566 Revert 103247, it causes lots of test failures.
llvm-svn: 103248
2010-05-07 09:09:23 +00:00
Sebastian Redl 019b5dbc55 Pass the correct type to BuildMemberReferenceExpr. Fixes bug 6466.
llvm-svn: 103247
2010-05-07 09:06:26 +00:00
Chris Lattner 06821c9e90 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

llvm-svn: 103239
2010-05-07 05:51:13 +00:00
John McCall f0c4f356b8 Change Evaluate* in the constant evaluator to enforce being given an argument of
the right type.  It turns out that the code was already doing this.

llvm-svn: 103238
2010-05-07 05:46:35 +00:00
John McCall 864e396d0b Move CheckICE and isIntegerConstantExpr to ExprConstant.cpp because it seemed
like a good idea at the time.

llvm-svn: 103237
2010-05-07 05:32:02 +00:00
Chris Lattner 46e3b4808f start using the caching now that it appears to work!
llvm-svn: 103236
2010-05-07 05:10:46 +00:00
Chris Lattner 66d2f924b4 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.

llvm-svn: 103231
2010-05-07 01:17:07 +00:00
Fariborz Jahanian c5158203dd Implement encoding of methods which have instantiated
template arguments.

llvm-svn: 103221
2010-05-07 00:28:49 +00:00
Douglas Gregor d80c0238bb 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. 

Fixes PR7080.

llvm-svn: 103220
2010-05-07 00:28:31 +00:00
John McCall 7ddbcf4f4b After some discussion, conservatively extend our sentinel check to discard
casts, but still require the (casted) type to be a pointer.  Fixes PR5685.

llvm-svn: 103216
2010-05-06 23:53:00 +00:00