]> granicus.if.org Git - clang/log
clang
13 years agoRe-enable the fix for PR9181 now that all the edge cases are handled.
Anders Carlsson [Sun, 15 May 2011 17:36:21 +0000 (17:36 +0000)]
Re-enable the fix for PR9181 now that all the edge cases are handled.

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

13 years agoWhen checking a set of template parameter lists against a
Douglas Gregor [Sun, 15 May 2011 17:27:27 +0000 (17:27 +0000)]
When checking a set of template parameter lists against a
nested-name-specifier, re-evaluate the nested-name-specifier as if we
were entering that context (which we did!), so that we'll resolve a
template-id to a particular class template partial
specialization. Fixes PR9913.

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

13 years agoThe array-size operand to a new-expression is not necessarily a size_t.
John McCall [Sun, 15 May 2011 07:14:44 +0000 (07:14 +0000)]
The array-size operand to a new-expression is not necessarily a size_t.
It can be larger, it can be smaller, it can be signed, whatever.  Handle
all the crazy cases with grace and spirit.

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

13 years agoFix MSVC build.
Argyrios Kyrtzidis [Sun, 15 May 2011 05:10:24 +0000 (05:10 +0000)]
Fix MSVC build.

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

13 years agoMake CGF.getContext() inlinable, because it's trivial, and optimize
John McCall [Sun, 15 May 2011 02:34:36 +0000 (02:34 +0000)]
Make CGF.getContext() inlinable, because it's trivial, and optimize
hasAggregateLLVMType.

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

13 years agoMore killing of std::vector.
John McCall [Sun, 15 May 2011 02:19:42 +0000 (02:19 +0000)]
More killing of std::vector.

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

13 years agoUse arrays and SmallVectors instead of std::vectors when building function
John McCall [Sun, 15 May 2011 01:53:33 +0000 (01:53 +0000)]
Use arrays and SmallVectors instead of std::vectors when building function
types.  Also, cache a translation of 'void' in CGM and provide a ptrdiff_t
alias.  No functionality change.

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

13 years agoDisable the optimization until the bug noticed by Sean Hunt has been fixed.
Anders Carlsson [Sun, 15 May 2011 01:50:14 +0000 (01:50 +0000)]
Disable the optimization until the bug noticed by Sean Hunt has been fixed.

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

13 years agoFix generation of obj-c @encoding for members with zero size.
Argyrios Kyrtzidis [Sun, 15 May 2011 00:11:35 +0000 (00:11 +0000)]
Fix generation of obj-c @encoding for members with zero size.
Also follow gcc in that arrays of elements with zero size are encoded as arrays with zero elements.

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

13 years agoWhen emitting the destructor for a class with a vtable, if we can determine
Anders Carlsson [Sat, 14 May 2011 23:26:09 +0000 (23:26 +0000)]
When emitting the destructor for a class with a vtable, if we can determine
that the destructor body is trivial and that all member variables also have either
trivial destructors or trivial destructor bodies, we don't need to initialize the
vtable pointers since no virtual member functions will be called on the destructor.

Fixes PR9181.

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

13 years agoLet clang-check actually use the Directory entry in the json file.
Nico Weber [Sat, 14 May 2011 21:20:23 +0000 (21:20 +0000)]
Let clang-check actually use the Directory entry in the json file.

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

13 years agoOnly perform the null-initialization of an aggregate result of a message
John McCall [Sat, 14 May 2011 21:12:11 +0000 (21:12 +0000)]
Only perform the null-initialization of an aggregate result of a message
send if the receiver is null.  Normally it's not worthwhile to check this,
but avoiding the null-initialization is nice, and this also avoids nasty
problems where the null-initialization is visible within the call because
we use an aliased result buffer.  rdar://problem/9402992

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

13 years agoCreate proper Objective-C @encoding for C++ classes; fixes rdar://9357400.
Argyrios Kyrtzidis [Sat, 14 May 2011 20:32:43 +0000 (20:32 +0000)]
Create proper Objective-C @encoding for C++ classes; fixes rdar://9357400.

