Commit Graph

15691 Commits

Author SHA1 Message Date
Douglas Gregor bddb73fa1d If a destructor is referenced or a pseudo-destructor expression is
formed without a trailing '(', diagnose the error (these expressions
must be immediately called), emit a fix-it hint, and fix the code.

llvm-svn: 81015
2009-09-04 18:29:40 +00:00
Mike Stump 5a522353c3 Add overidding for methods for vtable building for the secondary
vtables.  Add thunk generation.  WIP.

llvm-svn: 81014
2009-09-04 18:27:16 +00:00
Daniel Dunbar 0da4a5dcab Use llvm::sys::getHostTriple, not LLVM_HOSTTRIPLE.
llvm-svn: 81013
2009-09-04 17:43:10 +00:00
Daniel Dunbar 156fa7dde0 Make CmpDriver less stupid.
llvm-svn: 81012
2009-09-04 17:41:47 +00:00
Daniel Dunbar c9b0a37211 Support 'make test TESTSUITE=CodeGen', etc.
llvm-svn: 81011
2009-09-04 17:40:27 +00:00
Daniel Dunbar 5095b293b7 Remove unused argument.
llvm-svn: 81010
2009-09-04 17:39:02 +00:00
Douglas Gregor ad8a336b40 Implement AST, semantics, and CodeGen for C++ pseudo-destructor
expressions, e.g.,

  p->~T()

when p is a pointer to a scalar type. 

We don't currently diagnose errors when pseudo-destructor expressions
are used in any way other than by forming a call.

llvm-svn: 81009
2009-09-04 17:36:40 +00:00
Steve Naroff ef9618b75f Implement accessors clang_getCursorKind(), clang_getCursorDecl().
Implement clang_getCursor() - wired up to Argiris's work.
Implement callbacks for CXCursor_ObjCProtocolRef.

llvm-svn: 81004
2009-09-04 15:44:05 +00:00
Douglas Gregor 2d2282e8f9 When searching for a default constructor or copy constructor, skip constructor templates
llvm-svn: 81002
2009-09-04 14:46:39 +00:00
Douglas Gregor 43e75176ec Parse extern templates, pass that information all the way to Sema,
then drop it on the floor.

llvm-svn: 80989
2009-09-04 06:33:52 +00:00
Douglas Gregor 119b0c7185 Introduce an egregious hack to fix PR4828.
The problem this change addresses is that we treat __is_pod and
__is_empty as keywords in C++, because they are built-in type traits
in GCC >= 4.3. However, GNU libstdc++ 4.2 (and possibly earlier
versions) define implementation-detail struct templates named __is_pod
and __is_empty. 

This commit solves the problem by recognizing

  struct __is_pod

and

  struct __is_empty

as special token sequences. When one of these token sequences is
encountered, the keyword (__is_pod or __is_empty) is implicitly
downgraded to an identifier so that parsing can continue. This is an
egregious hack, but it has the virtue of "just working" whether
someone is using libstdc++ 4.2 or not, without the need for special
flags.

llvm-svn: 80988
2009-09-04 05:53:02 +00:00
Douglas Gregor f6a5411fd0 Actually initialize HasQualifier and HasExplicitTemplateArgumentList in the EmptyShell constructor for MemberExpr. Should clear up some valgrind failures in PCH reading
llvm-svn: 80984
2009-09-04 05:04:07 +00:00
Daniel Dunbar 79ee0fa59c Add a valgrind suppressions file for x86_64-pc-linux-gnu and gcc-4.3.3 which
suppresses the overlapped memcpy in stable_sort that clang triggers.

llvm-svn: 80982
2009-09-04 02:53:57 +00:00
Daniel Dunbar 3009f81d1d Add --vg-arg option to clang test runner.
- Passes additional argument through to valgrind.

Also, don't run valgrind with --leak-check=no by default.

llvm-svn: 80981
2009-09-04 02:53:50 +00:00
Zhongxing Xu bfb000f337 move the check into MarkNoReturnFunction.
llvm-svn: 80980
2009-09-04 02:17:35 +00:00
Zhongxing Xu 1748d8a43d Extract mark-no-return-function code into a function.
llvm-svn: 80979
2009-09-04 02:13:36 +00:00
John McCall 06f6fe8df7 Correctly handle elaborated template ids. Still not handled properly for friends.
llvm-svn: 80977
2009-09-04 01:14:41 +00:00
Fariborz Jahanian 37d065680b Patch to instantiate destructors used to destruct
base and data members when they are needed.

