platform/upstream/llvm.git
11 years agoRevert "Re-enable passing MS inline asm test."
Reid Kleckner [Mon, 21 Oct 2013 22:56:09 +0000 (22:56 +0000)]
Revert "Re-enable passing MS inline asm test."

Microsoft inline asm crashes on the hexagon bot for unknown reasons.

This reverts commit r193124.

llvm-svn: 193128

11 years agoRevert "Initialize some members where they are declared."
Rui Ueyama [Mon, 21 Oct 2013 22:37:14 +0000 (22:37 +0000)]
Revert "Initialize some members where they are declared."

Because MSVC11 doesn't like this new C++11 feature. The last commit
broke the buildbot.

llvm-svn: 193127

11 years agoDWARF type hashing: begin implementing Step 5, summary hashing in declarable contexts
David Blaikie [Mon, 21 Oct 2013 22:36:50 +0000 (22:36 +0000)]
DWARF type hashing: begin implementing Step 5, summary hashing in declarable contexts

There are several other tag types that need similar handling but to
ensure test coverage they'll be coming incrementally.

llvm-svn: 193126

11 years agoRemoving unnecessary link component for MCJIT unittests
Andrew Kaylor [Mon, 21 Oct 2013 22:35:06 +0000 (22:35 +0000)]
Removing unnecessary link component for MCJIT unittests

llvm-svn: 193125

11 years agoRe-enable passing MS inline asm test.
Reid Kleckner [Mon, 21 Oct 2013 22:30:53 +0000 (22:30 +0000)]
Re-enable passing MS inline asm test.

llvm-svn: 193124

11 years agoRevert "Refactor DynTypedMatcher into a value type class, just like Matcher<T>."
Reid Kleckner [Mon, 21 Oct 2013 22:26:36 +0000 (22:26 +0000)]
Revert "Refactor DynTypedMatcher into a value type class, just like Matcher<T>."

This reverts commit r193100.

It was failing to compile with MSVC 2012 while instantiating
llvm::Optional<DynTypedMatcher>.

llvm-svn: 193123

11 years agoInitialize some members where they are declared. No functionality change.
Rui Ueyama [Mon, 21 Oct 2013 22:25:02 +0000 (22:25 +0000)]
Initialize some members where they are declared. No functionality change.

llvm-svn: 193122

11 years agoDisable layout-transitivity test on Darwin for now.
Rui Ueyama [Mon, 21 Oct 2013 22:19:27 +0000 (22:19 +0000)]
Disable layout-transitivity test on Darwin for now.

llvm-svn: 193121

11 years agoUpdated and added to the Consumed documentation.
Chris Wailes [Mon, 21 Oct 2013 20:54:06 +0000 (20:54 +0000)]
Updated and added to the Consumed documentation.

llvm-svn: 193120

11 years agoDIEHashTest: Correct the order of operands to the TEST macro
David Blaikie [Mon, 21 Oct 2013 20:28:30 +0000 (20:28 +0000)]
DIEHashTest: Correct the order of operands to the TEST macro

And add the 'Test' suffix so the test case name matches the file name.

llvm-svn: 193119

11 years ago[AArch64] Add the constraint to NEON scalar mla/mls instructions.
Chad Rosier [Mon, 21 Oct 2013 20:12:01 +0000 (20:12 +0000)]
[AArch64] Add the constraint to NEON scalar mla/mls instructions.

llvm-svn: 193118

11 years ago[AArch64] Add the constraint to NEON scalar mla/mls instructions.
Chad Rosier [Mon, 21 Oct 2013 20:11:47 +0000 (20:11 +0000)]
[AArch64] Add the constraint to NEON scalar mla/mls instructions.

llvm-svn: 193117

11 years agoFix string assignment, David Blaikie suggestion.
Yaron Keren [Mon, 21 Oct 2013 20:07:37 +0000 (20:07 +0000)]
Fix string assignment, David Blaikie suggestion.

llvm-svn: 193116

11 years agoSimplifyCFG: Don't duplicate calls to functions marked noduplicate v2
Tom Stellard [Mon, 21 Oct 2013 20:07:30 +0000 (20:07 +0000)]
SimplifyCFG: Don't duplicate calls to functions marked noduplicate v2

v2:
  - Use CI->cannotDuplicate()

llvm-svn: 193115

11 years agoFixed breakpoints to be able to be set on eSymbolTypeReExported symbols and resolve...
Greg Clayton [Mon, 21 Oct 2013 20:04:47 +0000 (20:04 +0000)]
Fixed breakpoints to be able to be set on eSymbolTypeReExported symbols and resolve to the correct function. This allows setting a breakpoint on "memset" for iOS simulator binaries and the correct breakpoint will be set on "__platform_memset".

