]> granicus.if.org Git - clang/log
clang
14 years agoRework when and how vtables are emitted, by tracking where vtables are
Douglas Gregor [Thu, 13 May 2010 16:44:06 +0000 (16:44 +0000)]
Rework when and how vtables are emitted, by tracking where vtables are
"used" (e.g., we will refer to the vtable in the generated code) and
when they are defined (i.e., because we've seen the key function
definition). Previously, we were effectively tracking "potential
definitions" rather than uses, so we were a bit too eager about emitting
vtables for classes without key functions.

The new scheme:
  - For every use of a vtable, Sema calls MarkVTableUsed() to indicate
  the use. For example, this occurs when calling a virtual member
  function of the class, defining a constructor of that class type,
  dynamic_cast'ing from that type to a derived class, casting
  to/through a virtual base class, etc.
  - For every definition of a vtable, Sema calls MarkVTableUsed() to
  indicate the definition. This happens at the end of the translation
  unit for classes whose key function has been defined (so we can
  delay computation of the key function; see PR6564), and will also
  occur with explicit template instantiation definitions.
 - For every vtable defined/used, we mark all of the virtual member
 functions of that vtable as defined/used, unless we know that the key
 function is in another translation unit. This instantiates virtual
 member functions when needed.
  - At the end of the translation unit, Sema tells CodeGen (via the
  ASTConsumer) which vtables must be defined (CodeGen will define
  them) and which may be used (for which CodeGen will define the
  vtables lazily).

From a language perspective, both the old and the new schemes are
permissible: we're allowed to instantiate virtual member functions
whenever we want per the standard. However, all other C++ compilers
were more lazy than we were, and our eagerness was both a performance
issue (we instantiated too much) and a portability problem (we broke
Boost test cases, which now pass).

Notes:
  (1) There's a ton of churn in the tests, because the order in which
  vtables get emitted to IR has changed. I've tried to isolate some of
  the larger tests from these issues.
  (2) Some diagnostics related to
  implicitly-instantiated/implicitly-defined virtual member functions
  have moved to the point of first use/definition. It's better this
  way.
  (3) I could use a review of the places where we MarkVTableUsed, to
  see if I missed any place where the language effectively requires a
  vtable.

