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

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