Go through and expand the members of bases into the encoding string (and encode the VTable as well).
Unlike gcc which expands virtual bases as many times as they appear in the
hierarchy, clang will only expand them once at the end, to reflect the actual layout.

Note that there doesn't seem to be a way to indicate in the encoding that
packing/alignment of members is different that normal, in which case
the encoding will be out-of-sync with the real layout.
If the runtime switches to just consider the size of types without
taking into account alignment, we could easily make padding explicit in the
encoding (e.g. using arrays of chars). The encoding strings would be
longer then though.

Also encode a flexible array member as array of 0 size, like gcc, not as a pointer.

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

13 years agoEmit an error when trying to @encode an incomplete type.
Argyrios Kyrtzidis [Sat, 14 May 2011 20:32:39 +0000 (20:32 +0000)]
Emit an error when trying to @encode an incomplete type.

There are APIs, e.g. [NSValue valueWithBytes:objCType:], which use the encoding to find out
the size of an object pointed to by a pointer. Make things safer by making it illegal to @encode
incomplete types.

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

13 years agoRevert 131347. It asserts if the specialization in within a class template:
Francois Pichet [Sat, 14 May 2011 19:17:07 +0000 (19:17 +0000)]
Revert 131347. It asserts if the specialization in within a class template:

template<class U>
struct X1 {
  template<class T> void f(T*);
  template<> void f(int*) { }
};

Won't be so simple. I need to think more about it.

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

13 years agoMake sure we actually generate defaulted copy constructors; caught by
Sean Hunt [Sat, 14 May 2011 18:20:50 +0000 (18:20 +0000)]
Make sure we actually generate defaulted copy constructors; caught by
Howard Hinnant. Thanks!

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

13 years agoIn Microsoft mode, allow template function explicit specialization at class scope.
Francois Pichet [Sat, 14 May 2011 17:46:46 +0000 (17:46 +0000)]
In Microsoft mode, allow template function explicit specialization at class scope.
Necessary to parse MFC and MSVC standard lib code.

Example:
struct X {
  template<class T> void f(T) { }
  template<> void f(int) { }
}

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

13 years agoPR9908: Fix the broken fix for PR9902 to get the template argument lists in the right...
Richard Smith [Sat, 14 May 2011 15:04:18 +0000 (15:04 +0000)]
PR9908: Fix the broken fix for PR9902 to get the template argument lists in the right order.
Also, don't reject alias templates in all ElaboratedTypes: some ElaboratedTypes do not correspond to elaborated-type-specifiers.

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

13 years agoWhat I hope to be an implementation of defaulted copy assignment
Sean Hunt [Sat, 14 May 2011 05:23:28 +0000 (05:23 +0000)]
What I hope to be an implementation of defaulted copy assignment
operators.

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

13 years agoMore progress towards defaulted copy assignment
Sean Hunt [Sat, 14 May 2011 05:23:24 +0000 (05:23 +0000)]
More progress towards defaulted copy assignment

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

13 years agoStart implementing defaulted copy assignment
Sean Hunt [Sat, 14 May 2011 05:23:20 +0000 (05:23 +0000)]
Start implementing defaulted copy assignment

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

13 years agoObjective-C vtables are not taking the world by storm; call them
John McCall [Sat, 14 May 2011 03:10:52 +0000 (03:10 +0000)]
Objective-C vtables are not taking the world by storm;  call them
out as "v-table" message sends and stop calling normal messages "legacy"
message sends.

Also, fix some comments to reveal the true state of affairs.

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

13 years agoReorganize this method to avoid multiple calls for computing CGFunctionInfo
John McCall [Fri, 13 May 2011 23:16:18 +0000 (23:16 +0000)]
Reorganize this method to avoid multiple calls for computing CGFunctionInfo
and to decrease the amount of effort in appending strings.

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

13 years agoSimplify
Joerg Sonnenberger [Fri, 13 May 2011 22:58:37 +0000 (22:58 +0000)]
Simplify

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

