Aaron Ballman [Mon, 20 Jan 2014 14:18:40 +0000 (14:18 +0000)]
HasFunctionProto is a more strict version of FunctionLike. Since attribute subjects are inclusive (passing a single subject test means no subject-related diagnostic will fire), these two subjects should not be combined.
Chandler Carruth [Mon, 20 Jan 2014 09:42:24 +0000 (09:42 +0000)]
Make the Linux support for finding libc++ somewhat less braindead.
Now instead of just looking in the system root for it, we also look
relative to the clang binary's directory. This should "just work" in
almost all cases. I've added test cases accordingly.
This is probably *very* worthwhile to backport to the 3.4 branch so that
folks can check it out, build it, and use that as their host compiler
going forward.
Ted Kremenek [Mon, 20 Jan 2014 05:50:47 +0000 (05:50 +0000)]
Wire up basic parser/sema support for attribute 'returns_nonnull'.
This attribute is supported by GCC. More generally it should
probably be a type attribute, but this behavior matches 'nonnull'.
This patch does not include warning logic for checking if a null
value is returned from a function annotated with this attribute.
That will come in subsequent patches.
Alp Toker [Mon, 20 Jan 2014 00:23:47 +0000 (00:23 +0000)]
Fix nothrow trait with multiple default constructors
Check all default ctors, not just the first one we see. This brings
__has_nothrow_constructor() in line with the other unary type traits.
A C++ class can have multiple default constructors but clang was only checking
the first one written, presumably due to ambiguity in the GNU specification.
MSVC has the same bug, while g++ has the correct implementation which we now
match.
Alp Toker [Sat, 18 Jan 2014 21:49:02 +0000 (21:49 +0000)]
docs: clarify the role of compiler-builtin type trait primitives
Update the documentation to clarify the intent of clang's built-in type trait
facilities, their relation to user-facing C++ type traits and means to check
for availability.
Also explain that __has_feature() is not currently up to date and should not
generally be used in user code (there's a proposal to provide more consistent
checks via __has_builtin(), see cfe-dev).
David Blaikie [Sat, 18 Jan 2014 02:02:06 +0000 (02:02 +0000)]
Driver support for -fdebug-types-sections
Using backend-option like a few other debug codegen flags. I believe
Eric Christopher's working at porting those over to something nicer
such as an API level CodeGenOptions or the like, so this can be
improved along with that work.
Richard Smith [Fri, 17 Jan 2014 22:29:43 +0000 (22:29 +0000)]
PR12788: Remove unnecessary and incorrect special case for indirect fields.
This caused us to skip a step that was essential for correct access control.
Ismail Pazarbasi [Fri, 17 Jan 2014 21:08:52 +0000 (21:08 +0000)]
Fix string-literal to char* conversion in overload resolution for C++11
String literal to char* conversion is deprecated in C++03, and is removed in
C++11. We still accept this conversion in C++11 mode as an extension, if we find
it in the best viable function.
The checking logic in Sema is not as clean as I would like. Effectively
now we need to check both the FunctionDecl/ObjCMethodDecl and the parameters,
so the point of truth is spread in two places, but the logic isn't that
cumbersome.
Ted Kremenek [Fri, 17 Jan 2014 06:24:50 +0000 (06:24 +0000)]
Add ArrayRef<> interface to get the parameters of a FunctionDecl/ObjCMethodDecl.
This is an alternate interface to the separate iterator interfaces
provided by FunctionDecl and ObjCMethodDecl, which precede ArrayRef.
Providing this new interface is more convenient for some uses, and
likely the old interfaces should be removed. I have not undertaken
that effort in this change because this API introduction may
solicit commentary and that was a larger change than I wanted
to introduce all at once to serve a direct purpose.
Richard Smith [Fri, 17 Jan 2014 03:11:34 +0000 (03:11 +0000)]
PR18477: Create a function scope representing the constructor call when
handling C++11 default initializers. Without this, other parts of Sema (such as
lambda capture) would think the default initializer is part of the surrounding
function scope.
Richard Smith [Fri, 17 Jan 2014 02:09:33 +0000 (02:09 +0000)]
Issue a warning if a throwing operator new or operator new[] returns a null
pointer, since this invokes undefined behavior. Based on a patch by Artyom
Skrobov! Handling of dependent exception specifications and some additional
testcases by me.
Ben Langmuir [Fri, 17 Jan 2014 00:19:09 +0000 (00:19 +0000)]
Improve the error message when a PCH dependency is modified
Show the top-level pch file as the culprit, rather than the immediate
dependency when a pch file imports a pcm from a module. To clarify the
relationship, the pch import stack is printed as notes. The old behaviour was
misleading when a pch imported a pcm (from a module), since removing the pcm
would not fix the problem, whereas rebuilding the pch would.
Adrian Prantl [Fri, 17 Jan 2014 00:15:10 +0000 (00:15 +0000)]
Debug info: Refactor NoLocation and ArtificialLocation to use a common base
class and use it pervasively to restore debug locations.
Fixes an interaction between cleanup and EH that caused the location
to not be restored properly after emitting a landing pad.
rdar://problem/15208190
Richard Smith [Fri, 17 Jan 2014 00:11:48 +0000 (00:11 +0000)]
Move away from 'general' / 'generalized' as a way of identifying C++11
attribute syntax. There's nothing generalized about this; it's one of
several first-class attribute syntaxes we support, all of which are
more-or-less equally general.
As discussed on cfe-commits, we may want to revisit this if we start allowing
this syntax as an extension in C (or if C adopts the syntax), but hopefully
this diagnostic wording will be crystal clear to everyone in the mean time.
Hans Wennborg [Thu, 16 Jan 2014 23:59:08 +0000 (23:59 +0000)]
Relax the ms-intrin.cpp test
The part that checks that certain functions are marked deprecated doesn't
seem that useful, and it has the bad effect that the test hard-coded the
locations of the notes from that test.
Bob Wilson [Thu, 16 Jan 2014 21:50:37 +0000 (21:50 +0000)]
Remove an unnecessary special case to check for a few Darwin-specific options.
Using -mmacosx-version-min (etc.) on non-Darwin platforms should be a warning,
not a hard error. There is no reason to add a special check for these options
in the default toolchain. This just removes the special check and then we get
the usual -Wunused-command-line-argument warning if someone tries to use one
of these options for a target where they are not supported.
<rdar://problem/15569346>
David Majnemer [Thu, 16 Jan 2014 20:05:57 +0000 (20:05 +0000)]
MS ABI: Improve selection of an inheritance model
The MSVC ABI is rather finicky about the exact representation of it's
pointer-to-member representation. The exact position of when and where
it will go with one representation versus another appears to be when it
desires the pointer-to-member to be complete.
To properly implement this in clang, do several things:
- Give up on tracking the polymorphic nature of the class. It isn't
useful to Sema and is only pertinent when choosing CodeGen-time
details like whether the field-offset can be 0 instead of -1.
- Insist on locking-in the inheritance model when we ask our
pointer-to-member type to be complete. From there, grab the
underlying CXXRecordDecl and try to make *that* complete. Once we've
done this, we can calculate it's inheritance model and apply it using
an attribute.
N.B. My first bullet point is a lie. We will eventually care about the
specifics of whether or not a CXXRecordDecl is or is not polymorphic
because MSVC compatible mangling of such things depends on it. However,
I believe we will handle this in a rather different way.
Aaron Ballman [Thu, 16 Jan 2014 19:44:01 +0000 (19:44 +0000)]
When generating Spelling enumeration values, do not generate identifiers in the reserved namespace. Strip underscores as appropriate, taking care to not create duplicate identifiers.
Aaron Ballman [Thu, 16 Jan 2014 19:00:04 +0000 (19:00 +0000)]
Giving a spelling to the Override attribute, and commenting on the absence of a spelling for a few implicitly-only attributes. No functional change intended.
Alp Toker [Thu, 16 Jan 2014 16:29:02 +0000 (16:29 +0000)]
www: link to the planet clang newsfeed
Also shuffle the Communication section so the bug tracker comes first.
(The sidebar isn't scrollable at the moment so this gives a better chance of
the bug tracker being seen. The links further down are basically invisible --
we should look into that.)
Aaron Ballman [Thu, 16 Jan 2014 14:32:03 +0000 (14:32 +0000)]
Fixing a warning that causes the sanitizer build disliked about mixing && and ||. Since this is generated code, the && has been removed from the expression entirely.
Aaron Ballman [Thu, 16 Jan 2014 13:55:42 +0000 (13:55 +0000)]
Factored some function-like type reasoning out of SemaDeclAttr and onto Decl itself. This allows for more declarative subjects in attribute tablegen where the attribute appertains to something function-like, but not strictly a FunctionDecl.
Aaron Ballman [Thu, 16 Jan 2014 13:03:14 +0000 (13:03 +0000)]
Distinguish between attributes explicitly written at the request of the user, and attributes implicitly generated to assist in bookkeeping by the compiler. This is done so by table generating a CreateImplicit method for each attribute.
Additionally, remove the optional nature of the spelling list index when creating attributes. This is supported by table generating a Spelling enumeration when the spellings for an attribute are distinct enough to warrant it.
David Majnemer [Thu, 16 Jan 2014 12:02:55 +0000 (12:02 +0000)]
Sema: Fix crash during member pointer conversion involving incomplete classes
We would attempt to determine the inheritance relationship between
classes 'A' and 'B' during static_cast if we tried to convert from 'int
A::*' to 'int B::*'. However, the question "does A derive from B" is
not meaningful when 'A' isn't defined.
Handle this case by requiring that 'A' be defined.
Evgeniy Stepanov [Thu, 16 Jan 2014 10:19:31 +0000 (10:19 +0000)]
[asan] Remove -fsanitize-address-zero-base-shadow command line
flag from clang, and disable zero-base shadow support on all platforms
where it is not the default behavior.
- It is completely unused, as far as we know.
- It is ABI-incompatible with non-zero-base shadow, which means all
objects in a process must be built with the same setting. Failing to
do so results in a segmentation fault at runtime.
- It introduces a backward dependency of compiler-rt on user code,
which is uncommon and complicates testing.
Tim Northover [Thu, 16 Jan 2014 08:48:16 +0000 (08:48 +0000)]
MachO: use *-*-*-macho for MachO embedded targets.
Previously we had bodged together some hacks mapping MachO embedded
targets (i.e. mainly ARM v6M and v7M) to the "*-*-darwin-eabi" triple.
This is incorrect in both details (they don't run Darwin and they're
not EABI in any real sense).
This commit appropriates the existing "MachO" environment for the
purpose instead.
Alp Toker [Thu, 16 Jan 2014 02:37:08 +0000 (02:37 +0000)]
Forbid driver use in Sema tests
This ports the last Sema tests over to use the frontend directly, and adds a
local lit substitution to disable inappropriate %clang usage under this
directory.
Roman Divacky [Wed, 15 Jan 2014 19:07:16 +0000 (19:07 +0000)]
Make -fno-inline attach NoInline attribute to all functions that are not
marked as AlwaysInline or ForceInline.
This moves us to what gcc does with -fno-inline. The attribute approach
was discussed to be better than switching to InlineAlways inliner in presence
of LTO.
Jordan Rose [Wed, 15 Jan 2014 17:25:15 +0000 (17:25 +0000)]
[analyzer] BlockCall shouldn't really be an AnyFunctionCall.
Per discussion with Anna a /long/ time ago, it was way too easy to misuse
BlockCall: because it inherited from AnyFunctionCall (through SimpleCall),
getDecl() was constrained to return a FunctionDecl, and you had to call
getBlockDecl() instead. This goes against the whole point of CallEvent
(to abstract over different ways to invoke bodies of code).
Now, BlockCall just inherits directly from CallEvent. There's a bit of
duplication in getting things out of the origin expression (which is still
known to be a CallExpr), but nothing significant.