platform/upstream/llvm.git
11 years agoPPC: Prep for if conversion of bctr[l]
Hal Finkel [Wed, 10 Apr 2013 06:42:34 +0000 (06:42 +0000)]
PPC: Prep for if conversion of bctr[l]

This adds in-principle support for if-converting the bctr[l] instructions.
These instructions are used for indirect branching. It seems, however, that the
current if converter will never actually predicate these. To do so, it would
need the ability to hoist a few setup insts. out of the conditionally-executed
block. For example, code like this:
  void foo(int a, int (*bar)()) { if (a != 0) bar(); }
becomes:
        ...
        beq 0, .LBB0_2
        std 2, 40(1)
        mr 12, 4
        ld 3, 0(4)
        ld 11, 16(4)
        ld 2, 8(4)
        mtctr 3
        bctrl
        ld 2, 40(1)
.LBB0_2:
        ...
and it would be safe to do all of this unconditionally with a predicated
beqctrl instruction.

llvm-svn: 179156

11 years agoHandle "typeof" in Objective-C format string checking. This previously crashed.
Ted Kremenek [Wed, 10 Apr 2013 06:26:26 +0000 (06:26 +0000)]
Handle "typeof" in Objective-C format string checking.  This previously crashed.

Yes, this came from actual code.

Fixes <rdar://problem/13557053>.

llvm-svn: 179155

11 years agoAdd support for computing the exception specification for an inheriting
Richard Smith [Wed, 10 Apr 2013 06:11:48 +0000 (06:11 +0000)]
Add support for computing the exception specification for an inheriting
constructor. This isn't quite perfect (as usual, we don't handle default
arguments correctly yet, and we don't deal with copy/move constructors for
arguments correctly either, but this will be fixed when we implement core issue
1351.

This completes our support for inheriting constructors.

llvm-svn: 179154

11 years agoDon't crash when mangling types defined in ObjC class extensions.
John McCall [Wed, 10 Apr 2013 06:08:21 +0000 (06:08 +0000)]
Don't crash when mangling types defined in ObjC class extensions.

The original test case here was mangling a type name for TBAA,
but we can provoke this in C++11 easily enough.

rdar://13434937

llvm-svn: 179153

11 years agoWhen ObjectFileMachO::ParseSections() notices that it has a truncated file, zero...
Jason Molenda [Wed, 10 Apr 2013 05:58:57 +0000 (05:58 +0000)]
When ObjectFileMachO::ParseSections() notices that it has a truncated file, zero out the
SectionList so we don't try to do anything with this file.  Currently we end up crashing
later in the debug session when we read past the end of the file -- this at least gets us
closer with something like ProcessMachCore printing "error: core file has no sections".
<rdar://problem/13468295>

llvm-svn: 179152

11 years agoC++11 inheriting constructors: support for inheriting constructor templates.
Richard Smith [Wed, 10 Apr 2013 05:48:59 +0000 (05:48 +0000)]
C++11 inheriting constructors: support for inheriting constructor templates.

llvm-svn: 179151

11 years ago<rdar://problem/13605348> Don't consider invalid user-defined literal operators durin...
Douglas Gregor [Wed, 10 Apr 2013 05:18:00 +0000 (05:18 +0000)]
<rdar://problem/13605348> Don't consider invalid user-defined literal operators during overload resolution.

llvm-svn: 179150

11 years agofix typos
Sebastian Pop [Wed, 10 Apr 2013 04:09:12 +0000 (04:09 +0000)]
fix typos

llvm-svn: 179149

11 years agoscop detection: properly instantiate SCEVs to the place where they are used
Sebastian Pop [Wed, 10 Apr 2013 04:05:18 +0000 (04:05 +0000)]
scop detection: properly instantiate SCEVs to the place where they are used

Fix inspired from c2d4a0627e95c34a819b9d4ffb4db62daa78dade.

    Given the following code

        for (i = 0; i < 10; i++) {
          ;
        }

    S:  A[i] = 0

    When translate the data reference A[i] in statement S using scev, we need to
    retrieve the scev of 'i' at the location of 'S'. If we do not do this the
    scev that we obtain will be expressed as {0,+,1}_for and will reference loop
    iterators that do not surround 'S'. What we really want is the scev to be
    instantiated to the value of 'i' after the loop. This value is {10}.

This used to crash in:

    int loopDimension = getLoopDepth(Expr->getLoop());

    isl_aff *LAff = isl_aff_set_coefficient_si(
        isl_aff_zero_on_domain(LocalSpace), isl_dim_in, loopDimension, 1);

(gdb) p Expr->dump()
{8,+,8}<nw><%do.body>

(gdb) p getLoopDepth(Expr->getLoop())
$5 = 0

    isl_space *Space = isl_space_set_alloc(Ctx, 0, NbLoopSpaces);
    isl_local_space *LocalSpace = isl_local_space_from_space(Space);

As we are trying to create a memory access in a stmt that is outside all loops,
LocalSpace has 0 dimensions:

(gdb) p NbLoopSpaces
$12 = 0

(gdb) p Statement.BB->dump()

if.then:                                          ; preds = %do.end
  %0 = load float* %add.ptr, align 4
  store float %0, float* %q.1.reg2mem, align 4
  br label %if.end.single_exit

and so the scev for %add.ptr should be taken at the place where it is used,
i.e., it should be the value on the last iteration of the do.body loop, and not
"{8,+,8}<nw><%do.body>".

