r272454 - Revert "Strip Android version when looking up toolchain paths."

2016-06-10 Thread Chandler Carruth via cfe-commits
Author: chandlerc
Date: Fri Jun 10 23:57:29 2016
New Revision: 272454

URL: http://llvm.org/viewvc/llvm-project?rev=272454=rev
Log:
Revert "Strip Android version when looking up toolchain paths."

This reverts commit r272413. The tests here have been failing on several
different build bots for over 10 hours.

Removed:

cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld

cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld.exe
cfe/trunk/test/Driver/android-triple-version.c
Modified:
cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=272454=272453=272454=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Jun 10 23:57:29 2016
@@ -2343,15 +2343,7 @@ void Driver::generatePrefixedToolNames(
 const char *Tool, const ToolChain ,
 SmallVectorImpl ) const {
   // FIXME: Needs a better variable than DefaultTargetTriple
-  StringRef Triple = DefaultTargetTriple;
-
-  // On Android, the target triple can include a version number that needs to
-  // be stripped.
-  if (TC.getTriple().isAndroid()) {
-Triple = Triple.rtrim("0123456789");
-  }
-
-  Names.emplace_back((Triple + "-" + Tool).str());
+  Names.emplace_back(DefaultTargetTriple + "-" + Tool);
   Names.emplace_back(Tool);
 
   // Allow the discovery of tools prefixed with LLVM's default target triple.

Removed: 
cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld?rev=272453=auto
==
(empty)

Removed: 
cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld.exe
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld.exe?rev=272453=auto
==
(empty)

Removed: cfe/trunk/test/Driver/android-triple-version.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/android-triple-version.c?rev=272453=auto
==
--- cfe/trunk/test/Driver/android-triple-version.c (original)
+++ cfe/trunk/test/Driver/android-triple-version.c (removed)
@@ -1,10 +0,0 @@
-// Android's target triples can contain a version number in the environment
-// field (e.g. arm-linux-androideabi9).
-// Make sure that any version is stripped when finding toolchain binaries.
-
-// RUN: env "PATH=%S/Inputs/android_triple_version/bin" \
-// RUN: %clang -### -target arm-linux-androideabi %s 2>&1 | FileCheck %s
-// RUN: env "PATH=%S/Inputs/android_triple_version/bin" \
-// RUN: %clang -### -target arm-linux-androideabi9 %s 2>&1 | FileCheck %s
-
-// CHECK: arm-linux-androideabi-ld


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r272413 - Strip Android version when looking up toolchain paths.

2016-06-10 Thread Chandler Carruth via cfe-commits
This broke several bots that have now been red most of the day. Here are
recent builds that show the failure:
http://lab.llvm.org:8011/builders/clang-ppc64le-linux/builds/4611
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/6331
http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/15622

I suspect this is because using PATH in this way as part of a test doesn't
work well, but I'll let you look at what the best option is for fixing
this. For now I've reverted it in

Please watch the bots when committing in the future.

-Chandler

On Fri, Jun 10, 2016 at 11:37 AM Josh Gao via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: jmgao
> Date: Fri Jun 10 13:30:33 2016
> New Revision: 272413
>
> URL: http://llvm.org/viewvc/llvm-project?rev=272413=rev
> Log:
> Strip Android version when looking up toolchain paths.
>
> Summary:
> Android target triples can include a version number in the abi field
> (e.g. 'aarch64-linux-android21'), used for checking for availability.
> However, the driver was searching for toolchain binaries using the
> passed in triple as a prefix.
>
> Reviewers: srhines, danalbert, t.p.northover
>
> Subscribers: t.p.northover, aemerson, tberghammer, danalbert, srhines,
> cfe-commits
>
> Differential Revision: http://reviews.llvm.org/D21163
>
> Added:
> cfe/trunk/test/Driver/Inputs/android_triple_version/
> cfe/trunk/test/Driver/Inputs/android_triple_version/bin/
>
> cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld
>  (with props)
>
> cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld.exe
>  (with props)
> cfe/trunk/test/Driver/android-triple-version.c
> Modified:
> cfe/trunk/lib/Driver/Driver.cpp
>
> Modified: cfe/trunk/lib/Driver/Driver.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=272413=272412=272413=diff
>
> ==
> --- cfe/trunk/lib/Driver/Driver.cpp (original)
> +++ cfe/trunk/lib/Driver/Driver.cpp Fri Jun 10 13:30:33 2016
> @@ -2343,7 +2343,15 @@ void Driver::generatePrefixedToolNames(
>  const char *Tool, const ToolChain ,
>  SmallVectorImpl ) const {
>// FIXME: Needs a better variable than DefaultTargetTriple
> -  Names.emplace_back(DefaultTargetTriple + "-" + Tool);
> +  StringRef Triple = DefaultTargetTriple;
> +
> +  // On Android, the target triple can include a version number that
> needs to
> +  // be stripped.
> +  if (TC.getTriple().isAndroid()) {
> +Triple = Triple.rtrim("0123456789");
> +  }
> +
> +  Names.emplace_back((Triple + "-" + Tool).str());
>Names.emplace_back(Tool);
>
>// Allow the discovery of tools prefixed with LLVM's default target
> triple.
>
> Added:
> cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld?rev=272413=auto
>
> ==
> (empty)
>
> Propchange:
> cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld
>
> --
> svn:executable = *
>
> Added:
> cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld.exe
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld.exe?rev=272413=auto
>
> ==
> (empty)
>
> Propchange:
> cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld.exe
>
> --
> svn:executable = *
>
> Added: cfe/trunk/test/Driver/android-triple-version.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/android-triple-version.c?rev=272413=auto
>
> ==
> --- cfe/trunk/test/Driver/android-triple-version.c (added)
> +++ cfe/trunk/test/Driver/android-triple-version.c Fri Jun 10 13:30:33 2016
> @@ -0,0 +1,10 @@
> +// Android's target triples can contain a version number in the
> environment
> +// field (e.g. arm-linux-androideabi9).
> +// Make sure that any version is stripped when finding toolchain binaries.
> +
> +// RUN: env "PATH=%S/Inputs/android_triple_version/bin" \
> +// RUN: %clang -### -target arm-linux-androideabi %s 2>&1 | FileCheck
> %s
> +// RUN: env "PATH=%S/Inputs/android_triple_version/bin" \
> +// RUN: %clang -### -target arm-linux-androideabi9 %s 2>&1 |
> FileCheck %s
> +
> +// CHECK: arm-linux-androideabi-ld
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>

r272453 - Revert "[ASTMatchers] New forEachOverriden matcher."

2016-06-10 Thread Chandler Carruth via cfe-commits
Author: chandlerc
Date: Fri Jun 10 23:45:38 2016
New Revision: 272453

URL: http://llvm.org/viewvc/llvm-project?rev=272453=rev
Log:
Revert "[ASTMatchers] New forEachOverriden matcher."

This reverts commit r272386. It doesn't compile with MSVC and those bots
have been red the entire day as a consequence.

Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=272453=272452=272453=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Fri Jun 10 23:45:38 2016
@@ -3968,30 +3968,6 @@ matcher, or is a pointer to a type that
 
 
 
-Matcherhttp://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html;>CXXMethodDeclforEachOverriddenMatcherhttp://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html;>CXXMethodDecl
 InnerMatcher
-Matches each 
method overriden by the given method. This matcher may
-produce multiple matches.
-
-Given
-  class A { virtual void f(); };
-  class B : public A { void f(); };
-  class C : public B { void f(); };
-cxxMethodDecl(ofClass(hasName("C")),
-  forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
-  matches once, with "b" binding "A::f" and "d" binding "C::f" (Note
-  that B::f is not overridden by C::f).
-
-The check can produce multiple matches in case of multiple inheritance, e.g.
-  class A1 { virtual void f(); };
-  class A2 { virtual void f(); };
-  class C : public A1, public A2 { void f(); };
-cxxMethodDecl(ofClass(hasName("C")),
-  forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
-  matches twice, once with "b" binding "A1::f" and "d" binding "C::f", and
-  once with "b" binding "A2::f" and "d" binding "C::f".
-
-
-
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html;>CXXMethodDeclofClassMatcherhttp://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html;>CXXRecordDecl
 InnerMatcher
 Matches the class 
declaration that the given method declaration
 belongs to.

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=272453=272452=272453=diff
==
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Fri Jun 10 23:45:38 2016
@@ -821,9 +821,6 @@ public:
   overridden_methods_end(const CXXMethodDecl *Method) const;
 
   unsigned overridden_methods_size(const CXXMethodDecl *Method) const;
-  typedef llvm::iterator_range
-  overridden_method_range;
-  overridden_method_range overridden_methods(const CXXMethodDecl *Method) 
const;
 
   /// \brief Note that the given C++ \p Method overrides the given \p
   /// Overridden method.

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=272453=272452=272453=diff
==
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Fri Jun 10 23:45:38 2016
@@ -16,7 +16,6 @@
 #ifndef LLVM_CLANG_AST_DECLCXX_H
 #define LLVM_CLANG_AST_DECLCXX_H
 
-#include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTUnresolvedSet.h"
 #include "clang/AST/Attr.h"
 #include "clang/AST/Decl.h"
@@ -1829,8 +1828,6 @@ public:
   method_iterator begin_overridden_methods() const;
   method_iterator end_overridden_methods() const;
   unsigned size_overridden_methods() const;
-  typedef ASTContext::overridden_method_range overridden_method_range;
-  overridden_method_range overridden_methods() const;
 
   /// Returns the parent of this method declaration, which
   /// is the class in which this method is defined.

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=272453=272452=272453=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Fri Jun 10 23:45:38 2016
@@ -3770,47 +3770,6 @@ AST_MATCHER_P(CXXMethodDecl, ofClass,
   InnerMatcher.matches(*Parent, Finder, Builder));
 }
 
-/// \brief Matches each method overriden by the given method. This matcher may
-/// produce multiple matches.
-///
-/// Given
-/// \code
-///   class A { virtual void f(); };
-///   class B : public A { void f(); };
-///   class C : public 

Re: r272386 - [ASTMatchers] New forEachOverriden matcher.

2016-06-10 Thread Chandler Carruth via cfe-commits
This has broken Windows build bots all day. Here are some recent examples:
http://lab.llvm.org:8011/builders/clang-x86-win2008-selfhost/builds/8506/steps/ninja%20check%201/logs/stdio
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/12981/steps/ninja%20check%201/logs/stdio

Please pay attention to the bots when you are committing changes. I've
reverted it in r272453.

On Fri, Jun 10, 2016 at 5:01 AM Clement Courbet via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: courbet
> Date: Fri Jun 10 06:54:43 2016
> New Revision: 272386
>
> URL: http://llvm.org/viewvc/llvm-project?rev=272386=rev
> Log:
> [ASTMatchers] New forEachOverriden matcher.
>
> Matches methods overridden by the given method.
>
> Modified:
> cfe/trunk/docs/LibASTMatchersReference.html
> cfe/trunk/include/clang/AST/ASTContext.h
> cfe/trunk/include/clang/AST/DeclCXX.h
> cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
> cfe/trunk/lib/AST/ASTContext.cpp
> cfe/trunk/lib/AST/DeclCXX.cpp
> cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
>
> Modified: cfe/trunk/docs/LibASTMatchersReference.html
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=272386=272385=272386=diff
>
> ==
> --- cfe/trunk/docs/LibASTMatchersReference.html (original)
> +++ cfe/trunk/docs/LibASTMatchersReference.html Fri Jun 10 06:54:43 2016
> @@ -3968,6 +3968,30 @@ matcher, or is a pointer to a type that
>  
>
>
> +Matcherhttp://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html;>CXXMethodDecl class="name" onclick="toggle('forEachOverridden0')"> name="forEachOverridden0Anchor">forEachOverriddenMatcher href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html;>CXXMethodDecl
> InnerMatcher
> +Matches each
> method overriden by the given method. This matcher may
> +produce multiple matches.
> +
> +Given
> +  class A { virtual void f(); };
> +  class B : public A { void f(); };
> +  class C : public B { void f(); };
> +cxxMethodDecl(ofClass(hasName("C")),
> +  forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
> +  matches once, with "b" binding "A::f" and "d" binding "C::f" (Note
> +  that B::f is not overridden by C::f).
> +
> +The check can produce multiple matches in case of multiple inheritance,
> e.g.
> +  class A1 { virtual void f(); };
> +  class A2 { virtual void f(); };
> +  class C : public A1, public A2 { void f(); };
> +cxxMethodDecl(ofClass(hasName("C")),
> +  forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
> +  matches twice, once with "b" binding "A1::f" and "d" binding "C::f", and
> +  once with "b" binding "A2::f" and "d" binding "C::f".
> +
> +
> +
>  Matcherhttp://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html;>CXXMethodDecl class="name" onclick="toggle('ofClass0')"> name="ofClass0Anchor">ofClassMatcherhttp://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html;>CXXRecordDecl
> InnerMatcher
>  Matches the class
> declaration that the given method declaration
>  belongs to.
>
> Modified: cfe/trunk/include/clang/AST/ASTContext.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=272386=272385=272386=diff
>
> ==
> --- cfe/trunk/include/clang/AST/ASTContext.h (original)
> +++ cfe/trunk/include/clang/AST/ASTContext.h Fri Jun 10 06:54:43 2016
> @@ -821,6 +821,9 @@ public:
>overridden_methods_end(const CXXMethodDecl *Method) const;
>
>unsigned overridden_methods_size(const CXXMethodDecl *Method) const;
> +  typedef llvm::iterator_range
> +  overridden_method_range;
> +  overridden_method_range overridden_methods(const CXXMethodDecl *Method)
> const;
>
>/// \brief Note that the given C++ \p Method overrides the given \p
>/// Overridden method.
>
> Modified: cfe/trunk/include/clang/AST/DeclCXX.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=272386=272385=272386=diff
>
> ==
> --- cfe/trunk/include/clang/AST/DeclCXX.h (original)
> +++ cfe/trunk/include/clang/AST/DeclCXX.h Fri Jun 10 06:54:43 2016
> @@ -16,6 +16,7 @@
>  #ifndef LLVM_CLANG_AST_DECLCXX_H
>  #define LLVM_CLANG_AST_DECLCXX_H
>
> +#include "clang/AST/ASTContext.h"
>  #include "clang/AST/ASTUnresolvedSet.h"
>  #include "clang/AST/Attr.h"
>  #include "clang/AST/Decl.h"
> @@ -1828,6 +1829,8 @@ public:
>method_iterator begin_overridden_methods() const;
>method_iterator end_overridden_methods() const;
>unsigned size_overridden_methods() const;
> +  typedef ASTContext::overridden_method_range overridden_method_range;
> +  overridden_method_range overridden_methods() const;
>
>/// Returns the parent of this method declaration, which
>/// is the class in which this method is defined.
>
> Modified: 

r272452 - [AVX512] Implement 512-bit and masked shufflelo and shufflehi intrinsics directly with __builtin_shufflevector and __builtin_ia32_select. Also improve the formatting of the AVX2 version.

2016-06-10 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Fri Jun 10 22:31:13 2016
New Revision: 272452

URL: http://llvm.org/viewvc/llvm-project?rev=272452=rev
Log:
[AVX512] Implement 512-bit and masked shufflelo and shufflehi intrinsics 
directly with __builtin_shufflevector and __builtin_ia32_select. Also improve 
the formatting of the AVX2 version.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx2intrin.h
cfe/trunk/lib/Headers/avx512bwintrin.h
cfe/trunk/lib/Headers/avx512vlbwintrin.h
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/CodeGen/avx512bw-builtins.c
cfe/trunk/test/CodeGen/avx512vlbw-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=272452=272451=272452=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Fri Jun 10 22:31:13 2016
@@ -1615,12 +1615,6 @@ TARGET_BUILTIN(__builtin_ia32_prorvd128_
 TARGET_BUILTIN(__builtin_ia32_prorvd256_mask, "V8iV8iV8iV8iUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_prorvq128_mask, 
"V2LLiV2LLiV2LLiV2LLiUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_prorvq256_mask, 
"V4LLiV4LLiV4LLiV4LLiUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pshufhw512_mask, 
"V32sV32sIiV32sUi","","avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pshuflw512_mask, 
"V32sV32sIiV32sUi","","avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pshufhw128_mask, 
"V8sV8sIiV8sUc","","avx512bw,avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pshufhw256_mask, 
"V16sV16sIiV16sUs","","avx512bw,avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pshuflw128_mask, 
"V8sV8sIiV8sUc","","avx512bw,avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pshuflw256_mask, 
"V16sV16sIiV16sUs","","avx512bw,avx512vl")
 TARGET_BUILTIN(__builtin_ia32_psllv32hi_mask, 
"V32sV32sV32sV32sUi","","avx512bw")
 TARGET_BUILTIN(__builtin_ia32_psllw512_mask, "V32sV32sV8sV32sUi","","avx512bw")
 TARGET_BUILTIN(__builtin_ia32_psllwi512_mask, "V32sV32sIiV32sUi","","avx512bw")

Modified: cfe/trunk/lib/Headers/avx2intrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx2intrin.h?rev=272452=272451=272452=diff
==
--- cfe/trunk/lib/Headers/avx2intrin.h (original)
+++ cfe/trunk/lib/Headers/avx2intrin.h Fri Jun 10 22:31:13 2016
@@ -522,8 +522,10 @@ _mm256_shuffle_epi8(__m256i __a, __m256i
 #define _mm256_shufflelo_epi16(a, imm) __extension__ ({ \
   (__m256i)__builtin_shufflevector((__v16hi)(__m256i)(a), \
(__v16hi)_mm256_setzero_si256(), \
-   (imm) & 0x3,((imm) & 0xc) >> 2, \
-   ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6, \
+   0 + (((imm) & 0x03) >> 0), \
+   0 + (((imm) & 0x0c) >> 2), \
+   0 + (((imm) & 0x30) >> 4), \
+   0 + (((imm) & 0xc0) >> 6), \
4, 5, 6, 7, \
8 + (((imm) & 0x03) >> 0), \
8 + (((imm) & 0x0c) >> 2), \

Modified: cfe/trunk/lib/Headers/avx512bwintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512bwintrin.h?rev=272452=272451=272452=diff
==
--- cfe/trunk/lib/Headers/avx512bwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512bwintrin.h Fri Jun 10 22:31:13 2016
@@ -1588,37 +1588,74 @@ _mm512_maskz_cvtepu8_epi16 (__mmask32 __
   (__mmask32)(m)); })
 
 #define _mm512_shufflehi_epi16(A, imm) __extension__ ({ \
-  (__m512i)__builtin_ia32_pshufhw512_mask((__v32hi)(__m512i)(A), (int)(imm), \
-  (__v32hi)_mm512_setzero_hi(), \
-  (__mmask32)-1); })
+  (__m512i)__builtin_shufflevector((__v32hi)(__m512i)(A), \
+   (__v32hi)_mm512_setzero_hi(), \
+   0, 1, 2, 3, \
+   4 + (((imm) & 0x03) >> 0), \
+   4 + (((imm) & 0x0c) >> 2), \
+   4 + (((imm) & 0x30) >> 4), \
+   4 + (((imm) & 0xc0) >> 6), \
+   8, 9, 10, 11, \
+   12 + (((imm) & 0x03) >> 0), \
+   12 + (((imm) & 0x0c) >> 2), \
+   12 + (((imm) & 0x30) >> 4), \
+   12 + (((imm) & 0xc0) >> 6), \
+   16, 17, 18, 19, \
+   20 + (((imm) & 0x03) >> 0), \
+   20 + 

r272451 - [AVX512] Add _mm512_bsrli_epi128 and _mm512_bslli_epi128 intrinsics.

2016-06-10 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Fri Jun 10 22:31:07 2016
New Revision: 272451

URL: http://llvm.org/viewvc/llvm-project?rev=272451=rev
Log:
[AVX512] Add _mm512_bsrli_epi128 and _mm512_bslli_epi128 intrinsics.

Modified:
cfe/trunk/lib/Headers/avx512bwintrin.h
cfe/trunk/test/CodeGen/avx512bw-builtins.c

Modified: cfe/trunk/lib/Headers/avx512bwintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512bwintrin.h?rev=272451=272450=272451=diff
==
--- cfe/trunk/lib/Headers/avx512bwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512bwintrin.h Fri Jun 10 22:31:07 2016
@@ -1695,6 +1695,75 @@ _mm512_maskz_sll_epi16 (__mmask32 __U, _
  (__v32hi)_mm512_setzero_hi(), \
  (__mmask32)(U)); })
 
+#define _mm512_bslli_epi128(a, imm) __extension__ ({ \
+  ((char)(imm)&0xF0) ? _mm512_setzero_si512() :  \
+   (__m512i)__builtin_shufflevector( \
+ (__v64qi)_mm512_setzero_si512(),\
+ (__v64qi)(__m512i)(a),  \
+ ((char)(imm)>0x0 ? 16 :  64) - (char)(imm), \
+ ((char)(imm)>0x1 ? 17 :  65) - (char)(imm), \
+ ((char)(imm)>0x2 ? 18 :  66) - (char)(imm), \
+ ((char)(imm)>0x3 ? 19 :  67) - (char)(imm), \
+ ((char)(imm)>0x4 ? 20 :  68) - (char)(imm), \
+ ((char)(imm)>0x5 ? 21 :  69) - (char)(imm), \
+ ((char)(imm)>0x6 ? 22 :  70) - (char)(imm), \
+ ((char)(imm)>0x7 ? 23 :  71) - (char)(imm), \
+ ((char)(imm)>0x8 ? 24 :  72) - (char)(imm), \
+ ((char)(imm)>0x9 ? 25 :  73) - (char)(imm), \
+ ((char)(imm)>0xA ? 26 :  74) - (char)(imm), \
+ ((char)(imm)>0xB ? 27 :  75) - (char)(imm), \
+ ((char)(imm)>0xC ? 28 :  76) - (char)(imm), \
+ ((char)(imm)>0xD ? 29 :  77) - (char)(imm), \
+ ((char)(imm)>0xE ? 30 :  78) - (char)(imm), \
+ ((char)(imm)>0xF ? 31 :  79) - (char)(imm), \
+ ((char)(imm)>0x0 ? 32 :  80) - (char)(imm), \
+ ((char)(imm)>0x1 ? 33 :  81) - (char)(imm), \
+ ((char)(imm)>0x2 ? 34 :  82) - (char)(imm), \
+ ((char)(imm)>0x3 ? 35 :  83) - (char)(imm), \
+ ((char)(imm)>0x4 ? 36 :  84) - (char)(imm), \
+ ((char)(imm)>0x5 ? 37 :  85) - (char)(imm), \
+ ((char)(imm)>0x6 ? 38 :  86) - (char)(imm), \
+ ((char)(imm)>0x7 ? 39 :  87) - (char)(imm), \
+ ((char)(imm)>0x8 ? 40 :  88) - (char)(imm), \
+ ((char)(imm)>0x9 ? 41 :  89) - (char)(imm), \
+ ((char)(imm)>0xA ? 42 :  90) - (char)(imm), \
+ ((char)(imm)>0xB ? 43 :  91) - (char)(imm), \
+ ((char)(imm)>0xC ? 44 :  92) - (char)(imm), \
+ ((char)(imm)>0xD ? 45 :  93) - (char)(imm), \
+ ((char)(imm)>0xE ? 46 :  94) - (char)(imm), \
+ ((char)(imm)>0xF ? 47 :  95) - (char)(imm), \
+ ((char)(imm)>0x0 ? 48 :  96) - (char)(imm), \
+ ((char)(imm)>0x1 ? 49 :  97) - (char)(imm), \
+ ((char)(imm)>0x2 ? 50 :  98) - (char)(imm), \
+ ((char)(imm)>0x3 ? 51 :  99) - (char)(imm), \
+ ((char)(imm)>0x4 ? 52 : 100) - (char)(imm), \
+ ((char)(imm)>0x5 ? 53 : 101) - (char)(imm), \
+ ((char)(imm)>0x6 ? 54 : 102) - (char)(imm), \
+ ((char)(imm)>0x7 ? 55 : 103) - (char)(imm), \
+ ((char)(imm)>0x8 ? 56 : 104) - (char)(imm), \
+ ((char)(imm)>0x9 ? 57 : 105) - (char)(imm), \
+ ((char)(imm)>0xA ? 58 : 106) - (char)(imm), \
+ ((char)(imm)>0xB ? 59 : 107) - (char)(imm), \
+ ((char)(imm)>0xC ? 60 : 108) - (char)(imm), \
+ ((char)(imm)>0xD ? 61 : 109) - (char)(imm), \
+ ((char)(imm)>0xE ? 62 : 110) - (char)(imm), 

r272448 - Visual Studio visualizers associated with LookupResults

2016-06-10 Thread Mike Spertus via cfe-commits
Author: mps
Date: Fri Jun 10 22:02:33 2016
New Revision: 272448

URL: http://llvm.org/viewvc/llvm-project?rev=272448=rev
Log:
Visual Studio visualizers associated with LookupResults

Visualizers for DeclAccessPair, UnresolvedSet, and LookupResult. For example,
when combined with LLVM diff D21256 (currently in review), a Lookup set will
show much more naturally in the Locals window something like

  Found: {public typename ...Ts}


Modified:
cfe/trunk/utils/ClangVisualizers/clang.natvis

Modified: cfe/trunk/utils/ClangVisualizers/clang.natvis
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ClangVisualizers/clang.natvis?rev=272448=272447=272448=diff
==
--- cfe/trunk/utils/ClangVisualizers/clang.natvis (original)
+++ cfe/trunk/utils/ClangVisualizers/clang.natvis Fri Jun 10 22:02:33 2016
@@ -481,4 +481,22 @@ For later versions of Visual Studio, no
   
 Expression of class 
{(clang::Stmt::StmtClass)StmtBits.sClass,en} and type 
{TR,view(cpp)}
   
+  
+public
+protected
+private
+b
+{*(clang::NamedDecl 
*)(Ptr~Mask)}
+{*this,view(access)} {*this,view(decl)}
+  
+  
+{Decls}
+
+  Decls
+
+  
+  
+{Ambiguity,en}: {Decls}
+{ResultKind,en}: {Decls}
+  
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D21256: Improved Visual Studio 2015 visualization of SmallVectorImpl

2016-06-10 Thread Mike Spertus via cfe-commits
mspertus created this revision.
mspertus added reviewers: aaron.ballman, zturner, aemerson.
mspertus added a subscriber: cfe-commits.

When visualizing small vectors in VS2015, show the first few elements in the 
DisplayString instead of the size. For example, a `SmallVector` of 
`DeclAccessPair` will visualize like

  {public typename ...Ts, public typename U}

The visualization in VS2013 remains the same because we continue to include the 
old visualizer with a lower-than-default priority of `MediumLow`, and the same 
`SmallVector` would continue to be visualized as

  {size = 2}

I decided to submit this one for review before commit because as `SmallVector` 
is used pretty much everywhere in LLVM and Clang, even though I think this is a 
huge improvement in practice but wanted to give others a chance to pipe in if 
they disagree. If no one pipes in, I plan to go ahead and commit in 48 hours

http://reviews.llvm.org/D21256

Files:
  llvm.natvis

Index: llvm.natvis
===
--- llvm.natvis
+++ llvm.natvis
@@ -8,8 +8,8 @@
 For later versions of Visual Studio, no setup is required.
 -->
 http://schemas.microsoft.com/vstudio/debugger/natvis/2010;>
-
-  
+  
+  
 empty
 {{ 
size={($T1*)EndX - ($T1*)BeginX} }}
 
@@ -21,6 +21,29 @@
   
 
   
+  
+  
+
+{(($T1*)BeginX)[0]}{*this,view(elt1)}
+
+, 
{(($T1*)BeginX)[1]}{*this,view(elt2)}
+
+, 
{(($T1*)BeginX)[2]}{*this,view(elt3)}
+
+, 
{(($T1*)BeginX)[2]}{*this,view(elt4)}
+
+, /* {(($T1*)EndX - ($T1*)BeginX) - 4} 
more*/ 
+empty
+{{{*this,view(elt0)}}}
+
+  ($T1*)EndX - ($T1*)BeginX
+  ($T1*)CapacityX - ($T1*)BeginX
+  
+($T1*)EndX - ($T1*)BeginX
+($T1*)BeginX
+  
+
+  
   
 empty
 {{ size={Length} }}


Index: llvm.natvis
===
--- llvm.natvis
+++ llvm.natvis
@@ -8,8 +8,8 @@
 For later versions of Visual Studio, no setup is required.
 -->
 http://schemas.microsoft.com/vstudio/debugger/natvis/2010;>
-
-  
+  
+  
 empty
 {{ size={($T1*)EndX - ($T1*)BeginX} }}
 
@@ -21,6 +21,29 @@
   
 
   
+  
+  
+
+{(($T1*)BeginX)[0]}{*this,view(elt1)}
+
+, {(($T1*)BeginX)[1]}{*this,view(elt2)}
+
+, {(($T1*)BeginX)[2]}{*this,view(elt3)}
+
+, {(($T1*)BeginX)[2]}{*this,view(elt4)}
+
+, /* {(($T1*)EndX - ($T1*)BeginX) - 4} more*/ 
+empty
+{{{*this,view(elt0)}}}
+
+  ($T1*)EndX - ($T1*)BeginX
+  ($T1*)CapacityX - ($T1*)BeginX
+  
+($T1*)EndX - ($T1*)BeginX
+($T1*)BeginX
+  
+
+  
   
 empty
 {{ size={Length} }}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r272447 - [Sema] Return an appropriate result from CheckSpecifiedExceptionType

2016-06-10 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Fri Jun 10 20:25:04 2016
New Revision: 272447

URL: http://llvm.org/viewvc/llvm-project?rev=272447=rev
Log:
[Sema] Return an appropriate result from CheckSpecifiedExceptionType

We shouldn't return true from CheckSpecifiedExceptionType if
the record type is incomplete and -fms-extensions is engaged.  Otherwise
we will have an incomplete AST.

Modified:
cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
cfe/trunk/test/SemaCXX/ms-exception-spec.cpp

Modified: cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExceptionSpec.cpp?rev=272447=272446=272447=diff
==
--- cfe/trunk/lib/Sema/SemaExceptionSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExceptionSpec.cpp Fri Jun 10 20:25:04 2016
@@ -112,12 +112,15 @@ bool Sema::CheckSpecifiedExceptionType(Q
   //   pointer or reference to a class currently being defined.
   // In Microsoft mode, downgrade this to a warning.
   unsigned DiagID = diag::err_incomplete_in_exception_spec;
-  if (getLangOpts().MicrosoftExt)
+  bool ReturnValueOnError = true;
+  if (getLangOpts().MicrosoftExt) {
 DiagID = diag::ext_incomplete_in_exception_spec;
+ReturnValueOnError = false;
+  }
   if (!(PointeeT->isRecordType() &&
 PointeeT->getAs()->isBeingDefined()) &&
   RequireCompleteType(Range.getBegin(), PointeeT, DiagID, Kind, Range))
-return true;
+return ReturnValueOnError;
 
   return false;
 }

Modified: cfe/trunk/test/SemaCXX/ms-exception-spec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/ms-exception-spec.cpp?rev=272447=272446=272447=diff
==
--- cfe/trunk/test/SemaCXX/ms-exception-spec.cpp (original)
+++ cfe/trunk/test/SemaCXX/ms-exception-spec.cpp Fri Jun 10 20:25:04 2016
@@ -1,8 +1,9 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions
+// RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions -fexceptions 
-fcxx-exceptions
 
 void f() throw(...) { }
 
 namespace PR28080 {
-struct S; // expected-note {{forward declaration}}
-void fn() throw(S); // expected-warning {{incomplete type}}
+struct S;   // expected-note {{forward declaration}}
+void fn() throw(S); // expected-warning {{incomplete type}} 
expected-note{{previous declaration}}
+void fn() throw();  // expected-warning {{does not match previous declaration}}
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D21250: Make test less sensitive to resource dir

2016-06-10 Thread Paul Robinson via cfe-commits
probinson created this revision.
probinson added reviewers: chh, ismail.
probinson added a subscriber: cfe-commits.
Herald added subscribers: danalbert, tberghammer.

Capture the resource directory and use it for subsequent checks.
This is the same tactic used in linux-header-search.cpp.


http://reviews.llvm.org/D21250

Files:
  test/Driver/android-ndk-standalone.cpp

Index: test/Driver/android-ndk-standalone.cpp
===
--- test/Driver/android-ndk-standalone.cpp
+++ test/Driver/android-ndk-standalone.cpp
@@ -7,6 +7,7 @@
 // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
 // RUN:   | FileCheck  %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
+// CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9"
 // CHECK-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb"
 // CHECK-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a"
@@ -17,7 +18,7 @@
 // CHECK-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb"
 // CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9/backward"
 // CHECK: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
-// CHECK: "-internal-isystem" 
"{{.*(/|)}}lib{{(64)?(/|)}}clang{{(/|)[^"]+(/|)}}include"
+// CHECK: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|)}}include"
 // CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/include"
 // CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
 // CHECK: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
@@ -43,6 +44,7 @@
 // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
 // RUN:   | FileCheck  --check-prefix=CHECK-ARMV7 %s
 // CHECK-ARMV7: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-ARMV7: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-ARMV7: "-internal-isystem" "{{.*}}/include/c++/4.9"
 // CHECK-ARMV7-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb"
 // CHECK-ARMV7-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb"
@@ -53,7 +55,7 @@
 // CHECK-ARMV7-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi"
 // CHECK-ARMV7: "-internal-isystem" "{{.*}}/include/c++/4.9/backward"
 // CHECK-ARMV7: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
-// CHECK-ARMV7: "-internal-isystem" 
"{{.*(/|)}}lib{{(64)?(/|)}}clang{{(/|)[^"]+(/|)}}include"
+// CHECK-ARMV7: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|)}}include"
 // CHECK-ARMV7: "-internal-externc-isystem" "{{.*}}/sysroot/include"
 // CHECK-ARMV7: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
 // CHECK-ARMV7: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
