Commit Graph

22503 Commits

Author SHA1 Message Date
Douglas Gregor 7372248a98 When checking a call to a builtin atomic operation, be sure to
consider the _<width> variants as well, which we'll see if we're
performing the type checking in a template instantiation where the
call expression itself was originally not type-dependent. Fixes
PR11411.

llvm-svn: 145248
2011-11-28 16:30:08 +00:00
Nicola Gigante 13b6a2ae04 Removed useless ImplicitCast nodes in explicit cstyle and static casts
llvm-svn: 145244
2011-11-28 12:21:57 +00:00
Argyrios Kyrtzidis b11f5a4cbb [libclang] Indexing API: If the client requested to get a CXTranslationUnit after
indexing, honor all the TU options.

llvm-svn: 145229
2011-11-28 04:56:00 +00:00
Argyrios Kyrtzidis 67aa7db0a4 [libclang] Indexing API: Capture diagnostics during indexing.
llvm-svn: 145228
2011-11-28 04:55:55 +00:00
Peter Collingbourne eec0a2aa87 Another silly workaround for MSVC.
llvm-svn: 145227
2011-11-28 04:29:10 +00:00
Argyrios Kyrtzidis eca1f36a54 [arcmt] Integrate GC __weak into property attributes even when we don't have
the implementation.

llvm-svn: 145224
2011-11-28 02:04:36 +00:00
Peter Collingbourne fc38dfe499 Sigh, another workaround for MSVC.
llvm-svn: 145211
2011-11-28 00:41:08 +00:00
Argyrios Kyrtzidis 3fc3dcd80f [arcmt] Don't add __weak if there is already a GC __weak and make sure to clear
__weak from a readonly property.

llvm-svn: 145210
2011-11-28 00:23:12 +00:00
Peter Collingbourne 1424b308c3 Work around a gcc4.2 bug.
llvm-svn: 145209
2011-11-28 00:18:21 +00:00
Peter Collingbourne fbef4c8657 In Sema::MaybeBindToTemporary, create a CXXBindTemporaryExpr for an
array of objects with non-trivial destructors.  PR11365.

llvm-svn: 145203
2011-11-27 22:09:28 +00:00
Peter Collingbourne 702b2841a4 When destroying temporaries, instead of a custom cleanup use the
generic pushDestroy function.

This would reduce the number of useful declarations in
CGTemporaries.cpp to one.  Since CodeGenFunction::EmitCXXTemporary
does not deserve its own file, move it to CGCleanup.cpp and delete
CGTemporaries.cpp.

llvm-svn: 145202
2011-11-27 22:09:22 +00:00
Rafael Espindola a6416a7c73 Make our handling of MMX x SSE closer to what gcc does:
* Enabling sse enables mmx.
* Disabling (-mno-mmx) mmx, doesn't disable sse (we got this right already).
* The order in not important. -msse -mno-mmx is the same as -mno-mmx -msse.

llvm-svn: 145194
2011-11-27 20:00:43 +00:00
Rafael Espindola 32d8a275b9 Add inreg attributes to reference arguments.
llvm-svn: 145189
2011-11-27 18:35:39 +00:00
Sebastian Redl 29526f09ce Reference initialization with initializer lists.
This supports single-element initializer lists for references according to DR1288, as well as creating temporaries and binding to them for other initializer lists.

llvm-svn: 145186
2011-11-27 16:50:07 +00:00
Rafael Espindola 0618d14edf Error on non x86 architectures.
llvm-svn: 145185
2011-11-27 15:21:33 +00:00
Rafael Espindola fd03d0b733 Fix file name in comments.
llvm-svn: 145184
2011-11-27 15:13:54 +00:00
Rafael Espindola d086573a4d Add the minimum implementation of cpuid.h. This works on "modern" intel cpus
and on clang, which seams to handled "=b" correctly even when ebx is the
PIC register.