llvm-svn: 179148

11 years agoTemplate the MachO types over endianness.
Rafael Espindola [Wed, 10 Apr 2013 03:48:25 +0000 (03:48 +0000)]
Template the MachO types over endianness.

For now they are still only used as little endian.

llvm-svn: 179147

11 years agoInclude the more specific header.
Rafael Espindola [Wed, 10 Apr 2013 01:58:26 +0000 (01:58 +0000)]
Include the more specific header.

llvm-svn: 179146

11 years ago[frontend] -frewrite-includes: turn implicit module imports into @imports.
Argyrios Kyrtzidis [Wed, 10 Apr 2013 01:53:50 +0000 (01:53 +0000)]
[frontend] -frewrite-includes: turn implicit module imports into @imports.

rdar://13610250

llvm-svn: 179145

11 years ago[frontend] When preprocessing, turn implicit module imports into @imports.
Argyrios Kyrtzidis [Wed, 10 Apr 2013 01:53:46 +0000 (01:53 +0000)]
[frontend] When preprocessing, turn implicit module imports into @imports.

part of rdar://13610250

llvm-svn: 179144

11 years ago[frontend] -frewrite-includes: if there was no inclusion, don't add lineinfo that...
Argyrios Kyrtzidis [Wed, 10 Apr 2013 01:53:37 +0000 (01:53 +0000)]
[frontend] -frewrite-includes: if there was no inclusion, don't add lineinfo that indicates return from another file.

llvm-svn: 179143

11 years agoRepeat some #line directive tests for the GNU line marker directive.
Michael Ilseman [Wed, 10 Apr 2013 01:41:19 +0000 (01:41 +0000)]
Repeat some #line directive tests for the GNU line marker directive.

llvm-svn: 179142

11 years ago__sincosf_stret returns sinf / cosf in bits 0:31 and 32:63 of xmm0, not in
Evan Cheng [Wed, 10 Apr 2013 01:26:07 +0000 (01:26 +0000)]
__sincosf_stret returns sinf / cosf in bits 0:31 and 32:63 of xmm0, not in
xmm0 / xmm1.

rdar://13599493

llvm-svn: 179141

11 years agoGeneralize the PassConfig API and remove addFinalizeRegAlloc().
Andrew Trick [Wed, 10 Apr 2013 01:06:56 +0000 (01:06 +0000)]
Generalize the PassConfig API and remove addFinalizeRegAlloc().

The target hooks are getting out of hand. What does it mean to run
before or after regalloc anyway? Allowing either Pass* or AnalysisID
pass identification should make it much easier for targets to use the
substitutePass and insertPass APIs, and create less need for badly
named target hooks.

llvm-svn: 179140

11 years agoImprove the diagnostics of the number-reading preprocessor directives.
Michael Ilseman [Wed, 10 Apr 2013 01:04:18 +0000 (01:04 +0000)]
Improve the diagnostics of the number-reading preprocessor directives.

The GNU line marker directive was sharing code with the #line directive, but some of the warnings/errors were reporting as #line directive diagnostics in both cases.

Previously:
#line 11foo1   ==> "#line directive requires a simple digit sequence"
# 11foo1       ==> "#line directive requires a simple digit sequence"

Now, we get:
#line 11foo1   ==> "#line directive requires a simple digit sequence"
# 11foo1       ==> "GNU line marker directive requires a simple digit sequence"

llvm-svn: 179139

11 years agoSuppress -Wunused-variable for variables declared in headers, which may in
Matt Beaumont-Gay [Wed, 10 Apr 2013 00:47:10 +0000 (00:47 +0000)]
Suppress -Wunused-variable for variables declared in headers, which may in
fact be defined and used in another TU.

Reshuffle some test cases because we suppress -Wunused-variable after we've
emitted an error.

This fixes PR15558.

llvm-svn: 179138

11 years agoDon't erroneously put FunctionDecls into CXXRecordDecls
Sean Callanan [Tue, 9 Apr 2013 23:22:08 +0000 (23:22 +0000)]
Don't erroneously put FunctionDecls into CXXRecordDecls
if we didn't want to put in a CXXConstructorDecl.  This
prevents malformed classes (i.e., classes with regular C
functions as members) from being generated from type
information (and fixes a crash in the test suite).

<rdar://problem/13550765>

llvm-svn: 179136

11 years agoMips specific inline asm operand modifier 'D'
Jack Carter [Tue, 9 Apr 2013 23:19:50 +0000 (23:19 +0000)]
Mips specific inline asm operand modifier 'D'

Modifier 'D' is to use the second word of a double integer.

We had previously implemented the pure register varient of
the modifier and this patch implements the memory reference.

#include "stdio.h"

int b[8] = {0,1,2,3,4,5,6,7};
void main()
{
    int i;

    // The first word. Notice, no 'D'
    {asm (
    "lw    %0,%1;"
    : "=r" (i)
    : "m" (*(b+4))
    );}

    printf("%d\n",i);

    // The second word
    {asm (
    "lw    %0,%D1;"
    : "=r" (i)
    : "m" (*(b+4))
    );}

    printf("%d\n",i);
}

llvm-svn: 179135

11 years agoAllow PPC B and BLR to be if-converted into some predicated forms
Hal Finkel [Tue, 9 Apr 2013 22:58:37 +0000 (22:58 +0000)]
Allow PPC B and BLR to be if-converted into some predicated forms