@@ -101,6 +103,7 @@
 // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
 // RUN:   | FileCheck  --check-prefix=CHECK-THUMB %s
 // CHECK-THUMB: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-THUMB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9"
 // CHECK-THUMB-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7/thumb"
 // CHECK-THUMB-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7"
@@ -111,7 +114,7 @@
 // CHECK-THUMB-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi"
 // CHECK-THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9/backward"
 // CHECK-THUMB: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
-// CHECK-THUMB: "-internal-isystem" 
"{{.*(/|)}}lib{{(64)?(/|)}}clang{{(/|)[^"]+(/|)}}include"
+// CHECK-THUMB: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|)}}include"
 // CHECK-THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/include"
 // CHECK-THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
 // CHECK-THUMB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
@@ -139,6 +142,7 @@
 // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
 // RUN:   | FileCheck  --check-prefix=CHECK-ARMV7THUMB %s
 // CHECK-ARMV7THUMB: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-ARMV7THUMB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9"
 // CHECK-ARMV7THUMB-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a"
 // CHECK-ARMV7THUMB-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb"
@@ -149,7 +153,7 @@
 // CHECK-ARMV7THUMB-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi"
 // CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9/backward"
 // CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
-// CHECK-ARMV7THUMB: "-internal-isystem" 
"{{.*(/|)}}lib{{(64)?(/|)}}clang{{(/|)[^"]+(/|)}}include"
+// CHECK-ARMV7THUMB: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|)}}include"
 // CHECK-ARMV7THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/include"
 // 

Re: [PATCH] D20964: [clang-tidy] Add modernize-use-emplace

2016-06-10 Thread Vedant Kumar via cfe-commits
vsk added inline comments.


Comment at: clang-tidy/modernize/UseEmplaceCheck.cpp:41
@@ +40,3 @@
+  // (and destructed) as in push_back case.
+  auto isCtorOfSmartPtr = hasDeclaration(cxxConstructorDecl(
+  ofClass(hasAnyName("std::shared_ptr", "std::unique_ptr", "std::auto_ptr",

sbarzowski wrote:
> vsk wrote:
> > I agree that blacklisting some smart pointers is not a complete solution, 
> > and that we shouldn't introduce a check which emits false positives.
> > 
> > ISTM it's **only** safe to perform the "push(T(...)) -> emplace(...)" 
> > change if: it's safe to assume that if "emplace(...)" does not successfully 
> > call "T(...)", it's OK for the program to fail/leak/crash. Do we get to 
> > make this assumption ever? Perhaps just in no-exceptions mode?
> hmmm... Maybe it's not that bad.
> 
> Let's look closely at the difference in behaviour.
> 
> with push_back it works like:
> 1) Call the constructor
> 2) Allocate the memory
> 3) Call the copy constructor
> 
> And emplace_back is:
> 1) Allocate the memory
> 2) Call the constructor
> 
> Each of these steps in both scenarios may fail.
> 
> If we call the constructor and it fails, then it's alright. We have the same 
> behaviour in both cases - if it can fail it should do its cleanup. (And 
> failure of copy constructor obviously doesn't bother us).
> 
> So the scenario we have to worry about in only when memory allocation fails. 
> Then with push_back, we'll call constructor and then destructor, while 
> emplace_back doesn't call constructor at all.
> 
> So the real question is: "Is it safe to throw some exception and not to call 
> the constructor at all". And I see only one real-world case it isn't - taking 
> the ownership of the object.
> 
@sbarzowski Right, I think we're in agreement about what the problem is. I just 
don't think there are heuristics or comprehensive blacklists to detect classes 
which have ownership semantics. E.g, consider a FileHandle class which owns a 
file descriptor and is responsible for closing it.


http://reviews.llvm.org/D20964



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20602: Add .rgba syntax extension to ext_vector_type types

2016-06-10 Thread Pirama Arumuga Nainar via cfe-commits
pirama updated this revision to Diff 60425.
pirama added a comment.

Convert error to warning, update tests, and rename variable name.


http://reviews.llvm.org/D20602

Files:
  include/clang/AST/Type.h
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/AST/Expr.cpp
  lib/Sema/SemaExprMember.cpp
  test/CodeGen/ext-vector.c
  test/Misc/warning-flags.c
  test/Sema/ext_vector_components.c
  test/SemaOpenCL/ext_vectors.cl

Index: test/SemaOpenCL/ext_vectors.cl
===
--- /dev/null
+++ test/SemaOpenCL/ext_vectors.cl
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.1
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
+
+typedef float float4 __attribute__((ext_vector_type(4)));
+
+void test_ext_vector_accessors(float4 V) {
+  V = V.wzyx;
+  V = V.abgr; // expected-warning {{vector component name 'a' is an OpenCL version 2.2 feature}}
+  V = V.xyzr; // expected-warning {{vector component name 'r' is an OpenCL version 2.2 feature}} \
+  // expected-error {{illegal vector component name 'r'}}
+}
Index: test/Sema/ext_vector_components.c
===
--- test/Sema/ext_vector_components.c
+++ test/Sema/ext_vector_components.c
@@ -39,6 +39,33 @@
 vec4.x = vec16.sF;
   
 vec4p->yz = vec4p->xy;
+
+vec2.a; // expected-error {{vector component access exceeds type 'float2'}}
+vec2.rgba; // expected-error {{vector component access exceeds type 'float2'}}
+vec4.rgba; // expected-warning {{expression result unused}}
+vec4.rgbz; // expected-error {{illegal vector component name 'z'}}
+vec4.rgbc; // expected-error {{illegal vector component name 'c'}}
+vec4.xyzr; // expected-error {{illegal vector component name 'r'}}
+vec4.s01b; // expected-error {{vector component access exceeds type 'float4'}}
+
+vec3 = vec4.rgb; // legal, shorten
+f = vec2.r; // legal, shorten
+f = vec4.rg.r; // legal, shorten
+vec4_2.rgba = vec4.xyzw; // legal, no intermingling
+
+vec4_2.rgbr = vec4.rgba; // expected-error {{vector is not assignable (contains duplicate components)}}
+vec4_2.rgbb = vec4.rgba; // expected-error {{vector is not assignable (contains duplicate components)}}
+vec4_2.rgga = vec4.rgba; // expected-error {{vector is not assignable (contains duplicate components)}}
+vec2.x = f;
+vec2.rr = vec2_2.rg; // expected-error {{vector is not assignable (contains duplicate components)}}
+vec2.gr = vec2_2.rg;
+vec2.gr.g = vec2_2.r;
+vec4 = (float4){ 1,2,3,4 };
+vec4.rg.b; // expected-error {{vector component access exceeds type 'float2'}}
+vec4.r = vec16.sf;
+vec4.g = vec16.sF;
+
+vec4p->gb = vec4p->rg;
 }
 
 float2 lo(float3 x) { return x.lo; }
Index: test/Misc/warning-flags.c
===
--- test/Misc/warning-flags.c
+++ test/Misc/warning-flags.c
@@ -18,15 +18,16 @@
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (84):
+CHECK: Warnings without flags (85):
 CHECK-NEXT:   ext_excess_initializers
 CHECK-NEXT:   ext_excess_initializers_in_char_array_initializer
 CHECK-NEXT:   ext_expected_semi_decl_list
 CHECK-NEXT:   ext_explicit_specialization_storage_class
 CHECK-NEXT:   ext_initializer_string_for_char_array_too_long
 CHECK-NEXT:   ext_missing_declspec
 CHECK-NEXT:   ext_missing_whitespace_after_macro_name
 CHECK-NEXT:   ext_new_paren_array_nonconst
+CHECK-NEXT:   ext_opencl_ext_vector_type_rgba_selector
 CHECK-NEXT:   ext_plain_complex
 CHECK-NEXT:   ext_template_arg_extra_parens
 CHECK-NEXT:   ext_typecheck_comparison_of_pointer_integer
Index: test/CodeGen/ext-vector.c
===
--- test/CodeGen/ext-vector.c
+++ test/CodeGen/ext-vector.c
@@ -301,3 +301,40 @@
   char valC;
   char16 destVal = valC ? valA : valB;
 }
+
+typedef __attribute__(( ext_vector_type(16) )) float float16;
+
+float16 vec16, vec16_2;
+
+// CHECK: @test_rgba
+void test_rgba() {
+  // CHECK: fadd <4 x float>
+  vec4_2 = vec4.abgr + vec4;
+
+  // CHECK: shufflevector {{.*}} 
+  vec2 = vec4.rg;
+  // CHECK: shufflevector {{.*}} 
+  vec2_2 = vec4.ba;
+  // CHECK: extractelement {{.*}} 2
+  f = vec4.b;
+  // CHECK: shufflevector {{.*}} 
+  vec4_2 = vec4_2.;
+
+  // CHECK: insertelement {{.*}} 0
+  vec2.r = f;
+  // CHECK: shufflevector {{.*}} 
+  vec2.gr = vec2;
+
+  // CHECK: extractelement {{.*}} 0
+  f = vec4_2.rg.r;
+  // CHECK: shufflevector {{.*}} 
+  // CHECK: shufflevector {{.*}} 
+  // CHECK: shufflevector {{.*}} 
+  vec4.rgb = vec4.bgr;
+
+  // CHECK: extractelement {{.*}} 11
+  // CHECK: insertelement {{.*}} 2
+  vec4.b = vec16.sb;
+  // CHECK: shufflevector {{.*}} 
+  vec4_2 = vec16.sabcd;
+}
Index: lib/Sema/SemaExprMember.cpp
===
--- 

Re: [PATCH] D21247: Add `REQUIRES: c++experimental` where appropriate.

2016-06-10 Thread Dan Albert via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272443: Add `REQUIRES: c++experimental` where appropriate. 
(authored by danalbert).

Changed prior to commit:
  http://reviews.llvm.org/D21247?vs=60420=60421#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21247

Files:
  
libcxx/trunk/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/max_size.pass.cpp
  
libcxx/trunk/test/libcxx/experimental/memory/memory.resource.global/global_memory_resource_lifetime.pass.cpp
  
libcxx/trunk/test/libcxx/experimental/memory/memory.resource.global/new_delete_resource_lifetime.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/default.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/equal.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/not_equal.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/allocate.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/deallocate.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/destroy.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/resource.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/select_on_container_copy_construction.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_deque_synop.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_forward_list_synop.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_list_synop.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_map_synop.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_regex_synop.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_set_synop.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_string_synop.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_unordered_map_synop.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_vector_synop.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.resource.global/default_resource.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
  
libcxx/trunk/test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp

Index: libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/allocate.pass.cpp
===
--- libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/allocate.pass.cpp
+++ libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/allocate.pass.cpp
@@ -7,6 +7,7 @@
 //
 //===--===//
 
+// REQUIRES: c++experimental
 // UNSUPPORTED: c++98, c++03
 
 // 
Index: libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/select_on_container_copy_construction.pass.cpp
===
--- libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/select_on_container_copy_construction.pass.cpp
+++ 

[libcxx] r272443 - Add `REQUIRES: c++experimental` where appropriate.

2016-06-10 Thread Dan Albert via cfe-commits
Author: danalbert
Date: Fri Jun 10 17:45:11 2016
New Revision: 272443

URL: http://llvm.org/viewvc/llvm-project?rev=272443=rev
Log:
Add `REQUIRES: c++experimental` where appropriate.

Summary:
I haven't added it to all the tests, just those that fail without it
(those that aren't header only).

Reviewers: EricWF, mclow.lists

Subscribers: cfe-commits

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

Modified:

libcxx/trunk/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/max_size.pass.cpp

libcxx/trunk/test/libcxx/experimental/memory/memory.resource.global/global_memory_resource_lifetime.pass.cpp

libcxx/trunk/test/libcxx/experimental/memory/memory.resource.global/new_delete_resource_lifetime.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/default.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/equal.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/not_equal.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/allocate.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/deallocate.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/destroy.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/resource.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/select_on_container_copy_construction.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_deque_synop.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_forward_list_synop.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_list_synop.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_map_synop.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_regex_synop.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_set_synop.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_string_synop.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_unordered_map_synop.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_vector_synop.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.resource.global/default_resource.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp

Modified: 
libcxx/trunk/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/max_size.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/max_size.pass.cpp?rev=272443=272442=272443=diff
==
--- 
libcxx/trunk/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/max_size.pass.cpp
 (original)
+++ 
libcxx/trunk/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/max_size.pass.cpp
 Fri Jun 10 17:45:11 2016
@@ -7,6 +7,7 @@
 //
 
//===--===//
 
+// REQUIRES: c++experimental
 // UNSUPPORTED: c++98, c++03
 
 // 

Modified: 

[PATCH] D21247: Add `REQUIRES: c++experimental` where appropriate.

2016-06-10 Thread Dan Albert via cfe-commits
danalbert created this revision.
danalbert added reviewers: EricWF, mclow.lists.
danalbert added a subscriber: cfe-commits.

I haven't added it to all the tests, just those that fail without it
(those that aren't header only).

http://reviews.llvm.org/D21247

Files:
  
test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/max_size.pass.cpp
  
test/libcxx/experimental/memory/memory.resource.global/global_memory_resource_lifetime.pass.cpp
  
test/libcxx/experimental/memory/memory.resource.global/new_delete_resource_lifetime.pass.cpp
  
test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/default.pass.cpp
  
test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/equal.pass.cpp
  
test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/not_equal.pass.cpp
  
test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/allocate.pass.cpp
  
test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair.pass.cpp
  
test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp
  
test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp
  
test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp
  
test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
  
test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp
  
test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/deallocate.pass.cpp
  
test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/destroy.pass.cpp
  
test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/resource.pass.cpp
  
test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/select_on_container_copy_construction.pass.cpp
  
test/std/experimental/memory/memory.resource.aliases/header_deque_synop.pass.cpp
  
test/std/experimental/memory/memory.resource.aliases/header_forward_list_synop.pass.cpp
  
test/std/experimental/memory/memory.resource.aliases/header_list_synop.pass.cpp
  test/std/experimental/memory/memory.resource.aliases/header_map_synop.pass.cpp
  
test/std/experimental/memory/memory.resource.aliases/header_regex_synop.pass.cpp
  test/std/experimental/memory/memory.resource.aliases/header_set_synop.pass.cpp
  
test/std/experimental/memory/memory.resource.aliases/header_string_synop.pass.cpp
  
test/std/experimental/memory/memory.resource.aliases/header_unordered_map_synop.pass.cpp
  
test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp
  
test/std/experimental/memory/memory.resource.aliases/header_vector_synop.pass.cpp
  test/std/experimental/memory/memory.resource.global/default_resource.pass.cpp
  
test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
  
test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp

Index: test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp
===
--- test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp
+++ test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp
@@ -7,6 +7,7 @@
 //
 //===--===//
 
+// REQUIRES: c++experimental
 // UNSUPPORTED: c++98, c++03
 
 // 
Index: test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
===
--- test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
+++ test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
@@ -7,6 +7,7 @@
 //
 //===--===//
 
+// REQUIRES: c++experimental
 // UNSUPPORTED: c++98, c++03
 
 // 
Index: test/std/experimental/memory/memory.resource.global/default_resource.pass.cpp
===
--- test/std/experimental/memory/memory.resource.global/default_resource.pass.cpp
+++ test/std/experimental/memory/memory.resource.global/default_resource.pass.cpp
@@ -7,6 +7,7 @@
 //
 //===--===//
 
+// REQUIRES: c++experimental
 // UNSUPPORTED: c++98, c++03
 
 // 
Index: 

r272441 - Added missing close brace to OpaquePtr Visual Studio visualizer

2016-06-10 Thread Mike Spertus via cfe-commits
Author: mps
Date: Fri Jun 10 17:25:43 2016
New Revision: 272441

URL: http://llvm.org/viewvc/llvm-project?rev=272441=rev
Log:
Added missing close brace to OpaquePtr Visual Studio visualizer

This syntax error resulted in garbage being appended to OpaquePtr visualizations

Modified:
cfe/trunk/utils/ClangVisualizers/clang.natvis

Modified: cfe/trunk/utils/ClangVisualizers/clang.natvis
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ClangVisualizers/clang.natvis?rev=272441=272440=272441=diff
==
--- cfe/trunk/utils/ClangVisualizers/clang.natvis (original)
+++ cfe/trunk/utils/ClangVisualizers/clang.natvis Fri Jun 10 17:25:43 2016
@@ -452,7 +452,7 @@ For later versions of Visual Studio, no
 
   
   
-{($T1 *)Ptr
+{($T1 *)Ptr}
 
   ($T1 *)Ptr
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21212: Add documentation for RenderScript changes

2016-06-10 Thread Pirama Arumuga Nainar via cfe-commits
pirama updated this revision to Diff 60412.
pirama added a comment.

Rebase after submission of http://reviews.llvm.org/D21240.


http://reviews.llvm.org/D21212

Files:
  docs/ReleaseNotes.rst
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td

Index: include/clang/Basic/AttrDocs.td
===
--- include/clang/Basic/AttrDocs.td
+++ include/clang/Basic/AttrDocs.td
@@ -2433,3 +2433,18 @@
 See :doc:`LTOVisibility`.
   }];
 }
+
+def RenderScriptKernelAttributeDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+``__attribute__((kernel))`` is used to mark a ``kernel`` function in
+RenderScript.
+
+In RenderScript, ``kernel`` functions are used to express data-parallel
+computation.  The RenderScript runtime efficiently parallelizes ``kernel``
+functions to run on computational resources such as multi-core CPUs and GPUs.
+See the RenderScript_ documentation for more information.
+
+.. _RenderScript: 
https://developer.android.com/guide/topics/renderscript/compute.html
+  }];
+}
Index: include/clang/Basic/Attr.td
===
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -732,7 +732,7 @@
 def RenderScriptKernel : Attr {
   let Spellings = [GNU<"kernel">];
   let Subjects = SubjectList<[Function]>;
-  let Documentation = [Undocumented];
+  let Documentation = [RenderScriptKernelAttributeDocs];
   let LangOpts = [RenderScript];
 }
 
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -84,6 +84,11 @@
 ---
 The -faltivec and -maltivec flags no longer silently include altivec.h on 
Power platforms.
 
+`RenderScript
+`_
+support added to the Frontend and enabled by the '-x renderscript' option or
+the '.rs' file extension.
+
 ...
 
 C11 Feature Support


Index: include/clang/Basic/AttrDocs.td
===
--- include/clang/Basic/AttrDocs.td
+++ include/clang/Basic/AttrDocs.td
@@ -2433,3 +2433,18 @@
 See :doc:`LTOVisibility`.
   }];
 }
+
+def RenderScriptKernelAttributeDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+``__attribute__((kernel))`` is used to mark a ``kernel`` function in
+RenderScript.
+
+In RenderScript, ``kernel`` functions are used to express data-parallel
+computation.  The RenderScript runtime efficiently parallelizes ``kernel``
+functions to run on computational resources such as multi-core CPUs and GPUs.
+See the RenderScript_ documentation for more information.
+
+.. _RenderScript: https://developer.android.com/guide/topics/renderscript/compute.html
+  }];
+}
Index: include/clang/Basic/Attr.td
===
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -732,7 +732,7 @@
 def RenderScriptKernel : Attr {
   let Spellings = [GNU<"kernel">];
   let Subjects = SubjectList<[Function]>;
-  let Documentation = [Undocumented];
+  let Documentation = [RenderScriptKernelAttributeDocs];
   let LangOpts = [RenderScript];
 }
 
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -84,6 +84,11 @@
 ---
 The -faltivec and -maltivec flags no longer silently include altivec.h on Power platforms.
 
+`RenderScript
+`_
+support added to the Frontend and enabled by the '-x renderscript' option or
+the '.rs' file extension.
+
 ...
 
 C11 Feature Support
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r272438 - Revise RenderScript attribute declaration

2016-06-10 Thread Pirama Arumuga Nainar via cfe-commits
Author: pirama
Date: Fri Jun 10 16:51:18 2016
New Revision: 272438

URL: http://llvm.org/viewvc/llvm-project?rev=272438=rev
Log:
Revise RenderScript attribute declaration

Summary:
Address post-patch comments to r272342.

- Rename the 'kernel' attribute's name
- Idiomatically restrict the attribute to the 'RenderScript' LangOpt.

Reviewers: aaron.ballman, rsmith