13 years agoBug 8765: Honor assembler labels for builtins. Ensure that the label is
Joerg Sonnenberger [Fri, 13 May 2011 21:12:10 +0000 (21:12 +0000)]
Bug 8765: Honor assembler labels for builtins. Ensure that the label is
mangled to avoid doing it twice for platforms that use prefixes like
Darwin.

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

13 years agoInclude assembler label for functions in the XML dump
Joerg Sonnenberger [Fri, 13 May 2011 21:10:39 +0000 (21:10 +0000)]
Include assembler label for functions in the XML dump

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

13 years agoFix copy constructor deletion detection with array types.
Sean Hunt [Fri, 13 May 2011 21:10:11 +0000 (21:10 +0000)]
Fix copy constructor deletion detection with array types.

This fixes PR9910

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

13 years agoIntroduce __has_extension macro
Peter Collingbourne [Fri, 13 May 2011 20:54:45 +0000 (20:54 +0000)]
Introduce __has_extension macro

__has_extension is a function-like macro which takes the same set
of feature identifiers as __has_feature.  It evaluates to 1 if the
feature is supported by Clang in the current language (either as a
language extension or a standard language feature) or 0 if not.

At the same time, add support for the C1X feature identifiers
c_generic_selections (renamed from generic_selections) and
c_static_assert, and document them.

Patch by myself and Jean-Daniel Dupas.

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

13 years agoDefine __ARM_NEON__ in both ARM and Thumb modes. Radar 9431992.
Bob Wilson [Fri, 13 May 2011 18:56:03 +0000 (18:56 +0000)]
Define __ARM_NEON__ in both ARM and Thumb modes.  Radar 9431992.

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

13 years agoRemove the 'unaligned load' builtins now that they're no longer used in the *mmintrin...
Bill Wendling [Fri, 13 May 2011 18:52:28 +0000 (18:52 +0000)]
Remove the 'unaligned load' builtins now that they're no longer used in the *mmintrin.h files.

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

13 years agoProduce UTF-8 strings with -fconstant-string-class
Fariborz Jahanian [Fri, 13 May 2011 18:13:10 +0000 (18:13 +0000)]
Produce UTF-8 strings with -fconstant-string-class
-fno-constant-cfstrings. Patch by Jonathan Schleifer.

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

13 years agorefactor CheckForwardProtocolDeclarationForCircularDependency returns
Fariborz Jahanian [Fri, 13 May 2011 18:02:08 +0000 (18:02 +0000)]
refactor CheckForwardProtocolDeclarationForCircularDependency returns
'true' on detecting protocol cycles. No functionality change.

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

13 years agoAdd c-index-test printing and tests for static and virtual method
Douglas Gregor [Fri, 13 May 2011 15:54:42 +0000 (15:54 +0000)]
Add c-index-test printing and tests for static and virtual method
query functions, from Erik Verbruggen!

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

13 years agoEliminate old, useless tutorial page
Douglas Gregor [Fri, 13 May 2011 14:43:48 +0000 (14:43 +0000)]
Eliminate old, useless tutorial page

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

13 years agoDefaulting copy constructors now works reasonably well.
Sean Hunt [Fri, 13 May 2011 06:10:58 +0000 (06:10 +0000)]
Defaulting copy constructors now works reasonably well.

One more special member to go

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

13 years agosome updates.
Chris Lattner [Fri, 13 May 2011 05:29:16 +0000 (05:29 +0000)]
some updates.

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

13 years agothis never happened.
Chris Lattner [Fri, 13 May 2011 05:22:41 +0000 (05:22 +0000)]
this never happened.

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

13 years agoremove some old redirect pages. We're into our 3rd year of redirecting, the world...
Chris Lattner [Fri, 13 May 2011 05:21:33 +0000 (05:21 +0000)]
remove some old redirect pages.  We're into our 3rd year of redirecting, the world should have adjusted by now :)

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

