Commit Graph

12072 Commits

Author SHA1 Message Date
Fariborz Jahanian b8f018d1e9 Fixes a rewriting of byref variable when its initializer is
itself rewritten. Radar 7669784.

llvm-svn: 96798
2010-02-22 20:48:10 +00:00
Douglas Gregor 2b76dd9a9e Don't assert that we have a valid access specifier on an invalid
declaration. This is the trivial part of PR6365.

llvm-svn: 96792
2010-02-22 17:53:38 +00:00
Douglas Gregor dd4831794b Set access specifiers on imported declarations.
llvm-svn: 96788
2010-02-22 17:42:47 +00:00
Douglas Gregor d28f0412e4 Do not require a complete type when checking for a pointer conversion
between cv1 T* and cv2 T*.

llvm-svn: 96787
2010-02-22 17:06:41 +00:00
Douglas Gregor f4f2e0247f Change the name of the vtable-debugging environment variable to
CLANG_VTABLE_DEBUG.

llvm-svn: 96785
2010-02-22 16:48:26 +00:00
Douglas Gregor 76eb74a1cd Don't use NamedDecl::getNameAsCString() when dealing with C++ methods,
since they may not have normal identifiers for names. Fixes PR6369.

llvm-svn: 96784
2010-02-22 16:44:27 +00:00
Daniel Dunbar 260918ce5c Revert "Simplify code: Succ is guaranteed to be not NULL.", which turns out to
not be guaranteed.

llvm-svn: 96782
2010-02-22 05:58:59 +00:00
Zhongxing Xu d39620c451 Simplify code: Succ is guaranteed to be not NULL.
llvm-svn: 96772
2010-02-22 02:59:27 +00:00
Chris Lattner dd1cb5b2ec Add 'previous declaration is here' note for param redefinition
errors, e.g.:

t.c:1:21: error: redefinition of parameter 'x'
int test(int x, int x);
                    ^
t.c:1:14: note: previous declaration is here
int test(int x, int x);
             ^

llvm-svn: 96769
2010-02-22 00:40:25 +00:00
Douglas Gregor 36c569fb33 Eliminate the default arguments to ASTContext::getFunctionType(),
fixing up a few callers that thought they were propagating NoReturn
information but were in fact saying something about exception
specifications.

llvm-svn: 96766
2010-02-21 22:15:06 +00:00
Douglas Gregor 90d554ecb3 Implement support for parsing pseudo-destructor expression with a nested-name-specifier, e.g.,
typedef int Int;
  int *p;
  p->Int::~Int();

This weakens the invariant that the only types in nested-name-specifiers are tag types (restricted to class types in C++98/03). However, we weaken this invariant as little as possible, accepting arbitrary types in nested-name-specifiers only when we're in a member access expression that looks like a pseudo-destructor expression.

llvm-svn: 96743
2010-02-21 18:36:56 +00:00
Douglas Gregor 901e717f92 A constructor template cannot be used to copy to an object of the same class type (per C++ [class.copy]p3). Make sure that includes copies that involve a derived-to-base conversion. Fixes PR6141.
llvm-svn: 96742
2010-02-21 18:30:38 +00:00
Douglas Gregor 00eace1958 Implement AST import for C++ member functions, including constructors, destructors, and conversions. Unfortunately, this cannot be tested yet, since we don't have C++ PCH support.
llvm-svn: 96741
2010-02-21 18:29:16 +00:00
Douglas Gregor f18a2c7dd1 Implement AST importing for C++ namespaces.
llvm-svn: 96740
2010-02-21 18:26:36 +00:00
Douglas Gregor 968d633176 Collect the code that imports all of the members of a declaration context into a single function, ImportDeclContext. Use it rather than explicit loops. No functionality change.
llvm-svn: 96739
2010-02-21 18:24:45 +00:00
Douglas Gregor e31bbd904d Implement PCH support for C++ namespaces.
llvm-svn: 96738
2010-02-21 18:22:14 +00:00
Chandler Carruth 8f2548112e Commiting a revert from dgregor of a bit of destructor logic until we can
figure out how not to break lots of code using this. See PR6358 and PR6359 for
motivating examples. FIXME's left in the code and the test.