Subscribers: cfe-commits, srhines

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

Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/Sema/renderscript.rs

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=272438=272437=272438=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Fri Jun 10 16:51:18 2016
@@ -240,6 +240,7 @@ def Borland : LangOpt<"Borland">;
 def CUDA : LangOpt<"CUDA">;
 def COnly : LangOpt<"CPlusPlus", 1>;
 def OpenCL : LangOpt<"OpenCL">;
+def RenderScript : LangOpt<"RenderScript">;
 
 // Defines targets for target-specific attributes. The list of strings should
 // specify architectures for which the target applies, based off the ArchType
@@ -728,10 +729,11 @@ def OpenCLNoSVM : Attr {
   let ASTNode = 0;
 }
 
-def Kernel : Attr {
+def RenderScriptKernel : Attr {
   let Spellings = [GNU<"kernel">];
   let Subjects = SubjectList<[Function]>;
   let Documentation = [Undocumented];
+  let LangOpts = [RenderScript];
 }
 
 def Deprecated : InheritableAttr {

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=272438=272437=272438=diff
==
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Jun 10 16:51:18 2016
@@ -4185,17 +4185,6 @@ static void handleTypeTagForDatatypeAttr
 Attr.getAttributeSpellingListIndex()));
 }
 
-static void handleKernelAttr(Sema , Decl *D, const AttributeList ) {
-  if (S.LangOpts.RenderScript) {
-D->addAttr(::new (S.Context)
-   KernelAttr(Attr.getRange(), S.Context,
-  Attr.getAttributeSpellingListIndex()));
-  } else {
-S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "kernel";
-  }
-}
-
-
 
//===--===//
 // Checker-specific attribute handlers.
 
//===--===//
@@ -5925,8 +5914,8 @@ static void ProcessDeclAttribute(Sema 
 handleTypeTagForDatatypeAttr(S, D, Attr);
 break;
 
-  case AttributeList::AT_Kernel:
-handleKernelAttr(S, D, Attr);
+  case AttributeList::AT_RenderScriptKernel:
+handleSimpleAttribute(S, D, Attr);
 break;
   }
 }

Modified: cfe/trunk/test/Sema/renderscript.rs
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/renderscript.rs?rev=272438=272437=272438=diff
==
--- cfe/trunk/test/Sema/renderscript.rs (original)
+++ cfe/trunk/test/Sema/renderscript.rs Fri Jun 10 16:51:18 2016
@@ -2,11 +2,15 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -x c %s
 
 #ifndef __RENDERSCRIPT__
-// expected-warning@+2 {{kernel attribute ignored}}
+// expected-warning@+2 {{'kernel' attribute ignored}}
 #endif
-void __attribute__((kernel)) kernel();
+void __attribute__((kernel)) kernel() {}
 
-// expected-warning@+1 {{'kernel' attribute only applies to functions}}
+#ifndef __RENDERSCRIPT__
+// expected-warning@+4 {{'kernel' attribute ignored}}
+#else
+// expected-warning@+2 {{'kernel' attribute only applies to functions}}
+#endif
 int __attribute__((kernel)) global;
 
 #ifndef __RENDERSCRIPT__


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21240: Revise RenderScript attribute declaration

2016-06-10 Thread Pirama Arumuga Nainar via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272438: Revise RenderScript attribute declaration (authored 
by pirama).

Changed prior to commit:
  http://reviews.llvm.org/D21240?vs=60397=60411#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21240

Files:
  cfe/trunk/include/clang/Basic/Attr.td
  cfe/trunk/lib/Sema/SemaDeclAttr.cpp
  cfe/trunk/test/Sema/renderscript.rs

Index: cfe/trunk/include/clang/Basic/Attr.td
===
--- cfe/trunk/include/clang/Basic/Attr.td
+++ cfe/trunk/include/clang/Basic/Attr.td
@@ -240,6 +240,7 @@
 def CUDA : LangOpt<"CUDA">;
 def COnly : LangOpt<"CPlusPlus", 1>;
 def OpenCL : LangOpt<"OpenCL">;
+def RenderScript : LangOpt<"RenderScript">;
 
 // Defines targets for target-specific attributes. The list of strings should
 // specify architectures for which the target applies, based off the ArchType
@@ -728,10 +729,11 @@
   let ASTNode = 0;
 }
 
-def Kernel : Attr {
+def RenderScriptKernel : Attr {
   let Spellings = [GNU<"kernel">];
   let Subjects = SubjectList<[Function]>;
   let Documentation = [Undocumented];
+  let LangOpts = [RenderScript];
 }
 
 def Deprecated : InheritableAttr {
Index: cfe/trunk/test/Sema/renderscript.rs
===
--- cfe/trunk/test/Sema/renderscript.rs
+++ cfe/trunk/test/Sema/renderscript.rs
@@ -2,11 +2,15 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -x c %s
 
 #ifndef __RENDERSCRIPT__
-// expected-warning@+2 {{kernel attribute ignored}}
+// expected-warning@+2 {{'kernel' attribute ignored}}
 #endif
-void __attribute__((kernel)) kernel();
+void __attribute__((kernel)) kernel() {}
 
-// expected-warning@+1 {{'kernel' attribute only applies to functions}}
+#ifndef __RENDERSCRIPT__
+// expected-warning@+4 {{'kernel' attribute ignored}}
+#else
+// expected-warning@+2 {{'kernel' attribute only applies to functions}}
+#endif
 int __attribute__((kernel)) global;
 
 #ifndef __RENDERSCRIPT__
Index: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
===
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp
@@ -4185,17 +4185,6 @@
 Attr.getAttributeSpellingListIndex()));
 }
 
-static void handleKernelAttr(Sema , Decl *D, const AttributeList ) {
-  if (S.LangOpts.RenderScript) {
-D->addAttr(::new (S.Context)
-   KernelAttr(Attr.getRange(), S.Context,
-  Attr.getAttributeSpellingListIndex()));
-  } else {
-S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "kernel";
-  }
-}
-
-
 
//===--===//
 // Checker-specific attribute handlers.
 
//===--===//
@@ -5925,8 +5914,8 @@
 handleTypeTagForDatatypeAttr(S, D, Attr);
 break;
 
-  case AttributeList::AT_Kernel:
-handleKernelAttr(S, D, Attr);
+  case AttributeList::AT_RenderScriptKernel:
+handleSimpleAttribute(S, D, Attr);
 break;
   }
 }


Index: cfe/trunk/include/clang/Basic/Attr.td
===
--- cfe/trunk/include/clang/Basic/Attr.td
+++ cfe/trunk/include/clang/Basic/Attr.td
@@ -240,6 +240,7 @@
 def CUDA : LangOpt<"CUDA">;
 def COnly : LangOpt<"CPlusPlus", 1>;
 def OpenCL : LangOpt<"OpenCL">;
+def RenderScript : LangOpt<"RenderScript">;
 
 // Defines targets for target-specific attributes. The list of strings should
 // specify architectures for which the target applies, based off the ArchType
@@ -728,10 +729,11 @@
   let ASTNode = 0;
 }
 
