]> granicus.if.org Git - clang/log
clang
11 years agoPR14855: don't silently swallow a nested-name-specifier after a type name.
Richard Smith [Tue, 8 Jan 2013 22:43:49 +0000 (22:43 +0000)]
PR14855: don't silently swallow a nested-name-specifier after a type name.

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

11 years agoClear LV cache when dropping availability attributes.
Rafael Espindola [Tue, 8 Jan 2013 22:31:36 +0000 (22:31 +0000)]
Clear LV cache when dropping availability attributes.

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

11 years agoTighten types a bit. No functionality change.
Rafael Espindola [Tue, 8 Jan 2013 22:04:34 +0000 (22:04 +0000)]
Tighten types a bit. No functionality change.

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

11 years agoDon't crash when trying to apply the availability attribute to a block.
Rafael Espindola [Tue, 8 Jan 2013 21:30:32 +0000 (21:30 +0000)]
Don't crash when trying to apply the availability attribute to a block.

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

11 years agoTighten types a bit. No functionality change.
Rafael Espindola [Tue, 8 Jan 2013 21:00:12 +0000 (21:00 +0000)]
Tighten types a bit. No functionality change.

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

11 years agoTighten types a bit. No functionality change.
Rafael Espindola [Tue, 8 Jan 2013 20:44:06 +0000 (20:44 +0000)]
Tighten types a bit. No functionality change.

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

11 years agoRemove on-by-default warning from -Wmost.
David Blaikie [Tue, 8 Jan 2013 20:28:13 +0000 (20:28 +0000)]
Remove on-by-default warning from -Wmost.

