Commit Graph

42473 Commits

Author SHA1 Message Date
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