llvm-svn: 193114

11 years agoRemove unused TargetLowering field.
Matt Arsenault [Mon, 21 Oct 2013 20:04:01 +0000 (20:04 +0000)]
Remove unused TargetLowering field.

llvm-svn: 193113

11 years agoFix CodeGen for vectors of pointers with address spaces.
Matt Arsenault [Mon, 21 Oct 2013 20:03:58 +0000 (20:03 +0000)]
Fix CodeGen for vectors of pointers with address spaces.

llvm-svn: 193112

11 years agoFix CodeGen for different size address space GEPs
Matt Arsenault [Mon, 21 Oct 2013 20:03:54 +0000 (20:03 +0000)]
Fix CodeGen for different size address space GEPs

llvm-svn: 193111

11 years agoMake this test pass -verify.
Rafael Espindola [Mon, 21 Oct 2013 19:48:28 +0000 (19:48 +0000)]
Make this test pass -verify.

Instead of using not, just drop the fastcall attribute which was causing
an warning:

calling convention 'fastcall' ignored for this target

llvm-svn: 193110

11 years agoUse more type helper functions
Matt Arsenault [Mon, 21 Oct 2013 19:43:56 +0000 (19:43 +0000)]
Use more type helper functions

llvm-svn: 193109

11 years ago[lsan] When detect_leaks=false, be completely silent.
Sergey Matveev [Mon, 21 Oct 2013 19:35:00 +0000 (19:35 +0000)]
[lsan] When detect_leaks=false, be completely silent.

In particular, don't make a fuss if we're passed a malformed suppressions file,
or if we have trouble identifying ld.so. Also, make LSan interface functions
no-ops in this case.

llvm-svn: 193108

11 years agoReuse variable
Matt Arsenault [Mon, 21 Oct 2013 19:24:15 +0000 (19:24 +0000)]
Reuse variable

llvm-svn: 193107

11 years agoFix the build in DIE.cpp with MSVC 2010
Reid Kleckner [Mon, 21 Oct 2013 19:18:31 +0000 (19:18 +0000)]
Fix the build in DIE.cpp with MSVC 2010

llvm-svn: 193106

11 years agoDWARF type hashing: Handle multiple (including recursive) references to the same...
David Blaikie [Mon, 21 Oct 2013 18:59:40 +0000 (18:59 +0000)]
DWARF type hashing: Handle multiple (including recursive) references to the same type

This uses a map, keeping the type DIE numbering separate from the DIEs
themselves - alternatively we could do things the way GCC does if we
want to add an integer to the DIE type to record the numbering there.

llvm-svn: 193105

11 years agoTeach SimplifyCFG about address spaces
Matt Arsenault [Mon, 21 Oct 2013 18:55:08 +0000 (18:55 +0000)]
Teach SimplifyCFG about address spaces

llvm-svn: 193104

11 years agoIgnore -fstrength-reduce and -fno-strength-reduce.
Rafael Espindola [Mon, 21 Oct 2013 18:49:56 +0000 (18:49 +0000)]
Ignore -fstrength-reduce and -fno-strength-reduce.

GCC does the same.

llvm-svn: 193103

11 years agoFix creating bitcasts between address spaces in SCEV.
Matt Arsenault [Mon, 21 Oct 2013 18:41:10 +0000 (18:41 +0000)]
Fix creating bitcasts between address spaces in SCEV.

The test before wasn't successfully testing this
since it was missing the datalayout piece to change
the size of the second address space.

llvm-svn: 193102

11 years ago<rdar://problem/14496092>
Greg Clayton [Mon, 21 Oct 2013 18:40:51 +0000 (18:40 +0000)]
<rdar://problem/14496092>

Fixed an issue with reexported symbols on MacOSX by adding support for symbols re-exporting symbols. There is now a new symbol type eSymbolTypeReExported which contains a new name for the re-exported symbol and the new shared library. These symbols are only used when a symbol is re-exported as a symbol under a different name.

Modified the expression parser to be able to deal with finding the re-exported symbols and track down the actual symbol it refers to.

llvm-svn: 193101

11 years agoRefactor DynTypedMatcher into a value type class, just like Matcher<T>.
Samuel Benzaquen [Mon, 21 Oct 2013 18:40:51 +0000 (18:40 +0000)]
Refactor DynTypedMatcher into a value type class, just like Matcher<T>.