-Wint-to-pointer-cast, added to match GCC's warning by the same name, doesn't
need to be in any other groups (as it isn't in any groups in GCC either).

Found in post-commit review by Ted Kremenek.

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

11 years agoFormatter: More tests for already-passing ObjC bits.
Nico Weber [Tue, 8 Jan 2013 20:16:23 +0000 (20:16 +0000)]
Formatter: More tests for already-passing ObjC bits.

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

11 years ago[analyzer] Bump down the max size of functions being analyzed.
Anna Zaks [Tue, 8 Jan 2013 20:09:00 +0000 (20:09 +0000)]
[analyzer] Bump down the max size of functions being analyzed.

With the new setting, we are not going to inline any functions that are
more than 50 basic blocks. (The analyzer is 20% faster on several
especially bad benchmarks with the new default.)

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

11 years agoDon't break after unary operators.
Daniel Jasper [Tue, 8 Jan 2013 20:03:18 +0000 (20:03 +0000)]
Don't break after unary operators.

Before:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa, *
                                                 aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaaaaaaaaaa, *aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

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

11 years agoMove loop variable update.
Rafael Espindola [Tue, 8 Jan 2013 19:58:34 +0000 (19:58 +0000)]
Move loop variable update.
Thanks to Dmitri Gribenko for the suggestion.

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

11 years agoMark all subsequent decls used.
Rafael Espindola [Tue, 8 Jan 2013 19:43:34 +0000 (19:43 +0000)]
Mark all subsequent decls used.

In the source

  static void f();
  static void f();
  template<typename T>
  static void g() {
    f();
  }
  static void f() {
  }
  void h() {
    g<int>();
  }

the call to f refers to the second decl, but it is only marked used at the end
of the translation unit during instantiation, after the third f decl has been
linked in.

With this patch we mark all subsequent decls used, so that it is easy to check
if a symbol is used or not.

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

11 years agoFormatter: Format @ literals better. Array and dictionary literals need more work.
Nico Weber [Tue, 8 Jan 2013 19:40:21 +0000 (19:40 +0000)]
Formatter: Format @ literals better. Array and dictionary literals need more work.

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

11 years agoVarious tweaks and updates to the analyzer website.
Jordan Rose [Tue, 8 Jan 2013 19:29:37 +0000 (19:29 +0000)]
Various tweaks and updates to the analyzer website.

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

11 years ago[analyzer] Only include uniqueling location as issue_hash when available
Anna Zaks [Tue, 8 Jan 2013 19:19:46 +0000 (19:19 +0000)]
[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.

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

11 years agoFormatter: More ObjC tests.
Nico Weber [Tue, 8 Jan 2013 19:15:23 +0000 (19:15 +0000)]
Formatter: More ObjC tests.

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

11 years ago[libclang] In clang_equalCursors, clear out the "FirstInDeclGroup" part in a declarat...
Argyrios Kyrtzidis [Tue, 8 Jan 2013 18:23:28 +0000 (18:23 +0000)]
[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.

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

11 years agoUse Decl::getAvailability() rather than checking for the "unavailable"
Douglas Gregor [Tue, 8 Jan 2013 18:16:18 +0000 (18:16 +0000)]
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>.

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

11 years agoFormatter: Add tests for some ObjC bits that happen to be formatted correctly.
Nico Weber [Tue, 8 Jan 2013 17:56:31 +0000 (17:56 +0000)]
Formatter: Add tests for some ObjC bits that happen to be formatted correctly.

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

11 years agoRepost checker-270, which for some reason got deleted.
Ted Kremenek [Tue, 8 Jan 2013 17:33:58 +0000 (17:33 +0000)]
Repost checker-270, which for some reason got deleted.

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

11 years agoclang-format can now format #defines.
Manuel Klimek [Tue, 8 Jan 2013 16:33:20 +0000 (16:33 +0000)]
clang-format can now format #defines.

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

11 years agoDon't put spaces around ##.
Daniel Jasper [Tue, 8 Jan 2013 16:17:54 +0000 (16:17 +0000)]
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();

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

11 years agoAdd missing spaces. This doesn't cause problems in practice because we only warn
Rafael Espindola [Tue, 8 Jan 2013 16:09:04 +0000 (16:09 +0000)]
Add missing spaces. This doesn't cause problems in practice because we only warn
about _Static_assert with -pedantic.

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

11 years agoClear the LV cache when setting the instantiated from link.
Rafael Espindola [Tue, 8 Jan 2013 14:58:32 +0000 (14:58 +0000)]
Clear the LV cache when setting the instantiated from link.
Fixes pr14835.

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

11 years agoChange the data structure used in clang-format.
Daniel Jasper [Tue, 8 Jan 2013 14:56:18 +0000 (14:56 +0000)]
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.

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

11 years agoCodeGen/compound-assign-overflow.c: include stdint.h in freestanding mode
Dmitri Gribenko [Tue, 8 Jan 2013 14:47:41 +0000 (14:47 +0000)]
CodeGen/compound-assign-overflow.c: include stdint.h in freestanding mode

This hopefully fixes the ARM buildbot.

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

11 years agodocs: "clang tools" are not a different interface.
Sean Silva [Tue, 8 Jan 2013 04:42:09 +0000 (04:42 +0000)]
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.

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

11 years agoClear the LV cache when merging the availability attribute.
Rafael Espindola [Tue, 8 Jan 2013 04:04:30 +0000 (04:04 +0000)]
Clear the LV cache when merging the availability attribute.

The availability implies default visibility, so it can change the computed
visibility.

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

11 years agoAdd a test to make sure that vector output happens for debug info.
Eric Christopher [Tue, 8 Jan 2013 01:54:13 +0000 (01:54 +0000)]
Add a test to make sure that vector output happens for debug info.

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

11 years agoDon't warn about undefined varargs argument behavior in unreachable code.
Ted Kremenek [Tue, 8 Jan 2013 01:50:40 +0000 (01:50 +0000)]
Don't warn about undefined varargs argument behavior in unreachable code.

Fixes <rdar://problem/12322000>.

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

11 years agoAdd [artificial] debug info annotation to test matching r171826
David Blaikie [Tue, 8 Jan 2013 01:12:59 +0000 (01:12 +0000)]
Add [artificial] debug info annotation to test matching r171826

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

11 years ago[arcmt] Follow-up for r171484; make sure when adding brackets enclosing case statements,
Argyrios Kyrtzidis [Tue, 8 Jan 2013 00:58:25 +0000 (00:58 +0000)]
[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.

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

11 years agoMove ref qualifiers from Type bitfields into FunctionProtoType, stealing two
Richard Smith [Tue, 8 Jan 2013 00:50:27 +0000 (00:50 +0000)]
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.

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

11 years ago[analyzer] Include the bug uniqueing location in the issue_hash.
Anna Zaks [Tue, 8 Jan 2013 00:25:29 +0000 (00:25 +0000)]
[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.

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

11 years ago[analyzer] Plist: change the type of issue_hash from int to string.
Anna Zaks [Tue, 8 Jan 2013 00:25:22 +0000 (00:25 +0000)]
[analyzer] Plist: change the type of issue_hash from int to string.

This gives more flexibility to what could be stored as issue_hash.

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

11 years ago[analyzer] Extend the Representing Values section of the dev manual.
Anna Zaks [Tue, 8 Jan 2013 00:25:14 +0000 (00:25 +0000)]
[analyzer] Extend the Representing Values section of the dev manual.

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

11 years agoclang/test/CodeGenOpenCL/shifts.cl: Fixup for -Asserts.
NAKAMURA Takumi [Tue, 8 Jan 2013 00:15:53 +0000 (00:15 +0000)]
clang/test/CodeGenOpenCL/shifts.cl: Fixup for -Asserts.

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

11 years agoPR14838: When a member reference is bound to a temporary, don't forget to
Richard Smith [Tue, 8 Jan 2013 00:08:23 +0000 (00:08 +0000)]
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.

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

11 years agoBack out my no-op change from r171783.
Douglas Gregor [Tue, 8 Jan 2013 00:01:45 +0000 (00:01 +0000)]
Back out my no-op change from r171783.

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

11 years agoCorrect OpenBSD profiling test
Dmitri Gribenko [Mon, 7 Jan 2013 23:55:47 +0000 (23:55 +0000)]
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.

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

11 years agoExtract the instance-method case for debug info out into a separate function.
David Blaikie [Mon, 7 Jan 2013 23:06:35 +0000 (23:06 +0000)]
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)

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

11 years agoadd a triple
Rafael Espindola [Mon, 7 Jan 2013 23:04:04 +0000 (23:04 +0000)]
add a triple

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

11 years ago[ubsan] Use correct type for compound assignment ops.
Will Dietz [Mon, 7 Jan 2013 22:25:52 +0000 (22:25 +0000)]
[ubsan] Use correct type for compound assignment ops.

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

11 years agoSimplify computing debug info type for static member functions.
David Blaikie [Mon, 7 Jan 2013 22:24:59 +0000 (22:24 +0000)]
Simplify computing debug info type for static member functions.

No (intended) functional change.

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

11 years agoConverted Block-ABI-Apple.txt => Block-ABI-Apple.rst.
Michael Gottesman [Mon, 7 Jan 2013 22:24:45 +0000 (22:24 +0000)]
Converted Block-ABI-Apple.txt => Block-ABI-Apple.rst.

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

11 years agodocs: Fix inconsistent titles.
Sean Silva [Mon, 7 Jan 2013 21:46:47 +0000 (21:46 +0000)]
docs: Fix inconsistent titles.

Sphinx was whining about this.

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

11 years agodocs: Copy Block-ABI-Apple.txt to output.
Sean Silva [Mon, 7 Jan 2013 21:46:35 +0000 (21:46 +0000)]
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.

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

11 years agoMinor refactoring of my last patch
Fariborz Jahanian [Mon, 7 Jan 2013 21:31:08 +0000 (21:31 +0000)]
Minor refactoring of my last patch
related to // rdar://12958878

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

11 years ago[docs/analyzer] Test commit (for auto-update).
Daniel Dunbar [Mon, 7 Jan 2013 20:44:37 +0000 (20:44 +0000)]
[docs/analyzer] Test commit (for auto-update).

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

11 years ago[docs] Fix an inconsistent title level, and a sphinx warning.
Daniel Dunbar [Mon, 7 Jan 2013 20:43:06 +0000 (20:43 +0000)]
[docs] Fix an inconsistent title level, and a sphinx warning.
 - We don't need any static files currently, so drop that dir.

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

11 years ago[docs/analyzer] Convert existing debug-checks document to Sphinx and link into doctree.
Daniel Dunbar [Mon, 7 Jan 2013 20:38:55 +0000 (20:38 +0000)]
[docs/analyzer] Convert existing debug-checks document to Sphinx and link into doctree.

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

11 years agoTest case for r171784.
Chad Rosier [Mon, 7 Jan 2013 20:34:40 +0000 (20:34 +0000)]
Test case for r171784.

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

11 years agoUse the C++11 POD definition in C++11 mode to determine whether one
Douglas Gregor [Mon, 7 Jan 2013 20:03:16 +0000 (20:03 +0000)]
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>.

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

11 years agoUse getter. Fixes the build from a bad merge.
Rafael Espindola [Mon, 7 Jan 2013 20:01:57 +0000 (20:01 +0000)]
Use getter. Fixes the build from a bad merge.

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

11 years agoAdd support for attribute((mode(unwind_word))).
Rafael Espindola [Mon, 7 Jan 2013 19:58:54 +0000 (19:58 +0000)]
Add support for attribute((mode(unwind_word))).
Patch by Nick Lewycky. Fixes pr8703.

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

11 years agoobjective-C: when searching for declarations in protocol
Fariborz Jahanian [Mon, 7 Jan 2013 19:21:03 +0000 (19:21 +0000)]
objective-C: when searching for declarations in protocol
list of classes, etc., make sure to look into protocol
definitions. // rdar://12958878

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

11 years ago[libclang] When annotating preprocessor tokens, if we are in a macro definition,
Argyrios Kyrtzidis [Mon, 7 Jan 2013 19:16:32 +0000 (19:16 +0000)]
[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.

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

11 years ago[libclang] Simplify annotation of preprocessing tokens and remove the AnnotateTokensData
Argyrios Kyrtzidis [Mon, 7 Jan 2013 19:16:30 +0000 (19:16 +0000)]
[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.

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

11 years ago[libclang] Make token annotation of type/storage qualifiers accurate.
Argyrios Kyrtzidis [Mon, 7 Jan 2013 19:16:27 +0000 (19:16 +0000)]
[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.

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

11 years ago[libclang] When getting the cursor for an identifier inside a macro definition, check if
Argyrios Kyrtzidis [Mon, 7 Jan 2013 19:16:25 +0000 (19:16 +0000)]
[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.

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

11 years ago[PCH] (De)serialize the end location of MacroInfo.
Argyrios Kyrtzidis [Mon, 7 Jan 2013 19:16:23 +0000 (19:16 +0000)]
[PCH] (De)serialize the end location of MacroInfo.

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

11 years agoPull the bulk of Lexer::MeasureTokenLength() out into a new function,
Argyrios Kyrtzidis [Mon, 7 Jan 2013 19:16:18 +0000 (19:16 +0000)]
Pull the bulk of Lexer::MeasureTokenLength() out into a new function,
Lexer::getRawToken().

No functionality change.

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

11 years ago[analyzer] Fix a false positive in Secure Keychain API checker.
Anna Zaks [Mon, 7 Jan 2013 19:13:00 +0000 (19:13 +0000)]
[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.

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

11 years ago[analyzer] Fix a false positive in the ivar invalidation checker.
Anna Zaks [Mon, 7 Jan 2013 19:12:56 +0000 (19:12 +0000)]
[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)

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

11 years agoFixed a number of -Wcovered-switch-default diagnostics in tools/clang/include/clang...
Alexander Kornienko [Mon, 7 Jan 2013 19:09:15 +0000 (19:09 +0000)]
Fixed a number of -Wcovered-switch-default diagnostics in tools/clang/include/clang/AST/AttrDump.inc

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

11 years agoFormatter: Support @public/@protected/@package/@private.
Nico Weber [Mon, 7 Jan 2013 19:05:19 +0000 (19:05 +0000)]
Formatter: Support @public/@protected/@package/@private.

@package is an Objective-C 2 feature, so turn on ObjC2 as well.

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

11 years agoComment to XML conversion: no, we don't want to print instantiations for the
Dmitri Gribenko [Mon, 7 Jan 2013 18:45:48 +0000 (18:45 +0000)]
Comment to XML conversion: no, we don't want to print instantiations for the
<Declaration> tag

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

11 years agoFix parsing of variable declarations directly after a class / struct.
Manuel Klimek [Mon, 7 Jan 2013 18:10:23 +0000 (18:10 +0000)]
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.

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

11 years agoImplement Attr dumping for -ast-dump.
Alexander Kornienko [Mon, 7 Jan 2013 17:53:08 +0000 (17:53 +0000)]
Implement Attr dumping for -ast-dump.
http://llvm-reviews.chandlerc.com/D234

Patch by Philip Craig!

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

11 years agoAdd fixit hints for misplaced C++11 attributes around class specifiers.
Michael Han [Mon, 7 Jan 2013 16:57:11 +0000 (16:57 +0000)]
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.

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

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

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

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

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

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

Before:
  throw a *b;

Now:
  throw a * b;

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

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

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

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

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

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

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

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

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

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

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

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

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

Also set ObjC1 in the formatter tests.

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

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

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

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

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

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

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

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

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

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

This addresses llvm.org/PR14830.

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

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

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

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

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

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

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

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

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

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

This addresses llvm.org/PR14815.

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

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

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

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

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

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

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

Found with -fsanitize=integer.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This fixes llvm.org/PR14823.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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