Commit Graph

42880 Commits

Author SHA1 Message Date
Jordan Rose a2d5f0c742 Various tweaks and updates to the analyzer website.
llvm-svn: 171885
2013-01-08 19:29:37 +00:00
Anna Zaks 454a384e59 [analyzer] Only include uniqueling location as issue_hash when available
This makes us more optimistic when matching reports in a changing code
base. Addresses Jordan's feedback for r171825.

llvm-svn: 171884
2013-01-08 19:19:46 +00:00
Nico Weber d8cdb53e1d Formatter: More ObjC tests.
llvm-svn: 171883
2013-01-08 19:15:23 +00:00
Argyrios Kyrtzidis bf1be59dae [libclang] In clang_equalCursors, clear out the "FirstInDeclGroup" part in a declaration cursor
before doing the comparison.

This is because we can't set "FirstInDeclGroup" consistently; for example, when visiting a DeclStmt we will set
it but we don't set it on the result of clang_getCursorDefinition for a reference of the same declaration.

llvm-svn: 171878
2013-01-08 18:23:28 +00:00
Douglas Gregor c4c1fb39d8 Use Decl::getAvailability() rather than checking for the "unavailable"
attribute when determining whether we need to see an implementation of
a property. Fixes <rdar://problem/12958191>.

llvm-svn: 171877
2013-01-08 18:16:18 +00:00
Nico Weber 7e6a7a19e3 Formatter: Add tests for some ObjC bits that happen to be formatted correctly.
llvm-svn: 171875
2013-01-08 17:56:31 +00:00
Ted Kremenek 0ab78e622f Repost checker-270, which for some reason got deleted.
llvm-svn: 171870
2013-01-08 17:33:58 +00:00
Manuel Klimek 6e67bed48c clang-format can now format #defines.
llvm-svn: 171865
2013-01-08 16:33:20 +00:00
Daniel Jasper 4f397156c4 Don't put spaces around ##.
In Clang/LLVM this seems to be the more common formatting for ##s. There
might still be case that we miss, but we'll fix those as we go along.

Before:

  #define A(X)
    void function ## X();

After:

  #define A(X)
    void function##X();

llvm-svn: 171862
2013-01-08 16:17:54 +00:00
Rafael Espindola c8c61895be Add missing spaces. This doesn't cause problems in practice because we only warn
about _Static_assert with -pedantic.

llvm-svn: 171860
2013-01-08 16:09:04 +00:00
Rafael Espindola ef5ea1df4e Clear the LV cache when setting the instantiated from link.
Fixes pr14835.

llvm-svn: 171857
2013-01-08 14:58:32 +00:00
Daniel Jasper 7c85fde500 Change the data structure used in clang-format.
This is a first step towards supporting more complex structures such
as #ifs inside unwrapped lines. This patch mostly converts the array-based
UnwrappedLine into a linked-list-based UnwrappedLine. Future changes will
allow multiple children for each Token turning the UnwrappedLine into a
tree.

No functional changes intended.

llvm-svn: 171856
2013-01-08 14:56:18 +00:00
Dmitri Gribenko 7daa1a2201 CodeGen/compound-assign-overflow.c: include stdint.h in freestanding mode
This hopefully fixes the ARM buildbot.

llvm-svn: 171853
2013-01-08 14:47:41 +00:00
Sean Silva 3703823b89 docs: "clang tools" are not a different interface.
I spotted someone confused about this, so remove the heading to make it
clear that they really are a part of Tooling.

llvm-svn: 171841
2013-01-08 04:42:09 +00:00
Rafael Espindola 9a5a6dddf9 Clear the LV cache when merging the availability attribute.
The availability implies default visibility, so it can change the computed
visibility.

llvm-svn: 171840
2013-01-08 04:04:30 +00:00
Eric Christopher 9cf4480392 Add a test to make sure that vector output happens for debug info.
llvm-svn: 171834
2013-01-08 01:54:13 +00:00
Ted Kremenek a046169000 Don't warn about undefined varargs argument behavior in unreachable code.
Fixes <rdar://problem/12322000>.

llvm-svn: 171831
2013-01-08 01:50:40 +00:00
David Blaikie f7e654e3a7 Add [artificial] debug info annotation to test matching r171826
llvm-svn: 171830
2013-01-08 01:12:59 +00:00
Argyrios Kyrtzidis 08281fa337 [arcmt] Follow-up for r171484; make sure when adding brackets enclosing case statements,
that the case does not "contain" a declaration that is referenced "outside" of it,
otherwise we will emit un-compilable code.

llvm-svn: 171828
2013-01-08 00:58:25 +00:00
Richard Smith 1ecd564487 Move ref qualifiers from Type bitfields into FunctionProtoType, stealing two
bits from the number of parameters. This brings the bitfields down from 33 bits
to 32 bits, reducing the size of Types by 4 bytes on 32-bit systems.

llvm-svn: 171827
2013-01-08 00:50:27 +00:00
Anna Zaks a043d0cef2 [analyzer] Include the bug uniqueing location in the issue_hash.
The issue here is that if we have 2 leaks reported at the same line for
which we cannot print the corresponding region info, they will get
treated as the same by issue_hash+description. We need to AUGMENT the
issue_hash with the allocation info to differentiate the two issues.

Add the "hash" (offset from the beginning of a function) representing
allocation site to solve the issue.

We might want to generalize solution in the future when we decide to
track more than just the 2 locations from the diagnostics.

llvm-svn: 171825
2013-01-08 00:25:29 +00:00
Anna Zaks 58b961d176 [analyzer] Plist: change the type of issue_hash from int to string.
This gives more flexibility to what could be stored as issue_hash.

llvm-svn: 171824
2013-01-08 00:25:22 +00:00
Anna Zaks af48a938e3 [analyzer] Extend the Representing Values section of the dev manual.
llvm-svn: 171823
2013-01-08 00:25:14 +00:00
NAKAMURA Takumi 160087b1f6 clang/test/CodeGenOpenCL/shifts.cl: Fixup for -Asserts.
llvm-svn: 171820
2013-01-08 00:15:53 +00:00
Richard Smith 27874d603b PR14838: When a member reference is bound to a temporary, don't forget to
perform the semantic checks associated with the destruction of that temporary.
It'll be destroyed at the end of the constructor.

llvm-svn: 171818
2013-01-08 00:08:23 +00:00
Douglas Gregor 21444b96c8 Back out my no-op change from r171783.
llvm-svn: 171817
2013-01-08 00:01:45 +00:00
Dmitri Gribenko b9eb593e50 Correct OpenBSD profiling test
The test should be looking for gcrt0.o not crt0.o.  Clang was already printing
"gcrt0", but the test was looking for "{{.*}}crt0.o", and the .* regexp
consumed "g".

Patch by Brad Smith.

llvm-svn: 171815
2013-01-07 23:55:47 +00:00
David Blaikie 7eb0685969 Extract the instance-method case for debug info out into a separate function.
This is in preparation for using this to construct the function type for
pointers to member functions to include the implicit/artificial 'this'
parameter in that case as well. (feedback from GDB indicates that this might be
all that's necessary to get it to behave well with Clang's pointer-to-member
function debug output)

llvm-svn: 171809
2013-01-07 23:06:35 +00:00
Rafael Espindola fe95841630 add a triple
llvm-svn: 171808
2013-01-07 23:04:04 +00:00
Will Dietz cefb44869a [ubsan] Use correct type for compound assignment ops.
llvm-svn: 171801
2013-01-07 22:25:52 +00:00
David Blaikie 2aaf065103 Simplify computing debug info type for static member functions.
No (intended) functional change.

llvm-svn: 171800
2013-01-07 22:24:59 +00:00
Michael Gottesman 6fd5846b57 Converted Block-ABI-Apple.txt => Block-ABI-Apple.rst.
llvm-svn: 171799
2013-01-07 22:24:45 +00:00
Sean Silva 449e4926a6 docs: Fix inconsistent titles.
Sphinx was whining about this.

llvm-svn: 171796
2013-01-07 21:46:47 +00:00
Sean Silva dc92fc3426 docs: Copy Block-ABI-Apple.txt to output.
This fixes the URL permanence of that URL. This is a bit of a hack. See
the FIXME in the patch for what the "real" solution should be.

llvm-svn: 171795
2013-01-07 21:46:35 +00:00
Fariborz Jahanian 0a17f59db8 Minor refactoring of my last patch
related to // rdar://12958878

llvm-svn: 171792
2013-01-07 21:31:08 +00:00
Daniel Dunbar 5cfa4aeee5 [docs/analyzer] Test commit (for auto-update).
llvm-svn: 171788
2013-01-07 20:44:37 +00:00
Daniel Dunbar 98a93b3845 [docs] Fix an inconsistent title level, and a sphinx warning.
- We don't need any static files currently, so drop that dir.

llvm-svn: 171787
2013-01-07 20:43:06 +00:00
Daniel Dunbar 48f8bc895b [docs/analyzer] Convert existing debug-checks document to Sphinx and link into doctree.
llvm-svn: 171786
2013-01-07 20:38:55 +00:00
Chad Rosier 8f980ef08c Test case for r171784.
llvm-svn: 171785
2013-01-07 20:34:40 +00:00
Douglas Gregor da776f9a8e Use the C++11 POD definition in C++11 mode to determine whether one
can create a VLA of class type. Fixes <rdar://problem/12151822>.

llvm-svn: 171783
2013-01-07 20:03:16 +00:00
Rafael Espindola 0370597620 Use getter. Fixes the build from a bad merge.
llvm-svn: 171782
2013-01-07 20:01:57 +00:00
Rafael Espindola f0dafd3cbb Add support for attribute((mode(unwind_word))).
Patch by Nick Lewycky. Fixes pr8703.

llvm-svn: 171781
2013-01-07 19:58:54 +00:00
Fariborz Jahanian c41cf0598f objective-C: when searching for declarations in protocol
list of classes, etc., make sure to look into protocol
definitions. // rdar://12958878

llvm-svn: 171777
2013-01-07 19:21:03 +00:00
Argyrios Kyrtzidis 68d31ce5ff [libclang] When annotating preprocessor tokens, if we are in a macro definition,
check if the token was ever a macro name and annotate it if that's the case.

llvm-svn: 171776
2013-01-07 19:16:32 +00:00
Argyrios Kyrtzidis 2d77aeb946 [libclang] Simplify annotation of preprocessing tokens and remove the AnnotateTokensData
DenseMap and the lookups associated with it.

Instead of lexing for preprocessor tokens, associating the annotation with the location in a map,
and later lookup in the map in order to adjust the cursor annotation, just annotate the cursor
while lexing for preprocessor tokens.

llvm-svn: 171775
2013-01-07 19:16:30 +00:00
Argyrios Kyrtzidis 98a8874a0d [libclang] Make token annotation of type/storage qualifiers accurate.
Previously type/storage qualifiers would not be annotated as the declaration they belonged to.
Just use the resulting source range of getRawCursorExtent() which is more correct
than what AnnotateTokensWorker::Visit() was adjusting it to.

llvm-svn: 171774
2013-01-07 19:16:27 +00:00
Argyrios Kyrtzidis 579825a50a [libclang] When getting the cursor for an identifier inside a macro definition, check if
this was ever a macro name and return a specific CXCursor_MacroExpansion cursor in such a case,
instead of the generic CXCursor_MacroDefinition.

Checking for macro name makes sure the identifier is not part of the identifier list in a
function macro.
While, in general, resolving identifiers in macro definitions to other macros may not be completely accurate,
it greatly improves functionality such as give-me-the-definition-of-this, which was not working at all
inside macro definitions.

llvm-svn: 171773
2013-01-07 19:16:25 +00:00
Argyrios Kyrtzidis 7572be2e44 [PCH] (De)serialize the end location of MacroInfo.
llvm-svn: 171772
2013-01-07 19:16:23 +00:00
Argyrios Kyrtzidis 86f1a935dc Pull the bulk of Lexer::MeasureTokenLength() out into a new function,
Lexer::getRawToken().

No functionality change.

