platform/upstream/llvm.git
9 years agoTargetInstrInfo.h: Fix r240192. [-Wdocumentation]
NAKAMURA Takumi [Sat, 20 Jun 2015 03:53:18 +0000 (03:53 +0000)]
TargetInstrInfo.h: Fix r240192. [-Wdocumentation]

llvm-svn: 240210

9 years agoSemaDeclObjC.cpp: Escape '@' in the comment. [-Wdocumentation]
NAKAMURA Takumi [Sat, 20 Jun 2015 03:52:52 +0000 (03:52 +0000)]
SemaDeclObjC.cpp: Escape '@' in the comment. [-Wdocumentation]

llvm-svn: 240209

9 years agoRevert "InstrProf: When reading, copy the data instead of taking a reference. NFC"
Justin Bogner [Sat, 20 Jun 2015 01:37:56 +0000 (01:37 +0000)]
Revert "InstrProf: When reading, copy the data instead of taking a reference. NFC"

Seems like MSVC doesn't like this:

  InstrProf.h(49) : error C2614: 'llvm::InstrProfRecord' : illegal member initialization: 'Hash' is not a base or member

This reverts r240206.

llvm-svn: 240208

9 years agoUse correct escaping for semicolon on Windows.
Peter Collingbourne [Sat, 20 Jun 2015 01:28:20 +0000 (01:28 +0000)]
Use correct escaping for semicolon on Windows.

llvm-svn: 240207

9 years agoInstrProf: When reading, copy the data instead of taking a reference. NFC
Justin Bogner [Sat, 20 Jun 2015 01:26:04 +0000 (01:26 +0000)]
InstrProf: When reading, copy the data instead of taking a reference. NFC

This consolidates the logic to read instrprof records into the on disk
hash table's lookup trait and makes us copy the counter data instead
of taking references to it as we read. This will simplify further
changes to the format.

Patch by Betul Buyukkurt.

llvm-svn: 240206

9 years agoLibDriver tests require x86 target.
Peter Collingbourne [Sat, 20 Jun 2015 01:14:37 +0000 (01:14 +0000)]
LibDriver tests require x86 target.

llvm-svn: 240205

9 years ago[modules] When determining whether a definition of a class is visible, check all...
Richard Smith [Sat, 20 Jun 2015 01:05:19 +0000 (01:05 +0000)]
[modules] When determining whether a definition of a class is visible, check all modules even if we've already found a definition that's not visible.

llvm-svn: 240204

9 years agoLibDriver: implement /libpath and $LIB; ignore /ignore and /machine.
Peter Collingbourne [Sat, 20 Jun 2015 00:57:12 +0000 (00:57 +0000)]
LibDriver: implement /libpath and $LIB; ignore /ignore and /machine.

llvm-svn: 240203

9 years ago[MCJIT] Add a FindGlobalVariableNamed utility
Keno Fischer [Sat, 20 Jun 2015 00:55:58 +0000 (00:55 +0000)]
[MCJIT] Add a FindGlobalVariableNamed utility

Summary: This adds FindGlobalVariableNamed to ExecutionEngine
(plus implementation in MCJIT), which is an analog of
FindFunctionNamed for GlobalVariables.

Reviewers: lhames

Reviewed By: lhames

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D10421

llvm-svn: 240202

9 years agoLowerSwitch: Avoid some undefined behaviour
Justin Bogner [Sat, 20 Jun 2015 00:28:25 +0000 (00:28 +0000)]
LowerSwitch: Avoid some undefined behaviour

When a case of INT64_MIN was followed by a case that was greater than
zero, we were overflowing a signed integer here. Since we've sorted
the cases here anyway (and thus currentValue must be greater than
nextValue) it's simple enough to avoid this by using addition rather
than subtraction.

Found by UBSAN on existing tests.

llvm-svn: 240201

9 years ago[modules] Refactor and slightly simplify class definition merging.
Richard Smith [Sat, 20 Jun 2015 00:22:34 +0000 (00:22 +0000)]
[modules] Refactor and slightly simplify class definition merging.

