]> granicus.if.org Git - clang/log
clang
11 years agoupdateOutOfDateIdentifier() can cause the identifier table to be
Douglas Gregor [Mon, 7 Jan 2013 16:56:53 +0000 (16:56 +0000)]
updateOutOfDateIdentifier() can cause the identifier table to be
rehashed, invaliding the iterator walking through the identifier
table. Separate out the identification of out-of-date identifiers from
updating them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171756 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoScalar shifts in the OpenCL specification (as of v. 1.2) are defined to be
David Tweed [Mon, 7 Jan 2013 16:43:27 +0000 (16:43 +0000)]
Scalar shifts in the OpenCL specification (as of v. 1.2) are defined to be
with respect to the lower "left-hand-side bitwidth" bits, even when negative);
see OpenCL spec 6.3j. This patch both implements this behaviour in the code
generator and "constant folding" bits of Sema, and also prevents tests
to detect undefinedness in terms of the weaker C99 or C++ specifications
from being applied.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171755 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFormatter: Add tests for try/catch. Let 'throw' start an expression.
Nico Weber [Mon, 7 Jan 2013 16:36:17 +0000 (16:36 +0000)]
Formatter: Add tests for try/catch. Let 'throw' start an expression.

Before:
  throw a *b;

Now:
  throw a * b;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171754 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFormatter: Don't put spaces betwen @ and objc keywords.
Nico Weber [Mon, 7 Jan 2013 16:14:28 +0000 (16:14 +0000)]
Formatter: Don't put spaces betwen @ and objc keywords.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171753 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTest all @keywords. Turns out some of them are not formatted correctly yet.
Nico Weber [Mon, 7 Jan 2013 16:07:07 +0000 (16:07 +0000)]
Test all @keywords. Turns out some of them are not formatted correctly yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171752 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSlightly expand the @ test to cover whitespace between @ and keyword.
Nico Weber [Mon, 7 Jan 2013 15:56:25 +0000 (15:56 +0000)]
Slightly expand the @ test to cover whitespace between @ and keyword.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171751 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agolibclang/Makefile: Reorder USEDLIBS along driver/clang.
NAKAMURA Takumi [Mon, 7 Jan 2013 15:45:20 +0000 (15:45 +0000)]
libclang/Makefile: Reorder USEDLIBS along driver/clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171750 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSmall refactoring of the formatter code.
Daniel Jasper [Mon, 7 Jan 2013 15:36:15 +0000 (15:36 +0000)]
Small refactoring of the formatter code.

This should make it slightly more readable as it more clearly separates
what happens where. No intended functional changes. More of this to
come..

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171748 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd a test that checks that the formatter doesn't discard '@' with ObjC1 set.
Nico Weber [Mon, 7 Jan 2013 15:17:23 +0000 (15:17 +0000)]
Add a test that checks that the formatter doesn't discard '@' with ObjC1 set.

Also set ObjC1 in the formatter tests.

The only effect of this flag in the lexer is that '@' now gets turned into
tok::at instead of tok::unknown.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171742 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix typo.
Nico Weber [Mon, 7 Jan 2013 15:15:29 +0000 (15:15 +0000)]
Fix typo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171740 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agos/parseStatement/parseStructuralElement/g in the UnwrappedLineParser.
Manuel Klimek [Mon, 7 Jan 2013 14:56:16 +0000 (14:56 +0000)]
s/parseStatement/parseStructuralElement/g in the UnwrappedLineParser.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171737 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoReformat clang-formats source code.
Daniel Jasper [Mon, 7 Jan 2013 13:26:07 +0000 (13:26 +0000)]
Reformat clang-formats source code.

All changes done by clang-format itself. No functional changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171732 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPrefer not to break after assignments.
Daniel Jasper [Mon, 7 Jan 2013 13:08:40 +0000 (13:08 +0000)]
Prefer not to break after assignments.

This addresses llvm.org/PR14830.

Before:
unsigned Cost =
    TTI.getMemoryOpCost(I->getOpcode(), VectorTy, SI->getAlignment(),
                        SI->getPointerAddressSpace());
CharSourceRange LineRange =
    CharSourceRange::getTokenRange(TheLine.Tokens.front().Tok.getLocation(),
                                   TheLine.Tokens.back().Tok.getLocation());