This enables us to form predicated branches (which are the same conditional
branches we had before) and also a larger set of predicated returns (including
instructions like bdnzlr which is a conditional return and loop-counter
decrement all in one).

At the moment, if conversion does not capture all possible opportunities. A
simple example is provided in early-ret2.ll, where if conversion forms one
predicated return, and then the PPCEarlyReturn pass picks up the other one. So,
at least for now, we'll keep both mechanisms.

llvm-svn: 179134

11 years agoFix the help for unwind-on-error, it no longer controls what happens when an expressi...
Jim Ingham [Tue, 9 Apr 2013 22:34:06 +0000 (22:34 +0000)]
Fix the help for unwind-on-error, it no longer controls what happens when an expression hits a breakpoint.

llvm-svn: 179133

11 years agoFix some comment typos.
Bob Wilson [Tue, 9 Apr 2013 22:15:51 +0000 (22:15 +0000)]
Fix some comment typos.

llvm-svn: 179132

11 years agoRemove outdated run lines from tests.
Richard Trieu [Tue, 9 Apr 2013 22:06:27 +0000 (22:06 +0000)]
Remove outdated run lines from tests.

These run lines originally tested that the fix-its were properly applied.
Originally, the fixits were attached to warnings and were applied by -fixit.
Now, the fixits are attached to notes, so nothing happens.  These run lines
still manage to pass since Clang will produce an empty output which gets piped
back to Clang.  Then Clang produces no error on an empty input.

llvm-svn: 179131

11 years agoHardening so we won't crash if an Objective-C interface
Sean Callanan [Tue, 9 Apr 2013 21:30:48 +0000 (21:30 +0000)]
Hardening so we won't crash if an Objective-C interface
doesn't have a corresponding type.

<rdar://problem/13596142>

llvm-svn: 179130

11 years agoCleanup. No functional change intended.
Chad Rosier [Tue, 9 Apr 2013 20:58:48 +0000 (20:58 +0000)]
Cleanup. No functional change intended.

llvm-svn: 179129

11 years agoUpdating cpp11-migrate transform list in ClangTools docs
Edwin Vane [Tue, 9 Apr 2013 20:51:47 +0000 (20:51 +0000)]
Updating cpp11-migrate transform list in ClangTools docs

Author: Philip Dunstan <phil@phildunstan.com>
llvm-svn: 179128

11 years agoAdding the AddOverride transform for cpp11-migrate
Edwin Vane [Tue, 9 Apr 2013 20:49:49 +0000 (20:49 +0000)]
Adding the AddOverride transform for cpp11-migrate

This transform adds the override specifier to methods that overrides virtual
methods from a base class that don't already have this specifier.

Author: Philip Dunstan <phil@phildunstan.com>
llvm-svn: 179127

11 years agoAdding new AST Matchers isVirtual and isOverride
Edwin Vane [Tue, 9 Apr 2013 20:46:36 +0000 (20:46 +0000)]
Adding new AST Matchers isVirtual and isOverride

isVirtual - matches CXXMethodDecl nodes for virtual methods
isOverride - matches CXXMethodDecl nodes for methods that override virtual methods from a base class.

Author: Philip Dunstan <phil@philipdunstan.com>
llvm-svn: 179126

11 years agoCleanup. No functional change intended.
Chad Rosier [Tue, 9 Apr 2013 20:44:09 +0000 (20:44 +0000)]
Cleanup. No functional change intended.

llvm-svn: 179125

11 years agoRemove unused method and default values.
Rafael Espindola [Tue, 9 Apr 2013 20:35:08 +0000 (20:35 +0000)]
Remove unused method and default values.

llvm-svn: 179124

11 years ago[c-index-test] Enable 'display diagnostics' when using the -test-load functionality.
Argyrios Kyrtzidis [Tue, 9 Apr 2013 20:29:24 +0000 (20:29 +0000)]
[c-index-test] Enable 'display diagnostics' when using the -test-load functionality.

llvm-svn: 179123

11 years agoUpdate the version of dwarf we say we're emitting to at least 3.
Eric Christopher [Tue, 9 Apr 2013 20:22:47 +0000 (20:22 +0000)]
Update the version of dwarf we say we're emitting to at least 3.

Deals with a dwarf2 -> dwarf3 DW_FORM_ref_addr change.

llvm-svn: 179122

11 years ago[libclang] In cxtu::getASTUnit(), check for a null CXTranslationUnit.
Argyrios Kyrtzidis [Tue, 9 Apr 2013 20:03:03 +0000 (20:03 +0000)]
[libclang] In cxtu::getASTUnit(), check for a null CXTranslationUnit.

llvm-svn: 179121

11 years agoRevert r179115 as it looks to have killed the ASan tests.
Chad Rosier [Tue, 9 Apr 2013 19:59:12 +0000 (19:59 +0000)]
Revert r179115 as it looks to have killed the ASan tests.

llvm-svn: 179120

11 years agoRationalize the formatting of these case labels. Having two sorted
Chandler Carruth [Tue, 9 Apr 2013 19:46:46 +0000 (19:46 +0000)]
Rationalize the formatting of these case labels. Having two sorted
columns is essentially impossible to edit.

llvm-svn: 179119

11 years agoThis patch enables llvm to switch between compiling for mips32/mips64
Reed Kotler [Tue, 9 Apr 2013 19:46:01 +0000 (19:46 +0000)]
This patch enables llvm to switch between compiling for mips32/mips64
and mips16 on a per function basis.