Summary:
Refactor DynTypedMatcher into a value type class, just like Matcher<T>.
This simplifies its usage and removes the virtual hierarchy from Matcher<T>.
It also enables planned changes to replace MatcherInteface<T>.
Too many instantiaions of this class hierarchy has been causing Registry.cpp.o to bloat in size and number of symbols.

Reviewers: klimek

CC: cfe-commits, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D1661

llvm-svn: 193100

11 years agoExtend test to show an alias can be before a definition.
Rafael Espindola [Mon, 21 Oct 2013 18:24:30 +0000 (18:24 +0000)]
Extend test to show an alias can be before a definition.

llvm-svn: 193099

11 years agoUse internal_memset to initialize this variable.
Peter Collingbourne [Mon, 21 Oct 2013 18:11:57 +0000 (18:11 +0000)]
Use internal_memset to initialize this variable.

Otherwise, the compiler may use memset in non-optimized builds, which is
forbidden in the nolibc part of the runtime.

llvm-svn: 193098

11 years agoRemove unused SCEV functions
Matt Arsenault [Mon, 21 Oct 2013 18:08:09 +0000 (18:08 +0000)]
Remove unused SCEV functions

llvm-svn: 193097

11 years agoX86 vector element shift-by-immediate instructions take i8 immediates. Make
Lang Hames [Mon, 21 Oct 2013 17:51:24 +0000 (17:51 +0000)]
X86 vector element shift-by-immediate instructions take i8 immediates. Make
the instruction defenitions and ISEL reflect this.

Prior to this patch these instructions took an i32i8imm, and the high bits were
dropped during encoding. This led to incorrect behavior for shifts by
immediates higher than 255. This patch fixes that issue by detecting large
immediate shifts and returning constant zero (for logical shifts) or capping
the shift amount at an encodable value (for arithmetic shifts).

Fixes <rdar://problem/14968098>

llvm-svn: 193096

11 years agoFix up some old review feedback.
Eric Christopher [Mon, 21 Oct 2013 17:48:51 +0000 (17:48 +0000)]
Fix up some old review feedback.

llvm-svn: 193095

11 years agoImproving MCJIT/RuntimeDyld thread safety
Andrew Kaylor [Mon, 21 Oct 2013 17:42:06 +0000 (17:42 +0000)]
Improving MCJIT/RuntimeDyld thread safety

llvm-svn: 193094

11 years agoCleanup redundant include.
Rafael Espindola [Mon, 21 Oct 2013 17:34:39 +0000 (17:34 +0000)]
Cleanup redundant include.

Patch by Daniel Marjamäki.

llvm-svn: 193093

11 years agoGet rid of the FooStructSynth, it was a testing thing I put in and forgot to remove
Enrico Granata [Mon, 21 Oct 2013 17:29:51 +0000 (17:29 +0000)]
Get rid of the FooStructSynth, it was a testing thing I put in and forgot to remove
Hopefully nobody had a struct Foo in their app:-)

llvm-svn: 193092

11 years agoDebugInfo: Put each kind of constant (form, attribute, tag, etc) into its own enum...
David Blaikie [Mon, 21 Oct 2013 17:28:37 +0000 (17:28 +0000)]
DebugInfo: Put each kind of constant (form, attribute, tag, etc) into its own enum for ease of use.

This allows various variables to be more self-documenting and easier to
debug by being of specific types without overlapping enum values.

Precommit review by Eric Christopher.

llvm-svn: 193091

11 years agoOptimize more linkonce_odr values during LTO.
Rafael Espindola [Mon, 21 Oct 2013 17:14:55 +0000 (17:14 +0000)]
Optimize more linkonce_odr values during LTO.

When a linkonce_odr value that is on the dso list is not unnamed_addr
we can still look to see if anything is actually using its address. If
not, it is safe to hide it.

This patch implements that by moving GlobalStatus to Transforms/Utils
and using it in Internalize.

llvm-svn: 193090

11 years agoDebugInfo: Hash DW_FORM_GNU_str_index as a string.
David Blaikie [Mon, 21 Oct 2013 16:37:22 +0000 (16:37 +0000)]
DebugInfo: Hash DW_FORM_GNU_str_index as a string.

Found while adding type safety to the various DWARF enumerations (form,
attribute, tag, etc) that caused Clang to warn on an incompletely
covered switch. Converting the comment to a default/unreachable
uncovered this case of an unsupported form encoding. Seems we were
skipping fission strings entirely.

llvm-svn: 193089