llvm-svn: 145149
2011-11-26 20:53:19 +00:00
Nicola Gigante c8edb0f657 Test commit
llvm-svn: 145147
2011-11-26 16:20:01 +00:00
Abramo Bagnara edf99fff49 Fixed lexical declaration context when instantiating a friend / out-of-line class template member.
llvm-svn: 145146
2011-11-26 13:33:46 +00:00
Rafael Espindola 04268df8ed Set __OPTIMIZE_SIZE__ on -Os and -Oz. This matches gcc's behaviour on both OS X
and linux.

llvm-svn: 145142
2011-11-26 06:21:20 +00:00
Francois Pichet de232cb166 In Microsoft mode, make "Unqualified lookup into dependent bases of class templates" works inside a friend function definition at class scope.
Basically we have to look into the parent *lexical* DeclContext for friend functions at class scope. That's because calling GetParent() return the namespace or file DeclContext.

This fixes all remaining cases of "Unqualified lookup into dependent bases of class templates" when parsing MFC code with clang.

llvm-svn: 145127
2011-11-25 01:10:54 +00:00
Richard Trieu caff247882 Add feature to diagnostics that will provide more information on function
pointer mismatch.  Cases covered are: initialization, assignment, and function
arguments.  Additional text will give the extra information about the nature
of the mismatch: different classes for member functions, wrong number of
parameters, different parameter type, different return type, and function
qualifier mismatch.

llvm-svn: 145114
2011-11-23 22:32:32 +00:00
Argyrios Kyrtzidis a72450057b [PCH] Check for isTopLevelDeclInObjCContainer when picking abbreviations.
llvm-svn: 145110
2011-11-23 21:11:23 +00:00
Argyrios Kyrtzidis 8ad3bab505 [libclang] Fix operations (token annotation, getting cursor, etc.) with a file region
inside an objc container that "contains" other file-level declarations.

When getting the array of file-level declarations that overlap with a file region,
we failed to report that the region overlaps with an objc container, if
the container had other file-level declarations declared lexically inside it.

Fix this by marking such declarations as "isTopLevelDeclInObjCContainer" in the AST
and handling them appropriately.

llvm-svn: 145109
2011-11-23 20:27:36 +00:00
Argyrios Kyrtzidis e4d082827d Remove an assertion that is not valid if we cancel parsing.
llvm-svn: 145108
2011-11-23 20:27:29 +00:00
Argyrios Kyrtzidis 41fc05cad8 [libclang] Indexing API: Fix issues, mostly C++ related.
llvm-svn: 145107
2011-11-23 20:27:26 +00:00
James Molloy c445be4b4b AAPCS compliance - 32-bit wchar_t should be unsigned for both aapcs and aapcs-linux.
Original behaviour of defining wchar_t as signed int has been kept for apcs-gnu as I don't have any spec for this to validate against.

llvm-svn: 145102
2011-11-23 13:35:08 +00:00
Richard Smith 2d988f0f05 Use static storage duration for file-scope compound literals, even when they
appear in non-constant initializers in C++.

llvm-svn: 145087
2011-11-22 22:48:32 +00:00
Benjamin Kramer 900f1defdd Remove assert from hot code path and add a clarifying comment.
The assert wasn't adding much value but slowed down Release+Asserts builds.

llvm-svn: 145082
2011-11-22 20:39:31 +00:00
Matt Beaumont-Gay 31fcb9f291 Provide better source info for template specializations with non-type arguments.
This fixes a crasher in tools like Include-What-You-Use which examine such
arguments. Patch from Dean Sturtevant at Google!

llvm-svn: 145077
2011-11-22 20:00:10 +00:00
Benjamin Kramer 3885737a1b Lexer: Don't throw away the hard work SSE did to find a slash.
We can reuse the information and avoid looping over all the bytes again.

llvm-svn: 145070
2011-11-22 18:56:46 +00:00
Kostya Serebryany c3333e879f implement __has_feature(address_sanitizer); also use LangOpts.AddressSanitizer instead of CodeGenOpts.AddressSanitizer
llvm-svn: 145054
2011-11-22 01:28:36 +00:00
Richard Smith 9a56882e53 Add driver arguments -ftemplate-depth=N and -fconstexpr-depth=N, with the same
semantics and defaults as the corresponding g++ arguments. The historical g++
argument -ftemplate-depth-N is kept for compatibility, but modern g++ versions
no longer document that option.