After:
unsigned Cost = TTI.getMemoryOpCost(I->getOpcode(), VectorTy,
                                    SI->getAlignment(),
                                    SI->getPointerAddressSpace());
CharSourceRange LineRange = CharSourceRange::getTokenRange(
                                TheLine.Tokens.front().Tok.getLocation(),
                                TheLine.Tokens.back().Tok.getLocation());

This required rudimentary changes to static initializer lists, but we
are not yet formatting them in a reasonable way. That will be done in a
subsequent patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171731 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd style option for number of spaces before trailing comments.
Daniel Jasper [Mon, 7 Jan 2013 11:09:06 +0000 (11:09 +0000)]
Add style option for number of spaces before trailing comments.

In LLVM style, a single space should be enough. In Google style, two
spaces are required.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171725 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDo not break before "0" in pure virtual function declarations.
Daniel Jasper [Mon, 7 Jan 2013 10:48:50 +0000 (10:48 +0000)]
Do not break before "0" in pure virtual function declarations.

Before:
virtual void write(ELFWriter *writer, OwningPtr<FileOutputBuffer> &buffer) =
    0

After:
virtual void write(ELFWriter *writerrr,
                   OwningPtr<FileOutputBuffer> &buffer) = 0;

This addresses llvm.org/PR14815.

To implement this I introduced a line type during parsing and moved the
definition of TokenType out of the struct for increased readability.
Should have done the latter in a separate patch, but it would be hard to
pull apart now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171724 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix incorrect FIXME.
Manuel Klimek [Mon, 7 Jan 2013 10:03:37 +0000 (10:03 +0000)]
Fix incorrect FIXME.

The case that we wanted to write a test for cannot happen, as the
UnwrappedLineParser already protects against it. Added an assert to
prevent regressions of that assumption.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171720 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoCFG.cpp: Fix wrapping logic when printing block preds/succs.
Will Dietz [Mon, 7 Jan 2013 09:51:17 +0000 (09:51 +0000)]
CFG.cpp: Fix wrapping logic when printing block preds/succs.

First check only wrapped with i==8, second wrapped at i==2,8,18,28,...
This fix restores the intended behavior: i==8,18,28,...

Found with -fsanitize=integer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171718 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove outdated FIXME and add explanation for error handling strategy
Manuel Klimek [Mon, 7 Jan 2013 09:34:28 +0000 (09:34 +0000)]
Remove outdated FIXME and add explanation for error handling strategy
while parsing #define's.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171717 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove outdated fixme.
Manuel Klimek [Mon, 7 Jan 2013 09:25:37 +0000 (09:25 +0000)]
Remove outdated fixme.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171716 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDo not ever allow using the full line in preprocessor directives.
Manuel Klimek [Mon, 7 Jan 2013 09:24:17 +0000 (09:24 +0000)]
Do not ever allow using the full line in preprocessor directives.

We would format:
  #define A \
    int f(a); int i;
as
  #define A \
    int f(a);\
    int i

The fix will break up macro definitions that could fit a line, but hit
the last column; fixing that is more involved, though, as it requires
looking at the following line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171715 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix layouting of single-line-comments preceded by an escaped newline.
Manuel Klimek [Mon, 7 Jan 2013 08:54:53 +0000 (08:54 +0000)]
Fix layouting of single-line-comments preceded by an escaped newline.

Previously, we'd format
  int i;\
  // comment
as
  int i; // comment

The problem is that the escaped newline is part of the next token, and
thus the raw token text of the comment doesn't start with "//".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171713 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix layouting of tokens with a leading escaped newline.
Manuel Klimek [Mon, 7 Jan 2013 07:56:50 +0000 (07:56 +0000)]
Fix layouting of tokens with a leading escaped newline.

If a token follows directly on an escaped newline, the escaped newline
is stored with the token. Since we re-layout escaped newlines, we need
to treat them just like normal whitespace - thus, we need to increase
the whitespace-length of the token, while decreasing the token length
(otherwise the token length contains the length of the escaped newline
and we double-count it while indenting).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171706 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPut a higher penalty on breaking before "." or "->".
Daniel Jasper [Mon, 7 Jan 2013 07:13:20 +0000 (07:13 +0000)]
Put a higher penalty on breaking before "." or "->".

This fixes llvm.org/PR14823.

Before:
    local_state->SetString(prefs::kApplicationLocale, parent_local_state
                                ->GetString(prefs::kApplicationLocale));