13 years agoDelete doxygen.cfg, and use cwd-relative paths in doxygen.cfg.in.
Peter Collingbourne [Fri, 13 May 2011 03:29:06 +0000 (03:29 +0000)]
Delete doxygen.cfg, and use cwd-relative paths in doxygen.cfg.in.
Now "make doxygen" works for clang.

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

13 years agoRefactoring of constant expression evaluator
Peter Collingbourne [Fri, 13 May 2011 03:29:01 +0000 (03:29 +0000)]
Refactoring of constant expression evaluator

This introduces a generic base class for the expression evaluator
classes, which handles a few common expression types which were
previously handled separately in each class.  Also, the expression
evaluator now uses ConstStmtVisitor.

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

13 years agoAdd a ConstStmtVisitor class
Peter Collingbourne [Fri, 13 May 2011 03:28:54 +0000 (03:28 +0000)]
Add a ConstStmtVisitor class

ConstStmtVisitor is a constness-preserving variant of StmtVisitor.
ConstStmtVisitor and StmtVisitor share an implementation using a common
base class, StmtVisitorBase, which uses a template template parameter
to build pointer types.

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

13 years agoAdd 'may_alias' attribute. Noticed by Eli.
Bill Wendling [Fri, 13 May 2011 01:24:00 +0000 (01:24 +0000)]
Add 'may_alias' attribute. Noticed by Eli.

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

13 years agoWhen determining whether we can make a declaration into a global
Douglas Gregor [Fri, 13 May 2011 01:05:07 +0000 (01:05 +0000)]
When determining whether we can make a declaration into a global
constant, also consider whether it's a class type that has any mutable
fields. If so, it can't be a global constant.

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

13 years agoImplement a few basic tests for defaulted and deleted functions.
Sean Hunt [Fri, 13 May 2011 01:01:05 +0000 (01:01 +0000)]
Implement a few basic tests for defaulted and deleted functions.

More comprehensive testing once copy {constructors,assignment operators}
can be defaulted.

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

13 years agoTeach the template parameter dependency checker used when matching
Douglas Gregor [Fri, 13 May 2011 00:34:01 +0000 (00:34 +0000)]
Teach the template parameter dependency checker used when matching
template parameter lists to scope specifiers for friend declarations
about injected class name types. Fixes the
g++.dg/template/memfriend5.C regression in the GCC testsuite.

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

13 years agoImplement the __is_trivially_copyable type trait
Sean Hunt [Fri, 13 May 2011 00:31:07 +0000 (00:31 +0000)]
Implement the __is_trivially_copyable type trait

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

13 years agoRepresent the unaligned loads natively. These are converted into a call to the
Bill Wendling [Fri, 13 May 2011 00:11:39 +0000 (00:11 +0000)]
Represent the unaligned loads natively. These are converted into a call to the
correct unaligned load.

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

13 years agoImplement defaulting of destructors.
Sean Hunt [Thu, 12 May 2011 22:46:29 +0000 (22:46 +0000)]
Implement defaulting of destructors.

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

13 years agoHrm
Sean Hunt [Thu, 12 May 2011 22:46:25 +0000 (22:46 +0000)]
Hrm

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

13 years agoAdd a method to query whether or not a class has a default constructor declared.
Nick Lewycky [Thu, 12 May 2011 22:11:21 +0000 (22:11 +0000)]
Add a method to query whether or not a class has a default constructor declared.

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

13 years agoAfter issuing diagnostics on circular protocol list,
Fariborz Jahanian [Thu, 12 May 2011 22:04:39 +0000 (22:04 +0000)]
After issuing diagnostics on circular protocol list,
don't build circular AST in protocol's protocol list
when user code has introduced it. Indexer and other
clients may crash. // rdar://9221614

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

13 years agoDoug convinced me that DW_AT_APPLE_objc_complete_type is more appropriate name.
Devang Patel [Thu, 12 May 2011 21:29:57 +0000 (21:29 +0000)]
Doug convinced me that DW_AT_APPLE_objc_complete_type is more appropriate name.
s/DW_AT_APPLE_objc_class_extension/DW_AT_APPLE_objc_complete_type/g

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

