]> granicus.if.org Git - clang/log
clang
9 years agoTrim some includes. NFC.
Hans Wennborg [Wed, 29 Oct 2014 22:13:46 +0000 (22:13 +0000)]
Trim some includes. NFC.

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

9 years agoFollow-up to r216619: use isCXXCLassMember() instead of trying to
Hans Wennborg [Wed, 29 Oct 2014 21:20:57 +0000 (21:20 +0000)]
Follow-up to r216619: use isCXXCLassMember() instead of trying to
check the context ourselves when selectively allowing late-added
dll attributes on unused free functions and variables (PR20746)

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

9 years agoRefactor libTooling to reduce required dependencies.
Daniel Jasper [Wed, 29 Oct 2014 18:55:09 +0000 (18:55 +0000)]
Refactor libTooling to reduce required dependencies.

This moves classes for storing and applying replacements to separate
files. These classes specifically are used by clang-format which doesn't
have any other dependencies on clangAST. Thereby, the size of
clang-format's binary can be cut roughly in half and its build time sped
up.

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

9 years agoEnable display of compiler diagnostics in clang-tidy.
Alexander Kornienko [Wed, 29 Oct 2014 17:28:51 +0000 (17:28 +0000)]
Enable display of compiler diagnostics in clang-tidy.

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

9 years agotest: generalise the test matching
Saleem Abdulrasool [Wed, 29 Oct 2014 16:53:16 +0000 (16:53 +0000)]
test: generalise the test matching

The value names may change in different builds, use pattern based tests.

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

9 years agoclang-format: [JS] Support more regex literals.
Daniel Jasper [Wed, 29 Oct 2014 16:51:38 +0000 (16:51 +0000)]
clang-format: [JS] Support more regex literals.