After:
    local_state->SetString(
        prefs::kApplicationLocale,
        parent_local_state->GetString(prefs::kApplicationLocale));

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171705 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPR14759: Improve/correct support for debug info for C++ member pointers.
David Blaikie [Mon, 7 Jan 2013 05:55:03 +0000 (05:55 +0000)]
PR14759: Improve/correct support for debug info for C++ member pointers.

Using added LLVM functionality in r171698. This works in GDB for member
variable pointers but not member function pointers. See the LLVM commit and
GDB bug 14998 for details.

Un-xfailing cases in the GDB 7.5 test suite will follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171699 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSwitch to asking the target machine to add any relevant analysis passses
Chandler Carruth [Mon, 7 Jan 2013 01:38:01 +0000 (01:38 +0000)]
Switch to asking the target machine to add any relevant analysis passses
rather than doing it ourselves. This reflects the API changes in r171681.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171683 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSimplify. No behavior change.
Nico Weber [Mon, 7 Jan 2013 01:21:02 +0000 (01:21 +0000)]
Simplify. No behavior change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171680 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoClangTools doc: add ideas for new tools in clang-tools-extra to ensure that
Dmitri Gribenko [Sun, 6 Jan 2013 20:19:09 +0000 (20:19 +0000)]
ClangTools doc: add ideas for new tools in clang-tools-extra to ensure that
these ideas don't get lost

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171667 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFixes handling of unbalances braces.
Manuel Klimek [Sun, 6 Jan 2013 20:07:31 +0000 (20:07 +0000)]
Fixes handling of unbalances braces.

If we find an unexpected closing brace, we must not stop parsing, as
we'd otherwise not layout anything beyond that point.

If we find a structural error on the highest level we'll not re-indent
anyway, but we'll still want to format within unwrapped lines.

Needed to introduce a differentiation between an expected and unexpected
closing brace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171666 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoClang docs: add some information about the difference between 'clang' and 'clang...
Dmitri Gribenko [Sun, 6 Jan 2013 13:38:34 +0000 (13:38 +0000)]
Clang docs: add some information about the difference between 'clang' and 'clang -cc1'

This is coming up again and again on the mailing list and IRC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171656 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPrepare for the upcoming version of Debian (jessie)
Sylvestre Ledru [Sun, 6 Jan 2013 08:09:29 +0000 (08:09 +0000)]
Prepare for the upcoming version of Debian (jessie)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171655 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agouse early returns to simplify and de-nest
Sean Silva [Sun, 6 Jan 2013 07:49:41 +0000 (07:49 +0000)]
use early returns to simplify and de-nest

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171654 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFixes parsing of hash tokens in the middle of a line.
Manuel Klimek [Sat, 5 Jan 2013 22:56:06 +0000 (22:56 +0000)]
Fixes parsing of hash tokens in the middle of a line.

To parse # correctly, we need to know whether it is the first token in a
line - we can deduct this either from the whitespace or seeing that the
token is the first in the file - we already calculate this information.
This patch moves the identification of the first token into the
getNextToken method and stores it inside the FormatToken, so the
UnwrappedLineParser can stay independent of the SourceManager.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171640 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFixes PR14801 - preprocessor directives shouldn't be indented
Manuel Klimek [Sat, 5 Jan 2013 22:14:16 +0000 (22:14 +0000)]
Fixes PR14801 - preprocessor directives shouldn't be indented

Uses indent 0 for macros for now and resets the indent state to the
level prior to the preprocessor directive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171639 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFixes a breakage in dejagnu++ test suite where it included
Fariborz Jahanian [Sat, 5 Jan 2013 21:54:55 +0000 (21:54 +0000)]
Fixes a breakage in dejagnu++ test suite where it included
<objc/Protocol.h>. Caused by my recent changes for
various builtin declarations of objc_msgSendSuper
variety. // rdar://12489098

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171638 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMake checking for 'protected' access in debug info more legible.
David Blaikie [Sat, 5 Jan 2013 21:41:59 +0000 (21:41 +0000)]
Make checking for 'protected' access in debug info more legible.

Based on code review feedback for r171604 from Chandler Carruth &
Eric Christopher. Enabled by improvements to LLVM made in r171636.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171637 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFixes PR14811: Crash when formatting some macros
Manuel Klimek [Sat, 5 Jan 2013 21:34:55 +0000 (21:34 +0000)]
Fixes PR14811: Crash when formatting some macros