13 years agoDo not add AT_APPLE_objc_class_extension attribute if @implementation is not seen.
Devang Patel [Thu, 12 May 2011 21:14:54 +0000 (21:14 +0000)]
Do not add AT_APPLE_objc_class_extension attribute if @implementation is not seen.

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

13 years agoenable __has_feature(is_standard_layout)
Howard Hinnant [Thu, 12 May 2011 19:52:14 +0000 (19:52 +0000)]
enable __has_feature(is_standard_layout)

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

13 years agoUse DW_AT_APPLE_objc_class_extension attribute to identify interfaces that represent...
Devang Patel [Thu, 12 May 2011 19:07:41 +0000 (19:07 +0000)]
Use DW_AT_APPLE_objc_class_extension attribute to identify interfaces that represent class extension.
Radar 9423077.

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

13 years agoLLVM doesn't always optimize away the four loads from this:
Bill Wendling [Thu, 12 May 2011 19:02:15 +0000 (19:02 +0000)]
LLVM doesn't always optimize away the four loads from this:

     (__m128){ p[0], p[1], p[2], p[3] }

which produces really bad code. This could be done in instcombine, but it's
probably better to do it in the front-end instead.
<rdar://problem/9424836>

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

13 years agoAdd clang_CXXMethod_isVirtual() to libclang, from Erik Verbruggen!
Douglas Gregor [Thu, 12 May 2011 15:17:24 +0000 (15:17 +0000)]
Add clang_CXXMethod_isVirtual() to libclang, from Erik Verbruggen!

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

13 years agoProperly parse the 'default' and 'delete' keywords.
Sean Hunt [Thu, 12 May 2011 06:15:49 +0000 (06:15 +0000)]
Properly parse the 'default' and 'delete' keywords.

They are actually grammatically considered definitions and parsed
accordingly.

This fixes the outstanding bugs regarding defaulting functions after
their declarations.

We now really nicely diagnose the following construct (try it!)

int foo() = delete, bar;

Still todo: Defaulted functions other than default constructors
            Test cases (including for the above construct)

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

13 years agoMake it so that we actually generate definitions for explicitly
Sean Hunt [Thu, 12 May 2011 03:51:51 +0000 (03:51 +0000)]
Make it so that we actually generate definitions for explicitly
defaulted default constructors.

As it happens, making sure that we handle out-of-line defaulted
functions properly will involved making sure that we actually parse them
correctly, so that's coming after.

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

13 years agoImplement deletion of explicitly defaulted default constructors.
Sean Hunt [Thu, 12 May 2011 03:51:48 +0000 (03:51 +0000)]
Implement deletion of explicitly defaulted default constructors.

We still don't parse out-of-line defaults correctly, which is needed to
get the full effect out of this patch.

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

13 years agoFix crasher spotted in IWYU.
Nick Lewycky [Thu, 12 May 2011 03:51:24 +0000 (03:51 +0000)]
Fix crasher spotted in IWYU.

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

13 years agoPR9899: handle pseudo-destructors correctly in noexcept() expressions.
Eli Friedman [Thu, 12 May 2011 02:11:32 +0000 (02:11 +0000)]
PR9899: handle pseudo-destructors correctly in noexcept() expressions.

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

13 years agoMake this code more resilient against catch variables which need cleanups.
John McCall [Thu, 12 May 2011 01:00:15 +0000 (01:00 +0000)]
Make this code more resilient against catch variables which need cleanups.

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

13 years agoFix typo in comment.
Nick Lewycky [Thu, 12 May 2011 00:12:46 +0000 (00:12 +0000)]
Fix typo in comment.

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

13 years agoFix PR9902: correctly substitute alias templates within the template in which they...
Richard Smith [Thu, 12 May 2011 00:06:17 +0000 (00:06 +0000)]
Fix PR9902: correctly substitute alias templates within the template in which they are defined: provide an empty list of arguments for each containing template context during substitution.

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