Fixes PR7114 and PR6564.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103718 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDon't add a null successor to a CFGBlock when the contents of an @synchronized statem...
Ted Kremenek [Thu, 13 May 2010 16:38:08 +0000 (16:38 +0000)]
Don't add a null successor to a CFGBlock when the contents of an @synchronized statement is empty.
Fixes <rdar://problem/7979430>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103717 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFold assertion into condition, as it does not hold all the time.
Ted Kremenek [Thu, 13 May 2010 15:38:38 +0000 (15:38 +0000)]
Fold assertion into condition, as it does not hold all the time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103716 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTestcase for r103712.
Chandler Carruth [Thu, 13 May 2010 12:04:17 +0000 (12:04 +0000)]
Testcase for r103712.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103713 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTeach the AKA calculation to look at sugar on the pointee type for pointers and
Chandler Carruth [Thu, 13 May 2010 11:37:24 +0000 (11:37 +0000)]
Teach the AKA calculation to look at sugar on the pointee type for pointers and
references. This is a WIP as we should handle function pointers, etc. Reshuffle
the code to do this to facilitate recursing in this manner, and to check for
the type already being printed first rather than last.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103712 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRebuild builtin_id * as an ObjCObjectPointerType, where builtin_id is the
John McCall [Thu, 13 May 2010 08:39:13 +0000 (08:39 +0000)]
Rebuild builtin_id * as an ObjCObjectPointerType, where builtin_id is the
magic type that 'id' is a pointer to.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103708 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRelax an assertion. Various cases could lead to non-symbol values.
Zhongxing Xu [Thu, 13 May 2010 08:26:32 +0000 (08:26 +0000)]
Relax an assertion. Various cases could lead to non-symbol values.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103707 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen performing template argument deduction, match Objective C pointers
John McCall [Thu, 13 May 2010 07:48:05 +0000 (07:48 +0000)]
When performing template argument deduction, match Objective C pointers
against pointer patterns.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103706 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDelete a dead function at sabre's request.
Chandler Carruth [Thu, 13 May 2010 07:47:58 +0000 (07:47 +0000)]
Delete a dead function at sabre's request.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103705 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUpdate the types for warning option subgroup arrays to 'short', we have more
Chandler Carruth [Thu, 13 May 2010 07:43:05 +0000 (07:43 +0000)]
Update the types for warning option subgroup arrays to 'short', we have more
than 127 groups so this was already failing given -fsigned-char. A subsequent
to commit to TableGen will generate shorts for the arrays themselves.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103703 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd test case for <rdar://problem/7880658>.
Ted Kremenek [Thu, 13 May 2010 06:58:45 +0000 (06:58 +0000)]
Add test case for <rdar://problem/7880658>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103701 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove stale comment.
Ted Kremenek [Thu, 13 May 2010 03:40:51 +0000 (03:40 +0000)]
Remove stale comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103696 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoadd a couple of key functions for classes without them.
Chris Lattner [Thu, 13 May 2010 01:02:19 +0000 (01:02 +0000)]
add a couple of key functions for classes without them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103688 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSpecially handle CaseStmts in CursorVisitor because they can be nested and walking...
Ted Kremenek [Thu, 13 May 2010 00:25:00 +0000 (00:25 +0000)]
Specially handle CaseStmts in CursorVisitor because they can be nested and walking them
can blow out the stack.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103687 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoIf given location is invalid then use current location.
Devang Patel [Wed, 12 May 2010 23:46:38 +0000 (23:46 +0000)]
If given location is invalid then use current location.
This fixes recent regressions reported by gdb testsuite.
Tighter verification of debug info generated by FE found these regressions.

Refactor code to extract line number and column number from SourceLocation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103678 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoObjective-C++ Sema. Support for conversion of a C++
Fariborz Jahanian [Wed, 12 May 2010 23:29:11 +0000 (23:29 +0000)]
Objective-C++ Sema. Support for conversion of a C++
class object used as a receiver to an objective-c
pointer via a converwsion function. wip.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103672 91177308-0d34-0410-b5e6-96231b3b80d8

14 years ago"this patch properly addresses escaping < and > which might appear
Chris Lattner [Wed, 12 May 2010 23:27:11 +0000 (23:27 +0000)]
"this patch properly addresses escaping < and > which might appear
(e.g. for C++ operators) in the xml dump.

I also re-enabled the unit test for ast-print-xml (or so I think)
at least, make test didn't fail..."