A preprocessor directive cannot be started while we're parsing one.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171635 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPR14573: Unnamed parameters in debug info, Part 2
David Blaikie [Sat, 5 Jan 2013 20:03:07 +0000 (20:03 +0000)]
PR14573: Unnamed parameters in debug info, Part 2

Catch some cases I'd missed in r171605 related to unnamed parameters of record
type. This resolves all remaining cases of PR14573 suppression in the GDB 7.5
test suite. Fix to the test suite to follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171633 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFileCheck-ize test/CodeGen/inline.c.
David Blaikie [Sat, 5 Jan 2013 18:22:42 +0000 (18:22 +0000)]
FileCheck-ize test/CodeGen/inline.c.

A rather egregious example of the grep-style checking of old that I randomly
came across.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171631 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoCompanion patch to r171621 which changed the interface for creating TTI
Chandler Carruth [Sat, 5 Jan 2013 11:45:12 +0000 (11:45 +0000)]
Companion patch to r171621 which changed the interface for creating TTI
passes to a create-pass function instead of a direct constructor call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171622 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix set-xcode-analyzer to only modify the ExecPath for the analyzer when using -...
Ted Kremenek [Sat, 5 Jan 2013 07:31:54 +0000 (07:31 +0000)]
Fix set-xcode-analyzer to only modify the ExecPath for the analyzer when using --use-xcode-clang.

Turns out that the ExecPath for the ObjC migrator would also get set.

Fixes <rdar://problem/12961769>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171607 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoEmit debug info for unnamed parameters.
David Blaikie [Sat, 5 Jan 2013 05:58:35 +0000 (05:58 +0000)]
Emit debug info for unnamed parameters.

LLVM ignores this data for now - patch for that to follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171605 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoChange test/CodeGenCXX/debug-info-method.cpp an IR (rather than asm) test.
David Blaikie [Sat, 5 Jan 2013 05:48:08 +0000 (05:48 +0000)]
Change test/CodeGenCXX/debug-info-method.cpp an IR (rather than asm) test.

Referring back to the original commit (r115090) which was a frontend only test
I adjusted this test to verify the frontend change that was made, to emit the
protected access value in the flags metadata field.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171604 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFileCheck-ize test/CodeGenCXX/debug-info-method.cpp
David Blaikie [Sat, 5 Jan 2013 05:39:21 +0000 (05:39 +0000)]
FileCheck-ize test/CodeGenCXX/debug-info-method.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171602 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[mips] Fix data layout string. Add 64 to the list of native integer widths
Akira Hatanaka [Sat, 5 Jan 2013 02:04:34 +0000 (02:04 +0000)]
[mips] Fix data layout string. Add 64 to the list of native integer widths
and add stack alignment information.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171588 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAssert that redeclarations have the same linkage.
Rafael Espindola [Sat, 5 Jan 2013 01:28:37 +0000 (01:28 +0000)]
Assert that redeclarations have the same linkage.

It is somewhat hard to test linkage, so I decided to try to add an assert. This
already found some interesting cases where there were different.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171585 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoIn my last patch initialize the destination to null (with a simple store) before...
Fariborz Jahanian [Sat, 5 Jan 2013 00:32:13 +0000 (00:32 +0000)]
In my last patch initialize the destination to null (with a simple store) before doing a storeStrong to it.
// rdar://12530881

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171572 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix testing case for Release build (r171493)
Manman Ren [Sat, 5 Jan 2013 00:01:42 +0000 (00:01 +0000)]
Fix testing case for Release build (r171493)

rdar://11562117

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171564 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUpdate checker build to checker-270
Ted Kremenek [Fri, 4 Jan 2013 23:52:16 +0000 (23:52 +0000)]
Update checker build to checker-270

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171560 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoVarious fixes to clang-format's macro handling.
Manuel Klimek [Fri, 4 Jan 2013 23:34:14 +0000 (23:34 +0000)]
Various fixes to clang-format's macro handling.

Some of this is still pretty rough (note the load of FIXMEs), but it is
strictly an improvement and fixes various bugs that were related to
macro processing but are also imporant in non-macro use cases.

Specific fixes:
- correctly puts espaced newlines at the end of the line
- fixes counting of white space before a token when escaped newlines are
  present