Because this patch is somewhat involved I have provide an overview of the
key pieces of it.

The patch is written so as to not change the behavior of the non mixed
mode. We have tested this a lot but it is something new to switch subtargets
so we don't want any chance of regression in the mainline compiler until
we have more confidence in this.

Mips32/64 are very different from Mip16 as is the case of ARM vs Thumb1.
For that reason there are derived versions of the register info, frame info,
instruction info and instruction selection classes.

Now we register three separate passes for instruction selection.
One which is used to switch subtargets (MipsModuleISelDAGToDAG.cpp) and then
one for each of the current subtargets (Mips16ISelDAGToDAG.cpp and
MipsSEISelDAGToDAG.cpp).

When the ModuleISel pass runs, it determines if there is a need to switch
subtargets and if so, the owning pointers in MipsTargetMachine are
appropriately changed.

When 16Isel or SEIsel is run, they will return immediately without doing
any work if the current subtarget mode does not apply to them.

In addition, MipsAsmPrinter needs to be reset on a function basis.

The pass BasicTargetTransformInfo is substituted with a null pass since the
pass is immutable and really needs to be a function pass for it to be
used with changing subtargets. This will be fixed in a follow on patch.

llvm-svn: 179118

11 years agoAdd support for bottom-up SLP vectorization infrastructure.
Nadav Rotem [Tue, 9 Apr 2013 19:44:35 +0000 (19:44 +0000)]
Add support for bottom-up SLP vectorization infrastructure.

This commit adds the infrastructure for performing bottom-up SLP vectorization (and other optimizations) on parallel computations.
The infrastructure has three potential users:

  1. The loop vectorizer needs to be able to vectorize AOS data structures such as (sum += A[i] + A[i+1]).

  2. The BB-vectorizer needs this infrastructure for bottom-up SLP vectorization, because bottom-up vectorization is faster to compute.

  3. A loop-roller needs to be able to analyze consecutive chains and roll them into a loop, in order to reduce code size. A loop roller does not need to create vector instructions, and this infrastructure separates the chain analysis from the vectorization.

This patch also includes a simple (100 LOC) bottom up SLP vectorizer that uses the infrastructure, and can vectorize this code:

void SAXPY(int *x, int *y, int a, int i) {
  x[i]   = a * x[i]   + y[i];
  x[i+1] = a * x[i+1] + y[i+1];
  x[i+2] = a * x[i+2] + y[i+2];
  x[i+3] = a * x[i+3] + y[i+3];
}

llvm-svn: 179117

11 years agoMake check depend on all.
Eric Christopher [Tue, 9 Apr 2013 19:42:12 +0000 (19:42 +0000)]
Make check depend on all.

llvm-svn: 179116

11 years ago[ms-inline asm] Use parsePrimaryExpr in lieu of parseExpression if we need to
Chad Rosier [Tue, 9 Apr 2013 19:34:59 +0000 (19:34 +0000)]
[ms-inline asm] Use parsePrimaryExpr in lieu of parseExpression if we need to
parse an identifier.  Otherwise, parseExpression may parse multiple tokens,
which makes it impossible to properly compute an immediate displacement.
An example of such a case is the source operand (i.e., [Symbol + ImmDisp]) in
the below example:

 __asm mov eax, [Symbol + ImmDisp]

The existing test cases exercise this patch.
rdar://13611297

llvm-svn: 179115

11 years agoThe .dwo section shouldn't contain the unrelocated values (and
Eric Christopher [Tue, 9 Apr 2013 19:23:15 +0000 (19:23 +0000)]
The .dwo section shouldn't contain the unrelocated values (and
therefore not at all) of the pc or statement list. We also don't
need to emit the compilation dir so save so space and time
and don't bother.

Fix up the testcase accordingly and verify that we don't emit
the attributes or the items that they use.

llvm-svn: 179114

11 years agoCleanup PPCEarlyReturn
Hal Finkel [Tue, 9 Apr 2013 18:25:18 +0000 (18:25 +0000)]
Cleanup PPCEarlyReturn

Some general cleanup and only scan the end of a BB for branches (once we're
done with the terminators and debug values, then there should not be any other
branches). These address post-commit review suggestions by Bill Schmidt.

No functionality change intended.

llvm-svn: 179112

11 years agoRevert r176408 and r176407 to address PR15540.
Nadav Rotem [Tue, 9 Apr 2013 18:16:05 +0000 (18:16 +0000)]
Revert r176408 and r176407 to address PR15540.

llvm-svn: 179111

11 years agoFix the help message for “one-shot”.
Jim Ingham [Tue, 9 Apr 2013 18:05:22 +0000 (18:05 +0000)]
Fix the help message for “one-shot”.

llvm-svn: 179110

11 years ago[ms-inline asm] Maintain a StringRef to reference a symbol in a parsed operand,
Chad Rosier [Tue, 9 Apr 2013 17:53:49 +0000 (17:53 +0000)]
[ms-inline asm] Maintain a StringRef to reference a symbol in a parsed operand,
rather than deriving the StringRef from the Start and End SMLocs.

Using the Start and End SMLocs works fine for operands such as [Symbol], but
not for operands such as [Symbol + ImmDisp].  All existing test cases that
reference a variable exercise this patch.
rdar://13602265

llvm-svn: 179109