llvm-svn: 96733
2010-02-21 10:19:54 +00:00
Chandler Carruth f50ef6ed9a Make Decl::isOutOfLine() virtual, and use that to determine when definitions
are for out of line declarations more easily. This simplifies the logic and
handles the case of out-of-line class definitions correctly. Fixes PR6107.

llvm-svn: 96729
2010-02-21 07:08:09 +00:00
Ted Kremenek 2fb89539f7 Clang really intends to reject attribute 'warn_unused_result' on Objective-C methods, but
instead it crashes on them.  We might extend this attribute to work on methods, but for
now fix the crasher.  Addresses <rdar://problem/7670939>.

llvm-svn: 96723
2010-02-21 05:15:32 +00:00
Ted Kremenek 1979007ca8 Don't emit a warning about a dllimport attribute being used in a typedef
when -fms-extensions is specified.  Fixes <rdar://problem/7653870>.

llvm-svn: 96722
2010-02-21 05:12:56 +00:00
Ted Kremenek a3cfc4d1e1 Don't warn about functions redeclared without the dllimport attribute when
-fms-extensions is enabled.  Fixes <rdar://problem/7669559>.

llvm-svn: 96721
2010-02-21 05:12:53 +00:00
Fariborz Jahanian 34e3cef483 Start supporting declaration of ivars in @implementation
blocks. WIP.

llvm-svn: 96696
2010-02-19 20:58:54 +00:00
Anders Carlsson 350b56eed5 Add the CK_UnusedFunctionPointer component kind for unused function pointers.
llvm-svn: 96695
2010-02-19 20:08:13 +00:00
Fariborz Jahanian c5d61df0a9 Issue extended diagnostic when property dot-syntax is used and
there is a setter but no getter (part of radar 7664555).

llvm-svn: 96687
2010-02-19 18:30:30 +00:00
Douglas Gregor 0286b46702 Only parse C++0x attribute specifiers in declarators when in C++0x
mode. This allows us to detect invalid VLAs in Objective-C++
mode. This should be the last of <rdar://problem/7660386>.

llvm-svn: 96679
2010-02-19 16:47:56 +00:00
Douglas Gregor 337caf9e3e Implement C++ name lookup for instance variables of Objective-C classes
from an instance method. Previously, we were following the Objective-C
name lookup rules for ivars, which are of course completely different
from and incompatible with the Objective-C++ rules.

For the record, the Objective-C++ rules are the sane ones.

This is another part of <rdar://problem/7660386>.

llvm-svn: 96677
2010-02-19 16:08:35 +00:00
Douglas Gregor cfd70242ca Make Sema::ActOnClassMessage robust when name lookup for the receiver
name finds something other than a TypedefDecl or an
ObjCInterfaceDecl. This is a small part of <rdar://problem/7660386>.

llvm-svn: 96676
2010-02-19 15:18:45 +00:00
John McCall b81884d347 More refactoring around constructor/destructor code generation.
Fix some bugs with function-try-blocks and simplify normal try-block
code generation.

This implementation excludes a deleting destructor's call to
operator delete() from the function-try-block, which I believe
is correct but which I can't find straightforward support for at
a moment's glance.

llvm-svn: 96670
2010-02-19 09:25:03 +00:00
Anders Carlsson 2d3d903872 Dump this-adjustments for destructors as well.
llvm-svn: 96660
2010-02-19 06:03:53 +00:00
John McCall 8517abc30d Enable -mconstructor-aliases by default on non-darwin platforms.
The linker bug holding this back is Darwin-specific.

llvm-svn: 96655
2010-02-19 02:45:38 +00:00
Ted Kremenek 013041eef0 Revert: "Change InitListExpr to allocate the array for holding references"
This was causing buildbot breakage.

This reverts commit d46e952cc8cb8d9eed8657d9a0b267910a0f745a.

llvm-svn: 96652
2010-02-19 01:50:18 +00:00
Douglas Gregor 01cc437159 Add a missing break. Cocoa.h can now be merged twice into the same AST context
llvm-svn: 96650
2010-02-19 01:36:36 +00:00
John McCall d4324148d7 Re-introduce the ctor/dtor alias optimization, this time hidden behind a
command-line option which defaults off.