13 years agoImplement CWG1170, which makes access-control errors into template
Douglas Gregor [Wed, 11 May 2011 23:45:11 +0000 (23:45 +0000)]
Implement CWG1170, which makes access-control errors into template
argument deduction failures. Only implemented in C++0x, since this is
a significant change in behavior from C++98/03.

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

13 years agoWhen checking for the necessary 'template<>' headers based on the
Douglas Gregor [Wed, 11 May 2011 23:26:17 +0000 (23:26 +0000)]
When checking for the necessary 'template<>' headers based on the
nested of an out-of-line declaration, only require a 'template<>'
header for each enclosing class template that hasn't been previously
specialized; previously, we were requiring 'template<>' for enclosing
class templates and members of class templates that hadn't been
previously specialized. Fixes <rdar://problem/9422013>.

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

13 years agoPlace "conflicting distributed object modifiers..." warnings under a -W flag.
Ted Kremenek [Wed, 11 May 2011 23:06:50 +0000 (23:06 +0000)]
Place "conflicting distributed object modifiers..." warnings under a -W flag.

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

13 years agoCommit some missing changes to the previous patch.
Sean Hunt [Wed, 11 May 2011 22:50:12 +0000 (22:50 +0000)]
Commit some missing changes to the previous patch.

This means we get C++0x jump-across-intializer semantics correct.

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

13 years agoImplement implicit deletion of default constructors.
Sean Hunt [Wed, 11 May 2011 22:34:38 +0000 (22:34 +0000)]
Implement implicit deletion of default constructors.

Yes, I'm aware that the diagnostics are awful.

Tests to follow.

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

13 years agoAdd a Microsoft C test following r131201.
Francois Pichet [Wed, 11 May 2011 22:28:19 +0000 (22:28 +0000)]
Add a Microsoft C test following r131201.

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

13 years agoIn Microsoft mode, allow conversion from pointer to integral type no matter what...
Francois Pichet [Wed, 11 May 2011 22:13:54 +0000 (22:13 +0000)]
In Microsoft mode, allow conversion from pointer to integral type no matter what size the integral type is. Necessary to parse MFC code.

Example:
void f(char *ptr) {
  char var = (char)ptr;
}

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

13 years agoClean up consequences of cut and paste.
Fariborz Jahanian [Wed, 11 May 2011 17:07:02 +0000 (17:07 +0000)]
Clean up consequences of cut and paste.

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

13 years agoImplenment #pack pragma and ms_struct attribute layout.
Fariborz Jahanian [Wed, 11 May 2011 16:58:31 +0000 (16:58 +0000)]
Implenment #pack pragma and ms_struct attribute layout.
Concludes // radar://8823265.

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

13 years agoHandle gcc-compatible compilers (such as clang) the same way we handle
Oscar Fuentes [Wed, 11 May 2011 13:53:30 +0000 (13:53 +0000)]
Handle gcc-compatible compilers (such as clang) the same way we handle
gcc.

Fixes PR9886.

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

13 years agoTeach CFG building how to deal with CXXMemberCallExprs and BoundMemberTy,
John McCall [Wed, 11 May 2011 07:19:11 +0000 (07:19 +0000)]
Teach CFG building how to deal with CXXMemberCallExprs and BoundMemberTy,
then teach -Wreturn-type to handle the same.  Net effect:  we now correctly
handle noreturn attributes on member calls in the CFG.

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

13 years agoPR9882: Fix noexcept to deal with dependent new, delete, calls, and
Eli Friedman [Wed, 11 May 2011 05:22:44 +0000 (05:22 +0000)]
PR9882: Fix noexcept to deal with dependent new, delete, calls, and
dynamic_cast correctly.

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

13 years agoIn Microsoft mode, allow pure specifier (=0) on inline functions declared at class...
Francois Pichet [Wed, 11 May 2011 02:14:46 +0000 (02:14 +0000)]
In Microsoft mode, allow pure specifier (=0) on inline functions declared at class scope.
This removes 2 errors when parsing MFC code with clang