patch by Sebastien Binet!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103671 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoimprove comments.
Chris Lattner [Wed, 12 May 2010 23:26:21 +0000 (23:26 +0000)]
improve comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103670 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRevert "Move macro definitions for IBOutlet and IBAction into the source
Daniel Dunbar [Wed, 12 May 2010 21:54:41 +0000 (21:54 +0000)]
Revert "Move macro definitions for IBOutlet and IBAction into the source
code. ...", this was a lit bug which should be fixed in r103652.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103654 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMove macro definitions for IBOutlet and IBAction into the source code. This hopefully
Ted Kremenek [Wed, 12 May 2010 21:44:56 +0000 (21:44 +0000)]
Move macro definitions for IBOutlet and IBAction into the source code.  This hopefully
unbreaks the test with lit+Windows.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103650 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDriver/Darwin/i386: Don't allow compiling C++ with -fapple-kext, we don't support...
Daniel Dunbar [Wed, 12 May 2010 18:19:58 +0000 (18:19 +0000)]
Driver/Darwin/i386: Don't allow compiling C++ with -fapple-kext, we don't support the necessary ABI yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103632 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSimplify.
Daniel Dunbar [Wed, 12 May 2010 18:19:55 +0000 (18:19 +0000)]
Simplify.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103631 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoObjective-C++ Sema - Allow static_cast of one objc pointer to
Fariborz Jahanian [Wed, 12 May 2010 18:16:59 +0000 (18:16 +0000)]
Objective-C++ Sema - Allow static_cast of one objc pointer to
another.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103630 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhenever we instantiate a function definition or class, enter a new
Douglas Gregor [Wed, 12 May 2010 17:27:19 +0000 (17:27 +0000)]
Whenever we instantiate a function definition or class, enter a new
potentially-evaluated expression context, to ensure that used
declarations get properly marked. Fixes PR7123.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103624 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen we emit an error during the implicit definition of a special
Douglas Gregor [Wed, 12 May 2010 16:39:35 +0000 (16:39 +0000)]
When we emit an error during the implicit definition of a special
member function (default constructor, copy constructor, copy
assignment operator, destructor), emit a note showing where that
implicit definition was required.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103619 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoYes another annotate-tokens tweak.
Daniel Dunbar [Wed, 12 May 2010 15:10:09 +0000 (15:10 +0000)]
Yes another annotate-tokens tweak.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103615 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoIncrease test portability.
Daniel Dunbar [Wed, 12 May 2010 14:46:02 +0000 (14:46 +0000)]
Increase test portability.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103614 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake test portable.
Ted Kremenek [Wed, 12 May 2010 07:24:45 +0000 (07:24 +0000)]
Make test portable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103588 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake test case invariant to macro definition location.
Ted Kremenek [Wed, 12 May 2010 07:21:07 +0000 (07:21 +0000)]
Make test case invariant to macro definition location.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103587 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRe-apply r103581 with updated tests. It turns out we were computing bogus locations for
Ted Kremenek [Wed, 12 May 2010 06:16:13 +0000 (06:16 +0000)]
Re-apply r103581 with updated tests.  It turns out we were computing bogus locations for
many things.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103583 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTemporarily revert r103581 so I can fix the failing tests.
Ted Kremenek [Wed, 12 May 2010 06:03:33 +0000 (06:03 +0000)]
Temporarily revert r103581 so I can fix the failing tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103582 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoCorrectly check if a cursor is a declaration before returning its location/range...
Ted Kremenek [Wed, 12 May 2010 06:00:25 +0000 (06:00 +0000)]
Correctly check if a cursor is a declaration before returning its location/range in clang_getCursorLocation()/clang_getCursorExtent().  This fixes a horrible bug reported in
<rdar://problem/7961995> and <rdar://problem/7967123> where declarations with attributes
would get grossly annotated with the wrong tokens because the attribute would be interpreted
as if it was a Decl*.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103581 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove debugging aids I did not intend to commit.
Ted Kremenek [Wed, 12 May 2010 05:30:50 +0000 (05:30 +0000)]
Remove debugging aids I did not intend to commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103578 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdjust clang_annotateTokens() to correctly account for the TypeSourceInfo for Declara...
Ted Kremenek [Wed, 12 May 2010 05:29:33 +0000 (05:29 +0000)]
Adjust clang_annotateTokens() to correctly account for the TypeSourceInfo for DeclaratorDecls
when annotating tokens.  Fixes <rdar://problem/7971430>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103577 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agodon't force 16 threads.
Chris Lattner [Wed, 12 May 2010 02:47:23 +0000 (02:47 +0000)]
don't force 16 threads.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103566 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImprove commentary on the indirect-goto jump scope checker and extract
John McCall [Wed, 12 May 2010 02:37:54 +0000 (02:37 +0000)]
Improve commentary on the indirect-goto jump scope checker and extract
a convenience routine to find the innermost common ancestor of two scopes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103565 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoCorrect spelling of expected error message. Apparently I forgot to re-run
John McCall [Wed, 12 May 2010 01:15:36 +0000 (01:15 +0000)]
Correct spelling of expected error message.  Apparently I forgot to re-run
the test suite after modifying this diagnostic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103537 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen checking scopes for indirect goto, be more permissive (but still safe)
John McCall [Wed, 12 May 2010 00:58:13 +0000 (00:58 +0000)]
When checking scopes for indirect goto, be more permissive (but still safe)
about the permitted scopes.  Specifically:
  1) Permit labels and gotos to appear after a prologue of variable initializations.
  2) Permit indirect gotos to jump out of scopes that don't require cleanup.
  3) Diagnose possible attempts to indirect-jump out of scopes that do require
     cleanup.
