]> granicus.if.org Git - clang/log
clang
14 years agoAdd libclang function 'clang_isFromMainFile()' (which just wraps SourceManager::isFro...
Ted Kremenek [Thu, 20 May 2010 02:59:19 +0000 (02:59 +0000)]
Add libclang function 'clang_isFromMainFile()' (which just wraps SourceManager::isFromMainFile()).

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

14 years agoRemove accidental commit
Douglas Gregor [Thu, 20 May 2010 02:26:51 +0000 (02:26 +0000)]
Remove accidental commit

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

14 years agoVarious small fixes for construction/destruction of Objective-C++
Douglas Gregor [Thu, 20 May 2010 02:24:22 +0000 (02:24 +0000)]
Various small fixes for construction/destruction of Objective-C++
instance variables:
  - Use isRecordType() rather than isa<RecordType>(), so that we see
  through typedefs in ivar types.
  - Mark the destructor as referenced
  - Perform C++ access control on the destructor

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

14 years agoExpose -fobjc-nonfragile-abi2 as a top-level clang driver option. Fixes <rdar:/...
Ted Kremenek [Thu, 20 May 2010 02:12:37 +0000 (02:12 +0000)]
Expose -fobjc-nonfragile-abi2 as a top-level clang driver option.  Fixes <rdar://problem/8007063>.

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

14 years agoSupport implicitly closing on 'this' in a block. Fixed PR7165.
John McCall [Thu, 20 May 2010 01:18:31 +0000 (01:18 +0000)]
Support implicitly closing on 'this' in a block.  Fixed PR7165.

(the codegen works here, too, but that's annoying to test without execution)

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

14 years agojust add a fixme for the StructuredArgs leak, it shouldn't affect
Chris Lattner [Thu, 20 May 2010 00:26:28 +0000 (00:26 +0000)]
just add a fixme for the StructuredArgs leak, it shouldn't affect
c++'03 code and variadic support "needs work".

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

14 years agoswitch TemplateArgumentListBuilder to hold its flat argument list in a smallvector
Chris Lattner [Thu, 20 May 2010 00:25:36 +0000 (00:25 +0000)]
switch TemplateArgumentListBuilder to hold its flat argument list in a smallvector
instead of new[]'d.  This greatly reduces the number of new[]'s, and guess what,
they were all leaked.

This adds a fixme in this hunk:

   unsigned NumPackArgs = NumFlatArgs - PackBeginIndex;
+  // FIXME: NumPackArgs shouldn't be negative here???
   if (NumPackArgs)
-    PackArgs = &FlatArgs[PackBeginIndex];
+    PackArgs = FlatArgs.data()+PackBeginIndex;

where test/SemaTemplate/variadic-class-template-2.cpp is accessing the vector
out of range and NumPackArgs is negative.  I assume variadic template args are
completely hosed.

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

14 years agofix the TemplateArgumentList copy constructor to not
Chris Lattner [Thu, 20 May 2010 00:19:09 +0000 (00:19 +0000)]
fix the TemplateArgumentList copy constructor to not
be a copy constructor (since it isn't one semantically)
and fix the ownership bits it sets to be correct!

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

14 years agoClarify TemplateArgumentList ownership over its "flat" and
Chris Lattner [Thu, 20 May 2010 00:11:47 +0000 (00:11 +0000)]
Clarify TemplateArgumentList ownership over its "flat" and
"structure" arg lists, the first step to fixing some massive
memory leaks.

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

14 years agotweak to (hopefully) fix darwin[89] buildbots. Thanks to Doug for the suggested modif...
Jim Grosbach [Wed, 19 May 2010 23:53:08 +0000 (23:53 +0000)]
tweak to (hopefully) fix darwin[89] buildbots. Thanks to Doug for the suggested modification.

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

14 years agoWhen a conditional operator is an rvalue of class type, we need to
Douglas Gregor [Wed, 19 May 2010 23:40:50 +0000 (23:40 +0000)]
When a conditional operator is an rvalue of class type, we need to
create a temporary copy of both the "true" and "false" results. Fixes
the Boost.Interprocess failures.

Daniel did all the hard work of tracking down the issue, I get to type
up the trivial fix for this horrible miscompile.

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

14 years agoMore tests for ObjC++ GC support.
Fariborz Jahanian [Wed, 19 May 2010 23:07:54 +0000 (23:07 +0000)]
More tests for ObjC++ GC support.

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

14 years agoMove CXCursor_FirstDecl definition later to make the results more readable in the...
Ted Kremenek [Wed, 19 May 2010 21:51:10 +0000 (21:51 +0000)]
Move CXCursor_FirstDecl definition later to make the results more readable in the debugger.

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

14 years agoAdded basic source locations to Elaborated and DependentName types.
Abramo Bagnara [Wed, 19 May 2010 21:37:53 +0000 (21:37 +0000)]
Added basic source locations to Elaborated and DependentName types.

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

14 years agoAdds support for ObjC++'s GC attribute on declaration of
Fariborz Jahanian [Wed, 19 May 2010 21:37:30 +0000 (21:37 +0000)]
Adds support for ObjC++'s GC attribute on declaration of
object variables and functions returning such objects.

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

14 years agoRevert r104117, "Provide a naming class for UnresolvedLookupExprs, even when
Daniel Dunbar [Wed, 19 May 2010 21:07:14 +0000 (21:07 +0000)]
Revert r104117, "Provide a naming class for UnresolvedLookupExprs, even when
occuring on..." which breaks some Objective-C code. Working on getting a test
case...

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

14 years agoFill in some silly defaults to silence a GCC warning
Douglas Gregor [Wed, 19 May 2010 18:41:43 +0000 (18:41 +0000)]
Fill in some silly defaults to silence a GCC warning

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

14 years agoCache the linkage of a type within its canonical type, eliminating
Douglas Gregor [Wed, 19 May 2010 18:39:18 +0000 (18:39 +0000)]
Cache the linkage of a type within its canonical type, eliminating
some seriously non-linear performance with deeply nested template
instantiations, as shown in PR6998.

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

14 years agoRemove clang_isDeclarationADefinition() since its functionality is already provided...
Ted Kremenek [Wed, 19 May 2010 18:36:55 +0000 (18:36 +0000)]
Remove clang_isDeclarationADefinition() since its functionality is already provided by clang_isCursorDefinition().

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

14 years agoAdd clang support for IBOutletCollection.
Ted Kremenek [Wed, 19 May 2010 17:38:06 +0000 (17:38 +0000)]
Add clang support for IBOutletCollection.

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

14 years agoRevert r104106; it's breaking linking of Boost.Serialization.
Douglas Gregor [Wed, 19 May 2010 17:02:24 +0000 (17:02 +0000)]
Revert r104106; it's breaking linking of Boost.Serialization.

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

14 years agoImplement codegen for __builtin_isnormal.
Benjamin Kramer [Wed, 19 May 2010 11:24:26 +0000 (11:24 +0000)]
Implement codegen for __builtin_isnormal.

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

14 years agoProvide a naming class for UnresolvedLookupExprs, even when occuring on
Chandler Carruth [Wed, 19 May 2010 09:39:06 +0000 (09:39 +0000)]
Provide a naming class for UnresolvedLookupExprs, even when occuring on
template names. We were completely missing naming classes for many unqualified
lookups, but this didn't trigger code paths that need it. This removes part of
an optimization that re-uses the template name lookup done by the parser to
determine if explicit template arguments actually form a template-id.
Unfortunately the technique for avoiding the duplicate lookup lost needed data
such as the class context in which the lookup succeeded.

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

14 years agoProfile type-dependent uses of overloaded operators in C++ the same
Douglas Gregor [Wed, 19 May 2010 04:13:23 +0000 (04:13 +0000)]
Profile type-dependent uses of overloaded operators in C++ the same
way regardless of whether some overloaded operator functions were
found by name lookup within the template. Fixes PR6851.

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

14 years agoTeach clang to instantiate attributes on more declarations. Fixes PR7102.
Douglas Gregor [Wed, 19 May 2010 03:39:53 +0000 (03:39 +0000)]
Teach clang to instantiate attributes on more declarations. Fixes PR7102.

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

14 years agoImplement C++ builtin operator candidates for vector types.
Douglas Gregor [Wed, 19 May 2010 03:21:00 +0000 (03:21 +0000)]
Implement C++ builtin operator candidates for vector types.

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

14 years agoFix a GCC warning about inline functions not being defined. Until r104081, only
Chandler Carruth [Wed, 19 May 2010 02:12:56 +0000 (02:12 +0000)]
Fix a GCC warning about inline functions not being defined. Until r104081, only
the same .cpp file as provided the definitions referenced these functions,
hiding the issue. However, they are clearly no longer inline. Let me know if
there is a reason to move their definitions to the header and make them truly
inline.

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

14 years agoFix an obvious goof that rjmccall found by inspection. No testcase, suggestions
Chandler Carruth [Wed, 19 May 2010 01:37:01 +0000 (01:37 +0000)]
Fix an obvious goof that rjmccall found by inspection. No testcase, suggestions
welcome for one.

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

14 years agoBasic test for user-defined conversions involving vector types
Douglas Gregor [Tue, 18 May 2010 23:05:44 +0000 (23:05 +0000)]
Basic test for user-defined conversions involving vector types

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

14 years agoMisc. fixes to bring Objetive-C++'s handling of
Fariborz Jahanian [Tue, 18 May 2010 23:04:17 +0000 (23:04 +0000)]
Misc. fixes to bring Objetive-C++'s handling of
gc attributes to be inline with Objective-C
(for radar 7925141).

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

14 years agoProtect isIntegerConstantExpr from seeing type- or value-dependent
Douglas Gregor [Tue, 18 May 2010 23:01:22 +0000 (23:01 +0000)]
Protect isIntegerConstantExpr from seeing type- or value-dependent
expressions in attributes, pragmas.

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

14 years agoImplement C++ support for vector and extended vector types. This
Douglas Gregor [Tue, 18 May 2010 22:42:18 +0000 (22:42 +0000)]
Implement C++ support for vector and extended vector types. This
involves extending implicit conversion sequences to model vector
conversions and vector splats, along with teaching the C++ conditional
operator-checking code about vector types.

Fixes <rdar://problem/7983501>.

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

14 years agoAdd function 'clang_isTagDeclDefinition()' to allow clients of libclang to distinguis...
Ted Kremenek [Tue, 18 May 2010 22:32:15 +0000 (22:32 +0000)]
Add function 'clang_isTagDeclDefinition()' to allow clients of libclang to distinguish between
forward declarations and definitions of structs/classes/enums.

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

14 years agoTeach CursorVisitor about duplicate ObjCPropertyDecls that can arise because of a...
Ted Kremenek [Tue, 18 May 2010 21:09:07 +0000 (21:09 +0000)]
Teach CursorVisitor about duplicate ObjCPropertyDecls that can arise because of a current
design limitation in how we handle Objective-C class extensions.  This was causing the CursorVisitor
to essentially visit an @property twice (once in the @interface, the other in the class extension).
Fixes <rdar://problem/7410145>.

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

14 years agoThese test now run in objective-c++ mode we well.
Fariborz Jahanian [Tue, 18 May 2010 18:24:06 +0000 (18:24 +0000)]
These test now run in objective-c++ mode we well.

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

14 years agoAdd missing test case, provided by Steven Watanabe.
Douglas Gregor [Tue, 18 May 2010 17:43:51 +0000 (17:43 +0000)]
Add missing test case, provided by Steven Watanabe.

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

14 years agoFix typo test case
Douglas Gregor [Tue, 18 May 2010 16:57:36 +0000 (16:57 +0000)]
Fix typo test case

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

14 years agoAdd support for Microsoft's __thiscall, from Steven Watanabe!
Douglas Gregor [Tue, 18 May 2010 16:57:00 +0000 (16:57 +0000)]
Add support for Microsoft's __thiscall, from Steven Watanabe!

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

14 years agoCorrectly initialize bases with member pointers. This should fix PR6441 but that...
Anders Carlsson [Tue, 18 May 2010 16:51:41 +0000 (16:51 +0000)]
Correctly initialize bases with member pointers. This should fix PR6441 but that test case is a bit weird and I'd like to investigate further before closing that bug.

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

14 years agoGive a slight edge to the context-sensitive keyword 'super' over
Douglas Gregor [Tue, 18 May 2010 16:30:22 +0000 (16:30 +0000)]
Give a slight edge to the context-sensitive keyword 'super' over
non-function-local declarations with names similar to what the user
typed. For example, this allows us to correct 'supper' to 'super' in
an Objective-C message send, even though the C function 'isupper' has
the same edit distance.

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

14 years agoTweak typo-correction logic a bit regarding "super", so that we
Douglas Gregor [Tue, 18 May 2010 16:14:23 +0000 (16:14 +0000)]
Tweak typo-correction logic a bit regarding "super", so that we
consider "super" as a candidate whenever we're parsing an expression
within an Objective-C method in an interface that has a superclass. At
some point, we'd like to give "super" a little edge over non-local
names; that will come later.

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

14 years agoPermit Objective C object pointers to be const_casted.
John McCall [Tue, 18 May 2010 09:35:29 +0000 (09:35 +0000)]
Permit Objective C object pointers to be const_casted.

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

14 years agoSwitch over the tablegen to use much prettier range technology
Sean Hunt [Tue, 18 May 2010 06:22:21 +0000 (06:22 +0000)]
Switch over the tablegen to use much prettier range technology
Also rename ABSTRACT to ABSTRACT_STMT, in keeping with the other .def
files

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

14 years ago"The attached patch allows clang to find the headers
Douglas Gregor [Tue, 18 May 2010 05:47:04 +0000 (05:47 +0000)]
"The attached patch allows clang to find the headers
for Visual Studio 2010.  It also adds a registry search
for the Express edition,", from Steven Watanabe!

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

14 years agoI hate this commit.
Douglas Gregor [Tue, 18 May 2010 05:45:02 +0000 (05:45 +0000)]
I hate this commit.

Revert much of the implementation of C++98/03 [temp.friend]p5 in
r103943 and its follow-ons r103948 and r103952. While our
implementation was technically correct, other compilers don't seem to
implement this paragraph (which forces the instantiation of friend
functions defined in a class template when a class template
specialization is instantiated), and doing so broke a bunch of Boost
libraries.

Since this behavior has changed in C++0x (which instantiates the
friend function definitions when they are used), we're going to skip
the nowhere-implemented C++98/03 semantics and go straight to the
C++0x semantics.

This commit is a band-aid to get Boost up and running again. It
doesn't really fix PR6952 (which this commit un-fixes), but it does
deal with the way Boost.Units abuses this particular paragraph.

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

14 years agoKeep track of the LLVM field numbers for non-virtual bases.
Anders Carlsson [Tue, 18 May 2010 05:22:06 +0000 (05:22 +0000)]
Keep track of the LLVM field numbers for non-virtual bases.

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

14 years agoStart laying out bases as individual fields. We still use ugly i8 arrays but this...
Anders Carlsson [Tue, 18 May 2010 05:12:20 +0000 (05:12 +0000)]
Start laying out bases as individual fields. We still use ugly i8 arrays but this is a step in the right direction.

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

14 years agoAdd CodeGenTypes::ContainsPointerToDataMember overload that takes a CXXRecordDecl.
Anders Carlsson [Tue, 18 May 2010 03:47:15 +0000 (03:47 +0000)]
Add CodeGenTypes::ContainsPointerToDataMember overload that takes a CXXRecordDecl.

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

14 years agoIf a switch condition is constant, don't warn about missing enum cases.
John McCall [Tue, 18 May 2010 03:19:21 +0000 (03:19 +0000)]
If a switch condition is constant, don't warn about missing enum cases.
If a switch condition is constant, warn if there's no case for it.

Constant switch conditions do come up in reasonable template code.

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

14 years agoAdd option '-analyzer-max-loop', which specifies the maximum
Zhongxing Xu [Tue, 18 May 2010 00:28:37 +0000 (00:28 +0000)]
Add option '-analyzer-max-loop', which specifies the maximum
number of times the analyzer will go through a loop.

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

14 years agoTeach the ObjC mangler to ignore member pointers just like gcc does.
John McCall [Mon, 17 May 2010 23:56:34 +0000 (23:56 +0000)]
Teach the ObjC mangler to ignore member pointers just like gcc does.

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

14 years agoAdd a hack to silence warnings about failing to return from functions after
Chandler Carruth [Mon, 17 May 2010 23:51:52 +0000 (23:51 +0000)]
Add a hack to silence warnings about failing to return from functions after
a temporary with a noreturn destructor has been created. Fixes PR6884 for now.

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

14 years agoInstantiate attributes on typedefs. This is a quick fix for PR7148,
Douglas Gregor [Mon, 17 May 2010 23:46:49 +0000 (23:46 +0000)]
Instantiate attributes on typedefs. This is a quick fix for PR7148,
when we really need a proper audit of our handling of attributes in
templates.

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

14 years agoAdd a 'Base' type to RecursiveASTVisitor to make recursing easier and document
Nick Lewycky [Mon, 17 May 2010 23:15:38 +0000 (23:15 +0000)]
Add a 'Base' type to RecursiveASTVisitor to make recursing easier and document
how you're supposed to use it.

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

14 years agoClean up test case and remove XFAIL. This test can now distinguish between
Ted Kremenek [Mon, 17 May 2010 23:03:33 +0000 (23:03 +0000)]
Clean up test case and remove XFAIL.  This test can now distinguish between
cases where Clang can suggest and fix and suggest and not auto-fix (because of
current limitations).

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

14 years agoComments and assorted cleanups for the Objective C type AST.
John McCall [Mon, 17 May 2010 23:00:45 +0000 (23:00 +0000)]
Comments and assorted cleanups for the Objective C type AST.

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

14 years agoClean up some more uses of getAs<ObjCInterfaceType>() that Fariborz pointed
John McCall [Mon, 17 May 2010 21:00:27 +0000 (21:00 +0000)]
Clean up some more uses of getAs<ObjCInterfaceType>() that Fariborz pointed
out.  The remaining ones are okay.

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

14 years agoFix an ambiguous else warning from GCC by adding some much needed curlies.
Chandler Carruth [Mon, 17 May 2010 20:58:49 +0000 (20:58 +0000)]
Fix an ambiguous else warning from GCC by adding some much needed curlies.

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

14 years agorobustify the conflict marker stuff. Don't add 7 twice, which would
Chris Lattner [Mon, 17 May 2010 20:27:25 +0000 (20:27 +0000)]
robustify the conflict marker stuff.  Don't add 7 twice, which would
make it miss (invalid) things like:
<<<<<<<
>>>>>>>

and crash if

<<<<<<<

was at the end of the line.  When we find a >>>>>>> that is not at the
end of the line, make sure to reset Pos so we don't crash on something
like:
<<<<<<< >>>>>>>

This isn't worth making testcases for, since each would require a new file.

rdar://7987078 - signal 11 compiling "<<<<<<<<<<"

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

14 years agoFix missing '}'.
Ted Kremenek [Mon, 17 May 2010 20:12:45 +0000 (20:12 +0000)]
Fix missing '}'.

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

14 years agoCorrectly generate IR for ObjC messages sends to protocol-qualified types.
John McCall [Mon, 17 May 2010 20:12:43 +0000 (20:12 +0000)]
Correctly generate IR for ObjC messages sends to protocol-qualified types.
Fixes rdar://problem/7992749

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

14 years agoAdd libclang function 'clang_CXXMethod_isStatic' to query of a C++ method
Ted Kremenek [Mon, 17 May 2010 20:06:56 +0000 (20:06 +0000)]
Add libclang function 'clang_CXXMethod_isStatic' to query of a C++ method
is declared static.

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

14 years agoTest that mutability of class members that involve class definitions actually works
Douglas Gregor [Mon, 17 May 2010 19:45:25 +0000 (19:45 +0000)]
Test that mutability of class members that involve class definitions actually works

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

14 years agoTeach ASTContext::getUnqualifiedArrayType() how to look through
Douglas Gregor [Mon, 17 May 2010 18:45:21 +0000 (18:45 +0000)]
Teach ASTContext::getUnqualifiedArrayType() how to look through
typedefs. As a drive-by, teach hit how to build VLA types, since those
will eventually be supported in C++.

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

14 years agomutable is a storage class that can follow a class/struct/union definition. Fixes...
Douglas Gregor [Mon, 17 May 2010 18:19:56 +0000 (18:19 +0000)]
mutable is a storage class that can follow a class/struct/union definition. Fixes PR7153

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

14 years agoDon't attempt to poke into an invalid field's class type
Fariborz Jahanian [Mon, 17 May 2010 18:15:18 +0000 (18:15 +0000)]
Don't attempt to poke into an invalid field's class type
to mark its destructors as referenced which may cause
a crash. Fixes radar 7896920

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

14 years agoDiagnose a redefinition error when there are two instantiations of friend
Douglas Gregor [Mon, 17 May 2010 17:57:54 +0000 (17:57 +0000)]
Diagnose a redefinition error when there are two instantiations of friend
functions defined inside a class template. Fixes PR6952, the last
Boost.Units failure.

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

14 years agoDetermine when the instantiation of a friend function defined inside a
Douglas Gregor [Mon, 17 May 2010 17:34:56 +0000 (17:34 +0000)]
Determine when the instantiation of a friend function defined inside a
class template conflicts with an existing (non-template)
definition. This is another part of PR6952.

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

14 years agoIRgen: Remove dead function.
Daniel Dunbar [Mon, 17 May 2010 16:46:02 +0000 (16:46 +0000)]
IRgen: Remove dead function.

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

14 years agoC++/Darwin/i386 ABI: Fix some problems with empty record handling.
Daniel Dunbar [Mon, 17 May 2010 16:46:00 +0000 (16:46 +0000)]
C++/Darwin/i386 ABI: Fix some problems with empty record handling.
 - Check bases as part of isEmptyRecord().

 - C++ record fields are never empty in the Itanium ABI.

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

14 years agoC++98/03 [temp.friend]p4 requires that inline function definitions
Douglas Gregor [Mon, 17 May 2010 16:38:00 +0000 (16:38 +0000)]
C++98/03 [temp.friend]p4 requires that inline function definitions
within class templates be instantiated along with each class template
specialization, even if the functions are not used. Do so, as a baby
step toward PR6952.

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

14 years agoEnsure that destructors are called for NRVO'd objects when the
Douglas Gregor [Mon, 17 May 2010 15:52:46 +0000 (15:52 +0000)]
Ensure that destructors are called for NRVO'd objects when the
function does not return. Thanks to Eli for pointing out this corner
case.

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

14 years agoPick the correct personality function based on the language. This prevents link...
David Chisnall [Mon, 17 May 2010 13:49:20 +0000 (13:49 +0000)]
Pick the correct personality function based on the language.  This prevents link failures when C/ObjC code uses __attribute__((cleanup())) (previously this was inserting references to two libstc++ symbols; the personality function and the __terminate() function).

This is still probably wrong for Objective-C++ and adds a couple of lines in CGException that should probably be in the CGObjCRuntime subclass.  The personality function is now only looked up in one place in CGException though, so this should be easier to fix in the future.

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

14 years agoPR7117: Make sure we don't lose the calling convention for K&R-style
Eli Friedman [Mon, 17 May 2010 02:50:18 +0000 (02:50 +0000)]
PR7117: Make sure we don't lose the calling convention for K&R-style
definitions.

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

14 years agowhen code completing inside a C-style block comment, don't emit errors about
Chris Lattner [Sun, 16 May 2010 19:54:05 +0000 (19:54 +0000)]
when code completing inside a C-style block comment, don't emit errors about
a missing */ since we truncated the file.

This fixes rdar://7948776

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

14 years agoMoved clang-builtin include dir position to immediately precede C includes.
mike-m [Sun, 16 May 2010 19:03:52 +0000 (19:03 +0000)]
Moved clang-builtin include dir position to immediately precede C includes.
This aligns with how gcc compiler does things.

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

14 years agoCorrectly diagnose array 'new' with initialization arguments when the new type is...
Anders Carlsson [Sun, 16 May 2010 16:24:20 +0000 (16:24 +0000)]
Correctly diagnose array 'new' with initialization arguments when the new type is a typedef to an array type.

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

14 years agoWhen the type-id or new-type-id of a C++ "new" expression is a typedef
Douglas Gregor [Sun, 16 May 2010 16:01:03 +0000 (16:01 +0000)]
When the type-id or new-type-id of a C++ "new" expression is a typedef
of an array type, use the outermost array bound as the number of
elements to allocate. Fixes PR7147.

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

14 years agoDon't emit any fallthrough / missing-noreturn warnings if we can't
John McCall [Sun, 16 May 2010 09:34:11 +0000 (09:34 +0000)]
Don't emit any fallthrough / missing-noreturn warnings if we can't
compute a CFG for a function.

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

14 years agoWhen constant folding reference variables with an initializer to the
Chandler Carruth [Sun, 16 May 2010 09:32:51 +0000 (09:32 +0000)]
When constant folding reference variables with an initializer to the
initializer, don't fold paramters. Their initializers are just default
arguments which can be overridden. This fixes some spectacular regressions due
to more things making it into the constant folding.

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

14 years agoreally use valist.
Chris Lattner [Sun, 16 May 2010 05:00:34 +0000 (05:00 +0000)]
really use valist.

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

14 years agofix rdar://7985267 - Don't emit an error about a non-pod argument
Chris Lattner [Sun, 16 May 2010 04:01:30 +0000 (04:01 +0000)]
fix rdar://7985267 - Don't emit an error about a non-pod argument
passed to va_start, it doesn't actually pass it.

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

14 years agoEmit a type record for TYPE_OBJC_OBJECT in the PCH file. I'm not
John McCall [Sun, 16 May 2010 02:12:35 +0000 (02:12 +0000)]
Emit a type record for TYPE_OBJC_OBJECT in the PCH file.  I'm not
entirely sure what this does, to be honest.

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

14 years agoBe sure to initialize the "has base type as written" field of an
John McCall [Sun, 16 May 2010 02:12:01 +0000 (02:12 +0000)]
Be sure to initialize the "has base type as written" field of an
ObjCObjectTypeLoc.  This should clear up some valgrind errors we've
been seeing.

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

14 years agoAvoid doing two switches in TypeLoc's initialize() loop. The optimizer
John McCall [Sun, 16 May 2010 02:09:32 +0000 (02:09 +0000)]
Avoid doing two switches in TypeLoc's initialize() loop.  The optimizer
can probably do this for us, but it's actually somewhat nicer to write it
out here.

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

14 years agoWhen initializing thread-safe statics, put the call to
Douglas Gregor [Sun, 16 May 2010 01:24:12 +0000 (01:24 +0000)]
When initializing thread-safe statics, put the call to
__cxa_guard_abort along the exceptional edge into (in effect) a nested
"try" that rethrows after aborting. Fixes PR7144 and the remaining
Boost.ProgramOptions failures, along with the regressions that r103880
caused.

The crucial difference between this and r103880 is that we now follow
LLVM's little dance with the llvm.eh.exception and llvm.eh.selector
calls, then use _Unwind_Resume_or_Rethrow to rethrow.

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

14 years agoRevert r103880 (thread-safe static initialization w/ exceptions),
Douglas Gregor [Sun, 16 May 2010 00:44:00 +0000 (00:44 +0000)]
Revert r103880 (thread-safe static initialization w/ exceptions),
because it's causing strange linker errors. Unfixes PR7144.

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

14 years agoMinor twik to my last patch. (for radar 7986354).
Fariborz Jahanian [Sun, 16 May 2010 00:10:46 +0000 (00:10 +0000)]
Minor twik to my last patch. (for radar 7986354).

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

14 years agoFix API gen for objc_msgSend property of aggregate types
Fariborz Jahanian [Sat, 15 May 2010 23:05:52 +0000 (23:05 +0000)]
Fix API gen for objc_msgSend property of aggregate types
in Objective-c++ mode. Fixes radar 7986354.

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

14 years agoWhen initializing thread-safe statics, put the call to
Douglas Gregor [Sat, 15 May 2010 17:55:51 +0000 (17:55 +0000)]
When initializing thread-safe statics, put the call to
__cxa_guard_abort along the exceptional edge into (in effect) a nested
"try" that rethrows after aborting. Fixes PR7144 and the remaining
Boost.ProgramOptions failures.

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

14 years agoAttempt to satisfy Release-Asserts build
Douglas Gregor [Sat, 15 May 2010 17:28:53 +0000 (17:28 +0000)]
Attempt to satisfy Release-Asserts build

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

14 years agoModify this comment per Doug's suggestion: we don't need to mangle protocols.
John McCall [Sat, 15 May 2010 17:06:29 +0000 (17:06 +0000)]
Modify this comment per Doug's suggestion:  we don't need to mangle protocols.

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

14 years agosigh
Chris Lattner [Sat, 15 May 2010 16:56:34 +0000 (16:56 +0000)]
sigh

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

14 years agofix _mm_shuffle_pd too, thanks to Joel Falcou for pointing this out.
Chris Lattner [Sat, 15 May 2010 16:54:46 +0000 (16:54 +0000)]
fix _mm_shuffle_pd too, thanks to Joel Falcou for pointing this out.

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

14 years agoWhen applying the named return value optimization, we still need to
Douglas Gregor [Sat, 15 May 2010 16:39:56 +0000 (16:39 +0000)]
When applying the named return value optimization, we still need to
destroy the variable along the exceptional edge; it's only during
normal execution that we avoid destroying this variable.

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

14 years agoSubstantially alter the design of the Objective C type AST by introducing
John McCall [Sat, 15 May 2010 11:32:37 +0000 (11:32 +0000)]
Substantially alter the design of the Objective C type AST by introducing
ObjCObjectType, which is basically just a pair of
  one of {primitive-id, primitive-Class, user-defined @class}
with
  a list of protocols.
An ObjCObjectPointerType is therefore just a pointer which always points to
one of these types (possibly sugared).  ObjCInterfaceType is now just a kind
of ObjCObjectType which happens to not carry any protocols.

Alter a rather large number of use sites to use ObjCObjectType instead of
ObjCInterfaceType.  Store an ObjCInterfaceType as a pointer on the decl rather
than hashing them in a FoldingSet.  Remove some number of methods that are no
longer used, at least after this patch.

By simplifying ObjCObjectPointerType, we are now able to easily remove and apply
pointers to Objective-C types, which is crucial for a certain kind of ObjC++
metaprogramming common in WebKit.

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

14 years agoImplement a simple form of the C++ named return value optimization for
Douglas Gregor [Sat, 15 May 2010 06:46:45 +0000 (06:46 +0000)]
Implement a simple form of the C++ named return value optimization for
return statements. We perform NRVO only when all of the return
statements in the function return the same variable. Fixes some link
failures in Boost.Interprocess (which is relying on NRVO), and
probably improves performance for some C++ applications.

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

14 years agoImplement semantic analysis and an AST representation for the named
Douglas Gregor [Sat, 15 May 2010 06:01:05 +0000 (06:01 +0000)]
Implement semantic analysis and an AST representation for the named
return value optimization. Sema marks return statements with their
NRVO candidates (which may or may not end up using the NRVO), then, at
the end of a function body, computes and marks those variables that
can be allocated into the return slot.

I've checked this locally with some debugging statements (not
committed), but there won't be any tests until CodeGen comes along.

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

14 years agoadd type casts to _mm_shuffle_ps so the front-end applies
Chris Lattner [Sat, 15 May 2010 05:53:53 +0000 (05:53 +0000)]
add type casts to _mm_shuffle_ps so the front-end applies
implicit conversions where needed.  This fixes an error reported
on cfe-dev, not really worth a testcase though.

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

14 years agoRecognize when the named return value optimization applies in a
Douglas Gregor [Sat, 15 May 2010 00:13:29 +0000 (00:13 +0000)]
Recognize when the named return value optimization applies in a
"return" statement and mark the corresponding CXXConstructExpr as
elidable. Teach CodeGen that eliding a temporary is different from
eliding an object construction.

This is just a baby step toward NRVO.

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