Example:
class A {
    virtual void f() = 0 { }
}

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

13 years agoUse a heralded conversion to bool in inline-asm constraints.
John McCall [Tue, 10 May 2011 23:39:47 +0000 (23:39 +0000)]
Use a heralded conversion to bool in inline-asm constraints.

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

13 years agoFix crash in -Wuninitialized when using switch statments whose condition is a logical...
Ted Kremenek [Tue, 10 May 2011 22:10:35 +0000 (22:10 +0000)]
Fix crash in -Wuninitialized when using switch statments whose condition is a logical operation.

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

13 years agoTweak the diagnostics for the C++0x extensions to friend types to note
Douglas Gregor [Tue, 10 May 2011 21:23:31 +0000 (21:23 +0000)]
Tweak the diagnostics for the C++0x extensions to friend types to note
that they are C++0x extensions, and put them in the appropriate
group. We already support most of the semantics. Addresses
<rdar://problem/9407525>.

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

13 years agoChange magic string "abc" to better magic string "qux".
Matt Beaumont-Gay [Tue, 10 May 2011 20:28:29 +0000 (20:28 +0000)]
Change magic string "abc" to better magic string "qux".

Wait, what?

So, we run Clang (and LLVM) tests in an environment where the md5sum of the
input files becomes a component of the path. When testing the preprocessor,
the path becomes part of the output (in line directives). In this test, we
were grepping for the absence of "abc" in the output. When the stars aligned
properly, the md5sum component of the path contained "abc" and the test
failed. Oops.

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

13 years agoRe-do R131114 without breaking code.
Sean Hunt [Tue, 10 May 2011 19:08:14 +0000 (19:08 +0000)]
Re-do R131114 without breaking code.

I've edited one diagnostic which would print "copy constructor" for copy
constructors and "constructor" for any other constructor. If anyone is
extremely enamored with this, it can be reinstated with a simple boolean
flag rather than calling getSpecialMember, which is inappropriate.

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

13 years agoSupport pack pragma and ms_struct attributes. // rdar://8823265
Fariborz Jahanian [Tue, 10 May 2011 19:00:50 +0000 (19:00 +0000)]
Support pack pragma and ms_struct attributes. // rdar://8823265

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

13 years agoElide __label__ declarations from the CFG. This resolves a crash in CFGRecStmtDeclVi...
Ted Kremenek [Tue, 10 May 2011 18:42:15 +0000 (18:42 +0000)]
Elide __label__ declarations from the CFG.  This resolves a crash in CFGRecStmtDeclVisitor (crash in static analyzer).

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

13 years agoReimplement Sema::MatchTemplateParametersToScopeSpecifier() based on
Douglas Gregor [Tue, 10 May 2011 18:27:06 +0000 (18:27 +0000)]
Reimplement Sema::MatchTemplateParametersToScopeSpecifier() based on
the semantic context referenced by the nested-name-specifier rather
than the syntactic form of the nested-name-specifier. The previous
incarnation was based on my complete misunderstanding of C++
[temp.expl.spec]. The latest C++0x working draft clarifies the
requirements here, and this rewrite is intended to follow that.

Along the way, improve source location information in the
diagnostics. For example, if we report that a specific type needs or
doesn't need a 'template<>' header, we dig out that type in the
nested-name-specifier and highlight its range.

Fixes: PR5907, PR9421, PR8277, PR8708, PR9482, PR9668, PR9877, and
<rdar://problem/9135379>.

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

13 years agoDon't strlen() every file before parsing it.
Eli Friedman [Tue, 10 May 2011 17:11:21 +0000 (17:11 +0000)]
Don't strlen() every file before parsing it.

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

13 years agoAdd test for PR9884.
Rafael Espindola [Tue, 10 May 2011 14:19:13 +0000 (14:19 +0000)]
Add test for PR9884.

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

