]> granicus.if.org Git - clang/log
clang
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

11 years agoPrefer splitting after "template <...>" and fix indentation.
Daniel Jasper [Wed, 2 Jan 2013 15:08:56 +0000 (15:08 +0000)]
Prefer splitting after "template <...>" and fix indentation.

This addresses llvm.org/PR14699

Before:
template <typename T>
    void looooooooooooooooooooooongFunction(int Param1, int Param2);
template <typename T> void looooooooooooooooooooongFunction(
    int Paaaaaaaaaaaaaaaaaaaaram1, int Paaaaaaaaaaaaaaaaaaaaram2);

After:
template <typename T>
void looooooooooooooooooooooongFunction(int Param1, int Param2);
template <typename T>
void looooooooooooooooooooongFunction(int Paaaaaaaaaaaaaaaaaaaaram1,
                                      int Paaaaaaaaaaaaaaaaaaaaram2);

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

11 years agoPrefer to break after operators over breaking after "(".
Daniel Jasper [Wed, 2 Jan 2013 14:40:02 +0000 (14:40 +0000)]
Prefer to break after operators over breaking after "(".

Before:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
                                 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

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

11 years agodocs: `3.2` -> `3.3`
Sean Silva [Wed, 2 Jan 2013 13:25:05 +0000 (13:25 +0000)]
docs: `3.2` -> `3.3`

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

11 years agodocs: Remove useless discussion.
Sean Silva [Wed, 2 Jan 2013 13:23:37 +0000 (13:23 +0000)]
docs: Remove useless discussion.

The linked Makefile is always up to date, so there's no point in having
a rotting list of libraries.

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

11 years agodocs: Fix up HTML links to proper reST links.
Sean Silva [Wed, 2 Jan 2013 13:07:47 +0000 (13:07 +0000)]
docs: Fix up HTML links to proper reST links.

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

11 years agodocs: clang-format is coming down the pike, mention it
Sean Silva [Wed, 2 Jan 2013 12:49:25 +0000 (12:49 +0000)]
docs: clang-format is coming down the pike, mention it

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

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

