]> granicus.if.org Git - clang/log
clang
11 years agoFix clang-format bug in unwrapped-line merging.
Daniel Jasper [Tue, 14 May 2013 09:30:02 +0000 (09:30 +0000)]
Fix clang-format bug in unwrapped-line merging.

Before (in styles that allow it), clang-format would not merge an
if statement onto a single line, if only the second line was format
(e.g. in an editor integration):

if (a)
  return; // clang-format invoked on this line.

With this patch, this gets properly merged to:

if (a) return; // ...

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

11 years agoFirst revision of the dynamic ASTMatcher library.
Manuel Klimek [Tue, 14 May 2013 09:13:00 +0000 (09:13 +0000)]
First revision of the dynamic ASTMatcher library.

This library supports all the features of the compile-time based ASTMatcher
library, but allows the user to specify and construct the matchers at runtime.
It contains the following modules:
 - A variant type, to be used by the matcher factory.
 - A registry, where the matchers are indexed by name and have a factory method
   with a generic signature.
 - A simple matcher expression parser, that can be used to convert a matcher
   expression string into actual matchers that can be used with the AST at
   runtime.

Many features where omitted from this first revision to simplify this code
review. The main ideas are still represented in this change and it already has
support working use cases.
Things that are missing:
 - Support for polymorphic matchers. These requires supporting code in the
   registry, the marshallers and the variant type.
 - Support for numbers, char and bool arguments to the matchers. This requires
   supporting code in the parser and the variant type.
 - A command line program putting everything together and providing an already
   functional tool.

Patch by Samuel Benzaquen.

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

11 years agoImplement string literal breaking on unbreakable token sequences.
Manuel Klimek [Tue, 14 May 2013 09:04:24 +0000 (09:04 +0000)]
Implement string literal breaking on unbreakable token sequences.

This fixes indentation where there are for example multiple closing
parentheses after a string literal, and where those parentheses
run over the end of the line.

During testing this revealed a bug in the implementation of
breakProtrudingToken: we don't want to change the state if we didn't
actually do anything.

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

11 years agoUpdate clang-format emacs integration.
Daniel Jasper [Tue, 14 May 2013 08:48:24 +0000 (08:48 +0000)]
Update clang-format emacs integration.

- Remove free variables
- Add function clang-format-buffer, e.g. for before-save-hooks
- Wrap restoring windows in an unwind-protect

Patch by Stephen Gildea!

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

11 years agoAArch64: add test for updated __clear_cache definition
Tim Northover [Tue, 14 May 2013 08:37:13 +0000 (08:37 +0000)]
AArch64: add test for updated __clear_cache definition

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

11 years agoDon't format sizeof/alignof as function types.
Daniel Jasper [Tue, 14 May 2013 08:34:47 +0000 (08:34 +0000)]
Don't format sizeof/alignof as function types.

Before: A<sizeof (*x)> a;
After:  A<sizeof(*x)> a;

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

11 years agoAArch64: correct definition of __clear_cache
Tim Northover [Tue, 14 May 2013 08:26:14 +0000 (08:26 +0000)]
AArch64: correct definition of __clear_cache

According to libgcc document __clear_cache takes two char*
pointers. I suspect GCC's actual behaviour is more subtle than that,
but char* should clearly be preferred to void*.

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

11 years agoReplace EXPECT_EQ with EXPECT_FALSE to avoid gcc warning
Patrik Hagglund [Tue, 14 May 2013 07:53:53 +0000 (07:53 +0000)]
Replace EXPECT_EQ with EXPECT_FALSE to avoid gcc warning
[-Wconversion-null], introduced in r181326.

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

11 years agoSuppress bogus "use of undefined constexpr function" error if the function body
Richard Smith [Tue, 14 May 2013 05:18:44 +0000 (05:18 +0000)]
Suppress bogus "use of undefined constexpr function" error if the function body
was erroneous and got discarded.

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

11 years agoUse atomic instructions on linux thumb v7.
Rafael Espindola [Tue, 14 May 2013 00:44:24 +0000 (00:44 +0000)]
Use atomic instructions on linux thumb v7.

This matches gcc's behaviour. The patch also explicitly parses the version so
that this keeps working when we add support for v8.

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

11 years agoPR15956: Debug Info: Include the appropriate file location in types created due to...
David Blaikie [Tue, 14 May 2013 00:34:20 +0000 (00:34 +0000)]
PR15956: Debug Info: Include the appropriate file location in types created due to using declarations

We might benefit from API refactoring here (why pass in a value that's
derived from another parameter?) but this is the immediate issue.

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

