Hans Wennborg [Mon, 5 Aug 2013 20:14:43 +0000 (20:14 +0000)]
lit.cfg: better check for MSYS
When running the tests under Cygwin using non-Cygwin python,
the platform would be Windows and there would be bash on the path,
so this check for MSYS would not work correctly.
Richard Smith [Mon, 5 Aug 2013 18:49:43 +0000 (18:49 +0000)]
Implement C++'s restrictions on the type of an expression passed to a vararg
function: it can't be 'void' and it can't be an initializer list. We give a
hard error for these rather than treating them as undefined behavior (we can
and probably should do the same for non-POD types in C++11, but as of this
change we don't).
Slightly rework the checking of variadic arguments in a function with a format
attribute to ensure that certain kinds of format string problem (non-literal
string, too many/too few arguments, ...) don't suppress this error.
Craig Topper [Mon, 5 Aug 2013 06:17:21 +0000 (06:17 +0000)]
Use a shuffle with undef elements instead of inserting 0s in the 128-bit to 256-bit casting intrinsics to improve performance. Thanks to Katya Romanova for identifying this issue.
David Majnemer [Mon, 5 Aug 2013 04:53:41 +0000 (04:53 +0000)]
Sema: Don't assume a nested name specifier holds a type
Sema::PerformObjectMemberConversion assumed that the Qualifier it was
given holds a type. However, the specifier could hold just a namespace.
In this case, we should ignore the qualifier and not attempt to cast to
it.
Hans Wennborg [Fri, 2 Aug 2013 22:24:50 +0000 (22:24 +0000)]
Re-commit r187637: "clang-cl: add more options"
> This adds a bunch of options to clang-cl. Notably, this includes
> all the options that get passed when doing a default build of a
> command-line project with msbuild.exe in Debug and Release modes,
> and I believe all flags from Reid's original patch.
The original commit was reverted in r187640 after it broke the Mac build.
This should now be fixed, by Clang r187668, LLVM r187675, and putting
a -- before %s in the test.
Manuel Klimek [Fri, 2 Aug 2013 21:24:09 +0000 (21:24 +0000)]
Fix crash when encountering alias templates in isDerivedFrom matches.
- pull out function to drill to the CXXRecordDecl from the type,
to allow recursive resolution
- make the analysis more robust by rather skipping values we don't
understand
Richard Smith [Fri, 2 Aug 2013 01:09:12 +0000 (01:09 +0000)]
When merging redeclaration chains across modules, if a declaration is visible
in one module but is only declared as a friend in another module, keep it
visible in the result of the merge.
This is incomplete on two axes:
1) Our handling of local extern declarations is basically broken (we put them
in the wrong decl context, and don't find them in redeclaration lookup, unless
they've previously been declared), and this results in them making friends
visible after a merge.
2) Eventually we'll need to mark that this has happened, and more carefully
check whether a declaration should be visible if it was only visible in some
of the modules in which it was declared. Fortunately it's rare for the
identifier namespace of a declaration to change along its redeclaration chain.
Hans Wennborg [Fri, 2 Aug 2013 00:30:15 +0000 (00:30 +0000)]
clang-cl: add more options
This adds a bunch of options to clang-cl. Notably, this includes
all the options that get passed when doing a default build of a
command-line project with msbuild.exe in Debug and Release modes,
and I believe all flags from Reid's original patch.
Jordan Rose [Thu, 1 Aug 2013 22:16:36 +0000 (22:16 +0000)]
[analyzer] Don't process autorelease counts in synthesized function bodies.
We process autorelease counts when we exit functions, but if there's an
issue in a synthesized body the report will get dropped. Just skip the
processing for now and let it get handled when the caller gets around to
processing autoreleases.
(This is still suboptimal: objects autoreleased in the caller context
should never be warned about when exiting a callee context, synthesized
or not.)
Jordan Rose [Thu, 1 Aug 2013 22:16:30 +0000 (22:16 +0000)]
[analyzer] Silently drop all reports within synthesized bodies.
Much of our diagnostic machinery is set up to assume that the report
end path location is valid. Moreover, the user may be quite confused
when something goes wrong in our BodyFarm-synthesized function bodies,
which may be simplified or modified from the real implementations.
Rather than try to make this all work somehow, just drop the report so
that we don't try to go on with an invalid source location.
Note that we still handle reports whose /paths/ go through invalid
locations, just not those that are reported in one.
We do have to be careful not to lose warnings because of this.
The impetus for this change was an autorelease being processed within
the synthesized body, and there may be other possible issues that are
worth reporting in some way. We'll take these as they come, however.
This unifies the unix and windows versions of FileManager::UniqueDirContainer
and FileManager::UniqueFileContainer by using UniqueID.
We cannot just replace "struct stat" with llvm::sys::fs::file_status, since we
want to be able to construct fake ones, and file_status has different members
on unix and windows.
What the patch does is:
* Record only the information that clang is actually using.
* Use llvm::sys::fs::status instead of stat and fstat.
* Use llvm::sys::fs::UniqueID
* Delete the old windows versions of UniqueDirContainer and
UniqueFileContainer since the "unix" one now works on windows too.
David Blaikie [Thu, 1 Aug 2013 20:57:40 +0000 (20:57 +0000)]
DebugInfo: Don't prefer declarations over definitions in -flimit-debug-info in C
Without an ODR, the -flimit-debug-info debug info size optimization of
emitting declarations for fully defined types when only a declaration is
needed by the TU, is incorrect. Emit the full definition whenever it's
available in non-C++.
David Blaikie [Thu, 1 Aug 2013 20:31:40 +0000 (20:31 +0000)]
DebugInfo: Emit template arguments for limited types used for context.
We emit definitions with no members when a nested type is
referenced/required (GCC does the same, to be fair) but failed to attach
the template arguments in such a case.
Tim Northover [Thu, 1 Aug 2013 09:23:19 +0000 (09:23 +0000)]
AArch64: initial NEON support
Patch by Ana Pazos
- Completed implementation of instruction formats:
AdvSIMD three same
AdvSIMD modified immediate
AdvSIMD scalar pairwise
- Completed implementation of instruction classes
(some of the instructions in these classes
belong to yet unfinished instruction formats):
Vector Arithmetic
Vector Immediate
Vector Pairwise Arithmetic
- Initial implementation of instruction formats:
AdvSIMD scalar two-reg misc
AdvSIMD scalar three same
- Intial implementation of instruction class:
Scalar Arithmetic
- Initial clang changes to support arm v8 intrinsics.
Note: no clang changes for scalar intrinsics function name mangling yet.
- Comprehensive test cases for added instructions
To verify auto codegen, encoding, decoding, diagnosis, intrinsics.
Craig Topper [Thu, 1 Aug 2013 06:42:40 +0000 (06:42 +0000)]
Fix to handle all non-power-of-2 vector sizes in the mask form of _builtin_shuffle_vector.
Previously a 2-bit mask was used to mask each element of a vec6 mask before doing the extracts instead of 3-bit mask necessary to cover 0-5. vec3 was the only non-power-of-2 that worked correctly because a +1 conditionally added before calculating floor(log2(elements)).
David Majnemer [Thu, 1 Aug 2013 06:13:59 +0000 (06:13 +0000)]
Sema: Diagnose explicitly bound unresolved member expressions decaying into pointers to function type
We would disallow the case where the overloaded member expression is
coming from an address-of operator but we wouldn't issue any diagnostics
when the overloaded member expression comes by way of a function to
pointer decay cast.
Clang's implementation of DR61 is now seemingly complete.
Daniel Jasper [Wed, 31 Jul 2013 23:16:02 +0000 (23:16 +0000)]
clang-format: Add more options to namespace indentation.
With this patch, clang-format can be configured to:
* not indent in namespace at all (former behavior).
* indent in namespace as in other blocks.
* indent only in inner namespaces (as required by WebKit style).
Also fix alignment of access specifiers in WebKit style.
ObjectiveC ARC: Do not issue bridge cast diagnostic when
passing a retainable object arg to a CF audited function
expecting a CF object type. Issue a normal type mismatch
diagnostic. This is wip // rdar://14569171
Hans Wennborg [Wed, 31 Jul 2013 20:51:53 +0000 (20:51 +0000)]
clang-cl: add the /c, /W0 and /W1 options
This adds a few more clang-cl options. It also exposes two core clang
options to the clang-cl mode: we need to be able to claim --driver_mode
so it doesn't show up as unused in cl mode, and we need -### for tests.
ObjectiveC arc: Introduce a new initialization kind
for parameters passed to CF audited functions
to be used for better diagnostics. Current set but
unused. // rdar://14569171
ObjectiveC arc: Move check for type conversions in arc
out of ImpCastExprToType and to the caller site
as appropriate. This is in prep. to do more work for
// rdar://14569171
With help from chapuni on IRC, I think this is right now. =] The issue
is that the command is quoted differently from the arguments. The
command has '\' and the argument has '\\'. This is made unclear because
FileCheck escapes the single matched '\' when it prints the contents of
the variable, thus fooling me into thinking it had matched '\\' as
intended. The solution is to bind the gcc_install variable in the
argument list rather than out of the command. To do so we also have to
be a bit more careful so that we don't get stray other things into the
'.*' regex.
Also, because of the argument difference, '\\\\' is the correct
formulation before crtbegin, go back to that.
Run an experiment to try to understand the windows failure better by
replacing one variable with the regex. This won't fix anything, but will
hopefully shed light on the nature of the failure.
Find a better compromise with the default library search paths used by
Clang when linking and using a GCC installation from a GCC
cross-compiler.
This was desired already by two special case platforms (Android and
Mips), and turns out to be generally (if frustratingly) true. I've added
a substantial comment to the code clarifying the underlying assumptions
of doing actual cross compiles with Clang (or GCC for that matter!) and
help avoid further confusion here.
The end result is to realize that fully general form of PR12478 cannot
be resolved while we support existing cross-compiling GCC toolchains,
and linking with them (namely, linking against their libgcc and
libstdc++ installs). GCC installs these target libraries under
a target-specific prefix but one that may not be available within the
actual sysroot in use. When linking in this world, GCC works and Clang
should as well, but caveat emptor: DSOs from this tree must be
replicated and rpath-fixed to be found at runtime within the sysroot.
I've extended the cross compile test cases to cover these issues by
pointing them at a sysroot and actually checking the library search
paths.
Start keeping track of what work was done to detect a GCC installation
on the system, and report it when running the driver in verbose mode.
Without this it is essentially impossible to understand why a particular
GCC toolchain is used by Clang for libstdc++, libgcc, etc.
This also required threading a hook through the toolchain layers for
a specific toolchain implementation to print custom information under
'clang -v'. The naming here isn't spectacular. Suggestions welcome.
Added the notion of Type and TargetSpecific attributes to the clang tablegen. In turn, this fixes a mistake with Ptr32, Ptr64, UPtr and SPtr attribtues generating AST nodes that are never actually used.
Richard Smith [Mon, 29 Jul 2013 20:14:16 +0000 (20:14 +0000)]
PR16715: Fix assert in verifier: only mark call to 'operator new' as 'builtin' if
corresponding 'operator new' was actually emitted as a function marked 'nobuiltin'.