11 years agoObjective-C: This patch fixes a none-issuance of warning
Fariborz Jahanian [Tue, 9 Apr 2013 17:52:29 +0000 (17:52 +0000)]
Objective-C: This patch fixes a none-issuance of warning
when result type of protocol property and getter method
differ by fixing a more serious problem. When a forward
protocol declaration comes between its definition and
its use in class protocol list, the forward protocol
ast was being used in building the protocol list.
// rdar://12522752

llvm-svn: 179108

11 years agoFix comments before labels.
Daniel Jasper [Tue, 9 Apr 2013 17:46:55 +0000 (17:46 +0000)]
Fix comments before labels.

Before:
switch (...) {
  // a
  // b
// c
case first:
  break;
}

After:
switch (...) {
// a
// b
// c
case first:
  break;
}

llvm-svn: 179107

11 years agoDAGCombiner: Fold a shuffle on CONCAT_VECTORS into a new CONCAT_VECTORS if possible.
Benjamin Kramer [Tue, 9 Apr 2013 17:41:43 +0000 (17:41 +0000)]
DAGCombiner: Fold a shuffle on CONCAT_VECTORS into a new CONCAT_VECTORS if possible.

This pattern occurs in SROA output due to the way vector arguments are lowered
on ARM.

The testcase from PR15525 now compiles into this, which is better than the code
we got with the old scalarrepl:
_Store:
ldr.w r9, [sp]
vmov d17, r3, r9
vmov d16, r1, r2
vst1.8 {d16, d17}, [r0]
bx lr

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

llvm-svn: 179106

11 years agoUse virtual base registers on PPC
Hal Finkel [Tue, 9 Apr 2013 17:27:09 +0000 (17:27 +0000)]
Use virtual base registers on PPC

On PowerPC, non-vector loads and stores have r+i forms; however, in functions
with large stack frames these were not being used to access slots far from the
stack pointer because such slots were out of range for the signed 16-bit
immediate offset field. This increases register pressure because we need a
separate register for each offset (when the r+r form is used). By enabling
virtual base registers, we can deal with large stack frames without unduly
increasing register pressure.

llvm-svn: 179105

11 years agoConvert test PowerPC/2007-09-07-LoadStoreIdxForms to FileCheck
Hal Finkel [Tue, 9 Apr 2013 17:26:55 +0000 (17:26 +0000)]
Convert test PowerPC/2007-09-07-LoadStoreIdxForms to FileCheck

llvm-svn: 179104

11 years agoFix UseNullptr fails to replace c-style explicit cast in a return statement
Ariel J. Bernal [Tue, 9 Apr 2013 16:54:56 +0000 (16:54 +0000)]
Fix UseNullptr fails to replace c-style explicit cast in a return statement

This happens whenever there is a c-style explicit cast to nullptr not
surrounded by parentheses following a return statement.

- Added a white space before nullptr if the character before is alphanumeric
  when replacing the null pointer expression.
- Simplified visitor
- Addes tests

llvm-svn: 179103

11 years agoRewrite test/Linker tests to use FileCheck instead of grep.
Eli Bendersky [Tue, 9 Apr 2013 16:51:13 +0000 (16:51 +0000)]
Rewrite test/Linker tests to use FileCheck instead of grep.

Some translations here are not 1x1 because there are grep|grep
chains that are non-trivial to implement in terms of FileCheck features. I
made an effort for the tests to remain as similar as possible; do let me know
if you notice anything fishy. The good news are that some buggy tests were
fixed (grep | not grep - a bug waiting to happen).

llvm-svn: 179102

11 years agoAgain macros without trailing semicolons: don't care about declaration context.
Alexander Kornienko [Tue, 9 Apr 2013 16:15:19 +0000 (16:15 +0000)]
Again macros without trailing semicolons: don't care about declaration context.

Summary:
Some codebases use these kinds of macros in functions, e.g. Chromium's
IPC_BEGIN_MESSAGE_MAP, IPC_BEGIN_MESSAGE_HANDLER, etc.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D645

llvm-svn: 179099

11 years agoImprovements to clang-format integrations.
Daniel Jasper [Tue, 9 Apr 2013 15:23:04 +0000 (15:23 +0000)]
Improvements to clang-format integrations.

This adds an emacs editor integration (thanks to Ami Fischman). Also
pulls out the style into a variable for the vi integration and just
uses clang-formats defaults style in clang-format-diff.py.

llvm-svn: 179098

11 years agoConvert MachOObjectFile to a template.
Rafael Espindola [Tue, 9 Apr 2013 14:49:08 +0000 (14:49 +0000)]
Convert MachOObjectFile to a template.

For now it is templated only on being 64 or 32 bits. I will add little/big
endian next.

llvm-svn: 179097

11 years ago[sanitizer] Interceptors for wait*.
Evgeniy Stepanov [Tue, 9 Apr 2013 14:34:59 +0000 (14:34 +0000)]
[sanitizer] Interceptors for wait*.

llvm-svn: 179096

11 years agoDWARF parser: Fix DWARF-2/3 incompatibility: size of DW_FORM_ref_addr is the same...
Alexey Samsonov [Tue, 9 Apr 2013 14:09:42 +0000 (14:09 +0000)]
DWARF parser: Fix DWARF-2/3 incompatibility: size of DW_FORM_ref_addr is the same as DW_FORM_addr in DWARF2, and is 4/8 bytes on 32/64-bit DWARF starting from DWARF3. Adding a test for this is a huge pain - generating and uploading pre-built binary with DWARF3 debug info is way too ugly, and writing fine-grained unittests for DebugInfo is impossible, as it doesn't expose any headers in include/llvm. That said, I'm going to choose the second approach and submit the patch exposing DebugInfo headers for review soon enough.

llvm-svn: 179095

11 years agoMention the changes in the handling of language linkage in the release notes.
Rafael Espindola [Tue, 9 Apr 2013 12:51:24 +0000 (12:51 +0000)]
Mention the changes in the handling of language linkage in the release notes.

llvm-svn: 179094

11 years ago[ms-cxxabi] Add "$$C" when mangling template arg QualTypes
Reid Kleckner [Tue, 9 Apr 2013 12:47:38 +0000 (12:47 +0000)]
[ms-cxxabi] Add "$$C" when mangling template arg QualTypes

Credit goes to Timur Iskhodzhanov for finding the problem and solution.

llvm-svn: 179093

11 years agoOne more follow-up to r179082 - parse PIC/PIE arguments even on platfroms that force...
Alexey Samsonov [Tue, 9 Apr 2013 12:28:19 +0000 (12:28 +0000)]
One more follow-up to r179082 - parse PIC/PIE arguments even on platfroms that force default PIC (like Darwin x86-64), otherwise specifying -fPIC will produce bogus unused argument warning

llvm-svn: 179092

11 years ago[msan] Intercept glob() with tests.
Evgeniy Stepanov [Tue, 9 Apr 2013 11:35:13 +0000 (11:35 +0000)]
[msan] Intercept glob() with tests.

llvm-svn: 179091

11 years ago[Sanitizer] fix TSan tests: remove global ctor from sanitizer_common, run load_shared...
Alexey Samsonov [Tue, 9 Apr 2013 07:46:20 +0000 (07:46 +0000)]
[Sanitizer] fix TSan tests: remove global ctor from sanitizer_common, run load_shared_lib test only in lit

llvm-svn: 179090

11 years agoFollow-up for r179082: more careful handling of -f(no-)sanitize-address-zero-base...
Alexey Samsonov [Tue, 9 Apr 2013 07:27:44 +0000 (07:27 +0000)]
Follow-up for r179082: more careful handling of -f(no-)sanitize-address-zero-base-shadow on Android

llvm-svn: 179089

11 years ago[asan] relax Linux/zero-base-shadow.cc to make it pass on newer Ubuntu; fix lint
Kostya Serebryany [Tue, 9 Apr 2013 07:08:05 +0000 (07:08 +0000)]
[asan] relax Linux/zero-base-shadow.cc to make it pass on newer Ubuntu; fix lint

llvm-svn: 179088

11 years agoConverted 8x tests of SimplifyCFG to use FileCheck instead of grep.
Michael Gottesman [Tue, 9 Apr 2013 05:18:53 +0000 (05:18 +0000)]
Converted 8x tests of SimplifyCFG to use FileCheck instead of grep.

llvm-svn: 179087

11 years agoExtract a function.
Jakob Stoklund Olesen [Tue, 9 Apr 2013 05:11:52 +0000 (05:11 +0000)]
Extract a function.

llvm-svn: 179086

11 years agoRemove the confusing sentence.
Nadav Rotem [Tue, 9 Apr 2013 04:48:40 +0000 (04:48 +0000)]
Remove the confusing sentence.

llvm-svn: 179085

11 years agoRevert 179071 because it is not the right way to support non standard new/new[] opera...
Nadav Rotem [Tue, 9 Apr 2013 04:43:46 +0000 (04:43 +0000)]
Revert 179071 because it is not the right way to support non standard new/new[] operators.

llvm-svn: 179084

11 years agoCompute correct frame sizes for SPARC v9 64-bit frames.
Jakob Stoklund Olesen [Tue, 9 Apr 2013 04:37:47 +0000 (04:37 +0000)]
Compute correct frame sizes for SPARC v9 64-bit frames.

The save area is twice as big and there is no struct return slot. The
stack pointer is always 16-byte aligned (after adding the bias).

Also eliminate the stack adjustment instructions around calls when the
function has a reserved stack frame.

llvm-svn: 179083

11 years agoIf the user requested a zero-base-shadow sanitizer, infer -pie and -fPIC when appropr...
Peter Collingbourne [Tue, 9 Apr 2013 04:35:11 +0000 (04:35 +0000)]
If the user requested a zero-base-shadow sanitizer, infer -pie and -fPIC when appropriate.

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

llvm-svn: 179082

11 years ago[analyzer] Replace isIntegerType() with isIntegerOrEnumerationType().
Jordan Rose [Tue, 9 Apr 2013 02:30:33 +0000 (02:30 +0000)]
[analyzer] Replace isIntegerType() with isIntegerOrEnumerationType().

Previously, the analyzer used isIntegerType() everywhere, which uses the C
definition of "integer". The C++ predicate with the same behavior is
isIntegerOrUnscopedEnumerationType().

However, the analyzer is /really/ using this to ask if it's some sort of
"integrally representable" type, i.e. it should include C++11 scoped
enumerations as well. hasIntegerRepresentation() sounds like the right
predicate, but that includes vectors, which the analyzer represents by its
elements.

This commit audits all uses of isIntegerType() and replaces them with the
general isIntegerOrEnumerationType(), except in some specific cases where
it makes sense to exclude scoped enumerations, or any enumerations. These
cases now use isIntegerOrUnscopedEnumerationType() and getAs<BuiltinType>()
plus BuiltinType::isInteger().

isIntegerType() is hereby banned in the analyzer - lib/StaticAnalysis and
include/clang/StaticAnalysis. :-)

Fixes real assertion failures. PR15703 / <rdar://problem/12350701>

llvm-svn: 179081

11 years agoWhen checking for illegal expressions in a default-argument
John McCall [Tue, 9 Apr 2013 01:56:28 +0000 (01:56 +0000)]
When checking for illegal expressions in a default-argument
expression, look through pseudo-object expressions.

rdar://13602832

llvm-svn: 179080

11 years agoSkip transparent contexts when looking for using directives in name lookup.
Douglas Gregor [Tue, 9 Apr 2013 01:49:26 +0000 (01:49 +0000)]
Skip transparent contexts when looking for using directives in name lookup.

Fixes the bootstrap regression I introduced in r179067.

llvm-svn: 179079

11 years agoMark as referenced the functions from instantiated UserDefinedLiterals.
Argyrios Kyrtzidis [Tue, 9 Apr 2013 01:17:02 +0000 (01:17 +0000)]
Mark as referenced the functions from instantiated UserDefinedLiterals.

Fixes rdar://13589856

llvm-svn: 179078

11 years agoFixed the way we allocate executable memory on
Sean Callanan [Tue, 9 Apr 2013 01:13:08 +0000 (01:13 +0000)]
Fixed the way we allocate executable memory on
behalf of the JIT.  We don't need it to be writable
since we are using special APIs to write into it.

<rdar://problem/13599185>

llvm-svn: 179077

11 years agoMore uses for SymbolTableEntryBase.
Rafael Espindola [Tue, 9 Apr 2013 01:04:06 +0000 (01:04 +0000)]
More uses for SymbolTableEntryBase.

llvm-svn: 179076

11 years ago[analyzer] Keep tracking the pointer after the escape to more aggressively report...
Anna Zaks [Tue, 9 Apr 2013 00:30:28 +0000 (00:30 +0000)]
[analyzer] Keep tracking the pointer after the escape to more aggressively report mismatched deallocator

Test that the path notes do not change. I don’t think we should print a note on escape.

Also, I’ve removed a check that assumed that the family stored in the RefStete could be
AF_None and added an assert in the constructor.

llvm-svn: 179075

11 years agoAdd a SymbolTableEntryBase.
Rafael Espindola [Tue, 9 Apr 2013 00:22:58 +0000 (00:22 +0000)]
Add a SymbolTableEntryBase.

Use it when we don't need to know if we have a 32 or 64 bit SymbolTableEntry.

llvm-svn: 179074

11 years agoFix PointerIntPair to be enum class compatible.
Joe Groff [Tue, 9 Apr 2013 00:01:51 +0000 (00:01 +0000)]
Fix PointerIntPair to be enum class compatible.

Some parts of PointerIntPair assumed that the IntType of the pair was implicitly
convertible to intptr_t, which is not the case for enum class values. Add a
static_cast<intptr_t> to make these conversions explicit and allow
PointerIntPair to be used with an enum class IntType. While we're here, rename
some of the argument values so we don't have variables named "Int" floating
around.

llvm-svn: 179073

11 years agoAdd a SectionBase struct.
Rafael Espindola [Mon, 8 Apr 2013 23:57:13 +0000 (23:57 +0000)]
Add a SectionBase struct.

Use it to share code and when we don't need to know if we have a 32 or 64
bit Section.

llvm-svn: 179072

11 years agoc++ new operators are not malloc-like functions because they do not return uninitiali...
Nadav Rotem [Mon, 8 Apr 2013 23:40:47 +0000 (23:40 +0000)]
c++ new operators are not malloc-like functions because they do not return uninitialized memory.
Users may overide new-operators and implement any function that they like.

llvm-svn: 179071

11 years agoAdd test case calling a deprecated method from a subclass that reimplements that...
Ted Kremenek [Mon, 8 Apr 2013 23:39:32 +0000 (23:39 +0000)]
Add test case calling a deprecated method from a subclass that reimplements that method gets a warning.

Test case from <rdar://problem/11627873>.

llvm-svn: 179070

11 years agoDon't copy just to capture a strong block pointer under ARC.
John McCall [Mon, 8 Apr 2013 23:27:49 +0000 (23:27 +0000)]
Don't copy just to capture a strong block pointer under ARC.
It turns out that the optimizer can't eliminate this without extra
information, for which there's a separate bug.

rdar://13588325

llvm-svn: 179069

11 years ago<rdar://problem/13584715> Converted constant expressions are expected to have integra...
Douglas Gregor [Mon, 8 Apr 2013 23:24:07 +0000 (23:24 +0000)]
<rdar://problem/13584715> Converted constant expressions are expected to have integral values.

We were assuming that any expression used as a converted constant
expression would either not have a folded constant value or would be
an integer, which is not the case for some ill-formed constant
expressions. Because converted constant expressions are only used
where integral values are expected, we can simply treat this as an
error path. If that ever changes, we'll need to widen the interface of
Sema::CheckConvertedConstantExpression() anyway.

llvm-svn: 179068

11 years ago<rdar://problem/13540899> Collect using directives from all of the semantic contexts...
Douglas Gregor [Mon, 8 Apr 2013 23:11:25 +0000 (23:11 +0000)]
<rdar://problem/13540899> Collect using directives from all of the semantic contexts not represented by scopes.