I clustered the docs by some intuitive/fuzzy notion of "similarity", and
some reasonable categories seemed to materialize. I tried to give the
clusters useful names, but you may want to take a look at the landing
page (<http://clang.llvm.org/docs/> for the lazy) and share your
thoughts.

I have to say, this small change really gives the docs a whole new life!
It makes our documentation quite a bit easier to navigate and scope out.

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

11 years agoremove random spaces
Sean Silva [Wed, 2 Jan 2013 12:40:31 +0000 (12:40 +0000)]
remove random spaces

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

11 years agodocs: Change title.
Sean Silva [Wed, 2 Jan 2013 12:40:15 +0000 (12:40 +0000)]
docs: Change title.

The core of this page is a set of pros/cons for the different ways to
use clang as a library. The title should reflect that the page helps you
choose between alternatives.

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

11 years agodocs: Decrease toctree depth on landing page.
Sean Silva [Wed, 2 Jan 2013 12:39:50 +0000 (12:39 +0000)]
docs: Decrease toctree depth on landing page.

Having the table of contents there was making it hard to easily see at a
glance all the docs we have.

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

11 years agodocs: Sphinx conversion is "done"
Sean Silva [Wed, 2 Jan 2013 12:39:02 +0000 (12:39 +0000)]
docs: Sphinx conversion is "done"

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

11 years agos/CXX0X/CXX11/g, except for __GNU_EXPERIMENTAL_CXX0X__, and update a few nearby ...
Richard Smith [Wed, 2 Jan 2013 12:01:23 +0000 (12:01 +0000)]
s/CXX0X/CXX11/g, except for __GNU_EXPERIMENTAL_CXX0X__, and update a few nearby 'C++0x' comments.

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

11 years agoRewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate to
Chandler Carruth [Wed, 2 Jan 2013 11:45:17 +0000 (11:45 +0000)]
Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate to
reflect the migration in r171366.

Re-sort the #include lines to reflect the new paths.

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

11 years agos/CPlusPlus0x/CPlusPlus11/g
Richard Smith [Wed, 2 Jan 2013 11:42:31 +0000 (11:42 +0000)]
s/CPlusPlus0x/CPlusPlus11/g

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

11 years agoRe-sort #include lines using the llvm/utils/sort_includes.py script.
Chandler Carruth [Wed, 2 Jan 2013 10:28:36 +0000 (10:28 +0000)]
Re-sort #include lines using the llvm/utils/sort_includes.py script.

Removes a duplicate #include as well as cleaning up some sort order
regressions since I last ran the script over Clang.

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

11 years agoUnderstand * and & in ternary expressions.
Daniel Jasper [Wed, 2 Jan 2013 08:57:10 +0000 (08:57 +0000)]
Understand * and & in ternary expressions.

Before: "int a = b ? *c : * d;"
After: "int a = b ? *c : *d;

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

11 years agoDon't break after pointer or reference specifier.
Daniel Jasper [Wed, 2 Jan 2013 08:44:14 +0000 (08:44 +0000)]
Don't break after pointer or reference specifier.

This fixes llvm.org/PR14717.
Buggy format:
TypeSpecDecl *
    TypeSpecDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
                         IdentifierInfo *II, Type *T) {

Now changed to:
TypeSpecDecl *TypeSpecDecl::Create(ASTContext &C, DeclContext *DC,
                                   SourceLocation L, IdentifierInfo *II,
                                   Type *T) {

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

11 years agoConvert an if that never happens to an assert.
Rafael Espindola [Wed, 2 Jan 2013 04:19:07 +0000 (04:19 +0000)]
Convert an if that never happens to an assert.

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

11 years agoSimplify vector splat code. No functionality change.
Benjamin Kramer [Tue, 1 Jan 2013 20:08:10 +0000 (20:08 +0000)]
Simplify vector splat code. No functionality change.

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

11 years agoUpdate the copyright coredits -- Happy new year 2013!
NAKAMURA Takumi [Tue, 1 Jan 2013 10:00:19 +0000 (10:00 +0000)]
Update the copyright coredits -- Happy new year 2013!

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

11 years agoSilence some warnings and allow passing down some feature flags to the linker.
Rafael Espindola [Mon, 31 Dec 2012 22:41:36 +0000 (22:41 +0000)]
Silence some warnings and allow passing down some feature flags to the linker.
Patch by Brad Smith.

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

11 years agoFix minor copy-pasto. No functionality change.
Nico Weber [Mon, 31 Dec 2012 02:59:14 +0000 (02:59 +0000)]
Fix minor copy-pasto. No functionality change.

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

11 years agoRemove some remnants of OwningExprResult / OwningStmtResult.
Nico Weber [Mon, 31 Dec 2012 00:28:03 +0000 (00:28 +0000)]
Remove some remnants of OwningExprResult / OwningStmtResult.

These got deleted late 2010 during the Actions/Sema unification.
No functionality change.

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

11 years agoSimplify. No functionality change.
Nico Weber [Sun, 30 Dec 2012 23:36:56 +0000 (23:36 +0000)]
Simplify. No functionality change.

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

11 years agoDon't warn on unused member functions that are extern because of a typedef.
Rafael Espindola [Sun, 30 Dec 2012 21:42:26 +0000 (21:42 +0000)]
Don't warn on unused member functions that are extern because of a typedef.

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

11 years agoFormatter: parse and format inline namespaces like regular namespaces
Dmitri Gribenko [Sun, 30 Dec 2012 21:27:25 +0000 (21:27 +0000)]
Formatter: parse and format inline namespaces like regular namespaces

This changes formatting from:

inline namespace X {
  class A {
  };
}

to:

inline namespace X {
class A {
};
}

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

11 years ago[ubsan] Recover by default, use -fno-sanitize-recover to disable.
Will Dietz [Sun, 30 Dec 2012 20:53:28 +0000 (20:53 +0000)]
[ubsan] Recover by default, use -fno-sanitize-recover to disable.

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

11 years agoUse hasCLanguageLinkage when warning about non C return types.
Rafael Espindola [Sun, 30 Dec 2012 20:40:41 +0000 (20:40 +0000)]
Use hasCLanguageLinkage when warning about non C return types.

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

11 years agoComment lexing: replace manual comparison with StringRef::find_first_of
Dmitri Gribenko [Sun, 30 Dec 2012 19:45:46 +0000 (19:45 +0000)]
Comment lexing: replace manual comparison with StringRef::find_first_of

This gives an about 1.8% improvement on Clang bootstrap with -Wdocumentation

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

11 years agoDon't get confused if a extern "C" builtin function is redeclared without
Rafael Espindola [Sun, 30 Dec 2012 17:23:09 +0000 (17:23 +0000)]
Don't get confused if a extern "C" builtin function is redeclared without
the extern "C".

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

11 years agoRemove the Function::getFnAttributes method in favor of using the AttributeSet
Bill Wendling [Sun, 30 Dec 2012 10:32:17 +0000 (10:32 +0000)]
Remove the Function::getFnAttributes method in favor of using the AttributeSet
directly.

This is in preparation for removing the use of the 'Attribute' class as a
collection of attributes. That will shift to the AttributeSet class instead.

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

11 years agoDon't warn for undefined but used decls that are external because of a typedef.
Rafael Espindola [Sat, 29 Dec 2012 23:43:00 +0000 (23:43 +0000)]
Don't warn for undefined but used decls that are external because of a typedef.

This fixes pr14736. It is fairly ugly, but I don't think we can do much better
as we have to wait at least until the end of the typedef to know if the
function will have external linkage or not.

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

11 years agoArrayRefize CXXTryStmt.
Nico Weber [Sat, 29 Dec 2012 20:13:03 +0000 (20:13 +0000)]
ArrayRefize CXXTryStmt.

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

11 years agoArrayRefize a CompoundStmt constructor.
Nico Weber [Sat, 29 Dec 2012 20:03:39 +0000 (20:03 +0000)]
ArrayRefize a CompoundStmt constructor.

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

11 years agoFix a typo that caused a few standard library implementations of sort to
Chandler Carruth [Sat, 29 Dec 2012 13:00:47 +0000 (13:00 +0000)]
Fix a typo that caused a few standard library implementations of sort to
get the wrong answer. Wasn't caught by my implementation sadly...

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

11 years agoTry to re-structure the GCCVersion comparison routine to make it easier
Chandler Carruth [Sat, 29 Dec 2012 12:01:08 +0000 (12:01 +0000)]
Try to re-structure the GCCVersion comparison routine to make it easier
to read and tell that it is a SWO -- we now descend through the
components and return a result at the first inequal component.

Also comment it a bit better and make it a total ordering by sorting on
the text of the suffix if necessary.

None of this should really be a visible change.

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

11 years agoRemoved duplicate logic.
Erik Verbruggen [Sat, 29 Dec 2012 11:27:03 +0000 (11:27 +0000)]
Removed duplicate logic.

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

11 years agoMinor cleanup.
Rafael Espindola [Sat, 29 Dec 2012 01:09:46 +0000 (01:09 +0000)]
Minor cleanup.

DS parameter  has a default (null) value anyway, so there's no need for an
if/else here.
Patch by Nikola Smiljanić.

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

11 years agoReject overloading of two static extern C functions.
Rafael Espindola [Fri, 28 Dec 2012 14:21:58 +0000 (14:21 +0000)]
Reject overloading of two static extern C functions.

This patch moves hasCLanguageLinkage to be VarDecl and FunctionDecl methods
so that they can be used from SemaOverload.cpp and then fixes the logic
in Sema::IsOverload.

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

11 years agoReplace magic numbers in CheckICE with an enum.
Richard Smith [Fri, 28 Dec 2012 13:25:52 +0000 (13:25 +0000)]
Replace magic numbers in CheckICE with an enum.

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

11 years agoPR14729: Fix typo in CheckICE for BinaryConditionalOperators.
Richard Smith [Fri, 28 Dec 2012 12:53:55 +0000 (12:53 +0000)]
PR14729: Fix typo in CheckICE for BinaryConditionalOperators.

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

11 years agoImprove diagnostic wording for when an implicitly-deleted special member
Richard Smith [Fri, 28 Dec 2012 12:23:24 +0000 (12:23 +0000)]
Improve diagnostic wording for when an implicitly-deleted special member
function is selected by overload resolution.

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

11 years agoAdd proper support for -fsanitize-blacklist= flag for TSan and MSan. Clang part.
Alexey Samsonov [Fri, 28 Dec 2012 09:31:34 +0000 (09:31 +0000)]
Add proper support for -fsanitize-blacklist= flag for TSan and MSan. Clang part.

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

11 years agoChange this to an IR test instead of an assembly test (as per comment in r171134).
David Blaikie [Fri, 28 Dec 2012 01:16:31 +0000 (01:16 +0000)]
Change this to an IR test instead of an assembly test (as per comment in r171134).

This makes the test not dependent on LLVM & won't vary/break based on LLVM
codegen related changes. Appropriately testing at the Clang level what was
fixed at the Clang level originally (in r124210).

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

11 years agoSimplify typeid 'potentially evaluated' check.
Richard Smith [Thu, 27 Dec 2012 15:26:27 +0000 (15:26 +0000)]
Simplify typeid 'potentially evaluated' check.

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

11 years agoImplement dcl.link paragraph 5.
Rafael Espindola [Thu, 27 Dec 2012 03:56:20 +0000 (03:56 +0000)]
Implement dcl.link paragraph 5.

The language linkage of redeclarations must match. GCC was already reporting
an error for this.

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

11 years agoUpdate test for backend change.
Eric Christopher [Thu, 27 Dec 2012 02:20:24 +0000 (02:20 +0000)]
Update test for backend change.

TODO: This test should be moved to the backend.

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

11 years agoFix a regression from the previous commit.
Rafael Espindola [Wed, 26 Dec 2012 04:38:44 +0000 (04:38 +0000)]
Fix a regression from the previous commit.
Template instantiation can set the canonical decl to used after subsequent
decls have been chained, so we have to check that too.

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

11 years agoUse the most recent redecl to decide if it is needed.
Rafael Espindola [Wed, 26 Dec 2012 00:13:29 +0000 (00:13 +0000)]
Use the most recent redecl to decide if it is needed.

This fixes pr14691, which I think is a regression from r168519.

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

11 years agoProduce an actual error before attempting to attach notes to it when bailing out
Richard Smith [Tue, 25 Dec 2012 21:56:27 +0000 (21:56 +0000)]
Produce an actual error before attempting to attach notes to it when bailing out
due to FORCE_CLANG_DIAGNOSTICS_CRASH=1. Also add a test for that env var.

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

11 years agoFix for PR12222.
Erik Verbruggen [Tue, 25 Dec 2012 14:51:39 +0000 (14:51 +0000)]
Fix for PR12222.

Changed getLocStart() and getLocEnd() to be required for Stmts, and make
getSourceRange() optional. The default implementation for getSourceRange()
is build the range by calling getLocStart() and getLocEnd().

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

11 years agoAdd intel_ocl_bicc calling convention as a function attribute to clang. The calling...
Guy Benyei [Tue, 25 Dec 2012 08:53:55 +0000 (08:53 +0000)]
Add intel_ocl_bicc calling convention as a function attribute to clang. The calling convention is already implemented in LLVM.

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

11 years agoAdd 171048 back but invalidate the cache of all redeclarations when setting
Rafael Espindola [Tue, 25 Dec 2012 07:31:49 +0000 (07:31 +0000)]
Add 171048 back but invalidate the cache of all redeclarations when setting
the body of a functions. The problem was that hasBody looks at the entire chain
and causes problems to -fvisibility-inlines-hidden if the cache was not
invalidated.

Original message:

Cache visibility of decls.

This unifies the linkage and visibility caching. I first implemented this when
working on pr13844, but the previous fixes removed the performance advantage of
this one.
This is still a step in the right direction for making linkage and visibility
cheap to use.

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

11 years agoRevert r171048, "Cache visibility of decls."
NAKAMURA Takumi [Tue, 25 Dec 2012 04:47:44 +0000 (04:47 +0000)]
Revert r171048, "Cache visibility of decls."

It broke stage2.

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

11 years agoCache visibility of decls.
Rafael Espindola [Tue, 25 Dec 2012 00:39:58 +0000 (00:39 +0000)]
Cache visibility of decls.

This unifies the linkage and visibility caching. I first implemented this when
working on pr13844, but the previous fixes removed the performance advantage of
this one.

This is still a step in the right direction for making linkage and visibility
cheap to use.

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

11 years agoSimplify RUN lines. No functionality change.
Nick Lewycky [Mon, 24 Dec 2012 21:45:14 +0000 (21:45 +0000)]
Simplify RUN lines. No functionality change.

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

11 years agoLet clang-format format itself.
Daniel Jasper [Mon, 24 Dec 2012 16:51:15 +0000 (16:51 +0000)]
Let clang-format format itself.

Apply all formatting changes that clang-format would apply to its own source
code. All choices seem to improve readability (or at least not make it worse).
No functional changes.

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

11 years agoPenalize tokens with a lower parenthesis level than the start of the line.
Daniel Jasper [Mon, 24 Dec 2012 16:43:00 +0000 (16:43 +0000)]
Penalize tokens with a lower parenthesis level than the start of the line.

This prevents formattings like this (assuming "parameter" doesn't fit the line):
  bool f = someFunction() && someFunctionWithParam(
      parameter) && someOtherFunction();

Here, "parameter" - the start of line 2 - has a parenthesis level of 2, but
there are subsequent tokens ("&&" and "someOtherFunction") with a lower level.
This is bad for readability as "parameter" hides "someOtherFunction". With this
patch, this changes to:
  bool f = someFunction() &&
           someFunctionWithParam(parameter) &&
           someOtherFunction();

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

11 years agoAlign RHS after assignments and return statements.
Daniel Jasper [Mon, 24 Dec 2012 13:43:52 +0000 (13:43 +0000)]
Align RHS after assignments and return statements.

This changes:
  int Result = a +  // force break
      b;
  return Result +  // force break
      5;

To:
  int Result = a +  // force break
               b;
  return Result +  // force break
         5;

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

11 years agoFix formatting over overloaded operators.
Daniel Jasper [Mon, 24 Dec 2012 10:56:04 +0000 (10:56 +0000)]
Fix formatting over overloaded operators.

This fixes llvm.org/pr14686.

We used to add too many spaces for different versions of overloaded operator
function declarations/definitions. This patch changes, e.g.

  operator *() {}
  operator >() {}
  operator () () {}

to

  operator*() {}
  operator>() {}
  operator()() {}

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

11 years agoSupport -fsanitize-memory-track-origins.
Evgeniy Stepanov [Mon, 24 Dec 2012 08:42:34 +0000 (08:42 +0000)]
Support -fsanitize-memory-track-origins.

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

11 years agoCGClass.cpp: [PR14335] Remove comma-separated \param, for now. [-Wdocumentation]
NAKAMURA Takumi [Mon, 24 Dec 2012 02:03:30 +0000 (02:03 +0000)]
CGClass.cpp: [PR14335] Remove comma-separated \param, for now. [-Wdocumentation]

/// \param argBegin,argEnd the arguments to evaluate and pass to the constructor

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

11 years agoclang/AST/VTTBuilder.h: Prune one description in three methods, VTTBuilder::AddVTable...
NAKAMURA Takumi [Mon, 24 Dec 2012 01:49:04 +0000 (01:49 +0000)]
clang/AST/VTTBuilder.h: Prune one description in three methods, VTTBuilder::AddVTablePointer(), VTTBuilder::LayoutSecondaryVirtualPointers(), and VTTBuilder::LayoutSecondaryVirtualPointers(). [-Wdocumentation]

/// \param AddressPoints - If the vtable is a construction vtable, this has the address points for it.

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

11 years agoCGDecl.cpp: Prune three descriptions in two methods, CodeGenFunction::pushIrregularPa...
NAKAMURA Takumi [Mon, 24 Dec 2012 01:48:59 +0000 (01:48 +0000)]
CGDecl.cpp: Prune three descriptions in two methods, CodeGenFunction::pushIrregularPartialArrayCleanup() and CodeGenFunction::pushRegularPartialArrayCleanup(). [-Wdocumentation]

/// \param array - a value of type elementType*
/// \param destructionKind - the kind of destruction required
/// \param initializedElementCount - a value of type size_t* holding the number of successfully-constructed elements

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

11 years agoDiagnosticRenderer.cpp: Prune one description in DiagnosticRenderer::emitMacroExpansi...
NAKAMURA Takumi [Mon, 24 Dec 2012 01:48:53 +0000 (01:48 +0000)]
DiagnosticRenderer.cpp: Prune one description in DiagnosticRenderer::emitMacroExpansions(). [-Wdocumentation]

/// \param MacroSkipEnd The depth to stop skipping macro expansions.

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

11 years agoCGValue.h: Update one \param to Addr in MakeBitfield(). [-Wdocumentation]
NAKAMURA Takumi [Mon, 24 Dec 2012 01:48:48 +0000 (01:48 +0000)]
CGValue.h: Update one \param to Addr in MakeBitfield(). [-Wdocumentation]

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

11 years agotest/Index/preamble_macro_template.cpp: Tweak for win32.
NAKAMURA Takumi [Mon, 24 Dec 2012 01:23:48 +0000 (01:23 +0000)]
test/Index/preamble_macro_template.cpp: Tweak for win32.

Using the file immediately after "> file 2>&1" causes weird behavior on win32.
For example, "foo > %t 2>&1; FileCheck --input-file=%t"

Use "foo 2>&1 | tee %t" instead.

Note, mixing stdout and stderr to the same handle might cause unexpected behavior, due to buffering.

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

11 years agoTake operator precedence into account when splitting lines.
Daniel Jasper [Mon, 24 Dec 2012 00:13:23 +0000 (00:13 +0000)]
Take operator precedence into account when splitting lines.

With this patch, splitting after binary operators has a panelty corresponding
to the operator's precedence. We used to ignore this and eagerly format like:

  if (aaaaaaaaaaaaaaaaaaaaaaaaa || bbbbbbbbbbbbbbbbbbbbbbbbb &&
      ccccccccccccccccccccccccc) { .. }

With this patch, this becomes:

  if (aaaaaaaaaaaaaaaaaaaaaaaaa ||
      bbbbbbbbbbbbbbbbbbbbbbbbb && ccccccccccccccccccccccccc) { .. }

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

11 years agoDocumentation: PTHInternals: use correct adornments and fix typos
Dmitri Gribenko [Sun, 23 Dec 2012 18:39:54 +0000 (18:39 +0000)]
Documentation: PTHInternals: use correct adornments and fix typos

Fixes PR14014

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

11 years agoDocumentation: fix a syntax error: empty line required after code-block::
Dmitri Gribenko [Sun, 23 Dec 2012 18:36:44 +0000 (18:36 +0000)]
Documentation: fix a syntax error: empty line required after code-block::

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

11 years agoDocumentation: add MemorySanitizer to the toctree
Dmitri Gribenko [Sun, 23 Dec 2012 18:35:58 +0000 (18:35 +0000)]
Documentation: add MemorySanitizer to the toctree

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

11 years agodocs: Convert ReleaseNotes to reST.
Sean Silva [Sun, 23 Dec 2012 01:19:35 +0000 (01:19 +0000)]
docs: Convert ReleaseNotes to reST.

This is the last of the "regular" documents to convert to reST, and so
I'm declaring the initial clang reST conversion "done".

However,

- There are some documents in clang/www/ which probably should
  be migrated into clang/docs/, such as www/OpenProjects.html

  The primary thing blocking me from doing this right now is not knowing
  how to set up a redirect so that the old URL's continue to work.

- LibASTMatchersReference.html is not reST. This page is auto-generated
  by clang/docs/tools/dump_ast_matchers.py from the source and has some
  collapse/expand logic that isn't expressible directly with Sphinx, so
  just converting it to reST is not really a good strategy.

  Manuel Klimek and I discussed this and the general agreed-upon
  direction is making that page data-driven so that it, say, pulls in an
  auto-generated blob of JSON which describes the matchers and builds up
  the "matcher reference" part of the page with a small amount of JS.

- There are some rogue .txt files hanging around.

Also, I dropped the little dragon logo at the top because Sphinx was
warning about an external image reference (not sure why, but meh, I
didn't want to fight it). If anything, we would want such a logo
integrated into the site's overall theme, rather than hardcoded here.

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

11 years agolibFormat: Teach the *& usage heuristic that "return" starts a rhs too.
Nico Weber [Sun, 23 Dec 2012 01:07:46 +0000 (01:07 +0000)]
libFormat: Teach the *& usage heuristic that "return" starts a rhs too.

"return a*b;" was formatted as "return a *b;" and is now formatted as "return a * b;".

Fixes PR14687 partially.

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

11 years agoMove a declaration closer to its use. No functionality change.
Nico Weber [Sun, 23 Dec 2012 00:40:46 +0000 (00:40 +0000)]
Move a declaration closer to its use. No functionality change.

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

11 years agoClean out release notes for clang 3.3
Benjamin Kramer [Sat, 22 Dec 2012 16:12:31 +0000 (16:12 +0000)]
Clean out release notes for clang 3.3

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

11 years ago[libclang] Fix crash when code-completing a macro invocation that
Argyrios Kyrtzidis [Sat, 22 Dec 2012 04:48:10 +0000 (04:48 +0000)]
[libclang] Fix crash when code-completing a macro invocation that
reached EOF and did not expand the argument into the source context.

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

11 years ago[libclang] Don't try to translate diagnostics from the precompiled preamble to the
Argyrios Kyrtzidis [Sat, 22 Dec 2012 04:48:08 +0000 (04:48 +0000)]
[libclang] Don't try to translate diagnostics from the precompiled preamble to the
code-completion results, the SourceManager state may be slightly
different when code-completing.

And we don't even care for diagnostics when code-completing, anyway.

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

11 years ago[libclang] Check for the 'LIBCLANG_NOTHREADS' environment variable before creating
Argyrios Kyrtzidis [Sat, 22 Dec 2012 04:48:07 +0000 (04:48 +0000)]
[libclang] Check for the 'LIBCLANG_NOTHREADS' environment variable before creating
a separate thread for code-completion.

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

11 years agoPR14695: Fix assert from bad cast<>. Not every namespace is a NamespaceDecl; it might...
Richard Smith [Sat, 22 Dec 2012 02:46:14 +0000 (02:46 +0000)]
PR14695: Fix assert from bad cast<>. Not every namespace is a NamespaceDecl; it might instead be a TranslationUnitDecl.

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

11 years agoAdd back -Wduplicate-enum which I mistakenly removed.
Ted Kremenek [Sat, 22 Dec 2012 01:34:09 +0000 (01:34 +0000)]
Add back -Wduplicate-enum which I mistakenly removed.

This was removed with -Wunique-enum, which is still removed.  The
corresponding thread on cfe-comments for that warning is here:

  http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-September/024224.html

If we get specific user feedback for -Wduplicate-enum we can evaluate
whether or not to keep it.

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

11 years agoFix typo: objc_no_direct_instance_variable_assignmemt => objc_no_direct_instance_vari...
Ted Kremenek [Sat, 22 Dec 2012 00:34:48 +0000 (00:34 +0000)]
Fix typo: objc_no_direct_instance_variable_assignmemt => objc_no_direct_instance_variable_assignment.

Fixes <rdar://problem/12927551>.

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

11 years ago[analyzer] Convert SimpleStreamChecker to use the PointerEscape callback
Anna Zaks [Sat, 22 Dec 2012 00:18:39 +0000 (00:18 +0000)]
[analyzer] Convert SimpleStreamChecker to use the PointerEscape callback

The new callback greatly simplifies the checker.

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

11 years agoUse a safe default width for template-diff'ing integral arguments, in
Douglas Gregor [Fri, 21 Dec 2012 23:03:27 +0000 (23:03 +0000)]
Use a safe default width for template-diff'ing integral arguments, in
case we can't find an exact width to use. Fixes crash in
<rdar://problem/12456626>.

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

11 years agoAdding to FormatTest.cpp test for a very long ObjC method
Fariborz Jahanian [Fri, 21 Dec 2012 22:51:18 +0000 (22:51 +0000)]
Adding to FormatTest.cpp test for a very long ObjC method
declaration requiring formatting of wrap-arounds.

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

11 years agoTweak Sema::CheckLiteralKind() to also include block literals
Ted Kremenek [Fri, 21 Dec 2012 22:46:35 +0000 (22:46 +0000)]
Tweak Sema::CheckLiteralKind() to also include block literals

This simplifies some diagnostic logic in checkUnsafeAssignLiteral(),
hopefully making it less error prone.

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

11 years agoInsulate this test from the whims of the random number generator.
Matt Beaumont-Gay [Fri, 21 Dec 2012 22:43:20 +0000 (22:43 +0000)]
Insulate this test from the whims of the random number generator.

Our internal buildbot just failed because the tempfile happened to be named
'nodefaultlib-lcGA7k.o', which contains the substring '-lc'.

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

11 years agoAdd comments back that were accidentally removed in r170933.
Chad Rosier [Fri, 21 Dec 2012 22:38:37 +0000 (22:38 +0000)]
Add comments back that were accidentally removed in r170933.

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

11 years agoFix a warning due to an extraneous comma.
Chad Rosier [Fri, 21 Dec 2012 22:33:20 +0000 (22:33 +0000)]
Fix a warning due to an extraneous comma.

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

11 years agoRemove unused arguments and rename to conform to coding standards.
Chad Rosier [Fri, 21 Dec 2012 22:24:43 +0000 (22:24 +0000)]
Remove unused arguments and rename to conform to coding standards.

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

11 years agoChange checkUnsafeAssignLiteral() to use the new Sema::CheckLiteralKind().
Ted Kremenek [Fri, 21 Dec 2012 21:59:39 +0000 (21:59 +0000)]
Change checkUnsafeAssignLiteral() to use the new Sema::CheckLiteralKind().

Along the way, fix a bug in CheckLiteralKind(), previously in diagnoseObjCLiteralComparison, where we didn't ignore parentheses
in boxed expressions for purpose of classification.

In other words, both @42 and @(42) should be classified as numeric
literals.

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

11 years agoHoist logic for classifying Objective-C literals into Sema (proper) for use with...
Ted Kremenek [Fri, 21 Dec 2012 21:59:36 +0000 (21:59 +0000)]
Hoist logic for classifying Objective-C literals into Sema (proper) for use with other diagnostics.

No immediate (intended) functionality change.

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

11 years agoSwitch FrontendOptions to using an initializer list rather than initializing
Richard Smith [Fri, 21 Dec 2012 21:52:01 +0000 (21:52 +0000)]
Switch FrontendOptions to using an initializer list rather than initializing
the values in the constructor.  The constructor implementation is trivial
beyond the value initialisations. Patch by Saleem Abdulrasool!

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

11 years agoFixes couple of friend declaration -ast-print bug
Fariborz Jahanian [Fri, 21 Dec 2012 21:43:05 +0000 (21:43 +0000)]
Fixes couple of friend declaration -ast-print bug
found by running -ast-print on all-std-headers.cpp
which caused it to go into infinite loop. Now
-ast-print prints all declarations found in
all-std-headers.cpp.

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

11 years agoIndent.
Chad Rosier [Fri, 21 Dec 2012 21:27:13 +0000 (21:27 +0000)]
Indent.

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