llvm-svn: 171771
2013-01-07 19:16:18 +00:00
Anna Zaks 030e65d1b2 [analyzer] Fix a false positive in Secure Keychain API checker.
Better handle the blacklisting of known bad deallocators when symbol
escapes through a call to CFStringCreateWithBytesNoCopy.

Addresses radar://12702952.

llvm-svn: 171770
2013-01-07 19:13:00 +00:00
Anna Zaks 5f37643de1 [analyzer] Fix a false positive in the ivar invalidation checker.
When a property is "inherited" through both a parent class and directly
through a protocol, we should not require the child to invalidate it
since the backing ivar belongs to the parent class.
(Fixes radar://12913734)

llvm-svn: 171769
2013-01-07 19:12:56 +00:00
Alexander Kornienko 9569c7625a Fixed a number of -Wcovered-switch-default diagnostics in tools/clang/include/clang/AST/AttrDump.inc
llvm-svn: 171768
2013-01-07 19:09:15 +00:00
Nico Weber 04e9f1ab42 Formatter: Support @public/@protected/@package/@private.
@package is an Objective-C 2 feature, so turn on ObjC2 as well.

llvm-svn: 171766
2013-01-07 19:05:19 +00:00
Dmitri Gribenko a9cc2491dd Comment to XML conversion: no, we don't want to print instantiations for the
<Declaration> tag

llvm-svn: 171763
2013-01-07 18:45:48 +00:00
Manuel Klimek 28cacc740d Fix parsing of variable declarations directly after a class / struct.
Previous indent:
class A {
}
a;
void f() {
};

With this patch:
class A {
} a;
void f() {
}
;

The patch introduces a production for classes and structs, and parses
the rest of the line to the semicolon after the class scope.
This allowed us to remove a long-standing wart in the parser that would
just much the semicolon after any block.
Due to this suboptimal formating some tests were broken.

Some unrelated formatting tests broke; those hit a bug in the ast
printing, and need to be fixed separately.

llvm-svn: 171761
2013-01-07 18:10:23 +00:00
Alexander Kornienko 5bc364eb05 Implement Attr dumping for -ast-dump.
http://llvm-reviews.chandlerc.com/D234

Patch by Philip Craig!

llvm-svn: 171760
2013-01-07 17:53:08 +00:00
Michael Han 309af291ef Add fixit hints for misplaced C++11 attributes around class specifiers.
Following r168626, in class declaration or definition, there are a combination of syntactic locations 
where C++11 attributes could appear, and among those the only valid location permitted by standard is
between class-key and class-name. So for those attributes appear at wrong locations, fixit is used to 
move them to expected location and we recover by applying them to the class specifier.
 

llvm-svn: 171757
2013-01-07 16:57:11 +00:00
Douglas Gregor e68cf27225 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.

llvm-svn: 171756
2013-01-07 16:56:53 +00:00
David Tweed 042e0883cb 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. 

llvm-svn: 171755
2013-01-07 16:43:27 +00:00
Nico Weber d5650bdc1a Formatter: Add tests for try/catch. Let 'throw' start an expression.
Before:
  throw a *b;

Now:
  throw a * b;

llvm-svn: 171754
2013-01-07 16:36:17 +00:00
Nico Weber e89c42f409 Formatter: Don't put spaces betwen @ and objc keywords.
llvm-svn: 171753
2013-01-07 16:14:28 +00:00
Nico Weber 803d61d143 Test all @keywords. Turns out some of them are not formatted correctly yet.
llvm-svn: 171752
2013-01-07 16:07:07 +00:00
Nico Weber 12d5babba0 Slightly expand the @ test to cover whitespace between @ and keyword.
llvm-svn: 171751
2013-01-07 15:56:25 +00:00
NAKAMURA Takumi 0c340a96aa libclang/Makefile: Reorder USEDLIBS along driver/clang.
llvm-svn: 171750
2013-01-07 15:45:20 +00:00
Daniel Jasper f8673bca8d 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..

llvm-svn: 171748
2013-01-07 15:36:15 +00:00
Nico Weber a887650cf6 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.

llvm-svn: 171742
2013-01-07 15:17:23 +00:00
Nico Weber 49cbc2cb85 Fix typo.
llvm-svn: 171740
2013-01-07 15:15:29 +00:00
Manuel Klimek 6b9eeba09a s/parseStatement/parseStructuralElement/g in the UnwrappedLineParser.
llvm-svn: 171737
2013-01-07 14:56:16 +00:00
Daniel Jasper 8d1832e091 Reformat clang-formats source code.
All changes done by clang-format itself. No functional changes.

llvm-svn: 171732
2013-01-07 13:26:07 +00:00
Daniel Jasper 206df73417 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.

llvm-svn: 171731
2013-01-07 13:08:40 +00:00
Daniel Jasper 5ad1e1992a 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.

llvm-svn: 171725
2013-01-07 11:09:06 +00:00
Daniel Jasper da16db3f9a 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.

llvm-svn: 171724
2013-01-07 10:48:50 +00:00
Manuel Klimek 7872571fc5 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.

llvm-svn: 171720
2013-01-07 10:03:37 +00:00
Will Dietz df9a2bbcb1 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.

llvm-svn: 171718
2013-01-07 09:51:17 +00:00
Manuel Klimek 1b89629616 Remove outdated FIXME and add explanation for error handling strategy
while parsing #define's.

llvm-svn: 171717
2013-01-07 09:34:28 +00:00
Manuel Klimek c6827ae775 Remove outdated fixme.
llvm-svn: 171716
2013-01-07 09:25:37 +00:00
Manuel Klimek 38ba11e492 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.

llvm-svn: 171715
2013-01-07 09:24:17 +00:00
Manuel Klimek c74d292229 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 "//".

llvm-svn: 171713
2013-01-07 08:54:53 +00:00
Manuel Klimek ef92069940 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).

llvm-svn: 171706
2013-01-07 07:56:50 +00:00
Daniel Jasper c7345ccc2c 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));

llvm-svn: 171705
2013-01-07 07:13:20 +00:00
David Blaikie 18f7c59946 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.

llvm-svn: 171699
2013-01-07 05:55:03 +00:00
Chandler Carruth ed0f133bc7 Switch to asking the target machine to add any relevant analysis passses
rather than doing it ourselves. This reflects the API changes in r171681.

llvm-svn: 171683
2013-01-07 01:38:01 +00:00
Nico Weber 3b435ed829 Simplify. No behavior change.
llvm-svn: 171680
2013-01-07 01:21:02 +00:00
Dmitri Gribenko 5f3c9200e5 ClangTools doc: add ideas for new tools in clang-tools-extra to ensure that
these ideas don't get lost

llvm-svn: 171667
2013-01-06 20:19:09 +00:00
Manuel Klimek 1058d987f9 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.

llvm-svn: 171666
2013-01-06 20:07:31 +00:00
Dmitri Gribenko 4077efc146 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.

llvm-svn: 171656
2013-01-06 13:38:34 +00:00
Sylvestre Ledru bdef289eae Prepare for the upcoming version of Debian (jessie)
llvm-svn: 171655
2013-01-06 08:09:29 +00:00
Sean Silva aa73d02032 use early returns to simplify and de-nest
llvm-svn: 171654
2013-01-06 07:49:41 +00:00
Manuel Klimek 52d0fd8961 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.

llvm-svn: 171640
2013-01-05 22:56:06 +00:00
Manuel Klimek ef2cfb110d 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.

llvm-svn: 171639
2013-01-05 22:14:16 +00:00
Fariborz Jahanian feb9ae59d2 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

llvm-svn: 171638
2013-01-05 21:54:55 +00:00
David Blaikie 6e63ed0b37 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.

llvm-svn: 171637
2013-01-05 21:41:59 +00:00
Manuel Klimek 09e0797953 Fixes PR14811: Crash when formatting some macros
A preprocessor directive cannot be started while we're parsing one.

llvm-svn: 171635
2013-01-05 21:34:55 +00:00
David Blaikie 219c7d9f64 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.

llvm-svn: 171633
2013-01-05 20:03:07 +00:00
David Blaikie a234c65613 FileCheck-ize test/CodeGen/inline.c.
A rather egregious example of the grep-style checking of old that I randomly
came across.

llvm-svn: 171631
2013-01-05 18:22:42 +00:00
Chandler Carruth ff8cd6e238 Companion patch to r171621 which changed the interface for creating TTI
passes to a create-pass function instead of a direct constructor call.

llvm-svn: 171622
2013-01-05 11:45:12 +00:00
Ted Kremenek 6a4c73db23 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>.

llvm-svn: 171607
2013-01-05 07:31:54 +00:00
David Blaikie a76a7c902a Emit debug info for unnamed parameters.
LLVM ignores this data for now - patch for that to follow.

llvm-svn: 171605
2013-01-05 05:58:35 +00:00
David Blaikie c905b9decd 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.

llvm-svn: 171604
2013-01-05 05:48:08 +00:00
David Blaikie c1520bbb34 FileCheck-ize test/CodeGenCXX/debug-info-method.cpp
llvm-svn: 171602
2013-01-05 05:39:21 +00:00
Akira Hatanaka 009173f613 [mips] Fix data layout string. Add 64 to the list of native integer widths
and add stack alignment information.

llvm-svn: 171588
2013-01-05 02:04:34 +00:00
Rafael Espindola 3c98afe2ae 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.

llvm-svn: 171585
2013-01-05 01:28:37 +00:00
Fariborz Jahanian cc2ae88e3c In my last patch initialize the destination to null (with a simple store) before doing a storeStrong to it.
// rdar://12530881

llvm-svn: 171572
2013-01-05 00:32:13 +00:00
Manman Ren cf15a4e97a Fix testing case for Release build (r171493)
rdar://11562117

llvm-svn: 171564
2013-01-05 00:01:42 +00:00
Ted Kremenek a49cf10737 Update checker build to checker-270
llvm-svn: 171560
2013-01-04 23:52:16 +00:00
Manuel Klimek 1abf789c7a 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.

llvm-svn: 171556
2013-01-04 23:34:14 +00:00
Fariborz Jahanian a82e9265d8 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

llvm-svn: 171555
2013-01-04 23:32:24 +00:00
Chad Rosier ac00fbcbd2 Fix indent and remove parameter with a matching default value.
llvm-svn: 171545
2013-01-04 22:40:33 +00:00
Rafael Espindola 885106795e Style fix: We don't use lowercase-and-underscored template parameter names.
Thanks for dgregor for noticing it.

llvm-svn: 171532
2013-01-04 21:18:45 +00:00
Daniel Jasper 3c2557d0dd Correctly format dereference and address of in array parameters.
Before: InvalidRegions[ &R] = 0;
After:  InvalidRegions[&R] = 0;

This fixes llvm.org/PR14793

llvm-svn: 171522
2013-01-04 20:46:38 +00:00
Rafael Espindola 66748e93e2 Fix typo. Thanks to dgregor for noticing it.
llvm-svn: 171521
2013-01-04 20:41:40 +00:00
Rafael Espindola 4588a1a205 Unqualify the parameter type.
This fixes a regression from 168895.

llvm-svn: 171519
2013-01-04 20:34:32 +00:00
Douglas Gregor 7426050269 realpath'ify the mapping from header includes to module imports.
llvm-svn: 171516
2013-01-04 19:44:26 +00:00
Ted Kremenek 3d1464caee Update CMakeLists.txt
llvm-svn: 171505
2013-01-04 19:04:47 +00:00
Ted Kremenek dae8f9f1a2 Add __has_feature support to detect if clang supports the explicit "atomic" keyword for ObjC properties.
Fixes <rdar://problem/12953378>.

llvm-svn: 171504
2013-01-04 19:04:44 +00:00
Ted Kremenek 8533dd9f58 Require set-xcode-analyzer to run with Python 2.7 or later.
Addresses LLVM PR 11661.

llvm-svn: 171503
2013-01-04 19:04:42 +00:00
Ted Kremenek 9deaef7f44 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.