11 years agoPatch by GM: Turn off 'deprecated' warnings when building with MSVC, and add '-Werror...
Marshall Clow [Mon, 21 Oct 2013 15:56:35 +0000 (15:56 +0000)]
Patch by GM: Turn off 'deprecated' warnings when building with MSVC, and add '-Werror=return-type' to catch funtions that aren't returning what they should.

llvm-svn: 193088

11 years agoPatch by GM: apparently '__value' (two underscores) is a special name in Visual Studi...
Marshall Clow [Mon, 21 Oct 2013 15:43:25 +0000 (15:43 +0000)]
Patch by GM: apparently '__value' (two underscores) is a special name in Visual Studio, so rename the private method in <regex> with that name. GM's patch used  '___value' (three underscores), but I changed that to '__regex_traits_value' because I've been burned in the past by identifiers that appear identical but are not.

llvm-svn: 193087

11 years agoPatch from GM: locale.cpp; make implicit conversions to bool explicit, fix some ...
Marshall Clow [Mon, 21 Oct 2013 15:07:28 +0000 (15:07 +0000)]
Patch from GM: locale.cpp; make implicit conversions to bool explicit, fix some 'unknown pragma' warnings when compiling under MSVC, and don't use the __sso_allocator under windows, b/c MSVC doesn't support aligned-by value parameters

llvm-svn: 193086

11 years agoPatch by GM: Making implicit conversion to bool explicit in <ios> and <__locale>
Marshall Clow [Mon, 21 Oct 2013 14:41:05 +0000 (14:41 +0000)]
Patch by GM: Making implicit conversion to bool explicit in <ios> and <__locale>

llvm-svn: 193085

11 years agoPatch by GM: Adding MSVC support to __bit_reference
Marshall Clow [Mon, 21 Oct 2013 14:29:37 +0000 (14:29 +0000)]
Patch by GM: Adding MSVC support to __bit_reference

llvm-svn: 193084

11 years agoAVX-512: MUL operation lowering for v8i64
Elena Demikhovsky [Mon, 21 Oct 2013 13:27:34 +0000 (13:27 +0000)]
AVX-512: MUL operation lowering for v8i64

llvm-svn: 193083

11 years ago[mips][msa] Direct Object Emission support for LD/ST instructions.
Matheus Almeida [Mon, 21 Oct 2013 13:07:13 +0000 (13:07 +0000)]
[mips][msa] Direct Object Emission support for LD/ST instructions.

llvm-svn: 193082

11 years ago[mips][msa] Direct Object Emission support for LDI instructions.
Matheus Almeida [Mon, 21 Oct 2013 12:56:20 +0000 (12:56 +0000)]
[mips][msa] Direct Object Emission support for LDI instructions.

llvm-svn: 193081

11 years ago[mips][msa] Direct Object Emission support for MOVE.v.
Matheus Almeida [Mon, 21 Oct 2013 12:43:54 +0000 (12:43 +0000)]
[mips][msa] Direct Object Emission support for MOVE.v.

llvm-svn: 193080

11 years agoDriver: Various string-related cleanups.
Benjamin Kramer [Mon, 21 Oct 2013 12:33:55 +0000 (12:33 +0000)]
Driver: Various string-related cleanups.

Also fixes some funky formatting.

llvm-svn: 193079

11 years ago[mips][msa] Direct Object Emission support for CTCMSA and CFCMSA.
Matheus Almeida [Mon, 21 Oct 2013 12:26:50 +0000 (12:26 +0000)]
[mips][msa] Direct Object Emission support for CTCMSA and CFCMSA.

These instructions are logically related as they allow read/write of MSA control registers.
Currently MSA control registers are emitted by number but hopefully that will change as soon
as GAS starts accepting them by name as that would make the assembly easier to read.

llvm-svn: 193078

11 years ago[mips][msa] Direct Object Emission of SPLAT instruction.
Matheus Almeida [Mon, 21 Oct 2013 12:07:26 +0000 (12:07 +0000)]
[mips][msa] Direct Object Emission of SPLAT instruction.

llvm-svn: 193077

11 years ago[mips][msa] Fix definition of SLD instruction.
Matheus Almeida [Mon, 21 Oct 2013 11:47:56 +0000 (11:47 +0000)]
[mips][msa] Fix definition of SLD instruction.

The second parameter of the SLD intrinsic is the number of columns (GPR) to
slide left the source array.

llvm-svn: 193076