-def Kernel : Attr {
+def RenderScriptKernel : Attr {
   let Spellings = [GNU<"kernel">];
   let Subjects = SubjectList<[Function]>;
   let Documentation = [Undocumented];
+  let LangOpts = [RenderScript];
 }
 
 def Deprecated : InheritableAttr {
Index: cfe/trunk/test/Sema/renderscript.rs
===
--- cfe/trunk/test/Sema/renderscript.rs
+++ cfe/trunk/test/Sema/renderscript.rs
@@ -2,11 +2,15 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -x c %s
 
 #ifndef __RENDERSCRIPT__
-// expected-warning@+2 {{kernel attribute ignored}}
+// expected-warning@+2 {{'kernel' attribute ignored}}
 #endif
-void __attribute__((kernel)) kernel();
+void __attribute__((kernel)) kernel() {}
 
-// expected-warning@+1 {{'kernel' attribute only applies to functions}}
+#ifndef __RENDERSCRIPT__
+// expected-warning@+4 {{'kernel' attribute ignored}}
+#else
+// expected-warning@+2 {{'kernel' attribute only applies to functions}}
+#endif
 int __attribute__((kernel)) global;
 
 #ifndef __RENDERSCRIPT__
Index: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
===
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp
@@ -4185,17 +4185,6 @@

Re: [PATCH] D20602: Add .rgba syntax extension to ext_vector_type types

2016-06-10 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: include/clang/Basic/DiagnosticSemaKinds.td:7900
@@ -7897,1 +7899,3 @@
+def err_opencl_ext_vector_type_rgba_selector: Error<
+  "vector component name '%0' cannot be used earlier than OpenCL version 2.2">;
 } // end of sema category

I don't see any good reason to reject this in earlier versions of OpenCL. Clang 
has its own extensions and is not beholden to the OpenCL spec's notion of 
extensions in this regard. Generally, wherever reasonable, we support features 
from later versions of a language as extensions in earlier versions.

However, since "extension" means something in the OpenCL specification, we 
could say "OpenCL 2.2 feature" rather than "OpenCL 2.2 extension" in the 
ExtWarn message.


Comment at: lib/Sema/SemaExprMember.cpp:337-339
@@ +336,5 @@
+  if (S.getLangOpts().OpenCL && S.getLangOpts().OpenCLVersion < 220) {
+const char *diagBegin = HasRGBA ? CompName->getNameStart() : compStr;
+S.Diag(OpLoc, diag::err_opencl_ext_vector_type_rgba_selector)
+  << StringRef(diagBegin, 1)
+  << S.getLangOpts().OpenCLVersion << SourceRange(CompLoc);

diagBegin -> DiagBegin


http://reviews.llvm.org/D20602



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16948: [libcxx] Filesystem TS -- Complete

2016-06-10 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

@mclow.lists Just a reminder that 3.9 branches for release on July 19th.


http://reviews.llvm.org/D16948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r245719 - Properly provide alignment of 'byval' arguments down to llvm.

2016-06-10 Thread David Blaikie via cfe-commits
That was certainly one of the counterarguments (& global variables also use
a type rather than a size). I've not really settled on which way to
go/haven't given it lots of thought. I may loop back around to the original
thread when it comes to that.

On Fri, Jun 10, 2016 at 2:18 PM, James Y Knight  wrote:

> Yes, it was intended to -- at least for bitcode produced by clang.
>
> I do think it would be a good idea to continue to pass the value type to
> byval, though...Either that or get rid of the type in the "alloca"
> instruction. They're basically doing the same thing, and having them
> specified completely differently seems unfortunate.
>
> On Fri, Jun 10, 2016 at 4:58 PM, David Blaikie  wrote:
>
>> Excuse the necromancy, but do you know if this change (or other work you
>> did in this area) completely eclipsed LLVM's use of inferred alignment via
>> the llvm struct's alignment for byval arguments?
>>
>> I ask because this was something I was going to need to fix for the
>> typeless pointer work & I have some outdated patches, etc, that I can throw
>> away if that's the case (at least it looks like it touched most of the
>> places my patch did).
>>
>> (I'll still need to remove the pointer type in favor of a number of bytes
>> for byval (byval to copy (or moving the type from the argument's pointer
>> type, into a parameter to byval, eg: %ptr byval(struct_foo) %arg) but
>> knowing the alignment's totally handled would be a good first step in that
>> work)
>>
>> On Fri, Aug 21, 2015 at 11:19 AM, James Y Knight via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: jyknight
>>> Date: Fri Aug 21 13:19:06 2015
>>> New Revision: 245719
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=245719=rev
>>> Log:
>>> Properly provide alignment of 'byval' arguments down to llvm.
>>>
>>> This is important in the case that the LLVM-inferred llvm-struct
>>> alignment is not the same as the clang-known C-struct alignment.
>>>
>>> Differential Revision: http://reviews.llvm.org/D12243
>>>
>>> Added:
>>> cfe/trunk/test/CodeGen/sparc-arguments.c
>>> Modified:
>>> cfe/trunk/lib/CodeGen/CGCall.cpp
>>> cfe/trunk/test/CodeGen/le32-arguments.c
>>> cfe/trunk/test/CodeGen/nvptx-abi.c
>>>
>>> Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=245719=245718=245719=diff
>>>
>>> ==
>>> --- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGCall.cpp Fri Aug 21 13:19:06 2015
>>> @@ -1663,20 +1663,35 @@ void CodeGenModule::ConstructAttributeLi
>>>  Attrs.addAttribute(llvm::Attribute::InReg);
>>>break;
>>>
>>> -case ABIArgInfo::Indirect:
>>> +case ABIArgInfo::Indirect: {
>>>if (AI.getInReg())
>>>  Attrs.addAttribute(llvm::Attribute::InReg);
>>>
>>>if (AI.getIndirectByVal())
>>>  Attrs.addAttribute(llvm::Attribute::ByVal);
>>>
>>> -  Attrs.addAlignmentAttr(AI.getIndirectAlign());
>>> +  unsigned Align = AI.getIndirectAlign();
>>> +
>>> +  // In a byval argument, it is important that the required
>>> +  // alignment of the type is honored, as LLVM might be creating a
>>> +  // *new* stack object, and needs to know what alignment to give
>>> +  // it. (Sometimes it can deduce a sensible alignment on its own,
>>> +  // but not if clang decides it must emit a packed struct, or the
>>> +  // user specifies increased alignment requirements.)
>>> +  //
>>> +  // This is different from indirect *not* byval, where the object
>>> +  // exists already, and the align attribute is purely
>>> +  // informative.
>>> +  if (Align == 0 && AI.getIndirectByVal())
>>> +Align =
>>> getContext().getTypeAlignInChars(ParamType).getQuantity();
>>> +
>>> +  Attrs.addAlignmentAttr(Align);
>>>
>>>// byval disables readnone and readonly.
>>>FuncAttrs.removeAttribute(llvm::Attribute::ReadOnly)
>>>  .removeAttribute(llvm::Attribute::ReadNone);
>>>break;
>>> -
>>> +}
>>>  case ABIArgInfo::Ignore:
>>>  case ABIArgInfo::Expand:
>>>continue;
>>>
>>> Modified: cfe/trunk/test/CodeGen/le32-arguments.c
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/le32-arguments.c?rev=245719=245718=245719=diff
>>>
>>> ==
>>> --- cfe/trunk/test/CodeGen/le32-arguments.c (original)
>>> +++ cfe/trunk/test/CodeGen/le32-arguments.c Fri Aug 21 13:19:06 2015
>>> @@ -10,7 +10,7 @@ typedef struct {
>>>int bb;
>>>  } s1;
>>>  // Structs should be passed byval and not split up
>>> -// CHECK-LABEL: define void @f1(%struct.s1* byval %i)
>>> +// CHECK-LABEL: define void @f1(%struct.s1* byval align 4 %i)
>>>  void f1(s1 i) {}
>>>
>>>  typedef struct {
>>> @@ -48,7 +48,7 @@ union 

Re: r245719 - Properly provide alignment of 'byval' arguments down to llvm.

2016-06-10 Thread James Y Knight via cfe-commits
Yes, it was intended to -- at least for bitcode produced by clang.

I do think it would be a good idea to continue to pass the value type to
byval, though...Either that or get rid of the type in the "alloca"
instruction. They're basically doing the same thing, and having them
specified completely differently seems unfortunate.

On Fri, Jun 10, 2016 at 4:58 PM, David Blaikie  wrote:

> Excuse the necromancy, but do you know if this change (or other work you
> did in this area) completely eclipsed LLVM's use of inferred alignment via
> the llvm struct's alignment for byval arguments?
>
> I ask because this was something I was going to need to fix for the
> typeless pointer work & I have some outdated patches, etc, that I can throw
> away if that's the case (at least it looks like it touched most of the
> places my patch did).
>
> (I'll still need to remove the pointer type in favor of a number of bytes
> for byval (byval to copy (or moving the type from the argument's pointer
> type, into a parameter to byval, eg: %ptr byval(struct_foo) %arg) but
> knowing the alignment's totally handled would be a good first step in that
> work)
>
> On Fri, Aug 21, 2015 at 11:19 AM, James Y Knight via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: jyknight
>> Date: Fri Aug 21 13:19:06 2015
>> New Revision: 245719
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=245719=rev
>> Log:
>> Properly provide alignment of 'byval' arguments down to llvm.
>>
>> This is important in the case that the LLVM-inferred llvm-struct
>> alignment is not the same as the clang-known C-struct alignment.
>>
>> Differential Revision: http://reviews.llvm.org/D12243
>>
>> Added:
>> cfe/trunk/test/CodeGen/sparc-arguments.c
>> Modified:
>> cfe/trunk/lib/CodeGen/CGCall.cpp
>> cfe/trunk/test/CodeGen/le32-arguments.c
>> cfe/trunk/test/CodeGen/nvptx-abi.c
>>
>> Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=245719=245718=245719=diff
>>
>> ==
>> --- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGCall.cpp Fri Aug 21 13:19:06 2015
>> @@ -1663,20 +1663,35 @@ void CodeGenModule::ConstructAttributeLi
>>  Attrs.addAttribute(llvm::Attribute::InReg);
>>break;
>>
>> -case ABIArgInfo::Indirect:
>> +case ABIArgInfo::Indirect: {
>>if (AI.getInReg())
>>  Attrs.addAttribute(llvm::Attribute::InReg);
>>
>>if (AI.getIndirectByVal())
>>  Attrs.addAttribute(llvm::Attribute::ByVal);
>>
>> -  Attrs.addAlignmentAttr(AI.getIndirectAlign());
>> +  unsigned Align = AI.getIndirectAlign();
>> +
>> +  // In a byval argument, it is important that the required
>> +  // alignment of the type is honored, as LLVM might be creating a
>> +  // *new* stack object, and needs to know what alignment to give
>> +  // it. (Sometimes it can deduce a sensible alignment on its own,
>> +  // but not if clang decides it must emit a packed struct, or the
>> +  // user specifies increased alignment requirements.)
>> +  //
>> +  // This is different from indirect *not* byval, where the object
>> +  // exists already, and the align attribute is purely
>> +  // informative.
>> +  if (Align == 0 && AI.getIndirectByVal())
>> +Align =
>> getContext().getTypeAlignInChars(ParamType).getQuantity();
>> +
>> +  Attrs.addAlignmentAttr(Align);
>>
>>// byval disables readnone and readonly.
>>FuncAttrs.removeAttribute(llvm::Attribute::ReadOnly)
>>  .removeAttribute(llvm::Attribute::ReadNone);
>>break;
>> -
>> +}
>>  case ABIArgInfo::Ignore:
>>  case ABIArgInfo::Expand:
>>continue;
>>
>> Modified: cfe/trunk/test/CodeGen/le32-arguments.c
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/le32-arguments.c?rev=245719=245718=245719=diff
>>
>> ==
>> --- cfe/trunk/test/CodeGen/le32-arguments.c (original)
>> +++ cfe/trunk/test/CodeGen/le32-arguments.c Fri Aug 21 13:19:06 2015
>> @@ -10,7 +10,7 @@ typedef struct {
>>int bb;
>>  } s1;
>>  // Structs should be passed byval and not split up
>> -// CHECK-LABEL: define void @f1(%struct.s1* byval %i)
>> +// CHECK-LABEL: define void @f1(%struct.s1* byval align 4 %i)
>>  void f1(s1 i) {}
>>
>>  typedef struct {
>> @@ -48,7 +48,7 @@ union simple_union {
>>char b;
>>  };
>>  // Unions should be passed as byval structs
>> -// CHECK-LABEL: define void @f7(%union.simple_union* byval %s)
>> +// CHECK-LABEL: define void @f7(%union.simple_union* byval align 4 %s)
>>  void f7(union simple_union s) {}
>>
>>  typedef struct {
>> @@ -57,5 +57,5 @@ typedef struct {
>>int b8 : 8;
>>  } bitfield1;
>>  // Bitfields should be passed as byval structs
>> -// CHECK-LABEL: define void 

Re: r245719 - Properly provide alignment of 'byval' arguments down to llvm.

2016-06-10 Thread David Blaikie via cfe-commits
Excuse the necromancy, but do you know if this change (or other work you
did in this area) completely eclipsed LLVM's use of inferred alignment via
the llvm struct's alignment for byval arguments?

I ask because this was something I was going to need to fix for the
typeless pointer work & I have some outdated patches, etc, that I can throw
away if that's the case (at least it looks like it touched most of the
places my patch did).

(I'll still need to remove the pointer type in favor of a number of bytes
for byval (byval to copy (or moving the type from the argument's pointer
type, into a parameter to byval, eg: %ptr byval(struct_foo) %arg) but
knowing the alignment's totally handled would be a good first step in that
work)

On Fri, Aug 21, 2015 at 11:19 AM, James Y Knight via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: jyknight
> Date: Fri Aug 21 13:19:06 2015
> New Revision: 245719
>
> URL: http://llvm.org/viewvc/llvm-project?rev=245719=rev
> Log:
> Properly provide alignment of 'byval' arguments down to llvm.
>
> This is important in the case that the LLVM-inferred llvm-struct
> alignment is not the same as the clang-known C-struct alignment.
>
> Differential Revision: http://reviews.llvm.org/D12243
>
> Added:
> cfe/trunk/test/CodeGen/sparc-arguments.c
> Modified:
> cfe/trunk/lib/CodeGen/CGCall.cpp
> cfe/trunk/test/CodeGen/le32-arguments.c
> cfe/trunk/test/CodeGen/nvptx-abi.c
>
> Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=245719=245718=245719=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGCall.cpp Fri Aug 21 13:19:06 2015
> @@ -1663,20 +1663,35 @@ void CodeGenModule::ConstructAttributeLi
>  Attrs.addAttribute(llvm::Attribute::InReg);
>break;
>
> -case ABIArgInfo::Indirect:
> +case ABIArgInfo::Indirect: {
>if (AI.getInReg())
>  Attrs.addAttribute(llvm::Attribute::InReg);
>
>if (AI.getIndirectByVal())
>  Attrs.addAttribute(llvm::Attribute::ByVal);
>
> -  Attrs.addAlignmentAttr(AI.getIndirectAlign());
> +  unsigned Align = AI.getIndirectAlign();
> +
> +  // In a byval argument, it is important that the required
> +  // alignment of the type is honored, as LLVM might be creating a
> +  // *new* stack object, and needs to know what alignment to give
> +  // it. (Sometimes it can deduce a sensible alignment on its own,
> +  // but not if clang decides it must emit a packed struct, or the
> +  // user specifies increased alignment requirements.)
> +  //
> +  // This is different from indirect *not* byval, where the object
> +  // exists already, and the align attribute is purely
> +  // informative.
> +  if (Align == 0 && AI.getIndirectByVal())
> +Align = getContext().getTypeAlignInChars(ParamType).getQuantity();
> +
> +  Attrs.addAlignmentAttr(Align);
>
>// byval disables readnone and readonly.
>FuncAttrs.removeAttribute(llvm::Attribute::ReadOnly)
>  .removeAttribute(llvm::Attribute::ReadNone);
>break;
> -
> +}
>  case ABIArgInfo::Ignore:
>  case ABIArgInfo::Expand:
>continue;
>
> Modified: cfe/trunk/test/CodeGen/le32-arguments.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/le32-arguments.c?rev=245719=245718=245719=diff
>
> ==
> --- cfe/trunk/test/CodeGen/le32-arguments.c (original)
> +++ cfe/trunk/test/CodeGen/le32-arguments.c Fri Aug 21 13:19:06 2015
> @@ -10,7 +10,7 @@ typedef struct {
>int bb;
>  } s1;
>  // Structs should be passed byval and not split up
> -// CHECK-LABEL: define void @f1(%struct.s1* byval %i)
> +// CHECK-LABEL: define void @f1(%struct.s1* byval align 4 %i)
>  void f1(s1 i) {}
>
>  typedef struct {
> @@ -48,7 +48,7 @@ union simple_union {
>char b;
>  };
>  // Unions should be passed as byval structs
> -// CHECK-LABEL: define void @f7(%union.simple_union* byval %s)
> +// CHECK-LABEL: define void @f7(%union.simple_union* byval align 4 %s)
>  void f7(union simple_union s) {}
>
>  typedef struct {
> @@ -57,5 +57,5 @@ typedef struct {
>int b8 : 8;
>  } bitfield1;
>  // Bitfields should be passed as byval structs
> -// CHECK-LABEL: define void @f8(%struct.bitfield1* byval %bf1)
> +// CHECK-LABEL: define void @f8(%struct.bitfield1* byval align 4 %bf1)
>  void f8(bitfield1 bf1) {}
>
> Modified: cfe/trunk/test/CodeGen/nvptx-abi.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/nvptx-abi.c?rev=245719=245718=245719=diff
>
> ==
> --- cfe/trunk/test/CodeGen/nvptx-abi.c (original)
> +++ cfe/trunk/test/CodeGen/nvptx-abi.c Fri Aug 21 13:19:06 2015
> @@ -21,14 +21,14 @@ float bar(void) {
>
>  void 

Re: [PATCH] D20498: [Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr

2016-06-10 Thread Tim Shen via cfe-commits
timshen reopened this revision.
timshen added a comment.
This revision is now accepted and ready to land.

Clang-tidy is broken by this change. Dependency is added to track the fix.


Repository:
  rL LLVM

http://reviews.llvm.org/D20498



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D21243: Fix clang-tidy patterns to adapt to newly added ExprWithCleanups nodes.

2016-06-10 Thread Tim Shen via cfe-commits
timshen created this revision.
timshen added a reviewer: rsmith.
timshen added a subscriber: cfe-commits.

This is a fix for the new ExprWithCleanups introduced by clang's temporary 
variable lifetime marks change.

http://reviews.llvm.org/D21243

Files:
  clang-tidy/llvm/TwineLocalCheck.cpp
  clang-tidy/misc/DanglingHandleCheck.cpp
  clang-tidy/modernize/LoopConvertCheck.cpp
  clang-tidy/modernize/LoopConvertUtils.cpp
  clang-tidy/modernize/UseAutoCheck.cpp
  clang-tidy/readability/RedundantStringInitCheck.cpp

Index: clang-tidy/readability/RedundantStringInitCheck.cpp
===
--- clang-tidy/readability/RedundantStringInitCheck.cpp
+++ clang-tidy/readability/RedundantStringInitCheck.cpp
@@ -48,12 +48,13 @@
   // string foo = "";
   // string bar("");
   Finder->addMatcher(
-  namedDecl(varDecl(hasType(cxxRecordDecl(hasName("basic_string"))),
-hasInitializer(
-expr(anyOf(EmptyStringCtorExpr,
-   EmptyStringCtorExprWithTemporaries))
-.bind("expr"))),
-unless(parmVarDecl()))
+  namedDecl(
+  varDecl(hasType(cxxRecordDecl(hasName("basic_string"))),
+  hasInitializer(expr(ignoringExprWithCleanups(anyOf(
+  EmptyStringCtorExpr,
+  EmptyStringCtorExprWithTemporaries)))
+ .bind("expr"))),
+  unless(parmVarDecl()))
   .bind("decl"),
   this);
 }
Index: clang-tidy/modernize/UseAutoCheck.cpp
===
--- clang-tidy/modernize/UseAutoCheck.cpp
+++ clang-tidy/modernize/UseAutoCheck.cpp
@@ -42,6 +42,9 @@
   if (!Init)
 return false;
 
+  if (const auto *E = dyn_cast(Init))
+Init = E->getSubExpr();
+
   // The following test is based on DeclPrinter::VisitVarDecl() to find if an
   // initializer is implicit or not.
   if (const auto *Construct = dyn_cast(Init)) {
Index: clang-tidy/modernize/LoopConvertUtils.cpp
===
--- clang-tidy/modernize/LoopConvertUtils.cpp
+++ clang-tidy/modernize/LoopConvertUtils.cpp
@@ -156,6 +156,8 @@
 const Expr *digThroughConstructors(const Expr *E) {
   if (!E)
 return nullptr;
+  if (auto Cleanups = dyn_cast(E))
+E = Cleanups->getSubExpr();
   E = E->IgnoreParenImpCasts();
   if (const auto *ConstructExpr = dyn_cast(E)) {
 // The initial constructor must take exactly one parameter, but base class
Index: clang-tidy/modernize/LoopConvertCheck.cpp
===
--- clang-tidy/modernize/LoopConvertCheck.cpp
+++ clang-tidy/modernize/LoopConvertCheck.cpp
@@ -141,10 +141,10 @@
   StatementMatcher IteratorComparisonMatcher = expr(
   ignoringParenImpCasts(declRefExpr(to(varDecl().bind(ConditionVarName);
 
-  StatementMatcher OverloadedNEQMatcher =
+  StatementMatcher OverloadedNEQMatcher = ignoringExprWithCleanups(
   cxxOperatorCallExpr(hasOverloadedOperatorName("!="), argumentCountIs(2),
   hasArgument(0, IteratorComparisonMatcher),
-  hasArgument(1, IteratorBoundMatcher));
+  hasArgument(1, IteratorBoundMatcher)));
 
   // This matcher tests that a declaration is a CXXRecordDecl that has an
   // overloaded operator*(). If the operator*() returns by value instead of by
Index: clang-tidy/misc/DanglingHandleCheck.cpp
===
--- clang-tidy/misc/DanglingHandleCheck.cpp
+++ clang-tidy/misc/DanglingHandleCheck.cpp
@@ -135,15 +135,15 @@
   //   1. Value to Handle conversion.
   //   2. Handle copy construction.
   // We have to match both.
-  has(ignoringParenImpCasts(handleFrom(
+  has(ignoringExprWithCleanups(ignoringParenImpCasts(handleFrom(
   IsAHandle,
   handleFrom(IsAHandle, declRefExpr(to(varDecl(
 // Is function scope ...
 hasAutomaticStorageDuration(),
 // ... and it is a local array or Value.
 anyOf(hasType(arrayType()),
   hasType(recordDecl(
-  unless(IsAHandle))),
+  unless(IsAHandle,
   // Temporary fix for false positives inside lambdas.
   unless(hasAncestor(lambdaExpr(
   .bind("bad_stmt"),
Index: clang-tidy/llvm/TwineLocalCheck.cpp
===
--- clang-tidy/llvm/TwineLocalCheck.cpp
+++ clang-tidy/llvm/TwineLocalCheck.cpp
@@ 

Re: r272342 - RenderScript support in the Frontend

2016-06-10 Thread Pirama Arumuga Nainar via cfe-commits
Uploaded http://reviews.llvm.org/D21240 with the requested changes.

On Fri, Jun 10, 2016 at 7:39 AM, Aaron Ballman 
wrote:

> > +def Kernel : Attr {
>
> Please rename this to RenderScriptKernel. We have another attribute
> that is spelled "kernel" already, and we want to distinguish between
> them to reduce confusion.
>

Addressed in the above patch.

>
> > +  let Spellings = [GNU<"kernel">];
>
> Is there a reason this isn't also spelled with a C++ attribute spelling?


RenderScript is a C99 variant and the C++ spelling is not needed/supported.


>
>
> +static void handleKernelAttr(Sema , Decl *D, const AttributeList
> ) {
> > +  if (S.LangOpts.RenderScript) {
> > +D->addAttr(::new (S.Context)
> > +   KernelAttr(Attr.getRange(), S.Context,
> > +  Attr.getAttributeSpellingListIndex()));
> > +  } else {
> > +S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "kernel";
> > +  }
>
> This is the wrong way to handle this; please add a LangOpt subclass in
> Attr.td and make this a target-specific attribute there.
>
>
Addressed in the above patch.


>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D21241: Add an ASTMatcher for ignoring ExprWithCleanups.

2016-06-10 Thread Tim Shen via cfe-commits
timshen created this revision.
timshen added a reviewer: rsmith.
timshen added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

This is part of the fix of clang-tidy patterns to adapt to newly added 
ExprWithCleanups node.

http://reviews.llvm.org/D21241

Files:
  include/clang/ASTMatchers/ASTMatchers.h

Index: include/clang/ASTMatchers/ASTMatchers.h
===
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -625,6 +625,16 @@
   return InnerMatcher.matches(*Node.IgnoreParenImpCasts(), Finder, Builder);
 }
 
+/// \brief Matches expressions that match InnerMatcher after ExprWithCleanups
+/// are stripped off.
+AST_MATCHER_P(Expr, ignoringExprWithCleanups, internal::Matcher,
+  InnerMatcher) {
+  auto E = 
+  if (auto Cleanups = dyn_cast(E))
+E = Cleanups->getSubExpr();
+  return InnerMatcher.matches(*E, Finder, Builder);
+}
+
 /// \brief Matches types that match InnerMatcher after any parens are stripped.
 ///
 /// Given


Index: include/clang/ASTMatchers/ASTMatchers.h
===
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -625,6 +625,16 @@
   return InnerMatcher.matches(*Node.IgnoreParenImpCasts(), Finder, Builder);
 }
 
+/// \brief Matches expressions that match InnerMatcher after ExprWithCleanups
+/// are stripped off.
+AST_MATCHER_P(Expr, ignoringExprWithCleanups, internal::Matcher,
+  InnerMatcher) {
+  auto E = 
+  if (auto Cleanups = dyn_cast(E))
+E = Cleanups->getSubExpr();
+  return InnerMatcher.matches(*E, Finder, Builder);
+}
+
 /// \brief Matches types that match InnerMatcher after any parens are stripped.
 ///
 /// Given
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module

2016-06-10 Thread Yaxun Liu via cfe-commits
yaxunl added inline comments.


Comment at: test/Headers/opencl-c-header.cl:53-54
@@ +52,4 @@
+// RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -o - 
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t -fdisable-module-hash -ftime-report %s 2>&1 | FileCheck 
--check-prefix=CHECK --check-prefix=CHECK-MOD %s
+// RUN: chmod u+w %t/opencl_c.pcm
+// RUN: mv %t/opencl_c.pcm %t/1_0.pcm
+

I checked the size of the pch file. The largest chunk is for function 
declarations. Since it contains about 30k declarations, each one is about 50 
bytes on average, so total size is about 1.6MB.

The AST of function decl is written by ASTDeclWriter::VisitFunctionDecl 
http://clang.llvm.org/doxygen/ASTWriterDecl_8cpp_source.html 

A code snippet is as follows:

 515   Record.push_back((int)D->SClass); // FIXME: stable encoding
  516   Record.push_back(D->IsInline);
  517   Record.push_back(D->IsInlineSpecified);
  518   Record.push_back(D->IsVirtualAsWritten);
  519   Record.push_back(D->IsPure);
  520   Record.push_back(D->HasInheritedPrototype);
  521   Record.push_back(D->HasWrittenPrototype);
  522   Record.push_back(D->IsDeleted);
  523   Record.push_back(D->IsTrivial);
  524   Record.push_back(D->IsDefaulted);
  525   Record.push_back(D->IsExplicitlyDefaulted);
  526   Record.push_back(D->HasImplicitReturnZero);
  527   Record.push_back(D->IsConstexpr);
  528   Record.push_back(D->HasSkippedBody);
  529   Record.push_back(D->IsLateTemplateParsed);
  530   Record.push_back(D->getLinkageInternal());
  531   Record.AddSourceLocation(D->getLocEnd());

Record is like a buffer which will be written to file. It uses a vector of 
int64 to store the values, so it takes space.


http://reviews.llvm.org/D20444



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r271883 - [clang-format] make header guard identification stricter (with Lexer).

2016-06-10 Thread Mehdi Amini via cfe-commits
Hi Eric,

> On Jun 6, 2016, at 4:00 AM, Eric Liu via cfe-commits 
>  wrote:
> 
> Author: ioeric
> Date: Mon Jun  6 06:00:13 2016
> New Revision: 271883
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=271883=rev
> Log:
> [clang-format] make header guard identification stricter (with Lexer).
> 
> Summary: make header guard identification stricter with Lexer.
> 
> Reviewers: djasper
> 
> Subscribers: klimek, cfe-commits
> 
> Differential Revision: http://reviews.llvm.org/D20959
> 
> Modified:
>cfe/trunk/lib/Format/Format.cpp
>cfe/trunk/unittests/Format/CleanupTest.cpp
> 
> Modified: cfe/trunk/lib/Format/Format.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=271883=271882=271883=diff
> ==
> --- cfe/trunk/lib/Format/Format.cpp (original)
> +++ cfe/trunk/lib/Format/Format.cpp Mon Jun  6 06:00:13 2016
> @@ -1436,6 +1436,49 @@ inline bool isHeaderInsertion(const tool
>  llvm::Regex(IncludeRegexPattern).match(Replace.getReplacementText());
> }
> 
> +void skipComments(Lexer , Token ) {
> +  while (Tok.is(tok::comment))
> +if (Lex.LexFromRawLexer(Tok))
> +  return;
> +}
> +
> +// Check if a sequence of tokens is like "# ". If it 
> is,
> +// \p Tok will be the token after this directive; otherwise, it can be any 
> token
> +// after the given \p Tok (including \p Tok).
> +bool checkAndConsumeDirectiveWithName(Lexer , StringRef Name, Token 
> ) {
> +  bool Matched = Tok.is(tok::hash) && !Lex.LexFromRawLexer(Tok) &&
> + Tok.is(tok::raw_identifier) &&
> + Tok.getRawIdentifier() == Name && !Lex.LexFromRawLexer(Tok) 
> &&
> + Tok.is(tok::raw_identifier);
> +  if (Matched)
> +Lex.LexFromRawLexer(Tok);
> +  return Matched;
> +}
> +
> +unsigned getOffsetAfterHeaderGuardsAndComments(StringRef FileName,
> +   StringRef Code,
> +   FormatStyle Style) {


FormatStyle is 360B, did you really intended to pass it by value here?

-- 
Mehdi


> +  std::unique_ptr Env =
> +  Environment::CreateVirtualEnvironment(Code, FileName, /*Ranges=*/{});
> +  const SourceManager  = Env->getSourceManager();
> +  Lexer Lex(Env->getFileID(), SourceMgr.getBuffer(Env->getFileID()), 
> SourceMgr,
> +getFormattingLangOpts(Style));
> +  Token Tok;
> +  // Get the first token.
> +  Lex.LexFromRawLexer(Tok);
> +  skipComments(Lex, Tok);
> +  unsigned AfterComments = SourceMgr.getFileOffset(Tok.getLocation());
> +  if (checkAndConsumeDirectiveWithName(Lex, "ifndef", Tok)) {
> +skipComments(Lex, Tok);
> +if (checkAndConsumeDirectiveWithName(Lex, "define", Tok))
> +  return SourceMgr.getFileOffset(Tok.getLocation());
> +  }
> +  return AfterComments;
> +}
> +
> +// FIXME: we also need to insert a '\n' at the end of the code if we have an
> +// insertion with offset Code.size(), and there is no '\n' at the end of the
> +// code.
> // FIXME: do not insert headers into conditional #include blocks, e.g. 
> #includes
> // surrounded by compile condition "#if...".
> // FIXME: do not insert existing headers.
> @@ -1469,20 +1512,6 @@ fixCppIncludeInsertions(StringRef Code,
>   StringRef FileName = Replaces.begin()->getFilePath();
>   IncludeCategoryManager Categories(Style, FileName);
> 
> -  std::unique_ptr Env =
> -  Environment::CreateVirtualEnvironment(Code, FileName, /*Ranges=*/{});
> -  const SourceManager  = Env->getSourceManager();
> -  Lexer Lex(Env->getFileID(), SourceMgr.getBuffer(Env->getFileID()), 
> SourceMgr,
> -getFormattingLangOpts(Style));
> -  Token Tok;
> -  // All new headers should be inserted after this offset.
> -  int MinInsertOffset = Code.size();
> -  while (!Lex.LexFromRawLexer(Tok)) {
> -if (Tok.isNot(tok::comment)) {
> -  MinInsertOffset = SourceMgr.getFileOffset(Tok.getLocation());
> -  break;
> -}
> -  }
>   // Record the offset of the end of the last include in each category.
>   std::map CategoryEndOffsets;
>   // All possible priorities.
> @@ -1491,26 +1520,25 @@ fixCppIncludeInsertions(StringRef Code,
>   for (const auto  : Style.IncludeCategories)
> Priorities.insert(Category.Priority);
>   int FirstIncludeOffset = -1;
> -  bool HeaderGuardFound = false;
> +  // All new headers should be inserted after this offset.
> +  unsigned MinInsertOffset =
> +  getOffsetAfterHeaderGuardsAndComments(FileName, Code, Style);
>   StringRef TrimmedCode = Code.drop_front(MinInsertOffset);
>   SmallVector Lines;
>   TrimmedCode.split(Lines, '\n');
> -  int Offset = MinInsertOffset;
> +  unsigned Offset = MinInsertOffset;
> +  unsigned NextLineOffset;
>   for (auto Line : Lines) {
> +NextLineOffset = std::min(Code.size(), Offset + Line.size() + 1);
> if (IncludeRegex.match(Line, )) {
>   StringRef IncludeName = Matches[2];
>   int 

r272425 - [-fms-extensions] Don't crash on explicit class-scope specializations & default arguments

2016-06-10 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Fri Jun 10 15:21:15 2016
New Revision: 272425

URL: http://llvm.org/viewvc/llvm-project?rev=272425=rev
Log:
[-fms-extensions] Don't crash on explicit class-scope specializations & default 
arguments

The code had a typo it was doing:
  Param->setUninstantiatedDefaultArg(Param->getUninstantiatedDefaultArg());

This is a no-op but may assert, we wanted to do:
  Param->setUninstantiatedDefaultArg(OldParam->getUninstantiatedDefaultArg());

This fixes PR28082.

Modified:
cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
cfe/trunk/test/SemaTemplate/ms-function-specialization-class-scope.cpp

Modified: cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp?rev=272425=272424=272425=diff
==
--- cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp (original)
+++ cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp Fri Jun 10 15:21:15 2016
@@ -381,7 +381,7 @@ void Parser::ParseLexedMethodDeclaration
   assert (!OldParam->hasUnparsedDefaultArg());
   if (OldParam->hasUninstantiatedDefaultArg())
 Param->setUninstantiatedDefaultArg(
-  Param->getUninstantiatedDefaultArg());
+OldParam->getUninstantiatedDefaultArg());
   else
 Param->setDefaultArg(OldParam->getInit());
 }

Modified: cfe/trunk/test/SemaTemplate/ms-function-specialization-class-scope.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/ms-function-specialization-class-scope.cpp?rev=272425=272424=272425=diff
==
--- cfe/trunk/test/SemaTemplate/ms-function-specialization-class-scope.cpp 
(original)
+++ cfe/trunk/test/SemaTemplate/ms-function-specialization-class-scope.cpp Fri 
Jun 10 15:21:15 2016
@@ -75,3 +75,12 @@ namespace Duplicates {
   // here.
   template struct A;
 }
+
+namespace PR28082 {
+struct S {
+  template 
+  int f(int = 0);
+  template <>
+  int f<0>(int); // expected-warning {{Microsoft extension}}
+};
+}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21212: Add documentation for RenderScript changes

2016-06-10 Thread Pirama Arumuga Nainar via cfe-commits
pirama updated this revision to Diff 60394.
pirama added a comment.

Expand description of RenderScript kernel functions.


http://reviews.llvm.org/D21212

Files:
  docs/ReleaseNotes.rst
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td

Index: include/clang/Basic/AttrDocs.td
===
--- include/clang/Basic/AttrDocs.td
+++ include/clang/Basic/AttrDocs.td
@@ -2433,3 +2433,18 @@
 See :doc:`LTOVisibility`.
   }];
 }
+
+def RenderScriptKernelAttributeDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+``__attribute__((kernel))`` is used to mark a ``kernel`` function in
+RenderScript.
+
+In RenderScript, ``kernel`` functions are used to express data-parallel
+computation.  The RenderScript runtime efficiently parallelizes ``kernel``
+functions to run on computational resources such as multi-core CPUs and GPUs.
+See the RenderScript_ documentation for more information.
+
+.. _RenderScript: 
https://developer.android.com/guide/topics/renderscript/compute.html
+  }];
+}
Index: include/clang/Basic/Attr.td
===
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -731,7 +731,7 @@
 def Kernel : Attr {
   let Spellings = [GNU<"kernel">];
   let Subjects = SubjectList<[Function]>;
-  let Documentation = [Undocumented];
+  let Documentation = [RenderScriptKernelAttributeDocs];
 }
 
 def Deprecated : InheritableAttr {
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -84,6 +84,11 @@
 ---
 The -faltivec and -maltivec flags no longer silently include altivec.h on 
Power platforms.
 
+`RenderScript
+`_
+support added to the Frontend and enabled by the '-x renderscript' option or
+the '.rs' file extension.
+
 ...
 
 C11 Feature Support


Index: include/clang/Basic/AttrDocs.td
===
--- include/clang/Basic/AttrDocs.td
+++ include/clang/Basic/AttrDocs.td
@@ -2433,3 +2433,18 @@
 See :doc:`LTOVisibility`.
   }];
 }
+
+def RenderScriptKernelAttributeDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+``__attribute__((kernel))`` is used to mark a ``kernel`` function in
+RenderScript.
+
+In RenderScript, ``kernel`` functions are used to express data-parallel
+computation.  The RenderScript runtime efficiently parallelizes ``kernel``
+functions to run on computational resources such as multi-core CPUs and GPUs.
+See the RenderScript_ documentation for more information.
+
+.. _RenderScript: https://developer.android.com/guide/topics/renderscript/compute.html
+  }];
+}
Index: include/clang/Basic/Attr.td
===
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -731,7 +731,7 @@
 def Kernel : Attr {
   let Spellings = [GNU<"kernel">];
   let Subjects = SubjectList<[Function]>;
-  let Documentation = [Undocumented];
+  let Documentation = [RenderScriptKernelAttributeDocs];
 }
 
 def Deprecated : InheritableAttr {
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -84,6 +84,11 @@
 ---
 The -faltivec and -maltivec flags no longer silently include altivec.h on Power platforms.
 
+`RenderScript
+`_
+support added to the Frontend and enabled by the '-x renderscript' option or
+the '.rs' file extension.
+
 ...
 
 C11 Feature Support
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r272424 - Driver: make it easier to select the SjLj EH model

2016-06-10 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Fri Jun 10 15:12:00 2016
New Revision: 272424

URL: http://llvm.org/viewvc/llvm-project?rev=272424=rev
Log:
Driver: make it easier to select the SjLj EH model

GCC still permits enabling the SjLj EH model.  This is something which can be
done on various targets.  Hoist the -fsjlj-exceptions option into the driver and
pass it through.  This allows one to opt into the alternative EH model while
retaining the default to be the target's default.

Resolves PR27749!

Added:
cfe/trunk/test/Driver/fsjlj-exceptions.c
Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=272424=272423=272424=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Fri Jun 10 15:12:00 2016
@@ -527,8 +527,6 @@ def fblocks_runtime_optional : Flag<["-"
   HelpText<"Weakly link in the blocks runtime">;
 def fexternc_nounwind : Flag<["-"], "fexternc-nounwind">,
   HelpText<"Assume all functions with C linkage do not unwind">;
-def fsjlj_exceptions : Flag<["-"], "fsjlj-exceptions">,
-  HelpText<"Use SjLj style exceptions">;
 def split_dwarf_file : Separate<["-"], "split-dwarf-file">,
   HelpText<"File name to use for split dwarf debug info output">;
 def fno_wchar : Flag<["-"], "fno-wchar">,

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=272424=272423=272424=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Jun 10 15:12:00 2016
@@ -584,6 +584,8 @@ def fencoding_EQ : Joined<["-"], "fencod
 def ferror_limit_EQ : Joined<["-"], "ferror-limit=">, Group, 
Flags<[CoreOption]>;
 def fexceptions : Flag<["-"], "fexceptions">, Group, 
Flags<[CC1Option]>,
   HelpText<"Enable support for exception handling">;
+def fsjlj_exceptions : Flag<["-"], "fsjlj-exceptions">, Group,
+  Flags<[CC1Option]>, HelpText<"Use SjLj style exceptions">;
 def fexcess_precision_EQ : Joined<["-"], "fexcess-precision=">,
 Group;
 def : Flag<["-"], "fexpensive-optimizations">, 
Group;

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=272424=272423=272424=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Jun 10 15:12:00 2016
@@ -5495,7 +5495,8 @@ void Clang::ConstructJob(Compilation ,
 addExceptionArgs(Args, InputType, getToolChain(), KernelOrKext, 
objcRuntime,
  CmdArgs);
 
-  if (getToolChain().UseSjLjExceptions(Args))
+  if (Args.hasArg(options::OPT_fsjlj_exceptions) ||
+  getToolChain().UseSjLjExceptions(Args))
 CmdArgs.push_back("-fsjlj-exceptions");
 
   // C++ "sane" operator new.

Added: cfe/trunk/test/Driver/fsjlj-exceptions.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fsjlj-exceptions.c?rev=272424=auto
==
--- cfe/trunk/test/Driver/fsjlj-exceptions.c (added)
+++ cfe/trunk/test/Driver/fsjlj-exceptions.c Fri Jun 10 15:12:00 2016
@@ -0,0 +1,8 @@
+// RUN: %clang -target armv7-apple-ios -fexceptions -c %s -o /dev/null -### 
2>&1 | FileCheck -check-prefix CHECK-IOS %s
+// RUN: %clang -target i686-windows-gnu -fexceptions -c %s -o /dev/null -### 
2>&1 | FileCheck -check-prefix CHECK-MINGW-DEFAULT %s
+// RUN: %clang -target i686-windows-gnu -fexceptions -fsjlj-exceptions -c %s 
-o /dev/null -### 2>&1 | FileCheck -check-prefix CHECK-MINGW-SJLJ %s
+
+// CHECK-IOS: -fsjlj-exceptions
+// CHECK-MINGW-DEFAULT-NOT: -fsjlj-exceptions
+// CHECK-MINGW-SJLJ: -fsjlj-exceptions
+


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19854: Define Contiki OS toolchain

2016-06-10 Thread Evgeniy Stepanov via cfe-commits
eugenis accepted this revision.
eugenis added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D19854



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module

2016-06-10 Thread Yaxun Liu via cfe-commits
yaxunl marked 2 inline comments as done.


Comment at: test/Headers/opencl-c-header.cl:70
@@ +69,3 @@
+// RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -o - 
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s | FileCheck %s
+// RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -o - -cl-std=CL2.0 
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s | FileCheck --check-prefix=CHECK20 %s
+// RUN: %clang_cc1 -triple amdgcn--amdhsa -emit-llvm -o - -cl-std=CL2.0  
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s | FileCheck --check-prefix=CHECK20 %s

Anastasia wrote:
> yaxunl wrote:
> > I added check to the second compilation to make sure module is read, also 
> > changed the modules to be read only so that they won't be created again.
> Ok, now I see what you are testing here. :)
> 
> Do you think we could add:
>   CHECK-NOT: Reading modules
> 
> For the cases the modules are regenerated new?
In the case the modules are generated as new, Clang will generate the module 
first and then load it. So in the time report, you still see 'Reading modules'.


http://reviews.llvm.org/D20444



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20795: Added ASTStructure for analyzing the structure of Stmts.

2016-06-10 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

Please, pull out the refactor into a separate commit and ask someone who often 
reviews SemaChecking review it.



Comment at: lib/AST/CMakeLists.txt:10
@@ -9,2 +9,3 @@
   ASTImporter.cpp
+  ASTStructure.cpp
   ASTTypeTraits.cpp

Do we want this code to live in the AST library? Who will be the users of this?


http://reviews.llvm.org/D20795



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r272415 - Remove a few gendered pronouns.

2016-06-10 Thread Nico Weber via cfe-commits
Author: nico
Date: Fri Jun 10 13:53:04 2016
New Revision: 272415

URL: http://llvm.org/viewvc/llvm-project?rev=272415=rev
Log:
Remove a few gendered pronouns.

Modified:
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaInit.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=272415=272414=272415=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Fri Jun 10 13:53:04 2016
@@ -5271,7 +5271,7 @@ private:
.getPointer();
 
   // If the variable is a pointer and is being dereferenced (i.e. is not
-  // the last component), the base has to be the pointer itself, not his
+  // the last component), the base has to be the pointer itself, not its
   // reference.
   if (I->getAssociatedDeclaration()->getType()->isAnyPointerType() &&
   std::next(I) != CE) {

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=272415=272414=272415=diff
==
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Jun 10 13:53:04 2016
@@ -4534,10 +4534,9 @@ static void handleObjCRuntimeName(Sema &
  Attr.getAttributeSpellingListIndex()));
 }
 
-// when a user wants to use objc_boxable with a union or struct
-// but she doesn't have access to the declaration (legacy/third-party code)
-// then she can 'enable' this feature via trick with a typedef
-// e.g.:
+// When a user wants to use objc_boxable with a union or struct
+// but they don't have access to the declaration (legacy/third-party code)
+// then they can 'enable' this feature with a typedef:
 // typedef struct __attribute((objc_boxable)) legacy_struct legacy_struct;
 static void handleObjCBoxable(Sema , Decl *D, const AttributeList ) {
   bool notify = false;

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=272415=272414=272415=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Jun 10 13:53:04 2016
@@ -471,7 +471,7 @@ bool Sema::MergeCXXFunctionDecl(Function
   continue;
 }
 
-// We found our guy.
+// We found the right previous declaration.
 break;
   }
 

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=272415=272414=272415=diff
==
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Fri Jun 10 13:53:04 2016
@@ -5950,7 +5950,7 @@ static bool CheckArrow(Sema& S, QualType
 if (const PointerType *Ptr = ObjectType->getAs()) {
   ObjectType = Ptr->getPointeeType();
 } else if (!Base->isTypeDependent()) {
-  // The user wrote "p->" when she probably meant "p."; fix it.
+  // The user wrote "p->" when they probably meant "p."; fix it.
   S.Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
 << ObjectType << true
 << FixItHint::CreateReplacement(OpLoc, ".");

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=272415=272414=272415=diff
==
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Fri Jun 10 13:53:04 2016
@@ -7276,7 +7276,7 @@ bool InitializationSequence::Diagnose(Se
 isa(S.CurContext)) {
   // This is implicit default initialization of a member or
   // base within a constructor. If no viable function was
-  // found, notify the user that she needs to explicitly
+  // found, notify the user that they need to explicitly
   // initialize this base/member.
   CXXConstructorDecl *Constructor
 = cast(S.CurContext);


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20710: Lit C++11 Compatibility Patch #9

2016-06-10 Thread Charles Li via cfe-commits
tigerleapgorge updated this revision to Diff 60385.
tigerleapgorge added a comment.

Forgot to provide context last time.
Last patch was created using command: svn diff
This patch was created using command: svn diff --diff-cmd=diff -x -U99


http://reviews.llvm.org/D20710

Files:
  test/CXX/basic/basic.stc/basic.stc.dynamic/p2-noexceptions.cpp
  test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp
  test/CXX/class.access/class.friend/p1.cpp
  test/CXX/class.access/p4.cpp
  test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp
  test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x-fixits.cpp
  test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
  test/CXX/dcl.decl/dcl.init/p5.cpp
  test/CXX/special/class.dtor/p9.cpp
  test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp
  test/CXX/temp/temp.spec/temp.expl.spec/p4.cpp
  test/CXX/temp/temp.spec/temp.explicit/p4.cpp
  test/CodeGenCXX/debug-info-use-after-free.cpp
  test/CodeGenCXX/dynamic-cast-hint.cpp
  test/OpenMP/distribute_collapse_messages.cpp
  test/OpenMP/ordered_messages.cpp
  test/OpenMP/target_parallel_for_collapse_messages.cpp
  test/OpenMP/target_parallel_for_ordered_messages.cpp
  test/SemaCXX/i-c-e-cxx.cpp
  test/SemaCXX/implicit-virtual-member-functions.cpp
  test/SemaCXX/new-delete.cpp
  test/SemaCXX/no-wchar.cpp
  test/SemaCXX/virtual-member-functions-key-function.cpp
  test/SemaCXX/warn-bool-conversion.cpp
  test/SemaCXX/zero-length-arrays.cpp
  test/SemaTemplate/instantiate-c99.cpp
  test/SemaTemplate/temp_explicit.cpp
  test/SemaTemplate/value-dependent-null-pointer-constant.cpp
  test/SemaTemplate/virtual-member-functions.cpp

Index: test/SemaTemplate/virtual-member-functions.cpp
===
--- test/SemaTemplate/virtual-member-functions.cpp
+++ test/SemaTemplate/virtual-member-functions.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify -std=c++11 %s
 // RUN: %clang_cc1 -triple %ms_abi_triple -DMSABI -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple %ms_abi_triple -DMSABI -fsyntax-only -std=c++98 -verify %s
+// RUN: %clang_cc1 -triple %ms_abi_triple -DMSABI -fsyntax-only -std=c++11 -verify %s
 
 namespace PR5557 {
 template  struct A {
@@ -76,34 +80,74 @@
 }
 
 namespace PR7114 {
-  class A { virtual ~A(); }; // expected-note{{declared private here}}
+  class A { virtual ~A(); };
+#if __cplusplus <= 199711L
+  // expected-note@-2{{declared private here}}
+#else
+  // expected-note@-4 3 {{overridden virtual function is here}}
+#endif
 
   template
   class B {
   public:
-class Inner : public A { }; // expected-error{{base class 'PR7114::A' has private destructor}}
+class Inner : public A { };
+#if __cplusplus <= 199711L
+// expected-error@-2{{base class 'PR7114::A' has private destructor}}
+#else
+// expected-error@-4 2 {{deleted function '~Inner' cannot override a non-deleted function}}
+#ifdef MSABI
+// expected-note@-6 1 {{destructor of 'Inner' is implicitly deleted because base class 'PR7114::A' has an inaccessible destructor}}
+#endif
+#endif
+
 static Inner i;
 static const unsigned value = sizeof(i) == 4;
+#if __cplusplus >= 201103L
+// expected-note@-2 {{in instantiation of member class 'PR7114::B::Inner' requested here}}
+// expected-note@-3 {{in instantiation of member class 'PR7114::B::Inner' requested here}}
+#endif
   };
 
   int f() { return B::value; }
+#if __cplusplus >= 201103L
+// expected-note@-2 {{in instantiation of template class 'PR7114::B' requested here}}
+#endif
 
 #ifdef MSABI
-  void test_typeid(B::Inner bfi) { // expected-note{{implicit destructor}}
+  void test_typeid(B::Inner bfi) {
+#if __cplusplus <= 199711L
+// expected-note@-2 {{implicit destructor}}
+#else
+// expected-error@-4 {{attempt to use a deleted function}}
+// expected-note@-5 {{in instantiation of template class 'PR7114::B' requested here}}
+#endif
+
 (void)typeid(bfi);
 #else
   void test_typeid(B::Inner bfi) {
-(void)typeid(bfi); // expected-note{{implicit destructor}}
+#if __cplusplus >= 201103L
+// expected-note@-2 {{in instantiation of template class 'PR7114::B' requested here}}
+#endif
+(void)typeid(bfi);
+#if __cplusplus <= 199711L
+// expected-note@-2 {{implicit destructor}}
+#endif
 #endif
   }
 
   template
   struct X : A {
+#if __cplusplus >= 201103L
+// expected-error@-2{{deleted function '~X' cannot override a non-deleted function}}
+#endif
 void f() { }
   };
 
   void test_X(X , X ) {
 xi.f();
+#if __cplusplus >= 201103L
+// expected-note@-2 {{in instantiation of template class 'PR7114::X' requested here}}
+#endif
   }
 }
 
Index: test/SemaTemplate/value-dependent-null-pointer-constant.cpp
===
--- test/SemaTemplate/value-dependent-null-pointer-constant.cpp
+++ 

r272413 - Strip Android version when looking up toolchain paths.

2016-06-10 Thread Josh Gao via cfe-commits
Author: jmgao
Date: Fri Jun 10 13:30:33 2016
New Revision: 272413

URL: http://llvm.org/viewvc/llvm-project?rev=272413=rev
Log:
Strip Android version when looking up toolchain paths.

Summary:
Android target triples can include a version number in the abi field
(e.g. 'aarch64-linux-android21'), used for checking for availability.
However, the driver was searching for toolchain binaries using the
passed in triple as a prefix.

Reviewers: srhines, danalbert, t.p.northover

Subscribers: t.p.northover, aemerson, tberghammer, danalbert, srhines, 
cfe-commits

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

Added:
cfe/trunk/test/Driver/Inputs/android_triple_version/
cfe/trunk/test/Driver/Inputs/android_triple_version/bin/

cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld
   (with props)

cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld.exe
   (with props)
cfe/trunk/test/Driver/android-triple-version.c
Modified:
cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=272413=272412=272413=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Jun 10 13:30:33 2016
@@ -2343,7 +2343,15 @@ void Driver::generatePrefixedToolNames(
 const char *Tool, const ToolChain ,
 SmallVectorImpl ) const {
   // FIXME: Needs a better variable than DefaultTargetTriple
-  Names.emplace_back(DefaultTargetTriple + "-" + Tool);
+  StringRef Triple = DefaultTargetTriple;
+
+  // On Android, the target triple can include a version number that needs to
+  // be stripped.
+  if (TC.getTriple().isAndroid()) {
+Triple = Triple.rtrim("0123456789");
+  }
+
+  Names.emplace_back((Triple + "-" + Tool).str());
   Names.emplace_back(Tool);
 
   // Allow the discovery of tools prefixed with LLVM's default target triple.

Added: 
cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld?rev=272413=auto
==
(empty)

Propchange: 
cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld
--
svn:executable = *

Added: 
cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld.exe
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld.exe?rev=272413=auto
==
(empty)

Propchange: 
cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld.exe
--
svn:executable = *

Added: cfe/trunk/test/Driver/android-triple-version.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/android-triple-version.c?rev=272413=auto
==
--- cfe/trunk/test/Driver/android-triple-version.c (added)
+++ cfe/trunk/test/Driver/android-triple-version.c Fri Jun 10 13:30:33 2016
@@ -0,0 +1,10 @@
+// Android's target triples can contain a version number in the environment
+// field (e.g. arm-linux-androideabi9).
+// Make sure that any version is stripped when finding toolchain binaries.
+
+// RUN: env "PATH=%S/Inputs/android_triple_version/bin" \
+// RUN: %clang -### -target arm-linux-androideabi %s 2>&1 | FileCheck %s
+// RUN: env "PATH=%S/Inputs/android_triple_version/bin" \
+// RUN: %clang -### -target arm-linux-androideabi9 %s 2>&1 | FileCheck %s
+
+// CHECK: arm-linux-androideabi-ld


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21163: Strip Android version when looking up toolchain paths.

2016-06-10 Thread Josh Gao via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272413: Strip Android version when looking up toolchain 
paths. (authored by jmgao).

Changed prior to commit:
  http://reviews.llvm.org/D21163?vs=60294=60379#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21163

Files:
  cfe/trunk/lib/Driver/Driver.cpp
  
cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld
  
cfe/trunk/test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld.exe
  cfe/trunk/test/Driver/android-triple-version.c

Index: cfe/trunk/lib/Driver/Driver.cpp
===
--- cfe/trunk/lib/Driver/Driver.cpp
+++ cfe/trunk/lib/Driver/Driver.cpp
@@ -2343,7 +2343,15 @@
 const char *Tool, const ToolChain ,
 SmallVectorImpl ) const {
   // FIXME: Needs a better variable than DefaultTargetTriple
-  Names.emplace_back(DefaultTargetTriple + "-" + Tool);
+  StringRef Triple = DefaultTargetTriple;
+
+  // On Android, the target triple can include a version number that needs to
+  // be stripped.
+  if (TC.getTriple().isAndroid()) {
+Triple = Triple.rtrim("0123456789");
+  }
+
+  Names.emplace_back((Triple + "-" + Tool).str());
   Names.emplace_back(Tool);
 
   // Allow the discovery of tools prefixed with LLVM's default target triple.
Index: cfe/trunk/test/Driver/android-triple-version.c
===
--- cfe/trunk/test/Driver/android-triple-version.c
+++ cfe/trunk/test/Driver/android-triple-version.c
@@ -0,0 +1,10 @@
+// Android's target triples can contain a version number in the environment
+// field (e.g. arm-linux-androideabi9).
+// Make sure that any version is stripped when finding toolchain binaries.
+
+// RUN: env "PATH=%S/Inputs/android_triple_version/bin" \
+// RUN: %clang -### -target arm-linux-androideabi %s 2>&1 | FileCheck %s
+// RUN: env "PATH=%S/Inputs/android_triple_version/bin" \
+// RUN: %clang -### -target arm-linux-androideabi9 %s 2>&1 | FileCheck %s
+
+// CHECK: arm-linux-androideabi-ld


Index: cfe/trunk/lib/Driver/Driver.cpp
===
--- cfe/trunk/lib/Driver/Driver.cpp
+++ cfe/trunk/lib/Driver/Driver.cpp
@@ -2343,7 +2343,15 @@
 const char *Tool, const ToolChain ,
 SmallVectorImpl ) const {
   // FIXME: Needs a better variable than DefaultTargetTriple
-  Names.emplace_back(DefaultTargetTriple + "-" + Tool);
+  StringRef Triple = DefaultTargetTriple;
+
+  // On Android, the target triple can include a version number that needs to
+  // be stripped.
+  if (TC.getTriple().isAndroid()) {
+Triple = Triple.rtrim("0123456789");
+  }
+
+  Names.emplace_back((Triple + "-" + Tool).str());
   Names.emplace_back(Tool);
 
   // Allow the discovery of tools prefixed with LLVM's default target triple.
Index: cfe/trunk/test/Driver/android-triple-version.c
===
--- cfe/trunk/test/Driver/android-triple-version.c
+++ cfe/trunk/test/Driver/android-triple-version.c
@@ -0,0 +1,10 @@
+// Android's target triples can contain a version number in the environment
+// field (e.g. arm-linux-androideabi9).
+// Make sure that any version is stripped when finding toolchain binaries.
+
+// RUN: env "PATH=%S/Inputs/android_triple_version/bin" \
+// RUN: %clang -### -target arm-linux-androideabi %s 2>&1 | FileCheck %s
+// RUN: env "PATH=%S/Inputs/android_triple_version/bin" \
+// RUN: %clang -### -target arm-linux-androideabi9 %s 2>&1 | FileCheck %s
+
+// CHECK: arm-linux-androideabi-ld
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r272412 - [-fms-extensions] Permit incomplete types in dynamic exception specifications

2016-06-10 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Fri Jun 10 13:24:41 2016
New Revision: 272412

URL: http://llvm.org/viewvc/llvm-project?rev=272412=rev
Log:
[-fms-extensions] Permit incomplete types in dynamic exception specifications

Microsoft headers, comdef.h and comutil.h, assume that this is an OK
thing to do.  Downgrade the hard error to a warning if we are in
-fms-extensions mode.

This fixes PR28080.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
cfe/trunk/test/SemaCXX/ms-exception-spec.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=272412=272411=272412=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Jun 10 13:24:41 
2016
@@ -1223,6 +1223,8 @@ def err_distant_exception_spec : Error<
 def err_incomplete_in_exception_spec : Error<
   "%select{|pointer to |reference to }0incomplete type %1 is not allowed "
   "in exception specification">;
+def ext_incomplete_in_exception_spec : 
ExtWarn,
+  InGroup;
 def err_rref_in_exception_spec : Error<
   "rvalue reference type %0 is not allowed in exception specification">;
 def err_mismatched_exception_spec : Error<

Modified: cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExceptionSpec.cpp?rev=272412=272411=272412=diff
==
--- cfe/trunk/lib/Sema/SemaExceptionSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExceptionSpec.cpp Fri Jun 10 13:24:41 2016
@@ -110,10 +110,13 @@ bool Sema::CheckSpecifiedExceptionType(Q
   //   A type denoted in an exception-specification shall not denote a
   //   pointer or reference to an incomplete type, other than (cv) void* or a
   //   pointer or reference to a class currently being defined.
+  // In Microsoft mode, downgrade this to a warning.
+  unsigned DiagID = diag::err_incomplete_in_exception_spec;
+  if (getLangOpts().MicrosoftExt)
+DiagID = diag::ext_incomplete_in_exception_spec;
   if (!(PointeeT->isRecordType() &&
 PointeeT->getAs()->isBeingDefined()) &&
-  RequireCompleteType(Range.getBegin(), PointeeT,
-  diag::err_incomplete_in_exception_spec, Kind, Range))
+  RequireCompleteType(Range.getBegin(), PointeeT, DiagID, Kind, Range))
 return true;
 
   return false;

Modified: cfe/trunk/test/SemaCXX/ms-exception-spec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/ms-exception-spec.cpp?rev=272412=272411=272412=diff
==
--- cfe/trunk/test/SemaCXX/ms-exception-spec.cpp (original)
+++ cfe/trunk/test/SemaCXX/ms-exception-spec.cpp Fri Jun 10 13:24:41 2016
@@ -1,4 +1,8 @@
 // RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions
-// expected-no-diagnostics
 
 void f() throw(...) { }
+
+namespace PR28080 {
+struct S; // expected-note {{forward declaration}}
+void fn() throw(S); // expected-warning {{incomplete type}}
+}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21163: Strip Android version when looking up toolchain paths.

2016-06-10 Thread Josh Gao via cfe-commits
jmgao added a comment.

Thanks for the review!


http://reviews.llvm.org/D21163



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21113: Add support for case-insensitive header lookup

2016-06-10 Thread Hans Wennborg via cfe-commits
On Thu, Jun 9, 2016 at 5:31 PM, Joerg Sonnenberger via cfe-commits
 wrote:
> On Wed, Jun 08, 2016 at 01:12:31AM +, Hans Wennborg via cfe-commits wrote:
>> There has been a patch for this before (http://reviews.llvm.org/D2972),
>> but this one is more general, as it works on the virtual filesystem
>> layer, and also supports case-insensitive lookups of parent directories
>> not just the filename.
>
> What happens if two files / directories end up with the same mangling?

You'd get one of them :-)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] [clang] Emit ObjC method and block annotation attributes to IR

2016-06-10 Thread Max Bazaliy via cfe-commits
Any updates on this ?

On Thu, May 19, 2016 at 8:37 PM, Max Bazaliy 
wrote:

> Hey,
>
> For some reason clang does not emit ObjC method and block annotations to
> IR. Here is a fix for that.
>
> --
> Max Bazaliy
>



-- 
Max Bazaliy
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21179: Add mrrc/mrrc2 intrinsics and update existing mcrr/mcrr2 intrinsics to accept a single uint64 type instead of 2 uint32 types

2016-06-10 Thread Renato Golin via cfe-commits
rengolin added inline comments.


Comment at: lib/CodeGen/CGBuiltin.cpp:3817
@@ +3816,3 @@
+
+Value *Arg0 = EmitScalarExpr(E->getArg(0)); /* coproc */
+Value *Arg1 = EmitScalarExpr(E->getArg(1)); /* opc1 */

Would be better to use the comments as names and avoid the comments...

It'd also make clear the casts below.


Comment at: lib/CodeGen/CGBuiltin.cpp:3824
@@ +3823,3 @@
+Value *Arg2a = Builder.CreateTruncOrBitCast(Arg2, Int32Ty);
+Value *Arg2b = Builder.CreateLShr(Arg2, C1);
+Arg2b = Builder.CreateTruncOrBitCast(Arg2b, Int32Ty);

These variables could have better names...


Comment at: lib/CodeGen/CGBuiltin.cpp:3846
@@ +3845,3 @@
+Value *Arg1 = EmitScalarExpr(E->getArg(1)); /* opc */
+Value *Arg2 = EmitScalarExpr(E->getArg(2)); /* CRm */
+Value *Val = Builder.CreateCall(F, {Arg0, Arg1, Arg2});

Same here


Comment at: test/CodeGen/builtins-arm.c:203
@@ -188,5 +202,3 @@
 
-void mcrr2(unsigned a, unsigned b) {
-  // CHECK: define void @mcrr2(i32 [[A:%.*]], i32 [[B:%.*]])
-  // CHECK: call void @llvm.arm.mcrr2(i32 15, i32 0, i32 [[A]], i32 [[B]], i32 
0)
-  __builtin_arm_mcrr2(15, 0, a, b, 0);
+uint64_t mrrc2() {
+  // CHECK: define i64 @mrrc2()

I'm assuming this is a "soon to be documented" move, right?

It's really hard to review patches with these things changing all the time...


http://reviews.llvm.org/D21179



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18170: [CUDA][OpenMP] Create generic offload toolchains

2016-06-10 Thread Artem Belevich via cfe-commits
tra accepted this revision.
tra added a comment.
This revision is now accepted and ready to land.

LGTM.


http://reviews.llvm.org/D18170



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r272401 - [streambuf] Added call to traits_type::copy to common case in xsgetn()

2016-06-10 Thread Evandro Menezes via cfe-commits
Author: evandro
Date: Fri Jun 10 11:00:29 2016
New Revision: 272401

URL: http://llvm.org/viewvc/llvm-project?rev=272401=rev
Log:
[streambuf] Added call to traits_type::copy to common case in xsgetn()

Patch by Laman Sole , Sebastian Pop
, Aditya Kumar 

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

Modified:
libcxx/trunk/include/streambuf

Modified: libcxx/trunk/include/streambuf
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/streambuf?rev=272401=272400=272401=diff
==
--- libcxx/trunk/include/streambuf (original)
+++ libcxx/trunk/include/streambuf Fri Jun 10 11:00:29 2016
@@ -495,12 +495,22 @@ basic_streambuf<_CharT, _Traits>::xsgetn
 const int_type __eof = traits_type::eof();
 int_type __c;
 streamsize __i = 0;
-for (;__i < __n; ++__i, ++__s)
+while(__i < __n)
 {
 if (__ninp_ < __einp_)
-*__s = *__ninp_++;
+{
+const streamsize __len = _VSTD::min(__einp_ - __ninp_, __n - __i);
+traits_type::copy(__s, __ninp_, __len);
+__s +=  __len;
+__i +=  __len;
+this->gbump(__len);
+}
 else if ((__c = uflow()) != __eof)
+{
 *__s = traits_type::to_char_type(__c);
+++__s;
+++__i;
+}
 else
 break;
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D21230: Do not embed all the cc1 options in bitcode commandline

2016-06-10 Thread Steven Wu via cfe-commits
steven_wu created this revision.
steven_wu added reviewers: rsmith, dexonsmith.
steven_wu added subscribers: cfe-commits, jfb, dschuff.

Previously, all the cc1 options are passed to both compile stage and codegen
stage and almost all of them are embedded in the commandline section in the
object file when using embedded bitcode.
In reality, the most of the options are not needed for codegen phase. Some of
them are useless, for example, include paths, warning flags. Some of them are
included in the bitcode, for example, PIC mode.
This fixes the issue by removing unnecessary opts from both codegen cc1 command
and the commandline embedded in object file. This is achieved by adding all the
necessary cc1 options to a specific group. I also plan to extend this group
to driver flags so clang can issue warnings when using these options with LTO
because they are likely to get dropped in the process.
The list of the cc1 options are created from the options that will affect the
TargetMachine created in clang FrontendInvocation. I also make sure none of
these options are actually turned into an attribute in CGCall.

Note: This is an alternative to http://reviews.llvm.org/D17394

http://reviews.llvm.org/D21230

Files:
  include/clang/Driver/CC1Options.td
  include/clang/Driver/Options.td
  lib/Driver/Tools.cpp
  lib/Driver/Tools.h
  lib/Frontend/CompilerInvocation.cpp
  test/Driver/compress.c
  test/Driver/embed-bitcode.c

Index: test/Driver/embed-bitcode.c
===
--- test/Driver/embed-bitcode.c
+++ test/Driver/embed-bitcode.c
@@ -41,3 +41,68 @@
 // CHECK-MARKER: -fembed-bitcode=marker
 // CHECK-MARKER-NOT: -cc1
 
+// Check the options that affects CodeGen are passed correctly.
+// RUN: %clang -target armv7-apple-darwin -c %s -fembed-bitcode=all -O3 \
+// RUN:   -mios-version-min=9.0 -mcmodel=small \
+// RUN:   -mrecip=default -mthread-model posix -mrelax-all \
+// RUN:   -ffp-contract=fast -ffast-math -flimited-precision=8 -fapple-kext \
+// RUN:   -fno-dwarf-directory-asm -femulated-tls -ffunction-sections \
+// RUN:   -fdata-sections -fno-data-sections -funique-section-names \
+// RUN:   -mstack-alignment=8 -meabi test -fno-zero-initialized-in-bss \
+// RUN:   -mincremental-linker-compatible -Wa,--noexecstack \
+// RUN:   -Wa,--fatal-warnings -Wa,-L -fverbose-asm -mllvm -test \
+// RUN:   -Xclang -cl-finite-math-only -Xclang -cl-unsafe-math-optimizations \
+// RUN:   -Xclang -cl-fast-relaxed-math -Xclang -cl-mad-enable -### 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK-CODEGEN
+// CHECK-CODEGEN: "-cc1" "-emit-obj"
+// CHECK-CODEGEN: "-triple" "thumbv7-apple-ios9.0.0"
+// CHECK-CODEGEN: "-O3"
+// CHECK-CODEGEN: "-mrelax-all"
+// CHECK-CODEGEN: "-mincremental-linker-compatible"
+// CHECK-CODEGEN: "-mnoexecstack"
+// CHECK-CODEGEN: "-massembler-fatal-warnings"
+// CHECK-CODEGEN: "-msave-temp-labels"
+// CHECK-CODEGEN: "-fembed-bitcode=all"
+// CHECK-CODEGEN: "-meabi" "test"
+// CHECK-CODEGEN: "-mthread-model" "posix"
+// CHECK-CODEGEN: "-mno-zero-initialized-in-bss"
+// CHECK-CODEGEN: "-menable-no-infs"
+// CHECK-CODEGEN: "-menable-no-nans"
+// CHECK-CODEGEN: "-menable-unsafe-fp-math"
+// CHECK-CODEGEN: "-ffp-contract=fast"
+// CHECK-CODEGEN: "-mrecip=default"
+// CHECK-CODEGEN: "-masm-verbose"
+// CHECK-CODEGEN: "-mlimit-float-precision" "8"
+// CHECK-CODEGEN: "-mcode-model" "small"
+// CHECK-CODEGEN: "-target-abi" "apcs-gnu"
+// CHECK-CODEGEN: "-debugger-tuning=lldb"
+// CHECK-CODEGEN: "-ffunction-sections"
+// CHECK-CODEGEN: "-fno-dwarf-directory-asm"
+// CHECK-CODEGEN: "-femulated-tls"
+// CHECK-CODEGEN: "-fapple-kext"
+// CHECK-CODEGEN: "-mstack-alignment=8"
+// CHECK-CODEGEN: "-fsjlj-exceptions"
+// CHECK-CODEGEN: "-cl-finite-math-only"
+// CHECK-CODEGEN: "-cl-unsafe-math-optimizations"
+// CHECK-CODEGEN: "-cl-fast-relaxed-math"
+// CHECK-CODEGEN: "-cl-mad-enable"
+// CHECK-CODEGEN: "-mllvm" "-test"
+
+// RUN: %clang -target arm64-none-none-eabi -fuse-init-array \
+// RUN:   -fembed-bitcode=all -c %s -### 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
+// CHECK-INIT-ARRAY: "-cc1" "-emit-obj"
+// CHECK-INIT-ARRAY: "-fuse-init-array"
+
+// RUN: %clang -target armv7-apple-darwin -c %s -fembed-bitcode=all \
+// RUN:   -Wall -I/usr/include -c -### 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-OPTS %s
+// CHECK-NO-OPTS: "-cc1" "-emit-obj"
+// CHECK-NO-OPTS-NOT: "-Wall"
+// CHECK-NO-OPTS-NOT: "-I"
+
+// Check multiple inputs work with -fembed-bitcode.
+// RUN: %clang %s %s -fembed-bitcode=all 2>&1 -### | FileCheck %s -check-prefix=CHECK-MULTIPLE
+// RUN: %clang -arch arm64 -arch armv7 %s  -fembed-bitcode=all 2>&1 -### | FileCheck %s -check-prefix=CHECK-MULTIPLE
+// CHECK-MULTIPLE: "-cc1" "-emit-obj"
+// CHECK-MULTIPLE: "-cc1" "-emit-obj"
Index: test/Driver/compress.c
===
--- test/Driver/compress.c
+++ test/Driver/compress.c
@@ -6,3 +6,10 @@
 
 // RUN: %clang -### 

r272402 - This patch fixes target linker emulation for ARM 32 big endian.

2016-06-10 Thread Strahinja Petrovic via cfe-commits
Author: spetrovic
Date: Fri Jun 10 11:09:20 2016
New Revision: 272402

URL: http://llvm.org/viewvc/llvm-project?rev=272402=rev
Log:
This patch fixes target linker emulation for ARM 32 big endian.

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/linux-ld.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=272402=272401=272402=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Jun 10 11:09:20 2016
@@ -9119,7 +9119,7 @@ static const char *getLDMOption(const ll
 return "armelf_linux_eabi";
   case llvm::Triple::armeb:
   case llvm::Triple::thumbeb:
-return "armebelf_linux_eabi"; /* TODO: check which NAME.  */
+return "armelfb_linux_eabi";
   case llvm::Triple::ppc:
 return "elf32ppclinux";
   case llvm::Triple::ppc64:

Modified: cfe/trunk/test/Driver/linux-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=272402=272401=272402=diff
==
--- cfe/trunk/test/Driver/linux-ld.c (original)
+++ cfe/trunk/test/Driver/linux-ld.c Fri Jun 10 11:09:20 2016
@@ -1561,7 +1561,7 @@
 // RUN:   | FileCheck --check-prefix=CHECK-ARMEB %s
 // CHECK-ARMEB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
 // CHECK-ARMEB-NOT: "--be8"
-// CHECK-ARMEB: "-m" "armebelf_linux_eabi"
+// CHECK-ARMEB: "-m" "armelfb_linux_eabi"
 
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: --target=armebv7-unknown-linux \
@@ -1570,4 +1570,4 @@
 // RUN:   | FileCheck --check-prefix=CHECK-ARMV7EB %s
 // CHECK-ARMV7EB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
 // CHECK-ARMV7EB: "--be8"
-// CHECK-ARMV7EB: "-m" "armebelf_linux_eabi"
+// CHECK-ARMV7EB: "-m" "armelfb_linux_eabi"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20681: Add target-specific pre-linking passes to Clang

2016-06-10 Thread Anastasia Stulova via cfe-commits
Anastasia added a comment.

LGTM! Looks much cleaner now. Please, add me to related reviews later on.

Thanks!


http://reviews.llvm.org/D20681



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-10 Thread Eric Niebler via cfe-commits
eric_niebler added a comment.

@rsmith wrote:

> Thanks for the updates, LGTM (@bruno, did you get the performance numbers you 
> wanted?)


FWIW, I benchmarked (on Windows, where problems are likely to occur) with 3 
implementations of `warnByDefaultOnWrongCase`: 1) `StringSwitch`, 2) 
`StringSet`, and 3) noop. I found no measurable performance difference between 
any of them. This code path just isn't hot enough to matter.

If I don't hear back, maybe @twoh will merge these diffs again by EOD. And 
hopefully we'll hear fewer screams this time. :-)


http://reviews.llvm.org/D19843



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20428: Tracking exception specification source locations

2016-06-10 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

In http://reviews.llvm.org/D20428#452680, @hintonda wrote:

> The comment says to rebuild TypeSourceInfo, but isn't that what this does?
>
>   if (TSInfo->getType() != FD->getType())
> Updated = getFunctionTypeWithExceptionSpec(*this, TSInfo->getType(), ESI);
>   TSInfo->overrideType(Updated);
>   


That is only overriding the `QualType` stored in the `TypeSourceInfo`, but it 
does not rebuild the type source information as a whole (which includes the 
`FunctionTypeLoc`). The problem is that we need a new TSI that has sufficient 
space to store the exception specification source range in the case the 
existing source info does not have it. What's more, this function doesn't 
currently have that information (I believe it needs to be passed in as a 
parameter) to store in the adjusted type info.


http://reviews.llvm.org/D20428



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20428: Tracking exception specification source locations

2016-06-10 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

Richard, with the following test case, my patch currently fails an assertion in 
`ASTContext::adjustExceptionSpec()` that I want to solve before committing:

  template void f7() {
struct S { void g() noexcept(undefined_val); };  // expected-error{{use of 
undeclared identifier 'undefined_val'}}
  }
  template void f7();

What is the correct way to rebuild the type source information? Would it be 
correct to call CreateTypeSourceInfo(Updated) to get a new TypeSourceInfo 
object of the proper size, then initializeFullCopy() the new type location 
object from the old one, and call setExceptionSpecRange() to update the source 
range information on the new type loc object? (The range would have to be 
passed to adjustExceptionSpec().) Or is there a better way to perform this 
rebuilding?



Comment at: lib/AST/Decl.cpp:2938-2948
@@ -2937,1 +2937,13 @@
 
+SourceRange FunctionDecl::getExceptionSpecSourceRange() const {
+  const TypeSourceInfo *TSI = getTypeSourceInfo();
+  if (!TSI)
+return SourceRange();
+  FunctionTypeLoc FTL =
+TSI->getTypeLoc().IgnoreParens().getAs();
+  if (!FTL)
+return SourceRange();
+
+  return FTL.getExceptionSpecRange();
+}
+

rsmith wrote:
> Can you factor out a function to get the `FunctionTypeLoc` from a 
> `FunctionDecl`, when there is one (preferably as a separate change)? This is 
> duplicated in a few places now (you can find some more by searching for 
> `getAs` in Sema), and looks slightly wrong here (we 
> should skip calling convention attributes as well as parens).
Yup, I can do that.


http://reviews.llvm.org/D20428



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19854: Define Contiki OS toolchain

2016-06-10 Thread Michael LeMay via cfe-commits
mlemay-intel updated this revision to Diff 60357.
mlemay-intel added a comment.

Added driver test.


http://reviews.llvm.org/D19854

Files:
  lib/Driver/Driver.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h
  test/Driver/fsanitize.c

Index: test/Driver/fsanitize.c
===
--- test/Driver/fsanitize.c
+++ test/Driver/fsanitize.c
@@ -386,6 +386,7 @@
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack 
-fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP
 // RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=NO-SP
 // RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=NO-SP
+// RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 
| FileCheck %s -check-prefix=NO-SP
 // NO-SP-NOT: stack-protector
 // NO-SP: "-fsanitize=safe-stack"
 // SP: "-fsanitize=safe-stack"
Index: lib/Driver/ToolChains.h
===
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -1191,6 +1191,14 @@
   Tool *buildLinker() const override;
 };
 
+class LLVM_LIBRARY_VISIBILITY Contiki : public Generic_ELF {
+public:
+  Contiki(const Driver , const llvm::Triple ,
+ const llvm::opt::ArgList );
+
+  SanitizerMask getSupportedSanitizers() const override;
+};
+
 } // end namespace toolchains
 } // end namespace driver
 } // end namespace clang
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -4984,3 +4984,14 @@
   Res |= SanitizerKind::Vptr;
   return Res;
 }
+
+Contiki::Contiki(const Driver , const llvm::Triple , const ArgList 
)
+: Generic_ELF(D, Triple, Args) {}
+
+SanitizerMask Contiki::getSupportedSanitizers() const {
+  const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
+  SanitizerMask Res = ToolChain::getSupportedSanitizers();
+  if (IsX86)
+Res |= SanitizerKind::SafeStack;
+  return Res;
+}
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -2512,6 +2512,9 @@
 case llvm::Triple::PS4:
   TC = new toolchains::PS4CPU(*this, Target, Args);
   break;
+case llvm::Triple::Contiki:
+  TC = new toolchains::Contiki(*this, Target, Args);
+  break;
 default:
   // Of these targets, Hexagon is the only one that might have
   // an OS of Linux, in which case it got handled above already.


Index: test/Driver/fsanitize.c
===
--- test/Driver/fsanitize.c
+++ test/Driver/fsanitize.c
@@ -386,6 +386,7 @@
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP
 // RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
 // RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
+// RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
 // NO-SP-NOT: stack-protector
 // NO-SP: "-fsanitize=safe-stack"
 // SP: "-fsanitize=safe-stack"
Index: lib/Driver/ToolChains.h
===
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -1191,6 +1191,14 @@
   Tool *buildLinker() const override;
 };
 
+class LLVM_LIBRARY_VISIBILITY Contiki : public Generic_ELF {
+public:
+  Contiki(const Driver , const llvm::Triple ,
+ const llvm::opt::ArgList );
+
+  SanitizerMask getSupportedSanitizers() const override;
+};
+
 } // end namespace toolchains
 } // end namespace driver
 } // end namespace clang
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -4984,3 +4984,14 @@
   Res |= SanitizerKind::Vptr;
   return Res;
 }
+
+Contiki::Contiki(const Driver , const llvm::Triple , const ArgList )
+: Generic_ELF(D, Triple, Args) {}
+
+SanitizerMask Contiki::getSupportedSanitizers() const {
+  const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
+  SanitizerMask Res = ToolChain::getSupportedSanitizers();
+  if (IsX86)
+Res |= SanitizerKind::SafeStack;
+  return Res;
+}
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -2512,6 +2512,9 @@
 case llvm::Triple::PS4:
   TC = new toolchains::PS4CPU(*this, Target, Args);
   break;
+case llvm::Triple::Contiki:
+  TC = new toolchains::Contiki(*this, Target, Args);
+  break;
 default:
   // Of these targets, Hexagon is the only one that might have

[PATCH] D21229: [Analyzer] Don't cache report generation ExplodedNodes

2016-06-10 Thread Ben Craig via cfe-commits
bcraig created this revision.
bcraig added reviewers: zaks.anna, dcoughlin, jordan_rose.
bcraig added a subscriber: cfe-commits.

During the core analysis, ExplodedNodes are added to the ExplodedGraph, and 
those nodes are cached for deduplication purposes.

After core analysis, reports are generated.  Here, trimmed copies of the 
ExplodedGraph are made.  Since the ExplodedGraph has already been deduplicated, 
there is no need to deduplicate again.

This change makes it possible to add ExplodedNodes to an ExplodedGraph without 
the overhead of deduplication.  "Uncached" nodes also cannot be iterated over, 
but none of the report generation code attempts to iterate over all nodes.  
This change reduces the analysis time of a large .C file from 3m43.941s to 
3m40.256s (~1.6% speedup).  It should slightly reduce memory consumption.  
Gains should be roughly proportional to the number (and path length) of static 
analysis warnings.

This patch enables future work that should remove the need for an 
InterExplodedGraphMap inverse map.  I plan on using the (now unused) 
ExplodedNode link to connect new nodes to the original nodes.

http://reviews.llvm.org/D21229

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
  lib/StaticAnalyzer/Core/BugReporter.cpp
  lib/StaticAnalyzer/Core/ExplodedGraph.cpp

Index: lib/StaticAnalyzer/Core/ExplodedGraph.cpp
===
--- lib/StaticAnalyzer/Core/ExplodedGraph.cpp
+++ lib/StaticAnalyzer/Core/ExplodedGraph.cpp
@@ -336,6 +336,14 @@
   return V;
 }
 
+ExplodedNode *ExplodedGraph::createUncachedNode(const ProgramPoint ,
+ProgramStateRef State,
+bool IsSink) {
+  NodeTy *V = (NodeTy *) getAllocator().Allocate();
+  new (V) NodeTy(L, State, IsSink);
+  return V;
+}
+
 std::unique_ptr
 ExplodedGraph::trim(ArrayRef Sinks,
 InterExplodedGraphMap *ForwardMap,
@@ -395,8 +403,7 @@
 
 // Create the corresponding node in the new graph and record the mapping
 // from the old node to the new node.
-ExplodedNode *NewN = G->getNode(N->getLocation(), N->State, N->isSink(),
-nullptr);
+ExplodedNode *NewN = G->createUncachedNode(N->getLocation(), N->State, 
N->isSink());
 Pass2[N] = NewN;
 
 // Also record the reverse mapping from the new node to the old node.
Index: lib/StaticAnalyzer/Core/BugReporter.cpp
===
--- lib/StaticAnalyzer/Core/BugReporter.cpp
+++ lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -2922,7 +2922,7 @@
   while (true) {
 // Create the equivalent node in the new graph with the same state
 // and location.
-ExplodedNode *NewN = GNew->getNode(OrigN->getLocation(), OrigN->getState(),
+ExplodedNode *NewN = GNew->createUncachedNode(OrigN->getLocation(), 
OrigN->getState(),
OrigN->isSink());
 
 // Store the mapping to the original node.
Index: include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
===
--- include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
+++ include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
@@ -295,6 +295,14 @@
 bool IsSink = false,
 bool* IsNew = nullptr);
 
+  /// \brief Create a node for a (Location, State) pair,
+  ///  but don't store it for deduplication later.  This
+  ///  is useful when copying an already completed
+  ///  ExplodedGraph for further processing.
+  ExplodedNode *createUncachedNode(const ProgramPoint ,
+ProgramStateRef State,
+bool IsSink = false);
+
   std::unique_ptr MakeEmptyGraph() const {
 return llvm::make_unique();
   }


Index: lib/StaticAnalyzer/Core/ExplodedGraph.cpp
===
--- lib/StaticAnalyzer/Core/ExplodedGraph.cpp
+++ lib/StaticAnalyzer/Core/ExplodedGraph.cpp
@@ -336,6 +336,14 @@
   return V;
 }
 
+ExplodedNode *ExplodedGraph::createUncachedNode(const ProgramPoint ,
+ProgramStateRef State,
+bool IsSink) {
+  NodeTy *V = (NodeTy *) getAllocator().Allocate();
+  new (V) NodeTy(L, State, IsSink);
+  return V;
+}
+
 std::unique_ptr
 ExplodedGraph::trim(ArrayRef Sinks,
 InterExplodedGraphMap *ForwardMap,
@@ -395,8 +403,7 @@
 
 // Create the corresponding node in the new graph and record the mapping
 // from the old node to the new node.
-ExplodedNode *NewN = G->getNode(N->getLocation(), N->State, N->isSink(),
-nullptr);
+ExplodedNode *NewN = G->createUncachedNode(N->getLocation(), N->State, N->isSink());
 Pass2[N] = NewN;
 
 // Also record the reverse mapping from the new 

Re: [PATCH] D21223: [clang-tidy] misc-move-const-arg: Detect if result of std::move() is being passed as a const ref argument

2016-06-10 Thread Aaron Ballman via cfe-commits
aaron.ballman added a subscriber: aaron.ballman.
aaron.ballman added a reviewer: aaron.ballman.


Comment at: clang-tidy/misc/MoveConstantArgumentCheck.cpp:20
@@ -19,1 +19,3 @@
 
+namespace {
+

Instead of an unnamed namespace, you should use static functions per our coding 
standards (http://llvm.org/docs/CodingStandards.html#anonymous-namespaces).


Comment at: clang-tidy/misc/MoveConstantArgumentCheck.cpp:22
@@ +21,3 @@
+
+void ReplaceCallWithArg(const CallExpr *TheCallExpr, DiagnosticBuilder *Diag,
+const SourceManager , const LangOptions ) {

Should pass `Diag` by reference rather than by pointer.


Comment at: clang-tidy/misc/MoveConstantArgumentCheck.cpp:26
@@ +25,3 @@
+
+  auto BeforeArgumentsRange = Lexer::makeFileCharRange(
+  CharSourceRange::getCharRange(TheCallExpr->getLocStart(),

Should only use `auto` when the type is explicitly spelled out in the 
initialization (which this is not). Same elsewhere.


http://reviews.llvm.org/D21223



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21212: Add documentation for RenderScript changes

2016-06-10 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: include/clang/Basic/AttrDocs.td:2440
@@ +2439,3 @@
+  let Content = [{
+``__attribute__((kernel))`` is used to mark a ``kernel`` function in 
RenderScript_.  See the RenderScript_ documentation for more information.
+

A little bit more information would be appreciated. I know you link to the 
RenderScript documentation, but there should be at least enough information 
here so that a reader has an idea what a kernel function is for render script.


http://reviews.llvm.org/D21212



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21031: [OpenCL] Allow -cl-std and other standard -cl- options in driver

2016-06-10 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: include/clang/Driver/CC1Options.td:670
@@ -669,21 +669,3 @@
 
-def cl_opt_disable : Flag<["-"], "cl-opt-disable">,
-  HelpText<"OpenCL only. This option disables all optimizations. The default 
is optimizations are enabled.">;
-def cl_strict_aliasing : Flag<["-"], "cl-strict-aliasing">,
-  HelpText<"OpenCL only. This option does nothing and is for compatibility 
with OpenCL 1.0">;
-def cl_single_precision_constant : Flag<["-"], "cl-single-precision-constant">,
-  HelpText<"OpenCL only. Treat double precision floating-point constant as 
single precision constant.">;
-def cl_finite_math_only : Flag<["-"], "cl-finite-math-only">,
-  HelpText<"OpenCL only. Allow floating-point optimizations that assume 
arguments and results are not NaNs or +-Inf.">;
-def cl_kernel_arg_info : Flag<["-"], "cl-kernel-arg-info">,
-  HelpText<"OpenCL only. Generate kernel argument metadata.">;
-def cl_unsafe_math_optimizations : Flag<["-"], "cl-unsafe-math-optimizations">,
-  HelpText<"OpenCL only. Allow unsafe floating-point optimizations.  Also 
implies -cl-no-signed-zeros and -cl-mad-enable">;
-def cl_fast_relaxed_math : Flag<["-"], "cl-fast-relaxed-math">,
-  HelpText<"OpenCL only. Sets -cl-finite-math-only and 
-cl-unsafe-math-optimizations, and defines __FAST_RELAXED_MATH__">;
-def cl_mad_enable : Flag<["-"], "cl-mad-enable">,
-  HelpText<"OpenCL only. Enable less precise MAD instructions to be 
generated.">;
-def cl_std_EQ : Joined<["-"], "cl-std=">,
-  HelpText<"OpenCL language standard to compile for">;
-def cl_denorms_are_zero : Flag<["-"], "cl-denorms-are-zero">,
-  HelpText<"OpenCL only. Allow denormals to be flushed to zero">;
+//def cl_opt_disable : Flag<["-"], "cl-opt-disable">,
+//  HelpText<"OpenCL only. This option disables all optimizations. The default 
is optimizations are enabled.">;

Is this code below to be removed?


Comment at: include/clang/Driver/CC1Options.td:671
@@ +670,3 @@
+//def cl_opt_disable : Flag<["-"], "cl-opt-disable">,
+//  HelpText<"OpenCL only. This option disables all optimizations. The default 
is optimizations are enabled.">;
+//def cl_strict_aliasing : Flag<["-"], "cl-strict-aliasing">,

This isn't part of this change but could we improve the wording a bit for these 
items:

The default is optimizations are enabled -> By default optimizations are enabled


Comment at: include/clang/Driver/CC1Options.td:673
@@ +672,3 @@
+//def cl_strict_aliasing : Flag<["-"], "cl-strict-aliasing">,
+//  HelpText<"OpenCL only. This option does nothing and is for compatibility 
with OpenCL 1.0">;
+//def cl_single_precision_constant : Flag<["-"], 
"cl-single-precision-constant">,

This option does nothing and is for compatibility with OpenCL 1.0 -> This 
option is added for compatibility with OpenCL 1.0.
 finish with .

Btw, ideally this option should be deprivcated for CL > 1.0. Could we give 
diagnostic in this case?


Comment at: include/clang/Driver/CC1Options.td:681
@@ +680,3 @@
+//def cl_unsafe_math_optimizations : Flag<["-"], 
"cl-unsafe-math-optimizations">,
+//  HelpText<"OpenCL only. Allow unsafe floating-point optimizations.  Also 
implies -cl-no-signed-zeros and -cl-mad-enable">;
+//def cl_fast_relaxed_math : Flag<["-"], "cl-fast-relaxed-math">,

Finish with .


Comment at: include/clang/Driver/CC1Options.td:683
@@ +682,3 @@
+//def cl_fast_relaxed_math : Flag<["-"], "cl-fast-relaxed-math">,
+//  HelpText<"OpenCL only. Sets -cl-finite-math-only and 
-cl-unsafe-math-optimizations, and defines __FAST_RELAXED_MATH__">;
+//def cl_mad_enable : Flag<["-"], "cl-mad-enable">,

Finish with .


Comment at: include/clang/Driver/CC1Options.td:685
@@ +684,3 @@
+//def cl_mad_enable : Flag<["-"], "cl-mad-enable">,
+//  HelpText<"OpenCL only. Enable less precise MAD instructions to be 
generated.">;
+//def cl_std_EQ : Joined<["-"], "cl-std=">,

Enable less precise MAD instructions to be generated. -> Allow use of less 
precise MAD computations in the generated binary.


http://reviews.llvm.org/D21031



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r272342 - RenderScript support in the Frontend

2016-06-10 Thread Aaron Ballman via cfe-commits
On Thu, Jun 9, 2016 at 7:34 PM, Pirama Arumuga Nainar via cfe-commits
 wrote:
> Author: pirama
> Date: Thu Jun  9 18:34:20 2016
> New Revision: 272342
>
> URL: http://llvm.org/viewvc/llvm-project?rev=272342=rev
> Log:
> RenderScript support in the Frontend
>
> Summary:
>
> Create a new Frontend LangOpt to specify the renderscript language. It
> is enabled by the "-x renderscript" option from the driver.
>
> Add a "kernel" function attribute only for RenderScript (an "ignored
> attribute" warning is generated otherwise).
>
> Make the NativeHalfType and NativeHalfArgsAndReturns LangOpts be implied
> by the RenderScript LangOpt.
>
> Reviewers: rsmith
>
> Subscribers: cfe-commits, srhines
>
> Differential Revision: http://reviews.llvm.org/D21198
>
> Added:
> cfe/trunk/test/Sema/renderscript.rs
> Modified:
> cfe/trunk/include/clang/Basic/Attr.td
> cfe/trunk/include/clang/Basic/LangOptions.def
> cfe/trunk/include/clang/Frontend/FrontendOptions.h
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/lib/Frontend/FrontendActions.cpp
> cfe/trunk/lib/Sema/SemaDeclAttr.cpp
> cfe/trunk/test/CodeGen/fp16-ops.c
>
> Modified: cfe/trunk/include/clang/Basic/Attr.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=272342=272341=272342=diff
> ==
> --- cfe/trunk/include/clang/Basic/Attr.td (original)
> +++ cfe/trunk/include/clang/Basic/Attr.td Thu Jun  9 18:34:20 2016
> @@ -728,6 +728,12 @@ def OpenCLNoSVM : Attr {
>let ASTNode = 0;
>  }
>
> +def Kernel : Attr {

Please rename this to RenderScriptKernel. We have another attribute
that is spelled "kernel" already, and we want to distinguish between
them to reduce confusion.

> +  let Spellings = [GNU<"kernel">];

Is there a reason this isn't also spelled with a C++ attribute spelling?

> +  let Subjects = SubjectList<[Function]>;
> +  let Documentation = [Undocumented];
> +}
> +
>  def Deprecated : InheritableAttr {
>let Spellings = [GCC<"deprecated">, Declspec<"deprecated">,
> CXX11<"","deprecated", 201309>];
>
> Modified: cfe/trunk/include/clang/Basic/LangOptions.def
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=272342=272341=272342=diff
> ==
> --- cfe/trunk/include/clang/Basic/LangOptions.def (original)
> +++ cfe/trunk/include/clang/Basic/LangOptions.def Thu Jun  9 18:34:20 2016
> @@ -185,6 +185,7 @@ LANGOPT(CUDA  , 1, 0, "CUDA"
>  LANGOPT(OpenMP, 32, 0, "OpenMP support and version of OpenMP 
> (31, 40 or 45)")
>  LANGOPT(OpenMPUseTLS  , 1, 0, "Use TLS for threadprivates or runtime 
> calls")
>  LANGOPT(OpenMPIsDevice, 1, 0, "Generate code only for OpenMP target 
> device")
> +LANGOPT(RenderScript  , 1, 0, "RenderScript")
>
>  LANGOPT(CUDAIsDevice  , 1, 0, "compiling for CUDA device")
>  LANGOPT(CUDAAllowVariadicFunctions, 1, 0, "allowing variadic functions in 
> CUDA device code")
>
> Modified: cfe/trunk/include/clang/Frontend/FrontendOptions.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendOptions.h?rev=272342=272341=272342=diff
> ==
> --- cfe/trunk/include/clang/Frontend/FrontendOptions.h (original)
> +++ cfe/trunk/include/clang/Frontend/FrontendOptions.h Thu Jun  9 18:34:20 
> 2016
> @@ -74,6 +74,7 @@ enum InputKind {
>IK_OpenCL,
>IK_CUDA,
>IK_PreprocessedCuda,
> +  IK_RenderScript,
>IK_AST,
>IK_LLVM_IR
>  };
>
> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=272342=272341=272342=diff
> ==
> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Jun  9 18:34:20 2016
> @@ -1292,6 +1292,7 @@ static InputKind ParseFrontendArgs(Front
>.Case("objective-c++-header", IK_ObjCXX)
>.Cases("ast", "pcm", IK_AST)
>.Case("ir", IK_LLVM_IR)
> +  .Case("renderscript", IK_RenderScript)
>.Default(IK_None);
>  if (DashX == IK_None)
>Diags.Report(diag::err_drv_invalid_value)
> @@ -1495,6 +1496,9 @@ void CompilerInvocation::setLangDefaults
>  case IK_PreprocessedObjCXX:
>LangStd = LangStandard::lang_gnucxx98;
>break;
> +case IK_RenderScript:
> +  LangStd = LangStandard::lang_c99;
> +  break;
>  }
>}
>
> @@ -1537,6 +1541,12 @@ void CompilerInvocation::setLangDefaults
>Opts.CUDA = IK == IK_CUDA || IK == IK_PreprocessedCuda ||
>LangStd == LangStandard::lang_cuda;
>
> +  Opts.RenderScript = IK == IK_RenderScript;
> +  if (Opts.RenderScript) {
> +

[PATCH] D21228: Deprecated (legacy) string literal conversion to 'char *' causes strange overloading resolution

2016-06-10 Thread Alexander Makarov via cfe-commits
a.makarov created this revision.
a.makarov added a reviewer: rsmith.
a.makarov added a subscriber: cfe-commits.

It's a patch for PR28050. Seems like overloading resolution wipes out the first 
standard conversion sequence (before user-defined conversion) in case of 
deprecated string literal conversion.

http://reviews.llvm.org/D21228

Files:
  include/clang/Sema/Overload.h
  lib/Sema/SemaOverload.cpp
  test/SemaCXX/pr28050.cpp

Index: lib/Sema/SemaOverload.cpp
===
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -1199,7 +1199,6 @@
   case OR_Success:
   case OR_Deleted:
 ICS.setUserDefined();
-ICS.UserDefined.Before.setAsIdentityConversion();
 // C++ [over.ics.user]p4:
 //   A conversion of an expression of class type to the same class
 //   type is given Exact Match rank, and a conversion of an
@@ -4540,7 +4539,6 @@
   return ICS;
 }
 
-ICS.UserDefined.Before.setAsIdentityConversion();
 ICS.UserDefined.After.ReferenceBinding = true;
 ICS.UserDefined.After.IsLvalueReference = !isRValRef;
 ICS.UserDefined.After.BindsToFunctionLvalue = false;
Index: include/clang/Sema/Overload.h
===
--- include/clang/Sema/Overload.h
+++ include/clang/Sema/Overload.h
@@ -428,8 +428,11 @@
 };
 
 ImplicitConversionSequence()
-  : ConversionKind(Uninitialized), StdInitializerListElement(false)
-{}
+: ConversionKind(Uninitialized), StdInitializerListElement(false) {
+  Standard.First = ICK_Identity;
+  Standard.Second = ICK_Identity;
+  Standard.Third = ICK_Identity;
+}
 ~ImplicitConversionSequence() {
   destruct();
 }
Index: test/SemaCXX/pr28050.cpp
===
--- test/SemaCXX/pr28050.cpp
+++ test/SemaCXX/pr28050.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -std=c++11 %s -fsyntax-only
+//
+// expected-no-diagnostics
+
+class A {
+public:
+  A(char *s) {}
+  A(A &&) = delete;
+};
+
+int main() { A a("OK"); }


Index: lib/Sema/SemaOverload.cpp
===
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -1199,7 +1199,6 @@
   case OR_Success:
   case OR_Deleted:
 ICS.setUserDefined();
-ICS.UserDefined.Before.setAsIdentityConversion();
 // C++ [over.ics.user]p4:
 //   A conversion of an expression of class type to the same class
 //   type is given Exact Match rank, and a conversion of an
@@ -4540,7 +4539,6 @@
   return ICS;
 }
 
-ICS.UserDefined.Before.setAsIdentityConversion();
 ICS.UserDefined.After.ReferenceBinding = true;
 ICS.UserDefined.After.IsLvalueReference = !isRValRef;
 ICS.UserDefined.After.BindsToFunctionLvalue = false;
Index: include/clang/Sema/Overload.h
===
--- include/clang/Sema/Overload.h
+++ include/clang/Sema/Overload.h
@@ -428,8 +428,11 @@
 };
 
 ImplicitConversionSequence()
-  : ConversionKind(Uninitialized), StdInitializerListElement(false)
-{}
+: ConversionKind(Uninitialized), StdInitializerListElement(false) {
+  Standard.First = ICK_Identity;
+  Standard.Second = ICK_Identity;
+  Standard.Third = ICK_Identity;
+}
 ~ImplicitConversionSequence() {
   destruct();
 }
Index: test/SemaCXX/pr28050.cpp
===
--- test/SemaCXX/pr28050.cpp
+++ test/SemaCXX/pr28050.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -std=c++11 %s -fsyntax-only
+//
+// expected-no-diagnostics
+
+class A {
+public:
+  A(char *s) {}
+  A(A &&) = delete;
+};
+
+int main() { A a("OK"); }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20933: Preallocate ExplodedNode hash table

2016-06-10 Thread Ben Craig via cfe-commits
bcraig closed this revision.
bcraig added a comment.

Completed: At revision: 272394


http://reviews.llvm.org/D20933



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r272394 - Preallocate ExplodedNode hash table

2016-06-10 Thread Ben Craig via cfe-commits
Author: bcraig
Date: Fri Jun 10 08:22:13 2016
New Revision: 272394

URL: http://llvm.org/viewvc/llvm-project?rev=272394=rev
Log:
Preallocate ExplodedNode hash table

Rehashing the ExplodedNode table is very expensive. The hashing
itself is expensive, and the general activity of iterating over the
hash table is highly cache unfriendly. Instead, we guess at the
eventual size by using the maximum number of steps allowed. This
generally avoids a rehash. It is possible that we still need to
rehash if the backlog of work that is added to the worklist
significantly exceeds the number of work items that we process. Even
if we do need to rehash in that scenario, this change is still a
win, as we still have fewer rehashes that we would have prior to
this change.

For small work loads, this will increase the memory used. For large
work loads, it will somewhat reduce the memory used. Speed is
significantly increased. A large .C file took 3m53.812s to analyze
prior to this change. Now it takes 3m38.976s, for a ~6% improvement.

http://reviews.llvm.org/D20933

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp

Modified: 
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h?rev=272394=272393=272394=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h 
Fri Jun 10 08:22:13 2016
@@ -321,6 +321,8 @@ public:
   bool empty() const { return NumNodes == 0; }
   unsigned size() const { return NumNodes; }
 
+  void reserve(unsigned NodeCount) { Nodes.reserve(NodeCount); }
+
   // Iterators.
   typedef ExplodedNodeNodeTy;
   typedef llvm::FoldingSet  AllNodesTy;

Modified: cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp?rev=272394=272393=272394=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp Fri Jun 10 08:22:13 2016
@@ -208,6 +208,11 @@ bool CoreEngine::ExecuteWorkList(const L
 
   // Check if we have a steps limit
   bool UnlimitedSteps = Steps == 0;
+  // Cap our pre-reservation in the event that the user specifies
+  // a very large number of maximum steps.
+  const unsigned PreReservationCap = 400;
+  if(!UnlimitedSteps)
+G.reserve(std::min(Steps,PreReservationCap));
 
   while (WList->hasWork()) {
 if (!UnlimitedSteps) {


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20964: [clang-tidy] Add modernize-use-emplace

2016-06-10 Thread Stanisław Barzowski via cfe-commits
sbarzowski added inline comments.


Comment at: clang-tidy/modernize/UseEmplaceCheck.cpp:41
@@ +40,3 @@
+  // (and destructed) as in push_back case.
+  auto isCtorOfSmartPtr = hasDeclaration(cxxConstructorDecl(
+  ofClass(hasAnyName("std::shared_ptr", "std::unique_ptr", "std::auto_ptr",

vsk wrote:
> I agree that blacklisting some smart pointers is not a complete solution, and 
> that we shouldn't introduce a check which emits false positives.
> 
> ISTM it's **only** safe to perform the "push(T(...)) -> emplace(...)" change 
> if: it's safe to assume that if "emplace(...)" does not successfully call 
> "T(...)", it's OK for the program to fail/leak/crash. Do we get to make this 
> assumption ever? Perhaps just in no-exceptions mode?
hmmm... Maybe it's not that bad.

Let's look closely at the difference in behaviour.

with push_back it works like:
1) Call the constructor
2) Allocate the memory
3) Call the copy constructor

And emplace_back is:
1) Allocate the memory
2) Call the constructor

Each of these steps in both scenarios may fail.

If we call the constructor and it fails, then it's alright. We have the same 
behaviour in both cases - if it can fail it should do its cleanup. (And failure 
of copy constructor obviously doesn't bother us).

So the scenario we have to worry about in only when memory allocation fails. 
Then with push_back, we'll call constructor and then destructor, while 
emplace_back doesn't call constructor at all.

So the real question is: "Is it safe to throw some exception and not to call 
the constructor at all". And I see only one real-world case it isn't - taking 
the ownership of the object.



http://reviews.llvm.org/D20964



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21181: [include-fixer] give users an option to show N more headers in case there are too many candidates.

2016-06-10 Thread Eric Liu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272387: [include-fixer] give users an option to show N more 
headers in case there are… (authored by ioeric).

Changed prior to commit:
  http://reviews.llvm.org/D21181?vs=60338=60342#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21181

Files:
  clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py

Index: clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
===
--- clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
+++ clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
@@ -34,30 +34,41 @@
   1,
   vim.eval('g:clang_include_fixer_maximum_suggested_headers'))
 
+increment_num=5
+if vim.eval('exists("g:clang_include_fixer_increment_num")') == "1":
+  increment_num = max(
+  1,
+  vim.eval('g:clang_include_fixer_increment_num'))
 
 def GetUserSelection(message, headers, maximum_suggested_headers):
   eval_message = message + '\n'
   for idx, header in enumerate(headers[0:maximum_suggested_headers]):
 eval_message += "({0}). {1}\n".format(idx+1, header)
   eval_message += "Enter (q) to quit;"
   if maximum_suggested_headers < len(headers):
-eval_message += " (a) to show all candidates.";
+eval_message += " (m) to show {0} more candidates.".format(
+min(increment_num, len(headers) - maximum_suggested_headers))
+
   eval_message += "\nSelect (default 1): "
   res = vim.eval("input('{0}')".format(eval_message))
   if res == '':
 # choose the top ranked header by default
 idx = 1
   elif res == 'q':
 raise Exception('   Insertion cancelled...')
-  elif res == 'a' and maximum_suggested_headers < len(headers):
-return GetUserSelection(message, headers, len(headers))
+  elif res == 'm':
+return GetUserSelection(message,
+headers, maximum_suggested_headers + increment_num)
   else:
 try:
   idx = int(res)
   if idx <= 0 or idx > len(headers):
 raise Exception()
 except Exception:
-raise Exception('   ERROR: Invalid option "{0}"...Abort!'.format(res))
+  # Show a new prompt on invalid option instead of aborting so that users
+  # don't need to wait for another include-fixer run.
+  print >> sys.stderr, "Invalid option:", res
+  return GetUserSelection(message, headers, maximum_suggested_headers)
   return headers[idx-1]
 
 def execute(command, text):


Index: clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
===
--- clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
+++ clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
@@ -34,30 +34,41 @@
   1,
   vim.eval('g:clang_include_fixer_maximum_suggested_headers'))
 
+increment_num=5
+if vim.eval('exists("g:clang_include_fixer_increment_num")') == "1":
+  increment_num = max(
+  1,
+  vim.eval('g:clang_include_fixer_increment_num'))
 
 def GetUserSelection(message, headers, maximum_suggested_headers):
   eval_message = message + '\n'
   for idx, header in enumerate(headers[0:maximum_suggested_headers]):
 eval_message += "({0}). {1}\n".format(idx+1, header)
   eval_message += "Enter (q) to quit;"
   if maximum_suggested_headers < len(headers):
-eval_message += " (a) to show all candidates.";
+eval_message += " (m) to show {0} more candidates.".format(
+min(increment_num, len(headers) - maximum_suggested_headers))
+
   eval_message += "\nSelect (default 1): "
   res = vim.eval("input('{0}')".format(eval_message))
   if res == '':
 # choose the top ranked header by default
 idx = 1
   elif res == 'q':
 raise Exception('   Insertion cancelled...')
-  elif res == 'a' and maximum_suggested_headers < len(headers):
-return GetUserSelection(message, headers, len(headers))
+  elif res == 'm':
+return GetUserSelection(message,
+headers, maximum_suggested_headers + increment_num)
   else:
 try:
   idx = int(res)
   if idx <= 0 or idx > len(headers):
 raise Exception()
 except Exception:
-raise Exception('   ERROR: Invalid option "{0}"...Abort!'.format(res))
+  # Show a new prompt on invalid option instead of aborting so that users
+  # don't need to wait for another include-fixer run.
+  print >> sys.stderr, "Invalid option:", res
+  return GetUserSelection(message, headers, maximum_suggested_headers)
   return headers[idx-1]
 
 def execute(command, text):
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r272387 - [include-fixer] give users an option to show N more headers in case there are too many candidates.

2016-06-10 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Fri Jun 10 07:09:33 2016
New Revision: 272387

URL: http://llvm.org/viewvc/llvm-project?rev=272387=rev
Log:
[include-fixer] give users an option to show N more headers in case there are 
too many candidates.

Summary: give users an option to show N more headers in case there are too many 
candidates.

Reviewers: bkramer

Subscribers: cfe-commits

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

Modified:
clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py

Modified: clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py?rev=272387=272386=272387=diff
==
--- clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py (original)
+++ clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py Fri Jun 
10 07:09:33 2016
@@ -34,6 +34,11 @@ if vim.eval('exists("g:clang_include_fix
   1,
   vim.eval('g:clang_include_fixer_maximum_suggested_headers'))
 
+increment_num=5
+if vim.eval('exists("g:clang_include_fixer_increment_num")') == "1":
+  increment_num = max(
+  1,
+  vim.eval('g:clang_include_fixer_increment_num'))
 
 def GetUserSelection(message, headers, maximum_suggested_headers):
   eval_message = message + '\n'
@@ -41,7 +46,9 @@ def GetUserSelection(message, headers, m
 eval_message += "({0}). {1}\n".format(idx+1, header)
   eval_message += "Enter (q) to quit;"
   if maximum_suggested_headers < len(headers):
-eval_message += " (a) to show all candidates.";
+eval_message += " (m) to show {0} more candidates.".format(
+min(increment_num, len(headers) - maximum_suggested_headers))
+
   eval_message += "\nSelect (default 1): "
   res = vim.eval("input('{0}')".format(eval_message))
   if res == '':
@@ -49,15 +56,19 @@ def GetUserSelection(message, headers, m
 idx = 1
   elif res == 'q':
 raise Exception('   Insertion cancelled...')
-  elif res == 'a' and maximum_suggested_headers < len(headers):
-return GetUserSelection(message, headers, len(headers))
+  elif res == 'm':
+return GetUserSelection(message,
+headers, maximum_suggested_headers + increment_num)
   else:
 try:
   idx = int(res)
   if idx <= 0 or idx > len(headers):
 raise Exception()
 except Exception:
-raise Exception('   ERROR: Invalid option "{0}"...Abort!'.format(res))
+  # Show a new prompt on invalid option instead of aborting so that users
+  # don't need to wait for another include-fixer run.
+  print >> sys.stderr, "Invalid option:", res
+  return GetUserSelection(message, headers, maximum_suggested_headers)
   return headers[idx-1]
 
 def execute(command, text):


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19324: [ASTMatchers] new forEachOverriden matcher

2016-06-10 Thread Clement Courbet via cfe-commits
courbet closed this revision.
courbet added a comment.

This was submitted as r272386.


http://reviews.llvm.org/D19324



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r272386 - [ASTMatchers] New forEachOverriden matcher.

2016-06-10 Thread Clement Courbet via cfe-commits
Author: courbet
Date: Fri Jun 10 06:54:43 2016
New Revision: 272386

URL: http://llvm.org/viewvc/llvm-project?rev=272386=rev
Log:
[ASTMatchers] New forEachOverriden matcher.

Matches methods overridden by the given method.

Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=272386=272385=272386=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Fri Jun 10 06:54:43 2016
@@ -3968,6 +3968,30 @@ matcher, or is a pointer to a type that
 
 
 
+Matcherhttp://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html;>CXXMethodDeclforEachOverriddenMatcherhttp://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html;>CXXMethodDecl
 InnerMatcher
+Matches each 
method overriden by the given method. This matcher may
+produce multiple matches.
+
+Given
+  class A { virtual void f(); };
+  class B : public A { void f(); };
+  class C : public B { void f(); };
+cxxMethodDecl(ofClass(hasName("C")),
+  forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
+  matches once, with "b" binding "A::f" and "d" binding "C::f" (Note
+  that B::f is not overridden by C::f).
+
+The check can produce multiple matches in case of multiple inheritance, e.g.
+  class A1 { virtual void f(); };
+  class A2 { virtual void f(); };
+  class C : public A1, public A2 { void f(); };
+cxxMethodDecl(ofClass(hasName("C")),
+  forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
+  matches twice, once with "b" binding "A1::f" and "d" binding "C::f", and
+  once with "b" binding "A2::f" and "d" binding "C::f".
+
+
+
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html;>CXXMethodDeclofClassMatcherhttp://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html;>CXXRecordDecl
 InnerMatcher
 Matches the class 
declaration that the given method declaration
 belongs to.

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=272386=272385=272386=diff
==
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Fri Jun 10 06:54:43 2016
@@ -821,6 +821,9 @@ public:
   overridden_methods_end(const CXXMethodDecl *Method) const;
 
   unsigned overridden_methods_size(const CXXMethodDecl *Method) const;
+  typedef llvm::iterator_range
+  overridden_method_range;
+  overridden_method_range overridden_methods(const CXXMethodDecl *Method) 
const;
 
   /// \brief Note that the given C++ \p Method overrides the given \p
   /// Overridden method.

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=272386=272385=272386=diff
==
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Fri Jun 10 06:54:43 2016
@@ -16,6 +16,7 @@
 #ifndef LLVM_CLANG_AST_DECLCXX_H
 #define LLVM_CLANG_AST_DECLCXX_H
 
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTUnresolvedSet.h"
 #include "clang/AST/Attr.h"
 #include "clang/AST/Decl.h"
@@ -1828,6 +1829,8 @@ public:
   method_iterator begin_overridden_methods() const;
   method_iterator end_overridden_methods() const;
   unsigned size_overridden_methods() const;
+  typedef ASTContext::overridden_method_range overridden_method_range;
+  overridden_method_range overridden_methods() const;
 
   /// Returns the parent of this method declaration, which
   /// is the class in which this method is defined.

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=272386=272385=272386=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Fri Jun 10 06:54:43 2016
@@ -3770,6 +3770,47 @@ AST_MATCHER_P(CXXMethodDecl, ofClass,
   InnerMatcher.matches(*Parent, Finder, Builder));
 }
 
+/// \brief Matches each method overriden by the given method. This matcher may
+/// produce multiple matches.
+///
+/// Given
+/// \code
+///   class A { virtual void f(); };
+///   class B : public A { void f(); };
+///   class C : public B { void f(); };
+/// \endcode
+/// cxxMethodDecl(ofClass(hasName("C")),
+///  

Re: [PATCH] D20249: [OpenCL] Hierarchical/dynamic parallelism - enqueue kernel in OpenCL 2.0

2016-06-10 Thread Anastasia Stulova via cfe-commits
Anastasia marked 2 inline comments as done.
Anastasia added a comment.

http://reviews.llvm.org/D20249



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20821: Fix a few issues while skipping function bodies

2016-06-10 Thread Olivier Goffart via cfe-commits
ogoffart updated this revision to Diff 60340.
ogoffart added a comment.

Using Parser::ConsumeAndStoreFunctionPrologue this time


http://reviews.llvm.org/D20821

Files:
  lib/Parse/ParseCXXInlineMethods.cpp
  lib/Parse/ParseObjc.cpp
  lib/Parse/ParseStmt.cpp
  lib/Parse/Parser.cpp
  lib/Sema/SemaDecl.cpp
  test/CodeCompletion/ctor-initializer.cpp
  unittests/Tooling/ToolingTest.cpp

Index: unittests/Tooling/ToolingTest.cpp
===
--- unittests/Tooling/ToolingTest.cpp
+++ unittests/Tooling/ToolingTest.cpp
@@ -241,7 +241,7 @@
 struct SkipBodyConsumer : public clang::ASTConsumer {
   /// Skip the 'skipMe' function.
   bool shouldSkipFunctionBody(Decl *D) override {
-FunctionDecl *F = dyn_cast(D);
+NamedDecl *F = dyn_cast(D);
 return F && F->getNameAsString() == "skipMe";
   }
 };
@@ -255,10 +255,64 @@
 };
 
 TEST(runToolOnCode, TestSkipFunctionBody) {
+  std::vector Args = {"-std=c++11"};
+
   EXPECT_TRUE(runToolOnCode(new SkipBodyAction,
 "int skipMe() { an_error_here }"));
   EXPECT_FALSE(runToolOnCode(new SkipBodyAction,
  "int skipMeNot() { an_error_here }"));
+
+  // Test constructors with initializers
+  EXPECT_TRUE(runToolOnCodeWithArgs(
+  new SkipBodyAction,
+  "struct skipMe { skipMe() : an_error() { more error } };", Args));
+  EXPECT_TRUE(runToolOnCodeWithArgs(
+  new SkipBodyAction, "struct skipMe { skipMe(); };"
+  "skipMe::skipMe() : an_error([](){;}) { more error }",
+  Args));
+  EXPECT_TRUE(runToolOnCodeWithArgs(
+  new SkipBodyAction, "struct skipMe { skipMe(); };"
+  "skipMe::skipMe() : an_error{[](){;}} { more error }",
+  Args));
+  EXPECT_TRUE(runToolOnCodeWithArgs(
+  new SkipBodyAction,
+  "struct skipMe { skipMe(); };"
+  "skipMe::skipMe() : a>(), f{}, g() { error }",
+  Args));
+  EXPECT_TRUE(runToolOnCodeWithArgs(
+  new SkipBodyAction, "struct skipMe { skipMe() : bases()... { error } };",
+  Args));
+
+  EXPECT_FALSE(runToolOnCodeWithArgs(
+  new SkipBodyAction, "struct skipMeNot { skipMeNot() : an_error() { } };",
+  Args));
+  EXPECT_FALSE(runToolOnCodeWithArgs(new SkipBodyAction,
+ "struct skipMeNot { skipMeNot(); };"
+ "skipMeNot::skipMeNot() : an_error() { }",
+ Args));
+
+  // Try/catch
+  EXPECT_TRUE(runToolOnCode(
+  new SkipBodyAction,
+  "void skipMe() try { an_error() } catch(error) { error };"));
+  EXPECT_TRUE(runToolOnCode(
+  new SkipBodyAction,
+  "struct S { void skipMe() try { an_error() } catch(error) { error } };"));
+  EXPECT_TRUE(
+  runToolOnCode(new SkipBodyAction,
+"void skipMe() try { an_error() } catch(error) { error; }"
+"catch(error) { error } catch (error) { }"));
+  EXPECT_FALSE(runToolOnCode(
+  new SkipBodyAction,
+  "void skipMe() try something;")); // don't crash while parsing
+
+  // Template
+  EXPECT_TRUE(runToolOnCode(
+  new SkipBodyAction, "template int skipMe() { an_error_here }"
+  "int x = skipMe();"));
+  EXPECT_FALSE(
+  runToolOnCode(new SkipBodyAction,
+"template int skipMeNot() { an_error_here }"));
 }
 
 TEST(runToolOnCodeWithArgs, TestNoDepFile) {
Index: test/CodeCompletion/ctor-initializer.cpp
===
--- /dev/null
+++ test/CodeCompletion/ctor-initializer.cpp
@@ -0,0 +1,41 @@
+struct Base1 {
+  Base1() : {}
+  // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:2:12 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+  // CHECK-CC1: COMPLETION: Pattern : member1(<#args#>)
+  // CHECK-CC1: COMPLETION: Pattern : member2(<#args#>
+
+  Base1(int) : member1(123), {}
+  // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:7:30 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+  // CHECK-CC2-NOT: COMPLETION: Pattern : member1(<#args#>)
+  // CHECK-CC2: COMPLETION: Pattern : member2(<#args#>
+
+  int member1;
+  float member2;
+};
+
+struct Derived : public Base1 {
+  Derived();
+  Derived(int);
+  Derived(float);
+  int deriv1;
+};
+
+Derived::Derived() : {}
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:23:22 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
+// CHECK-CC3: COMPLETION: Pattern : Base1(<#args#>)
+// CHECK-CC3: COMPLETION: Pattern : deriv1(<#args#>)
+
+Derived::Derived(int) try : {
+} catch (...) {
+}
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:28:29 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
+// CHECK-CC4: COMPLETION: Pattern : Base1(<#args#>)
+// CHECK-CC4: COMPLETION: Pattern : deriv1(<#args#>)
+
+Derived::Derived(float) try : Base1(),
+{
+} catch (...) {
+}
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:35:39 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s
+// 

Re: [PATCH] D20249: [OpenCL] Hierarchical/dynamic parallelism - enqueue kernel in OpenCL 2.0

2016-06-10 Thread Anastasia Stulova via cfe-commits
Anastasia updated this revision to Diff 60339.
Anastasia added a comment.

Fixed issue with block typedef.


http://reviews.llvm.org/D20249

Files:
  include/clang/AST/Type.h
  include/clang/Basic/Builtins.def
  include/clang/Basic/Builtins.h
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Basic/Builtins.cpp
  lib/CodeGen/CGBuiltin.cpp
  lib/Headers/opencl-c.h
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaInit.cpp
  test/CodeGenOpenCL/cl20-device-side-enqueue.cl
  test/SemaOpenCL/cl20-device-side-enqueue.cl
  test/SemaOpenCL/clang-builtin-version.cl
  test/SemaOpenCL/to_addr_builtin.cl

Index: test/SemaOpenCL/to_addr_builtin.cl
===
--- test/SemaOpenCL/to_addr_builtin.cl
+++ test/SemaOpenCL/to_addr_builtin.cl
@@ -10,43 +10,44 @@
 
   glob = to_global(glob, loc);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{implicit declaration of function 'to_global' is invalid in C99}}
+  // expected-warning@-3{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}}
 #else
-  // expected-error@-4{{invalid number of arguments to function: 'to_global'}}
+  // expected-error@-5{{invalid number of arguments to function: 'to_global'}}
 #endif
 
   int x;
   glob = to_global(x);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}}
 #else
   // expected-error@-4{{invalid argument x to function: 'to_global', expecting a generic pointer argument}}
 #endif
 
   glob = to_global(con);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}}
 #else
   // expected-error@-4{{invalid argument con to function: 'to_global', expecting a generic pointer argument}}
 #endif
 
   glob = to_global(con_typedef);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}}
 #else
   // expected-error@-4{{invalid argument con_typedef to function: 'to_global', expecting a generic pointer argument}}
 #endif
 
   loc = to_global(glob);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__local int *' from 'int'}}
 #else
   // expected-error@-4{{assigning '__global int *' to '__local int *' changes address space of pointer}}
 #endif
 
   global char *glob_c = to_global(loc);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion initializing '__global char *' with an expression of type 'int'}}
 #else
   // expected-warning@-4{{incompatible pointer types initializing '__global char *' with an expression of type '__global int *'}}
 #endif
Index: test/SemaOpenCL/clang-builtin-version.cl
===
--- /dev/null
+++ test/SemaOpenCL/clang-builtin-version.cl
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 %s -fblocks -verify -pedantic -fsyntax-only -ferror-limit 100
+
+// Confirm CL2.0 Clang builtins are not available in earlier versions
+
+kernel void dse_builtins() {
+  int tmp;
+  enqueue_kernel(tmp, tmp, tmp, ^(void) { // expected-warning{{implicit declaration of function 'enqueue_kernel' is invalid in C99}}
+return;
+  });
+  unsigned size = get_kernel_work_group_size(^(void) { // expected-warning{{implicit declaration of function 'get_kernel_work_group_size' is invalid in C99}}
+return;
+  });
+  size = get_kernel_preferred_work_group_size_multiple(^(void) { // expected-warning{{implicit declaration of function 'get_kernel_preferred_work_group_size_multiple' is invalid in C99}}
+return;
+  });
+}
+
+void pipe_builtins() {
+  int tmp;
+
+  read_pipe(tmp, tmp);  // expected-warning{{implicit declaration of function 'read_pipe' is invalid in C99}}
+  write_pipe(tmp, tmp); // expected-warning{{implicit declaration of function 'write_pipe' is invalid in C99}}
+
+  reserve_read_pipe(tmp, tmp);  // expected-warning{{implicit declaration of function 'reserve_read_pipe' is invalid in C99}}
+  reserve_write_pipe(tmp, tmp); // expected-warning{{implicit declaration of function 'reserve_write_pipe' is invalid in C99}}
+
+  work_group_reserve_read_pipe(tmp, tmp);  // expected-warning{{implicit declaration of function 'work_group_reserve_read_pipe' is invalid in C99}}
+  work_group_reserve_write_pipe(tmp, tmp); // 

Re: [PATCH] D21181: [include-fixer] give users an option to show N more headers in case there are too many candidates.

2016-06-10 Thread Eric Liu via cfe-commits
ioeric updated this revision to Diff 60338.
ioeric added a comment.

- remove option (a) in favor of option (m); show a new prompt on invalid option 
instead of aborting.


http://reviews.llvm.org/D21181

Files:
  include-fixer/tool/clang-include-fixer.py

Index: include-fixer/tool/clang-include-fixer.py
===
--- include-fixer/tool/clang-include-fixer.py
+++ include-fixer/tool/clang-include-fixer.py
@@ -34,30 +34,41 @@
   1,
   vim.eval('g:clang_include_fixer_maximum_suggested_headers'))
 
+increment_num=5
+if vim.eval('exists("g:clang_include_fixer_increment_num")') == "1":
+  increment_num = max(
+  1,
+  vim.eval('g:clang_include_fixer_increment_num'))
 
 def GetUserSelection(message, headers, maximum_suggested_headers):
   eval_message = message + '\n'
   for idx, header in enumerate(headers[0:maximum_suggested_headers]):
 eval_message += "({0}). {1}\n".format(idx+1, header)
   eval_message += "Enter (q) to quit;"
   if maximum_suggested_headers < len(headers):
-eval_message += " (a) to show all candidates.";
+eval_message += " (m) to show {0} more candidates.".format(
+min(increment_num, len(headers) - maximum_suggested_headers))
+
   eval_message += "\nSelect (default 1): "
   res = vim.eval("input('{0}')".format(eval_message))
   if res == '':
 # choose the top ranked header by default
 idx = 1
   elif res == 'q':
 raise Exception('   Insertion cancelled...')
-  elif res == 'a' and maximum_suggested_headers < len(headers):
-return GetUserSelection(message, headers, len(headers))
+  elif res == 'm':
+return GetUserSelection(message,
+headers, maximum_suggested_headers + increment_num)
   else:
 try:
   idx = int(res)
   if idx <= 0 or idx > len(headers):
 raise Exception()
 except Exception:
-raise Exception('   ERROR: Invalid option "{0}"...Abort!'.format(res))
+  # Show a new prompt on invalid option instead of aborting so that users
+  # don't need to wait for another include-fixer run.
+  print >> sys.stderr, "Invalid option:", res
+  return GetUserSelection(message, headers, maximum_suggested_headers)
   return headers[idx-1]
 
 def execute(command, text):


Index: include-fixer/tool/clang-include-fixer.py
===
--- include-fixer/tool/clang-include-fixer.py
+++ include-fixer/tool/clang-include-fixer.py
@@ -34,30 +34,41 @@
   1,
   vim.eval('g:clang_include_fixer_maximum_suggested_headers'))
 
+increment_num=5
+if vim.eval('exists("g:clang_include_fixer_increment_num")') == "1":
+  increment_num = max(
+  1,
+  vim.eval('g:clang_include_fixer_increment_num'))
 
 def GetUserSelection(message, headers, maximum_suggested_headers):
   eval_message = message + '\n'
   for idx, header in enumerate(headers[0:maximum_suggested_headers]):
 eval_message += "({0}). {1}\n".format(idx+1, header)
   eval_message += "Enter (q) to quit;"
   if maximum_suggested_headers < len(headers):
-eval_message += " (a) to show all candidates.";
+eval_message += " (m) to show {0} more candidates.".format(
+min(increment_num, len(headers) - maximum_suggested_headers))
+
   eval_message += "\nSelect (default 1): "
   res = vim.eval("input('{0}')".format(eval_message))
   if res == '':
 # choose the top ranked header by default
 idx = 1
   elif res == 'q':
 raise Exception('   Insertion cancelled...')
-  elif res == 'a' and maximum_suggested_headers < len(headers):
-return GetUserSelection(message, headers, len(headers))
+  elif res == 'm':
+return GetUserSelection(message,
+headers, maximum_suggested_headers + increment_num)
   else:
 try:
   idx = int(res)
   if idx <= 0 or idx > len(headers):
 raise Exception()
 except Exception:
-raise Exception('   ERROR: Invalid option "{0}"...Abort!'.format(res))
+  # Show a new prompt on invalid option instead of aborting so that users
+  # don't need to wait for another include-fixer run.
+  print >> sys.stderr, "Invalid option:", res
+  return GetUserSelection(message, headers, maximum_suggested_headers)
   return headers[idx-1]
 
 def execute(command, text):
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21224: [Driver] Add method to redirect output of Compilation.

2016-06-10 Thread Nikolay Haustov via cfe-commits
nhaustov updated this revision to Diff 60333.
nhaustov updated the summary for this revision.
nhaustov added a comment.

Fix summary.


http://reviews.llvm.org/D21224

Files:
  include/clang/Driver/Compilation.h
  lib/Driver/Compilation.cpp

Index: lib/Driver/Compilation.cpp
===
--- lib/Driver/Compilation.cpp
+++ lib/Driver/Compilation.cpp
@@ -42,6 +42,7 @@
 
   // Free redirections of stdout/stderr.
   if (Redirects) {
+delete Redirects[0];
 delete Redirects[1];
 delete Redirects[2];
 delete [] Redirects;
@@ -210,3 +211,7 @@
 StringRef Compilation::getSysRoot() const {
   return getDriver().SysRoot;
 }
+
+void Compilation::Redirect(const StringRef** Redirects) {
+  this->Redirects = Redirects;
+}
Index: include/clang/Driver/Compilation.h
===
--- include/clang/Driver/Compilation.h
+++ include/clang/Driver/Compilation.h
@@ -208,6 +208,15 @@
 
   /// Return true if we're compiling for diagnostics.
   bool isForDiagnostics() const { return ForDiagnostics; }
+
+  /// RedirectOutput - Redirect output of this compilation. Can only be done 
once.
+  ///
+  /// \param Redirects - array of pointers to paths. The array
+  /// should have a size of three. The inferior process's
+  /// stdin(0), stdout(1), and stderr(2) will be redirected to the
+  /// corresponding paths. This compilation instance becomes
+  /// the owner of Redirects and will delete the array and StringRef's.
+  void Redirect(const StringRef** Redirects);
 };
 
 } // end namespace driver


Index: lib/Driver/Compilation.cpp
===
--- lib/Driver/Compilation.cpp
+++ lib/Driver/Compilation.cpp
@@ -42,6 +42,7 @@
 
   // Free redirections of stdout/stderr.
   if (Redirects) {
+delete Redirects[0];
 delete Redirects[1];
 delete Redirects[2];
 delete [] Redirects;
@@ -210,3 +211,7 @@
 StringRef Compilation::getSysRoot() const {
   return getDriver().SysRoot;
 }
+
+void Compilation::Redirect(const StringRef** Redirects) {
+  this->Redirects = Redirects;
+}
Index: include/clang/Driver/Compilation.h
===
--- include/clang/Driver/Compilation.h
+++ include/clang/Driver/Compilation.h
@@ -208,6 +208,15 @@
 
   /// Return true if we're compiling for diagnostics.
   bool isForDiagnostics() const { return ForDiagnostics; }
+
+  /// RedirectOutput - Redirect output of this compilation. Can only be done once.
+  ///
+  /// \param Redirects - array of pointers to paths. The array
+  /// should have a size of three. The inferior process's
+  /// stdin(0), stdout(1), and stderr(2) will be redirected to the
+  /// corresponding paths. This compilation instance becomes
+  /// the owner of Redirects and will delete the array and StringRef's.
+  void Redirect(const StringRef** Redirects);
 };
 
 } // end namespace driver
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D21224: [Driver] Add method to redirect output of Compilation.

2016-06-10 Thread Nikolay Haustov via cfe-commits
nhaustov created this revision.
nhaustov added a reviewer: tstellarAMD.
nhaustov added a subscriber: cfe-commits.

Currently output of child process, however in my use case, it
needs to be captured and presented to the user.

Add Redirect method to Compilation and use existing infrastructure
for redirecting output of commands.

http://reviews.llvm.org/D21224

Files:
  include/clang/Driver/Compilation.h
  lib/Driver/Compilation.cpp

Index: lib/Driver/Compilation.cpp
===
--- lib/Driver/Compilation.cpp
+++ lib/Driver/Compilation.cpp
@@ -42,6 +42,7 @@
 
   // Free redirections of stdout/stderr.
   if (Redirects) {
+delete Redirects[0];
 delete Redirects[1];
 delete Redirects[2];
 delete [] Redirects;
@@ -210,3 +211,7 @@
 StringRef Compilation::getSysRoot() const {
   return getDriver().SysRoot;
 }
+
+void Compilation::Redirect(const StringRef** Redirects) {
+  this->Redirects = Redirects;
+}
Index: include/clang/Driver/Compilation.h
===
--- include/clang/Driver/Compilation.h
+++ include/clang/Driver/Compilation.h
@@ -208,6 +208,15 @@
 
   /// Return true if we're compiling for diagnostics.
   bool isForDiagnostics() const { return ForDiagnostics; }
+
+  /// RedirectOutput - Redirect output of this compilation. Can only be done 
once.
+  ///
+  /// \param Redirects - array of pointers to paths. The array
+  /// should have a size of three. The inferior process's
+  /// stdin(0), stdout(1), and stderr(2) will be redirected to the
+  /// corresponding paths. This compilation instance becomes
+  /// the owner of Redirects and will delete the array and StringRef's.
+  void Redirect(const StringRef** Redirects);
 };
 
 } // end namespace driver


Index: lib/Driver/Compilation.cpp
===
--- lib/Driver/Compilation.cpp
+++ lib/Driver/Compilation.cpp
@@ -42,6 +42,7 @@
 
   // Free redirections of stdout/stderr.
   if (Redirects) {
+delete Redirects[0];
 delete Redirects[1];
 delete Redirects[2];
 delete [] Redirects;
@@ -210,3 +211,7 @@
 StringRef Compilation::getSysRoot() const {
   return getDriver().SysRoot;
 }
+
+void Compilation::Redirect(const StringRef** Redirects) {
+  this->Redirects = Redirects;
+}
Index: include/clang/Driver/Compilation.h
===
--- include/clang/Driver/Compilation.h
+++ include/clang/Driver/Compilation.h
@@ -208,6 +208,15 @@
 
   /// Return true if we're compiling for diagnostics.
   bool isForDiagnostics() const { return ForDiagnostics; }
+
+  /// RedirectOutput - Redirect output of this compilation. Can only be done once.
+  ///
+  /// \param Redirects - array of pointers to paths. The array
+  /// should have a size of three. The inferior process's
+  /// stdin(0), stdout(1), and stderr(2) will be redirected to the
+  /// corresponding paths. This compilation instance becomes
+  /// the owner of Redirects and will delete the array and StringRef's.
+  void Redirect(const StringRef** Redirects);
 };
 
 } // end namespace driver
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21022: [ARM] Fix linker emulation for arm 32 big endian

2016-06-10 Thread Peter Smith via cfe-commits
peter.smith accepted this revision.
peter.smith added a comment.
This revision is now accepted and ready to land.

I think the change looks fine and it looks small enough for me to approve.


http://reviews.llvm.org/D21022



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20249: [OpenCL] Hierarchical/dynamic parallelism - enqueue kernel in OpenCL 2.0

2016-06-10 Thread Anastasia Stulova via cfe-commits
Anastasia updated this revision to Diff 60330.
Anastasia marked 2 inline comments as done.
Anastasia added a comment.

  - Allow passing array of events as a valid event list object (following C 
implicit cast rules of arrays to pointers) in enqueue_kernel function.
- Added failing test case!
- Removed declarations of  get_kernel_work_group_size and 
get_kernel_preferred_work_group_size_multiple from the OpenCL header.


http://reviews.llvm.org/D20249

Files:
  include/clang/AST/Type.h
  include/clang/Basic/Builtins.def
  include/clang/Basic/Builtins.h
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Basic/Builtins.cpp
  lib/CodeGen/CGBuiltin.cpp
  lib/Headers/opencl-c.h
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaInit.cpp
  test/CodeGenOpenCL/cl20-device-side-enqueue.cl
  test/SemaOpenCL/cl20-device-side-enqueue.cl
  test/SemaOpenCL/clang-builtin-version.cl
  test/SemaOpenCL/to_addr_builtin.cl

Index: test/SemaOpenCL/to_addr_builtin.cl
===
--- test/SemaOpenCL/to_addr_builtin.cl
+++ test/SemaOpenCL/to_addr_builtin.cl
@@ -10,43 +10,44 @@
 
   glob = to_global(glob, loc);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{implicit declaration of function 'to_global' is invalid in C99}}
+  // expected-warning@-3{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}}
 #else
-  // expected-error@-4{{invalid number of arguments to function: 'to_global'}}
+  // expected-error@-5{{invalid number of arguments to function: 'to_global'}}
 #endif
 
   int x;
   glob = to_global(x);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}}
 #else
   // expected-error@-4{{invalid argument x to function: 'to_global', expecting a generic pointer argument}}
 #endif
 
   glob = to_global(con);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}}
 #else
   // expected-error@-4{{invalid argument con to function: 'to_global', expecting a generic pointer argument}}
 #endif
 
   glob = to_global(con_typedef);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}}
 #else
   // expected-error@-4{{invalid argument con_typedef to function: 'to_global', expecting a generic pointer argument}}
 #endif
 
   loc = to_global(glob);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__local int *' from 'int'}}
 #else
   // expected-error@-4{{assigning '__global int *' to '__local int *' changes address space of pointer}}
 #endif
 
   global char *glob_c = to_global(loc);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion initializing '__global char *' with an expression of type 'int'}}
 #else
   // expected-warning@-4{{incompatible pointer types initializing '__global char *' with an expression of type '__global int *'}}
 #endif
Index: test/SemaOpenCL/clang-builtin-version.cl
===
--- /dev/null
+++ test/SemaOpenCL/clang-builtin-version.cl
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 %s -fblocks -verify -pedantic -fsyntax-only -ferror-limit 100
+
+// Confirm CL2.0 Clang builtins are not available in earlier versions
+
+kernel void dse_builtins() {
+  int tmp;
+  enqueue_kernel(tmp, tmp, tmp, ^(void) { // expected-warning{{implicit declaration of function 'enqueue_kernel' is invalid in C99}}
+return;
+  });
+  unsigned size = get_kernel_work_group_size(^(void) { // expected-warning{{implicit declaration of function 'get_kernel_work_group_size' is invalid in C99}}
+return;
+  });
+  size = get_kernel_preferred_work_group_size_multiple(^(void) { // expected-warning{{implicit declaration of function 'get_kernel_preferred_work_group_size_multiple' is invalid in C99}}
+return;
+  });
+}
+
+void pipe_builtins() {
+  int tmp;
+
+  read_pipe(tmp, tmp);  // expected-warning{{implicit declaration of function 'read_pipe' is invalid in C99}}
+  write_pipe(tmp, tmp); // expected-warning{{implicit declaration of function 'write_pipe' is invalid in C99}}
+
+  reserve_read_pipe(tmp, tmp);  // expected-warning{{implicit declaration of function 'reserve_read_pipe' is invalid in C99}}
+  

Re: [PATCH] D21181: [include-fixer] give users an option to show N more headers in case there are too many candidates.

2016-06-10 Thread Benjamin Kramer via cfe-commits
bkramer added a comment.

I'm not convinced that this use case is common enough to make the interface 
more complex. Should we remove (a) in favor of this?


http://reviews.llvm.org/D21181



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D21223: [clang-tidy] misc-move-const-arg: Detect if result of std::move() is being passed as a const ref argument

2016-06-10 Thread Martin Böhme via cfe-commits
mboehme created this revision.
mboehme added reviewers: alexfh, hokein.
mboehme added a subscriber: cfe-commits.

Conceptually, this is very close to the existing functionality of 
misc-move-const-arg, which is why I'm adding it here and not creating a new 
check. For example, for a type A that is both movable and copyable, this

  const A a1;
  A a2(std::move(a1));

is not only a case where a const argument is being passed to std::move(), but 
the result of std::move() is also being passed as a const reference (due to 
overload resolution).

The new check typically triggers (exclusively) in cases where people think 
they're dealing with a movable type, but in fact the type is not movable.

http://reviews.llvm.org/D21223

Files:
  clang-tidy/misc/MoveConstantArgumentCheck.cpp
  docs/clang-tidy/checks/misc-move-const-arg.rst
  test/clang-tidy/misc-move-const-arg.cpp

Index: test/clang-tidy/misc-move-const-arg.cpp
===
--- test/clang-tidy/misc-move-const-arg.cpp
+++ test/clang-tidy/misc-move-const-arg.cpp
@@ -71,3 +71,90 @@
   f10(1);
   f10(1);
 }
+
+struct NonMoveable {
+ public:
+  NonMoveable();
+  NonMoveable(const NonMoveable &);
+
+  NonMoveable =(const NonMoveable &);
+};
+
+void callByConstRef(const NonMoveable &);
+void callByConstRef(int i, const NonMoveable &);
+
+void moveToConstReferencePositives() {
+  NonMoveable obj;
+
+  // Basic case.
+  callByConstRef(std::move(obj));
+  // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: passing result of std::move() as
+  // CHECK-FIXES: callByConstRef(obj);
+
+  // Also works for second argument.
+  callByConstRef(1, std::move(obj));
+  // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: passing result of std::move() as
+  // CHECK-FIXES: callByConstRef(1, obj);
+
+  // Works if std::move() applied to a temporary.
+  callByConstRef(std::move(NonMoveable()));
+  // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: passing result of std::move() as
+  // CHECK-FIXES: callByConstRef(NonMoveable());
+
+  // Works if calling a copy constructor.
+  NonMoveable other(std::move(obj));
+  // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: passing result of std::move() as
+  // CHECK-FIXES: NonMoveable other(obj);
+
+  // Works if calling assignment operator.
+  other = std::move(obj);
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: passing result of std::move() as
+  // CHECK-FIXES: other = obj;
+}
+
+struct Moveable {
+ public:
+  Moveable();
+  Moveable(Moveable &&);
+
+  Moveable =(Moveable &&);
+};
+
+void callByValue(Moveable);
+
+void callByRValueRef(Moveable &&);
+
+template 
+void templateFunction(T obj) {
+  T other = std::move(obj);
+}
+
+#define M3(T, obj)\
+  do {\
+T other = std::move(obj); \
+  } while (true)
+
+#define CALL(func) (func)()
+
+void moveToConstReferenceNegatives() {
+  // No warning when actual move takes place.
+  Moveable moveable;
+  callByValue(std::move(moveable));
+  callByRValueRef(std::move(moveable));
+  Moveable other(std::move(moveable));
+  other = std::move(moveable);
+
+  // No warning if std::move() not used.
+  NonMoveable non_moveable;
+  callByConstRef(non_moveable);
+
+  // No warning if instantiating a template.
+  templateFunction(non_moveable);
+
+  // No warning inside of macro expansions.
+  M3(NonMoveable, non_moveable);
+
+  // No warning inside of macro expansion, even if the macro expansion is inside
+  // a lambda that is, in turn, an argument to a macro.
+  CALL([non_moveable] { M3(NonMoveable, non_moveable); });
+}
Index: docs/clang-tidy/checks/misc-move-const-arg.rst
===
--- docs/clang-tidy/checks/misc-move-const-arg.rst
+++ docs/clang-tidy/checks/misc-move-const-arg.rst
@@ -3,13 +3,26 @@
 misc-move-const-arg
 ===
 
-The check warns if ``std::move()`` is called with a constant argument or an
-argument of a trivially-copyable type, e.g.:
+The check warns
+
+  - if ``std::move()`` is called with a constant argument,
+  - if ``std::move()`` is called with an argument of a trivially-copyable type,
+or
+  - if the result of ``std::move()`` is passed as a const reference argument.
+
+In all three cases, the check will suggest a fix that removes the
+``std::move()``.
+
+Here are examples of each of the three cases:
 
 .. code:: c++
 
   const string s;
   return std::move(s);  // Warning: std::move of the const variable has no effect
 
   int x;
   return std::move(x);  // Warning: std::move of the variable of a trivially-copyable type has no effect
+
+  void f(const string );
+  string s;
+  f(std::move(s));  // Warning: passing result of std::move as a const reference argument; no move will actually happen
Index: clang-tidy/misc/MoveConstantArgumentCheck.cpp
===
--- clang-tidy/misc/MoveConstantArgumentCheck.cpp
+++ clang-tidy/misc/MoveConstantArgumentCheck.cpp
@@ -17,51 +17,112 @@
 

Re: [PATCH] D18170: [CUDA][OpenMP] Create generic offload toolchains

2016-06-10 Thread Jonas Hahnfeld via cfe-commits
Hahnfeld added a comment.

@tra any more comments on this?


http://reviews.llvm.org/D18170



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r272381 - clang-rename: fix the DynamicCastExpr test on ps4

2016-06-10 Thread Miklos Vajna via cfe-commits
Author: vmiklos
Date: Fri Jun 10 03:29:02 2016
New Revision: 272381

URL: http://llvm.org/viewvc/llvm-project?rev=272381=rev
Log:
clang-rename: fix the DynamicCastExpr test on ps4

It has RTTI disabled by default, so need to enable it explicitly.

Reviewers: silvas

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

Modified:
clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp

Modified: clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp?rev=272381=272380=272381=diff
==
--- clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp (original)
+++ clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp Fri Jun 10 
03:29:02 2016
@@ -1,5 +1,5 @@
 // RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=186 -new-name=X %t.cpp -i --
+// RUN: clang-rename -offset=193 -new-name=X %t.cpp -i -- -frtti
 // RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
 class Base {
   virtual int getValue() const = 0;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21186: clang-rename: fix the DynamicCastExpr test on ps4

2016-06-10 Thread Miklos Vajna via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272381: clang-rename: fix the DynamicCastExpr test on ps4 
(authored by vmiklos).

Changed prior to commit:
  http://reviews.llvm.org/D21186?vs=60324=60326#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21186

Files:
  clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp

Index: clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
===
--- clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
+++ clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
@@ -1,5 +1,5 @@
 // RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=186 -new-name=X %t.cpp -i --
+// RUN: clang-rename -offset=193 -new-name=X %t.cpp -i -- -frtti
 // RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
 class Base {
   virtual int getValue() const = 0;


Index: clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
===
--- clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
+++ clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
@@ -1,5 +1,5 @@
 // RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=186 -new-name=X %t.cpp -i --
+// RUN: clang-rename -offset=193 -new-name=X %t.cpp -i -- -frtti
 // RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
 class Base {
   virtual int getValue() const = 0;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21186: clang-rename: fix the DynamicCastExpr test on ps4

2016-06-10 Thread Sean Silva via cfe-commits
silvas accepted this revision.
silvas added a reviewer: silvas.
silvas added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D21186



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21186: clang-rename: fix the DynamicCastExpr test on ps4

2016-06-10 Thread Miklos Vajna via cfe-commits
vmiklos updated this revision to Diff 60324.
vmiklos added a comment.

Correct diff this time.


http://reviews.llvm.org/D21186

Files:
  test/clang-rename/DynamicCastExpr.cpp

Index: test/clang-rename/DynamicCastExpr.cpp
===
--- test/clang-rename/DynamicCastExpr.cpp
+++ test/clang-rename/DynamicCastExpr.cpp
@@ -1,5 +1,5 @@
 // RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=186 -new-name=X %t.cpp -i --
+// RUN: clang-rename -offset=193 -new-name=X %t.cpp -i -- -frtti
 // RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
 class Base {
   virtual int getValue() const = 0;


Index: test/clang-rename/DynamicCastExpr.cpp
===
--- test/clang-rename/DynamicCastExpr.cpp
+++ test/clang-rename/DynamicCastExpr.cpp
@@ -1,5 +1,5 @@
 // RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=186 -new-name=X %t.cpp -i --
+// RUN: clang-rename -offset=193 -new-name=X %t.cpp -i -- -frtti
 // RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
 class Base {
   virtual int getValue() const = 0;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r272378 - test commit: remove trailing whitespace in comments

2016-06-10 Thread Clement Courbet via cfe-commits
Author: courbet
Date: Fri Jun 10 03:12:37 2016
New Revision: 272378

URL: http://llvm.org/viewvc/llvm-project?rev=272378=rev
Log:
test commit: remove trailing whitespace in comments

Modified:
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=272378=272377=272378=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Fri Jun 10 03:12:37 2016
@@ -482,7 +482,7 @@ const internal::VariadicDynCastAllOfMatc
 ///   };
 /// \endcode
 /// fieldDecl(isPublic())
-///   matches 'int a;' 
+///   matches 'int a;'
 AST_MATCHER(Decl, isPublic) {
   return Node.getAccess() == AS_public;
 }
@@ -498,7 +498,7 @@ AST_MATCHER(Decl, isPublic) {
 ///   };
 /// \endcode
 /// fieldDecl(isProtected())
-///   matches 'int b;' 
+///   matches 'int b;'
 AST_MATCHER(Decl, isProtected) {
   return Node.getAccess() == AS_protected;
 }
@@ -514,7 +514,7 @@ AST_MATCHER(Decl, isProtected) {
 ///   };
 /// \endcode
 /// fieldDecl(isPrivate())
-///   matches 'int c;' 
+///   matches 'int c;'
 AST_MATCHER(Decl, isPrivate) {
   return Node.getAccess() == AS_private;
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21186: clang-rename: fix the DynamicCastExpr test on ps4

2016-06-10 Thread Miklos Vajna via cfe-commits
vmiklos retitled this revision from "clang-rename: mark the DynamicCastExpr 
test unsupported on ps4" to "clang-rename: fix the DynamicCastExpr test on ps4".
vmiklos updated the summary for this revision.
vmiklos updated this revision to Diff 60320.
vmiklos added a comment.

Ah, then the fix is simpler, I guess. :-)


http://reviews.llvm.org/D21186

Files:
  test/clang-rename/DynamicCastExpr.cpp

Index: test/clang-rename/DynamicCastExpr.cpp
===
--- test/clang-rename/DynamicCastExpr.cpp
+++ test/clang-rename/DynamicCastExpr.cpp
@@ -1,5 +1,6 @@
+// UNSUPPORTED: x86_64-scei-ps4
 // RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=186 -new-name=X %t.cpp -i --
+// RUN: clang-rename -offset=218 -new-name=X %t.cpp -i --
 // RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
 class Base {
   virtual int getValue() const = 0;


Index: test/clang-rename/DynamicCastExpr.cpp
===
--- test/clang-rename/DynamicCastExpr.cpp
+++ test/clang-rename/DynamicCastExpr.cpp
@@ -1,5 +1,6 @@
+// UNSUPPORTED: x86_64-scei-ps4
 // RUN: cat %s > %t.cpp
-// RUN: clang-rename -offset=186 -new-name=X %t.cpp -i --
+// RUN: clang-rename -offset=218 -new-name=X %t.cpp -i --
 // RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
 class Base {
   virtual int getValue() const = 0;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21186: clang-rename: mark the DynamicCastExpr test unsupported on ps4

2016-06-10 Thread Sean Silva via cfe-commits
silvas added a comment.

In http://reviews.llvm.org/D21186#454497, @silvas wrote:

> > It has no RTTI, so the test would always fail in a non-interesting way.
>
>
> It does. There is a call to dynamic_cast on lines 20 and 21 of this test. You 
> can fix this by explicitly adding -frtti I believe.


Sorry, that was a bit unclear (I thought you meant "it" meaning "this test"). 
On PS4 RTTI is disabled by default, but -frtti turns it on, so you should be 
able to add -frtti to this test to fix it.


http://reviews.llvm.org/D21186



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21186: clang-rename: mark the DynamicCastExpr test unsupported on ps4

2016-06-10 Thread Sean Silva via cfe-commits
silvas added a subscriber: silvas.
silvas added a comment.

> It has no RTTI, so the test would always fail in a non-interesting way.


It does. There is a call to dynamic_cast on lines 20 and 21 of this test. You 
can fix this by explicitly adding -frtti I believe.


http://reviews.llvm.org/D21186



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits