]> granicus.if.org Git - clang/log
clang
11 years agoDo not model loads from complex types, since we don't accurately model the imaginary...
Ted Kremenek [Wed, 9 Jan 2013 18:46:17 +0000 (18:46 +0000)]
Do not model loads from complex types, since we don't accurately model the imaginary and real parts yet.

Fixes false positive reported in <rdar://problem/12964481>.

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

11 years agoSuppress GCC -Wreturn warning.
David Blaikie [Wed, 9 Jan 2013 17:48:41 +0000 (17:48 +0000)]
Suppress GCC -Wreturn warning.

Modified from a patch by David Greene.

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

11 years agoHandle static functions being redeclared in function scope.
Rafael Espindola [Wed, 9 Jan 2013 16:34:58 +0000 (16:34 +0000)]
Handle static functions being redeclared in function scope.

Fixes pr14861.

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

11 years agoEnables layouting unwrapped lines around preprocessor directives.
Manuel Klimek [Wed, 9 Jan 2013 15:25:02 +0000 (15:25 +0000)]
Enables layouting unwrapped lines around preprocessor directives.

Previously, we'd always start at indent level 0 after a preprocessor
directive, now we layout the following snippet (column limit 69) as
follows:

functionCallTo(someOtherFunction(
    withSomeParameters, whichInSequence,
    areLongerThanALine(andAnotherCall,
  B
                       withMoreParamters,
                       whichStronglyInfluenceTheLayout),
    andMoreParameters),
               trailing);

Note that the different jumping indent is a different issue that will be
addressed separately.

This is the first step towards handling #ifdef->#else->#endif chains
correctly.

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

11 years agoEnable intel_ocl_bicc for x86_64 target. This was missed in r171056.
Guy Benyei [Wed, 9 Jan 2013 12:21:44 +0000 (12:21 +0000)]
Enable intel_ocl_bicc for x86_64 target. This was missed in r171056.

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

11 years agoOnly align after assignments on the top level.
Daniel Jasper [Wed, 9 Jan 2013 10:40:23 +0000 (10:40 +0000)]
Only align after assignments on the top level.

This fixes llvm.org/PR14870 and we no longer mess up:
template <typename T1, typename T2 = char, typename T3 = char,
          typename T4 = char>
void f();

It removes the nice aligment for assignments inside other expressions,
but I am not sure those are actually practically relevant. If so, we can
fix those later.

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

11 years agoDon't simply give up when exceeding 80cols, choose an "ok" option.
Daniel Jasper [Wed, 9 Jan 2013 10:16:05 +0000 (10:16 +0000)]
Don't simply give up when exceeding 80cols, choose an "ok" option.

This addresses llvm.org/PR14847.

We can now format something like:
int aaaaaaaaaaaaaaaaaaaaaaaaaaa =
    // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;

clang-format unavoidably exceeds the column limit, but does not just
flush everything into a single line. Moreover, it tries to minimize the
number of characters beyond the column limit.

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

11 years agoCorrectly format wrapped function call parameters in templated functions.
Daniel Jasper [Wed, 9 Jan 2013 09:50:48 +0000 (09:50 +0000)]
Correctly format wrapped function call parameters in templated functions.

This fixes llvm.org/PR14846.

Before:
template <typename T>
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
        int aaaaaaaaaaaaaaaaa);

After:
template <typename T>
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
    int aaaaaaaaaaaaaaaaa);

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

11 years agoFixes dump_ast_matchers to parse all matcher macros and updates the
Manuel Klimek [Wed, 9 Jan 2013 09:38:21 +0000 (09:38 +0000)]
Fixes dump_ast_matchers to parse all matcher macros and updates the
docs.

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

11 years agoAllow comments in the middle of statements to be on their own line.
Daniel Jasper [Wed, 9 Jan 2013 09:33:39 +0000 (09:33 +0000)]
Allow comments in the middle of statements to be on their own line.

This fixes llvm.org/PR14860.

Before, we messed up the format of:
if (DeclaratorInfo.isFunctionDeclarator() &&
    //getDeclSpecContextFromDeclaratorContext(Context) == DSC_top_level &&
    Tok.is(tok::semi) && NextToken().is(tok::l_brace)) {
}

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