11 years agoSet the default hardware division features for ARM cpus. Also set it as default for...
Silviu Baranga [Mon, 21 Oct 2013 10:59:33 +0000 (10:59 +0000)]
Set the default hardware division features for ARM cpus. Also set it as default for A32 armv8.

llvm-svn: 193075

11 years agoAdd the __ARM_ARCH_EXT_IDIV__ predefine. It is set to 1 if we have hardware divide...
Silviu Baranga [Mon, 21 Oct 2013 10:54:53 +0000 (10:54 +0000)]
Add the __ARM_ARCH_EXT_IDIV__ predefine. It is set to 1 if we have hardware divide in the mode that we are compiling in (depending on the target features), not defined if we don't. Should be compatible with the GCC conterpart. Also adding a -hwdiv option to overide the default behavior.

llvm-svn: 193074

11 years agoFix to PR8880 (clang dies processing a for loop).
Serge Pavlov [Mon, 21 Oct 2013 09:34:44 +0000 (09:34 +0000)]
Fix to PR8880 (clang dies processing a for loop).

Due to statement expressions supported as GCC extension, it is possible
to put 'break' or 'continue' into a loop/switch statement but outside its
body, for example:

    for ( ; ({ if (first) { first = 0; continue; } 0; }); )

Such usage must be diagnosed as an error, GCC rejects it. To recognize
this and similar patterns the flags BreakScope and ContinueScope are
temporarily turned off while parsing condition expression.

Differential Revision: http://llvm-reviews.chandlerc.com/D1762

llvm-svn: 193073

11 years ago[asan] count the size of QuarantineBatch in the total Quarantine size; make Quarantin...
Kostya Serebryany [Mon, 21 Oct 2013 08:36:10 +0000 (08:36 +0000)]
[asan] count the size of QuarantineBatch in the total Quarantine size; make QuarantineBatch fit into 8K, fix a MSVC compile warning

llvm-svn: 193072

11 years agoFixes PR17617: Crash on joining short if statements.
Manuel Klimek [Mon, 21 Oct 2013 08:11:15 +0000 (08:11 +0000)]
Fixes PR17617: Crash on joining short if statements.

Now that we iterate on the formatting multiple times when we
have chains of preprocessor branches, we need to correctly reset
the token's previous and next pointer for the first / last token.

llvm-svn: 193071

11 years agotsan: fix strerror interceptor (eliminate false positives)
Dmitry Vyukov [Mon, 21 Oct 2013 07:40:19 +0000 (07:40 +0000)]
tsan: fix strerror interceptor (eliminate false positives)

llvm-svn: 193070

11 years agoExpose -fmodule-name and -fmodule-map-file as driver options.
Daniel Jasper [Mon, 21 Oct 2013 06:34:34 +0000 (06:34 +0000)]
Expose -fmodule-name and -fmodule-map-file as driver options.

Review: http://llvm-reviews.chandlerc.com/D1974
llvm-svn: 193069

11 years agoFix the predecessor removal logic in r193045.
Michael Gottesman [Mon, 21 Oct 2013 05:20:11 +0000 (05:20 +0000)]
Fix the predecessor removal logic in r193045.

Additionally some small comment/stylistic fixes are included as well.

llvm-svn: 193068

11 years agoLex: Don't restrict legal UCNs when preprocessing assembly
Justin Bogner [Mon, 21 Oct 2013 05:02:28 +0000 (05:02 +0000)]
Lex: Don't restrict legal UCNs when preprocessing assembly

The C and C++ standards disallow using universal character names to
refer to some characters, such as basic ascii and control characters,
so we reject these sequences in the lexer. However, when the
preprocessor isn't being used on C or C++, it doesn't make sense to
apply these restrictions.

Notably, accepting these characters avoids issues with unicode escapes
when GHC uses the compiler as a preprocessor on haskell sources.

Fixes rdar://problem/14742289

llvm-svn: 193067

11 years agoAvoid using the name 'bzero' for an enumerator in global scope. <strings.h> might...
Richard Smith [Mon, 21 Oct 2013 04:59:37 +0000 (04:59 +0000)]
Avoid using the name 'bzero' for an enumerator in global scope. <strings.h> might declare this as a function.

llvm-svn: 193066

11 years ago[-fms-extensions] __is_interface_class was miscategorized
David Majnemer [Mon, 21 Oct 2013 04:55:56 +0000 (04:55 +0000)]
[-fms-extensions] __is_interface_class was miscategorized

We claimed that the __is_interface_class keyword was KEYCXX even though
the __interface keyword was KEYMS.

llvm-svn: 193065