Add -cc1 argument -fconstexpr-depth N to implement the corresponding
functionality.

The -ftemplate-depth=N part of this fixes PR9890.

llvm-svn: 145045
2011-11-21 19:36:32 +00:00
Roman Divacky d150ad3f07 Change the linker emulation name for FreeBSD/PPC32.
Submitted by Andreas Tobler!

llvm-svn: 145041
2011-11-21 16:50:32 +00:00
Benjamin Kramer 5642e19065 CodeGen: Simplify code.
llvm-svn: 145040
2011-11-21 15:47:23 +00:00
Peter Collingbourne 0e7e3fc130 Delete the depfile if we could not open a header file. We cannot
generate any reasonable depfile if a header is missing.

llvm-svn: 145019
2011-11-21 00:01:14 +00:00
Peter Collingbourne 119cfaa595 Teach the driver about failure result files, which are compilation
output files that are valid regardless of whether the compilation
succeeded or failed (but not if we crash).  Add depfiles to the
failure result file list.

llvm-svn: 145018
2011-11-21 00:01:05 +00:00
Benjamin Kramer ddbb2b85ab CodeGen: allow __asm renaming on static local variables.
Fixes PR4777.

llvm-svn: 145015
2011-11-20 21:05:04 +00:00
Douglas Gregor 8ad31c2e36 Allow preprocessor callbacks to recover from a "file not found" error,
from Jason Haslam!

llvm-svn: 145012
2011-11-20 17:46:46 +00:00
Douglas Gregor 49ccfaa938 Add support for pretty-printing attributes, from Richard Membarth!
llvm-svn: 145002
2011-11-19 19:22:57 +00:00
Abramo Bagnara 5001caa1b6 Fixed HadMultipleCandidates loading.
llvm-svn: 144995
2011-11-19 11:44:21 +00:00
Benjamin Kramer 7824360017 Driver: Remove the signal number from the "command failed" diagnostic.
- With the current implementation of sys::Program this always printed "2".
- The command execution code will output the right number anyway (including the signal name).

llvm-svn: 144993
2011-11-19 10:24:49 +00:00
Francois Pichet 6dc4c16417 Enable delayed template parsing for friend functions declared at template class scope.
llvm-svn: 144980
2011-11-18 23:47:17 +00:00
Abramo Bagnara 12dcbf3eaa Fixed implicit instantiations source range.
llvm-svn: 144977
2011-11-18 08:08:52 +00:00
Ted Kremenek 2acedbd417 Refine placement of LangOptions object in CompilerInvocation by adding a new baseclass CompilerInvocationBase with a custom copy constructor. This ensures that whenever the CompilerInvocation object's copy constructor is used we always clone the LangOptions object.
llvm-svn: 144973
2011-11-18 04:32:13 +00:00
Eli Friedman f22fa9eaef Finish r144971, which was an incomplete commit.
llvm-svn: 144972
2011-11-18 04:01:36 +00:00
Eli Friedman 0b3f201b61 Fix the meaning of an "empty" record for the case of a zero-length array. Use isEmptyRecord for arguments on x86-32; there are structs of size 0 which don't count as empty.
llvm-svn: 144971
2011-11-18 03:47:20 +00:00
Eli Friedman a1748564b4 Make va_arg on x86-64 compute alignment the same way as argument passing.
Fixes <rdar://problem/10463281>.

llvm-svn: 144966
2011-11-18 02:44:19 +00:00
Anna Zaks 457c68726c [analyzer] Warn when non pointer arguments are passed to scanf (only when running taint checker).
There is an open radar to implement better scanf checking as a Sema warning. However, a bit of redundancy is fine in this case.

llvm-svn: 144964
2011-11-18 02:26:36 +00:00
Eli Friedman 1d7dd3b682 A bunch of fixes to argument passing and va_arg on Darwin x86-32 for structures containing an SSE vector.
llvm-svn: 144963
2011-11-18 02:12:09 +00:00