11 years ago[analyzer] Refactor: address Jordan’s code review of r181738.
Anna Zaks [Mon, 13 May 2013 23:49:51 +0000 (23:49 +0000)]
[analyzer] Refactor: address Jordan’s code review of r181738.

(Modifying the checker to record that the values are no longer nil will be done separately.)

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

11 years ago[analyzer] Warn about nil elements/keys/values in array and dictionary literals.
Anna Zaks [Mon, 13 May 2013 21:48:20 +0000 (21:48 +0000)]
[analyzer] Warn about nil elements/keys/values in array and dictionary literals.

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

11 years agoAlign a multiline string literal with the first part.
Daniel Jasper [Mon, 13 May 2013 20:50:15 +0000 (20:50 +0000)]
Align a multiline string literal with the first part.

Before:
  #define A(X)          \
    "aaaaa" #X "bbbbbb" \
               "ccccc"

After:
  #define A(X)          \
    "aaaaa" #X "bbbbbb" \
    "ccccc"

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

11 years agoSuppress GCC warning for no return after covered switch, and remove some
Richard Smith [Mon, 13 May 2013 20:33:30 +0000 (20:33 +0000)]
Suppress GCC warning for no return after covered switch, and remove some
debugging code from an unreachable codepath.

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

11 years agoFix a wrong and confusing comment in CharUnits.h. Neither C nor C++ allows
Richard Smith [Mon, 13 May 2013 20:28:15 +0000 (20:28 +0000)]
Fix a wrong and confusing comment in CharUnits.h. Neither C nor C++ allows
bytes and character units to be different sizes.

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

11 years agoUse atomic instructions on ARM linux.
Rafael Espindola [Mon, 13 May 2013 20:09:47 +0000 (20:09 +0000)]
Use atomic instructions on ARM linux.

This is safe given how the pre-v6 atomic ops funcions in libgcc are
implemented.

This fixes pr15429.

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

11 years agoObjective-C error recovery. This patch makes a quick
Fariborz Jahanian [Mon, 13 May 2013 17:27:00 +0000 (17:27 +0000)]
Objective-C error recovery. This patch makes a quick
recovery form duplicate method definition error thus
preventing doc parsing to loop trying to find comment
for the invalid redefinition in a previous declaration.
// rdar://13836387

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

11 years agoFix test/CodeGenCXX/captured-statements.cpp on powerpc64
Ben Langmuir [Mon, 13 May 2013 14:45:11 +0000 (14:45 +0000)]
Fix test/CodeGenCXX/captured-statements.cpp on powerpc64

Generalize some attributes that differ on powerpc64 (i32 vs signext i32). Also
fix some copy-and-pasted code that didn't get updated properly.

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

11 years agoFix a gcc warning.
Rafael Espindola [Mon, 13 May 2013 14:05:53 +0000 (14:05 +0000)]
Fix a gcc warning.

In r181677 I removed this llvm_unreachable and it introduced a gcc
warning. Add it back.

Thanks to Patrik Hägglund for noticing it.

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

11 years agoA better version of r181699: use raw_string_ostream.str() instead of manually calling...
Alexander Kornienko [Mon, 13 May 2013 12:56:35 +0000 (12:56 +0000)]
A better version of r181699: use raw_string_ostream.str() instead of manually calling .flush().

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

11 years agoFix style according to post-commit review comments.
Manuel Klimek [Mon, 13 May 2013 12:53:04 +0000 (12:53 +0000)]
Fix style according to post-commit review comments.

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

11 years agoImplements brace breaking styles.
Manuel Klimek [Mon, 13 May 2013 12:51:40 +0000 (12:51 +0000)]
Implements brace breaking styles.

We now support "Linux" and "Stroustrup" brace breaking styles, which
gets us one step closer to support formatting WebKit, KDE & Linux code.

Linux brace breaking style:
namespace a
{
class A
{
  void f()
  {
    if (x) {
      f();
    } else {
      g();
    }
  }
}
}

Stroustrup brace breaking style:
namespace a {
class A {
  void f()
  {
    if (x) {
      f();
    } else {
      g();
    }
  }
}
}

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

11 years agoFixes [Bug 15960] YAMLTraits doesn't roundtrip on Windows.
Alexander Kornienko [Mon, 13 May 2013 12:41:08 +0000 (12:41 +0000)]
Fixes [Bug 15960] YAMLTraits doesn't roundtrip on Windows.
Thanks to Kim Gräsman for help!

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

11 years agoImplements UseTab for clang-format.
Manuel Klimek [Mon, 13 May 2013 09:22:11 +0000 (09:22 +0000)]
Implements UseTab for clang-format.