11 years agoDon't eliminate a partially redundant load if it's in a landing pad.
Bill Wendling [Mon, 21 Oct 2013 04:09:17 +0000 (04:09 +0000)]
Don't eliminate a partially redundant load if it's in a landing pad.

A landing pad can be jumped to only by the unwind edge of an invoke
instruction. If we eliminate a partially redundant load in a landing pad, it
will create a basic block that violates this constraint. It then leads to other
problems down the line if it tries to merge that basic block with the landing
pad. Avoid this by not eliminating the load in a landing pad.

PR17621

llvm-svn: 193064

11 years agoFix typo in test's XFAIL line. Patch by Dimitry Andric!
Nick Lewycky [Mon, 21 Oct 2013 00:46:21 +0000 (00:46 +0000)]
Fix typo in test's XFAIL line. Patch by Dimitry Andric!

llvm-svn: 193063

11 years agoSema: Explain our deviation from the standard by referencing the, now open, LWG issue.
David Majnemer [Mon, 21 Oct 2013 00:25:32 +0000 (00:25 +0000)]
Sema: Explain our deviation from the standard by referencing the, now open, LWG issue.

llvm-svn: 193062

11 years agoBe more precise when diagnosing 'inline' on global replacement functions
David Majnemer [Mon, 21 Oct 2013 00:22:03 +0000 (00:22 +0000)]
Be more precise when diagnosing 'inline' on global replacement functions

llvm-svn: 193061

11 years agoRuntime support for the indirect function call checker.
Peter Collingbourne [Sun, 20 Oct 2013 21:29:46 +0000 (21:29 +0000)]
Runtime support for the indirect function call checker.

Differential Revision: http://llvm-reviews.chandlerc.com/D1339

llvm-svn: 193060

11 years ago[ubsan] Introduce %clangxx substitution for all C++ tests.
Peter Collingbourne [Sun, 20 Oct 2013 21:29:32 +0000 (21:29 +0000)]
[ubsan] Introduce %clangxx substitution for all C++ tests.

llvm-svn: 193059

11 years agoImplement function type checker for the undefined behavior sanitizer.
Peter Collingbourne [Sun, 20 Oct 2013 21:29:19 +0000 (21:29 +0000)]
Implement function type checker for the undefined behavior sanitizer.

This uses function prefix data to store function type information at the
function pointer.

Differential Revision: http://llvm-reviews.chandlerc.com/D1338

llvm-svn: 193058

11 years agoRevert r193022 and r193048. They broke the ubsan test suite.
Peter Collingbourne [Sun, 20 Oct 2013 21:29:13 +0000 (21:29 +0000)]
Revert r193022 and r193048.  They broke the ubsan test suite.

llvm-svn: 193057

11 years agoSwitch attribute test line endings from CRLF
Alp Toker [Sun, 20 Oct 2013 19:04:19 +0000 (19:04 +0000)]
Switch attribute test line endings from CRLF

The convention is LF unless specifically testing line endings.

llvm-svn: 193056

11 years agoFix crash in cleanup attr handling
Alp Toker [Sun, 20 Oct 2013 18:48:56 +0000 (18:48 +0000)]
Fix crash in cleanup attr handling

ResolveSingleFunctionTemplateSpecialization() returns 0 and doesn't emit diags
unless the expression has template-ids, so we must null check the result.

Also add a better diag noting which overloads are causing the problem.

Reviewed by Aaron Ballman.

llvm-svn: 193055

11 years agoclang-format: Better understand Lambda poarameters.
Daniel Jasper [Sun, 20 Oct 2013 18:15:30 +0000 (18:15 +0000)]
clang-format: Better understand Lambda poarameters.

Before:
  auto PointerBinding = [](const char * S) {};

After:
  auto PointerBinding = [](const char *S) {};

This fixes llvm.org/PR17618.

llvm-svn: 193054

11 years agoFix python-free build.
Joerg Sonnenberger [Sun, 20 Oct 2013 17:36:05 +0000 (17:36 +0000)]
Fix python-free build.

llvm-svn: 193053

11 years agoMake sure switch covers all values.
Joerg Sonnenberger [Sun, 20 Oct 2013 17:35:46 +0000 (17:35 +0000)]
Make sure switch covers all values.

llvm-svn: 193052

11 years agoclang-format: Fix formatting of nested blocks after comment.
Daniel Jasper [Sun, 20 Oct 2013 17:28:32 +0000 (17:28 +0000)]
clang-format: Fix formatting of nested blocks after comment.