llvm-svn: 171502
2013-01-04 19:04:40 +00:00
Ted Kremenek 7505b5a64c Tighten code. No functionality change.
llvm-svn: 171501
2013-01-04 19:04:36 +00:00
Douglas Gregor 8f1f3331dc Add the module name to the 'incomplete umbrella header' warning.
llvm-svn: 171497
2013-01-04 18:58:28 +00:00
Daniel Jasper c0880a904b Let the formatter ignore UnwrappedLines containing errors.
This prevents code like:

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

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

llvm-svn: 171495
2013-01-04 18:52:56 +00:00
Filipe Cabecinhas c18708ee6e Add file added in r171484 to CMakelists.txt.
llvm-svn: 171494
2013-01-04 18:52:29 +00:00
Manman Ren ab08a9adab 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

llvm-svn: 171493
2013-01-04 18:51:35 +00:00
Fariborz Jahanian cb6c867c46 Fix up various builtin declaration of objc_msgSend families
to match those foung in objc.h an avoid spurious warnings. 
// rdar://12489098

llvm-svn: 171492
2013-01-04 18:45:40 +00:00
Argyrios Kyrtzidis 56be71610f [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.

llvm-svn: 171486
2013-01-04 18:30:13 +00:00
Argyrios Kyrtzidis d12c332905 [arcmt] Allow removing an -autorelease of a variable initialized in the previous statement.
rdar://11074996

llvm-svn: 171485
2013-01-04 18:30:11 +00:00
Argyrios Kyrtzidis 03fbe3ef81 [arcmt] Adds brackets in case statements that "contain" initialization of retaining
variable, thus emitting the "switch case is in protected scope" error.

rdar://12952016

llvm-svn: 171484
2013-01-04 18:30:08 +00:00
Argyrios Kyrtzidis aa1ce901eb Move the common source locations of CastStmt & DefaultStmt into their base class, SwitchCase.
llvm-svn: 171483
2013-01-04 18:30:04 +00:00
Argyrios Kyrtzidis b7b89b5ebc [arcmt] Don't error if an autoreleased variable is returned after the -autorelease.
rdar://12952025

llvm-svn: 171482
2013-01-04 18:29:59 +00:00
Douglas Gregor 2060482ece Remove -Wmodule-build; it was a dumb idea anyway. <rdar://problem/12957525>
llvm-svn: 171478
2013-01-04 18:22:19 +00:00
Eric Christopher 0f75943780 Fix fieldNo usage for lambdas. No behavior change since the
field number was 0 anyhow.

llvm-svn: 171472
2013-01-04 17:59:07 +00:00
Rafael Espindola d2ecc139f2 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.

llvm-svn: 171458
2013-01-03 04:29:20 +00:00
Rafael Espindola 60470f1194 Use early returns to reduce indentation.
llvm-svn: 171457
2013-01-03 04:05:19 +00:00
Argyrios Kyrtzidis 6ba7afb8e1 [arcmt] Rewrite uses of Block_copy/Block_release macros.
c = Block_copy(b);
  Block_release(c);
 ---->
  c = [b copy];
  <removed>

rdar://9408211

llvm-svn: 171454
2013-01-03 03:17:17 +00:00
Ted Kremenek 1d6aac5b6a Fix capitalization of Objective-C in diagnostic.
llvm-svn: 171440
2013-01-03 01:30:20 +00:00
Ted Kremenek 6fcefb53e3 Make MallocChecker debug output useful.
llvm-svn: 171439
2013-01-03 01:30:12 +00:00
Eli Friedman 33accdf602 Don't assert/crash on reference variables in lambdas bound to a
static local variable from the parent scope.  PR14773.

llvm-svn: 171433
2013-01-03 00:39:26 +00:00
Anna Zaks 3fdcc0bda3 [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.)

llvm-svn: 171432
2013-01-03 00:25:29 +00:00
Sean Silva ab3314f4d7 Add docs/README.txt to point to llvm/docs/README.txt.
llvm-svn: 171426
2013-01-02 23:25:41 +00:00
Sean Silva cd61d28c4a 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.

llvm-svn: 171425
2013-01-02 23:07:22 +00:00
Sean Silva 437db15978 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).

llvm-svn: 171424
2013-01-02 22:48:50 +00:00
Argyrios Kyrtzidis eedb5432c5 [python bindings] Expose cursor.referenced (clang_getCursorReferenced).
Patch by Matthew King!

llvm-svn: 171423
2013-01-02 22:31:57 +00:00
Dmitri Gribenko 1654035a3b hexagon-target-basic.c test: add REQUIRES line for hexagon target
llvm-svn: 171422
2013-01-02 22:30:14 +00:00
Argyrios Kyrtzidis f86e8cced6 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.

llvm-svn: 171421
2013-01-02 22:26:07 +00:00
Sean Silva b045514abf 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.

llvm-svn: 171419
2013-01-02 22:05:33 +00:00
Sean Silva aaa78eefe7 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.

llvm-svn: 171417
2013-01-02 21:50:48 +00:00
Anshuman Dasgupta 89730ce9ee Correct Hexagon DataLayout string. Fixes bug 14744.
Patch by Krzysztof Parzyszek!

llvm-svn: 171415
2013-01-02 21:25:57 +00:00
Dmitri Gribenko 154e6e53ad Type safety attributes: add tests for enumerations (users are actually doing
this, ensure we don't regress)

llvm-svn: 171412
2013-01-02 21:12:03 +00:00
Sean Silva 13d43feb11 docs: Curb excessive table-of-contents depth.
llvm-svn: 171410
2013-01-02 21:09:58 +00:00
Sean Silva f380e0e24b 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.

llvm-svn: 171409
2013-01-02 21:03:11 +00:00
Sean Silva 29b7a60b12 docs: Fix spelling error.
Spotted by Nikola Smiljanic.

llvm-svn: 171407
2013-01-02 20:22:14 +00:00
Argyrios Kyrtzidis c32b022ef0 Remove the anonymous namespace from lib/Sema/TreeTransform.h
llvm-svn: 171402
2013-01-02 19:10:22 +00:00
Manuel Klimek b69e3c6201 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

llvm-svn: 171401
2013-01-02 18:33:23 +00:00
Daniel Jasper 90e51fdbab 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(aaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaa<T>
                    ::aaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

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

llvm-svn: 171400
2013-01-02 18:30:06 +00:00
Daniel Jasper 3c0431c887 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 :-)

llvm-svn: 171396
2013-01-02 17:21:36 +00:00
Manuel Klimek a71e5d8115 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.

llvm-svn: 171393
2013-01-02 16:30:12 +00:00
Daniel Jasper 542de16e50 Correctly format pointers and references in casts.
This fixes llvm.org/PR14747.

Before: Type *A = (Type * ) P;
After:  Type *A = (Type *) P;
llvm-svn: 171390
2013-01-02 15:46:59 +00:00
Daniel Jasper da1c68ab71 Understand unary operators after "return" and "case".
This fixes llvm.org/PR14746.

Before: return - 1;
After:  return -1;
llvm-svn: 171389
2013-01-02 15:26:16 +00:00
Daniel Jasper ac5c1c286c 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);

llvm-svn: 171388
2013-01-02 15:08:56 +00:00
Daniel Jasper 3d0c75cc96 Prefer to break after operators over breaking after "(".
Before:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
                                 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 171386
2013-01-02 14:40:02 +00:00
Sean Silva 6d2be4a24d docs: `3.2` -> `3.3`
llvm-svn: 171384
2013-01-02 13:25:05 +00:00
Sean Silva ebf3a0e465 docs: Remove useless discussion.
The linked Makefile is always up to date, so there's no point in having
a rotting list of libraries.

llvm-svn: 171383
2013-01-02 13:23:37 +00:00
Sean Silva 173d252601 docs: Fix up HTML links to proper reST links.
llvm-svn: 171382
2013-01-02 13:07:47 +00:00
Sean Silva 8966c60cae docs: clang-format is coming down the pike, mention it
llvm-svn: 171380
2013-01-02 12:49:25 +00:00
Sean Silva dd9f40641c 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.

llvm-svn: 171379
2013-01-02 12:41:24 +00:00
Sean Silva bb220f08e2 remove random spaces
llvm-svn: 171378
2013-01-02 12:40:31 +00:00
Sean Silva 2c58e5ed63 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.

llvm-svn: 171377
2013-01-02 12:40:15 +00:00
Sean Silva d2a98e6dbb 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.

llvm-svn: 171376
2013-01-02 12:39:50 +00:00
Sean Silva ff15b34dda docs: Sphinx conversion is "done"
llvm-svn: 171375
2013-01-02 12:39:02 +00:00
Richard Smith 89645bc888 s/CXX0X/CXX11/g, except for __GNU_EXPERIMENTAL_CXX0X__, and update a few nearby 'C++0x' comments.
llvm-svn: 171372
2013-01-02 12:01:23 +00:00
Chandler Carruth ffd5551bc7 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.

llvm-svn: 171369
2013-01-02 11:45:17 +00:00
Richard Smith 2bf7fdb723 s/CPlusPlus0x/CPlusPlus11/g
llvm-svn: 171367
2013-01-02 11:42:31 +00:00
Chandler Carruth 44eb4f66f4 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.

llvm-svn: 171364
2013-01-02 10:28:36 +00:00
Daniel Jasper 22bcf8a8eb Understand * and & in ternary expressions.
Before: "int a = b ? *c : * d;"
After: "int a = b ? *c : *d;
llvm-svn: 171358
2013-01-02 08:57:10 +00:00
Daniel Jasper d1926a3758 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) {

llvm-svn: 171357
2013-01-02 08:44:14 +00:00
Rafael Espindola 6525f96f01 Convert an if that never happens to an assert.
llvm-svn: 171354
2013-01-02 04:19:07 +00:00
Benjamin Kramer 7a14bc0f4c Simplify vector splat code. No functionality change.
llvm-svn: 171350
2013-01-01 20:08:10 +00:00
NAKAMURA Takumi 43632a26a5 Update the copyright coredits -- Happy new year 2013!
llvm-svn: 171342
2013-01-01 10:00:19 +00:00
Rafael Espindola aadd30ec52 Silence some warnings and allow passing down some feature flags to the linker.
Patch by Brad Smith.

llvm-svn: 171329
2012-12-31 22:41:36 +00:00
Nico Weber 965368743e Fix minor copy-pasto. No functionality change.
llvm-svn: 171274
2012-12-31 02:59:14 +00:00
Nico Weber a7c7e60764 Remove some remnants of OwningExprResult / OwningStmtResult.
These got deleted late 2010 during the Actions/Sema unification.
No functionality change.

llvm-svn: 171269
2012-12-31 00:28:03 +00:00
Nico Weber a48b6c2bba Simplify. No functionality change.
llvm-svn: 171268
2012-12-30 23:36:56 +00:00
Rafael Espindola ea7537f2a2 Don't warn on unused member functions that are extern because of a typedef.
llvm-svn: 171267
2012-12-30 21:42:26 +00:00
Dmitri Gribenko 58d64e2bb1 Formatter: parse and format inline namespaces like regular namespaces
This changes formatting from:

inline namespace X {
  class A {
  };
}

to:

inline namespace X {
class A {
};
}

llvm-svn: 171266
2012-12-30 21:27:25 +00:00
Will Dietz 3676d56b71 [ubsan] Recover by default, use -fno-sanitize-recover to disable.
llvm-svn: 171264
2012-12-30 20:53:28 +00:00
Rafael Espindola a5c892058c Use hasCLanguageLinkage when warning about non C return types.
llvm-svn: 171263
2012-12-30 20:40:41 +00:00
Dmitri Gribenko 10af67a9c3 Comment lexing: replace manual comparison with StringRef::find_first_of
This gives an about 1.8% improvement on Clang bootstrap with -Wdocumentation

llvm-svn: 171262
2012-12-30 19:45:46 +00:00
Rafael Espindola 5cab029e4b Don't get confused if a extern "C" builtin function is redeclared without
the extern "C".

llvm-svn: 171260
2012-12-30 17:23:09 +00:00
Bill Wendling 5e85be4326 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.

llvm-svn: 171254
2012-12-30 10:32:17 +00:00
Rafael Espindola 9463dce9bf 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.

llvm-svn: 171240
2012-12-29 23:43:00 +00:00
Nico Weber 9dff378a12 ArrayRefize CXXTryStmt.
llvm-svn: 171239
2012-12-29 20:13:03 +00:00
Nico Weber a2a0eb940a ArrayRefize a CompoundStmt constructor.
llvm-svn: 171238
2012-12-29 20:03:39 +00:00
Chandler Carruth 19e8beaad6 Fix a typo that caused a few standard library implementations of sort to
get the wrong answer. Wasn't caught by my implementation sadly...

llvm-svn: 171222
2012-12-29 13:00:47 +00:00
Chandler Carruth 5193dfca24 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.

llvm-svn: 171219
2012-12-29 12:01:08 +00:00
Erik Verbruggen 3f27d4e05a Removed duplicate logic.
llvm-svn: 171218
2012-12-29 11:27:03 +00:00
Rafael Espindola db7325e56e Minor cleanup.
DS parameter  has a default (null) value anyway, so there's no need for an
if/else here.
Patch by Nikola Smiljanić.

llvm-svn: 171210
2012-12-29 01:09:46 +00:00
Rafael Espindola 576127d90e 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.

llvm-svn: 171193
2012-12-28 14:21:58 +00:00
Richard Smith 9e575dafad Replace magic numbers in CheckICE with an enum.
llvm-svn: 171192
2012-12-28 13:25:52 +00:00
Richard Smith 74fc72143a PR14729: Fix typo in CheckICE for BinaryConditionalOperators.
llvm-svn: 171191
2012-12-28 12:53:55 +00:00
Richard Smith de1a487402 Improve diagnostic wording for when an implicitly-deleted special member
function is selected by overload resolution.

llvm-svn: 171190
2012-12-28 12:23:24 +00:00
Alexey Samsonov c6515b6a41 Add proper support for -fsanitize-blacklist= flag for TSan and MSan. Clang part.
llvm-svn: 171184
2012-12-28 09:31:34 +00:00
David Blaikie bf18725d11 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).