This is required for kernel linux kernel style formatting.

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

11 years agoFurther improve optimization for nested calls.
Daniel Jasper [Mon, 13 May 2013 09:19:24 +0000 (09:19 +0000)]
Further improve optimization for nested calls.

Fake parentheses (i.e. emulated parentheses used to correctly handle
binary expressions) used to prevent the optimization implemented in
r180264.

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

11 years agoImplements IndentWidth.
Manuel Klimek [Mon, 13 May 2013 08:42:42 +0000 (08:42 +0000)]
Implements IndentWidth.

This is required for various styles that are for example based on
8-indent.

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

11 years agoAssume macros to contain declarations.
Daniel Jasper [Mon, 13 May 2013 07:14:40 +0000 (07:14 +0000)]
Assume macros to contain declarations.

This seems to be the vastly more common case. If we find enough
examples to the contrary, we can make it smarter.

Before: #define MACRO void f(int * a)
After:  #define MACRO void f(int *a)

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

11 years agoDebug Info: PR14992: Support values for non-type template parameters of function...
David Blaikie [Mon, 13 May 2013 06:57:50 +0000 (06:57 +0000)]
Debug Info: PR14992: Support values for non-type template parameters of function type

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

11 years agoOpenMP threadprivate with qualified names.
Alexey Bataev [Mon, 13 May 2013 04:18:18 +0000 (04:18 +0000)]
OpenMP threadprivate with qualified names.

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

11 years agoUpdate for LLVM interface change in r181680.
Rafael Espindola [Mon, 13 May 2013 01:24:18 +0000 (01:24 +0000)]
Update for LLVM interface change in r181680.

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

11 years agoAdd missing triple to CodeGen test.
Richard Smith [Mon, 13 May 2013 00:29:57 +0000 (00:29 +0000)]
Add missing triple to CodeGen test.

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

11 years agoCleanup handling of UniqueExternalLinkage.
Rafael Espindola [Mon, 13 May 2013 00:12:11 +0000 (00:12 +0000)]
Cleanup handling of UniqueExternalLinkage.

This patch renames getLinkage to getLinkageInternal. Only code that
needs to handle UniqueExternalLinkage specially should call this.

Linkage, as defined in the c++ standard, is provided by
getFormalLinkage. It maps UniqueExternalLinkage to ExternalLinkage.

Most places in the compiler actually want isExternallyVisible, which
handles UniqueExternalLinkage as internal.

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

11 years agoDowngrade C++14 "Clarifying memory allocation". We perform non-conforming
Richard Smith [Sun, 12 May 2013 23:39:32 +0000 (23:39 +0000)]
Downgrade C++14 "Clarifying memory allocation". We perform non-conforming
optimizations -- in particular, globalopt will remove calls to ::operator
new(size_t) that did not come from new-expressions.

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

11 years agoFix stack overflow in linkage computation when a function with a deduced return
Richard Smith [Sun, 12 May 2013 23:17:59 +0000 (23:17 +0000)]
Fix stack overflow in linkage computation when a function with a deduced return
type returns a lambda defined within itself. The computation of linkage for the
function looked at the linkage of the lambda, and vice versa.

