Douglas Gregor [Fri, 19 Jun 2015 23:18:00 +0000 (23:18 +0000)]
Handle 'instancetype' in ParseDeclarationSpecifiers.
...instead of as a special case in ParseObjCTypeName with lots of
duplicated logic. Besides being a nice refactoring, this also allows
"- (instancetype __nonnull)self" in addition to "- (nonnull instancetype)self".
rdar://problem/
19924646
llvm-svn: 240188
Douglas Gregor [Fri, 19 Jun 2015 23:17:55 +0000 (23:17 +0000)]
Make -Wnullability-completeness work with -Wsystem-headers.
rdar://problem/
21134250
llvm-svn: 240187
Douglas Gregor [Fri, 19 Jun 2015 23:17:51 +0000 (23:17 +0000)]
CF_RETURNS_[NOT_]RETAINED on a param makes the inner pointer __nullable.
That is,
void cf2(CFTypeRef * __nullable p CF_RETURNS_NOT_RETAINED);
is equivalent to
void cf2(CFTypeRef __nullable * __nullable p CF_RETURNS_NOT_RETAINED);
More rdar://problem/
18742441
llvm-svn: 240186
Douglas Gregor [Fri, 19 Jun 2015 23:17:46 +0000 (23:17 +0000)]
Allow the cf_returns_[not_]retained attributes to appear on out-parameters.
Includes a simple static analyzer check and not much else, but we'll also
be able to take advantage of this in Swift.
This feature can be tested for using __has_feature(cf_returns_on_parameters).
This commit also contains two fixes:
- Look through non-typedef sugar when deciding whether something is a CF type.
- When (cf|ns)_returns(_not)?_retained is applied to invalid properties,
refer to "property" instead of "method" in the error message.
rdar://problem/
18742441
llvm-svn: 240185
Peter Collingbourne [Fri, 19 Jun 2015 22:40:05 +0000 (22:40 +0000)]
COFF: Take reference to argument vector using std::vector::data() instead of operator[](0).
This avoids undefined behaviour caused by an out-of-range access if the
vector is empty, which can happen if an object file's directive section
contains only whitespace.
llvm-svn: 240183
Rui Ueyama [Fri, 19 Jun 2015 22:39:48 +0000 (22:39 +0000)]
COFF: Fix precedence between LIB and /libpath.
/libpath should take precedence over LIB.
Previously, LIB took precedence over /libpath.
llvm-svn: 240182
Dan Liew [Fri, 19 Jun 2015 21:50:27 +0000 (21:50 +0000)]
Try to fix generation of LLVMExports.cmake under Visual Studio.
If LLVMDebugInfoPDB links against the DIA SDK then the exports file
would contain an INTERFACE_LINK_LIBRARIES property that contained an
absolute path to ``diaguids.lib`` which used a native windows path (interpreted
as escape sequences when LLVMExports.cmake is imported causing
``find_package(LLVM)`` to fail) rather than the correct CMake style path.
llvm-svn: 240181
Rui Ueyama [Fri, 19 Jun 2015 21:44:32 +0000 (21:44 +0000)]
COFF: Add search paths in the correct order.
Previously, we added search paths in reverse order.
llvm-svn: 240180
Alexey Samsonov [Fri, 19 Jun 2015 21:36:47 +0000 (21:36 +0000)]
[Sanitizers] Provide better diagnostic for sanitizers unsupported for target triple.
Introduce ToolChain::getSupportedSanitizers() that would return the set
of sanitizers available on given toolchain. By default, these are
sanitizers which don't necessarily require runtime support and are
not toolchain- or architecture-dependent.
Sanitizers (ASan, DFSan, TSan, MSan etc.) which cannot function
without runtime library are marked as supported only on platforms
for which we actually build these runtimes.
This would allow more fine-grained checks in the future: for instance,
we have to restrict availability of -fsanitize=vptr to Mac OS 10.9+
(PR23539).
Update test cases accrodingly: add tests for certain unsupported
configurations, remove test cases for -fsanitize=vptr + PS4
integration, as we don't build the runtime for PS4 at the moment.
This change was first submitted as r239953 and reverted in r239958.
The problem was and still is in Darwin toolchains, which get the
knowledge about target platform too late after initializaition, while
now we require this information when ToolChain::getSanitizerArgs() is
called. r240170 works around this issue.
llvm-svn: 240179
Rui Ueyama [Fri, 19 Jun 2015 21:25:44 +0000 (21:25 +0000)]
COFF: Cache Archive::Symbol::getName(). NFC.
getName() does strlen() on the symbol table, so it's not very fast.
It's not as bad as r239332 because the number of symbols exported
from archive files are fewer than object files, and they are usually
shorter, though.
llvm-svn: 240178
Rui Ueyama [Fri, 19 Jun 2015 21:12:48 +0000 (21:12 +0000)]
COFF: Continue reading object files until converge.
In this linker model, adding an undefined symbol may trigger chain
reactions. It may trigger a Lazy symbol to read a new file.
A new file may contain a directive section, which may contain various
command line options.
Previously, we didn't handle chain reactions well. We visited /include'd
symbols only once, so newly-added /include symbols were ignored.
This patch fixes that bug.
Now, the symbol table is versioned; every time the symbol table is
updated, the version number is incremented. We repeat adding undefined
symbols until the version number does not change. It is guaranteed to
converge -- the number of undefined symbol in the system is finite,
and adding the same undefined symbol more than once is basically no-op.
llvm-svn: 240177
Rafael Espindola [Fri, 19 Jun 2015 20:58:43 +0000 (20:58 +0000)]
Improve error handling of getRelocationAddend.
This patch changes getRelocationAddend to use ErrorOr and considers it an error
to try to get the addend of a REL section.
If, for example, a x86_64 file has a REL section, that file is corrupted and
we should reject it.
Using ErrorOr is not ideal since we check the section type once per relocation
instead of once per section.
Checking once per section would involve getRelocationAddend just asserting and
callers checking the section before iterating over the relocations.
In any case, this is an improvement and includes a test.
llvm-svn: 240176
Pete Cooper [Fri, 19 Jun 2015 20:49:02 +0000 (20:49 +0000)]
Fix header path in CMake. NFC.
The ADDITIONAL_HEADER_DIRS command can be used to tell UIs that a given library
owns certain headers. The path for MCParser was missing MC/ in it.
llvm-svn: 240175
Alex Lorenz [Fri, 19 Jun 2015 20:12:03 +0000 (20:12 +0000)]
MIR Parser: report an error when a basic block isn't found.
This commit reports an error when the MIR parser can't find
a basic block with the machine basic block's name.
llvm-svn: 240174
Greg Clayton [Fri, 19 Jun 2015 20:08:36 +0000 (20:08 +0000)]
Fix the MacOSX build to include the Mips64 ABI plug-in.
llvm-svn: 240173
David Blaikie [Fri, 19 Jun 2015 20:07:18 +0000 (20:07 +0000)]
Fix the clang -Werror build (-Wbraced-scalar-init)
llvm-svn: 240172
Douglas Gregor [Fri, 19 Jun 2015 20:00:10 +0000 (20:00 +0000)]
Fix a use of err_nullability_conflicting that's triggering an assertion.
llvm-svn: 240171
Alexey Samsonov [Fri, 19 Jun 2015 19:57:46 +0000 (19:57 +0000)]
[CFI] Require -flto instead of implying it.
Summary:
This is unfortunate, but would let us land http://reviews.llvm.org/D10467,
that makes ToolChains responsible for computing the set of sanitizers
they support.
Unfortunately, Darwin ToolChains doesn't know about actual OS they
target until ToolChain::TranslateArgs() is called. In particular, it
means we won't be able to construct SanitizerArgs for these ToolChains
before that.
This change removes SanitizerArgs::needsLTO() method, so that now
ToolChain::IsUsingLTO(), which is called very early, doesn't need
SanitizerArgs to implement this method.
Docs and test cases are updated accordingly. See
https://llvm.org/bugs/show_bug.cgi?id=23539, which describes why we
start all these.
Test Plan: regression test suite
Reviewers: pcc
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D10560
llvm-svn: 240170
David Blaikie [Fri, 19 Jun 2015 19:55:25 +0000 (19:55 +0000)]
Fix no-asserts build failure due to unused variable, and cleanup some unique_ptr usage while I'm here
llvm-svn: 240169
Alexey Samsonov [Fri, 19 Jun 2015 19:48:40 +0000 (19:48 +0000)]
Add -flto to clang flags for cfi tests.
llvm-svn: 240168
David Blaikie [Fri, 19 Jun 2015 19:43:43 +0000 (19:43 +0000)]
Simplify Pass::perform to take a SimpleFile& instead of unique_ptr<SimpleFile>&
None of the implementations replace the SimpleFile with some other file,
they just modify the SimpleFile in-place, so a direct reference to the
file is sufficient.
llvm-svn: 240167
Tamas Berghammer [Fri, 19 Jun 2015 19:42:43 +0000 (19:42 +0000)]
Add comment for workarond in DYLDRendezvous with android version
llvm-svn: 240166
Adam Nemet [Fri, 19 Jun 2015 19:32:48 +0000 (19:32 +0000)]
[LoopDist] Rename RuntimeCheckEmitter to LoopVersioning, NFC
llvm-svn: 240165
Adam Nemet [Fri, 19 Jun 2015 19:32:41 +0000 (19:32 +0000)]
[LoopDist] Move pointer-to-partition computation out of RuntimeCheckEmitter, NFC
This starts preparing the class to become a (more) general
LoopVersioning utility class.
llvm-svn: 240164
Marshall Clow [Fri, 19 Jun 2015 19:32:06 +0000 (19:32 +0000)]
Fix illegal chars that snuck into <memory>
llvm-svn: 240163
Tamas Berghammer [Fri, 19 Jun 2015 19:28:13 +0000 (19:28 +0000)]
Fix build brakage caused by r240154
llvm-svn: 240162
Rui Ueyama [Fri, 19 Jun 2015 19:23:43 +0000 (19:23 +0000)]
COFF: Don't add new undefined symbols for /alternatename.
Alternatename option is in the form of /alternatename:<from>=<to>.
It's effect is to resolve <from> as <to> if <from> is still undefined
at end of name resolution.
If <from> is not undefined but completely a new symbol, alternatename
shouldn't do anything. Previously, it introduced a new undefined
symbol for <from>, which resulted in undefined symbol error.
llvm-svn: 240161
Rafael Espindola [Fri, 19 Jun 2015 19:07:59 +0000 (19:07 +0000)]
Delete dead code. NFC.
llvm-svn: 240160
Douglas Gregor [Fri, 19 Jun 2015 18:27:52 +0000 (18:27 +0000)]
Code completion for nullability type specifiers.
Another part of rdar://problem/
18868820.
llvm-svn: 240159
Douglas Gregor [Fri, 19 Jun 2015 18:27:45 +0000 (18:27 +0000)]
Check for consistent use of nullability type specifiers in a header.
Adds a new warning (under -Wnullability-completeness) that complains
about pointer, block pointer, or member pointer declarations that have
not been annotated with nullability information (directly or inferred)
within a header that contains some nullability annotations. This is
intended to be used to help maintain the completeness of nullability
information within a header that has already been audited.
Note that, for performance reasons, this warning will underrepresent
the number of non-annotated pointers in the case where more than one
pointer is seen before the first nullability type specifier, because
we're only tracking one piece of information per header. Part of
rdar://problem/
18868820.
llvm-svn: 240158
Adrian McCarthy [Fri, 19 Jun 2015 18:26:53 +0000 (18:26 +0000)]
Load executable module when attaching to process; implement detach from process.
llvm-svn: 240157
Douglas Gregor [Fri, 19 Jun 2015 18:25:57 +0000 (18:25 +0000)]
Introduced pragmas for audited nullability regions.
Introduce the clang pragmas "assume_nonnull begin" and "assume_nonnull
end" in which we make default assumptions about the nullability of many
unannotated pointers:
- Single-level pointers are inferred to __nonnull
- NSError** in a (function or method) parameter list is inferred to
NSError * __nullable * __nullable.
- CFErrorRef * in a (function or method) parameter list is inferred
to CFErrorRef __nullable * __nullable.
- Other multi-level pointers are never inferred to anything.
Implements rdar://problem/
19191042.
llvm-svn: 240156
Douglas Gregor [Fri, 19 Jun 2015 18:14:46 +0000 (18:14 +0000)]
Implement the 'null_resettable' attribute for Objective-C properties.
'null_resettable' properties are those whose getters return nonnull
but whose setters take nil, to "reset" the property to some
default. Implements rdar://problem/
19051334.
llvm-svn: 240155
Douglas Gregor [Fri, 19 Jun 2015 18:14:38 +0000 (18:14 +0000)]
Extend type nullability qualifiers for Objective-C.
Introduce context-sensitive, non-underscored nullability specifiers
(nonnull, nullable, null_unspecified) for Objective-C method return
types, method parameter types, and properties.
Introduce Objective-C-specific semantics, including computation of the
nullability of the result of a message send, merging of nullability
information from the @interface of a class into its @implementation,
etc .
This is the Objective-C part of rdar://problem/
18868820.
llvm-svn: 240154
Douglas Gregor [Fri, 19 Jun 2015 18:13:19 +0000 (18:13 +0000)]
Diagnose unsafe uses of nil and __nonnull pointers.
This generalizes the checking of null arguments to also work with
values of pointer-to-function, reference-to-function, and block
pointer type, using the nullability information within the underling
function prototype to extend non-null checking, and diagnoses returns
of 'nil' within a function with a __nonnull return type.
Note that we don't warn about nil returns from Objective-C methods,
because it's common for Objective-C methods to mimic the nil-swallowing
behavior of the receiver by checking ostensibly non-null parameters
and returning nil from otherwise non-null methods in that
case.
It also diagnoses (via a separate flag) conversions from nullable to
nonnull pointers. It's a separate flag because this warning can be noisy.
llvm-svn: 240153
Eric Christopher [Fri, 19 Jun 2015 18:09:33 +0000 (18:09 +0000)]
Add a comment and FIXME based on the commit message that made the
intrinsic _mm_prefetch into a builtin rather than by textual inclusion
via the intrinsic headers.
llvm-svn: 240152
Matt Arsenault [Fri, 19 Jun 2015 17:56:51 +0000 (17:56 +0000)]
AMDGPU: Fix filename in comment
llvm-svn: 240151
Matt Arsenault [Fri, 19 Jun 2015 17:55:06 +0000 (17:55 +0000)]
AMDGPU: Fix renamed file that was somehow dropped from last commit
llvm-svn: 240150
Rafael Espindola [Fri, 19 Jun 2015 17:54:28 +0000 (17:54 +0000)]
Make getRelocationSection MachO only.
There are 3 types of relocations on MachO
* Scattered
* Section based
* Symbol based
On ELF and COFF relocations are symbol based.
We were in the strange situation that we abstracted over two of them. This makes
section based relocations MachO only.
llvm-svn: 240149
Matt Arsenault [Fri, 19 Jun 2015 17:54:10 +0000 (17:54 +0000)]
AMDGPU: Fix places missed in rename
llvm-svn: 240148
Lang Hames [Fri, 19 Jun 2015 17:51:46 +0000 (17:51 +0000)]
[lld] Allow LLD passes to return error codes.
llvm-svn: 240147
Douglas Gregor [Fri, 19 Jun 2015 17:51:05 +0000 (17:51 +0000)]
Introduce type nullability specifiers for C/C++.
Introduces the type specifiers __nonnull, __nullable, and
__null_unspecified that describe the nullability of the pointer type
to which the specifier appertains. Nullability type specifiers improve
on the existing nonnull attributes in a few ways:
- They apply to types, so one can represent a pointer to a non-null
pointer, use them in function pointer types, etc.
- As type specifiers, they are syntactically more lightweight than
__attribute__s or [[attribute]]s.
- They can express both the notion of 'should never be null' and
also 'it makes sense for this to be null', and therefore can more
easily catch errors of omission where one forgot to annotate the
nullability of a particular pointer (this will come in a subsequent
patch).
Nullability type specifiers are maintained as type sugar, and
therefore have no effect on mangling, encoding, overloading,
etc. Nonetheless, they will be used for warnings about, e.g., passing
'null' to a method that does not accept it.
This is the C/C++ part of rdar://problem/
18868820.
llvm-svn: 240146
Alex Lorenz [Fri, 19 Jun 2015 17:43:07 +0000 (17:43 +0000)]
MIR Serialization: Serialize the list of machine basic blocks with simple attributes.
This commit implements the initial serialization of machine basic blocks in a
machine function. Only the simple, scalar MBB attributes are serialized. The
reference to LLVM IR's basic block is preserved when that basic block has a name.
Reviewers: Duncan P. N. Exon Smith
Differential Revision: http://reviews.llvm.org/D10465
llvm-svn: 240145
Michael Zolotukhin [Fri, 19 Jun 2015 17:40:15 +0000 (17:40 +0000)]
[SLP] Vectorize for all-constant entries.
Differential Revision: http://reviews.llvm.org/D10531
llvm-svn: 240144
Matt Arsenault [Fri, 19 Jun 2015 17:39:03 +0000 (17:39 +0000)]
AMDGPU: Fix some places missed in rename
llvm-svn: 240143
Alex Lorenz [Fri, 19 Jun 2015 17:36:02 +0000 (17:36 +0000)]
MIR Serialization: use default member initializers to initialize yaml::MachineFunction. NFC.
Default member initializers are permitted since r236244.
llvm-svn: 240142
Chad Rosier [Fri, 19 Jun 2015 17:32:57 +0000 (17:32 +0000)]
Typo. NFC.
llvm-svn: 240141
Douglas Katzman [Fri, 19 Jun 2015 17:21:02 +0000 (17:21 +0000)]
Avoid warning about inability to cast from ptr-to-obj to ptr-to-fun.
Use POSIX.1-2003 Technical Corrigendum 1 suggested workaround.
llvm-svn: 240140
Marshall Clow [Fri, 19 Jun 2015 17:13:59 +0000 (17:13 +0000)]
Fix ASAN bot; missing bookkeeping in r240136.
llvm-svn: 240139
Rafael Espindola [Fri, 19 Jun 2015 17:02:25 +0000 (17:02 +0000)]
Fix the lldb build for the EM_486 change.
llvm-svn: 240138
Alexander Kornienko [Fri, 19 Jun 2015 15:57:42 +0000 (15:57 +0000)]
Fixed/added namespace ending comments using clang-tidy. NFC
The patch is generated using this command:
tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \
-checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \
llvm/lib/
Thanks to Eugene Kosov for the original patch!
llvm-svn: 240137
Marshall Clow [Fri, 19 Jun 2015 15:54:13 +0000 (15:54 +0000)]
Fix PR#18843. Thanks to Howard for the fix
llvm-svn: 240136
Douglas Katzman [Fri, 19 Jun 2015 15:40:00 +0000 (15:40 +0000)]
Fix typo in comment.
llvm-svn: 240135
Douglas Katzman [Fri, 19 Jun 2015 14:55:19 +0000 (14:55 +0000)]
Add nominal support for 'shave' target.
This change passes through C and assembler jobs to Movidius tools by
constructing commands which are the same as ones produces by the examples
in the SDK. But rather than reference MV_TOOLS_DIR to find tools,
we will assume that binaries are installed wherever the Driver would
find its native tools. Similarly, this change assumes that -I options
will "just work" based on where SDK headers get installed, rather than
baking into the Driver some magic paths.
Differential Revision: http://reviews.llvm.org/D10440
llvm-svn: 240134
Rafael Espindola [Fri, 19 Jun 2015 14:34:12 +0000 (14:34 +0000)]
Fix the build.
Sorry, I have no idea how grep failed to find this.
llvm-svn: 240133
Rafael Espindola [Fri, 19 Jun 2015 14:22:16 +0000 (14:22 +0000)]
Replace EM_486 with EM_IAMCU.
This matches the current
http://www.sco.com/developers/gabi/latest/ch4.eheader.html#machine
llvm-svn: 240132
Alexander Potapenko [Fri, 19 Jun 2015 12:19:07 +0000 (12:19 +0000)]
[ASan] Initial support for Kernel AddressSanitizer
This patch adds initial support for the -fsanitize=kernel-address flag to Clang.
Right now it's quite restricted: only out-of-line instrumentation is supported, globals are not instrumented, some GCC kasan flags are not supported.
Using this patch I am able to build and boot the KASan tree with LLVMLinux patches from github.com/ramosian-glider/kasan/tree/kasan_llvmlinux.
To disable KASan instrumentation for a certain function attribute((no_sanitize("kernel-address"))) can be used.
llvm-svn: 240131
Rafael Espindola [Fri, 19 Jun 2015 12:16:55 +0000 (12:16 +0000)]
Make all temporary symbols unnamed.
What this does is make all symbols that would otherwise start with a .L
(or L on MachO) unnamed.
Some of these symbols still show up in the symbol table, but we can just
make them unnamed.
In order to make sure we produce identical results when going thought assembly,
all .L (not just the compiler produced ones), are now unnamed.
Running llc on llvm-as.opt.bc, the peak memory usage goes from 208.24MB to
205.57MB.
llvm-svn: 240130
Daniel Jasper [Fri, 19 Jun 2015 10:32:28 +0000 (10:32 +0000)]
clang-format: Make exception to AlwaysBreakBeforeMultilineStrings more
conservative.
In particular, this fixes an unwanted corner case.
Before:
string s =
someFunction("aaaa"
"bbbb");
After:
string s = someFunction(
"aaaa"
"bbbb");
llvm-svn: 240129
Daniel Jasper [Fri, 19 Jun 2015 08:23:10 +0000 (08:23 +0000)]
clang-format: Add TypeScript detection to git-clang-format.
llvm-svn: 240128
Daniel Jasper [Fri, 19 Jun 2015 08:17:32 +0000 (08:17 +0000)]
clang-format: Better fix to detect elaborated enum return types.
The previous one (r240021) regressed:
enum E Type::f() { .. }
llvm-svn: 240127
Alexey Bataev [Fri, 19 Jun 2015 08:09:27 +0000 (08:09 +0000)]
[ATTRIBUTE] Fixed test compatibility.
llvm-svn: 240126
Alexey Bataev [Fri, 19 Jun 2015 07:46:21 +0000 (07:46 +0000)]
[ATTRIBUTE] Support base vector types of __attribute__((mode)), patch by Alexey Frolov
Base type of attribute((mode)) can actually be a vector type.
The patch is to distinguish between base type and base element type.
This fixes http://llvm.org/PR17453.
Differential Revision: http://reviews.llvm.org/D10058
llvm-svn: 240125
Tobias Grosser [Fri, 19 Jun 2015 07:19:17 +0000 (07:19 +0000)]
IRBuilder: Add unit tests for construction of globals with address space
This was forgotten in r240113. Thanks Eric for paying attention.
llvm-svn: 240124
Bhushan D. Attarde [Fri, 19 Jun 2015 04:25:07 +0000 (04:25 +0000)]
[LLDB][MIPS] ABI Plugin for MIPS64
SUMMARY:
This patch implements ABI plugin for MIPS64.
Reviewers: clayborg
Subscribers: mohit.bhakkad, sagar, jaydeep, emaste, nitesh.jain, lldb-commits
Differential Revision: http://reviews.llvm.org/D10534
llvm-svn: 240123
Filipe Cabecinhas [Fri, 19 Jun 2015 03:45:42 +0000 (03:45 +0000)]
CMake: Stop using LLVM's custom parse_arguments (delete implementation). NFC
Summary:
Finally, delete LLVM's parse_arguments() definition.
Second part of D10531.
This is dependent on http://reviews.llvm.org/D10529
Reviewers: pcc, beanz, chapuni
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D10531
llvm-svn: 240122
Filipe Cabecinhas [Fri, 19 Jun 2015 03:45:40 +0000 (03:45 +0000)]
CMake: Stop using LLVM's custom parse_arguments. NFC
Summary:
Use CMake's cmake_parse_arguments() instead.
It's called in a slightly different way, but supports all our use cases.
It's in CMake 2.8.8, which is our minimum supported version.
CMake 3.0 doc (roughly the same. No direct link to 2.8.8 doc):
http://www.cmake.org/cmake/help/v3.0/module/CMakeParseArguments.html?highlight=cmake_parse_arguments
Reviewers: pcc, beanz, chapuni
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D10531
llvm-svn: 240121
Filipe Cabecinhas [Fri, 19 Jun 2015 03:39:24 +0000 (03:39 +0000)]
CMake: Stop using LLVM's custom parse_arguments. NFC
Summary:
Use CMake's cmake_parse_arguments() instead.
It's called in a slightly different way, but supports all our use cases.
It's in CMake 2.8.8, which is our minimum supported version.
CMake 3.0 doc (roughly the same. No direct link to 2.8.8 doc):
http://www.cmake.org/cmake/help/v3.0/module/CMakeParseArguments.html?highlight=cmake_parse_arguments
Since I was already changing these calls, I changed ARCH and LIB into
ARCHS and LIBS to make it more clear that they're lists of arguments.
Reviewers: eugenis, samsonov, beanz
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D10529
llvm-svn: 240120
Tobias Grosser [Fri, 19 Jun 2015 02:33:45 +0000 (02:33 +0000)]
Add NVIDIA vprintf printing to RuntimeDebugBuilder
2nd try, this time with the corresponding LLVM IRBuilder changes in place.
llvm-svn: 240119
Ahmed Bougacha [Fri, 19 Jun 2015 02:32:35 +0000 (02:32 +0000)]
[ARM] Look through concat when lowering in-place shuffles (VZIP, ..)
Currently, we canonicalize shuffles that produce a result larger than
their operands with:
shuffle(concat(v1, undef), concat(v2, undef))
->
shuffle(concat(v1, v2), undef)
because we can access quad vectors (see PerformVECTOR_SHUFFLECombine).
This is useful in the general case, but there are special cases where
native shuffles produce larger results: the two-result ops.
We can look through the concat when lowering them:
shuffle(concat(v1, v2), undef)
->
concat(VZIP(v1, v2):0, :1)
This lets us generate the native shuffles instead of scalarizing to
dozens of VMOVs.
Differential Revision: http://reviews.llvm.org/D10424
llvm-svn: 240118
Peter Collingbourne [Fri, 19 Jun 2015 02:30:43 +0000 (02:30 +0000)]
CFI: Implement bitset emission for the Microsoft ABI.
Clang's control flow integrity implementation works by conceptually attaching
"tags" (in the form of bitset entries) to each virtual table, identifying
the names of the classes that the virtual table is compatible with. Under
the Itanium ABI, it is simple to assign tags to virtual tables; they are
simply the address points, which are available via VTableLayout. Because any
overridden methods receive an entry in the derived class's virtual table,
a check for an overridden method call can always be done by checking the
tag of whichever derived class overrode the method call.
The Microsoft ABI is a little different, as it does not directly use address
points, and overrides in a derived class do not cause new virtual table entries
to be added to the derived class; instead, the slot in the base class is
reused, and the compiler needs to adjust the this pointer at the call site
to (generally) the base class that initially defined the method. After the
this pointer has been adjusted, we cannot check for the derived class's tag,
as the virtual table may not be compatible with the derived class. So we
need to determine which base class we have been adjusted to.
Specifically, at each call site, we use ASTRecordLayout to identify the most
derived class whose virtual table is laid out at the "this" pointer offset
we are using to make the call, and check the virtual table for that tag.
Because address point information is unavailable, we "reconstruct" it as
follows: any virtual tables we create for a non-derived class receive a tag
for that class, and virtual tables for a base class inside a derived class
receive a tag for the base class, together with tags for any derived classes
which are laid out at the same position as the derived class (and therefore
have compatible virtual tables).
Differential Revision: http://reviews.llvm.org/D10520
llvm-svn: 240117
Ahmed Bougacha [Fri, 19 Jun 2015 02:25:01 +0000 (02:25 +0000)]
[ARM] Factor out two-result shuffle matching. NFCI.
In preparation for a future patch: makes it easier to do the same
matching to generate different nodes, without duplication.
llvm-svn: 240116
Peter Collingbourne [Fri, 19 Jun 2015 02:24:25 +0000 (02:24 +0000)]
Fix Windows test failure.
llvm-svn: 240115
Ahmed Bougacha [Fri, 19 Jun 2015 02:15:34 +0000 (02:15 +0000)]
[ARM] Add D-sized vtrn/vuzp/vzip tests, and cleanup. NFC.
llvm-svn: 240114
Tobias Grosser [Fri, 19 Jun 2015 02:12:07 +0000 (02:12 +0000)]
IRBuilder: Allow globals to be constructed in a specific address space
llvm-svn: 240113
Eric Christopher [Fri, 19 Jun 2015 01:53:21 +0000 (01:53 +0000)]
Fix "the the" in comments.
llvm-svn: 240112
Peter Collingbourne [Fri, 19 Jun 2015 01:52:55 +0000 (01:52 +0000)]
Add control flow integrity diagnosis function to UBSan runtime library.
Also includes execution tests for the feature.
Differential Revision: http://reviews.llvm.org/D10269
llvm-svn: 240111
Eric Christopher [Fri, 19 Jun 2015 01:52:53 +0000 (01:52 +0000)]
Fix "the the" in comments/documentation/etc.
llvm-svn: 240110
Peter Collingbourne [Fri, 19 Jun 2015 01:51:54 +0000 (01:51 +0000)]
Implement diagnostic mode for -fsanitize=cfi*, -fsanitize=cfi-diag.
This causes programs compiled with this flag to print a diagnostic when
a control flow integrity check fails instead of aborting. Diagnostics are
printed using UBSan's runtime library.
The main motivation of this feature over -fsanitize=vptr is fidelity with
the -fsanitize=cfi implementation: the diagnostics are printed under exactly
the same conditions as those which would cause -fsanitize=cfi to abort the
program. This means that the same restrictions apply regarding compiling
all translation units with -fsanitize=cfi, cross-DSO virtual calls are
forbidden, etc.
Differential Revision: http://reviews.llvm.org/D10268
llvm-svn: 240109
Alexey Samsonov [Fri, 19 Jun 2015 01:34:06 +0000 (01:34 +0000)]
Revert "Revert "[CMake] LSan is not actually available on Darwin.""
Re-land fixed version of r239955.
llvm-svn: 240108
Evgeniy Stepanov [Fri, 19 Jun 2015 01:28:41 +0000 (01:28 +0000)]
[msan] Intercept fopencookie.
https://code.google.com/p/memory-sanitizer/issues/detail?id=86
llvm-svn: 240107
Peter Collingbourne [Fri, 19 Jun 2015 00:39:59 +0000 (00:39 +0000)]
Fix hexagon test failure.
llvm-svn: 240106
Peter Collingbourne [Thu, 18 Jun 2015 23:59:22 +0000 (23:59 +0000)]
Introduce -fsanitize-trap= flag.
This flag controls whether a given sanitizer traps upon detecting
an error. It currently only supports UBSan. The existing flag
-fsanitize-undefined-trap-on-error has been made an alias of
-fsanitize-trap=undefined.
This change also cleans up some awkward behavior around the combination
of -fsanitize-trap=undefined and -fsanitize=undefined. Previously we
would reject command lines containing the combination of these two flags,
as -fsanitize=vptr is not compatible with trapping. This required the
creation of -fsanitize=undefined-trap, which excluded -fsanitize=vptr
(and -fsanitize=function, but this seems like an oversight).
Now, -fsanitize=undefined is an alias for -fsanitize=undefined-trap,
and if -fsanitize-trap=undefined is specified, we treat -fsanitize=vptr
as an "unsupported" flag, which means that we error out if the flag is
specified explicitly, but implicitly disable it if the flag was implied
by -fsanitize=undefined.
Differential Revision: http://reviews.llvm.org/D10464
llvm-svn: 240105
Keno Fischer [Thu, 18 Jun 2015 23:45:51 +0000 (23:45 +0000)]
Don't link ObjCARCOpts twice. Fixes PR22543
ObjCARCOpts is already included by ClangCodeGen. Linking it again causes the error in PR22543.
Differential Revision: http://reviews.llvm.org/D10399
llvm-svn: 240104
Rui Ueyama [Thu, 18 Jun 2015 23:22:39 +0000 (23:22 +0000)]
COFF: Add /nodefaultlib and /merge for .drectve.
llvm-svn: 240077
Rui Ueyama [Thu, 18 Jun 2015 23:20:11 +0000 (23:20 +0000)]
COFF: Handle /include in .drectve.
We don't want to insert a new symbol to the symbol table while reading
a .drectve section because it's going to be too complicated.
That we are reading a directive section means that we are currently
reading some object file. Adding a new undefined symbol to the symbol
table can trigger a library file to read a new file, so it would make
the call stack too deep.
In this patch, I add new symbol names to a list to resolve them later.
llvm-svn: 240076
Rui Ueyama [Thu, 18 Jun 2015 23:04:26 +0000 (23:04 +0000)]
COFF: Allow identical alternatename options.
Alternatename option is in the form of /alternatename:<from>=<to>.
It is an error if there are two options having the same <from> but
different <to>. It is *not* an error if both are the same.
llvm-svn: 240075
Alex Lorenz [Thu, 18 Jun 2015 22:46:27 +0000 (22:46 +0000)]
MIR Serialization: Reenable one of the MIRParser tests by reverting r239805.
The test 'llvm/test/CodeGen/MIR/machine-function.mir' was disabled on
x86 msc18 in r239805 as it failed. My commit r240054 have fixed the
problem, so this commit reverts the commit that disabled the test as
it should pass now.
llvm-svn: 240074
Rafael Espindola [Thu, 18 Jun 2015 22:38:20 +0000 (22:38 +0000)]
Improve the --expand-relocs handling of MachO.
In a relocation target can take 3 basic forms
* A r_value in scattered relocations.
* A symbol in external relocations.
* A section is non-external relocations.
Have the dump reflect that. With this change we go from
CHECK-NEXT: Extern: 0
CHECK-NEXT: Type: X86_64_RELOC_SUBTRACTOR (5)
CHECK-NEXT: Symbol: 0x2
CHECK-NEXT: Scattered: 0
To just
// CHECK-NEXT: Type: X86_64_RELOC_SUBTRACTOR (5)
// CHECK-NEXT: Section: __data (2)
Since the relocation is with a section, we print the seciton name and don't
need to say that it is not scattered or external.
Someone motivated can add further special cases for things like
ARM64_RELOC_ADDEND and ARM_RELOC_PAIR.
llvm-svn: 240073
Yi Jiang [Thu, 18 Jun 2015 22:34:09 +0000 (22:34 +0000)]
Avoid redundant select node in early if-conversion pass
llvm-svn: 240072
Hans Wennborg [Thu, 18 Jun 2015 22:22:30 +0000 (22:22 +0000)]
Switch lowering: enable whole-switch jump tables at -O0.
To same compile time, the analysis to find dense case-clusters in switches is
not done at -O0. However, when the whole switch is dense enough, it is easy to
turn it into a jump table, resulting in much faster code with no extra effort.
llvm-svn: 240071
Jason Molenda [Thu, 18 Jun 2015 22:16:10 +0000 (22:16 +0000)]
Update comment about the UNWIND_X86_64_MODE_STACK_IND encoding
bug in old clang's.
llvm-svn: 240070
Rafael Espindola [Thu, 18 Jun 2015 22:12:47 +0000 (22:12 +0000)]
Pass --expand-relocs to a few more tests.
llvm-svn: 240069
Richard Smith [Thu, 18 Jun 2015 22:07:00 +0000 (22:07 +0000)]
[modules] Merging support for enums with a local definition prior to the first
imported definition.
llvm-svn: 240068
Rui Ueyama [Thu, 18 Jun 2015 21:50:38 +0000 (21:50 +0000)]
COFF: Unknown options in .drectve section is an error.
We skip unknown options in the command line with a warning message
being printed out, but we shouldn't do that for .drectve section.
The section is not visible to the user. We should handle unknown
options as an error.
llvm-svn: 240067
Jason Molenda [Thu, 18 Jun 2015 21:46:06 +0000 (21:46 +0000)]
Add a new wart, I mean feature, on to gdb-remote protocol: compression.
For some communication channels, sending large packets can be very
slow. In those cases, it may be faster to compress the contents of
the packet on the target device and decompress it on the debug host
system. For instance, communicating with a device using something
like Bluetooth may be an environment where this tradeoff is a good one.
This patch adds a new field to the response to the "qSupported" packet
(which returns a "qXfer:features:" response) -- SupportedCompressions
and DefaultCompressionMinSize. These tell you what the remote
stub can support.
lldb, if it wants to enable compression and can handle one of those
algorithms, it can send a QEnableCompression packet specifying the
algorithm and optionally the minimum packet size to use compression
on. lldb may have better knowledge about the best tradeoff for
a given communication channel.
I added support to debugserver an lldb to use the zlib APIs
(if -DHAVE_LIBZ=1 is in CFLAGS and -lz is in LDFLAGS) and the
libcompression APIs on Mac OS X 10.11 and later
(if -DHAVE_LIBCOMPRESSION=1). libz "zlib-deflate" compression.
libcompression can support deflate, lz4, lzma, and a proprietary
lzfse algorithm. libcompression has been hand-tuned for Apple
hardware so it should be preferred if available.
debugserver currently only adds the SupportedCompressions when
it is being run on an Apple watch (TARGET_OS_WATCH). Comment
that #if out from RNBRemote.cpp if you want to enable it to
see how it works. I haven't tested this on a native system
configuration but surely it will be slower to compress & decompress
the packets in a same-system debug session.
I haven't had a chance to add support for this to
GDBRemoteCommunciationServer.cpp yet.
<rdar://problem/
21090180>
llvm-svn: 240066
Alexey Samsonov [Thu, 18 Jun 2015 21:46:05 +0000 (21:46 +0000)]
[Driver] Compute MacOS/iOS version from triple if/when we actually need it. NFC.
llvm-svn: 240065
Sanjay Patel [Thu, 18 Jun 2015 21:44:31 +0000 (21:44 +0000)]
use SDValue bool operator; NFCI
llvm-svn: 240064
Sanjay Patel [Thu, 18 Jun 2015 21:34:26 +0000 (21:34 +0000)]
add test to show suboptimal load merging behavior
llvm-svn: 240063
Simon Pilgrim [Thu, 18 Jun 2015 21:26:01 +0000 (21:26 +0000)]
[X86][SSE][CostModel] Fixed uitofp/sitofp cost target tests to specify sse2/avx2/avx512f directly instead of via a cpu model.
llvm-svn: 240062