These are now treated as environments. Remove references to these enumeration
values in order to clean up the unused enumeration entries in LLVM. The target
normalisation prior to tool invocation should ensure that the old values
continue to function properly.
Richard Smith [Sat, 17 May 2014 04:36:39 +0000 (04:36 +0000)]
More fixes for isBetterOverloadCandidate not being a strict weak ordering. The
bug was obvious from inspection, figuring out a way to test it was... less so.
Richard Smith [Sat, 17 May 2014 01:58:45 +0000 (01:58 +0000)]
Correct incoherent function versus function template partial ordering for conversion operators (the comparison could claim that two conversion operators are both better than each other). Actually implement DR495, rather than passing its test by chance because the declarations happened to be in the "lucky" order.
Richard Smith [Fri, 16 May 2014 23:01:30 +0000 (23:01 +0000)]
If a declaration is loaded, and then a module import adds a redeclaration, then
ensure that querying the first declaration for its most recent declaration
checks for redeclarations from the imported module.
This works as follows:
* The 'most recent' pointer on a canonical declaration grows a pointer to the
external AST source and a generation number (space- and time-optimized for
the case where there is no external source).
* Each time the 'most recent' pointer is queried, if it has an external source,
we check whether it's up to date, and update it if not.
* The ancillary data stored on the canonical declaration is allocated lazily
to avoid filling it in for declarations that end up being non-canonical.
We'll still perform a redundant (ASTContext) allocation if someone asks for
the most recent declaration from a decl before setPreviousDecl is called,
but such cases are probably all bugs, and are now easy to find.
Some finessing is still in order here -- in particular, we use a very general
mechanism for handling the DefinitionData pointer on CXXRecordData, and a more
targeted approach would be more compact.
Also, the MayHaveOutOfDateDef mechanism should now be expunged, since it was
addressing only a corner of the full problem space here. That's not covered
by this patch.
Early performance benchmarks show that this makes no measurable difference to
Clang performance without modules enabled (and fixes a major correctness issue
with modules enabled). I'll revert if a full performance comparison shows any
problems.
Rafael Espindola [Fri, 16 May 2014 19:35:48 +0000 (19:35 +0000)]
Update for llvm api change.
Now that llvm cannot represent alias cycles, we have to diagnose erros just
before trying to close the cycle. This degrades the errors a bit. The real
solution is what it was before: if we want to provide good errors for these
cases, we have to be able to find a clang level decl given a mangled name
and produce the error from Sema.
InstrProf: Look for the PIC-version of the profile runtime
If `-shared` is specified, pull in a PIC-version of the profile runtime,
which was added to compiler-rt in r208947. I'm hoping this will get the
bots on my side.
Richard Smith [Fri, 16 May 2014 02:14:42 +0000 (02:14 +0000)]
Push implicitly-declared allocation functions into the IdResolver. Otherwise,
declaration merging in modules is unable to find them and we get bogus errors
and even crashes.
Shared objects are fairly broken for InstrProf right now -- a follow-up
commit in compiler-rt will fix the rest of this.
The main problem here is that at link time, profile data symbols in the
shared object might get used instead of symbols from the main
executable, creating invalid profile data sections.
Hans Wennborg [Fri, 16 May 2014 00:09:31 +0000 (00:09 +0000)]
test/CodeGenCXX/dllexport.cpp: we already correctly emit b() even when
it's not used, because CodeGenModule::EmitGlobal consults
ASTContext::DeclMustBeEmitted via CodeGenModule::MayDeferGeneration.
Reid Kleckner [Thu, 15 May 2014 23:01:46 +0000 (23:01 +0000)]
MS ABI: Use musttail for thunk IR generation
This allows us to perfectly forward non-trivial arguments that use
inalloca.
We still can't forward non-trivial arguments through thunks when we have
a covariant return type with a non-trivial adjustment. This would
require emitting an extra copy, which is non-conforming anyway.
Ben Langmuir [Thu, 15 May 2014 16:20:33 +0000 (16:20 +0000)]
Use the virtual name of headers when searching for a module
When using the VFS, we want the virtual header location when searching
for a framework module, since that will be the one in the correct
directory structure for the module.
I'll add a regression test once I finish reducing the larger one I have.
Reid Kleckner [Thu, 15 May 2014 01:26:32 +0000 (01:26 +0000)]
Revert Itanium parts of "Don't copy objects with trivial, deleted copy ctors"
This undoes half of r208786.
It had problems with lazily declared special members in cases like this:
struct A {
A();
A &operator=(A &&o);
void *p;
};
void foo(A);
void bar() {
foo({});
}
In this case, the copy and move constructors are implicitly deleted.
However, Clang doesn't eagerly declare the copy ctor in the AST, so we
pass the struct in registers. Furthermore, GCC passes this in registers
even though this class should be uncopyable.
Richard Smith [Wed, 14 May 2014 23:23:27 +0000 (23:23 +0000)]
PR19742: cv-qualifiers and ref-qualifiers aren't allowed on functions within
pointer and reference types, even if those types are produced by template
instantiation.
Reid Kleckner [Wed, 14 May 2014 16:02:09 +0000 (16:02 +0000)]
Don't copy objects with trivial, deleted copy ctors
This affects both the Itanium and Microsoft C++ ABIs.
This is in anticipation of a change to the Itanium C++ ABI, and should
match GCC's current behavior. The new text will likely be:
"""
Pass an object of class type by value if every copy constructor and
move constructor is deleted or trivial and at least one of them is not
deleted, and the destructor is trivial.
"""
http://sourcerytools.com/pipermail/cxx-abi-dev/2014-May/002728.html
On x86 Windows, we can mostly use the same logic, where we use inalloca
instead of passing by address. However, on Win64, there are register
parameters, and we have to do what MSVC does. MSVC ignores the presence
of non-trivial move constructors and only considers the presence of
non-trivial or deleted copy constructors. If a non-trivial or deleted
copy ctor is present, it passes the argument indirectly.
This change fixes bugs and makes us more ABI compatible with both GCC
and MSVC.
David Blaikie [Wed, 14 May 2014 00:29:00 +0000 (00:29 +0000)]
DebugInfo: Avoid creating DILexicalScopeFiles when the filename in the current scope has not changed.
This looks like the right way for this check to work, but there is
another semi-obvious bug, I would think: why is CurLoc not zero'd out
between functions? The possibility for it to bleed between them seems
problematic. (& indeed I caused tests to fail when I fixed this a
different way, by setting CurLoc to SourceLocation() and the end of
EmitFunctionEnd... )
The changes to debug-info-blocks.m are due to a mismatch between the
source manager's file naming and CGDebugInfo's default handling when no
-main-file-name is specified. This actually reveals somewhat of a bug in
the debug info when using source files from standard in, too. See the
comment in CGDebugInfo::CreateCompileUnit for more details.
Reid Kleckner [Tue, 13 May 2014 22:05:45 +0000 (22:05 +0000)]
Push record return type classification into CGCXXABI
In the Microsoft C++ ABI, instance methods always return records
indirectly via the second hidden parameter. This was implemented in
X86_32ABIInfo, but not WinX86_64ABIInfo.
Rather than exposing a handful of boolean methods in the CGCXXABI
interface, we can expose a single method that applies C++ ABI return
value classification rules.
Richard Smith [Tue, 13 May 2014 19:56:21 +0000 (19:56 +0000)]
PR19729: Delete a bunch of bogus code in Sema::FindAllocationOverload. This
caused us to perform copy-initialization for the parameters of an allocation
function called by a new-expression multiple times, resulting in us rejecting
allocations that passed non-copyable parameters (and much worse things in
MSVC compat mode, where we potentially called this function multiple times).
Aaron Ballman [Tue, 13 May 2014 16:12:14 +0000 (16:12 +0000)]
Fix the AST printer for attributed statements so that it does not print duplicate attribute introducers. Eg) [[clang::fallthrough]] instead of [[[[clang::fallthrough]]]]
Aaron Ballman [Tue, 13 May 2014 15:14:59 +0000 (15:14 +0000)]
Updated the test case to show that no diagnostics are expected, and not require emitting the AST until after the AST printing for statement attributes is updated.
Richard Smith [Tue, 13 May 2014 00:34:43 +0000 (00:34 +0000)]
Refactor and fix a latent bug (found by inspection) where an external AST
source that provides a declaration from a hidden module would not have the
visibility of the produced definition checked. This might matter if an
external source chose to import a new module to provide an extra definition,
but is not observable with our current external sources.
Alexey Samsonov [Mon, 12 May 2014 18:39:51 +0000 (18:39 +0000)]
[ASan] Split static ASan runtime in two parts: asan and asan_cxx.
asan_cxx containts replacements for new/delete operators, and should
only be linked in C++ mode. We plan to start building this part
with exception support to make new more standard-compliant.
See https://code.google.com/p/address-sanitizer/issues/detail?id=295
for more details.
Simon Atanasyan [Mon, 12 May 2014 07:37:51 +0000 (07:37 +0000)]
[Driver] Do not lose already detected set of toolchain's multilibs while
iterating over different library path suffixes and different library versions.
To find the most appropriate library for the given command line flags we
iterate over a set of disk paths. Before probe each path the already
detected set of multilibs are cleared. If the set of paths contains
existing paths which do not satisfy command line flags or do not contain
necessary libraries and object files at all we might lose found multilibs.
The patch updates variables which hold detected multilibs if we really find
a new multilib matches command line flags.
disable asan's detect_stack_use_after_return when running CXX/drs/dr4xx.cpp (temporary workaround for PR19722); This should make the asan bootstrap bot green again