This is solved by not checking whether an 'auto' in a function return type
deduces to a type with unique external linkage. We don't need this check,
because the type deduced for 'auto' doesn't affect whether two
otherwise-identical declarations would name different functions, so we don't
need to give an ostensibly external-linkage function internal linkage for this
reason. (We also don't need unique-external linkage in C++11 onwards at all,
but that's not implemented yet.)

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

11 years agoDebug Info: Comment changes in r181393 by request of echristo
David Blaikie [Sun, 12 May 2013 18:05:52 +0000 (18:05 +0000)]
Debug Info: Comment changes in r181393 by request of echristo

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

11 years agoC++1y: support for 'switch' statements in constexpr functions. This is somewhat
Richard Smith [Sun, 12 May 2013 17:32:42 +0000 (17:32 +0000)]
C++1y: support for 'switch' statements in constexpr functions. This is somewhat
inefficient; we perform a linear scan of switch labels to find the one matching
the condition, and then walk the body looking for that label. Both parts should
be straightforward to optimize.

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

11 years agoC++1y: provide full 'auto' return type deduction for lambda expressions. This
Richard Smith [Sun, 12 May 2013 03:09:35 +0000 (03:09 +0000)]
C++1y: provide full 'auto' return type deduction for lambda expressions. This
completes the implementation of N3638.

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

11 years agoCodeGen: Refactor SetLLVMFunctionAttributesForDefinition to use an AttrBuilder.
Benjamin Kramer [Sat, 11 May 2013 12:45:37 +0000 (12:45 +0000)]
CodeGen: Refactor SetLLVMFunctionAttributesForDefinition to use an AttrBuilder.

Adding attributes to a uniqued set has become expensive, don't do it more often
than necessary. No functionality change.

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

11 years ago[Mips] Add -mldc1-sdc1 / -mno-ldc1-sdc1 command line options.
Simon Atanasyan [Sat, 11 May 2013 06:33:44 +0000 (06:33 +0000)]
[Mips] Add -mldc1-sdc1 / -mno-ldc1-sdc1 command line options.

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

11 years agoC++1y deduced return types: when we deduce a return type for a function which
Richard Smith [Sat, 11 May 2013 05:45:24 +0000 (05:45 +0000)]
C++1y deduced return types: when we deduce a return type for a function which
we loaded from PCH, if we're building another PCH, create an update record to
patch the return type of the earlier declaration.

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

11 years agoDebug Info: correct comment
David Blaikie [Fri, 10 May 2013 23:36:06 +0000 (23:36 +0000)]
Debug Info: correct comment

Eric's code review feedback to r181644

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

11 years agoDebug Info: Silently accept template argument packs
David Blaikie [Fri, 10 May 2013 22:53:25 +0000 (22:53 +0000)]
Debug Info: Silently accept template argument packs

We could support the GCC extension DW_TAG_GNU_template_parameter_pack if
we're feeling adventurous, at some point - but I don't think GDB's doing
anything useful with it yet anyway.

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

11 years ago[Modules] Make r180934 more efficient by only loading top-level module maps in system...
Douglas Gregor [Fri, 10 May 2013 22:52:27 +0000 (22:52 +0000)]
[Modules] Make r180934 more efficient by only loading top-level module maps in system header directories.

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

11 years ago[Modules] When things go horribly wrong when reading a module, point at the module...
Douglas Gregor [Fri, 10 May 2013 22:15:13 +0000 (22:15 +0000)]
[Modules] When things go horribly wrong when reading a module, point at the module cache.

Sometimes people hack on their system headers. In such cases, they'll
need to delete their module cache, but may not know where it is. Add a
note to show them where it is.

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

11 years ago[Modules] Extend Darwin hack to include the modification time of SystemVersion.plist.
Douglas Gregor [Fri, 10 May 2013 21:54:08 +0000 (21:54 +0000)]
[Modules] Extend Darwin hack to include the modification time of SystemVersion.plist.

Fixes <rdar://problem/13856838>.

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

11 years agoPR14992: Debug Info: Support more non-type template parameters
David Blaikie [Fri, 10 May 2013 21:53:14 +0000 (21:53 +0000)]
PR14992: Debug Info: Support more non-type template parameters

* Provide DW_TAG_template_value_parameter for pointers, function
  pointers, member pointers, and member function pointers (still missing
  support for template template parameters which GCC encodes as a
  DW_TAG_GNU_template_template_param)
* Provide values for all but the (member & non-member) function pointer case.
  Simple constant integer values for member pointers (offset within the
  object) and address for the value pointer case. GCC doesn't provide a
  value for the member function pointer case so I'm not sure how, if at
  all, GDB supports encoding that. & non-member function pointers should
  follow shortly in a subsequent patch.
* Null pointer value encodings of all of these types, including
  correctly encoding null data member pointers as -1.

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

11 years agoObjC debug info: Substitute the class type for methods that return
Adrian Prantl [Fri, 10 May 2013 21:08:31 +0000 (21:08 +0000)]
ObjC debug info: Substitute the class type for methods that return
a related type (e.g., if they use the instancetype keyword).

rdar://problem/13359718

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

11 years agoAvoid patching storage class for block scope thread_local variables.
Enea Zaffanella [Fri, 10 May 2013 20:34:44 +0000 (20:34 +0000)]
Avoid patching storage class for block scope thread_local variables.

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

11 years agoPR15966: don't get confused by a complex integer -> complex integer conversion
Richard Smith [Fri, 10 May 2013 20:29:50 +0000 (20:29 +0000)]
PR15966: don't get confused by a complex integer -> complex integer conversion
and misclassify it as a complex-real conversion.

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

11 years agoReformat clang-format help strings, filter out irrelevant options.
Alexander Kornienko [Fri, 10 May 2013 18:12:00 +0000 (18:12 +0000)]
Reformat clang-format help strings, filter out irrelevant options.

Summary: +updated ClangFormat.rst

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D780

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

11 years ago[analyzer] Assume [NSNull null] does not return nil.
Anna Zaks [Fri, 10 May 2013 18:04:46 +0000 (18:04 +0000)]
[analyzer] Assume [NSNull null] does not return nil.

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

11 years ago[analyzer] Do not check if sys/queue.h file is a system header.
Anna Zaks [Fri, 10 May 2013 18:04:43 +0000 (18:04 +0000)]
[analyzer] Do not check if sys/queue.h file is a system header.

In most cases it is, by just looking at the name. Also, this check prevents the heuristic from working in strange user settings.
radar://13839692

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

11 years agoAllocate memory for the new number of subexpressions. Fixup for r181572
Dmitri Gribenko [Fri, 10 May 2013 17:30:13 +0000 (17:30 +0000)]
Allocate memory for the new number of subexpressions.  Fixup for r181572

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

11 years ago[analyzer] Indirect invalidation counts as an escape for leak checkers.
Jordan Rose [Fri, 10 May 2013 17:07:16 +0000 (17:07 +0000)]
[analyzer] Indirect invalidation counts as an escape for leak checkers.

Consider this example:

  char *p = malloc(sizeof(char));
  systemFunction(&p);
  free(p);

In this case, when we call systemFunction, we know (because it's a system
function) that it won't free 'p'. However, we /don't/ know whether or not
it will /change/ 'p', so the analyzer is forced to invalidate 'p', wiping
out any bindings it contains. But now the malloc'd region looks like a
leak, since there are no more bindings pointing to it, and we'll get a
spurious leak warning.

The fix for this is to notice when something is becoming inaccessible due
to invalidation (i.e. an imperfect model, as opposed to being explicitly
overwritten) and stop tracking it at that point. Currently, the best way
to determine this for a call is the "indirect escape" pointer-escape kind.

In practice, all the patch does is take the "system functions don't free
memory" special case and limit it to direct parameters, i.e. just the
arguments to a call and not other regions accessible to them. This is a
conservative change that should only cause us to escape regions more
eagerly, which means fewer leak warnings.

This isn't perfect for several reasons, the main one being that this
example is treated the same as the one above:

  char **p = malloc(sizeof(char *));
  systemFunction(p + 1);
  // leak

Currently, "addresses accessible by offsets of the starting region" and
"addresses accessible through bindings of the starting region" are both
considered "indirect" regions, hence this uniform treatment.

Another issue is our longstanding problem of not distinguishing const and
non-const bindings; if in the first example systemFunction's parameter were
a char * const *, we should know that the function will not overwrite 'p',
and thus we can safely report the leak.

<rdar://problem/13758386>

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

11 years agoCodegen tests for captured statements with templates
Wei Pan [Fri, 10 May 2013 14:15:18 +0000 (14:15 +0000)]
Codegen tests for captured statements with templates

Differential-revision: llvm-reviews.chandlerc.com/D778

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

11 years agoWhen breaking at function calls, indent from function name.
Daniel Jasper [Fri, 10 May 2013 13:37:16 +0000 (13:37 +0000)]
When breaking at function calls, indent from function name.

Otherwise (when indenting from the wrapped -> or .), this looks
like a confusing indent.

Before:
aaaaaaa        //
    .aaaaaaa( //
        aaaaaaa);
After:
aaaaaaa        //
    .aaaaaaa( //
         aaaaaaa);

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

11 years agoArrayRef'ize Sema::FindAllocationFunctions
Dmitri Gribenko [Fri, 10 May 2013 13:22:23 +0000 (13:22 +0000)]
ArrayRef'ize Sema::FindAllocationFunctions

Patch by Robert Wilhelm.

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

11 years agoUpdated clang-format help messages for -offset and -length
Alexander Kornienko [Fri, 10 May 2013 13:18:17 +0000 (13:18 +0000)]
Updated clang-format help messages for -offset and -length

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

11 years agoArrayRef'ize GenericSelectionExpr
Dmitri Gribenko [Fri, 10 May 2013 13:06:58 +0000 (13:06 +0000)]
ArrayRef'ize GenericSelectionExpr

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

11 years agoMinor clarifications in help messages and a comment.
Alexander Kornienko [Fri, 10 May 2013 13:04:20 +0000 (13:04 +0000)]
Minor clarifications in help messages and a comment.

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

11 years agoAlways format entire macro definitions.
Daniel Jasper [Fri, 10 May 2013 13:00:49 +0000 (13:00 +0000)]
Always format entire macro definitions.

Thereby, the macro is consistently formatted (including the trailing
escaped newlines) even if clang-format is invoked only on single lines
of the macro.

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

11 years agoConfig file support for clang-format, part 2.
Alexander Kornienko [Fri, 10 May 2013 11:56:10 +0000 (11:56 +0000)]
Config file support for clang-format, part 2.

Summary:
Adds actual config file reading to the clang-format utility.
Configuration file name is .clang-format. It is looked up for each input file
in its parent directories starting from immediate one. First found .clang-format
file is used. When using standard input, .clang-format is searched starting from
the current directory.
Added -dump-config option to easily create configuration files.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits, jordan_rose, kimgr
Differential Revision: http://llvm-reviews.chandlerc.com/D758

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

11 years agoAdd caseStmt(), defaultStmt(), eachCase() and hasCaseConstant() matchers.
Peter Collingbourne [Fri, 10 May 2013 11:52:02 +0000 (11:52 +0000)]
Add caseStmt(), defaultStmt(), eachCase() and hasCaseConstant() matchers.

Differential Revision: http://llvm-reviews.chandlerc.com/D744

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

11 years agoAdd support for __wchar_t in -fms-extensions mode.
Hans Wennborg [Fri, 10 May 2013 10:08:40 +0000 (10:08 +0000)]
Add support for __wchar_t in -fms-extensions mode.

MSVC provides __wchar_t. This is the same as the built-in wchar_t type
from C++, but it is also available with -fno-wchar and in C.

The commit changes ASTContext to have two different types for this:

  - WCharTy is the built-in type used for wchar_t in C++ and __wchar_t.

  - WideCharTy is the type of a wide character literal. In C++ this is
    the same as WCharTy, and in C  it is an integer type compatible with
    the type in <stddef.h>.

This fixes PR15815.

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

11 years agoFix bug when formatting overloaded operators.
Daniel Jasper [Fri, 10 May 2013 07:59:58 +0000 (07:59 +0000)]
Fix bug when formatting overloaded operators.

Before, the actual operator of an overloaded operator declaration was
handled as a binary operator an thus, clang-format could not find valid
formattings for many examples, e.g.:

template <typename AAAAAAA, typename BBBBBBB>
AAAAAAA operator/(const AAAAAAA &a, BBBBBBB &b);

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

11 years agoC++1y auto return type: when a function contains no 'return' statements at all,
Richard Smith [Fri, 10 May 2013 04:31:10 +0000 (04:31 +0000)]
C++1y auto return type: when a function contains no 'return' statements at all,
substitute 'void' into the return type rather than replacing it with 'void', so
that we maintain the 'auto' type sugar.

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

11 years agoTypo and misc comment fix.
Richard Smith [Fri, 10 May 2013 02:36:35 +0000 (02:36 +0000)]
Typo and misc comment fix.

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

11 years ago[libclang] When parsing with CXTranslationUnit_ForSerialization, make sure to install...
Argyrios Kyrtzidis [Fri, 10 May 2013 01:28:51 +0000 (01:28 +0000)]
[libclang] When parsing with CXTranslationUnit_ForSerialization, make sure to install the ASTWriter that we create as an ASTMutationListener.

Fixes rdar://13833268

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

11 years agoRemove redundant variable
Dmitri Gribenko [Fri, 10 May 2013 01:14:26 +0000 (01:14 +0000)]
Remove redundant variable

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

11 years agoArrayRef'ize ShuffleVectorExpr::setExprs
Dmitri Gribenko [Fri, 10 May 2013 00:43:44 +0000 (00:43 +0000)]
ArrayRef'ize ShuffleVectorExpr::setExprs

But ShuffleVectorExpr should be tail-allocating the storage for expressions.

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

11 years agoArrayRef'ize Sema::CheckMessageArgumentTypes
Dmitri Gribenko [Fri, 10 May 2013 00:27:15 +0000 (00:27 +0000)]
ArrayRef'ize Sema::CheckMessageArgumentTypes

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

11 years agoArrayRef'ize Sema::FindAllocationOverload
Dmitri Gribenko [Fri, 10 May 2013 00:20:06 +0000 (00:20 +0000)]
ArrayRef'ize Sema::FindAllocationOverload

Now tests should pass.  The previous error was caused by a misplaced backing
array for MutableArrayRef that I introduced.

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

11 years agoRevert my r181563, breaks tests on buildbots
Dmitri Gribenko [Fri, 10 May 2013 00:11:18 +0000 (00:11 +0000)]
Revert my r181563, breaks tests on buildbots

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

11 years agoArrayRef'ize Sema::ActOnMemInitializer
Dmitri Gribenko [Thu, 9 May 2013 23:51:52 +0000 (23:51 +0000)]
ArrayRef'ize Sema::ActOnMemInitializer

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

11 years agoArrayRef'ize Sema::FindAllocationOverload
Dmitri Gribenko [Thu, 9 May 2013 23:45:53 +0000 (23:45 +0000)]
ArrayRef'ize Sema::FindAllocationOverload

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

11 years agoArrayRef'ize Sema::BuildCallToObjectOfClassType
Dmitri Gribenko [Thu, 9 May 2013 23:32:58 +0000 (23:32 +0000)]
ArrayRef'ize Sema::BuildCallToObjectOfClassType

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

11 years agoDebug Info: Fix a problem that resulted in missing DW_AT_specifications
Adrian Prantl [Thu, 9 May 2013 23:16:27 +0000 (23:16 +0000)]
Debug Info: Fix a problem that resulted in missing DW_AT_specifications
for C++ constructors.

If the DIType for a class was generated by
CGDebugInfo::createContextChain(), the cache contains only a
limited DIType wihtout any declarations. Since EmitFunctionStart()
needs to find the canonical declaration for each method, we
construct the complete type before emitting any method.

rdar://problem/13116508

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

11 years agoRemove dependence on system headers from this test, to try to make the Windows bots...
Richard Smith [Thu, 9 May 2013 22:45:27 +0000 (22:45 +0000)]
Remove dependence on system headers from this test, to try to make the Windows bots happier.

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

11 years agoDebug Info: include address-of ('&') operator and qualified names in template argumen...
David Blaikie [Thu, 9 May 2013 22:43:45 +0000 (22:43 +0000)]
Debug Info: include address-of ('&') operator and qualified names in template argument lists

This fixes several (7 out of 16) cases of PR14492 in the GDB 7.5 test
suite. It seems GDB was bailing out whenever it had even the slightest
problem with the template argument list (& I assume it didn't like
seeing template value parameters that were just simple names - perhaps
assuming that lone names must be types, not values)

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

11 years agoFix some test cases I broke in r181552
David Blaikie [Thu, 9 May 2013 22:11:34 +0000 (22:11 +0000)]
Fix some test cases I broke in r181552

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

11 years agoC++1y n3648: parse and reject init-captures for now.
Richard Smith [Thu, 9 May 2013 21:36:41 +0000 (21:36 +0000)]
C++1y n3648: parse and reject init-captures for now.

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

11 years agoDebugInfo: Simply & constrain test(s) for PR9600/PR9608
David Blaikie [Thu, 9 May 2013 21:32:04 +0000 (21:32 +0000)]
DebugInfo: Simply & constrain test(s) for PR9600/PR9608

Both these tests were ultimately fixed by the check for
"isIncompleteType" & neither test case was really reduced to a minimal
form. On doing so it becomes apparent that the problem wasn't specific
to templates at all, so I've moved the test case to a more appropriate
test file and added FileCheck verification to it (to show the forward
declaration of the array element type as well as the array alignment and
size being 0 since it cannot be computed). That's about as far down this
rabbithole as I'm willing to go today, so the rest of the un-FileChecked
tests in test/CodeGenCXX/debug-info.cpp will have to go another day
without actually testing anything other than the fact that they don't
crash.

& improve the actually interesting test case in
test/CodeGenCXX/debug-info-templates.cpp which was my original goal (in
preparation for expanding it/fixing some related bugs in non-type
template parameters)

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

11 years agoDocumentation warning: \param, not \parm
Dmitri Gribenko [Thu, 9 May 2013 21:15:22 +0000 (21:15 +0000)]
Documentation warning: \param, not \parm

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

11 years agoAdd pragma-comment.c test case for r181426 that I forgot to add
Reid Kleckner [Thu, 9 May 2013 21:10:06 +0000 (21:10 +0000)]
Add pragma-comment.c test case for r181426 that I forgot to add

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

11 years agoArrayRef'ize some SemaOverload methods
Dmitri Gribenko [Thu, 9 May 2013 21:02:07 +0000 (21:02 +0000)]
ArrayRef'ize some SemaOverload methods

Patch by Robert Wilhelm.

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

11 years ago[ms-cxxabi] Implement member pointer conversions
Reid Kleckner [Thu, 9 May 2013 21:01:17 +0000 (21:01 +0000)]
[ms-cxxabi] Implement member pointer conversions

Summary:
This only supports converting along non-virtual inheritance paths by
changing the field offset or the non-virtual base adjustment.

This implements three kinds of conversions:
- codegen for Value conversions
- Constant emission for APValue
- Constant folding for CastExprs

In almost all constant initialization settings
EmitMemberPointer(APValue) is called, except when the expression
contains a reinterpret cast.

reinterpret casts end up being a big corner case because the null value
changes between different kinds of member pointers.

Reviewers: rsmith

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D741

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

11 years agoDebug Info: Remove unnecessary check for dependent array types
David Blaikie [Thu, 9 May 2013 20:48:12 +0000 (20:48 +0000)]
Debug Info: Remove unnecessary check for dependent array types

This was added, untested (though the relevant crash was tested), in
r128725/PR9600. Removing it doesn't cause failures & nothing I can
imagine could cause this check to ever return 'true' (we should never be
dealing with dependent types here). The subsequent change to check
"isIncompleteType" (r128855/PR9608) makes a lot more sense.

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

11 years agoFix captured statements codegen test on ARM
Ben Langmuir [Thu, 9 May 2013 20:42:43 +0000 (20:42 +0000)]
Fix captured statements codegen test on ARM

The return type of the destructor may vary between platforms, so stop
inadvertently testing it.

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

11 years agoCodeGen for CapturedStmts
Ben Langmuir [Thu, 9 May 2013 19:17:11 +0000 (19:17 +0000)]
CodeGen for CapturedStmts

EmitCapturedStmt creates a captured struct containing all of the captured
variables, and then emits a call to the outlined function.  This is similar in
principle to EmitBlockLiteral.

GenerateCapturedFunction actually produces the outlined function.  It is based
on GenerateBlockFunction, but is much simpler.  The function type is determined
by the parameters that are in the CapturedDecl.

Some changes have been added to this patch that were reviewed as part of the
serialization patch and moving the parameters to the captured decl.

Differential Revision: http://llvm-reviews.chandlerc.com/D640

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

11 years agoSwitch C++1y paper links back to the canonical location at open-std.org now that...
Richard Smith [Thu, 9 May 2013 18:53:17 +0000 (18:53 +0000)]
Switch C++1y paper links back to the canonical location at open-std.org now that the post-Bristol mailing has shipped.

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

11 years agoAdd testcase missed from r181527.
Richard Smith [Thu, 9 May 2013 18:33:50 +0000 (18:33 +0000)]
Add testcase missed from r181527.

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

11 years agoFix the return type of the complex creal functions. Patch by YunZhong Gao, modified...
Richard Smith [Thu, 9 May 2013 17:41:19 +0000 (17:41 +0000)]
Fix the return type of the complex creal functions. Patch by YunZhong Gao, modified to use _Static_assert and to check __STDC_HOSTED__ by me.

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

11 years agoRemove trailing whitespace
David Blaikie [Thu, 9 May 2013 17:29:54 +0000 (17:29 +0000)]
Remove trailing whitespace

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

11 years ago[doc parsing]: make single character command impostures
Fariborz Jahanian [Thu, 9 May 2013 17:18:52 +0000 (17:18 +0000)]
[doc parsing]: make single character command impostures
warn in pedantic mode.

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

11 years agoAdding isConst() ASTMatcher for CXXMethodDecl nodes
Edwin Vane [Thu, 9 May 2013 17:00:17 +0000 (17:00 +0000)]
Adding isConst() ASTMatcher for CXXMethodDecl nodes

Updated reference and unit tests.

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

11 years ago[doc parsing]: So, in this patch, single character
Fariborz Jahanian [Thu, 9 May 2013 16:44:02 +0000 (16:44 +0000)]
[doc parsing]: So, in this patch, single character
'commands' will not go through typo fixit logic,
preserving the old behavior (no typo, no diagnostics).
// rdar://12381408

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

11 years agoUpdating LibASTMatchersReference to include namespaceDecl()
Edwin Vane [Thu, 9 May 2013 16:42:37 +0000 (16:42 +0000)]
Updating LibASTMatchersReference to include namespaceDecl()

The namespaceDecl() ASTMatcher was added in r179027.

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

11 years ago[doc parsing]: don't attempt to fix single character
Fariborz Jahanian [Thu, 9 May 2013 16:22:31 +0000 (16:22 +0000)]
[doc parsing]: don't attempt to fix single character
commands (\t \n are common). \\ rdar://12381408

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

11 years agoxopintrin.h: Add wrappers for all flavors of _mm_com.
Benjamin Kramer [Thu, 9 May 2013 15:07:46 +0000 (15:07 +0000)]
xopintrin.h: Add wrappers for all flavors of _mm_com.

GCC defines only the wrappers, MSVC defines both, we define both now too.
PR15844.

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