This requires a substantial reinvention of the algorithm for checking indirect
goto.  The current algorithm is Omega(M*N), with M = the number of unique
scopes being jumped from and N = the number of unique scopes being jumped to,
with an additional factor that is probably (worst-case) linear in the depth
of scopes.  Thus the entire thing is likely cubic given some truly bizarre
ill-formed code;  on well-formed code the additional factor collapses to
an amortized constant (when amortized over the entire function) and so
the algorithm is quadratic.  Even this requires every label to appear in
its own scope, which would be very unusual for indirect-goto code (and
extremely unlikely for well-formed code);  it is far more likely that
all labels will be in the same scope and so the algorithm becomes linear.
For such a marginal feature, I am fairly happy with this result.

(this is using JumpDiagnostic's definition of scope, where successive
variables in a block appear in their own scope)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103536 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUse end location of DeclStmt to mark stop point.
Devang Patel [Wed, 12 May 2010 00:39:34 +0000 (00:39 +0000)]
Use end location of DeclStmt to mark stop point.
This is meaningful for blocks. This patch fixes bunch of test failures in gdb testsuite.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103533 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoBoostCon tutorial notes, temporary
Douglas Gregor [Tue, 11 May 2010 22:09:20 +0000 (22:09 +0000)]
BoostCon tutorial notes, temporary

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103520 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMerged Elaborated and QualifiedName types.
Abramo Bagnara [Tue, 11 May 2010 21:36:43 +0000 (21:36 +0000)]
Merged Elaborated and QualifiedName types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103517 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSpeculatively revert r103497, "Do not mark the virtual members of an
Daniel Dunbar [Tue, 11 May 2010 21:32:35 +0000 (21:32 +0000)]
Speculatively revert r103497, "Do not mark the virtual members of an
implicitly-instantiated class as ...", which seems to have broken bootstrap.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103515 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoIRgen/i386/C++: Fix isSingleElementStruct computation for C++ record decls.
Daniel Dunbar [Tue, 11 May 2010 21:15:36 +0000 (21:15 +0000)]
IRgen/i386/C++: Fix isSingleElementStruct computation for C++ record decls.
 - Fixes PR7098.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103514 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDo not mark the virtual members of an implicitly-instantiated class as
Douglas Gregor [Tue, 11 May 2010 20:24:17 +0000 (20:24 +0000)]
Do not mark the virtual members of an implicitly-instantiated class as
referenced unless we see one of them defined (or the key function
defined, if it as one) or if we need the vtable for something. Fixes
PR7114.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103497 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoVISIBILITY_HIDDEN was renamed LLVM_LIBRARY_VISIBILITY.
Duncan Sands [Tue, 11 May 2010 20:16:05 +0000 (20:16 +0000)]
VISIBILITY_HIDDEN was renamed LLVM_LIBRARY_VISIBILITY.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103494 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix test.
Fariborz Jahanian [Tue, 11 May 2010 18:48:13 +0000 (18:48 +0000)]
Fix test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103487 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoIt's bad form to create VarDecl's without DeclContexts
Douglas Gregor [Tue, 11 May 2010 18:17:16 +0000 (18:17 +0000)]
It's bad form to create VarDecl's without DeclContexts

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103484 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoThe C++98/03 standard is disturbingly silent about out-of-scope
Douglas Gregor [Tue, 11 May 2010 17:39:34 +0000 (17:39 +0000)]
The C++98/03 standard is disturbingly silent about out-of-scope
explicit instantiations of template. C++0x clarifies the intent
(they're ill-formed in some cases; see [temp.explicit] for
details). However, one could squint at the C++98/03 standard and
conclude they are permitted, so reduce the error to a warning
(controlled by -Wc++0x-compat) in C++98/03 mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103482 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoStatic data members intialized in-class that have constant values are
Douglas Gregor [Tue, 11 May 2010 16:41:27 +0000 (16:41 +0000)]
Static data members intialized in-class that have constant values are
value-dependent if their initializers are value-dependent; my recent
tweak to these dependent rules overstepped by taking away this
value-dependents. Fixes a Boost.GIL regression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103476 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMinor refactoring of my last patch.
Fariborz Jahanian [Tue, 11 May 2010 16:31:10 +0000 (16:31 +0000)]
Minor refactoring of my last patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103475 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix indentation
Douglas Gregor [Tue, 11 May 2010 08:44:04 +0000 (08:44 +0000)]
Fix indentation

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103465 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoA DeclRefExpr that refers to a member function or a static data member
Douglas Gregor [Tue, 11 May 2010 08:41:30 +0000 (08:41 +0000)]
A DeclRefExpr that refers to a member function or a static data member
of the current instantiation is value-dependent. The C++ standard
fails to enumerate this case and, therefore, we missed it. Chandler
did all of the hard work of reducing the last remaining
Boost.PtrContainer failure (which had to do with static initialization
in the Serialization library) down to this simple little test.

