Commit Graph

30128 Commits

Author SHA1 Message Date
Fariborz Jahanian 783243b3ca Implenment #pack pragma and ms_struct attribute layout.
Concludes // radar://8823265.

llvm-svn: 131188
2011-05-11 16:58:31 +00:00
Oscar Fuentes cfc9efa43e Handle gcc-compatible compilers (such as clang) the same way we handle
gcc.

Fixes PR9886.

llvm-svn: 131182
2011-05-11 13:53:30 +00:00
John McCall c67067f43e 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.

llvm-svn: 131178
2011-05-11 07:19:11 +00:00
Eli Friedman c6587cc550 PR9882: Fix noexcept to deal with dependent new, delete, calls, and
dynamic_cast correctly.

llvm-svn: 131177
2011-05-11 05:22:44 +00:00
Francois Pichet 3abc9b8b79 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 { }
}

llvm-svn: 131175
2011-05-11 02:14:46 +00:00
John McCall dfbf9341ad Use a heralded conversion to bool in inline-asm constraints.
llvm-svn: 131170
2011-05-10 23:39:47 +00:00
Ted Kremenek efdb7fe53b Fix crash in -Wuninitialized when using switch statments whose condition is a logical operation.
llvm-svn: 131158
2011-05-10 22:10:35 +00:00
Douglas Gregor 932aac6492 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>.

llvm-svn: 131153
2011-05-10 21:23:31 +00:00
Matt Beaumont-Gay 5bd77b3b0f 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.

llvm-svn: 131147
2011-05-10 20:28:29 +00:00
Alexis Hunt 80f00ff95d 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.

llvm-svn: 131143
2011-05-10 19:08:14 +00:00
Fariborz Jahanian 07ceb0a1a4 Support pack pragma and ms_struct attributes. // rdar://8823265
llvm-svn: 131142
2011-05-10 19:00:50 +00:00
Ted Kremenek 6878c36328 Elide __label__ declarations from the CFG. This resolves a crash in CFGRecStmtDeclVisitor (crash in static analyzer).
llvm-svn: 131141
2011-05-10 18:42:15 +00:00
Douglas Gregor 972fe534ed 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>.

llvm-svn: 131138
2011-05-10 18:27:06 +00:00
Eli Friedman 86a5101c27 Don't strlen() every file before parsing it.
llvm-svn: 131132
2011-05-10 17:11:21 +00:00
Rafael Espindola d9ddbb0807 Add test for PR9884.
llvm-svn: 131127
2011-05-10 14:19:13 +00:00
Rafael Espindola 5fe6d35770 Revert 131114. This fixes PR9884.
llvm-svn: 131126
2011-05-10 14:12:22 +00:00
Manuel Klimek ffecc6b9c2 Fixes compilation with Visual Studio by replacing the non-standard vector::data() access.
llvm-svn: 131116
2011-05-10 00:58:12 +00:00
Alexis Hunt 6d5b96c6b3 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.

llvm-svn: 131115
2011-05-10 00:49:42 +00:00
Alexis Hunt be3f9ecd18 The last of the trivial constructor changes, make CXXSpecialMember
reflect our new, more accurate AST.

llvm-svn: 131114
2011-05-10 00:41:46 +00:00
Francois Pichet 2f019ed2e6 Add a __uuidof test where the uuid attribute is on the second declaration.
Also some -fdelayed-template-parsing test refactoring.

llvm-svn: 131113
2011-05-10 00:08:32 +00:00
Douglas Gregor 0f8bc97abd Ignore const/volatile/restrict qualifiers on anonymous structs and
unions. Fixes PR8326.

llvm-svn: 131109
2011-05-09 23:05:33 +00:00
Francois Pichet 16c9491f48 Add a FIXME.
llvm-svn: 131108
2011-05-09 22:32:46 +00:00
Fariborz Jahanian 7adbed6b4d 'long long' requires special treatment in ms_struct
structs (impacts 32-bit only though).

llvm-svn: 131103
2011-05-09 22:03:17 +00:00
Douglas Gregor 5d1d9e381e Extend the tag-ambiguity hack I committed in r130810 for tag
definitions to also include tag declarations. Fixes PR8151.

llvm-svn: 131102
2011-05-09 21:46:33 +00:00
Alexis Hunt 88c75c311f 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.

llvm-svn: 131101
2011-05-09 21:45:35 +00:00
Douglas Gregor a7203e537d 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>.

llvm-svn: 131099
2011-05-09 20:45:16 +00:00
Alexis Hunt f479f1b7e4 Rename "hasTrivialConstructor" to "hasTrivialDefaultConstructor" and
modify the semantics slightly to accomodate default constructors (I
hope).

llvm-svn: 131087
2011-05-09 18:22:59 +00:00
Daniel Dunbar eb86b04595 Driver/Darwin: Put dsymutil -o arguments first, so that dysmutil doesn't barf
when POSIXLY_COMPLIANT is set.
 - Patch by Dave Vasilevsky!

llvm-svn: 131084
2011-05-09 17:23:16 +00:00
John McCall e155a3d8aa __builtin_va_list is void* on ARM, not char*.
rdar://problem/9391966

llvm-svn: 131080
2011-05-09 02:19:37 +00:00
Francois Pichet a7c8da40a8 Fix test.
llvm-svn: 131077
2011-05-08 23:15:10 +00:00
Francois Pichet bc6ebb5b76 Allow implicit conversion from function pointer to void* in Microsoft mode.
Necessary to parse MFC code.