llvm-svn: 171175
2012-12-28 01:16:31 +00:00
Richard Smith d8f265a5b8 Simplify typeid 'potentially evaluated' check.
llvm-svn: 171162
2012-12-27 15:26:27 +00:00
Rafael Espindola cffa95d73f Implement dcl.link paragraph 5.
The language linkage of redeclarations must match. GCC was already reporting
an error for this.

llvm-svn: 171139
2012-12-27 03:56:20 +00:00
Eric Christopher a487035ca9 Update test for backend change.
TODO: This test should be moved to the backend.
llvm-svn: 171134
2012-12-27 02:20:24 +00:00
Rafael Espindola 1779760cb4 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.

llvm-svn: 171088
2012-12-26 04:38:44 +00:00
Rafael Espindola dfa5f9b511 Use the most recent redecl to decide if it is needed.
This fixes pr14691, which I think is a regression from r168519.

llvm-svn: 171077
2012-12-26 00:13:29 +00:00
Richard Smith 940a6d73ce 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.

llvm-svn: 171074
2012-12-25 21:56:27 +00:00
Erik Verbruggen 11a2eccc8b 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().

llvm-svn: 171067
2012-12-25 14:51:39 +00:00
Guy Benyei f0a014bbb7 Add intel_ocl_bicc calling convention as a function attribute to clang. The calling convention is already implemented in LLVM.
llvm-svn: 171056
2012-12-25 08:53:55 +00:00
Rafael Espindola 54606d57a2 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.

llvm-svn: 171053
2012-12-25 07:31:49 +00:00
NAKAMURA Takumi eb63feb5bd Revert r171048, "Cache visibility of decls."
It broke stage2.

llvm-svn: 171050
2012-12-25 04:47:44 +00:00
Rafael Espindola f92a59f0cb 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.

llvm-svn: 171048
2012-12-25 00:39:58 +00:00
Nick Lewycky a5d914196c Simplify RUN lines. No functionality change.
llvm-svn: 171045
2012-12-24 21:45:14 +00:00
Daniel Jasper 8fbd96855c 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.

llvm-svn: 171039
2012-12-24 16:51:15 +00:00
Daniel Jasper 6d822720f0 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();

llvm-svn: 171038
2012-12-24 16:43:00 +00:00
Daniel Jasper 2eda23e78a 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;

llvm-svn: 171032
2012-12-24 13:43:52 +00:00
Daniel Jasper 537a29638d 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()() {}

llvm-svn: 171028
2012-12-24 10:56:04 +00:00
Evgeniy Stepanov ad8ab3d9ea Support -fsanitize-memory-track-origins.
llvm-svn: 171020
2012-12-24 08:42:34 +00:00
NAKAMURA Takumi cc80b551bf CGClass.cpp: [PR14335] Remove comma-separated \param, for now. [-Wdocumentation]
/// \param argBegin,argEnd the arguments to evaluate and pass to the constructor

llvm-svn: 171015
2012-12-24 02:03:30 +00:00
NAKAMURA Takumi 5fe61c6952 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.

llvm-svn: 171014
2012-12-24 01:49:04 +00:00
NAKAMURA Takumi 320c1f8806 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

llvm-svn: 171013
2012-12-24 01:48:59 +00:00
NAKAMURA Takumi 07c2e02e27 DiagnosticRenderer.cpp: Prune one description in DiagnosticRenderer::emitMacroExpansions(). [-Wdocumentation]
/// \param MacroSkipEnd The depth to stop skipping macro expansions.

llvm-svn: 171012
2012-12-24 01:48:53 +00:00
NAKAMURA Takumi 368d2ee4ef CGValue.h: Update one \param to Addr in MakeBitfield(). [-Wdocumentation]
llvm-svn: 171011
2012-12-24 01:48:48 +00:00
NAKAMURA Takumi 6cebf7f8c0 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.

llvm-svn: 171009
2012-12-24 01:23:48 +00:00
Daniel Jasper de5c20792d 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) { .. }

llvm-svn: 171007
2012-12-24 00:13:23 +00:00
Dmitri Gribenko 114d895e26 Documentation: PTHInternals: use correct adornments and fix typos
Fixes PR14014

llvm-svn: 171005
2012-12-23 18:39:54 +00:00
Dmitri Gribenko 46735cb9ce Documentation: fix a syntax error: empty line required after code-block::
llvm-svn: 171004
2012-12-23 18:36:44 +00:00
Dmitri Gribenko dd20f2c3eb Documentation: add MemorySanitizer to the toctree
llvm-svn: 171003
2012-12-23 18:35:58 +00:00
Sean Silva fe25144e68 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.

llvm-svn: 170994
2012-12-23 01:19:35 +00:00
Nico Weber 6f372e6533 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.

llvm-svn: 170993
2012-12-23 01:07:46 +00:00
Nico Weber cb4c7f4b18 Move a declaration closer to its use. No functionality change.
llvm-svn: 170992
2012-12-23 00:40:46 +00:00
Benjamin Kramer a296431357 Clean out release notes for clang 3.3
llvm-svn: 170987
2012-12-22 16:12:31 +00:00
Argyrios Kyrtzidis 9fd1571e7a [libclang] Fix crash when code-completing a macro invocation that
reached EOF and did not expand the argument into the source context.