While I'm at it, clean up the dependence rules for template arguments
that are declarations, and implement the dependence rules for template
argument packs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103464 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd a test for a subtle instantiation pattern that showed up within a Boost
Chandler Carruth [Tue, 11 May 2010 08:02:08 +0000 (08:02 +0000)]
Add a test for a subtle instantiation pattern that showed up within a Boost
miscompile reduction. Clang already handles this correctly, but let's make sure
it stays that way.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103463 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFixes for compilation with Microsoft Visual Studio 2010, from Steven Watanabe!
Douglas Gregor [Tue, 11 May 2010 06:18:17 +0000 (06:18 +0000)]
Fixes for compilation with Microsoft Visual Studio 2010, from Steven Watanabe!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103458 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoInitialize Column.
Devang Patel [Mon, 10 May 2010 23:48:38 +0000 (23:48 +0000)]
Initialize Column.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103448 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAllow static_cast to objective-c pointers.
Fariborz Jahanian [Mon, 10 May 2010 23:46:53 +0000 (23:46 +0000)]
Allow static_cast to objective-c pointers.
Fixes radar 7952457.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103447 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agotests: Avoid spurious use of /dev/null.
Daniel Dunbar [Mon, 10 May 2010 23:31:31 +0000 (23:31 +0000)]
tests: Avoid spurious use of /dev/null.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103446 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRefactor the constant-evaluator so that it only supports a single form
John McCall [Mon, 10 May 2010 23:27:23 +0000 (23:27 +0000)]
Refactor the constant-evaluator so that it only supports a single form
of constant-evaluation.  Formerly you could control whether it accepted
local l-values or not;  now it always evaluates local l-values in the core
routines, but filters them out where consumed by the top-level routines.
This will make it much easier to cache evaluability.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103444 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoObjective-C++ Code gen. Handle code gen. for property
Fariborz Jahanian [Mon, 10 May 2010 22:57:35 +0000 (22:57 +0000)]
Objective-C++ Code gen. Handle code gen. for property
reference dot-syntax notation in a varierty of cases.
Fixes radar 7964490.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103440 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAllocate most of DeclarationNamesTable using ASTContext's allcocator. The only thing...
Ted Kremenek [Mon, 10 May 2010 20:56:10 +0000 (20:56 +0000)]
Allocate most of DeclarationNamesTable using ASTContext's allcocator.  The only things that
aren't allocated this way are the internal FoldingSets.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103429 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoStart converting pieces of DeclarationNameTable to be allocated using ASTContext...
Ted Kremenek [Mon, 10 May 2010 20:40:08 +0000 (20:40 +0000)]
Start converting pieces of DeclarationNameTable to be allocated using ASTContext's allocator.
While DeclarationNameTable doesn't leak, it uses 'malloc' too often.  Start with having
'CXXLiteralOperatorNames' allocated using ASTContext's allocator and add a 'DoDestroy()' method
to DeclarationNameTable that is called by ~ASTContext.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103426 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoConvert CXXTempory[] in CXXExprWithTemporaries to be allocated using ASTContext's...
Ted Kremenek [Mon, 10 May 2010 20:06:30 +0000 (20:06 +0000)]
Convert CXXTempory[] in CXXExprWithTemporaries to be allocated using ASTContext's allocator.  Fixes <rdar://problem/7961605>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103421 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImproved -ast-print-xml for C++, from Sebastien Binet!
Douglas Gregor [Mon, 10 May 2010 17:43:18 +0000 (17:43 +0000)]
Improved -ast-print-xml for C++, from Sebastien Binet!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103412 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAlternative workaround for MSVC compilation failure, from Dimitry Andric
Douglas Gregor [Mon, 10 May 2010 17:28:19 +0000 (17:28 +0000)]
Alternative workaround for MSVC compilation failure, from Dimitry Andric

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103409 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoIf variable location is invalid then use current location.
Devang Patel [Mon, 10 May 2010 17:24:58 +0000 (17:24 +0000)]
If variable location is invalid then use current location.
This fixes radar 7959934.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103408 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix refacto in r103387, noticed by Christopher Jefferson.
Daniel Dunbar [Mon, 10 May 2010 15:59:37 +0000 (15:59 +0000)]
Fix refacto in r103387, noticed by Christopher Jefferson.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103406 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd an UpdateVBases parameter to UpdateEmptyClassOffsets. Not used just yet.
Anders Carlsson [Mon, 10 May 2010 15:28:59 +0000 (15:28 +0000)]
Add an UpdateVBases parameter to UpdateEmptyClassOffsets. Not used just yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103403 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMore work on handling empty classes.
Anders Carlsson [Mon, 10 May 2010 15:26:14 +0000 (15:26 +0000)]
More work on handling empty classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103402 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agopch'ify CXXNewExpr and CXXZeroInitValueExpr
Chris Lattner [Mon, 10 May 2010 01:22:27 +0000 (01:22 +0000)]
pch'ify CXXNewExpr and CXXZeroInitValueExpr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103390 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDoxygen-ify a comment and add an example of when this AST node is required.
Chandler Carruth [Mon, 10 May 2010 00:56:18 +0000 (00:56 +0000)]
Doxygen-ify a comment and add an example of when this AST node is required.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103389 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agofix refactor-o
Chris Lattner [Mon, 10 May 2010 00:45:12 +0000 (00:45 +0000)]
fix refactor-o

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103388 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agopchify CXXTemporary, CXXBindTemporaryExpr, and
Chris Lattner [Mon, 10 May 2010 00:25:06 +0000 (00:25 +0000)]
pchify CXXTemporary, CXXBindTemporaryExpr, and
CXXExprWithTemporaries.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103387 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix typo.
Chandler Carruth [Sun, 9 May 2010 12:16:11 +0000 (12:16 +0000)]
Fix typo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103378 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agopch'ify default argument definitions and uses.
Chris Lattner [Sun, 9 May 2010 06:40:08 +0000 (06:40 +0000)]
pch'ify default argument definitions and uses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103376 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agopch'ify 'this' and 'throw'
Chris Lattner [Sun, 9 May 2010 06:15:05 +0000 (06:15 +0000)]
pch'ify 'this' and 'throw'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103375 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agopch'ify typeid.
Chris Lattner [Sun, 9 May 2010 06:03:39 +0000 (06:03 +0000)]
pch'ify typeid.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103374 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agopchify CXXMemberCallExpr correctly. Before it would serialize
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103371 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoCleanup.
Anders Carlsson [Sun, 9 May 2010 05:03:38 +0000 (05:03 +0000)]
Cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103370 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoBe more careful about picking a template parameter when we fail to substitute explici...
Douglas Gregor [Sun, 9 May 2010 01:26:06 +0000 (01:26 +0000)]
Be more careful about picking a template parameter when we fail to substitute explicit template arguments into a function template

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103369 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTweaked selector mangling again (GNU runtime).
David Chisnall [Sun, 9 May 2010 01:01:43 +0000 (01:01 +0000)]
Tweaked selector mangling again (GNU runtime).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103368 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix a silly bootstrap-breaking thinko, where we were trying to convert
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103364 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoActually compute the empty subobject sizes. No functionality change yet.
Anders Carlsson [Sat, 8 May 2010 23:06:26 +0000 (23:06 +0000)]
Actually compute the empty subobject sizes. No functionality change yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103363 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImprove our handling of the -Wunused-variable warning in templates. In
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103362 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDon't complain about an __builtin_va_arg expression's result being
Douglas Gregor [Sat, 8 May 2010 22:41:50 +0000 (22:41 +0000)]
Don't complain about an __builtin_va_arg expression's result being
unused, since the operation has side effects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103360 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd a SizeOfLargestEmptySubobject member to ASTRecordLayout. For C++ classes this...
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103359 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAttempted workaround for MSVC compile error
Douglas Gregor [Sat, 8 May 2010 22:24:24 +0000 (22:24 +0000)]
Attempted workaround for MSVC compile error

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103358 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen instantiating statements that involve conditions (if, while, do,
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.

Fixes a regression in Boost.Function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103357 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFixed linkage problem from last commit (GNU runtime).
David Chisnall [Sat, 8 May 2010 21:55:04 +0000 (21:55 +0000)]
Fixed linkage problem from last commit (GNU runtime).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103355 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTweaked selector generation (GNU runtime). Removed the use of GlobalAliases in the...
David Chisnall [Sat, 8 May 2010 20:58:05 +0000 (20:58 +0000)]
Tweaked selector generation (GNU runtime).  Removed the use of GlobalAliases in the generated bitcode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103353 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDon't destroy the data associated with an overload resolution candidate; it's ASTCont...
Douglas Gregor [Sat, 8 May 2010 20:20:05 +0000 (20:20 +0000)]
Don't destroy the data associated with an overload resolution candidate; it's ASTContext-allocated now

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103350 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRecord template argument deduction failures for member function
Douglas Gregor [Sat, 8 May 2010 20:18:54 +0000 (20:18 +0000)]
Record template argument deduction failures for member function
templates and conversion function templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103349 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen printing an overload candidate that failed due to SFINAE, print a
Douglas Gregor [Sat, 8 May 2010 20:07:26 +0000 (20:07 +0000)]
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 ...
                   ^

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103348 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImprove overload-candidate diagnostic for a function template that
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.,

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&);
       ^

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103344 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoA leak is better than a double-free while I figure out how to address
Douglas Gregor [Sat, 8 May 2010 18:32:25 +0000 (18:32 +0000)]
A leak is better than a double-free while I figure out how to address
this issue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103343 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMinor cleanup, and ban copying of OverloadCandidateSets. No
Douglas Gregor [Sat, 8 May 2010 18:20:53 +0000 (18:20 +0000)]
Minor cleanup, and ban copying of OverloadCandidateSets. No
functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103342 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen template argument deduction fails because the call had too
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103341 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen printing a non-viable overload candidate that failed due to
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.,

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&);
         ^

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103339 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix test for Release-Asserts build
Douglas Gregor [Sat, 8 May 2010 16:04:01 +0000 (16:04 +0000)]
Fix test for Release-Asserts build

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103337 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUpdate latest checker build to a local link.
Daniel Dunbar [Sat, 8 May 2010 02:03:49 +0000 (02:03 +0000)]
Update latest checker build to a local link.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103332 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen we encounter a non-dependent type during template instantiation,
Douglas Gregor [Fri, 7 May 2010 23:12:07 +0000 (23:12 +0000)]
When we encounter a non-dependent type during template instantiation,
mark any declarations we see inside of that type as
"referenced". Fixes PR7079.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103323 91177308-0d34-0410-b5e6-96231b3b80d8