13 years agoRevert 131114. This fixes PR9884.
Rafael Espindola [Tue, 10 May 2011 14:12:22 +0000 (14:12 +0000)]
Revert 131114. This fixes PR9884.

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

13 years agoFixes compilation with Visual Studio by replacing the non-standard vector::data(...
Manuel Klimek [Tue, 10 May 2011 00:58:12 +0000 (00:58 +0000)]
Fixes compilation with Visual Studio by replacing the non-standard vector::data() access.

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

13 years agoFurther implement defaulting constructors.
Sean Hunt [Tue, 10 May 2011 00:49:42 +0000 (00:49 +0000)]
Further implement defaulting constructors.

Focus is on default constructors for the time being. Currently the
exception specification and prototype are processed correctly. Codegen
might work but in all likelihood doesn't.

Note that due to an error, out-of-line defaulting of member functions is
currently impossible. It will continue to that until I muster up the
courage to admit that I secretly pray to epimetheus and that I need to
rework the way default gets from Parse -> Sema.

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

13 years agoThe last of the trivial constructor changes, make CXXSpecialMember
Sean Hunt [Tue, 10 May 2011 00:41:46 +0000 (00:41 +0000)]
The last of the trivial constructor changes, make CXXSpecialMember
reflect our new, more accurate AST.

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

13 years agoAdd a __uuidof test where the uuid attribute is on the second declaration.
Francois Pichet [Tue, 10 May 2011 00:08:32 +0000 (00:08 +0000)]
Add a __uuidof test where the uuid attribute is on the second declaration.
Also some -fdelayed-template-parsing test refactoring.

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

13 years agoIgnore const/volatile/restrict qualifiers on anonymous structs and
Douglas Gregor [Mon, 9 May 2011 23:05:33 +0000 (23:05 +0000)]
Ignore const/volatile/restrict qualifiers on anonymous structs and
unions. Fixes PR8326.

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

13 years agoAdd a FIXME.
Francois Pichet [Mon, 9 May 2011 22:32:46 +0000 (22:32 +0000)]
Add a FIXME.

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

13 years ago'long long' requires special treatment in ms_struct
Fariborz Jahanian [Mon, 9 May 2011 22:03:17 +0000 (22:03 +0000)]
'long long' requires special treatment in ms_struct
structs (impacts 32-bit only though).

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

13 years agoExtend the tag-ambiguity hack I committed in r130810 for tag
Douglas Gregor [Mon, 9 May 2011 21:46:33 +0000 (21:46 +0000)]
Extend the tag-ambiguity hack I committed in r130810 for tag
definitions to also include tag declarations. Fixes PR8151.

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

13 years agoClean up trivial default constructors now.
Sean Hunt [Mon, 9 May 2011 21:45:35 +0000 (21:45 +0000)]
Clean up trivial default constructors now.

hasTrivialDefaultConstructor() really really means it now.

Also implement a fun standards bug regarding aggregates. Doug, if you'd
like, I can un-implement that bug if you think it is truly a defect.

The bug is that non-special-member constructors are never considered
user-provided, so the following is an aggregate:

struct foo {
  foo(int);
};

It's kind of bad, but the solution isn't obvious - should

struct foo {
  foo (int) = delete;
};

be an aggregate or not?

Lastly, add a missing initialization to FunctionDecl.

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

13 years agoWhen determining whether we need to instantiate a function type,
Douglas Gregor [Mon, 9 May 2011 20:45:16 +0000 (20:45 +0000)]
When determining whether we need to instantiate a function type,
also consider whether any of the parameter types (as written, prior to
decay) are dependent. Fixes PR9880 and <rdar://problem/9408413>.

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

13 years agoRename "hasTrivialConstructor" to "hasTrivialDefaultConstructor" and
Sean Hunt [Mon, 9 May 2011 18:22:59 +0000 (18:22 +0000)]
Rename "hasTrivialConstructor" to "hasTrivialDefaultConstructor" and
modify the semantics slightly to accomodate default constructors (I
hope).

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