This fixes a regression I introduced in r178136, where we would not
consider the using directives from the semantic declaration contexts
that aren't represented by the lexical scopes (Scope) when performing
unqualified name lookup. This lead to horribly funny diagnostics like
"no identifier named 'foo'; did you mean 'foo'?".

llvm-svn: 179067

11 years agoInstructionSimplify.cpp: Fix a ligature, "fi", to get rid of utf8 in comment.
NAKAMURA Takumi [Mon, 8 Apr 2013 23:05:21 +0000 (23:05 +0000)]
InstructionSimplify.cpp: Fix a ligature, "fi", to get rid of utf8 in comment.

llvm-svn: 179066

11 years agoclang/test/Index/annotate-tokens.cpp: Appease msvc-targets with -fno-delayed-template...
NAKAMURA Takumi [Mon, 8 Apr 2013 23:05:10 +0000 (23:05 +0000)]
clang/test/Index/annotate-tokens.cpp: Appease msvc-targets with -fno-delayed-template-parsing.

llvm-svn: 179065

11 years agoRecognize function-like macro usages without semicolon in declaration context.
Alexander Kornienko [Mon, 8 Apr 2013 22:16:06 +0000 (22:16 +0000)]
Recognize function-like macro usages without semicolon in declaration context.

Summary:
Preserve line breaks after function-like macro usages without
semicolon, e.g.:

QQQ(xxx)
class X {
};

Reviewers: djasper, klimek

Reviewed By: djasper

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D638

llvm-svn: 179064

11 years agoRedo the fix Benjamin Kramer committed in r178793 about iterator invalidation in...
Shuxin Yang [Mon, 8 Apr 2013 22:00:43 +0000 (22:00 +0000)]
Redo the fix Benjamin Kramer committed in r178793 about iterator invalidation in Reassociate.

I brazenly think this change is slightly simpler than r178793 because:
  - no "state" in functor
  - "OpndPtrs[i]" looks simpler than "&Opnds[OpndIndices[i]]"

  While I can reproduce the probelm in Valgrind, it is rather difficult to come up
a standalone testing case. The reason is that when an iterator is invalidated,
the stale invalidated elements are not yet clobbered by nonsense data, so the
optimizer can still proceed successfully.

  Thank Benjamin for fixing this bug and generously providing the test case.

llvm-svn: 179062

11 years agoFix typo in assertion.
Nick Lewycky [Mon, 8 Apr 2013 21:55:21 +0000 (21:55 +0000)]
Fix typo in assertion.

llvm-svn: 179061

11 years agoUpdate the docs about the fact that the loop vectorizer is enabled by default for...
Nadav Rotem [Mon, 8 Apr 2013 21:34:49 +0000 (21:34 +0000)]
Update the docs about the fact that the loop vectorizer is enabled by default for -O3.

llvm-svn: 179060

11 years agoThe PNaCl target no longer permits __attribute__((regparm)).
Eli Bendersky [Mon, 8 Apr 2013 21:31:01 +0000 (21:31 +0000)]
The PNaCl target no longer permits __attribute__((regparm)).

Remove the custom lowering code dealing with it, disallow it in PNaclTargetInfo
and adjust tests accordingly.

llvm-svn: 179059

11 years agoUpdate PlatformDarwinKernel::GetMacDirectoriesToSearch to also try
Jason Molenda [Mon, 8 Apr 2013 21:24:40 +0000 (21:24 +0000)]
Update PlatformDarwinKernel::GetMacDirectoriesToSearch to also try
/Volumes/KernelDebugKit (the default mount point for the Kernel Debug
Kit dmgs).

llvm-svn: 179058

11 years ago<rdar://problem/13559825> Further reduce template instantiation depth down to 256...
Douglas Gregor [Mon, 8 Apr 2013 21:13:13 +0000 (21:13 +0000)]
<rdar://problem/13559825> Further reduce template instantiation depth down to 256, since we're blowing the stack for a trivial "factorial" class template.

llvm-svn: 179057

11 years agoFix PR15634, better error message for template deduction failure.
Richard Trieu [Mon, 8 Apr 2013 21:11:40 +0000 (21:11 +0000)]
Fix PR15634, better error message for template deduction failure.

When two template decls with the same name are used in this diagnostic,
force them to print their qualified names.  This changes the bad message of:

candidate template ignored: could not match 'array' against 'array'

to the better message of:

candidate template ignored: could not match 'NS2::array' against 'NS1::array'

llvm-svn: 179056

11 years agoUpdate checker build to checker-273
Ted Kremenek [Mon, 8 Apr 2013 21:02:16 +0000 (21:02 +0000)]
Update checker build to checker-273

llvm-svn: 179055

11 years agoRevert r179012: "[msan] Intercept glob()."
Chandler Carruth [Mon, 8 Apr 2013 20:59:44 +0000 (20:59 +0000)]
Revert r179012: "[msan] Intercept glob()."

This was committed without tests and contains obvious bugs. That's not
acceptable. It broke address sanitizer for most programs using glob(3).

llvm-svn: 179054

11 years ago<rdar://problem/13540921> Fix a crasher when an Objective-C for-in loop gets a non...
Douglas Gregor [Mon, 8 Apr 2013 20:52:24 +0000 (20:52 +0000)]
<rdar://problem/13540921> Fix a crasher when an Objective-C for-in loop gets a non-variable iteration declaration.

llvm-svn: 179053

11 years agofix indentation
Adrian Prantl [Mon, 8 Apr 2013 20:52:12 +0000 (20:52 +0000)]
fix indentation

llvm-svn: 179052