llvm-svn: 240200

9 years agoSuppress bogus gcc -Wreturn-type warnings.
Nico Weber [Sat, 20 Jun 2015 00:06:30 +0000 (00:06 +0000)]
Suppress bogus gcc -Wreturn-type warnings.

llvm-svn: 240199

9 years ago[Statepoint] Remove unnecessary argument from Statepoint::getRelocates
Sanjoy Das [Sat, 20 Jun 2015 00:01:03 +0000 (00:01 +0000)]
[Statepoint] Remove unnecessary argument from Statepoint::getRelocates

NFC.

llvm-svn: 240198

9 years ago[Statepoint][NFC] Fix include guard style.
Sanjoy Das [Sat, 20 Jun 2015 00:00:58 +0000 (00:00 +0000)]
[Statepoint][NFC] Fix include guard style.

llvm-svn: 240197

9 years agoYet another MSVC-related fix.
Douglas Gregor [Fri, 19 Jun 2015 23:59:55 +0000 (23:59 +0000)]
Yet another MSVC-related fix.

llvm-svn: 240196

9 years agoRevert 240130, it caused crashes (repro in PR23900).
Nico Weber [Fri, 19 Jun 2015 23:43:47 +0000 (23:43 +0000)]
Revert 240130, it caused crashes (repro in PR23900).

llvm-svn: 240193

9 years agoname change: hasPattern() -> getMachineCombinerPatterns() ; NFC
Sanjay Patel [Fri, 19 Jun 2015 23:21:42 +0000 (23:21 +0000)]
name change: hasPattern() -> getMachineCombinerPatterns() ; NFC

This was suggested as part of D10460, but it's independent of
any functional change.

llvm-svn: 240192

9 years ago[CallGraph] Given -print-callgraph a stable printing order.
Sanjoy Das [Fri, 19 Jun 2015 23:20:31 +0000 (23:20 +0000)]
[CallGraph] Given -print-callgraph a stable printing order.

Summary:
Since FunctionMap has llvm::Function pointers as keys, the order in
which the traversal happens can differ from run to run, causing spurious
FileCheck failures.  Have CallGraph::print sort the CallGraphNodes by
name before printing them.

Reviewers: bogner, chandlerc

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D10575

llvm-svn: 240191

9 years agoTry to fix the MSVC build
Douglas Gregor [Fri, 19 Jun 2015 23:18:05 +0000 (23:18 +0000)]
Try to fix the MSVC build

llvm-svn: 240190

9 years agoStop moving attributes off of a block literal's decl specifiers.
Douglas Gregor [Fri, 19 Jun 2015 23:18:03 +0000 (23:18 +0000)]
Stop moving attributes off of a block literal's decl specifiers.

These usually apply to the return type. At one point this was necessary to
get some of them to apply to the entire block, but it appears that's working
anyway (see block-return.c).

rdar://problem/20468034

llvm-svn: 240189

9 years agoHandle 'instancetype' in ParseDeclarationSpecifiers.
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

9 years agoMake -Wnullability-completeness work with -Wsystem-headers.
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

9 years agoCF_RETURNS_[NOT_]RETAINED on a param makes the inner pointer __nullable.
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

9 years agoAllow the cf_returns_[not_]retained attributes to appear on out-parameters.
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

9 years agoCOFF: Take reference to argument vector using std::vector::data() instead of operator...
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

9 years agoCOFF: Fix precedence between LIB and /libpath.
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

9 years agoTry to fix generation of LLVMExports.cmake under Visual Studio.
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

9 years agoCOFF: Add search paths in the correct order.
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

9 years ago[Sanitizers] Provide better diagnostic for sanitizers unsupported for target triple.
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

9 years agoCOFF: Cache Archive::Symbol::getName(). NFC.
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

9 years agoCOFF: Continue reading object files until converge.
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

9 years agoImprove error handling of getRelocationAddend.
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

9 years agoFix header path in CMake. NFC.
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

9 years agoMIR Parser: report an error when a basic block isn't found.
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