llvm-svn: 80967
2009-09-03 23:18:17 +00:00
Anders Carlsson 0e91275ab4 If the alignment of the chosen field in a union is greater than the alignment of the union, we need to use a packed LLVM struct. Fixes <rdar://problem/7184250>.
llvm-svn: 80964
2009-09-03 22:56:02 +00:00
Douglas Gregor f816bd70ce Implement tree transformations for DeclarationNames. Among other
things, this means that we can properly cope with member access
expressions such as 

  t->operator T()

where T is a template parameter (or other dependent type).

llvm-svn: 80957
2009-09-03 22:13:48 +00:00
Douglas Gregor 7a0f1105ce Update C++ status, since a bunch of the comments were out-of-date
llvm-svn: 80954
2009-09-03 21:51:43 +00:00
Douglas Gregor 2b6ca46c6b Improve template instantiation for member access expressions that
involve qualified names, e.g., x->Base::f. We now maintain enough
information in the AST to compare the results of the name lookup of
"Base" in the scope of the postfix-expression (determined at template
definition time) and in the type of the object expression.

llvm-svn: 80953
2009-09-03 21:38:09 +00:00
Fariborz Jahanian 59a1cd4a06 Mark constructors used in initialization of base(s) and fields
as referecned with location where they are used. Still
need to look at destructor aspects of them.

llvm-svn: 80950
2009-09-03 21:32:41 +00:00
Fariborz Jahanian 3501bcec7d Issue diagnostics in variety of situations involving
reference/const data members when user has declared
the constructor. This necessitated some non-minor
refactoring.

llvm-svn: 80934
2009-09-03 19:36:46 +00:00
Daniel Dunbar fe07aecd37 Don't use '%ll', this doesn't workin on Win32.
llvm-svn: 80933
2009-09-03 19:23:49 +00:00
Steve Naroff c0683b909a Add ASTUnit::getOriginalSourceFileName() and use in clang_getTranslationUnitSpelling().
llvm-svn: 80932
2009-09-03 18:19:54 +00:00
Douglas Gregor c26e0f626b Improved handling for dependent, qualified member access expressions, e.g.,
t->Base::f

where t has a dependent type. We save the nested-name-specifier in the
CXXUnresolvedMemberExpr then, during instantiation, substitute into
the nested-name-specifier with the (transformed) object type of t, so
that we get name lookup into the type of the object expression.

Note that we do not yet retain information about name lookup into the
lexical scope of the member access expression, so several regression
tests are still disabled.

llvm-svn: 80925
2009-09-03 16:14:30 +00:00
Steve Naroff 38c1a7ba12 - Add back some harmless code that part of a reverted commit (r80859). I'll investigate the lifetime snafu (with ASTUnit) separately.
- Traverse category methods, add a "class ref" and make the little test harness a bit more flexible.

llvm-svn: 80921
2009-09-03 15:49:00 +00:00
Douglas Gregor b3286fe685 Save/load POSIXThreads flag for PCH
llvm-svn: 80916
2009-09-03 14:36:33 +00:00
Daniel Dunbar 3a0637b06b Revert "Visit function/method bodies and issue callback for parameters and local
variables.", this is breaking x86_64-apple-darwin10 and Linux tests.

llvm-svn: 80896
2009-09-03 05:59:50 +00:00
Daniel Dunbar 2d9c740cc5 Revert "Remove redundant local variable (use newly created instance data).", the
previous commit this depends on is breaking x86_64-apple-darwin10 and Linux tests.

llvm-svn: 80895
2009-09-03 05:59:35 +00:00
Daniel Dunbar a77eaeb1e6 Add basic support for -pthread.
- Patch by David Chisnall, with PCH and Darwin support mixed in.