- fixes parsing of "trailing" tokens when eof() is hit
- puts macro parsing orthogonal to parsing other structure
- general support for parsing of macro definitions

Due to the fix to format trailing tokens, this change also includes a
bunch of fixes to the c-index tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171556 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoobjective-C arc: in copy helper function for
Fariborz Jahanian [Fri, 4 Jan 2013 23:32:24 +0000 (23:32 +0000)]
objective-C arc: in copy helper function for
__strong __block variables, perform objc_storeStrong on
source and destination instead of direct move. This
is done with -O0 and to improve some analysis.
// rdar://12530881

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171555 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix indent and remove parameter with a matching default value.
Chad Rosier [Fri, 4 Jan 2013 22:40:33 +0000 (22:40 +0000)]
Fix indent and remove parameter with a matching default value.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171545 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoStyle fix: We don't use lowercase-and-underscored template parameter names.
Rafael Espindola [Fri, 4 Jan 2013 21:18:45 +0000 (21:18 +0000)]
Style fix: We don't use lowercase-and-underscored template parameter names.
Thanks for dgregor for noticing it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171532 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoCorrectly format dereference and address of in array parameters.
Daniel Jasper [Fri, 4 Jan 2013 20:46:38 +0000 (20:46 +0000)]
Correctly format dereference and address of in array parameters.

Before: InvalidRegions[ &R] = 0;
After:  InvalidRegions[&R] = 0;

This fixes llvm.org/PR14793

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171522 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix typo. Thanks to dgregor for noticing it.
Rafael Espindola [Fri, 4 Jan 2013 20:41:40 +0000 (20:41 +0000)]
Fix typo. Thanks to dgregor for noticing it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171521 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUnqualify the parameter type.
Rafael Espindola [Fri, 4 Jan 2013 20:34:32 +0000 (20:34 +0000)]
Unqualify the parameter type.
This fixes a regression from 168895.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171519 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agorealpath'ify the mapping from header includes to module imports.
Douglas Gregor [Fri, 4 Jan 2013 19:44:26 +0000 (19:44 +0000)]
realpath'ify the mapping from header includes to module imports.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171516 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUpdate CMakeLists.txt
Ted Kremenek [Fri, 4 Jan 2013 19:04:47 +0000 (19:04 +0000)]
Update CMakeLists.txt

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171505 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd __has_feature support to detect if clang supports the explicit "atomic" keyword...
Ted Kremenek [Fri, 4 Jan 2013 19:04:44 +0000 (19:04 +0000)]
Add __has_feature support to detect if clang supports the explicit "atomic" keyword for ObjC properties.

Fixes <rdar://problem/12953378>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171504 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRequire set-xcode-analyzer to run with Python 2.7 or later.
Ted Kremenek [Fri, 4 Jan 2013 19:04:42 +0000 (19:04 +0000)]
Require set-xcode-analyzer to run with Python 2.7 or later.

Addresses LLVM PR 11661.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171503 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoNSErrorChecker: remove quoting the parameter name in the diagnostic until we actually...
Ted Kremenek [Fri, 4 Jan 2013 19:04:40 +0000 (19:04 +0000)]
NSErrorChecker: remove quoting the parameter name in the diagnostic until we actually include it's name.

This is a possible regression of moving to using ImplicitNullDerefEvent.
Fixing this for real (including the parameter name) requires more
plumbing in ImplicitNullDerefEvent.  This is just a stop gap fix.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171502 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTighten code. No functionality change.
Ted Kremenek [Fri, 4 Jan 2013 19:04:36 +0000 (19:04 +0000)]
Tighten code.  No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171501 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd the module name to the 'incomplete umbrella header' warning.
Douglas Gregor [Fri, 4 Jan 2013 18:58:28 +0000 (18:58 +0000)]
Add the module name to the 'incomplete umbrella header' warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171497 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoLet the formatter ignore UnwrappedLines containing errors.
Daniel Jasper [Fri, 4 Jan 2013 18:52:56 +0000 (18:52 +0000)]
Let the formatter ignore UnwrappedLines containing errors.

This prevents code like:

