Artyom Skrobov [Thu, 14 Aug 2014 16:04:47 +0000 (16:04 +0000)]
Use the proper post-order traversal in LiveVariables analysis,
to recover the performance after r214064.
Also sorts out the naming for PostOrderCFGView, ReversePostOrderCFGView,
BackwardDataflowWorklist and ForwardDataflowWorklist, to match the accepted
terminology.
Also unifies BackwardDataflowWorklist and ForwardDataflowWorklist to share
the "worklist for prioritization, post-order traversal for fallback" logic,
and to avoid repetitive sorting.
Justin Bogner [Thu, 14 Aug 2014 15:44:29 +0000 (15:44 +0000)]
Revert "CodeGen: When bitfields fall on natural boundaries, split them up"
It fits better with LLVM's memory model to try to do this in the
backend. Specifically, narrowing wide loads in the backends should be
relatively straightforward and is generally valuable, whereas widening
loads tends to be very constrained.
David Majnemer [Thu, 14 Aug 2014 06:35:08 +0000 (06:35 +0000)]
Parse: Don't attempt to act on #pragma init_seg when not targeting MSVC
It doesn't really make sense to try and do stuff with #pragma init_seg
when targeting non-Microsoft platforms; notions like library vs user
initializers don't exist for other targets.
Richard Smith [Thu, 14 Aug 2014 04:11:33 +0000 (04:11 +0000)]
[modules] Factor .td-generated diagnostics stuff out into its own module; this
avoids users of AllDiagnostics.h from needing to pregenerate *all* generated
headers. Hopefully this will make my modules buildbot happier...
Richard Smith [Thu, 14 Aug 2014 03:30:27 +0000 (03:30 +0000)]
[modules] Don't assert if the same imported class template specialization
declaration has its definition instantiated in two sibling modules and they use
a partial specialization.
Justin Bogner [Thu, 14 Aug 2014 02:42:10 +0000 (02:42 +0000)]
CodeGen: When bitfields fall on natural boundaries, split them up
Currently when laying out bitfields that don't need any padding, we
represent them as a wide enough int to contain all of the bits. This
can be hard on the backend since we'll do things like represent stores
to a few bits as loading an i144, masking it with a large constant,
and storing it back.
This turns up in less pathological cases where we load and mask 64 bit
word on a 32 bit platform when we actually only need to access 32 bits.
This leads to bad code being generated in most of our 32 bit backends.
In practice, there are often natural breaks in bitfields, and it's a
fairly simple and effective heuristic to split these fields into legal
integer sized chunks when it will be equivalent (ie, it won't force us
to add any extra padding).
Richard Smith [Thu, 14 Aug 2014 02:21:01 +0000 (02:21 +0000)]
[modules] When we merge together multiple class template specialization
definitions (because some other declaration declares a special member that
isn't present in the canonical definition), we need to search *all* of them; we
can't just stop when we find the requested name in any of the definitions,
because that can fail to find things (and in particular, it can fail to find
the member of the canonical declaration and return a bogus ODR failure).
Richard Smith [Wed, 13 Aug 2014 21:15:09 +0000 (21:15 +0000)]
[modules] Fix a rejects-valid resulting from emitting an inline function
recursively within the emission of another inline function. This ultimately
led to us emitting the same inline function definition twice, which we then
rejected because we believed we had a mangled name conflict.
Objective-C. This patch is to resolve the method used in method
expression to the best method found in global method pools.
This is wip. // rdar://16808765
Manuel Klimek [Wed, 13 Aug 2014 15:25:55 +0000 (15:25 +0000)]
Work around missing handling of temporaries bound to default arguments.
Yet more problems due to the missing CXXBindTemporaryExpr in the CFG for
default arguments.
Unfortunately we cannot just switch off inserting temporaries for the
corresponding default arguments, as that breaks existing tests
(test/SemaCXX/return-noreturn.cpp:245).
Simon Atanasyan [Wed, 13 Aug 2014 14:34:14 +0000 (14:34 +0000)]
[Driver] Support -muclibc / -mglibc command line options for a couple
of MIPS toolchains.
The uCLibc implemented for multiple architectures. A couple of MIPS toolchains
contains both uCLibc and glibc implementation so these options allow to select
used C library.
Initially -muclibc / -mglibc (as well as -mbionic) have been implemented in gcc
for various architectures so they are not MIPS specific.
For NetBSD, use the same settings for PPC64 as for PPC when it comes to
integrated assembler, libc++ and libgcc. Set emulation for ld for both
platforms for correct -m32 handling.
Manuel Klimek [Wed, 13 Aug 2014 12:34:41 +0000 (12:34 +0000)]
Default getFile() to use the last accessed name in the FileEntry.
With modules we start accessing headers for the first time while reading
the module map, which often has very different paths from the include
scanning logic.
Using the name by which the file was accessed gets us one step closer to
the right solution, which is using a FileName abstraction that decouples
the name by which a file was accessed from the FileEntry.
Oliver Stannard [Wed, 13 Aug 2014 09:18:12 +0000 (09:18 +0000)]
Emit diagnostic for -munaligned-access on v6m targets
Rather than silently disabling unaligned accesses for v6m targets as
in the previous patch to llvm, instead produce a warning saying that
this architecture doesn't support unaligned accesses.
Richard Smith [Wed, 13 Aug 2014 01:23:33 +0000 (01:23 +0000)]
[modules] When performing a lookup into a namespace, ensure that any later
redefinitions of that namespace have already been loaded. When writing out the
names in a namespace, if we see a name that is locally declared and had
imported declarations merged on top of it, export the local declaration as the
lookup result, because it will be the most recent declaration of that entity in
the redeclaration chain of an importer of the module.
Adam Nemet [Wed, 13 Aug 2014 00:29:01 +0000 (00:29 +0000)]
[AVX512] Add intrinsics for FP scalar broadcasts
Similar approach to the set1 intrinsics is used: implement in terms of vector
initializers and then ensure with an LLVM test that a broadcast is generated
at the end.
Alexey Samsonov [Wed, 13 Aug 2014 00:26:40 +0000 (00:26 +0000)]
[UBSan] Add returns-nonnull sanitizer.
Summary:
This patch adds a runtime check verifying that functions
annotated with "returns_nonnull" attribute do in fact return nonnull pointers.
It is based on suggestion by Jakub Jelinek:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140623/223693.html.
Objective-C [qoi]. Patch to not do Fix-It for fixing
a messaging expression except in the simple case
of a unary selector. We cannot reliably provide such a fixit due
to numerous reasons where a matching selector could not be found.
rdar://15756038
Samuel Benzaquen [Tue, 12 Aug 2014 21:11:37 +0000 (21:11 +0000)]
Support named values in the autocomplete feature.
Summary:
This includes:
- Passing a Sema to completeExpression to allow for named values in the
expression.
- Passing a map of names to values to the parser.
- Update the Sema interface to include completion for matchers.
- Change the parser to use the Sema for completion, instead of going
directly to Registry.
David Majnemer [Tue, 12 Aug 2014 17:53:10 +0000 (17:53 +0000)]
MS ABI: Mangle this qualifiers on function types
C++11 allows this qualifiers to exist on function types when used in
template arguments. Previously, I believed it wasn't possible because
MSVC rejected declarations like: S<int () const &> s;
However, it turns out MSVC properly allows them in using declarations;
updated clang to be compatible with this mangling.
Ben Langmuir [Tue, 12 Aug 2014 16:42:33 +0000 (16:42 +0000)]
Verify all the module map files for a pcm are the same on load
We already verified the primary module map file (either the one that
defines the top-level module, or the one that allows inferring it if it
is an inferred framework module). Now we also verify any other module
map files that define submodules, such as when there is a
module.private.modulemap file.
Objective-C. Fixes an assert where because of captured
variable in block is over-aligned with an align
attribute causing block metadata size not be multiple
of alignment. rdar://17878679
Manuel Klimek [Tue, 12 Aug 2014 08:25:57 +0000 (08:25 +0000)]
Correctly implement -include search logic.
According to the gcc docs, -include uses the current working directory
for the lookup instead of the main source file.
This patch gets rid of NormalizeIncludePath (which relied on an
implementation detail of FileManager / FileEntry for the include path
logic to work), and instead hands the correct lookup information down to
LookupFile.
This will allow us to change the FileEntry's behavior regarding its Name
caching.
Richard Smith [Mon, 11 Aug 2014 23:30:23 +0000 (23:30 +0000)]
Reject varargs '...' in function prototype if there are more parameters after
it. Diagnose with recovery if it appears after a function parameter that was
obviously supposed to be a parameter pack. Otherwise, warn if it immediately
follows a function parameter pack, because the user most likely didn't intend
to write a parameter pack followed by a C-style varargs ellipsis.
This warning can be syntactically disabled by using ", ..." instead of "...".
Richard Smith [Mon, 11 Aug 2014 22:11:07 +0000 (22:11 +0000)]
Modify behavior of -ast-dump-lookups: if -ast-dump is not also provided, dump
anyway. If -ast-dump *is* also provided, then dump the AST declarations as well
as the lookup results. This is invaluable for cross-correlating the lookup
information with the declarations actually found.
David Blaikie [Mon, 11 Aug 2014 22:08:06 +0000 (22:08 +0000)]
Change MemoryBuffer* to MemoryBuffer& parameter to Lexer::ComputePreamble
(dropping const from the reference as MemoryBuffer is immutable already,
so const is just redundant - and while I'd personally put const
everywhere, that's not the LLVM Way (see llvm::Type for another example
of an immutable type where "const" is omitted for brevity))
Changing the pointer argument to a reference parameter makes call sites
identical between callers with unique_ptrs or raw pointers, minimizing
the churn in a pending unique_ptr migrations.
And in the process, discover that FileManager::removeStatCache had a
double-delete when removing an element from the middle of the list (at
the beginning or the end of the list, there was no problem) and add a
unit test to exercise the code path (which successfully crashed when run
(with modifications to match the old API) without this patch applied)
David Majnemer [Mon, 11 Aug 2014 18:33:59 +0000 (18:33 +0000)]
Sema: Properly perform lookup when acting on fields for desig inits
Clang used a custom implementation of lookup when handling designated
initializers. The custom code was not particularly optimized and relied
on standard lookup for typo-correction anyway.
This custom code has to go, it doesn't properly support MSVC-style
anonymous structs embedded inside other records; replace it with the
typo-correction path.
This has the side effect of speeding up semantic handling of the fields
for a designated initializer while simplifying the code at the same
time.
Manuel Klimek [Mon, 11 Aug 2014 14:54:30 +0000 (14:54 +0000)]
Work around default parameter problem in the static analyzer.
In cases like:
struct C { ~C(); }
void f(C c = C());
void t() {
f();
}
We currently do not add the CXXBindTemporaryExpr for the temporary (the
code mentions that as the default parameter expressions are owned by
the declaration, we'd otherwise add the same expression multiple times),
but we add the temporary destructor pointing to the CXXBindTemporaryExpr.
We need to fix that before we can re-enable the assertion.
Daniel Jasper [Mon, 11 Aug 2014 11:37:33 +0000 (11:37 +0000)]
Properly #include ASTConsumer.h instead of forward declaration.
Otherwise, this can lead to compile failures if a user/subclass of
FrontendAction doesn't #include this file, even if CreateASTConsumer
isn't used directly.
David Majnemer [Mon, 11 Aug 2014 07:29:54 +0000 (07:29 +0000)]
Sema: Handle declspecs without declarators in records properly in C mode
We had two bugs:
- We wouldn't properly warn when a struct/union/enum was mentioned
inside of a record definition if no declarator was provided. We
should have mentioned that this declaration declares nothing.
- We didn't properly support Microsoft's extension where certain
declspecs without declarators would act as anonymous structs/unions.
* We completely ignored the case where such a declspec could be a
union.
* We didn't properly handle the case where a record was defined inside
another record:
struct X {
int a;
struct Y {
int b;
};
};
NAKAMURA Takumi [Mon, 11 Aug 2014 06:53:11 +0000 (06:53 +0000)]
Revert r215331, "unique_ptrify CompilerInstance::OutputFile(s) and remove a unique_ptr around a non-owning raw_ostream in CodeGenAction::CreateASTConsumer"
It cannot be compiled on Visual Studio 2012.
clang\include\clang/Frontend/CompilerInstance.h(153):
error C2248: 'std::unique_ptr<_Ty>::unique_ptr' : cannot access private member declared in class 'std::unique_ptr<_Ty>'
with
[
_Ty=llvm::raw_ostream
]
D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\memory(1447) : see declaration of 'std::unique_ptr<_Ty>::unique_ptr'
with
[
_Ty=llvm::raw_ostream
]
This diagnostic occurred in the compiler generated function 'clang::CompilerInstance::OutputFile::OutputFile(const clang::CompilerInstance::OutputFile &)'
David Blaikie [Sun, 10 Aug 2014 19:56:51 +0000 (19:56 +0000)]
Recommit 213307: unique_ptr-ify ownership of ASTConsumers (reverted in r213325)
After post-commit review and community discussion, this seems like a
reasonable direction to continue, making ownership semantics explicit in
the source using the type system.
Richard Smith [Sun, 10 Aug 2014 02:20:15 +0000 (02:20 +0000)]
[modules] When considering merging a newly-declared typedef into an imported
one, perform the import if the types match even if the imported declaration is
hidden. Otherwise, NamedDecl::declarationReplaces will drop one of the name
lookup entries, making the typedef effectively inaccessible from one of the
modules that declared it.
Yaron Keren [Sat, 9 Aug 2014 21:24:04 +0000 (21:24 +0000)]
Make this test unsupported when there is no real 'env' from a real shell.
While the test was already requiring shell-preserves-root (such as the
internal shell), it wasn't aware that the MSYS 1.0 env command knows how
to expand root by itself!
From cmd.exe try:
env SDKROOT=/ cmd //c echo %SDKROOT%
And get:
C:/MINGW/MSYS/1.0
To be certain we have a good 'env' program the test now requires a shell.
Suprisingly the normalize_separators() was no-op when LLVM_ON_WIN32.
Its replacement native() does change path separators into \ as expected,
breaking these tests.
I had fixed the tests by #ifndef LLVM_ON_WIN32 on the native call,
to match the previous behaviour.
If this logic is not used on Windows host, it might be completely
deleted as there should not be windows path seperators on Linux hosts.
I can't test on Linux but if someone can run tests on Linux after
commenting out the line
llvm::sys::path::native(NormalizedPath);
and the tests pass, the whole if (LangOpts.MSVCCompat) could be deleted.