llvm-svn: 80883
2009-09-03 04:54:28 +00:00
Daniel Dunbar 57f2224c79 Tweak comment.
llvm-svn: 80882
2009-09-03 04:54:12 +00:00
Ted Kremenek 17a0296a09 Fix 80 column violations.
llvm-svn: 80873
2009-09-03 03:02:58 +00:00
David Chisnall 2c5bef2a74 Fixed bug introduced in r79900 where FreeBSD was turned into NetBSD, transposing the ABIs and breaking both platforms.
llvm-svn: 80870
2009-09-03 01:48:05 +00:00
Ted Kremenek b117fd9168 Fix regression introduced in r80786 and reported in PR 4867. We should use
'dyn_cast' instead of 'cast' as the denominator value could be UnknownVal (and
is not guaranteed to be a DefinedVal).

llvm-svn: 80869
2009-09-03 01:48:03 +00:00
Zhongxing Xu 677e6a2faf remove a debug output I introduced in the last commit.
llvm-svn: 80865
2009-09-03 01:31:59 +00:00
Mike Stump 850cc1c5a4 Update.
llvm-svn: 80864
2009-09-03 01:30:36 +00:00
Anders Carlsson 496335ea1a Add CastExpr::getCastKindName and use it in the StmtDumper.
llvm-svn: 80862
2009-09-03 00:59:21 +00:00
Steve Naroff 517ea46e2e Remove redundant local variable (use newly created instance data).
llvm-svn: 80861
2009-09-03 00:43:52 +00:00
Fariborz Jahanian f15d4b6050 This patch does the following.
1) Issue digsnostics in non-fragile ABI, when an expression
   evaluates to an interface type (except when it is used to
   access a non-fragile ivar).
2) Issue unsupported error in fragile ABI when an expression
   evaluates to an interface type (except when it is used to
   access a fragile ivar).

llvm-svn: 80860
2009-09-03 00:43:07 +00:00
Steve Naroff ef3cf2a576 Visit function/method bodies and issue callback for parameters and local variables.
Add clang_getTranslationUnitSpelling().

llvm-svn: 80859
2009-09-03 00:32:06 +00:00
Douglas Gregor 64792e021d Add a wicked little test-case that illustrates what we have to deal
with to properly support member access expressions in templates. This
test is XFAIL'd, because we get it completely wrong, but I've made the
minimal changes to the representation to at least avoid a crash.

llvm-svn: 80856
2009-09-02 23:58:38 +00:00
Douglas Gregor e5feb51624 Don't try to CodeGen using directives, from Anders Johnsen
llvm-svn: 80853
2009-09-02 23:49:23 +00:00
Daniel Dunbar 1268851c51 Initialize targets before parsing command line options, so --version shows registered targets.
llvm-svn: 80849
2009-09-02 23:20:15 +00:00
Fariborz Jahanian cc043a7154 Minor refactoring of my last patch.
llvm-svn: 80847
2009-09-02 23:11:48 +00:00
Fariborz Jahanian 3117e2b9d4 Referenced instatiated default constructors
must be defined. Fixed pr4853.

llvm-svn: 80846
2009-09-02 23:02:57 +00:00
Douglas Gregor b7bfe79412 Rewrite of our handling of name lookup in C++ member access expressions, e.g.,
x->Base::f

We no longer try to "enter" the context of the type that "x" points
to. Instead, we drag that object type through the parser and pass it
into the Sema routines that need to know how to perform lookup within
member access expressions.

We now implement most of the crazy name lookup rules in C++
[basic.lookup.classref] for non-templated code, including performing
lookup both in the context of the type referred to by the member
access and in the scope of the member access itself and then detecting
ambiguities when the two lookups collide (p1 and p4; p3 and p7 are
still TODO). This change also corrects our handling of name lookup
within template arguments of template-ids inside the
nested-name-specifier (p6; we used to look into the scope of the
object expression for them) and fixes PR4703.

I have disabled some tests that involve member access expressions
where the object expression has dependent type, because we don't yet
have the ability to describe dependent nested-name-specifiers starting
with an identifier.

llvm-svn: 80843
2009-09-02 22:59:36 +00:00
Fariborz Jahanian 589202d8e6 Added a FIXME to the test case.
llvm-svn: 80840
2009-09-02 21:24:14 +00:00
Anders Carlsson 35dca26835 Fix an assertion when initializing a union using a member initializer. (We weren't casting from the union type to the initializer type correctly).
llvm-svn: 80837
2009-09-02 21:14:47 +00:00