llvm-svn: 170980
2012-12-22 04:48:10 +00:00
Argyrios Kyrtzidis 430a938fde [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.

llvm-svn: 170979
2012-12-22 04:48:08 +00:00
Argyrios Kyrtzidis 9999f4f88b [libclang] Check for the 'LIBCLANG_NOTHREADS' environment variable before creating
a separate thread for code-completion.

llvm-svn: 170978
2012-12-22 04:48:07 +00:00
Richard Smith 21bae43fab PR14695: Fix assert from bad cast<>. Not every namespace is a NamespaceDecl; it might instead be a TranslationUnitDecl.
llvm-svn: 170976
2012-12-22 02:46:14 +00:00
Ted Kremenek 6cae9ec643 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.

llvm-svn: 170974
2012-12-22 01:34:09 +00:00
Ted Kremenek c632467e2b Fix typo: objc_no_direct_instance_variable_assignmemt => objc_no_direct_instance_variable_assignment.
Fixes <rdar://problem/12927551>.

llvm-svn: 170971
2012-12-22 00:34:48 +00:00
Anna Zaks 0dffbd6b8e [analyzer] Convert SimpleStreamChecker to use the PointerEscape callback
The new callback greatly simplifies the checker.

llvm-svn: 170969
2012-12-22 00:18:39 +00:00
Douglas Gregor 2d5a5613ce 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>.

llvm-svn: 170951
2012-12-21 23:03:27 +00:00
Fariborz Jahanian 9017ec3a62 Adding to FormatTest.cpp test for a very long ObjC method
declaration requiring formatting of wrap-arounds.

llvm-svn: 170946
2012-12-21 22:51:18 +00:00
Ted Kremenek 6487335f43 Tweak Sema::CheckLiteralKind() to also include block literals
This simplifies some diagnostic logic in checkUnsafeAssignLiteral(),
hopefully making it less error prone.

llvm-svn: 170945
2012-12-21 22:46:35 +00:00
Matt Beaumont-Gay cab0f3131e 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'.

llvm-svn: 170941
2012-12-21 22:43:20 +00:00
Chad Rosier 8a67a65a4b Add comments back that were accidentally removed in r170933.
llvm-svn: 170938
2012-12-21 22:38:37 +00:00
Chad Rosier 35e18ad918 Fix a warning due to an extraneous comma.
llvm-svn: 170935
2012-12-21 22:33:20 +00:00
Chad Rosier 92f0dccbad Remove unused arguments and rename to conform to coding standards.
llvm-svn: 170933
2012-12-21 22:24:43 +00:00
Ted Kremenek 44c2a2a26e 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.

llvm-svn: 170931
2012-12-21 21:59:39 +00:00
Ted Kremenek 01a33f82d2 Hoist logic for classifying Objective-C literals into Sema (proper) for use with other diagnostics.
No immediate (intended) functionality change.

llvm-svn: 170930
2012-12-21 21:59:36 +00:00
Richard Smith a90d567af6 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!

llvm-svn: 170929
2012-12-21 21:52:01 +00:00
Fariborz Jahanian 7a16a02eec 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.

llvm-svn: 170928
2012-12-21 21:43:05 +00:00
Chad Rosier 6c0da1154a Indent.
llvm-svn: 170925
2012-12-21 21:27:13 +00:00
Chad Rosier eea9ca7e39 Remove unnecessary checks.
llvm-svn: 170924
2012-12-21 21:22:20 +00:00
Ted Kremenek b6439e6bfe Use descriptive enum instead of raw integers for checkUnsafeAssignLiteral().
llvm-svn: 170920
2012-12-21 19:45:33 +00:00
Ted Kremenek c1f014afc8 Sink call to checkUnsafeAssignLiteral() into checkUnsafeAssignObject().
llvm-svn: 170919
2012-12-21 19:45:30 +00:00
Chad Rosier 6af2d2e4bb Fix indent.
llvm-svn: 170918
2012-12-21 19:43:33 +00:00
Jordan Rose 7b5bfc795a [analyzer] Don't perform an expensive assertion in release builds.
Unfortunately, we don't seem to have a standard way to do this. I'm using
the __OPTIMIZE__ GNU extension that Clang also defines, but that doesn't
help MSVC. I suppose we could remove the check entirely, but it's useful
for developing new constraint managers.

llvm-svn: 170915
2012-12-21 18:26:48 +00:00
Nico Weber 8f83ee46ba format: Handle #import as include directive too.
llvm-svn: 170914
2012-12-21 18:21:56 +00:00
Quentin Colombet 9b14ebc355 Add a testcase for ARM cortex-r5 subtarget
llvm-svn: 170912
2012-12-21 18:00:32 +00:00
Daniel Jasper 050948a5a5 clang-format: No spaces around directory specifiers
This fixes PR14683. We used to format like this:
  #include <a / b>

And this patch changes this to:
  #include <a/b>

llvm-svn: 170910
2012-12-21 17:58:39 +00:00
Quentin Colombet f5a37a3b71 Add ARM cortex-r5 subtarget as available mcpu
llvm-svn: 170909
2012-12-21 17:57:47 +00:00
Anna Zaks 4127750ed8 [analyzer] Fix typos.
llvm-svn: 170907
2012-12-21 17:27:04 +00:00
Anna Zaks 1ee76c1bae [analyzer] Re-apply r170826 and make the dumping of the GallGraph
deterministic.

Commit message for r170826:

[analyzer] Traverse the Call Graph in topological order.

Modify the call graph by removing the parentless nodes. Instead all
nodes are children of root to ensure they are all reachable. Remove the
tracking of nodes that are "top level" or global. This information is
not used and can be obtained from the Decls stored inside
CallGraphNodes.

Instead of existing ordering hacks, analyze the functions in topological
order over the Call Graph.

Together with the addition of devirtualizable ObjC message sends and
blocks to the call graph, this gives around 6% performance improvement
on several large ObjC benchmarks.

llvm-svn: 170906
2012-12-21 17:27:01 +00:00
Roman Divacky a6795968e6 Sort the includes according to the coding standard.
llvm-svn: 170905
2012-12-21 17:23:52 +00:00
Fariborz Jahanian 3b1604e485 Fix typo.
llvm-svn: 170904
2012-12-21 17:14:23 +00:00
Roman Divacky 241f45118b Remove duplicate includes.
llvm-svn: 170903
2012-12-21 17:07:08 +00:00
Daniel Jasper fbde69e266 Basic support for formatting for-loops.
We used to not really format them. Now we do:

  for (MachineBasicBlock::succ_iterator SI = BB->succ_begin(),
                                        SE = BB->succ_end();
       SI != SE; ++SI) {

This is just one example and I am sure we still mess some of them up, but it
is a step forward.

llvm-svn: 170899
2012-12-21 14:37:20 +00:00
Rafael Espindola 92e37d31e7 Update comments.
llvm-svn: 170890
2012-12-21 13:22:55 +00:00
Daniel Jasper 0ca819410d Temporary fix of tests to make buildbots happy.
Permanent solution coming up after checking back with Fariborz/Douglas.

llvm-svn: 170887
2012-12-21 12:10:20 +00:00
Evgeniy Stepanov acef0e66a6 Slight rewording of -fsanitize=memory docs.
llvm-svn: 170880
2012-12-21 10:53:20 +00:00
Evgeniy Stepanov 17d5590003 User manual chapter on MemorySanitizer.
llvm-svn: 170879
2012-12-21 10:50:00 +00:00
Daniel Jasper ab7654e894 Use OperatorPrecedence.h in clang-format
No indented functional changes other than handling more operators
correctly.

llvm-svn: 170875
2012-12-21 10:20:02 +00:00
Daniel Jasper 8dd404737b Formatting fixes for PR14680
Also, some (automated) formatting fixes and slight cleanups.

llvm-svn: 170873
2012-12-21 09:41:31 +00:00
Dmitry Vyukov 42de108861 Remove the working that ThreadSanitizer is *experimental*.
llvm-svn: 170868
2012-12-21 08:21:25 +00:00
Richard Smith 38a549bc42 Fix regression in r170489: when instantiating a direct initializer which is a
CXXScalarValueInitExpr (or an ImplicitValueInitExpr), strip it back down to an
empty pair of parentheses so that the initialization code can tell that we're
performing value-initialization.

llvm-svn: 170867
2012-12-21 08:13:35 +00:00
Ted Kremenek 9304da9578 Extend checkUnsafeAssigns() to also handle assigning an object literal to a weak reference.
Thanks to Jordan Rose and John McCall for their sage code review.

Fixes <rdar://problem/12569201>.

llvm-svn: 170864
2012-12-21 08:04:28 +00:00
Ted Kremenek b36234deca Refactor checkUnsafeAssigns() to avoid code duplication with while loop.
This is just a minor bit of refactoring, but it is nice cleanup for
the subsequent patch that adds warning support for assigning literals
to weak variables.

llvm-svn: 170863
2012-12-21 08:04:20 +00:00
Richard Smith d82a2ce3a0 Reinstate r170806, reverted in r170835, with a fix use i1 instead of i8 for a value-initialized bool!
llvm-svn: 170837
2012-12-21 03:17:28 +00:00
NAKAMURA Takumi 3df909d030 Revert r170806, "Fix some bugs where we would sometimes use 0, not -1, when emitting a null constant of type pointer-to-data-member."
It broke stage2.

llvm-svn: 170835
2012-12-21 02:50:38 +00:00
Argyrios Kyrtzidis d4635d4865 [libclang] Follow-up to r170824, provide the correct number of arguments for
a not-fully-formed macro invocation during code-completion.

llvm-svn: 170833
2012-12-21 01:51:12 +00:00
Anna Zaks 9747febba9 [analyzer] Address Jordan's nitpicks as per code review of r170625.
llvm-svn: 170832
2012-12-21 01:50:14 +00:00
Rafael Espindola e7ec558f25 Revert r170826. The output of
./bin/clang -cc1 -internal-isystem /home/espindola/llvm/build/lib/clang/3.3/include/ -analyze -analyzer-checker=debug.DumpCallGraph /home/espindola/llvm/clang/test/Analysis/debug-CallGraph.c -fblocks

changes in each run.

llvm-svn: 170829
2012-12-21 01:30:23 +00:00
Rafael Espindola 2be6b72ce0 Don't eagerly emit a global static merged with a local extern.
When we are visiting the extern declaration of 'i' in

static int i = 99;
int foo() {
  extern int i;
  return i;
}

We should not try to handle it as if it was an function static. That is, we
must consider the written storage class.

Fixing this then exposes that the assert in EmitGlobalVarDeclLValue and the
if leading to its call are not completely accurate. They were passing before
because the second decl was marked as having external storage. I changed them
to check the linkage, which I find easier to understand.

Last but not least, there is something strange going on with cuda and opencl.
My guess is that the linkage computation for these languages needs to be
audited, but I didn't want to change that in this patch so I just updated
the storage classes to keep the current behavior.

Thanks to Reed Kotler for reporting this.

llvm-svn: 170827
2012-12-21 01:21:33 +00:00
Anna Zaks 77ca7f1bbe [analyzer] Traverse the Call Graph in topological order.
Modify the call graph by removing the parentless nodes. Instead all
nodes are children of root to ensure they are all reachable. Remove the
tracking of nodes that are "top level" or global. This information is
not used and can be obtained from the Decls stored inside
CallGraphNodes.

Instead of existing ordering hacks, analyze the functions in topological
order over the Call Graph.

Together with the addition of devirtualizable ObjC message sends and
blocks to the call graph, this gives around 6% performance improvement
on several large ObjC benchmarks.

llvm-svn: 170826
2012-12-21 01:19:22 +00:00
Anna Zaks 5c32dfc5fb [analyzer] Add blocks and ObjC messages to the call graph.
This paves the road for constructing a better function dependency graph.
If we analyze a function before the functions it calls and inlines,
there is more opportunity for optimization.

Note, we add call edges to the called methods that correspond to
function definitions (declarations with bodies).

llvm-svn: 170825
2012-12-21 01:19:15 +00:00
Argyrios Kyrtzidis c1d9a67e2b [libclang] Make sure we can code-complete inside a macro argument even though
the macro invocation is not fully formed.

rdar://11290992

llvm-svn: 170824
2012-12-21 01:17:20 +00:00
NAKAMURA Takumi f115642b61 EditedSource.cpp: Appease msvc, to add <cctype>.
llvm-svn: 170817
2012-12-21 00:21:02 +00:00
Sean Silva 426914a549 docs: Convert ObjectiveCLiterals to reST.
Sphinx's syntax highlighter doesn't recognize the new literals, so the
syntax highlighting is pretty pathetic.

llvm-svn: 170814
2012-12-21 00:17:02 +00:00
Sean Silva 2ff89eb835 docs: fix Sphinx toctree warning.
llvm-svn: 170813
2012-12-21 00:16:58 +00:00
Sean Silva 5f25c50e91 docs: Convert DriverInternals to reST.
llvm-svn: 170812
2012-12-21 00:16:53 +00:00
Richard Smith 789ce142df Fix some bugs where we would sometimes use 0, not -1, when emitting a null constant of type pointer-to-data-member.
llvm-svn: 170806
2012-12-20 23:49:09 +00:00
Douglas Gregor 27c42e66bb Revert r170801, which breaks the mingw build.
llvm-svn: 170804
2012-12-20 23:36:52 +00:00
Douglas Gregor d04592dc81 Eliminate errors when running the 'PrintFunctionNames' plugin, from Li Qun!
llvm-svn: 170801
2012-12-20 23:11:42 +00:00
Ted Kremenek 9453721985 Revert "Warn if a __weak variable is initialized with an Objective-C object literal."
Per code feedback, I want to see if there is a more general way to do this.

llvm-svn: 170777
2012-12-20 22:31:27 +00:00
Argyrios Kyrtzidis cbfd4d2483 Use some heuristics so that when a fixit removes a source range, we try
to also remove a trailing space if possible.

For example, removing '__bridge' from:

i = (__bridge I*)p;

should result in:

i = (I*)p;

not:

i = ( I*)p;

rdar://11314821

llvm-svn: 170764
2012-12-20 21:05:53 +00:00
Ted Kremenek b39cfd41f2 Warn if a __weak variable is initialized with an Objective-C object literal.
Such variables may immediately become nil or may have unpredictable
behavior.

Fixes <rdar://problem/12569201>.

llvm-svn: 170763
2012-12-20 20:55:03 +00:00
Dmitri Gribenko b420ef75fb Documentation: use monospaced font in BlockLanguageSpec, and fix a link to this
document

llvm-svn: 170762
2012-12-20 20:51:59 +00:00
Chad Rosier f8a2e70b08 Use the MaybeParseMicrosoftAttributes function.
llvm-svn: 170761
2012-12-20 20:37:53 +00:00
Daniel Jasper 9dd7e0f1f9 Remove namespace qualifier that lead to build breakage.
llvm-svn: 170759
2012-12-20 20:31:38 +00:00
Daniel Jasper d1122cb50d Move operator precedence calculation to new header
Thereby, it can be reused by clang-format and others.
Review: http://llvm-reviews.chandlerc.com/D229

llvm-svn: 170757
2012-12-20 20:25:19 +00:00
Fariborz Jahanian 68a542aea7 Add objective-C style formatting to clang format and
use it to format xml declaration tags. 
// rdar://12378714

llvm-svn: 170727
2012-12-20 19:54:13 +00:00
Ted Kremenek 89abaa3517 Update RetainCountChecker to understand attribute ns_returns_autoreleased.
Fixes <rdar://problem/12887356>.

llvm-svn: 170724
2012-12-20 19:36:22 +00:00
Ted Kremenek 8f895741a2 Attribute 'cf_returns_autoreleased' doesn't really exist.
llvm-svn: 170723
2012-12-20 19:36:20 +00:00
Bill Wendling 207f05369d Rename llvm::Attributes to llvm::Attribute.
llvm-svn: 170722
2012-12-20 19:27:06 +00:00
Bill Wendling 4442605f18 Revert r170500. It over-zealously converted *ALL* things named Attributes, which is wrong here.
llvm-svn: 170721
2012-12-20 19:22:21 +00:00
Rafael Espindola ec5999e622 Fix Generic_GCC::GCCVersion::operator<
Without this patch comparing two equal versions without patch numbers (4.7 for
example) will result in A < B and B < A.

Patch by Simon Atanasyan.

llvm-svn: 170705
2012-12-20 16:15:07 +00:00
NAKAMURA Takumi f827eb629d c-index-test/Makefile: Add clangFormat to USEDLIBS for libclang-unavailable hosts.
llvm-svn: 170693
2012-12-20 13:30:10 +00:00
NAKAMURA Takumi 393bf4c3c8 c-index-test/Makefile: Reformat.
llvm-svn: 170692
2012-12-20 13:30:05 +00:00
Alexander Kornienko 9bdeb11508 Minor coding style issue: NULL -> 0
llvm-svn: 170688
2012-12-20 12:23:54 +00:00
Evgeniy Stepanov a8df444a1c Add __has_feature(memory_sanitizer).
llvm-svn: 170686
2012-12-20 12:03:13 +00:00
Alexander Kornienko 787f4c399f ASTDumper coding style fixes.
http://llvm-reviews.chandlerc.com/D226

Patch by Philip Craig!

llvm-svn: 170684
2012-12-20 11:08:38 +00:00
NAKAMURA Takumi 712c3882f6 clang/test/Driver/warning-options.cpp: Appease MSYS bash.
llvm-svn: 170683
2012-12-20 11:08:13 +00:00
NAKAMURA Takumi df3cf71dd7 clang/test/Misc/ast-dump-decl.c: Add triple. __thread is not supported on all targets.
llvm-svn: 170645
2012-12-20 03:30:30 +00:00
Michael Gottesman 2799ad4cce Updated link in LanguageExtensions.rst to point to BlockLanguageSpec.rst instead of BlockLanguageSpec.txt.
Thanks to Jean-Daniel Dupas for comments!

llvm-svn: 170644
2012-12-20 03:23:52 +00:00
Michael Gottesman 5cf1f65dc9 Changed UTF-8 emdashes to --- ala Dmitri Gribenko's comments.
llvm-svn: 170643
2012-12-20 03:23:49 +00:00
Richard Smith da4de6c246 Fix another uninitialized bool member bug found by -fsanitize=bool. This one
appears to currently be benign (we happen to test the flags in the right
order, so we never depend on the uninitialized value).

llvm-svn: 170640
2012-12-20 02:47:01 +00:00
John McCall 393a78d4d3 Robustify the @encode code and add support for _Atomic.
Fixes PR14628.

llvm-svn: 170639
2012-12-20 02:45:14 +00:00
Richard Smith 5bb4cdfaa9 Fix code that attempted to produce a diagnostic with one DiagnosticEngine, then
produce a note for that diagnostic either with a different DiagnosticEngine or
after calling DiagnosticEngine::Reset(). That didn't make any sense, and did the
wrong thing if the original diagnostic was suppressed.

llvm-svn: 170636
2012-12-20 02:22:15 +00:00
Fariborz Jahanian 4419449391 Provide couple of DeclPrint tests for my last patch.
llvm-svn: 170635
2012-12-20 02:20:09 +00:00
Alexander Kornienko 90ff607894 Implement AST dumper for Decls.
http://llvm-reviews.chandlerc.com/D52

Patch by Philip Craig!

llvm-svn: 170634
2012-12-20 02:09:13 +00:00
Anna Zaks dc15415da4 [analyzer] Add the pointer escaped callback.
Instead of using several callbacks to identify the pointer escape event,
checkers now can register for the checkPointerEscape.

Converted the Malloc checker to use the new callback.
SimpleStreamChecker will be converted next.

llvm-svn: 170625
2012-12-20 00:38:25 +00:00
Argyrios Kyrtzidis 5e14925a35 [preprocessor] When "merging" macro argument tokens into one SLocEntry chunk,
make sure they came from the same kind of FileIDs.

Thanks to Abramo Bagnara for providing the test case.

llvm-svn: 170616
2012-12-19 23:55:44 +00:00
Chad Rosier 567fcd7da2 Typo.
llvm-svn: 170613
2012-12-19 23:47:16 +00:00
Chad Rosier 6c2b11cc50 [driver] Have -isysroot warn on nonexistent paths.
rdar://12282267

llvm-svn: 170611
2012-12-19 23:41:50 +00:00
Fariborz Jahanian 0389e528ab Audit DeclPrinter with -ast-dump on Cocoa.h and
fix any bad objectiveC syntax coming out of
DeclPrinter. This is on going. Also, introduce a new
PrintPolicy and use it as needed when declaration tag
is to be produced via DeclPrinter.

llvm-svn: 170606
2012-12-19 23:36:00 +00:00
Argyrios Kyrtzidis 2810e9dee0 [PCH/Modules] In ASTReader::completeVisibleDeclsMap, make sure to visit all
modules when getting the decls for a namespace or translation unit.

Otherwise the code-completion results will not be complete.

rdar://12889089

llvm-svn: 170596
2012-12-19 22:21:18 +00:00
Dmitri Gribenko 1436ff2ef8 Documentation: UsersManual.rst: some cleanups after semi-automatic conversion
llvm-svn: 170590
2012-12-19 22:06:59 +00:00
Fariborz Jahanian a1f8571e84 objective-C: Don't warn of unimplemented property of protocols in
category, when those properties will be implemented in category's 
primary class or one of its super classes. // rdar://12568064

llvm-svn: 170573
2012-12-19 18:58:55 +00:00
Michael Gottesman 42845efb2d Forgot to remove trailing whitespace when I converted the BlockLanguageSpec.txt => BlockLanguageSpec.rst. It has been eliminated.
llvm-svn: 170572
2012-12-19 18:42:42 +00:00
Michael Gottesman b166b92908 Converted BlockLanguageSpec.txt => BlockLanguageSpec.rst.
llvm-svn: 170571
2012-12-19 18:41:09 +00:00
Ted Kremenek 11d0b553bb Change test to dump Filecheck output to an intermediate file. This makes it easier to update this test.
llvm-svn: 170570
2012-12-19 18:30:38 +00:00
Dmitri Gribenko c55c6fc6e3 Fix PR14591: Windows newlines in doxygen comments cause failed assertion in
TextDiagnostic

Patch by Janusz Chorko.

llvm-svn: 170566
2012-12-19 17:34:55 +00:00
Dmitri Gribenko 909eebc9ac Add a missing 'else'. Found by grep '} if'
No testcase because this did not affect correctness: a declaration can only be
ClassTemplateDecl or a FunctionTemplateDecl, not both.

llvm-svn: 170565
2012-12-19 17:29:30 +00:00
Dmitri Gribenko 696d7226d6 Comment parsing: add a missing 'else'. Found by inspection.
No testcase because we were just building an extra AST node and eventually
throwing it away, so it did not affect correctness.

llvm-svn: 170563
2012-12-19 17:17:09 +00:00
Fariborz Jahanian ae9d8aeb2b Improve on header comment suggested by James Dennet.
llvm-svn: 170555
2012-12-19 17:03:46 +00:00
Bill Wendling 7967fc14b9 Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.
llvm-svn: 170500
2012-12-19 07:18:12 +00:00
Richard Smith 4efa77fde4 Attempt to clarify a vexing-parse diagnostic.
llvm-svn: 170492
2012-12-19 03:15:32 +00:00
Richard Smith 503053a737 Fix assertion failure in self-host (and probably bogus template instantiation
too). When instantiating a direct-initializer, if we find it has zero
arguments, produce an empty ParenListExpr rather than returning a null
expression.

llvm-svn: 170490
2012-12-19 02:27:38 +00:00
Richard Smith d59b832320 PR13470: Ensure that copy-list-initialization isntantiates as
copy-list-initialization (and doesn't add an additional copy step):

Fill in the ListInitialization bit when creating a CXXConstructExpr. Use it
when instantiating initializers in order to correctly handle instantiation of
copy-list-initialization. Teach TreeTransform that function arguments are
initializations, and so need this special treatment too. Finally, remove some
hacks which were working around SubstInitializer's shortcomings.

llvm-svn: 170489
2012-12-19 01:39:02 +00:00
Ted Kremenek 3a081a0339 Pass AnalyzerOptions to PathDiagnosticConsumer to make analyzer options accessible there.
This is plumbing needed for later functionality changes.

llvm-svn: 170488
2012-12-19 01:35:35 +00:00
Ted Kremenek 372735f342 Simplify logic to use SourceManager::getFileLoc(), per Argyrios's feedback.
llvm-svn: 170487
2012-12-19 01:16:49 +00:00
Fariborz Jahanian 799d96b8b8 fixes a doxygen comment.
llvm-svn: 170485
2012-12-19 01:00:36 +00:00
NAKAMURA Takumi 710c18329b test/Index/preamble_macro_template.cpp: Suppress this probably due to Lit/win32 issue. Investigating.
llvm-svn: 170484
2012-12-19 00:57:48 +00:00
David Blaikie ff7d47a354 Change DeclContextLookup(Const)Result to (Mutable)ArrayRef<NamedDecl*>, as per review discussion in r170365
This does limit these typedefs to being sequences, but no current usage
requires them to be contiguous (we could expand this to a more general
iterator pair range concept at some point).

Also, it'd be nice if SmallVector were constructible directly from an ArrayRef
but this is a bit tricky since ArrayRef depends on SmallVectorBaseImpl for the
inverse conversion. (& generalizing over all range-like things, while nice,
would require some nontrivial SFINAE I haven't thought about yet)

llvm-svn: 170482
2012-12-19 00:45:41 +00:00
Fariborz Jahanian bbdb9f2653 Increas number of iterations before a new libclang format object
is created to 1000.

llvm-svn: 170481
2012-12-19 00:35:23 +00:00
Eli Friedman 39b685e4d1 Make sure CodeGen uses a value of the correct type as the result of
of assignment to a bool bitfield.  PR14638.

llvm-svn: 170480
2012-12-19 00:26:58 +00:00
Fariborz Jahanian b67908a07b Some code refactoring per Dimitri's comment.
llvm-svn: 170478
2012-12-19 00:01:48 +00:00
Eli Friedman 40ea264c25 Fix a crash in diagnostic printing when a template class type is diff'ed
against itself. PR14489.

llvm-svn: 170474
2012-12-18 23:32:47 +00:00
Nadav Rotem 1cd71a771c Enable the loop vectorizer in clang via -fvectorize
llvm-svn: 170472
2012-12-18 23:10:16 +00:00
Nadav Rotem b2b8d5bc86 Fix the fvectorize testcase
llvm-svn: 170469
2012-12-18 23:08:58 +00:00
Ted Kremenek e3713d3025 Have clang_getSpellingLocation() use the same logic as DiagnosticRenderer for plowing through macros.
This fixes a subtle bug reported in <rdar://problem/12584554> where a double-nested
macro could lead to an incorrect fixit location with live issues.

This fix also uncovers a bunch of subtle bugs in our indexer test cases which
are now fixed (mostly around source ranges for attributes).

llvm-svn: 170468
2012-12-18 23:07:30 +00:00
Fariborz Jahanian 9b7ab87738 This is the libclang patch providing minimal API to
use clang's formatter. Currently, formatter is used 
to format declaration tags for xml comments. Since formatter
is in flux and its change will break several of the clang comment
tests, only a single tests is formatted using this facility.
Doug has reviewed and approved it for check-in. 

llvm-svn: 170467
2012-12-18 23:02:59 +00:00
Douglas Gregor dfc9430bc7 Be defensive when printing module import locations; the diagnostic printer needs to be robust
llvm-svn: 170466
2012-12-18 23:02:07 +00:00
Eli Bendersky 03b913d539 Similar to 170440 - fix build warning with gcc
llvm-svn: 170461
2012-12-18 22:22:16 +00:00
Bill Wendling f1c3191188 Add tests to check recent changes to some builtins.
llvm-svn: 170458
2012-12-18 21:09:25 +00:00
Daniel Jasper 2af6bbe7e0 Better support for constructor initializers.
We used to format initializers like this (with a sort of hacky implementation):
Constructor()
    : Val1(A),
      Val2(B) {

and now format like this (with a somewhat better solution):
Constructor()
    : Val1(A), Val2(B) {

assuming this would not fit on a single line. Also added tests.

As a side effect we now first analyze whether an UnwrappedLine needs to be
split at all. If not, not splitting it is the best solution by definition. As
this should be a very common case in normal code, not exploring the entire
solution space can provide significant speedup.

llvm-svn: 170457
2012-12-18 21:05:13 +00:00
Meador Inge b97878a235 CodeGen: Expand creal and cimag into complex field loads
PR 14529 was opened because neither Clang or LLVM was expanding
calls to creal* or cimag* into instructions that just load the
respective complex field.  After some discussion, it was not
considered realistic to do this in LLVM because of the platform
specific way complex types are expanded.  Thus a way to solve
this in Clang was pursued.  GCC does a similar expansion.

This patch adds the feature to Clang by making the creal* and
cimag* functions library builtins and modifying the builtin code
generator to look for the new builtin types.

llvm-svn: 170455
2012-12-18 20:58:04 +00:00
Daniel Jasper 3f69a1b860 Make the format scrambler understand line comments.
This allows for writing tests including line comments easier and more readable.
We will need more of those tests in the future and also line comments are
useful to force line breaks in tests.

llvm-svn: 170446
2012-12-18 19:56:56 +00:00
Douglas Gregor 4d65bbd509 CMake: Make sure to detect LibXml2 when Clang is built standalone
llvm-svn: 170444
2012-12-18 19:39:40 +00:00
Eli Bendersky 76bd3d8599 Fix a compilation warning with gcc 4.6
llvm-svn: 170440
2012-12-18 18:53:14 +00:00
Guy Benyei d8a08ea98d Re-commit r170428 changes with Linux style file endings.
Add OpenCL images as clang builtin types.

llvm-svn: 170432
2012-12-18 14:38:23 +00:00
Guy Benyei 11169dded0 Revert changes from r170428, as I accidentally changed the line endings of these files to Windows style.
llvm-svn: 170431
2012-12-18 14:30:41 +00:00
Guy Benyei b13abb952a Add OpenCL images as clang builtin types.
llvm-svn: 170428
2012-12-18 12:30:03 +00:00
David Chisnall d499f8244b Remove obsolete FIXMEs.
llvm-svn: 170425
2012-12-18 10:24:07 +00:00
NAKAMURA Takumi 7174e90078 test/Misc/dev-fd-fs.c: Mark this as XFAIL:freebsd (since r169831).
I don't want to suppress this to be excluded with the feature "dev-fd-fs". This should work also on freebsd.

llvm-svn: 170411
2012-12-18 05:14:30 +00:00
Rafael Espindola d727d3db08 Inline hasAtomicCopyHelperAPI.
llvm-svn: 170408
2012-12-18 04:29:34 +00:00
Rafael Espindola 74a133fa9a Merge storage classes even when contexts don't match.
This fixes the storage class of extern decls that are merged with file level
statics. The patch also fixes the linkage computation so that they are
considered internal.

llvm-svn: 170406
2012-12-18 04:18:55 +00:00
Rafael Espindola 8522ba845f Now that the uninitialized variable has been fixed in llvm, add this test back,
but remove unneeded options and fix the comment.

llvm-svn: 170405
2012-12-18 03:54:29 +00:00
Richard Smith 8b731ea100 Fix typo (thanks to Jordan for spotting it!).
llvm-svn: 170403
2012-12-18 03:04:38 +00:00
Eli Friedman 52f32b9b2b The underlying type for an enum should be an integer type, not another enum.
(This change only affects ObjC.)

<rdar://problem/12857117>.

llvm-svn: 170402
2012-12-18 02:37:32 +00:00
Sean Silva 62737b65b1 docs: Nuke AnalyzerRegions.rst.
As per Ted's advice. It can be brought back from version control if
needed.

This also fixes a Sphinx warning.

llvm-svn: 170401
2012-12-18 02:15:05 +00:00
Anders Carlsson 2a45e409a8 When warning about a missing prototype because a function declaration is missing 'void', insert a fixit to add the void.
llvm-svn: 170399
2012-12-18 01:29:20 +00:00
Eli Friedman 672845bcde More conservative fix for <rdar://problem/12847524> (a crash printing diagnostic ranges).
I'm not really happy with this fix, but I'm confident it's correct.

llvm-svn: 170397
2012-12-18 00:52:36 +00:00
Bill Wendling 707021a90f Use the correct return type (size_t) for these builtins.
<rdar://problem/12646344>

llvm-svn: 170393
2012-12-18 00:37:10 +00:00
Bill Wendling 5d4e6a6a10 Add an expected parameter for the size of the destination.
<rdar://problem/12622659>

llvm-svn: 170392
2012-12-18 00:34:49 +00:00
Eric Christopher 45f2e71571 Add support for passing the main file name down to the assembler
for location information.

Part of PR14624

llvm-svn: 170391
2012-12-18 00:31:10 +00:00
Richard Smith be024a8150 Rein ubsan's vptr sanitizer back a bit. Per core issue 453, binding a reference
to an object outside its lifetime does not have undefined behavior.

llvm-svn: 170387
2012-12-18 00:22:45 +00:00
Rafael Espindola 7581f3269a Fix isThisDeclarationADefinition for extern following tentative.
An extern declaration following a tentative definition should not itself be
considered a tentative definition.
Fixes pr14614.

llvm-svn: 170377
2012-12-17 22:23:47 +00:00
Chandler Carruth 4d5e1a9b34 Fix PR14625 by teaching the driver to detect PWD for assembly files.
This also requires adding support to -cc1as for passing the detecting
PWD down through LLVM's debug info (which in turn required the LLVM
change in r170371).

The test case is weak (we only test the driver behavior) because there
is currently to infrastructure for running cc1as in the test suite. So
those four lines are untested (much like all other lines in that file),
but we have a test for the same pattern using llvm-mc in the LLVM
repository.

llvm-svn: 170373
2012-12-17 21:40:04 +00:00
Argyrios Kyrtzidis fdea813c4a [c-index-test] Fix warnings about unused results from chdir().
Patch from Edwin Vane!

llvm-svn: 170366
2012-12-17 20:19:56 +00:00
Argyrios Kyrtzidis 40f6c2ac9c Just use begin()/end() instead of "&Vector[0], &Vector[0]+Vector.size()".
No functionality change.

llvm-svn: 170365
2012-12-17 20:10:50 +00:00
Argyrios Kyrtzidis 475b399721 Don't include the header outside the include guards, it defeats the purpose of the include guards.
llvm-svn: 170364
2012-12-17 20:10:49 +00:00
Argyrios Kyrtzidis e6f6913bec [parser] Push a semi token for recovery only when it is actually missing.
llvm-svn: 170363
2012-12-17 20:10:43 +00:00
Anna Zaks ad3704c96a [analyzer] Tweak the NumFunctionsAnalyzed stat so that it's more useful.
llvm-svn: 170362
2012-12-17 20:08:54 +00:00
Anna Zaks d53182b0df [analyzer] Implement "do not inline large functions many times"
performance heuristic

After inlining a function with more than 13 basic blocks 32 times, we
are not going to inline it anymore. The idea is that inlining large
functions leads to drastic performance implications. Since the function
has already been inlined, we know that we've analyzed it in many
contexts. 

The following metrics are used:
 - Large function is a function with more than 13 basic blocks (we
should switch to another metric, like cyclomatic complexity)
 - We consider that we've inlined a function many times if it's been
inlined 32 times. This number is configurable with -analyzer-config
max-times-inline-large=xx

This heuristic addresses a performance regression introduced with
inlining on one benchmark. The analyzer on this benchmark became 60
times slower with inlining turned on. The heuristic allows us to analyze
it in 24% of the time. The performance improvements on the other
benchmarks I've tested with are much lower - under 10%, which is
expected.

llvm-svn: 170361
2012-12-17 20:08:51 +00:00
David Chisnall 0d75e0600b Reapply r170344, this time without forgetting to commit the header changes.
llvm-svn: 170354
2012-12-17 18:54:24 +00:00
Benjamin Kramer beea120d6e Revert "Added support for new property helpers (GNUstep runtime)."
This reverts commit r170344. Doesn't even compile.

llvm-svn: 170351
2012-12-17 18:02:43 +00:00
David Chisnall e99bc83fa5 Added support for new property helpers (GNUstep runtime).
llvm-svn: 170344
2012-12-17 15:59:29 +00:00
Daniel Jasper 5485d0cd67 Add basic support for splitting before function calls if it can't be
avoided.

This required a minor modification of the memoization as now the
"CurrentPenalty" depends on whether or not we break before the current
token. Therefore, the CurrentPenalty should not be memoized but added
after retrieving a value from memory. This should not affect the runtime
behavior.

llvm-svn: 170337
2012-12-17 14:34:14 +00:00
Dmitry Vyukov ca2d2e11ac tsan: correct llvm libc++ name
llvm-svn: 170326
2012-12-17 13:07:35 +00:00
Daniel Jasper e25509f857 Fix several formatting problems.
More specifically:
- Improve formatting of static initializers.
- Fix formatting of lines comments in enums.
- Fix formmating of trailing line comments.

llvm-svn: 170316
2012-12-17 11:29:41 +00:00
Dmitry Vyukov a53767ea22 tsan: add __has_feature(thread_sanitizer)
llvm-svn: 170314
2012-12-17 08:52:05 +00:00
Dmitry Vyukov be66bf152e tsan: update docs
llvm-svn: 170311
2012-12-17 07:16:54 +00:00
Chandler Carruth 1aa9f173fc Clean up a small (messy) section of Clang's release notes for 3.2.
llvm-svn: 170309
2012-12-17 06:24:36 +00:00
Bill Schmidt a3d121cd61 This patch fixes PR13624, which notes a 64-bit PowerPC ELF ABI
incompatibility with how complex values are returned.  It is sufficient
to flag all complex types as direct rather than indirect.

A new test case is provided that checks correct IR generation for the
various supported flavors of _Complex.

llvm-svn: 170302
2012-12-17 04:20:17 +00:00
Nico Weber 555d1aa3a4 IdentifierResolver: Remove an unnecessary include and an unused parameter.
llvm-svn: 170297
2012-12-17 03:51:09 +00:00
Dmitri Gribenko 544bd61989 Documentation: add a missing word
llvm-svn: 170296
2012-12-16 19:55:39 +00:00
Dmitri Gribenko 2d1fa58fa9 Clang ReleaseNotes: add information about documentation comments support
llvm-svn: 170294
2012-12-16 17:38:09 +00:00
Dmitri Gribenko 7730cf0b62 Documentation: AutomaticReferenceCounting.rst: use CSS section numbering.
This enables us to use the same document structure as in other files.

llvm-svn: 170283
2012-12-16 11:25:45 +00:00
Craig Topper f3b839b063 Don't use SourceLineCache in getColumnNumber if LastLineNoResult is past the end of the cache. Fixes PR14570.
llvm-svn: 170281
2012-12-16 05:58:32 +00:00
Sean Silva 55b7cbe8ed docs: Fix completely broken adornment structure.
The adornment:

===
Foo
===

is for titles, not sections.

llvm-svn: 170278
2012-12-16 00:23:40 +00:00
Dmitri Gribenko 7ac0cc3698 Documentation: random cleanups. Use monospaced font where appropriate,
highlight console output with "code-block:: console", etc.

llvm-svn: 170276
2012-12-15 21:10:51 +00:00
Dmitri Gribenko d9d26072d6 Documentation: convert InternalsManual.html to reST
Patch by Anastasi Voitova with with small fixes by me.

llvm-svn: 170275
2012-12-15 20:41:17 +00:00
Dmitri Gribenko ace09a2466 Documentation: LanguageExtensions.rst: convert link to :doc: style and fix up
heading underline.

llvm-svn: 170272
2012-12-15 14:25:25 +00:00
Will Dietz ddd282addb [ubsan] Emit branch weight metadata to hint towards common case.
Results in better block placement that helps close the
performance gap when making ubsan checks recoverable.

llvm-svn: 170263
2012-12-15 01:39:14 +00:00
Jordan Rose 32e9489058 Docs: redirect "static analysis extensions" section to the analyzer site.
The notes on the objc_method_family and ns_returns_retained-type attributes
have been moved to the Objective-C section, since both are used by ARC.
The notes on analyzer_noreturn are now only on the analyzer site.

The inadequacy of these docs was noticed months ago by Jonathan Sauer;
I'm only just now getting around to cleaning them up.

llvm-svn: 170261
2012-12-15 00:37:01 +00:00
Jordan Rose ba8307d2e5 Remove old description of analyzer internals from public docs.
The file still exists in docs/analyzer/, but it won't be linked to from
clang.llvm.org or processed as part of the default Sphinx doc-build.
RegionStore has changed a lot from what Ted and Zhongxing describe here!

llvm-svn: 170260
2012-12-15 00:36:53 +00:00
Anton Yartsev 20ae1dbfd1 fixed line endings
llvm-svn: 170238
2012-12-14 20:28:48 +00:00
Anton Yartsev 5363bf157f added post-statement callback to CXXNewExpr and pre-statement callback to CXXDeleteExpr
llvm-svn: 170234
2012-12-14 19:48:34 +00:00
Argyrios Kyrtzidis 53e3d6d7f0 Don't hit an assertion failure when calculating the __PRETTY_FUNCTION__
of a member function with parenthesized declarator.

Like this test case:

class Foo {
  const char *(baz)() {
    return __PRETTY_FUNCTION__;
  }
};

llvm-svn: 170233
2012-12-14 19:44:11 +00:00
Anna Zaks a40bcac0ef [analyzer] Propagate the checker's state from checkBranchCondition
Fixes a bug, where we were dropping the state modifications from the
checkBranchCondition checker callback.

llvm-svn: 170232
2012-12-14 19:08:20 +00:00
Anna Zaks 5f2af81e79 [analyzer] Refactor: Store visited Decls instead of CallGraphNodes.
llvm-svn: 170231
2012-12-14 19:08:17 +00:00
Edwin Vane 524741fbbd Style and Doc fix for CommonOptionsParser
- Renaming GetCompilations() and GetSourcePathList() to follow LLVM
  style.
- Updating docs to reflect name change.
- Also updating help text to not mention clang-check since this class
  can be used by any tool.

Reviewed By: Alexander Kornienko

llvm-svn: 170229
2012-12-14 18:58:25 +00:00
Argyrios Kyrtzidis 164fdb607b [preprocessor] For errors at a function macro invocation, also include
a note about where the macro is defined.

llvm-svn: 170228
2012-12-14 18:53:47 +00:00
NAKAMURA Takumi 92eb254c3c [CMake] Move libxml2 stuff from clang to llvm/cmake.
llvm-svn: 170225
2012-12-14 18:30:20 +00:00
Nico Weber 7aa4a881e6 Don't require a space between the two ">" in "vector<id<protocol>>" in objc++11.
C++11 allowed writing "vector<vector<int>>" without a space between the two ">".
This change allows this for protocols in template lists too in -std=c++11 mode,
and improves the diagnostic in c++98 mode.

llvm-svn: 170223
2012-12-14 18:22:38 +00:00
NAKAMURA Takumi 02f4395df6 Targets.cpp: [cygwin] Add the predefined macro "_X86_", according to newer version of cygwin/w32api.
llvm-svn: 170188
2012-12-14 10:17:26 +00:00
Argyrios Kyrtzidis 26444c5243 Have Sema::ActOnStartOfFunctionDef return the declaration that was passed it.
This fixes the missing warning here:

struct S {
    template <typename T>
    void meth() {
        char arr[3];
        arr[4] = 0; // warning: array index 4 is past the end of the array
    }
};

template <typename T>
void func() {
    char arr[3];
    arr[4] = 0; // no warning
}

llvm-svn: 170180
2012-12-14 06:54:03 +00:00
Argyrios Kyrtzidis 6fada2ddbd Remove code from Sema::ActOnStartOfFunctionTemplateDef that duplicates what
Sema::ActOnStartOfFunctionDef is already doing.

llvm-svn: 170179
2012-12-14 06:53:58 +00:00
Nico Weber b819108af7 fix another spello
llvm-svn: 170177
2012-12-14 02:41:18 +00:00
Nico Weber 696933606b fix spello
llvm-svn: 170176
2012-12-14 02:40:09 +00:00
NAKAMURA Takumi 6780b68ff5 clang/test/CodeGenCXX/lambda-expressions.cpp: Relax expression for -Asserts.
"entry:" is not met in -Asserts build.

llvm-svn: 170175
2012-12-14 02:35:04 +00:00
Ted Kremenek 45bb8db372 Refactor dump methods to make RegionBindingsRef printable in the debugger.
llvm-svn: 170170
2012-12-14 01:23:13 +00:00
Nadav Rotem a633af3f68 Make the test less sensitive to the inline threshold.
llvm-svn: 170164
2012-12-14 00:26:15 +00:00
Eli Friedman f5f4d2fd2e Make sure the __invoke function for lambdas returns properly. Per bug report on IRC>
llvm-svn: 170160
2012-12-13 23:37:17 +00:00
David Blaikie 831c9927e8 Debug Info: Emit vtables pointer members as artificial.
I wasn't sure where to put the test case for this, but this seemed like as good
a place as any. I had to reorder the tests here to make them legible while
still matching the order of metadata output in the IR file (for some reason
making it virtual changed the ordering).

Relevant commit to fix up LLVM to actually respect 'artificial' member
variables is coming once I write up a test case for it.

llvm-svn: 170154
2012-12-13 22:29:06 +00:00
Argyrios Kyrtzidis 3960540e30 [PCH] Make the new PCH format (control block) backwards compatible and
don't crash when loading a PCH with the older format.

The introduction of the control block broke compatibility with PCHs from
older versions. This patch allows loading (and rejecting) PCHs from an older
version and allows newer PCHs to be rejected from older clang versions as well.

rdar://12821386

llvm-svn: 170150
2012-12-13 21:38:23 +00:00
Rafael Espindola 62e8770ff8 Add support for current Ubuntu Quantal and the upcoming Raring.
Patch by Martin Nowack.

llvm-svn: 170147
2012-12-13 20:26:05 +00:00
Nadav Rotem b89373430a Revert 170049 because it fails with an assertion on one of the spec2000 workloads.
llvm-svn: 170143
2012-12-13 19:58:10 +00:00
Jordan Rose 2806a549b4 [analyzer] Fix doc error (wrong param name) in ObjCSuperCallChecker.
Thanks for the -Wdocumentation catch, Dmitri!

llvm-svn: 170139
2012-12-13 18:26:05 +00:00
NAKAMURA Takumi 62167ca254 Update CMake build corresponding to r170135.
Thanks to Saleem Abdulrasool, aka compnerd!

llvm-svn: 170136
2012-12-13 16:24:59 +00:00
Roman Divacky d93c8c008e Dont use/link ARCMT, StaticAnalyzer and Rewriter to clang when the user
specifies not to. Dont build ASTMatchers with Rewriter disabled and
StaticAnalyzer when it's disabled.

Without all those three, the clang binary shrinks (x86_64) from ~36MB
to ~32MB (unstripped).

llvm-svn: 170135
2012-12-13 16:09:42 +00:00
Dmitri Gribenko 795774018e Documentation: add AutomaticReferenceCounting.rst to the toctree
llvm-svn: 170133
2012-12-13 16:06:00 +00:00
Dmitri Gribenko 6c48a8c4ee Documentation: convert AutomaticReferenceCounting.html to reST
Patch by Anastasi Voitova with with small fixes by me.

llvm-svn: 170132
2012-12-13 16:04:37 +00:00
Alexander Kornienko 18ec81b854 Rename StmtDumper to ASTDumper.
Patch contributed by Philip Craig!

llvm-svn: 170127
2012-12-13 13:59:55 +00:00
Guy Benyei 41aa1a4b92 Remove little endian specification from SPIR data layout - SPIR doesn't define endiannes in the data layout.
llvm-svn: 170125
2012-12-13 13:22:48 +00:00
Richard Smith bb741f4552 Point a hyperlink back to where it was before it got reStructured.
llvm-svn: 170110
2012-12-13 07:29:23 +00:00
Richard Smith 1629da95fe ubsan: Add -fsanitize=bool and -fsanitize=enum, which check for loads of
bit-patterns which are not valid values for enumerated or boolean types.
These checks are the ubsan analogue of !range metadata.

llvm-svn: 170108
2012-12-13 07:11:50 +00:00
Richard Smith f0480fc988 Simplify. No functionality change.
llvm-svn: 170100
2012-12-13 05:41:48 +00:00
Rafael Espindola 0f207edaa5 Initial support for FreeBSD on ARM.
Patch by Andrew Turner.

llvm-svn: 170096
2012-12-13 04:17:14 +00:00
Jordan Rose b0fe7fdb57 [analyzer] Generalize ObjCMissingSuperCallChecker.
We now check a few methods for UIResponder, NSResponder, and NSDocument.

Patch by Julian Mayer!

llvm-svn: 170089
2012-12-13 03:06:45 +00:00
Eli Friedman 07bab73c7f Using CanQualType::getAs<ArrayType> is unsafe; fix the code currently using it,
and make sure additional uses don't get introduced.  <rdar://problem/12858424>.

llvm-svn: 170081
2012-12-13 01:43:21 +00:00
Sean Silva bf9b4cd596 docs: More reST conversion.
Sorry for the large commit, but it is much faster to convert in batches.

llvm-svn: 170067
2012-12-13 01:10:46 +00:00
Anna Zaks 3f12949b25 [analyzer] Fix a self-init checker false positive.
This is a Band-Aid fix to a false positive, where we complain about not
initializing self to [super init], where self is not coming from the
init method, but is coming from the caller to init.

The proper solution would be to associate the self and it's state with
the enclosing init.

llvm-svn: 170059
2012-12-13 00:42:19 +00:00
Fariborz Jahanian b487388be1 objc: DOn't complain if a (SEL) expression is typecast
to (SEL). Fixes // rdar://12859590

llvm-svn: 170058
2012-12-13 00:42:06 +00:00
Eli Friedman 89a4a2cd3d Add missing check for error return from DefaultLvalueConversion. Fixes <rdar://problem/12857416>.
llvm-svn: 170056
2012-12-13 00:37:17 +00:00
Eli Friedman cdb135a96b More hacking on mapDiagnosticRanges to make it handle more cases.
This still isn't quite right, but it fixes a crash.

I factored out findCommonParent because we need it on the result of 
getImmediateExpansionRange: for a function macro, the beginning
and end of an expansion range can come out of different
macros/macro arguments, which means the resulting range is a complete
mess to handle consistently.

I also made some changes to how findCommonParent works; it works somewhat
better in some cases, and somewhat worse in others, but I think overall
it's a better balance.  I'm coming to the conclusion that mapDiagnosticRanges
isn't using the right algorithm, though: chasing the caret is fundamentally
more complicated than any algorithm which only considers one FileID for the
caret can handle because each SourceLocation doesn't really have a single parent.
We need to follow the same path of choosing expansion locations and spelling
locations which the caret used to come up with the correct range
in the general case.

Fixes <rdar://problem/12847524>.

llvm-svn: 170049
2012-12-13 00:14:59 +00:00
Sean Silva 709c44d1f1 docs: Convert some docs to reST.
Converts:
    LanguageExtensions
    LibASTMatchers
    LibTooling
    PCHInternals
    ThreadSanitizer
    Tooling

Patch by Mykhailo Pustovit!
(with minor edits by Dmitri Gribenko and Sean Silva)

llvm-svn: 170048
2012-12-12 23:44:55 +00:00
Daniel Dunbar e50a92f754 docs: Another test commit (sphinx autoupdating).
llvm-svn: 170047
2012-12-12 23:35:03 +00:00
Daniel Dunbar e6daf69f8b docs: Test commit (sphinx autoupdating).
llvm-svn: 170046
2012-12-12 23:33:24 +00:00
Sean Silva 99b51c48cc docs: Initial Sphinx setup for Clang.
I don't think this will be visible just yet on <clang.llvm.org/docs/>
since I don't think that the necessary server-side setup has taken
place.

Don't shoot me over the theme. I don't want to duplicate LLVM's theme
into the clang repo at the moment, so I just used one of Sphinx's
default themes.

llvm-svn: 170042
2012-12-12 23:02:30 +00:00