Aaron Ballman [Mon, 24 Mar 2014 19:29:19 +0000 (19:29 +0000)]
Capability attributes can now be declared on a typedef declaration as well as a structure declaration. This allows for C code to use Boolean expressions on a capability as part of another attribute. Eg) __attribute__((requires_capability(!SomeCapability)))
Will Schmidt [Mon, 24 Mar 2014 17:27:03 +0000 (17:27 +0000)]
[PPC64LE] Add a CALL_ELF macro to indicate use of the ELFv2 ABI.
Additional clarification from Uli for the background on _CALL_ELF:
"Historically GCC has provided various _CALL_... predefines depending on the
ABI currently being compiled for. (_CALL_SYSV,_CALL_AIXDESC, _CALL_DARWIN )
When we needed a new define for the current ABI, we decided on using _CALL_ELF
since the official name of the ABI is the OpenPower ElfV2 ABI, with the
current Linux ABI retro-actively being renamed the ELFv1 ABI
and so we decided on using _CALL_ELF to identify the Linux (+BSD etc.) ELF ABI,
with _CALL_ELF=1 for the v1 ABI and _CALL_ELF=2 for the v2 ABI.
(Note that this matches the gcc compiler switch -mabi=elfv1 vs. -mabi=elfv2)."
In code, a (_CALL_ELF==2) check will indicate when the ELFv2 ABI is
to be used. This is the desired default for the PPC64 LE target.
Will Schmidt [Mon, 24 Mar 2014 17:10:37 +0000 (17:10 +0000)]
Update the parameters passed to the assembler and linker for
the PPC64LE target. Specifically:
(assembler) adds/uses -mppc64 -mlittle-endian
(linker) adds/uses elf64lppc
David Majnemer [Mon, 24 Mar 2014 05:53:08 +0000 (05:53 +0000)]
MS ABI: Add tests, other cleanups for r204562
This commit cleans up a few accidents:
- Do not rely on the order in which StringLiteral lays out bytes.
- Use a more efficient mechanism for handling so-called
"special-mappings" when mangling string literals.
- There is no need to allocate a copy of the mangled name.
- Add the test written for r204562.
Richard Smith [Sun, 23 Mar 2014 20:41:56 +0000 (20:41 +0000)]
If a name is injected into an imported inline namespace without reopening that
namespace, we need to update both the visible names of that namespace and of
its enclosing namespace set.
Richard Smith [Sun, 23 Mar 2014 19:45:26 +0000 (19:45 +0000)]
When we inject a declaration into a namespace, add the primary DeclContext to
the update set rather than the current DeclContext. Add test for the local
extern case too.
Simplify test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp by forcing VFTableBuilder invocation with virtual function calls or constructors codegen
Previously the vftables were built at the end of the TU in a reverse-to-random order
David Majnemer [Sun, 23 Mar 2014 17:47:16 +0000 (17:47 +0000)]
MS ABI: Eliminate Duplicate Strings
COFF doesn't have mergeable sections so LLVM/clang's normal tactics for
string deduplication will not have any effect.
To remedy this we place each string inside it's own section and mark
the section as IMAGE_COMDAT_SELECT_ANY. However, we can only do this if the
string has an external name that we can generate from it's contents.
To be compatible with MSVC, we must use their scheme. Otherwise identical
strings in translation units from clang may not be deduplicated with
translation units in MSVC.
This fixes PR18248.
N.B. We will not attempt to do anything with a string literal which is not of
type 'char' or 'wchar_t' because their compiler does not support unicode
string literals as of this date.
Nuno Lopes [Sun, 23 Mar 2014 17:12:37 +0000 (17:12 +0000)]
remove a bunch of unused private methods
found with a smarter version of -Wunused-member-function that I'm playwing with.
Appologies in advance if I removed someone's WIP code.
Richard Smith [Sun, 23 Mar 2014 02:30:01 +0000 (02:30 +0000)]
If a template instantation introduces a name into a namespace, we need to write
out a visible update record for that namespace even if it was never declared in
this module.
Richard Smith [Sat, 22 Mar 2014 23:33:22 +0000 (23:33 +0000)]
Emit an update record if we instantiate the definition of a function template
specialization from a module. (This can also happen for function template
specializations in PCHs if they're instantiated eagerly, because they're
constexpr or have a deduced return type.)
Adrian Prantl [Fri, 21 Mar 2014 21:01:58 +0000 (21:01 +0000)]
CGDebugInfo: At the end of EmitFunctionStart, Initialize PrevLoc to the
location that the next call emitLocation() would default to. Otherwise
setLocation() may wrongly believe that the current source file didn't
change, when in fact it did.
Paul Robinson [Fri, 21 Mar 2014 18:13:35 +0000 (18:13 +0000)]
Make clang/test/lit.cfg pre-scan the RUN line looking for tool names,
and substitute fully qualified path names pointing to the build
directory. This ensures we're testing the just-built tools.
Aaron Ballman [Fri, 21 Mar 2014 14:48:48 +0000 (14:48 +0000)]
The release_capability, release_shared_capability and release_generic_capability functions are now functionally distinct for capability analysis. The unlock_function attribute maps directly to release_generic_capability.
Alexey Samsonov [Fri, 21 Mar 2014 13:09:25 +0000 (13:09 +0000)]
[CMake] Propagate top-level targets for compiler-rt runtimes and test-suites
from (external) compiler-rt build tree into LLVM/Clang build tree in
LLVM_BUILD_EXTERNAL_COMPILER_RT mode.
For instance, running
make asan -j12
in LLVM/Clang build tree will now build Clang, use it to configure
compiler-rt build tree, and invoke "make asan -j12" there. ASan runtime will
be built in the proper location, where Clang driver expects to find it.
Running
make check-asan
will build Clang, use it to configure compiler-rt build tree, build everything
there, and then run "make check-asan" in compiler-rt build tree using just-built
Clang and ASan runtime.
Richard Smith [Fri, 21 Mar 2014 00:33:59 +0000 (00:33 +0000)]
PR19215: When writing/reading a PCH that imported a module, store the location
at which that PCH imported each visible submodule of the module. Such locations
are needed when synthesizing macro directives resulting from the import.
PGO: Don't define instrumentation data available_externally
Variables with available_externally linkage can be dropped at will.
This causes link errors, since there are still references to the
instrumentation! linkonce_odr is almost equivalent, so use that
instead.
As a drive-by fix (I don't have an Elf system, so I'm not sure how to
write a testcase), use linkonce linkage for the instrumentation of
extern_weak functions.
Richard Smith [Thu, 20 Mar 2014 19:44:17 +0000 (19:44 +0000)]
Rearrange serialization block order to put decl update emission into the same
block as decl and type emission. This allows decl updates include statements
and expressions. No functionality change (but the generated PCM files are
incompatible with earlier versions of Clang).
Remove the remaining explicit static initialization from translation
units, at least on Darwin. Instead, create a use of __llvm_pgo_runtime,
which will pull in required code from compiler-rt.
After this commit (and its pair in compiler-rt), a user can define their
own __llvm_pgo_runtime to satisfy this undefined symbol and call the
functions in compiler-rt directly.
Ben Langmuir [Thu, 20 Mar 2014 18:27:26 +0000 (18:27 +0000)]
Prevent lookup of subframework modules by name without parent framework
We were 'allowing' the following import
@import Sub;
where Sub is a subframework of Foo and we had a -F path inside
Foo.framework/Frameworks and no module map file for Sub. This would
later hit assertion failures in debug builds.
Now we should correctly diagnose this as a module not found error.
Jordan Rose [Thu, 20 Mar 2014 16:37:54 +0000 (16:37 +0000)]
[analyzer] scan-build: match whitespace instead of word boundaries around flags.
Because neither ' ' nor '-' is alphanumeric, \b won't match between them!
Since in this case we know our output is coming from a -### invocation,
we should always have spaces on both sides of the flag we're trying to match,
"-cc1".
Aaron Ballman [Thu, 20 Mar 2014 16:02:49 +0000 (16:02 +0000)]
Replacing the exclusive_lock_function, shared_lock_function and unlock_function attributes with the acquire_capability and release_capability attributes. The old spellings will continue to work, but the underlying semantic attributes have been replaced.
Downgraded the capability diagnostics from error to warning to match the desired behavior, and updated the existing test cases.
Jordan Rose [Thu, 20 Mar 2014 15:54:16 +0000 (15:54 +0000)]
Remove wchar_t* buffer from scanf format fix-it test.
Amends r204300 to not try to test fixing a wchar_t* to "%ls", which we don't
do correctly anyway. In C mode, wchar_t is just a typedef for a normal
primitive integer type, not a distinct type like it is in C++. To make this
work correctly, we'll need to look for the wchar_t typedef, not just the
builtin type.
Evgeniy Stepanov [Thu, 20 Mar 2014 14:58:36 +0000 (14:58 +0000)]
[msan] -fsanitize-memory-track-origins=[level] flag and docs.
This change turns -fsanitize-memory-track-origins into
-fsanitize-memory-track-origins=[level] flag (keeping the old one for
compatibility). Possible levels are 0 (off), 1 (default) and 2 (incredibly
detailed). See docs (part of this patch) for more info.
Ted Kremenek [Thu, 20 Mar 2014 06:07:30 +0000 (06:07 +0000)]
[-Wunreachable-code] Simplify and broad -Wunreachable-code-return, including nontrivial returns.
The exception is return statements that include control-flow,
which are clearly doing something "interesting".
99% of the cases I examined for -Wunreachable-code that fired
on return statements were not interesting enough to warrant
being in -Wunreachable-code by default. Thus the move to
include them in -Wunreachable-code-return.
This simplifies a bunch of logic, including removing the ad hoc
logic to look for std::string literals.
Ben Langmuir [Wed, 19 Mar 2014 20:23:34 +0000 (20:23 +0000)]
Add a new spelling for module map files 'module.modulemap'
This name, while more verbose, plays more nicely with tools that use
file extensions to determine file types. The existing spelling
'module.map' will continue to work, but the new spelling will take
precedence.
In frameworks, this new filename will only go in a new 'Modules'
sub-directory.
Similarly, add a module.private.modulemap corresponding to
module_private.map.
Manuel Klimek [Wed, 19 Mar 2014 10:22:36 +0000 (10:22 +0000)]
Use the expansion location of the file name when finding the module.
The spelling location of stringified strings is not a file location.
Optimally, we'll want to solve the problem (as the FIXME states) by
handing in the right FileEntry of the #include location.