namespace {
class Foo {
  Foo(
  };
}  // comment

from causing segfaults (see llvm.org/PR14774).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171495 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd file added in r171484 to CMakelists.txt.
Filipe Cabecinhas [Fri, 4 Jan 2013 18:52:29 +0000 (18:52 +0000)]
Add file added in r171484 to CMakelists.txt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171494 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDebug Info: fix the line location for cleanup code of a block function
Manman Ren [Fri, 4 Jan 2013 18:51:35 +0000 (18:51 +0000)]
Debug Info: fix the line location for cleanup code of a block function

The line information was changed when emitting debug information for all the
DeclRefExprs and we should change it back to get ready for PopClenupBlocks
called from FinishFunction.

rdar://11562117

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171493 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix up various builtin declaration of objc_msgSend families
Fariborz Jahanian [Fri, 4 Jan 2013 18:45:40 +0000 (18:45 +0000)]
Fix up various builtin declaration of objc_msgSend families
to match those foung in objc.h an avoid spurious warnings.
// rdar://12489098

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171492 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[libclang] Introduce clang_getFileLocation.
Argyrios Kyrtzidis [Fri, 4 Jan 2013 18:30:13 +0000 (18:30 +0000)]
[libclang] Introduce clang_getFileLocation.

Uses of clang_getSpellingLocation should eventually move to calling
clang_getFileLocation, and clang_getSpellingLocation should do what
its name represents and actually point at the 'spelling' location, e.g.
inside a macro definition if the spelling of a token came from that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171486 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[arcmt] Allow removing an -autorelease of a variable initialized in the previous...
Argyrios Kyrtzidis [Fri, 4 Jan 2013 18:30:11 +0000 (18:30 +0000)]
[arcmt] Allow removing an -autorelease of a variable initialized in the previous statement.

rdar://11074996

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171485 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[arcmt] Adds brackets in case statements that "contain" initialization of retaining
Argyrios Kyrtzidis [Fri, 4 Jan 2013 18:30:08 +0000 (18:30 +0000)]
[arcmt] Adds brackets in case statements that "contain" initialization of retaining
variable, thus emitting the "switch case is in protected scope" error.

rdar://12952016

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171484 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMove the common source locations of CastStmt & DefaultStmt into their base class...
Argyrios Kyrtzidis [Fri, 4 Jan 2013 18:30:04 +0000 (18:30 +0000)]
Move the common source locations of CastStmt & DefaultStmt into their base class, SwitchCase.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171483 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[arcmt] Don't error if an autoreleased variable is returned after the -autorelease.
Argyrios Kyrtzidis [Fri, 4 Jan 2013 18:29:59 +0000 (18:29 +0000)]
[arcmt] Don't error if an autoreleased variable is returned after the -autorelease.

rdar://12952025

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171482 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove -Wmodule-build; it was a dumb idea anyway. <rdar://problem/12957525>
Douglas Gregor [Fri, 4 Jan 2013 18:22:19 +0000 (18:22 +0000)]
Remove -Wmodule-build; it was a dumb idea anyway. <rdar://problem/12957525>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171478 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix fieldNo usage for lambdas. No behavior change since the
Eric Christopher [Fri, 4 Jan 2013 17:59:07 +0000 (17:59 +0000)]
Fix fieldNo usage for lambdas. No behavior change since the
field number was 0 anyhow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171472 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoWarn on unused auto variables.
Rafael Espindola [Thu, 3 Jan 2013 04:29:20 +0000 (04:29 +0000)]
Warn on unused auto variables.

To do so we have to wait until we know that the type of a variable has been
deduced. Sema::FinalizeDeclaration is the first callback that is used for
decl with or without initializers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171458 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse early returns to reduce indentation.
Rafael Espindola [Thu, 3 Jan 2013 04:05:19 +0000 (04:05 +0000)]
Use early returns to reduce indentation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171457 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[arcmt] Rewrite uses of Block_copy/Block_release macros.
Argyrios Kyrtzidis [Thu, 3 Jan 2013 03:17:17 +0000 (03:17 +0000)]
[arcmt] Rewrite uses of Block_copy/Block_release macros.