9 years agoFix the MacOSX build to include the Mips64 ABI plug-in.
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

9 years agoFix the clang -Werror build (-Wbraced-scalar-init)
David Blaikie [Fri, 19 Jun 2015 20:07:18 +0000 (20:07 +0000)]
Fix the clang -Werror build (-Wbraced-scalar-init)

llvm-svn: 240172

9 years agoFix a use of err_nullability_conflicting that's triggering an assertion.
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

9 years ago[CFI] Require -flto instead of implying it.
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

9 years agoFix no-asserts build failure due to unused variable, and cleanup some unique_ptr...
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

9 years agoAdd -flto to clang flags for cfi tests.
Alexey Samsonov [Fri, 19 Jun 2015 19:48:40 +0000 (19:48 +0000)]
Add -flto to clang flags for cfi tests.

llvm-svn: 240168

9 years agoSimplify Pass::perform to take a SimpleFile& instead of unique_ptr<SimpleFile>&
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

9 years agoAdd comment for workarond in DYLDRendezvous with android version
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

9 years ago[LoopDist] Rename RuntimeCheckEmitter to LoopVersioning, NFC
Adam Nemet [Fri, 19 Jun 2015 19:32:48 +0000 (19:32 +0000)]
[LoopDist] Rename RuntimeCheckEmitter to LoopVersioning, NFC

llvm-svn: 240165

9 years ago[LoopDist] Move pointer-to-partition computation out of RuntimeCheckEmitter, NFC
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

9 years agoFix illegal chars that snuck into <memory>
Marshall Clow [Fri, 19 Jun 2015 19:32:06 +0000 (19:32 +0000)]
Fix illegal chars that snuck into <memory>

llvm-svn: 240163

9 years agoFix build brakage caused by r240154
Tamas Berghammer [Fri, 19 Jun 2015 19:28:13 +0000 (19:28 +0000)]
Fix build brakage caused by r240154

llvm-svn: 240162

9 years agoCOFF: Don't add new undefined symbols for /alternatename.
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

9 years agoDelete dead code. NFC.
Rafael Espindola [Fri, 19 Jun 2015 19:07:59 +0000 (19:07 +0000)]
Delete dead code. NFC.

llvm-svn: 240160

9 years agoCode completion for nullability type specifiers.
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

9 years agoCheck for consistent use of nullability type specifiers in a header.
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

9 years agoLoad executable module when attaching to process; implement detach from process.
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

9 years agoIntroduced pragmas for audited nullability regions.
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

9 years agoImplement the 'null_resettable' attribute for Objective-C properties.
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

9 years agoExtend type nullability qualifiers for Objective-C.
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

9 years agoDiagnose unsafe uses of nil and __nonnull pointers.
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

9 years agoAdd a comment and FIXME based on the commit message that made the
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

9 years agoAMDGPU: Fix filename in comment
Matt Arsenault [Fri, 19 Jun 2015 17:56:51 +0000 (17:56 +0000)]
AMDGPU: Fix filename in comment

llvm-svn: 240151

9 years agoAMDGPU: Fix renamed file that was somehow dropped from last commit
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

9 years agoMake getRelocationSection MachO only.
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

9 years agoAMDGPU: Fix places missed in rename
Matt Arsenault [Fri, 19 Jun 2015 17:54:10 +0000 (17:54 +0000)]
AMDGPU: Fix places missed in rename

llvm-svn: 240148

9 years ago[lld] Allow LLD passes to return error codes.
Lang Hames [Fri, 19 Jun 2015 17:51:46 +0000 (17:51 +0000)]
[lld] Allow LLD passes to return error codes.

llvm-svn: 240147

9 years agoIntroduce type nullability specifiers for C/C++.
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

9 years agoMIR Serialization: Serialize the list of machine basic blocks with simple attributes.
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

9 years ago[SLP] Vectorize for all-constant entries.
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