Previously a regex-literal containing "/*" would through clang-format
off, e.g.:
  var regex = /\/*$/;

Would lead to none of the following code to be formatted.

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

9 years agoCodeGen: add __readfsdword builtin
Saleem Abdulrasool [Wed, 29 Oct 2014 16:35:41 +0000 (16:35 +0000)]
CodeGen: add __readfsdword builtin

The Windows NT SDK uses __readfsdword and declares it as a compiler provided
builtin (#pragma intrinsic(__readfsword).  Because intrin.h is not referenced
by winnt.h, it is not possible to provide an out-of-line definition for the
intrinsic.  Provide a proper compiler builtin definition.

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

9 years agoFix warning in Altivec code when building with GCC 4.8.2 on Ubuntu 14.04.
Jay Foad [Wed, 29 Oct 2014 14:42:12 +0000 (14:42 +0000)]
Fix warning in Altivec code when building with GCC 4.8.2 on Ubuntu 14.04.

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

9 years agoPass aggregates on the stack without splitting in NVPTX.
Eli Bendersky [Wed, 29 Oct 2014 13:43:21 +0000 (13:43 +0000)]
Pass aggregates on the stack without splitting in NVPTX.

Following the NVVM IR specifications, arguments of aggregate type should be
passed on the stack without splitting (byval).

http://reviews.llvm.org/D6020

Patch by Jacques Pienaar.

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

9 years agoclang/lib/AST/Decl.cpp: Tweak isVLATypeCapturingAllowed() for -Asserts. [-Wunused...
NAKAMURA Takumi [Wed, 29 Oct 2014 13:27:44 +0000 (13:27 +0000)]
clang/lib/AST/Decl.cpp: Tweak isVLATypeCapturingAllowed() for -Asserts. [-Wunused-function]

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

9 years ago[PowerPC ABI] Bug 21398 - Consider C++ base classes in HA classification
Ulrich Weigand [Wed, 29 Oct 2014 13:23:20 +0000 (13:23 +0000)]
[PowerPC ABI] Bug 21398 - Consider C++ base classes in HA classification

As discussed in bug 21398, PowerPC ABI code needs to consider C++ base
classes when classifying a class as homogeneous aggregate (or not) for
ABI purposes.

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

9 years agoclang/test/CodeGen/captured-statements-nested.c: Tweak for -Asserts.
NAKAMURA Takumi [Wed, 29 Oct 2014 13:21:52 +0000 (13:21 +0000)]
clang/test/CodeGen/captured-statements-nested.c: Tweak for -Asserts.

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

9 years agoImproved capturing variable-length array types in CapturedStmt.
Alexey Bataev [Wed, 29 Oct 2014 12:21:55 +0000 (12:21 +0000)]
Improved capturing variable-length array types in CapturedStmt.
An updated implemnentation of VLA types capturing based on previously committed solution for Lambdas.
This version captures the whole VLA type instead of particular variables which are part of VLA size expression and allows to use previusly calculated size of VLA type in captured regions. Required for OpenMP.
Differential Revision: http://reviews.llvm.org/D5099

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

9 years agoUse enumerators instead of hardcoded integers when we decide if keyword is enabled.
Serge Pavlov [Wed, 29 Oct 2014 10:59:18 +0000 (10:59 +0000)]
Use enumerators instead of hardcoded integers when we decide if keyword is enabled.

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

9 years agoDon't capture DeclRefExpr::getNameInfo().getInfo(). It returns reference in temporary...
NAKAMURA Takumi [Wed, 29 Oct 2014 08:11:47 +0000 (08:11 +0000)]
Don't capture DeclRefExpr::getNameInfo().getInfo(). It returns reference in temporary object.

DeclarationNameInfo::getInfo() returns reference, but DeclRefExpr::getNameInfo() returns temporary DeclarationNameInfo().

It triggered a local crash for me.

  Failing Tests (1):
      Clang :: SemaTemplate/instantiate-overload-candidates.cpp

  Assertion failed!
  Program: bin\clang.EXE
  File: clang/lib/Basic/SourceManager.cpp, Line 822
  Expression: 0 && "Invalid SLocOffset or bad function choice"

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

9 years agoObjective-C modern rewriter. Patch to fix a rewriting bug
Fariborz Jahanian [Tue, 28 Oct 2014 23:46:58 +0000 (23:46 +0000)]
Objective-C modern rewriter. Patch to fix a rewriting bug
rewriting an Objective-C block. Patch by Ryan Govostes.
rdar://18799145

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

9 years agoThe dllimport.cpp test was gating some checks on #ifndef MSABI,
Hans Wennborg [Tue, 28 Oct 2014 22:15:55 +0000 (22:15 +0000)]
The dllimport.cpp test was gating some checks on #ifndef MSABI,
but MSABI was never defined in the test. It seems we are erroring
on code that we should be accepting when compiling for MSVC compatibility.

This should make the test less confusing until PR21406 is fixed.

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

9 years agoObjective-C remove an unused enumerator which causes
Fariborz Jahanian [Tue, 28 Oct 2014 20:21:33 +0000 (20:21 +0000)]
Objective-C remove an unused enumerator which causes
warning in a switch statement.

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

9 years agoclang-format: Improve && detection as binary operator.
Daniel Jasper [Tue, 28 Oct 2014 18:28:22 +0000 (18:28 +0000)]
clang-format: Improve && detection as binary operator.

Before:
  template <class T,
            class = typename ::std::enable_if<
                ::std::is_array<T>{}&& ::std::is_array<T>{}>::type>
  void F();

After:
  template <class T,
            class = typename ::std::enable_if<
                ::std::is_array<T>{} && ::std::is_array<T>{}>::type>
  void F();

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

9 years agoObjective-C. revert patch for rdar://17554063.
Fariborz Jahanian [Tue, 28 Oct 2014 18:28:16 +0000 (18:28 +0000)]
Objective-C. revert patch for rdar://17554063.

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

9 years agoclang-format: Fix test.
Daniel Jasper [Tue, 28 Oct 2014 18:18:02 +0000 (18:18 +0000)]
clang-format: Fix test.

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

9 years agoclang-format: Improve && detection as binary operators.
Daniel Jasper [Tue, 28 Oct 2014 18:11:52 +0000 (18:11 +0000)]
clang-format: Improve && detection as binary operators.

Before:
  template <class T, class = typename std::enable_if<std::is_integral<
                         T>::value &&(sizeof(T) > 1 || sizeof(T) < 8)>::type>
  void F();

After:
  template <class T, class = typename std::enable_if<
                         std::is_integral<T>::value &&
                         (sizeof(T) > 1 || sizeof(T) < 8)>::type>
  void F();

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

9 years agoActually remove this test entirely.
Fariborz Jahanian [Tue, 28 Oct 2014 17:32:36 +0000 (17:32 +0000)]
Actually remove this test entirely.

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

9 years ago[Objective-C]. revert r220740,r220727
Fariborz Jahanian [Tue, 28 Oct 2014 17:26:21 +0000 (17:26 +0000)]
[Objective-C]. revert r220740,r220727

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

9 years agoclang-format: Improve function declaration detection.
Daniel Jasper [Tue, 28 Oct 2014 17:06:04 +0000 (17:06 +0000)]
clang-format: Improve function declaration detection.

Before:
  ReturnType MACRO
      FunctionName() {}

After:
  ReturnType MACRO
  FunctionName() {}

This fixes llvm.org/PR21404.

I wonder what the motivation for that if-condition was. But as no test
breaks, ...

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

9 years agoPR17730: Add test that we don't crash on this testcase. (The bug is already fixed.)
Richard Smith [Tue, 28 Oct 2014 17:00:19 +0000 (17:00 +0000)]
PR17730: Add test that we don't crash on this testcase. (The bug is already fixed.)

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

9 years agoclang-format: Update generated documentation with new flag.
Daniel Jasper [Tue, 28 Oct 2014 16:56:37 +0000 (16:56 +0000)]
clang-format: Update generated documentation with new flag.

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

9 years agoPR21367: Don't accept rvalue references as an extension in C++98 mode if we're in...
Richard Smith [Tue, 28 Oct 2014 16:55:02 +0000 (16:55 +0000)]
PR21367: Don't accept rvalue references as an extension in C++98 mode if we're in a new-type-id or conversion-type-id, since those things can legitimately be followed by a binary && operator.

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

9 years agoclang-format: [ObjC] Add separate flag to control indentation in blocks
Daniel Jasper [Tue, 28 Oct 2014 16:53:38 +0000 (16:53 +0000)]
clang-format: [ObjC] Add separate flag to control indentation in blocks

Apparently, people are very much divided on what the "correct"
indentation is. So, best to give them a choice.

The new flag is called ObjCBlockIndentWidth and the default is now set
to the same value as IndentWidth for the pre-defined styles.

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

9 years agoExtend test to check that -D flags do not leak across module boundaries.
Richard Smith [Tue, 28 Oct 2014 16:30:57 +0000 (16:30 +0000)]
Extend test to check that -D flags do not leak across module boundaries.

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

9 years agoclang-format: Fix test after recent flag change.
Daniel Jasper [Tue, 28 Oct 2014 16:29:56 +0000 (16:29 +0000)]
clang-format: Fix test after recent flag change.

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

9 years ago[modules] Allow -I, -D, -W flags to change between building a module and
Richard Smith [Tue, 28 Oct 2014 16:24:08 +0000 (16:24 +0000)]
[modules] Allow -I, -D, -W flags to change between building a module and
explicitly using the resulting .pcm file. Unlike for an implicit module build,
we don't need nor want to require these flags to match between the module
and its users.

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

9 years agoclang-format: Don't put functions on a single line in Google's Java
Daniel Jasper [Tue, 28 Oct 2014 16:15:52 +0000 (16:15 +0000)]
clang-format: Don't put functions on a single line in Google's Java
style.

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

9 years agoAdd valueDecl() matcher.
Samuel Benzaquen [Tue, 28 Oct 2014 13:33:58 +0000 (13:33 +0000)]
Add valueDecl() matcher.

Summary: Add valueDecl() matcher.

Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D6005

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

9 years agoclang/test/Modules/explicit-build.cpp: Tweak to meet win32's backslash.
NAKAMURA Takumi [Tue, 28 Oct 2014 11:34:29 +0000 (11:34 +0000)]
clang/test/Modules/explicit-build.cpp: Tweak to meet win32's backslash.

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

9 years agoFix warning text: lower -> higher
Richard Trieu [Tue, 28 Oct 2014 04:37:34 +0000 (04:37 +0000)]
Fix warning text: lower -> higher

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

9 years agoDriver: remove a stray s that propagated in cross-windows
Saleem Abdulrasool [Tue, 28 Oct 2014 03:15:02 +0000 (03:15 +0000)]
Driver: remove a stray s that propagated in cross-windows

The option is '--allow-multiple-definition' not '--allow-multiple-definitions'.

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

9 years agoUpdate for LLVM API change.
Rafael Espindola [Tue, 28 Oct 2014 00:29:51 +0000 (00:29 +0000)]
Update for LLVM API change.

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

9 years agoImprove on the diagnostic in my last patch and change warning
Fariborz Jahanian [Mon, 27 Oct 2014 23:41:04 +0000 (23:41 +0000)]
Improve on the diagnostic in my last patch and change warning
to error. rdar://18768214.

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

9 years agoRemove unused variable.
Richard Smith [Mon, 27 Oct 2014 23:25:15 +0000 (23:25 +0000)]
Remove unused variable.

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

9 years agoUse the newer/simple API for passing a diagnostic handler to the IR linker.
Rafael Espindola [Mon, 27 Oct 2014 23:02:34 +0000 (23:02 +0000)]
Use the newer/simple API for passing a diagnostic handler to the IR linker.

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

9 years ago[modules] Load .pcm files specified by -fmodule-file lazily.
Richard Smith [Mon, 27 Oct 2014 23:01:16 +0000 (23:01 +0000)]
[modules] Load .pcm files specified by -fmodule-file lazily.

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

9 years agoObjective-C ARC [qoi]. Issue diagnostic if __bridge casting
Fariborz Jahanian [Mon, 27 Oct 2014 22:33:06 +0000 (22:33 +0000)]
Objective-C ARC [qoi]. Issue diagnostic if __bridge casting
to C type a collection literal. rdar://18768214

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

9 years agoFrontend: Don't include stdin in the dependency list for an object file
David Majnemer [Mon, 27 Oct 2014 22:31:50 +0000 (22:31 +0000)]
Frontend: Don't include stdin in the dependency list for an object file

GCC doesn't do this and it semes weird to include a file that we can't
open.

This fixes PR21362.

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

9 years agoTry to appease the C++ gods
Hans Wennborg [Mon, 27 Oct 2014 22:28:50 +0000 (22:28 +0000)]
Try to appease the C++ gods

Looks like some builds were not happy with the potentially-throwing move
constructor that was added in r220723, and reached for the implicitly
deleted copy constructor instead.

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

9 years agoGive TypoExprState a move constructor and assignment operator to appease MSVC build
Hans Wennborg [Mon, 27 Oct 2014 21:50:49 +0000 (21:50 +0000)]
Give TypoExprState a move constructor and assignment operator to appease MSVC build

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

9 years agoFix segfault in hasDeclContext for nodes that have no decl context.
Samuel Benzaquen [Mon, 27 Oct 2014 20:58:44 +0000 (20:58 +0000)]
Fix segfault in hasDeclContext for nodes that have no decl context.

Summary:
Some declarations do not have a declaration context, like TranslationUnitDecl.
Fix hasDeclContext() to not segfault on these nodes.

Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D6003

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

9 years agoFrontend: Define __EXCEPTIONS if -fexceptions is passed
David Majnemer [Mon, 27 Oct 2014 20:02:19 +0000 (20:02 +0000)]
Frontend: Define __EXCEPTIONS if -fexceptions is passed

GCC defines __EXCEPTIONS, regardless of language mode, if -fexceptions
is passed.  We should do the same.

This fixes PR21358.

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

9 years agoDo not insert asan paddings after fields that have flexible arrays.
Kostya Serebryany [Mon, 27 Oct 2014 19:34:10 +0000 (19:34 +0000)]
Do not insert asan paddings after fields that have flexible arrays.

Summary:
We should avoid a tail padding not only if the last field
has zero size but also if the last field is a struct with a flexible array.

If/when http://reviews.llvm.org/D5478 is committed,
this will also handle the case of structs with zero-sized arrays.

Reviewers: majnemer, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5924

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

9 years agoc++11 patch to issue warning on missing 'override' on
Fariborz Jahanian [Mon, 27 Oct 2014 19:11:51 +0000 (19:11 +0000)]
c++11 patch to issue warning on missing 'override' on
overriding methods. Patch review by Richard Smith.
rdar://18295240

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

9 years agoWire up LookupMemberExpr to use the new TypoExpr.
Kaelyn Takata [Mon, 27 Oct 2014 18:07:46 +0000 (18:07 +0000)]
Wire up LookupMemberExpr to use the new TypoExpr.

This includes adding the new TypoExpr-based lazy typo correction to
LookupMemberExprInRecord as an alternative to the existing eager typo
correction.

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

9 years agoAdd a callback for recovering using a typo correction.
Kaelyn Takata [Mon, 27 Oct 2014 18:07:42 +0000 (18:07 +0000)]
Add a callback for recovering using a typo correction.

Also keep track of the stack of Exprs visited during the tree transform
so the callback can be passed the parent of the TypoExpr.

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

9 years agoAdd simple way for a CorrectionCandidateCallback to reject exact
Kaelyn Takata [Mon, 27 Oct 2014 18:07:40 +0000 (18:07 +0000)]
Add simple way for a CorrectionCandidateCallback to reject exact
matches of the typo.

Also be more proactive about checking a correction's visibility so that
a correction requiring a module import can be distinguished from the
original typo even if it looks identical. Otherwise the correction will
be excluded and the diagnostic about needing the module import won't be
emitted.

Note that no change was made to checkCorrectionVisibility other than
moving where it is at in SemaLookup.cpp.

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

9 years agoStart adding the infrastructure for handling TypoExprs.
Kaelyn Takata [Mon, 27 Oct 2014 18:07:37 +0000 (18:07 +0000)]
Start adding the infrastructure for handling TypoExprs.

Part of the infrastructure is a map from a TypoExpr to the Sema-specific
state needed to correct it, along with helpers to ease dealing with the
state.

The the typo count is propagated up the stack of
ExpressionEvaluationContextRecords when one is popped off of to
avoid accidentally dropping TypoExprs on the floor. For example,
the attempted correction of g() in test/CXX/class/class.mem/p5-0x.cpp
happens with an ExpressionEvaluationContextRecord that is popped off
the stack prior to ActOnFinishFullExpr being called and the tree
transform for TypoExprs being run.

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

9 years agoHave TypoCorrectionConsumer remember the TypoCorrections it returned.
Kaelyn Takata [Mon, 27 Oct 2014 18:07:34 +0000 (18:07 +0000)]
Have TypoCorrectionConsumer remember the TypoCorrections it returned.

Two additional methods are provided: one to return the current
correction (the last correction returned by getNextCorrection), and one
to "reset" the state so that getNextCorrection will return the previous
corrections before returning any new corrections.

Also ensure that all TypoCorrections have valid source ranges.

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

9 years agoPass around CorrectionCandidateCallbacks as unique_ptrs so
Kaelyn Takata [Mon, 27 Oct 2014 18:07:29 +0000 (18:07 +0000)]
Pass around CorrectionCandidateCallbacks as unique_ptrs so
TypoCorrectionConsumer can keep the callback around as long as needed.

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

9 years agoAdd the initial TypoExpr AST node for delayed typo correction.
Kaelyn Takata [Mon, 27 Oct 2014 18:07:20 +0000 (18:07 +0000)]
Add the initial TypoExpr AST node for delayed typo correction.

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

9 years agoMove TypoCorrectionConsumer into a header.
Kaelyn Takata [Mon, 27 Oct 2014 18:07:13 +0000 (18:07 +0000)]
Move TypoCorrectionConsumer into a header.

This makes it available outside of SemaLookup.cpp, as
needed for the forthcoming TypoExpr AST node which will
keep a TypoCorrectionConsumer that provides the possible
typo corrections for that TypoExpr.

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

9 years agoclang-format: Don't break after very short return types.
Daniel Jasper [Mon, 27 Oct 2014 17:13:59 +0000 (17:13 +0000)]
clang-format: Don't break after very short return types.

Before:
  void
  SomeFunction(int parameter);

After:
  void SomeFunction(
      int parameter);

(Unless AlwaysBreakAfterDefinitionReturnType after type is set).

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

9 years agoclang-format: improve vim integration docs
Saleem Abdulrasool [Mon, 27 Oct 2014 17:13:33 +0000 (17:13 +0000)]
clang-format: improve vim integration docs

Improve the documentation for vim integration of clang-format.  Prefer the use
of <c-o> to do the normal mode command execution to avoid side-effects of the
escape and re-insertion (cursor movement).  Tweak the macros to use a double
return to avoid having to manually return control to the editor from the
subprocess.

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

9 years agoclang-format: Fix bad merging of lines in nested blocks.
Daniel Jasper [Mon, 27 Oct 2014 16:31:46 +0000 (16:31 +0000)]
clang-format: Fix bad merging of lines in nested blocks.

Before:
  SomeFunction([]() {
  #define A a
    return 43; });

After:
  SomeFunction([]() {
  #define A a
    return 43;
  });

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

9 years agoSpeed up clang-tidy when profiling in on.
Samuel Benzaquen [Mon, 27 Oct 2014 15:22:59 +0000 (15:22 +0000)]
Speed up clang-tidy when profiling in on.

Summary:
Speed up clang-tidy when profiling in on.
It makes profiling runs twice as fast by reusing the time samples between the
different actions.
It also joins together the sampling of different matchers of the same check.

Reviewers: alexfh

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D5972

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

9 years agoAllow thread sanitizer in clang driver on FreeBSD
Viktor Kutuzov [Mon, 27 Oct 2014 13:51:25 +0000 (13:51 +0000)]
Allow thread sanitizer in clang driver on FreeBSD
http://reviews.llvm.org/D5999

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

9 years agoclang-format: [Proto] Change formatting text-formatted options.
Daniel Jasper [Mon, 27 Oct 2014 13:25:59 +0000 (13:25 +0000)]
clang-format: [Proto] Change formatting text-formatted options.

Before:
  optional Type type = 1 [(mutate_options) = {vital : true
                                              abc : false}];

After:
  optional Type type = 1 [(mutate_options) = {
    vital : true
    abc : false
  }];

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

9 years agoPrune CRLF.
NAKAMURA Takumi [Mon, 27 Oct 2014 12:37:26 +0000 (12:37 +0000)]
Prune CRLF.

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

9 years agoRevert rL220675 due to failures on check-clang
Viktor Kutuzov [Mon, 27 Oct 2014 12:33:10 +0000 (12:33 +0000)]
Revert rL220675 due to failures on check-clang

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

9 years agoAllow thread sanitizer in clang driver on FreeBSD
Viktor Kutuzov [Mon, 27 Oct 2014 11:26:01 +0000 (11:26 +0000)]
Allow thread sanitizer in clang driver on FreeBSD
Differential Revision: http://reviews.llvm.org/D5994

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

9 years agoFix unicode chars into ascii in comment lines.
NAKAMURA Takumi [Mon, 27 Oct 2014 08:08:18 +0000 (08:08 +0000)]
Fix unicode chars into ascii in comment lines.

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

9 years agoFix 80-column and other odd formatting.
Eric Christopher [Sun, 26 Oct 2014 23:40:33 +0000 (23:40 +0000)]
Fix 80-column and other odd formatting.

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

9 years agoMake VFS and FileManager match the current MemoryBuffer API.
Benjamin Kramer [Sun, 26 Oct 2014 22:44:13 +0000 (22:44 +0000)]
Make VFS and FileManager match the current MemoryBuffer API.

This eliminates converting back and forth between the 3 formats and
gives us a more homogeneous interface.

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

9 years agoModuleMap.cpp: fix Windows build, take 2
Hans Wennborg [Sun, 26 Oct 2014 20:00:53 +0000 (20:00 +0000)]
ModuleMap.cpp: fix Windows build, take 2

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

9 years agoModuleMap.cpp: fix VS2012 build
Hans Wennborg [Sun, 26 Oct 2014 19:39:46 +0000 (19:39 +0000)]
ModuleMap.cpp: fix VS2012 build

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

9 years agoDelete unused method and clangAST dependency it required.
Daniel Jasper [Sun, 26 Oct 2014 14:26:55 +0000 (14:26 +0000)]
Delete unused method and clangAST dependency it required.

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

9 years agoModuleMap::addHeader(): Appease msc17.
NAKAMURA Takumi [Sun, 26 Oct 2014 13:12:35 +0000 (13:12 +0000)]
ModuleMap::addHeader(): Appease msc17.

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

9 years agoDriver: reduce search logic duplication
Saleem Abdulrasool [Sat, 25 Oct 2014 23:33:21 +0000 (23:33 +0000)]
Driver: reduce search logic duplication

Refactor the path search into a helper function to avoid duplicating the path
handling for the search.  NFC.

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

9 years agotest: attempt to make test more hermetic
Saleem Abdulrasool [Sat, 25 Oct 2014 20:49:12 +0000 (20:49 +0000)]
test: attempt to make test more hermetic

Add a fake linker in to a sysroot to use for testing the driver's tool
invocation.  Should make the test behave similarly on all platforms.  Addresses
review comments from Reid Kleckner from SVN r220546.

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

9 years agoDriver: assume that all architectures are supported for libstc++
Saleem Abdulrasool [Sat, 25 Oct 2014 20:48:35 +0000 (20:48 +0000)]
Driver: assume that all architectures are supported for libstc++

Rather than asserting that the target is unsupported, make a guess at what the
tree for a port would look like and use that for the search path.

Addresses review comments from Ried Kleckner for SVN r220547.

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

9 years agoLex: Fix an invalid access into a SmallString
David Majnemer [Sat, 25 Oct 2014 11:40:40 +0000 (11:40 +0000)]
Lex: Fix an invalid access into a SmallString

We would crash because we used operator[] to access past the end of a
SmallString.  This occured because our token had length zero.

Instead, form the pointer using .data() and arithmetic.  This is safe
because this forms a one-past-the-end pointer and it is only used to
compare with another one-past-the-end pointer.

This fixes PR21379.

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

9 years agoUpdate for LLVM api change.
Rafael Espindola [Sat, 25 Oct 2014 04:06:14 +0000 (04:06 +0000)]
Update for LLVM api change.

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

9 years agoMake this test a bit stricter by checking clang's output too.
Rafael Espindola [Sat, 25 Oct 2014 01:51:19 +0000 (01:51 +0000)]
Make this test a bit stricter by checking clang's output too.

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

9 years agoCodeGen: Don't form weak dllexport aliases
David Majnemer [Fri, 24 Oct 2014 22:05:27 +0000 (22:05 +0000)]
CodeGen: Don't form weak dllexport aliases

The MS linker cannot do anything interesting with these, it doesn't make
sense to emit them.

This fixes PR21373.

Differential Revision: http://reviews.llvm.org/D5986

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

9 years agotest: correct an overzealous search-and-replace
Saleem Abdulrasool [Fri, 24 Oct 2014 21:23:49 +0000 (21:23 +0000)]
test: correct an overzealous search-and-replace

The temporary initialized is referenced as %0, not as the auto-release pool.
Fixes R+A tests.

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

9 years agoCodeGen: correct materialize temporary aggregates in ARC mode
Saleem Abdulrasool [Fri, 24 Oct 2014 20:23:43 +0000 (20:23 +0000)]
CodeGen: correct materialize temporary aggregates in ARC mode

Avoid an assertion when materializing a lifetime type aggregate temporary.  When
performing CodeGen for ObjC++, we could generate a lifetime-only aggregate
temporary by using an initializer list (which is effectively an array).  We
would reach through the temporary expression, fishing out the inner expression.
If this expression was a lifetime expression, we would attempt to emit this as a
scalar.  This would eventually result in an assertion as the emission would
eventually assert that the expression being emitted has a scalar evaluation
kind.

Add a case to handle the aggregate expressions.  Use the EmitAggExpr to emit the
aggregate expression rather than the EmitScalarInit.

Addresses PR21347.

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

9 years ago[modules] Support combining 'textual' with 'private'.
Richard Smith [Fri, 24 Oct 2014 20:23:01 +0000 (20:23 +0000)]
[modules] Support combining 'textual' with 'private'.

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

9 years agoItanium ABI: Template template parameters are usable as substitutions
David Majnemer [Fri, 24 Oct 2014 20:22:57 +0000 (20:22 +0000)]
Itanium ABI: Template template parameters are usable as substitutions

Template template parameters weren't added to the list of substitutions.
This would make the substitution map contain inaccurate mappings,
leading to Clang violating the Itanium ABI and breaking compatibility
with GCC.

This fixes PR21351.

Differential Revision: http://reviews.llvm.org/D5959

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

9 years agoCodeGen: trivial conversion to range based loop
Saleem Abdulrasool [Fri, 24 Oct 2014 19:54:32 +0000 (19:54 +0000)]
CodeGen: trivial conversion to range based loop

Switch to a range-based for loop.  NFC.

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

9 years agotest: add -std=c++11
Saleem Abdulrasool [Fri, 24 Oct 2014 19:54:29 +0000 (19:54 +0000)]
test: add -std=c++11

This test uses C++11 features (r-value references) in ObjC++.  Add a -std=c++11
to silence a warning.  NFC.

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

9 years agoCodeGen: GLValue exprs in template parameters should have reference type
David Majnemer [Fri, 24 Oct 2014 19:49:04 +0000 (19:49 +0000)]
CodeGen: GLValue exprs in template parameters should have reference type

This fixes a corner-case where __uuidof as a template argument would
result in us trying to emit a GLValue as an RValue.  This would lead to
a crash down the road.

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

9 years agoFix windows-cross.c test on my machine
Reid Kleckner [Fri, 24 Oct 2014 17:55:29 +0000 (17:55 +0000)]
Fix windows-cross.c test on my machine

I suspect it will need a custom sysroot to pass reliably elsewhere.

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

9 years agoAdd frontend support for __vectorcall
Reid Kleckner [Fri, 24 Oct 2014 17:42:17 +0000 (17:42 +0000)]
Add frontend support for __vectorcall

Wire it through everywhere we have support for fastcall, essentially.

This allows us to parse the MSVC "14" CTP headers, but we will
miscompile them because LLVM doesn't support __vectorcall yet.

Reviewed By: Aaron Ballman

Differential Revision: http://reviews.llvm.org/D5808

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

9 years agoUse enumerators instead of hardcoded integers when processing macro names.
Serge Pavlov [Fri, 24 Oct 2014 17:31:32 +0000 (17:31 +0000)]
Use enumerators instead of hardcoded integers when processing macro names.

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

9 years ago[Modules] Free modules that failed signature verification.
Benjamin Kramer [Fri, 24 Oct 2014 16:31:42 +0000 (16:31 +0000)]
[Modules] Free modules that failed signature verification.

The control flow and ownership is weird enough so unique_ptr doesn't help here :(

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

9 years ago[mips] Mark aggregate arguments passed in registers with the inreg attribute
Daniel Sanders [Fri, 24 Oct 2014 15:30:16 +0000 (15:30 +0000)]
[mips] Mark aggregate arguments passed in registers with the inreg attribute

Summary:
This allows us to easily identify them in the backend which in turn allows us
to handle them correctly for big-endian targets (where they must be shifted
into the upper bits of the register).

Depends on D5961

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits, theraven

Differential Revision: http://reviews.llvm.org/D5962

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

9 years ago[mips] Promote all integral/enumeration types to the GPR width
Daniel Sanders [Fri, 24 Oct 2014 14:42:42 +0000 (14:42 +0000)]
[mips] Promote all integral/enumeration types to the GPR width

Summary:
Ensure all integral/enumeration types are appropriately annotated with
signext/zeroext. In particular, i32 now has these attributes when using the
N32/N64 ABI. This paves the way for accurately representing the way the
N32/N64 ABI's promotes integer arguments to i64.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits, theraven

Differential Revision: http://reviews.llvm.org/D5961

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

9 years agoFix initializing TypeOfTypeLoc
Olivier Goffart [Fri, 24 Oct 2014 13:52:55 +0000 (13:52 +0000)]
Fix initializing TypeOfTypeLoc

This fixes a crash in the RecursiveASTVisitor on such code
 __typeof__(struct F*) var[invalid];

The UnderlyingTInfo of a TypeOfTypeLoc was left uninitialized when
created from ASTContext::getTrivialTypeSourceInfo
This lead to a crash in RecursiveASTVisitor when trying to access it.

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

9 years agoASTMatchers: Peel off a layer of indirection from true matcher. NFC.
Benjamin Kramer [Fri, 24 Oct 2014 13:29:21 +0000 (13:29 +0000)]
ASTMatchers: Peel off a layer of indirection from true matcher. NFC.

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

9 years agoASTMatchers: for-rangify loops. No functionality change.
Benjamin Kramer [Fri, 24 Oct 2014 13:29:15 +0000 (13:29 +0000)]
ASTMatchers: for-rangify loops. No functionality change.

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

9 years agoAdd arguments() to CXXConstructExpr so the same interface as with CallExpr can be...
Benjamin Kramer [Fri, 24 Oct 2014 13:29:07 +0000 (13:29 +0000)]
Add arguments() to CXXConstructExpr so the same interface as with CallExpr can be used.

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

9 years agoReport when a function-try-block does not return a value on all control paths. Fixed...
Aaron Ballman [Fri, 24 Oct 2014 13:19:19 +0000 (13:19 +0000)]
Report when a function-try-block does not return a value on all control paths. Fixed PR14620.

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

9 years ago[Thumb] Clang thinks "char" is signed when using a thumb triple
Oliver Stannard [Fri, 24 Oct 2014 11:28:47 +0000 (11:28 +0000)]
[Thumb] Clang thinks "char" is signed when using a thumb triple

'char' is unsigned on all ARM and Thumb architectures. Clang gets this
right for ARM, and for thumb when using and arm triple and the -mthumb
option, but gets it wrong for thumb triples. This fixes that.

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