  c = Block_copy(b);
  Block_release(c);
 ---->
  c = [b copy];
  <removed>

rdar://9408211

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171454 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix capitalization of Objective-C in diagnostic.
Ted Kremenek [Thu, 3 Jan 2013 01:30:20 +0000 (01:30 +0000)]
Fix capitalization of Objective-C in diagnostic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171440 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMake MallocChecker debug output useful.
Ted Kremenek [Thu, 3 Jan 2013 01:30:12 +0000 (01:30 +0000)]
Make MallocChecker debug output useful.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171439 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDon't assert/crash on reference variables in lambdas bound to a
Eli Friedman [Thu, 3 Jan 2013 00:39:26 +0000 (00:39 +0000)]
Don't assert/crash on reference variables in lambdas bound to a
static local variable from the parent scope.  PR14773.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171433 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Rename callback EndPath -> EndFunction
Anna Zaks [Thu, 3 Jan 2013 00:25:29 +0000 (00:25 +0000)]
[analyzer] Rename callback EndPath -> EndFunction

This better reflects when callback is called and what the checkers
are relying on. (Both names meant the same pre-IPA.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171432 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd docs/README.txt to point to llvm/docs/README.txt.
Sean Silva [Wed, 2 Jan 2013 23:25:41 +0000 (23:25 +0000)]
Add docs/README.txt to point to llvm/docs/README.txt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171426 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoanalyzer: add initial Sphinx configuration
Sean Silva [Wed, 2 Jan 2013 23:07:22 +0000 (23:07 +0000)]
analyzer: add initial Sphinx configuration

This is just the output of sphinx-quickstart. Now all that is needed
to begin converting the analyzer docs to reST is the server-side setup.

The analyzer folks have asked me to keep this segregated from the other
clang docs since the analyzer is a logically separate project (and has
its own separate web page) even though it resides in the clang tree.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171425 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoExclude docs/analyzer/ from the default Sphinx build.
Sean Silva [Wed, 2 Jan 2013 22:48:50 +0000 (22:48 +0000)]
Exclude docs/analyzer/ from the default Sphinx build.

This paves the way for converting the analyzer docs to Sphinx (by
setting up a nested Sphinx tree in this directory).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171424 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[python bindings] Expose cursor.referenced (clang_getCursorReferenced).
Argyrios Kyrtzidis [Wed, 2 Jan 2013 22:31:57 +0000 (22:31 +0000)]
[python bindings] Expose cursor.referenced (clang_getCursorReferenced).

Patch by Matthew King!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171423 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agohexagon-target-basic.c test: add REQUIRES line for hexagon target
Dmitri Gribenko [Wed, 2 Jan 2013 22:30:14 +0000 (22:30 +0000)]
hexagon-target-basic.c test: add REQUIRES line for hexagon target

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171422 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDiagnosticIds: Fix offset/ID calculation, no impact outside this code.
Argyrios Kyrtzidis [Wed, 2 Jan 2013 22:26:07 +0000 (22:26 +0000)]
DiagnosticIds: Fix offset/ID calculation, no impact outside this code.

Patch by Will Dietz:

Minor touchup so the values of Offset/ID reflect their intention.
Previously, the sum (Offset+ID) was correct, but Offset/ID
individually were wrong.

Caught by investigating unsigned overflow reported by -fsanitize=integer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171421 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agodocs: Mark ReleaseNotes as "In-Progress"
Sean Silva [Wed, 2 Jan 2013 22:05:33 +0000 (22:05 +0000)]
docs: Mark ReleaseNotes as "In-Progress"

Even though we do have a `.. warning::` directive on the page, hopefully
having "In-Progress" in the title will help to condition people's
expectations a bit for when they run into the extremely bare-bones
release notes.

Also, when release season comes around again, maybe this will get
people's attention and avoid confusion about what is going into the
upcoming release, and what is for changes to trunk for the next version.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171419 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agodocs: Take advantage of extra level of headings.
Sean Silva [Wed, 2 Jan 2013 21:50:48 +0000 (21:50 +0000)]
docs: Take advantage of extra level of headings.

The way Sphinx treats the "top-level" adornments is weird. It usually
uses the first top-level adornment as the page title, even if the
top-level adornment is just one "section" out of many (i.e. if the first
section is "Introduction", then it will make the page title be
"Introduction"). This behavior can be overriden by using an explicit
`..  title::` directive to set the title.

Since the Sphinx stylesheet that Clang is currently using ('haiku')
nicely puts the document title at the top of the page in the header,
this weird default behavior was resulting in a redundant "title" in the
body content. Getting rid of this redundant level of headings
effectively "exposes" one more level of heading from the stylesheet to
which now makes the real "sections" more distinct.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171417 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoCorrect Hexagon DataLayout string. Fixes bug 14744.
Anshuman Dasgupta [Wed, 2 Jan 2013 21:25:57 +0000 (21:25 +0000)]
Correct Hexagon DataLayout string. Fixes bug 14744.

Patch by Krzysztof Parzyszek!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171415 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoType safety attributes: add tests for enumerations (users are actually doing
Dmitri Gribenko [Wed, 2 Jan 2013 21:12:03 +0000 (21:12 +0000)]
Type safety attributes: add tests for enumerations (users are actually doing
this, ensure we don't regress)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171412 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agodocs: Curb excessive table-of-contents depth.
Sean Silva [Wed, 2 Jan 2013 21:09:58 +0000 (21:09 +0000)]
docs: Curb excessive table-of-contents depth.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171410 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agodocs: Reorganize landing page.
Sean Silva [Wed, 2 Jan 2013 21:03:11 +0000 (21:03 +0000)]
docs: Reorganize landing page.

Language extensions are highly relevant to using clang as a compiler, so
move LanguageExtensions up into `Using Clang as a Compiler` on the
landing page.

The other documents from the now-gone `Language Extensions and Specs`
section on the landing page nicely fit hierarchically under
LanguageExtensions.rst, so put them under LanguageExtensions.rst's
toctree instead of on the landing page.

Impetus from Jordan Rose.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171409 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agodocs: Fix spelling error.
Sean Silva [Wed, 2 Jan 2013 20:22:14 +0000 (20:22 +0000)]
docs: Fix spelling error.

Spotted by Nikola Smiljanic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171407 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove the anonymous namespace from lib/Sema/TreeTransform.h
Argyrios Kyrtzidis [Wed, 2 Jan 2013 19:10:22 +0000 (19:10 +0000)]
Remove the anonymous namespace from lib/Sema/TreeTransform.h

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171402 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFixes multiple formatting bugs.
Manuel Klimek [Wed, 2 Jan 2013 18:33:23 +0000 (18:33 +0000)]
Fixes multiple formatting bugs.

Fixes:
- incorrect handling of multiple consecutive preprocessor directives
- crash when trying to right align the escpaed newline for a line that
  is longer than the column limit
- using only ColumnLimit-1 columns when layouting with escaped newlines
  inside preprocessor directives

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171401 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDon't allow line breaks after template parameters.
Daniel Jasper [Wed, 2 Jan 2013 18:30:06 +0000 (18:30 +0000)]
Don't allow line breaks after template parameters.

This fixes llvm.org/PR14786.

We will need to split there as a last resort, but that should be done
consistently independent of whether the type is a template type or not.

Before:
template <typename T>
aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<T>
                    ::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
template <typename T>
aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaa,
                    aaaaaaaaaaaaaaaaaaaaaaaaaa<T>::aaaaaaaaaa,
                    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171400 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFormat */& as binary operator if followed by a unary operator.
Daniel Jasper [Wed, 2 Jan 2013 17:21:36 +0000 (17:21 +0000)]
Format */& as binary operator if followed by a unary operator.

This fixes llvm.org/PR14687.
Also fixes segfault for lines starting with * or &.

Before:
a *~b;
*a = 1;  // <- this segfaulted

After:
a * ~b;
*a = 1;  // no segfault :-)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171396 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFixes use of unescaped newlines when formatting preprocessor directives.
Manuel Klimek [Wed, 2 Jan 2013 16:30:12 +0000 (16:30 +0000)]
Fixes use of unescaped newlines when formatting preprocessor directives.

This is the first step towards handling preprocessor directives. This
patch only fixes the most pressing issue, namely correctly escaping
newlines for tokens within a sequence of a preprocessor directive.

The next step will be to fix incorrect format decisions on #define
directives.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171393 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoCorrectly format pointers and references in casts.
Daniel Jasper [Wed, 2 Jan 2013 15:46:59 +0000 (15:46 +0000)]
Correctly format pointers and references in casts.

This fixes llvm.org/PR14747.

Before: Type *A = (Type * ) P;
After:  Type *A = (Type *) P;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171390 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUnderstand unary operators after "return" and "case".
Daniel Jasper [Wed, 2 Jan 2013 15:26:16 +0000 (15:26 +0000)]
Understand unary operators after "return" and "case".

This fixes llvm.org/PR14746.

Before: return - 1;
After:  return -1;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171389 91177308-0d34-0410-b5e6-96231b3b80d8