9 years agoAMDGPU: Fix some places missed in rename
Matt Arsenault [Fri, 19 Jun 2015 17:39:03 +0000 (17:39 +0000)]
AMDGPU: Fix some places missed in rename

llvm-svn: 240143

9 years agoMIR Serialization: use default member initializers to initialize yaml::MachineFunctio...
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

9 years agoTypo. NFC.
Chad Rosier [Fri, 19 Jun 2015 17:32:57 +0000 (17:32 +0000)]
Typo. NFC.

llvm-svn: 240141

9 years agoAvoid warning about inability to cast from ptr-to-obj to ptr-to-fun.
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

9 years agoFix ASAN bot; missing bookkeeping in r240136.
Marshall Clow [Fri, 19 Jun 2015 17:13:59 +0000 (17:13 +0000)]
Fix ASAN bot; missing bookkeeping in r240136.

llvm-svn: 240139

9 years agoFix the lldb build for the EM_486 change.
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

9 years agoFixed/added namespace ending comments using clang-tidy. NFC
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

9 years agoFix PR#18843. Thanks to Howard for the fix
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

9 years agoFix typo in comment.
Douglas Katzman [Fri, 19 Jun 2015 15:40:00 +0000 (15:40 +0000)]
Fix typo in comment.

llvm-svn: 240135

9 years agoAdd nominal support for 'shave' target.
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

9 years agoFix the build.
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

9 years agoReplace EM_486 with EM_IAMCU.
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

9 years ago[ASan] Initial support for Kernel AddressSanitizer
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

9 years agoMake all temporary symbols unnamed.
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

9 years agoclang-format: Make exception to AlwaysBreakBeforeMultilineStrings more
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

9 years agoclang-format: Add TypeScript detection to git-clang-format.
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

9 years agoclang-format: Better fix to detect elaborated enum return types.
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

9 years ago[ATTRIBUTE] Fixed test compatibility.
Alexey Bataev [Fri, 19 Jun 2015 08:09:27 +0000 (08:09 +0000)]
[ATTRIBUTE] Fixed test compatibility.

llvm-svn: 240126

9 years ago[ATTRIBUTE] Support base vector types of __attribute__((mode)), patch by Alexey Frolov
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

9 years agoIRBuilder: Add unit tests for construction of globals with address space
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

9 years ago[LLDB][MIPS] ABI Plugin for MIPS64
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

9 years agoCMake: Stop using LLVM's custom parse_arguments (delete implementation). NFC
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

9 years agoCMake: Stop using LLVM's custom parse_arguments. NFC
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

9 years agoCMake: Stop using LLVM's custom parse_arguments. NFC
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

9 years agoAdd NVIDIA vprintf printing to RuntimeDebugBuilder
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

9 years ago[ARM] Look through concat when lowering in-place shuffles (VZIP, ..)
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

9 years agoCFI: Implement bitset emission for the Microsoft ABI.
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

9 years ago[ARM] Factor out two-result shuffle matching. NFCI.
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

9 years agoFix Windows test failure.
Peter Collingbourne [Fri, 19 Jun 2015 02:24:25 +0000 (02:24 +0000)]
Fix Windows test failure.

llvm-svn: 240115

9 years ago[ARM] Add D-sized vtrn/vuzp/vzip tests, and cleanup. NFC.
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

9 years agoIRBuilder: Allow globals to be constructed in a specific address space
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

9 years agoFix "the the" in comments.
Eric Christopher [Fri, 19 Jun 2015 01:53:21 +0000 (01:53 +0000)]
Fix "the the" in comments.

llvm-svn: 240112

9 years agoAdd control flow integrity diagnosis function to UBSan runtime library.
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

9 years agoFix "the the" in comments/documentation/etc.
Eric Christopher [Fri, 19 Jun 2015 01:52:53 +0000 (01:52 +0000)]
Fix "the the" in comments/documentation/etc.

llvm-svn: 240110

9 years agoImplement diagnostic mode for -fsanitize=cfi*, -fsanitize=cfi-diag.
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

9 years agoRevert "Revert "[CMake] LSan is not actually available on Darwin.""
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