llvm-svn: 131076
2011-05-08 22:52:41 +00:00
Anders Carlsson c36783e8b9 Move code to emit the callee of an CXXOperatorCallExpr out into a separate function in CGClass.cpp
llvm-svn: 131075
2011-05-08 20:32:23 +00:00
Alexis Hunt d8ee4beff4 Restore an accidentally-deleted word.
llvm-svn: 131074
2011-05-08 20:15:27 +00:00
Anders Carlsson cc53197903 Don't emit complete constructors for abstract classes. Also, don't emit
complete destructors for abstract classes unless the destructor is virtual
and thus needs to be in the vtable.

llvm-svn: 131068
2011-05-08 17:25:05 +00:00
Francois Pichet 59d2b017d7 Look at all the record redeclaration when looking for a uuid attribute.
llvm-svn: 131066
2011-05-08 10:02:20 +00:00
Douglas Gregor f30053d18d Relax the conversion rules for Objective-C GC qualifiers a
bit by allowing __weak and __strong to be added/dropped as part of
implicit conversions (qualification conversions in C++). A little
history: GCC lets one add/remove/change GC qualifiers just about
anywhere, implicitly. Clang did roughly the same before, but we
recently normalized the semantics of qualifiers across the board to
get a semantics that we could reason about (yay). Unfortunately, this
tightened the screws a bit too much for GC qualifiers, where it's
common to add/remove these qualifiers at will.

Overall, we're still in better shape than we were before: we don't
permit directly changing the GC qualifier (e.g., __weak -> __strong),
so type safety is improved. More importantly, we're internally
consistent in our handling of qualifiers, and the logic that allows
adding/removing GC qualifiers (but not adding/removing address
spaces!) only touches two obvious places.

Fixes <rdar://problem/9402499>.

llvm-svn: 131065
2011-05-08 06:09:53 +00:00
Douglas Gregor 2d1c055eba In C++, allow us to emit a global as 'constant' even if it has class
type, so long as it is known to have a constant initializer and the
class type is a POD class. Fixes <rdar://problem/9306265>.

llvm-svn: 131060
2011-05-07 22:06:45 +00:00
Douglas Gregor 9ca5465500 Revert r130717, which caused a regression (<rdar://problem/9402621>).
llvm-svn: 131057
2011-05-07 20:12:26 +00:00
Francois Pichet dcf88932a2 Don't fail at parsing __declspec(property(get=get_func_name)). Just skip everything inside property() for now while we wait for the BoostPro people to provide a complete patch.
llvm-svn: 131053
2011-05-07 19:04:49 +00:00
Eli Friedman 8ba29d8e7f PR9866: Fix the implementation of _mm_loadl_pd and _mm_loadh_pd to not make
bad assumptions about the alignment of the double* argument.

llvm-svn: 131052
2011-05-07 18:59:31 +00:00
Francois Pichet 61d818c058 Temporary preprocessor hack to get around the Microsoft __identifier(x) extension.
http://msdn.microsoft.com/en-us/library/hzc8ytsz(v=VS.100).aspx

Microsoft doc claims this is a C++/CLI feature but it is really always enabled.
This removes 2 error when parsing MFC code with clang.

llvm-svn: 131051
2011-05-07 17:47:38 +00:00
Francois Pichet a5b3fcbc02 Add support for _if_exists and __if_not_exists at namespace/global scope.
llvm-svn: 131050
2011-05-07 17:30:27 +00:00
Richard Trieu de756fbbd7 Patch for PR 7409 - only error on definition of invalid typedefs. Suppress errors for additional uses of this invalid typedef.
llvm-svn: 131043
2011-05-07 01:36:37 +00:00
Douglas Gregor 0de016dbb7 Implement a minor optimization by not introducing declarations into
DeclContext's lookup table when they aren't in any identifier namespace.

llvm-svn: 131037
2011-05-06 23:32:38 +00:00
Douglas Gregor b578fbe0f2 When checking for a prior declaration of the name of a namespace, skip
any names that aren't in the appropriate identifier namespaces. Fixes
an embarrassing bug where we give a redefinition error due to an
Objective-C category (<rdar://problem/9388207>).

llvm-svn: 131036
2011-05-06 23:28:47 +00:00
Fariborz Jahanian 307eace474 In ms_struct structs, Establish a new alignment for a
non-bitfield following a bitfield if size of their types differ.

llvm-svn: 131032
2011-05-06 22:42:22 +00:00
Fariborz Jahanian b7a2879677 Establish a new alignment for an ms_struct bitfield following
a non-bitfield if size of their types differ.

llvm-svn: 131023
2011-05-06 21:56:12 +00:00
Douglas Gregor a3b202643f Keep track of the file ID corresponding to the original file used to
build a precompiled header. Use this information to eliminate the call
to SourceManager::getLocation() while loading a precompiled preamble,
since SourceManager::getLocation() itself causes unwanted
deserialization.

Fixed <rdar://problem/9399352>.

llvm-svn: 131021
2011-05-06 21:43:30 +00:00
Cameron Esfahani bceca20ab9 Fix false positive warning about uninitialized variable.
llvm-svn: 131019
2011-05-06 21:28:42 +00:00
Alexis Hunt 83dc3e89c3 Per Richard's suggestion, rename DefLoc to DefaultLoc where it appears.
llvm-svn: 131018
2011-05-06 21:24:28 +00:00