11 years agoFix ObjC block declarations.
Daniel Jasper [Wed, 9 Jan 2013 08:36:49 +0000 (08:36 +0000)]
Fix ObjC block declarations.

Before: int ( ^ Block1) (int, int) = ^ (int i, int j)
After:  int (^Block1) (int, int) = ^(int i, int j)

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

11 years agoImprove formatting of conditional operators.
Daniel Jasper [Wed, 9 Jan 2013 07:06:56 +0000 (07:06 +0000)]
Improve formatting of conditional operators.

This addresses llvm.org/PR14864.

We used to completely mess this up and now format as:
Diag(NewFD->getLocation(),
     getLangOpts().MicrosoftExt ? diag::ext_function_specialization_in_class :
         diag::err_function_specialization_in_class)
    << NewFD->getDeclName();

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

11 years agoDon't mention -fno-diagnostics-print-source-range-info in manual.
Nico Weber [Wed, 9 Jan 2013 05:06:41 +0000 (05:06 +0000)]
Don't mention -fno-diagnostics-print-source-range-info in manual.

Clang doesn't understand it.

If someone wants to teach clang about that flag instead, please also add
support for -fno-diagnostics-parseable-fixits for consistency.

Until then, let the documentation match the current behavior.

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

11 years ago[ubsan] Make static check data non-const so it can be used for deduplication.
Will Dietz [Wed, 9 Jan 2013 03:39:41 +0000 (03:39 +0000)]
[ubsan] Make static check data non-const so it can be used for deduplication.

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

11 years agoMake sure clang puts tokens from different files on separate lines in "-E -P" mode...
Eli Friedman [Wed, 9 Jan 2013 03:16:42 +0000 (03:16 +0000)]
Make sure clang puts tokens from different files on separate lines in "-E -P" mode.  <rdar://problem/12774044>

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

11 years agoMake __has_include a bit more resilient in the presence of macros. <rdar://problem...
Eli Friedman [Wed, 9 Jan 2013 02:20:00 +0000 (02:20 +0000)]
Make __has_include a bit more resilient in the presence of macros.  <rdar://problem/12748859>.

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

11 years agoWhen name lookup for a redeclaration finds declarations that are known
Douglas Gregor [Wed, 9 Jan 2013 00:47:56 +0000 (00:47 +0000)]
When name lookup for a redeclaration finds declarations that are known
(because they are part of some module) but have not been made visible
(because they are in a submodule that wasn't imported), filter out
those declarations unless both the old declaration and the new
declaration have external linkage. When one or both has internal
linkage, there should be no conflict unless both are imported.

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

11 years agoput back diagnostics when flexible members are captured
Fariborz Jahanian [Wed, 9 Jan 2013 00:09:15 +0000 (00:09 +0000)]
put back diagnostics when flexible members are captured
in lambdas.

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

11 years agoRemoved extra "`" from ARC documentation.
Michael Gottesman [Tue, 8 Jan 2013 23:55:10 +0000 (23:55 +0000)]
Removed extra "`" from ARC documentation.

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

11 years ago[ms-inline asm] Add a test case for the offset operator where the operand is a
Chad Rosier [Tue, 8 Jan 2013 23:51:48 +0000 (23:51 +0000)]
[ms-inline asm] Add a test case for the offset operator where the operand is a
global variable.

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

11 years agoFix typo (again).
Fariborz Jahanian [Tue, 8 Jan 2013 23:48:48 +0000 (23:48 +0000)]
Fix typo (again).

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

11 years agoRemove lambda from my last patch.
Fariborz Jahanian [Tue, 8 Jan 2013 23:40:08 +0000 (23:40 +0000)]
Remove lambda from my last patch.

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

11 years agoFixes typo in comment.
Fariborz Jahanian [Tue, 8 Jan 2013 23:21:22 +0000 (23:21 +0000)]
Fixes typo in comment.

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

11 years agoobjectiveC blocks: It is impractical to capture
Fariborz Jahanian [Tue, 8 Jan 2013 23:17:51 +0000 (23:17 +0000)]
objectiveC blocks: It is impractical to capture
struct variables with flexiable array members in
blocks (and lambdas). Issue error instead of
crashing in IRGen. // rdar://12655829

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

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