Before:
  DEBUG({ // Comment that used to confuse clang-format.
  fdafas();
  });
Before:
  DEBUG({ // Comments are now fine.
    fdafas();
  });

This fixed llvm.org/PR17619.

llvm-svn: 193051

11 years agoclang-format: Support case ranges.
Daniel Jasper [Sun, 20 Oct 2013 16:56:16 +0000 (16:56 +0000)]
clang-format: Support case ranges.

Before (note the missing space before "..." which can lead to compile
errors):
  switch (x) {
    case 'A'... 'Z':
    case 1... 5:
        break;
  }

After:
  switch (x) {
    case 'A' ... 'Z':
    case 1 ... 5:
        break;
  }

llvm-svn: 193050

11 years agoclang-format: Improve formatting of ObjC dict literals.
Daniel Jasper [Sun, 20 Oct 2013 16:45:46 +0000 (16:45 +0000)]
clang-format: Improve formatting of ObjC dict literals.

Before:
  NSDictionary *d = @{ @"nam" : NSUserNam(), @"dte" : [NSDate date],
                       @"processInfo" : [NSProcessInfo processInfo]
  };

After:
  NSDictionary *d = @{
    @"nam" : NSUserNam(),
    @"dte" : [NSDate date],
    @"processInfo" : [NSProcessInfo processInfo]
  };

llvm-svn: 193049

11 years agoDriver: libubsan_cxx depends on libubsan. Preserve the topological ordering, some...
Benjamin Kramer [Sun, 20 Oct 2013 12:34:18 +0000 (12:34 +0000)]
Driver: libubsan_cxx depends on libubsan. Preserve the topological ordering, some linkers depend on it.

llvm-svn: 193048

11 years agoForgot some references to misspelled enums.
Benjamin Kramer [Sun, 20 Oct 2013 11:53:20 +0000 (11:53 +0000)]
Forgot some references to misspelled enums.

llvm-svn: 193047

11 years agoMiscellaneous speling fixes.
Benjamin Kramer [Sun, 20 Oct 2013 11:47:15 +0000 (11:47 +0000)]
Miscellaneous speling fixes.

llvm-svn: 193046

11 years agoTeach simplify-cfg how to correctly create covered lookup tables for switches on...
Michael Gottesman [Sun, 20 Oct 2013 07:04:37 +0000 (07:04 +0000)]
Teach simplify-cfg how to correctly create covered lookup tables for switches on iN with N >= 3.

One optimization simplify-cfg performs is the converting of switches to
lookup tables if the switch has > 4 cases. This is done by:

1. Finding the max/min case value and calculating the switch case range.
2. Create a lookup table basic block.
3. Perform a check in the switch's BB to see if the input value is in
the switch's case range. If the input value satisfies said predicate
branch to the lookup table BB, otherwise branch to the switch's default
destination BB using the default value as the result.

The conditional check consists of subtracting the min case value of the
table from any input iN value and then ensuring that said value is
unsigned less than the size of the lookup table represented as an iN
value.

If the lookup table is a covered lookup table, the size of the table will be N
which is 0 as an iN value. Thus the comparison will be an `icmp ult` of an iN
value against 0 which is always false yielding the incorrect result.

This patch fixes this problem by recognizing if we have a covered lookup table
and if we do, unconditionally jumps to the lookup table BB since the covering
property of the lookup table implies no input values could not be handled by
said BB.

rdar://15268442

llvm-svn: 193045

11 years agoSema: Diagnose global replacement functions declared as inline
David Majnemer [Sun, 20 Oct 2013 05:40:29 +0000 (05:40 +0000)]
Sema: Diagnose global replacement functions declared as inline

This fixes PR17591.

N.B. This actually goes beyond what the standard mandates by requiring
the restriction to hold for declarations instead of definitions.  This
is believed to be a defect in the standard and an LWG issue has been
submitted.

llvm-svn: 193044

11 years agoTypo.
Peter Collingbourne [Sun, 20 Oct 2013 03:19:25 +0000 (03:19 +0000)]
Typo.

llvm-svn: 193043

11 years agoEmit prefix data after debug and EH directives.
Peter Collingbourne [Sun, 20 Oct 2013 02:16:21 +0000 (02:16 +0000)]
Emit prefix data after debug and EH directives.

This ensures that the prefix data is treated as part of the function for
the purpose of debug info.  This provides a better debugging experience,
among other things by allowing a debug info client to correctly look up
a function in debug info given a function pointer.

llvm-svn: 193042