llvm-svn: 96649
2010-02-19 01:32:20 +00:00
Douglas Gregor 5481d329a3 AST import for CStyleCastExpr. With this, we can import Cocoa.h into an empty context
llvm-svn: 96648
2010-02-19 01:32:14 +00:00
Douglas Gregor d8552cdc96 AST import for sizeof and alignof expressions
llvm-svn: 96647
2010-02-19 01:24:23 +00:00
Douglas Gregor 52f820ead4 AST import for DeclRefExprs
llvm-svn: 96646
2010-02-19 01:17:02 +00:00
Douglas Gregor c74247eddd AST import of parenthesized expressions, unary operators, binary
operators, and compound assignment operators.

llvm-svn: 96643
2010-02-19 01:07:06 +00:00
Ted Kremenek 445a603c78 Change InitListExpr to allocate the array for holding references
to initializer expressions in an array allocated using ASTContext.

This plugs a memory leak when ASTContext uses a BumpPtrAllocator to
allocate memory for AST nodes.

In my mind this isn't an ideal solution; it would be nice to have
a general "vector"-like class that allocates memory using ASTContext,
but whose guts could be separated from the methods of InitListExpr
itself.  I haven't gone and taken this approach yet because it isn't
clear yet if we'll eventually want an alternate solution for recylcing
memory using by InitListExprs as we are constructing the ASTs.

llvm-svn: 96642
2010-02-19 00:42:33 +00:00
Douglas Gregor 70127c1dcf Use a little binary header in serialized diagnostics to help the deserializer skip over noise in the stream
llvm-svn: 96641
2010-02-19 00:40:40 +00:00
Fariborz Jahanian aef662206b Patch removes IVars list from ObjCInterfaceDecl and
instead relies on their DeclContext for iteration, etc.

llvm-svn: 96638
2010-02-19 00:31:17 +00:00
Blaine Garst 5421a83e4a remove unused function & enumerations
llvm-svn: 96635
2010-02-19 00:24:37 +00:00
Douglas Gregor 6cb5ba4c4f Teach ASTUnit to keep track of temporary files, then delete them when
the ASTUnit itself is destroyed. Fixes <rdar://problem/7649385>.

llvm-svn: 96628
2010-02-18 23:35:40 +00:00
Douglas Gregor 1e21cc7d19 Re-apply my diagnostics-capture patch for CIndex, with some tweaks to
try to address the msvc failures.

llvm-svn: 96624
2010-02-18 23:07:20 +00:00
Ted Kremenek 66f2d6ba7b Allow GNU attributes to appear in an Objective-C method declaration
before the selector name (but after the return type).  Among other things,
this allows IBAction to be implemented with an attribute.

llvm-svn: 96623
2010-02-18 23:05:16 +00:00
John McCall 334ce7c1c4 Revert the ctor/dtor alias optimization for now; the buildbots can detect
some failure here that I can't.

llvm-svn: 96612
2010-02-18 21:31:48 +00:00
Fariborz Jahanian ffcfecdc1f Fixed a crash specific to blocks in c++ uncovered by an internal
test suite.

llvm-svn: 96608
2010-02-18 20:31:02 +00:00
John McCall 5c60a6f597 Make deleting and complete dtor variants defer to other dtor variants by
calling them as subroutines.  This triggers whenever the alias optimization
doesn't, i.e. when the dtor has linkonce linkage or there are virtual bases
or it's the deleting dtor.

llvm-svn: 96605
2010-02-18 19:59:28 +00:00
Anders Carlsson f8b53536ed Attempt to fix the 32-bit test failures.
llvm-svn: 96595
2010-02-18 18:20:49 +00:00
Douglas Gregor 33cdd81064 Rework how CIndex handles diagnostics. Rather than using a callback,
we attach diagnostics to translation units and code-completion
results, so they can be queried at any time.

To facilitate this, the new StoredDiagnostic class stores a diagnostic
in a serializable/deserializable form, and ASTUnit knows how to
capture diagnostics in this stored form. CIndex's CXDiagnostic is a
thin wrapper around StoredDiagnostic, providing a C interface to
stored or de-serialized diagnostics.

I've XFAIL'd one test case temporarily, because currently we end up
storing diagnostics in an ASTUnit that's never returned to the user
(because it contains errors). I'll introduce a temporary fix for this
soon; the real fix will be to allow us to return and query invalid ASTs.

llvm-svn: 96592
2010-02-18 18:08:43 +00:00
Anders Carlsson e5faca7cda Fix another bug and add another class.
llvm-svn: 96590
2010-02-18 17:32:33 +00:00