11 years agoEmit DWARF line entries for all data in the instruction stream.
Peter Collingbourne [Sun, 20 Oct 2013 02:16:18 +0000 (02:16 +0000)]
Emit DWARF line entries for all data in the instruction stream.

r182712 attempted to do this, but it failed to handle data emitted via
EmitBytes.

llvm-svn: 193041

11 years agoAdd a missing getMostRecentDecl to ClassTemplateDecl.
Rafael Espindola [Sat, 19 Oct 2013 21:06:31 +0000 (21:06 +0000)]
Add a missing getMostRecentDecl to ClassTemplateDecl.

llvm-svn: 193040

11 years agoSimplify some implementations of get*Decl.
Rafael Espindola [Sat, 19 Oct 2013 16:55:03 +0000 (16:55 +0000)]
Simplify some implementations of get*Decl.

* NamedDecl and CXXMethodDecl were missing getMostRecentDecl.
* The const version can just forward to the non const.
* getMostRecentDecl can use cast instead of cast_or_null.

This then removes some casts from the callers.

llvm-svn: 193039

11 years agoRemove unused variable.
Benjamin Kramer [Sat, 19 Oct 2013 16:32:15 +0000 (16:32 +0000)]
Remove unused variable.

llvm-svn: 193038

11 years agoThis should use the possessive adjective.
Rafael Espindola [Sat, 19 Oct 2013 16:14:07 +0000 (16:14 +0000)]
This should use the possessive adjective.

Thanks to David Blaikie for noticing it.

llvm-svn: 193037

11 years agoComment improvement.
Rafael Espindola [Sat, 19 Oct 2013 13:08:51 +0000 (13:08 +0000)]
Comment improvement.

Thanks to Sean Silva for the suggestion.

llvm-svn: 193036

11 years agoPerform an intelligent splice of the predecessor with the single successor.
Bill Wendling [Sat, 19 Oct 2013 11:27:12 +0000 (11:27 +0000)]
Perform an intelligent splice of the predecessor with the single successor.

If the predecessor's being spliced into a landing pad, then we need the PHIs to
come first and the rest of the predecessor's code to come *after* the landing
pad instruction.

llvm-svn: 193035

11 years agoAvoid duplicate search by reusing the iterator.
Yaron Keren [Sat, 19 Oct 2013 09:04:26 +0000 (09:04 +0000)]
Avoid duplicate search by reusing the iterator.

llvm-svn: 193034

11 years agoAdded comments from Andrew Kaylor.
Yaron Keren [Sat, 19 Oct 2013 09:03:20 +0000 (09:03 +0000)]
Added comments from Andrew Kaylor.

llvm-svn: 193033

11 years agoAdd irreader to the component list, because ParseIR is called.
Bill Wendling [Sat, 19 Oct 2013 08:33:11 +0000 (08:33 +0000)]
Add irreader to the component list, because ParseIR is called.

llvm-svn: 193032

11 years agoRemove NDBEUG from all release types compile flags.
Yaron Keren [Sat, 19 Oct 2013 07:30:37 +0000 (07:30 +0000)]
Remove NDBEUG from all release types compile flags.

llvm-svn: 193031

11 years agoSimplify WinLinkDriver. No functionality change.
Rui Ueyama [Sat, 19 Oct 2013 03:34:00 +0000 (03:34 +0000)]
Simplify WinLinkDriver. No functionality change.

llvm-svn: 193030

11 years agoFix bug that CompareAtoms::compare is not transitive.
Rui Ueyama [Sat, 19 Oct 2013 03:18:18 +0000 (03:18 +0000)]
Fix bug that CompareAtoms::compare is not transitive.

This patch fixes a bug in r190608. The results of a comparison function
passed to std::sort must be transitive, which is, if a < b and b < c, and if
a != b, a < c must be also true. CompareAtoms::compare did not actually
guarantee the transitivity. As a result the sort results were sometimes just
wrong.

Consider there are three atoms, X, Y, and Z, whose file ordinals are 1, 2, 3,
respectively. Z has a property "layout-after X". In this case, all the
following conditionals become true:

  X < Y because X's ordinal is less than Y's
  Y < Z because Y's ordinal is less than Z's
  Z < X because of the layout-after relationship

This is not of course transitive. The reason why this happened is because
we used follow-on relationships for comparison if two atoms falls in the same
follow-on chain, but we used each atom's properties if they did not. This patch
fixes the issue by using follow-on root atoms for comparison to get consistent
results.

Differential Revision: http://llvm-reviews.chandlerc.com/D1980

llvm-svn: 193029