Re: [PATCH] D14471: [AArch64] Fix a crash in driver

2015-11-12 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment.

> If you can get the CPU name, return it. If not, return "native". If you're on 
> AArch64 and you can't get the CPU name, that's a bug that needs fixing. If 
> it's always "generic", that's another piece of code that needs fixing. If 
> whatever getCPU function you use doesn't return a valid name, and the name 
> chosen was "native", you should return "native".


I'm guessing this is what you are suggesting:

In getAArch64TargetCPU, if it finds out the cpu name passed via -mtune or -mcpu 
is "native",

1. Call llvm::sys::getHostCPUName to get the host CPU name.
2. Check the host CPU name to see if it is a valid AArch64 CPU. A CPU is valid 
if it is one of these CPUs: cyclone, cortex-a53, cortex-a57, cortex-a72, or 
generic (this is the set of CPUs that are valid in DecodeAArch64Mcpu).
3. If the host CPU is valid, return the CPU name. Otherwise, return "native".


http://reviews.llvm.org/D14471



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


r253016 - scan-build: Fix install.

2015-11-12 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Fri Nov 13 00:48:02 2015
New Revision: 253016

URL: http://llvm.org/viewvc/llvm-project?rev=253016&view=rev
Log:
scan-build: Fix install.

Modified:
cfe/trunk/tools/scan-build/CMakeLists.txt

Modified: cfe/trunk/tools/scan-build/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/CMakeLists.txt?rev=253016&r1=253015&r2=253016&view=diff
==
--- cfe/trunk/tools/scan-build/CMakeLists.txt (original)
+++ cfe/trunk/tools/scan-build/CMakeLists.txt Fri Nov 13 00:48:02 2015
@@ -72,7 +72,7 @@ if(CLANG_INSTALL_SCANBUILD)
  ${CMAKE_BINARY_DIR}/share/scan-view/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
 list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
-install(FILES ${ShareFile} DESTINATION share/scan-view)
+install(FILES share/${ShareFile} DESTINATION share/scan-view)
   endforeach()
 
   add_custom_target(scan-build ALL DEPENDS ${Depends})


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


r253013 - [Sema] __is_constructible should return false for function types

2015-11-12 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Thu Nov 12 23:32:43 2015
New Revision: 253013

URL: http://llvm.org/viewvc/llvm-project?rev=253013&view=rev
Log:
[Sema] __is_constructible should return false for function types

While functions types are complete, they cannot be constructed.

This fixes PR25513.

Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/SemaCXX/type-traits.cpp

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=253013&r1=253012&r2=253013&view=diff
==
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu Nov 12 23:32:43 2015
@@ -4084,12 +4084,13 @@ static bool evaluateTypeTrait(Sema &S, T
 return false;
 }
 
-// Make sure the first argument is a complete type.
-if (Args[0]->getType()->isIncompleteType())
+// Make sure the first argument is not incomplete nor a function type.
+QualType T = Args[0]->getType();
+if (T->isIncompleteType() || T->isFunctionType())
   return false;
 
 // Make sure the first argument is not an abstract type.
-CXXRecordDecl *RD = Args[0]->getType()->getAsCXXRecordDecl();
+CXXRecordDecl *RD = T->getAsCXXRecordDecl();
 if (RD && RD->isAbstract())
   return false;
 
@@ -4097,13 +4098,13 @@ static bool evaluateTypeTrait(Sema &S, T
 SmallVector ArgExprs;
 ArgExprs.reserve(Args.size() - 1);
 for (unsigned I = 1, N = Args.size(); I != N; ++I) {
-  QualType T = Args[I]->getType();
-  if (T->isObjectType() || T->isFunctionType())
-T = S.Context.getRValueReferenceType(T);
+  QualType ArgTy = Args[I]->getType();
+  if (ArgTy->isObjectType() || ArgTy->isFunctionType())
+ArgTy = S.Context.getRValueReferenceType(ArgTy);
   OpaqueArgExprs.push_back(
-OpaqueValueExpr(Args[I]->getTypeLoc().getLocStart(),
-T.getNonLValueExprType(S.Context),
-Expr::getValueKindForType(T)));
+  OpaqueValueExpr(Args[I]->getTypeLoc().getLocStart(),
+  ArgTy.getNonLValueExprType(S.Context),
+  Expr::getValueKindForType(ArgTy)));
 }
 for (Expr &E : OpaqueArgExprs)
   ArgExprs.push_back(&E);
@@ -4134,7 +4135,7 @@ static bool evaluateTypeTrait(Sema &S, T
   // Under Objective-C ARC, if the destination has non-trivial Objective-C
   // lifetime, this is a non-trivial construction.
   if (S.getLangOpts().ObjCAutoRefCount &&
-  hasNontrivialObjCLifetime(Args[0]->getType().getNonReferenceType()))
+  hasNontrivialObjCLifetime(T.getNonReferenceType()))
 return false;
 
   // The initialization succeeded; now make sure there are no non-trivial

Modified: cfe/trunk/test/SemaCXX/type-traits.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/type-traits.cpp?rev=253013&r1=253012&r2=253013&view=diff
==
--- cfe/trunk/test/SemaCXX/type-traits.cpp (original)
+++ cfe/trunk/test/SemaCXX/type-traits.cpp Thu Nov 12 23:32:43 2015
@@ -1991,6 +1991,9 @@ void constructible_checks() {
   // PR20228
   { int arr[T(__is_constructible(VariadicCtor,
  int, int, int, int, int, int, int, int, 
int))]; }
+
+  // PR25513
+  { int arr[F(__is_constructible(int(int)))]; }
 }
 
 // Instantiation of __is_trivially_constructible


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


r253012 - [modules] When a declaration has non-trivial visibility, check whether it's

2015-11-12 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Nov 12 23:14:45 2015
New Revision: 253012

URL: http://llvm.org/viewvc/llvm-project?rev=253012&view=rev
Log:
[modules] When a declaration has non-trivial visibility, check whether it's
actually hidden before we check its linkage. This avoids computing the linkage
"too early" for an anonymous struct with a typedef name for linkage.

Modified:
cfe/trunk/include/clang/Sema/Lookup.h
cfe/trunk/test/Modules/submodule-visibility.cpp

Modified: cfe/trunk/include/clang/Sema/Lookup.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=253012&r1=253011&r2=253012&view=diff
==
--- cfe/trunk/include/clang/Sema/Lookup.h (original)
+++ cfe/trunk/include/clang/Sema/Lookup.h Thu Nov 12 23:14:45 2015
@@ -303,8 +303,7 @@ public:
 if (!D->isInIdentifierNamespace(IDNS))
   return nullptr;
 
-if (!D->isHidden() || isHiddenDeclarationVisible(D) ||
-isVisibleSlow(getSema(), D))
+if (isVisible(getSema(), D) || isHiddenDeclarationVisible(D))
   return D;
 
 return getAcceptableDeclSlow(D);

Modified: cfe/trunk/test/Modules/submodule-visibility.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/submodule-visibility.cpp?rev=253012&r1=253011&r2=253012&view=diff
==
--- cfe/trunk/test/Modules/submodule-visibility.cpp (original)
+++ cfe/trunk/test/Modules/submodule-visibility.cpp Thu Nov 12 23:14:45 2015
@@ -28,3 +28,10 @@ int k = n + m; // OK, a and b are visibl
 #ifndef B
 #error B is not defined
 #endif
+
+// Ensure we don't compute the linkage of this struct before we find it has a
+// typedef name for linkage purposes.
+typedef struct {
+  int p; 
+  void (*f)(int p);
   
+} name_for_linkage;


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


r253011 - clang/test/Driver/mips-mti-linux.c: Tweak to match DOSish paths.

2015-11-12 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Thu Nov 12 22:44:51 2015
New Revision: 253011

URL: http://llvm.org/viewvc/llvm-project?rev=253011&view=rev
Log:
clang/test/Driver/mips-mti-linux.c: Tweak to match DOSish paths.

Modified:
cfe/trunk/test/Driver/mips-mti-linux.c

Modified: cfe/trunk/test/Driver/mips-mti-linux.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-mti-linux.c?rev=253011&r1=253010&r2=253011&view=diff
==
--- cfe/trunk/test/Driver/mips-mti-linux.c (original)
+++ cfe/trunk/test/Driver/mips-mti-linux.c Thu Nov 12 22:44:51 2015
@@ -5,8 +5,6 @@
 //Ideally, we'd like to have an --llvm-toolchain option similar to
 //the --gcc-toolchain one.
 
-// REQUIRES: shell
-
 // = Big-endian, mips32r2, hard float
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: --target=mips-mti-linux -mips32r2 -mhard-float \
@@ -21,7 +19,7 @@
 // CHECK-BE-HF-32R2-SAME: 
"[[SYSROOT]]/mips-r2-hard-musl/usr/lib{{/|}}crt1.o"
 // CHECK-BE-HF-32R2-SAME: 
"[[SYSROOT]]/mips-r2-hard-musl/usr/lib{{/|}}crti.o"
 // CHECK-BE-HF-32R2-SAME: "-L[[SYSROOT]]/mips-r2-hard-musl/usr/lib"
-// CHECK-BE-HF-32R2-SAME: 
"{{[^"]+}}/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a"
+// CHECK-BE-HF-32R2-SAME: 
"{{[^"]+}}/mips-r2-hard-musl{{/|}}lib{{/|}}linux{{/|}}libclang_rt.builtins-mips.a"
 // CHECK-BE-HF-32R2-SAME: "-lc"
 // CHECK-BE-HF-32R2-SAME: 
"[[SYSROOT]]/mips-r2-hard-musl/usr/lib{{/|}}crtn.o"
 
@@ -39,6 +37,6 @@
 // CHECK-LE-HF-32R2-SAME: 
"[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crt1.o"
 // CHECK-LE-HF-32R2-SAME: 
"[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crti.o"
 // CHECK-LE-HF-32R2-SAME: "-L[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib"
-// CHECK-LE-HF-32R2-SAME: 
"{{[^"]+}}/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a"
+// CHECK-LE-HF-32R2-SAME: 
"{{[^"]+}}/mipsel-r2-hard-musl{{/|}}lib{{/|}}linux{{/|}}libclang_rt.builtins-mipsel.a"
 // CHECK-LE-HF-32R2-SAME: "-lc"
 // CHECK-LE-HF-32R2-SAME: 
"[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crtn.o"


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


Re: [PATCH] D13357: [Concepts] Diagnose when 'concept' is specified on a specialization

2015-11-12 Thread Nathan Wilson via cfe-commits
nwilson updated this revision to Diff 40105.
nwilson added a comment.

- Remove marking a variable concept invalid when specialized since we'll only 
look at the primary template downstream. This removal let's us use the same 
recovery path as before when 'concept' is specified on a non-template.


http://reviews.llvm.org/D13357

Files:
  include/clang/AST/Decl.h
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaTemplate.cpp
  test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp

Index: test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp
===
--- test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp
+++ test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp
@@ -41,3 +41,20 @@
 void fpc(concept int i) {} // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
 
 concept bool; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
+
+template concept bool VCEI { true };
+template concept bool VCEI; // expected-error {{'concept' cannot be applied on an explicit instantiation}}
+extern template concept bool VCEI; // expected-error {{'concept' cannot be applied on an explicit instantiation}}
+
+template concept bool VCPS { true };
+template concept bool VCPS { true }; // expected-error {{'concept' cannot be applied on an partial specialization}}
+
+template concept bool VCES { true };
+template<> concept bool VCES { true }; // expected-error {{'concept' cannot be applied on an explicit specialization}}
+
+template concept bool FCEI() { return true; }
+template concept bool FCEI(); // expected-error {{'concept' cannot be applied on an explicit instantiation}}
+extern template concept bool FCEI(); // expected-error {{'concept' cannot be applied on an explicit instantiation}}
+
+template concept bool FCES() { return true; }
+template<> concept bool FCES() { return true; } // expected-error {{'concept' cannot be applied on an explicit specialization}}
Index: lib/Sema/SemaTemplate.cpp
===
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -7654,6 +7654,17 @@
 Diag(D.getDeclSpec().getConstexprSpecLoc(),
  diag::err_explicit_instantiation_constexpr);
 
+  // C++ Concepts TS [dcl.spec.concept]p1: The concept specifier shall be
+  // applied only to the definition of a function template or variable template,
+  // declared in namespace scope. A concept definition refers to either a
+  // function concept and its definition or a variable concept and its
+  // initializer.
+  if (D.getDeclSpec().isConceptSpecified()) {
+Diag(D.getDeclSpec().getConceptSpecLoc(),
+ diag:: err_concept_specified_specialization) << 0;
+return true;
+  }
+
   // C++0x [temp.explicit]p2:
   //   There are two forms of explicit instantiation: an explicit instantiation
   //   definition and an explicit instantiation declaration. An explicit
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -5932,6 +5932,16 @@
 << 0 << 3;
 NewVD->setInvalidDecl(true);
   }
+
+  // C++ Concepts TS [dcl.spec.concept]p1: The concept specifier shall be
+  // applied only to the definition of a [...] variable template, declared
+  // in namespace scope. [...] A concept definition refers to [...] a
+  // variable concept and its initializer.
+  if (IsVariableTemplateSpecialization) {
+Diag(D.getDeclSpec().getConceptSpecLoc(),
+ diag::err_concept_specified_specialization)
+  << (IsPartialSpecialization ? 2 : 1);
+  }
 }
   }
 
@@ -7578,6 +7588,9 @@
 }
 
 if (isConcept) {
+  // This is a function concept.
+  NewFD->setConcept(true);
+
   // C++ Concepts TS [dcl.spec.concept]p1: The concept specifier shall be
   // applied only to the definition of a function template [...]
   if (!D.isFunctionDefinition()) {
@@ -7636,6 +7649,15 @@
 << 1 << 3;
 NewFD->setInvalidDecl(true);
   }
+
+  // C++ Concepts TS [dcl.spec.concept]p1: The concept specifier shall be
+  // applied only to the definition of a function template [...], declared
+  // in namespace scope. [...] A concept definition refers to either a
+  // function concept and its definition [...].
+  if (isFunctionTemplateSpecialization) {
+Diag(D.getDeclSpec().getConceptSpecLoc(),
+ diag::err_concept_specified_specialization) << 1;
+  }
 }
 
 // If __module_private__ was specified, mark the function accordingly.
@@ -7897,9 +7919,9 @@
  TemplateId->NumArgs);
   translateTemplateArguments(TemplateArgsPtr,
  TemplateArgs);
-
+
  

r253010 - [modules] Follow the C++ standard's rule for linkage of enumerators: they have

2015-11-12 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Nov 12 21:52:13 2015
New Revision: 253010

URL: http://llvm.org/viewvc/llvm-project?rev=253010&view=rev
Log:
[modules] Follow the C++ standard's rule for linkage of enumerators: they have
the linkage of the enumeration. For enumerators of unnamed enumerations, extend
the -Wmodules-ambiguous-internal-linkage extension to allow selecting an
arbitrary enumerator (but only if they all have the same value, otherwise it's
ambiguous).

Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/AST/DeclBase.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/Index/linkage.c
cfe/trunk/test/Modules/Inputs/no-linkage/decls.h
cfe/trunk/test/Modules/no-linkage.cpp
cfe/trunk/test/Modules/submodules-merge-defs.cpp

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=253010&r1=253009&r2=253010&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Thu Nov 12 21:52:13 2015
@@ -2121,7 +2121,8 @@ public:
 
   void mergeDeclAttributes(NamedDecl *New, Decl *Old,
AvailabilityMergeKind AMK = AMK_Redeclaration);
-  void MergeTypedefNameDecl(TypedefNameDecl *New, LookupResult &OldDecls);
+  void MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New,
+LookupResult &OldDecls);
   bool MergeFunctionDecl(FunctionDecl *New, NamedDecl *&Old, Scope *S,
  bool MergeTypeWithOld);
   bool MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old,

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=253010&r1=253009&r2=253010&view=diff
==
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Thu Nov 12 21:52:13 2015
@@ -1239,7 +1239,6 @@ static LinkageInfo computeLVForDecl(cons
 // Note that the name of a typedef, namespace alias, using declaration,
 // and so on are not the name of the corresponding type, namespace, or
 // declaration, so they do *not* have linkage.
-case Decl::EnumConstant: // FIXME: This has linkage, but that's dumb.
 case Decl::ImplicitParam:
 case Decl::Label:
 case Decl::NamespaceAlias:
@@ -1249,6 +1248,10 @@ static LinkageInfo computeLVForDecl(cons
 case Decl::UsingDirective:
   return LinkageInfo::none();
 
+case Decl::EnumConstant:
+  // C++ [basic.link]p4: an enumerator has the linkage of its enumeration.
+  return getLVForDecl(cast(D->getDeclContext()), computation);
+
 case Decl::Typedef:
 case Decl::TypeAlias:
   // A typedef declaration has linkage if it gives a type a name for

Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=253010&r1=253009&r2=253010&view=diff
==
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Thu Nov 12 21:52:13 2015
@@ -1210,13 +1210,16 @@ void DeclContext::removeDecl(Decl *D) {
 // Remove only decls that have a name
 if (!ND->getDeclName()) return;
 
-StoredDeclsMap *Map = getPrimaryContext()->LookupPtr;
-if (!Map) return;
-
-StoredDeclsMap::iterator Pos = Map->find(ND->getDeclName());
-assert(Pos != Map->end() && "no lookup entry for decl");
-if (Pos->second.getAsVector() || Pos->second.getAsDecl() == ND)
-  Pos->second.remove(ND);
+auto *DC = this;
+do {
+  StoredDeclsMap *Map = DC->getPrimaryContext()->LookupPtr;
+  if (Map) {
+StoredDeclsMap::iterator Pos = Map->find(ND->getDeclName());
+assert(Pos != Map->end() && "no lookup entry for decl");
+if (Pos->second.getAsVector() || Pos->second.getAsDecl() == ND)
+  Pos->second.remove(ND);
+  }
+} while (DC->isTransparentContext() && (DC = DC->getParent()));
   }
 }
 

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=253010&r1=253009&r2=253010&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Nov 12 21:52:13 2015
@@ -1880,7 +1880,8 @@ bool Sema::isIncompatibleTypedef(TypeDec
 /// how to resolve this situation, merging decls or emitting
 /// diagnostics as appropriate. If there was an error, set New to be invalid.
 ///
-void Sema::MergeTypedefNameDecl(TypedefNameDecl *New, LookupResult &OldDecls) {
+void Sema::MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New,
+LookupResult &OldDecls) {
   // If the new decl is known invalid already, don't bo

Re: r252836 - [CMake] Setup an install component for libclang and c-index-test.

2015-11-12 Thread Argyrios Kyrtzidis via cfe-commits
I assume you are referring to the install-c-index-test target, this should not 
be added to IDEs after r253001.

> On Nov 12, 2015, at 7:29 AM, Aaron Ballman  wrote:
> 
> Is this target needed by IDEs? It currently adds the target to the
> root level of the solution in MSVC.
> 
> ~Aaron
> 
> On Wed, Nov 11, 2015 at 7:46 PM, Argyrios Kyrtzidis via cfe-commits
>  wrote:
>> Author: akirtzidis
>> Date: Wed Nov 11 18:46:57 2015
>> New Revision: 252836
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=252836&view=rev
>> Log:
>> [CMake] Setup an install component for libclang and c-index-test.
>> 
>> Also don't create libclang dylib symlinks on darwin.
>> 
>> Modified:
>>cfe/trunk/CMakeLists.txt
>>cfe/trunk/tools/c-index-test/CMakeLists.txt
>>cfe/trunk/tools/libclang/CMakeLists.txt
>> 
>> Modified: cfe/trunk/CMakeLists.txt
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=252836&r1=252835&r2=252836&view=diff
>> ==
>> --- cfe/trunk/CMakeLists.txt (original)
>> +++ cfe/trunk/CMakeLists.txt Wed Nov 11 18:46:57 2015
>> @@ -354,7 +354,7 @@ endmacro()
>> 
>> macro(add_clang_library name)
>>   cmake_parse_arguments(ARG
>> -""
>> +"SHARED"
>> ""
>> "ADDITIONAL_HEADERS"
>> ${ARGN})
>> @@ -390,17 +390,29 @@ macro(add_clang_library name)
>>   ${ARG_ADDITIONAL_HEADERS} # It may contain unparsed unknown args.
>>   )
>>   endif()
>> -  llvm_add_library(${name} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
>> +  if(ARG_SHARED)
>> +set(ARG_ENABLE_SHARED SHARED)
>> +  endif()
>> +  llvm_add_library(${name} ${ARG_ENABLE_SHARED} ${ARG_UNPARSED_ARGUMENTS} 
>> ${srcs})
>> 
>>   if(TARGET ${name})
>> target_link_libraries(${name} ${cmake_2_8_12_INTERFACE} 
>> ${LLVM_COMMON_LIBS})
>> 
>> if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "libclang")
>>   install(TARGETS ${name}
>> +COMPONENT ${name}
>> EXPORT ClangTargets
>> LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
>> ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
>> RUNTIME DESTINATION bin)
>> +
>> +  if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
>> +add_custom_target(install-${name}
>> +  DEPENDS ${name}
>> +  COMMAND "${CMAKE_COMMAND}"
>> +  -DCMAKE_INSTALL_COMPONENT=${name}
>> +  -P 
>> "${CMAKE_BINARY_DIR}/cmake_install.cmake")
>> +  endif()
>> endif()
>> set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
>>   else()
>> @@ -451,6 +463,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
>> endif()
>> 
>> install(DIRECTORY include/clang-c
>> +  COMPONENT libclang
>>   DESTINATION include
>>   FILES_MATCHING
>>   PATTERN "*.h"
>> 
>> Modified: cfe/trunk/tools/c-index-test/CMakeLists.txt
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/CMakeLists.txt?rev=252836&r1=252835&r2=252836&view=diff
>> ==
>> --- cfe/trunk/tools/c-index-test/CMakeLists.txt (original)
>> +++ cfe/trunk/tools/c-index-test/CMakeLists.txt Wed Nov 11 18:46:57 2015
>> @@ -28,3 +28,12 @@ if (CLANG_HAVE_LIBXML)
>>   include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR})
>>   target_link_libraries(c-index-test ${LIBXML2_LIBRARIES})
>> endif()
>> +
>> +install(TARGETS c-index-test
>> +  RUNTIME DESTINATION local/bin
>> +  COMPONENT c-index-test)
>> +add_custom_target(install-c-index-test
>> +  DEPENDS c-index-test
>> +  COMMAND "${CMAKE_COMMAND}"
>> +  -DCMAKE_INSTALL_COMPONENT=c-index-test
>> +  -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
>> 
>> Modified: cfe/trunk/tools/libclang/CMakeLists.txt
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CMakeLists.txt?rev=252836&r1=252835&r2=252836&view=diff
>> ==
>> --- cfe/trunk/tools/libclang/CMakeLists.txt (original)
>> +++ cfe/trunk/tools/libclang/CMakeLists.txt Wed Nov 11 18:46:57 2015
>> @@ -102,18 +102,16 @@ if(ENABLE_SHARED)
>>   PROPERTIES
>>   VERSION ${LIBCLANG_LIBRARY_VERSION}
>>   DEFINE_SYMBOL _CINDEX_LIB_)
>> -  else()
>> -set_target_properties(libclang
>> -  PROPERTIES
>> -  VERSION ${LIBCLANG_LIBRARY_VERSION}
>> -  DEFINE_SYMBOL _CINDEX_LIB_)
>> -  endif()
>> -
>> -  if(APPLE)
>> +  elseif(APPLE)
>> set(LIBCLANG_LINK_FLAGS " -Wl,-compatibility_version -Wl,1")
>> set(LIBCLANG_LINK_FLAGS "${LIBCLANG_LINK_FLAGS} -Wl,-current_version 
>> -Wl,${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
>> 
>> set_property(TARGET libclang APPEND_STRING PROPERTY
>>  LINK_FLAGS ${LIBCLANG_LINK_FLAGS})
>> +  else()
>> +set_target_properties(libclang
>> +  PROPERTIES
>> +  VERSION ${LIBCLANG_LIBRARY_VERSION}
>> +  DEFINE_SYMBOL _CINDEX_LIB_)
>>   endi

Re: r252836 - [CMake] Setup an install component for libclang and c-index-test.

2015-11-12 Thread Argyrios Kyrtzidis via cfe-commits
Thanks for pointing it out.
r253001 sets up the destination to a different location only if 
‘INTERNAL_INSTALL_PREFIX’ is set.

> On Nov 12, 2015, at 5:50 AM, Ismail Donmez  wrote:
> 
> Fixed in r252890
> 
> On Thu, Nov 12, 2015 at 2:17 PM, Ismail Donmez  > wrote:
> Hi,
> 
> On Thu, Nov 12, 2015 at 2:46 AM, Argyrios Kyrtzidis via cfe-commits 
> mailto:cfe-commits@lists.llvm.org>> wrote:
> --- cfe/trunk/tools/c-index-test/CMakeLists.txt (original)
> +++ cfe/trunk/tools/c-index-test/CMakeLists.txt Wed Nov 11 18:46:57 2015
> @@ -28,3 +28,12 @@ if (CLANG_HAVE_LIBXML)
>include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR})
>target_link_libraries(c-index-test ${LIBXML2_LIBRARIES})
>  endif()
> +
> +install(TARGETS c-index-test
> +  RUNTIME DESTINATION local/bin
> +  COMPONENT c-index-test)
> 
> This doesn't look right, all of the llvm/clang install binaries under 
> $PREFIX/bin, with this change c-index-test is going under $PREFIX/local/bin
> 
> ismail
> 
> 

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


r253001 - [CMake] If 'INTERNAL_INSTALL_PREFIX' is set, use it for determining the install destination of c-index-test and the libclang headers.

2015-11-12 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Thu Nov 12 19:46:18 2015
New Revision: 253001

URL: http://llvm.org/viewvc/llvm-project?rev=253001&view=rev
Log:
[CMake] If 'INTERNAL_INSTALL_PREFIX' is set, use it for determining the install 
destination of c-index-test and the libclang headers.

Modified:
cfe/trunk/CMakeLists.txt
cfe/trunk/tools/c-index-test/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=253001&r1=253000&r2=253001&view=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Thu Nov 12 19:46:18 2015
@@ -462,14 +462,28 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
 )
 endif()
 
+if(INTERNAL_INSTALL_PREFIX)
+  set(LIBCLANG_HEADERS_INSTALL_DESTINATION 
"${INTERNAL_INSTALL_PREFIX}/include")
+else()
+  set(LIBCLANG_HEADERS_INSTALL_DESTINATION include)
+endif()
+
 install(DIRECTORY include/clang-c
-  COMPONENT libclang
-  DESTINATION include
+  COMPONENT libclang-headers
+  DESTINATION "${LIBCLANG_HEADERS_INSTALL_DESTINATION}"
   FILES_MATCHING
   PATTERN "*.h"
   PATTERN ".svn" EXCLUDE
   )
 
+if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
+  add_custom_target(install-libclang-headers
+DEPENDS
+COMMAND "${CMAKE_COMMAND}"
+-DCMAKE_INSTALL_COMPONENT=libclang-headers
+-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+endif()
+
 add_definitions( -D_GNU_SOURCE )
 
 option(CLANG_ENABLE_ARCMT "Build ARCMT." ON)

Modified: cfe/trunk/tools/c-index-test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/CMakeLists.txt?rev=253001&r1=253000&r2=253001&view=diff
==
--- cfe/trunk/tools/c-index-test/CMakeLists.txt (original)
+++ cfe/trunk/tools/c-index-test/CMakeLists.txt Thu Nov 12 19:46:18 2015
@@ -29,11 +29,20 @@ if (CLANG_HAVE_LIBXML)
   target_link_libraries(c-index-test ${LIBXML2_LIBRARIES})
 endif()
 
+if(INTERNAL_INSTALL_PREFIX)
+  set(INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/bin")
+else()
+  set(INSTALL_DESTINATION bin)
+endif()
+
 install(TARGETS c-index-test
-  RUNTIME DESTINATION bin
+  RUNTIME DESTINATION "${INSTALL_DESTINATION}"
   COMPONENT c-index-test)
-add_custom_target(install-c-index-test
-  DEPENDS c-index-test
-  COMMAND "${CMAKE_COMMAND}"
-  -DCMAKE_INSTALL_COMPONENT=c-index-test
-  -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+
+if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
+  add_custom_target(install-c-index-test
+DEPENDS c-index-test
+COMMAND "${CMAKE_COMMAND}"
+-DCMAKE_INSTALL_COMPONENT=c-index-test
+-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+endif()


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


r252991 - Fix build

2015-11-12 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Thu Nov 12 19:23:40 2015
New Revision: 252991

URL: http://llvm.org/viewvc/llvm-project?rev=252991&view=rev
Log:
Fix build

Modified:
cfe/trunk/tools/scan-view/CMakeLists.txt

Modified: cfe/trunk/tools/scan-view/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/CMakeLists.txt?rev=252991&r1=252990&r2=252991&view=diff
==
--- cfe/trunk/tools/scan-view/CMakeLists.txt (original)
+++ cfe/trunk/tools/scan-view/CMakeLists.txt Thu Nov 12 19:23:40 2015
@@ -33,7 +33,7 @@ if(CLANG_INSTALL_SCANVIEW)
  ${CMAKE_BINARY_DIR}/share/scan-view/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
 list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
-install(FILES Shares/${ShareFile} DESTINATION share/scan-view)
+install(FILES share/${ShareFile} DESTINATION share/scan-view)
   endforeach()
 
   add_custom_target(scan-view ALL DEPENDS ${Depends})


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


Re: [PATCH] D12359: New warning -Wnonconst-parameter when a pointer parameter can be const

2015-11-12 Thread Richard Smith via cfe-commits
On Wed, Nov 11, 2015 at 10:11 PM, Daniel Marjamäki <
daniel.marjam...@evidente.se> wrote:

> danielmarjamaki added a comment.
>
> In http://reviews.llvm.org/D12359#287522, @rsmith wrote:
>
> > Why does this construct justify the compiler emitting a warning? It
> seems to be reporting a fact about the code rather than a bug, and as there
> are many coding styles where variables are not routinely marked as const
> whenever possible, this appears to be checking that the code conforms to a
> particular coding style. As such, this seems like a better fit as a
> clang-tidy check than as a compiler warning.
>

I don't think you've responded to this. Why do you think this situation
justifies the compiler emitting a warning? This seems outside the normal
scope of things that we'd warn on, since we have no proof or strong
evidence that the code is buggy or does something other than what the
author intended. There are lots of legitimate scenarios when a function
might be passed a non-const pointer where it has no intention of modifying
the pointee (perhaps the function is a callback or similar and must have a
certain signature), and there seems to be no obvious syntactic way to
suppress this warning on a case-by-case basis.

Conversely, this seems very well suited to exist as a clang-tidy check.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13388: Add support for querying the visibility of a cursor

2015-11-12 Thread Michael Wu via cfe-commits
michaelwu updated this revision to Diff 40100.
michaelwu added a comment.

This removes the test for protected visibility and improves documentation for 
clang_getCursorVisibility.


http://reviews.llvm.org/D13388

Files:
  include/clang-c/Index.h
  test/Index/symbol-visibility.c
  tools/c-index-test/c-index-test.c
  tools/libclang/CIndex.cpp
  tools/libclang/libclang.exports

Index: tools/libclang/libclang.exports
===
--- tools/libclang/libclang.exports
+++ tools/libclang/libclang.exports
@@ -176,6 +176,7 @@
 clang_getCursorSpelling
 clang_getCursorType
 clang_getCursorUSR
+clang_getCursorVisibility
 clang_getDeclObjCTypeEncoding
 clang_getDefinitionSpellingAndExtent
 clang_getDiagnostic
Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -6428,6 +6428,27 @@
 } // end: extern "C"
 
 //===--===//
+// Operations for querying visibility of a cursor.
+//===--===//
+
+extern "C" {
+CXVisibilityKind clang_getCursorVisibility(CXCursor cursor) {
+  if (!clang_isDeclaration(cursor.kind))
+return CXVisibility_Invalid;
+
+  const Decl *D = cxcursor::getCursorDecl(cursor);
+  if (const NamedDecl *ND = dyn_cast_or_null(D))
+switch (ND->getVisibility()) {
+  case HiddenVisibility: return CXVisibility_Hidden;
+  case ProtectedVisibility: return CXVisibility_Protected;
+  case DefaultVisibility: return CXVisibility_Default;
+};
+
+  return CXVisibility_Invalid;
+}
+} // end: extern "C"
+
+//===--===//
 // Operations for querying language of a cursor.
 //===--===//
 
Index: tools/c-index-test/c-index-test.c
===
--- tools/c-index-test/c-index-test.c
+++ tools/c-index-test/c-index-test.c
@@ -1248,6 +1248,32 @@
 }
 
 /**/
+/* Visibility testing.*/
+/**/
+
+static enum CXChildVisitResult PrintVisibility(CXCursor cursor, CXCursor p,
+   CXClientData d) {
+  const char *visibility = 0;
+
+  if (clang_isInvalid(clang_getCursorKind(cursor)))
+return CXChildVisit_Recurse;
+
+  switch (clang_getCursorVisibility(cursor)) {
+case CXVisibility_Invalid: break;
+case CXVisibility_Hidden: visibility = "Hidden"; break;
+case CXVisibility_Protected: visibility = "Protected"; break;
+case CXVisibility_Default: visibility = "Default"; break;
+  }
+
+  if (visibility) {
+PrintCursor(cursor, NULL);
+printf("visibility=%s\n", visibility);
+  }
+
+  return CXChildVisit_Recurse;
+}
+
+/**/
 /* Typekind testing.  */
 /**/
 
@@ -4084,6 +4110,7 @@
 "   c-index-test -test-inclusion-stack-tu \n");
   fprintf(stderr,
 "   c-index-test -test-print-linkage-source {}*\n"
+"   c-index-test -test-print-visibility {}*\n"
 "   c-index-test -test-print-type {}*\n"
 "   c-index-test -test-print-type-size {}*\n"
 "   c-index-test -test-print-bitwidth {}*\n"
@@ -4171,6 +4198,9 @@
   else if (argc > 2 && strcmp(argv[1], "-test-print-linkage-source") == 0)
 return perform_test_load_source(argc - 2, argv + 2, "all", PrintLinkage,
 NULL);
+  else if (argc > 2 && strcmp(argv[1], "-test-print-visibility") == 0)
+return perform_test_load_source(argc - 2, argv + 2, "all", PrintVisibility,
+NULL);
   else if (argc > 2 && strcmp(argv[1], "-test-print-type") == 0)
 return perform_test_load_source(argc - 2, argv + 2, "all",
 PrintType, 0);
Index: test/Index/symbol-visibility.c
===
--- /dev/null
+++ test/Index/symbol-visibility.c
@@ -0,0 +1,7 @@
+// RUN: c-index-test -test-print-visibility %s | FileCheck %s
+
+__attribute__ ((visibility ("default"))) void foo1();
+__attribute__ ((visibility ("hidden"))) void foo2();
+
+// CHECK: FunctionDecl=foo1:3:47visibility=Default
+// CHECK: FunctionDecl=foo2:4:46visibility=Hidden
Index: include/clang-c/Index.h
===
--- include/clang-c/Index.h
+++ include/clang-c/Index.h
@@ -2449,6 +2449,32 @@
 CINDEX_LINKAGE enum CXLinkageKind clang_getCursorL

Re: [PATCH] D12547: Add support for function attribute "disable_tail_calls"

2015-11-12 Thread Akira Hatanaka via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL252986: Add support for function attribute 
'disable_tail_calls'. (authored by ahatanak).

Changed prior to commit:
  http://reviews.llvm.org/D12547?vs=40060&id=40099#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12547

Files:
  cfe/trunk/include/clang/Basic/Attr.td
  cfe/trunk/include/clang/Basic/AttrDocs.td
  cfe/trunk/lib/CodeGen/CGCall.cpp
  cfe/trunk/lib/Sema/SemaDeclAttr.cpp
  cfe/trunk/test/CodeGen/attr-disable-tail-calls.c
  cfe/trunk/test/CodeGenCXX/attr-disable-tail-calls.cpp
  cfe/trunk/test/Sema/attr-disable-tail-calls.c
  cfe/trunk/test/SemaCXX/attr-disable-tail-calls.cpp

Index: cfe/trunk/include/clang/Basic/AttrDocs.td
===
--- cfe/trunk/include/clang/Basic/AttrDocs.td
+++ cfe/trunk/include/clang/Basic/AttrDocs.td
@@ -1684,3 +1684,41 @@
 This can be used to contain the ABI of a C++ library by excluding unwanted class methods from the export tables.
   }];
 }
+
+def DisableTailCallsDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+The ``disable_tail_calls`` attribute instructs the backend to not perform tail call optimization inside the marked function.
+
+For example:
+
+  .. code-block:: c
+
+int callee(int);
+
+int foo(int a) __attribute__((disable_tail_calls)) {
+  return callee(a); // This call is not tail-call optimized.
+}
+
+Marking virtual functions as ``disable_tail_calls`` is legal.
+
+  .. code-block: c++
+
+int callee(int);
+
+class Base {
+public:
+  [[clang::disable_tail_calls]] virtual int foo1() {
+return callee(); // This call is not tail-call optimized.
+  }
+};
+
+class Derived1 : public Base {
+public:
+  int foo1() override {
+return callee(); // This call is tail-call optimized.
+  }
+};
+
+  }];
+}
Index: cfe/trunk/include/clang/Basic/Attr.td
===
--- cfe/trunk/include/clang/Basic/Attr.td
+++ cfe/trunk/include/clang/Basic/Attr.td
@@ -890,6 +890,13 @@
   let Documentation = [Undocumented];
 }
 
+def DisableTailCalls : InheritableAttr {
+  let Spellings = [GNU<"disable_tail_calls">,
+   CXX11<"clang", "disable_tail_calls">];
+  let Subjects = SubjectList<[Function, ObjCMethod]>;
+  let Documentation = [DisableTailCallsDocs];
+}
+
 def NoAlias : InheritableAttr {
   let Spellings = [Declspec<"noalias">];
   let Subjects = SubjectList<[Function]>;
Index: cfe/trunk/test/CodeGenCXX/attr-disable-tail-calls.cpp
===
--- cfe/trunk/test/CodeGenCXX/attr-disable-tail-calls.cpp
+++ cfe/trunk/test/CodeGenCXX/attr-disable-tail-calls.cpp
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -triple=x86_64-apple-darwin -std=c++11 -emit-llvm -o - %s | FileCheck %s
+
+class B {
+public:
+  [[clang::disable_tail_calls]] virtual int m1() { return 1; }
+  virtual int m2() { return 2; }
+  int m3() { return 3; }
+  [[clang::disable_tail_calls]] int m4();
+};
+
+class D : public B {
+public:
+  int m1() override { return 11; }
+  [[clang::disable_tail_calls]] int m2() override { return 22; }
+};
+
+int foo1() {
+  B *b = new B;
+  D *d = new D;
+  int t = 0;
+  t += b->m1() + b->m2() + b->m3() + b->m4();
+  t += d->m1() + d->m2();
+  return t;
+}
+
+// CHECK: define linkonce_odr i32 @_ZN1B2m3Ev(%class.B* %this) [[ATTRFALSE:#[0-9]+]]
+// CHECK: declare i32 @_ZN1B2m4Ev(%class.B*) [[ATTRTRUE0:#[0-9]+]]
+// CHECK: define linkonce_odr i32 @_ZN1B2m1Ev(%class.B* %this) unnamed_addr [[ATTRTRUE1:#[0-9]+]]
+// CHECK: define linkonce_odr i32 @_ZN1B2m2Ev(%class.B* %this) unnamed_addr [[ATTRFALSE:#[0-9]+]]
+// CHECK: define linkonce_odr i32 @_ZN1D2m1Ev(%class.D* %this) unnamed_addr [[ATTRFALSE:#[0-9]+]]
+// CHECK: define linkonce_odr i32 @_ZN1D2m2Ev(%class.D* %this) unnamed_addr [[ATTRTRUE1:#[0-9]+]]
+
+// CHECK: attributes [[ATTRFALSE]] = { {{.*}}"disable-tail-calls"="false"{{.*}} }
+// CHECK: attributes [[ATTRTRUE0]] = { {{.*}}"disable-tail-calls"="true"{{.*}} }
+// CHECK: attributes [[ATTRTRUE1]] = { {{.*}}"disable-tail-calls"="true"{{.*}} }
Index: cfe/trunk/test/Sema/attr-disable-tail-calls.c
===
--- cfe/trunk/test/Sema/attr-disable-tail-calls.c
+++ cfe/trunk/test/Sema/attr-disable-tail-calls.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void __attribute__((disable_tail_calls,naked)) foo1(int a) { // expected-error {{'disable_tail_calls' and 'naked' attributes are not compatible}} expected-note {{conflicting attribute is here}}
+  __asm__("");
+}
+
+void __attribute__((naked,disable_tail_calls)) foo2(int a) { // expected-error {{'naked' and 'disable_tail_calls' attributes are not compatible}} expected-note {{conflicting attribute is here}}
+  __asm__("");
+}
+
+int g0 __attribute__((disable_tail_calls)); // expected-warning {{'disabl

r252986 - Add support for function attribute 'disable_tail_calls'.

2015-11-12 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Thu Nov 12 18:42:21 2015
New Revision: 252986

URL: http://llvm.org/viewvc/llvm-project?rev=252986&view=rev
Log:
Add support for function attribute 'disable_tail_calls'.

The ``disable_tail_calls`` attribute instructs the backend to not
perform tail call optimization inside the marked function.

For example, 

int callee(int);

int foo(int a) __attribute__((disable_tail_calls)) {
  return callee(a); // This call is not tail-call optimized.
}

Note that this attribute is different from 'not_tail_called', which
prevents tail-call optimization to the marked function.

rdar://problem/8973573

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

Added:
cfe/trunk/test/CodeGenCXX/attr-disable-tail-calls.cpp
cfe/trunk/test/Sema/attr-disable-tail-calls.c
cfe/trunk/test/SemaCXX/attr-disable-tail-calls.cpp
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/AttrDocs.td
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/CodeGen/attr-disable-tail-calls.c

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=252986&r1=252985&r2=252986&view=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Thu Nov 12 18:42:21 2015
@@ -890,6 +890,13 @@ def ReturnsTwice : InheritableAttr {
   let Documentation = [Undocumented];
 }
 
+def DisableTailCalls : InheritableAttr {
+  let Spellings = [GNU<"disable_tail_calls">,
+   CXX11<"clang", "disable_tail_calls">];
+  let Subjects = SubjectList<[Function, ObjCMethod]>;
+  let Documentation = [DisableTailCallsDocs];
+}
+
 def NoAlias : InheritableAttr {
   let Spellings = [Declspec<"noalias">];
   let Subjects = SubjectList<[Function]>;

Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=252986&r1=252985&r2=252986&view=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Thu Nov 12 18:42:21 2015
@@ -1684,3 +1684,41 @@ this attribute affects all methods and s
 This can be used to contain the ABI of a C++ library by excluding unwanted 
class methods from the export tables.
   }];
 }
+
+def DisableTailCallsDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+The ``disable_tail_calls`` attribute instructs the backend to not perform tail 
call optimization inside the marked function.
+
+For example:
+
+  .. code-block:: c
+
+int callee(int);
+
+int foo(int a) __attribute__((disable_tail_calls)) {
+  return callee(a); // This call is not tail-call optimized.
+}
+
+Marking virtual functions as ``disable_tail_calls`` is legal.
+
+  .. code-block: c++
+
+int callee(int);
+
+class Base {
+public:
+  [[clang::disable_tail_calls]] virtual int foo1() {
+return callee(); // This call is not tail-call optimized.
+  }
+};
+
+class Derived1 : public Base {
+public:
+  int foo1() override {
+return callee(); // This call is tail-call optimized.
+  }
+};
+
+  }];
+}

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=252986&r1=252985&r2=252986&view=diff
==
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Thu Nov 12 18:42:21 2015
@@ -1481,8 +1481,12 @@ void CodeGenModule::ConstructAttributeLi
   FuncAttrs.addAttribute("no-frame-pointer-elim-non-leaf");
 }
 
+bool DisableTailCalls =
+CodeGenOpts.DisableTailCalls ||
+(TargetDecl && TargetDecl->hasAttr());
 FuncAttrs.addAttribute("disable-tail-calls",
-   llvm::toStringRef(CodeGenOpts.DisableTailCalls));
+   llvm::toStringRef(DisableTailCalls));
+
 FuncAttrs.addAttribute("less-precise-fpmad",
llvm::toStringRef(CodeGenOpts.LessPreciseFPMAD));
 FuncAttrs.addAttribute("no-infs-fp-math",

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=252986&r1=252985&r2=252986&view=diff
==
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Thu Nov 12 18:42:21 2015
@@ -1583,6 +1583,15 @@ static void handleCommonAttr(Sema &S, De
 D->addAttr(CA);
 }
 
+static void handleNakedAttr(Sema &S, Decl *D, const AttributeList &Attr) {
+  if (checkAttrMutualExclusion(S, D, Attr.getRange(),
+ Attr.getName()

Re: [PATCH] D9600: Add scan-build python implementation

2015-11-12 Thread Laszlo Nagy via cfe-commits
rizsotto.mailinglist added a comment.

> The reason to squash all your patches together is that partial diffs from a 
> patch series don't work well with Phabricator's "Revision Update History" 
> tool. Also, it makes it hard to pull out a patch that I can apply on my local 
> tree to try it out.


thanks @jroelofs, will take a try on the weekend... my thought was that it 
might be more confusing to send squashed commits, since i can't remove the old 
patches... anyway, here you can find its own repository, till it's not merged 
to clang... https://github.com/rizsotto/Beye


http://reviews.llvm.org/D9600



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


r252981 - [scan-build] Create share directory similar to scan-view's

2015-11-12 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Thu Nov 12 18:32:54 2015
New Revision: 252981

URL: http://llvm.org/viewvc/llvm-project?rev=252981&view=rev
Log:
[scan-build] Create share directory similar to scan-view's

Added:
cfe/trunk/tools/scan-build/share/
cfe/trunk/tools/scan-build/share/scanview.css
  - copied unchanged from r252671, cfe/trunk/tools/scan-build/scanview.css
cfe/trunk/tools/scan-build/share/sorttable.js
  - copied unchanged from r252671, cfe/trunk/tools/scan-build/sorttable.js
Removed:
cfe/trunk/tools/scan-build/scanview.css
cfe/trunk/tools/scan-build/sorttable.js
Modified:
cfe/trunk/tools/scan-build/CMakeLists.txt
cfe/trunk/tools/scan-build/Makefile

Modified: cfe/trunk/tools/scan-build/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/CMakeLists.txt?rev=252981&r1=252980&r2=252981&view=diff
==
--- cfe/trunk/tools/scan-build/CMakeLists.txt (original)
+++ cfe/trunk/tools/scan-build/CMakeLists.txt Thu Nov 12 18:32:54 2015
@@ -21,7 +21,7 @@ endif()
 set(ManPages
   scan-build.1)
 
-set(ResourceFiles
+set(ShareFiles
   scanview.css
   sorttable.js)
 
@@ -63,16 +63,16 @@ if(CLANG_INSTALL_SCANBUILD)
 install(PROGRAMS ${ManPage} DESTINATION share/man/man1)
   endforeach()
 
-  foreach(ResourceFile ${ResourceFiles})
-add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/bin/${ResourceFile}
+  foreach(ShareFile ${ShareFiles})
+add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile}
COMMAND ${CMAKE_COMMAND} -E make_directory
- ${CMAKE_BINARY_DIR}/bin
+ ${CMAKE_BINARY_DIR}/share/scan-view
COMMAND ${CMAKE_COMMAND} -E copy
- ${CMAKE_CURRENT_SOURCE_DIR}/${ResourceFile}
- ${CMAKE_BINARY_DIR}/bin/
-   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${ResourceFile})
-list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${ResourceFile})
-install(FILES ${ResourceFile} DESTINATION bin)
+ ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile}
+ ${CMAKE_BINARY_DIR}/share/scan-view/
+   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
+list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
+install(FILES ${ShareFile} DESTINATION share/scan-view)
   endforeach()
 
   add_custom_target(scan-build ALL DEPENDS ${Depends})

Modified: cfe/trunk/tools/scan-build/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/Makefile?rev=252981&r1=252980&r2=252981&view=diff
==
--- cfe/trunk/tools/scan-build/Makefile (original)
+++ cfe/trunk/tools/scan-build/Makefile Thu Nov 12 18:32:54 2015
@@ -47,7 +47,7 @@ $(ShareDir)/man/man1/%: % Makefile $(Sha
$(Echo) "Copying $(notdir $<) to the 'share' directory..."
$(Verb)cp $< $@
 
-$(ShareDir)/scan-build/%: % Makefile $(ShareDir)/scan-build/.dir
+$(ShareDir)/scan-build/%: share/% Makefile $(ShareDir)/scan-build/.dir
$(Echo) "Copying $(notdir $<) to the 'share' directory..."
$(Verb)cp $< $@
 

Removed: cfe/trunk/tools/scan-build/scanview.css
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/scanview.css?rev=252980&view=auto
==
--- cfe/trunk/tools/scan-build/scanview.css (original)
+++ cfe/trunk/tools/scan-build/scanview.css (removed)
@@ -1,62 +0,0 @@
-body { color:#00; background-color:#ff }
-body { font-family: Helvetica, sans-serif; font-size:9pt }
-h1 { font-size: 14pt; }
-h2 { font-size: 12pt; }
-table { font-size:9pt }
-table { border-spacing: 0px; border: 1px solid black }
-th, table thead {
-  background-color:#eee; color:#66;
-  font-weight: bold; cursor: default;
-  text-align:center;
-  font-weight: bold; font-family: Verdana;
-  white-space:nowrap;
-}
-.W { font-size:0px }
-th, td { padding:5px; padding-left:8px; text-align:left }
-td.SUMM_DESC { padding-left:12px }
-td.DESC { white-space:pre }
-td.Q { text-align:right }
-td { text-align:left }
-tbody.scrollContent { overflow:auto }
-
-table.form_group {
-background-color: #ccc;
-border: 1px solid #333;
-padding: 2px;
-}
-
-table.form_inner_group {
-background-color: #ccc;
-border: 1px solid #333;
-padding: 0px;
-}
-
-table.form {
-background-color: #999;
-border: 1px solid #333;
-padding: 2px;
-}
-
-td.form_label {
-text-align: right;
-vertical-align: top;
-}
-/* For one line entires */
-td.form_clabel {
-text-align: right;
-vertical-align: center;
-}
-td.form_value {
-text-align: left;
-vertical-align: top;
-}
-td.form_submit {
-text-align: right;
-vertical-align: top;
-}
-
-h1.SubmitFail {
-color: #f00;
-}
-h1.SubmitOk {
-}

r252977 - [scan-view] Rename 'Resources' --> 'share'

2015-11-12 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Thu Nov 12 18:25:04 2015
New Revision: 252977

URL: http://llvm.org/viewvc/llvm-project?rev=252977&view=rev
Log:
[scan-view] Rename 'Resources' --> 'share'

Added:
cfe/trunk/tools/scan-view/share/
  - copied from r252671, cfe/trunk/tools/scan-view/Resources/
Removed:
cfe/trunk/tools/scan-view/Resources/
Modified:
cfe/trunk/tools/scan-view/CMakeLists.txt
cfe/trunk/tools/scan-view/Makefile
cfe/trunk/tools/scan-view/ScanView.py

Modified: cfe/trunk/tools/scan-view/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/CMakeLists.txt?rev=252977&r1=252976&r2=252977&view=diff
==
--- cfe/trunk/tools/scan-view/CMakeLists.txt (original)
+++ cfe/trunk/tools/scan-view/CMakeLists.txt Thu Nov 12 18:25:04 2015
@@ -6,7 +6,7 @@ set(BinFiles
   scan-view
   startfile.py)
 
-set(ResourceFiles
+set(ShareFiles
   FileRadar.scpt
   GetRadarVersion.scpt
   bugcatcher.ico)
@@ -24,16 +24,16 @@ if(CLANG_INSTALL_SCANVIEW)
 install(PROGRAMS ${BinFile} DESTINATION bin)
   endforeach()
 
-  foreach(ResourceFile ${ResourceFiles})
-add_custom_command(OUTPUT 
${CMAKE_BINARY_DIR}/share/scan-view/${ResourceFile}
+  foreach(ShareFile ${ShareFiles})
+add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile}
COMMAND ${CMAKE_COMMAND} -E make_directory
  ${CMAKE_BINARY_DIR}/share/scan-view
COMMAND ${CMAKE_COMMAND} -E copy
- ${CMAKE_CURRENT_SOURCE_DIR}/Resources/${ResourceFile}
+ ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile}
  ${CMAKE_BINARY_DIR}/share/scan-view/
-   DEPENDS 
${CMAKE_CURRENT_SOURCE_DIR}/Resources/${ResourceFile})
-list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ResourceFile})
-install(FILES Resources/${ResourceFile} DESTINATION share/scan-view)
+   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
+list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
+install(FILES Shares/${ShareFile} DESTINATION share/scan-view)
   endforeach()
 
   add_custom_target(scan-view ALL DEPENDS ${Depends})

Modified: cfe/trunk/tools/scan-view/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/Makefile?rev=252977&r1=252976&r2=252977&view=diff
==
--- cfe/trunk/tools/scan-view/Makefile (original)
+++ cfe/trunk/tools/scan-view/Makefile Thu Nov 12 18:25:04 2015
@@ -31,7 +31,7 @@ $(ToolDir)/%: % Makefile $(ToolDir)/.dir
$(Verb)cp $< $@
$(Verb)chmod +x $@
 
-$(ShareDir)/scan-view/%: Resources/% Makefile $(ShareDir)/scan-view/.dir
+$(ShareDir)/scan-view/%: share/% Makefile $(ShareDir)/scan-view/.dir
$(Echo) "Copying $(notdir $<) to the 'share' directory..."
$(Verb)cp $< $@
 

Modified: cfe/trunk/tools/scan-view/ScanView.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/ScanView.py?rev=252977&r1=252976&r2=252977&view=diff
==
--- cfe/trunk/tools/scan-view/ScanView.py (original)
+++ cfe/trunk/tools/scan-view/ScanView.py Thu Nov 12 18:25:04 2015
@@ -73,7 +73,7 @@ kReportReplacements.append((re.compile('
 ###
 # Other simple parameters
 
-kResources = posixpath.join(posixpath.dirname(__file__), '../share/scan-view')
+kShare = posixpath.join(posixpath.dirname(__file__), '../share/scan-view')
 kConfigPath = os.path.expanduser('~/.scanview.cfg')
 
 ###
@@ -680,7 +680,7 @@ File Bug
 overrides['Radar']['Component Version'] = 'X'
 return self.send_report(None, overrides)
 elif name=='favicon.ico':
-return 
self.send_path(posixpath.join(kResources,'bugcatcher.ico'))
+return 
self.send_path(posixpath.join(kShare,'bugcatcher.ico'))
 
 # Match directory entries.
 if components[-1] == '':


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


Re: [PATCH] D14629: [analyzer] Configuration file for scan-build.

2015-11-12 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

Actually, now that I think about it more, `scan-build.cfg` doesn't belong in 
share at all. The location of an instance of it should be read in via a 
command-line argument, and it shouldn't be installed.


http://reviews.llvm.org/D14629



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


Re: [PATCH] D14629: [analyzer] Configuration file for scan-build.

2015-11-12 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

Also, how is this different from `-analyzer-config`?


http://reviews.llvm.org/D14629



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


Re: [PATCH] D14467: [MS] Fix for bug 25013 - #pragma vtordisp is unknown inside functions.

2015-11-12 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

I went ahead and ran some of your test cases through MSVC, and I agree with 
your results. This is pretty interesting behavior. Thanks for looking into it! 
Looks good.



Comment at: test/SemaCXX/pragma-vtordisp.cpp:35-37
@@ -34,5 +34,5 @@
 struct C {
 // FIXME: Our implementation based on token insertion makes it impossible for
 // the pragma to appear everywhere we should support it.
 //#pragma vtordisp()
   struct D : virtual A {

With your changes, can we enable this test?


http://reviews.llvm.org/D14467



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


r252972 - clang/test/Driver/mips-mti-linux.c: Remove XFAIL. It shouldn't fail for targeting win32.

2015-11-12 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Thu Nov 12 17:56:37 2015
New Revision: 252972

URL: http://llvm.org/viewvc/llvm-project?rev=252972&view=rev
Log:
clang/test/Driver/mips-mti-linux.c: Remove XFAIL. It shouldn't fail for 
targeting win32.

I will remove REQUIRES later.

Modified:
cfe/trunk/test/Driver/mips-mti-linux.c

Modified: cfe/trunk/test/Driver/mips-mti-linux.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-mti-linux.c?rev=252972&r1=252971&r2=252972&view=diff
==
--- cfe/trunk/test/Driver/mips-mti-linux.c (original)
+++ cfe/trunk/test/Driver/mips-mti-linux.c Thu Nov 12 17:56:37 2015
@@ -5,7 +5,7 @@
 //Ideally, we'd like to have an --llvm-toolchain option similar to
 //the --gcc-toolchain one.
 
-// XFAIL: win32, win64
+// REQUIRES: shell
 
 // = Big-endian, mips32r2, hard float
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \


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


Re: [PATCH] D14629: [analyzer] Configuration file for scan-build.

2015-11-12 Thread Jonathan Roelofs via cfe-commits
jroelofs added a subscriber: jroelofs.
jroelofs added a comment.

`CommonStuff.pm` (which could stand to have a more descriptive name, 
`libscanbuild.pm` maybe?) and `scan-build.cfg` belong in `share`.


http://reviews.llvm.org/D14629



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


[PATCH] D14629: [analyzer] Configuration file for scan-build.

2015-11-12 Thread Антон Ярцев via cfe-commits
ayartsev created this revision.
ayartsev added a reviewer: zaks.anna.
ayartsev added subscribers: jordan_rose, krememek, sylvestre.ledru, cfe-commits.

A simple INI configuration file for scan-build with options - aliases to 
scan-build command line arguments. This configuration file can be used to 
customize scan-build runs as it is done via command line. Options from this 
config are processed before any command line arguments so equivalent command 
line arguments passed to scan-build will overwrite values obtained from config. 
An order in which options are passed to scan-build is the same in which they 
occur in the config.
[[ https://llvm.org/bugs/show_bug.cgi?id=8203 | PR8203 ]] is related to the 
issue.
In the future I intend to use this config to also customize ccc/c++-analyzer 
script runs (to e.g pass special includes to Clang-analyzer, e.t.c).
Please review!

Currently looking through CMakeLists.txt in scan-build folder I do not exactly 
know where 'CommonStuff.pm' and 'scan-build.cfg' should be placed 
(BinFiles/LibexecFiles/ResourceFiles). Perhaps 'CommonStuff.pm' will go to the 
'ResourceFiles' dir.
I am in favor of placing 'scan-build.cfg' to 'BinFiles' even bearing in mind 
hypothetical usage of this config by ccc/c++-analyzer scripts.

Tested the patch under Windows/Unix, any additional testing is appreciated!

http://reviews.llvm.org/D14629

Files:
  tools/scan-build/CommonStuff.pm
  tools/scan-build/scan-build
  tools/scan-build/scan-build.cfg

Index: tools/scan-build/scan-build.cfg
===
--- tools/scan-build/scan-build.cfg
+++ tools/scan-build/scan-build.cfg
@@ -0,0 +1,85 @@
+# A simple INI (https://en.wikipedia.org/wiki/INI_file) file.
+
+[scan-build] 
+# This section contains scan-build options which are aliases for scan-build
+# command-line arguments. This options are processed before any command line
+# arguments so equivalent command line arguments will overwrite values obtained
+# from this section.
+#
+# The order in which the options are passed to scan-build is the same in which
+# they occur in this section. You can freely change the options order or delete
+# options you don't like to see here.
+#
+# Options with no values are skipped.
+# {flag_name}_FLAG options can only take values 1 and 0.
+
+  # Alias for -analyze-headers.
+  ANALYZE_HEADERS_FLAG = 
+
+  # Alias for -o.
+  OUTPUT_LOCATION = 
+
+  # Alias for -k (--keep-going).
+  KEEP_GOING_FLAG = 
+
+  # Alias for --html-title.
+  HTML_TITLE = 
+
+  # Alias for -plist/-plist-html.
+  # Possible values: [plist|plist-html].
+  OUTPUT_FORMAT = 
+
+  # Alias for --status-bugs.
+  STATUS_BUGS_FLAG = 
+
+  # Alias for --use-cc.
+  USE_CC = 
+
+  # Alias for --use-c++.
+  USE_CPP = 
+
+  # Alias for --analyzer-target.
+  ANALYZER_TARGET = 
+
+  # Alias for -v.
+  #Possible values: [1|2|3].
+  VERBOSITY_LEVEL = 
+
+  # Alias for -V (--view).
+  VIEW_FLAG = 
+
+  # Alias for -no-failure-reports.
+  NO_FAILURE_REPORTS_FLAG = 
+
+  # Alias for -stats.
+  STATS_FLAG = 
+
+  # Alias for -maxloop.
+  MAXLOOP = 
+
+  # Alias for -internal-stats.
+  INTERNAL_STATS_FLAG = 
+
+  # Alias for --use-analyzer.
+  USE_ANALYZER = 
+
+  # Alias for --keep-empty.
+  KEEP_EMPTY_FLAG = 
+
+  # Alias for --override-compiler.
+  OVERRIDE_COMPILER_FLAG = 
+
+  # Alias for -analyzer-config.
+  ANALYZER_CONFIG = 
+
+  # Alias for -enable-checker.
+  # Value: checker names separated by commas.
+  ENABLE_CHECKERS = 
+
+  # Alias for -disable-checker.
+  # Value: checker names separated by commas.
+  DISABLE_CHECKERS = 
+
+  # Alias for -load-plugin.
+  # Value: plugin names separated by commas.
+  LOAD_PLUGINS = 
Index: tools/scan-build/scan-build
===
--- tools/scan-build/scan-build
+++ tools/scan-build/scan-build
@@ -25,6 +25,9 @@
 use Cwd qw/ getcwd abs_path /;
 use Sys::Hostname;
 use Hash::Util qw(lock_keys);
+# Add scan-build dir to the list of places where perl looks for modules.
+use lib dirname(abs_path($0));
+use CommonStuff;
 
 my $Prog = "scan-build";
 my $BuildName;
@@ -1439,6 +1442,118 @@
 }
 
 ####
+# Process options from config file.
+####
+
+my %CfgOptToCmdArg = (
+  ANALYZE_HEADERS_FLAG => "-analyze-headers",
+  OUTPUT_LOCATION => "-o",
+  KEEP_GOING_FLAG => "-k",
+  HTML_TITLE => "--html-title",
+  OUTPUT_FORMAT => undef,# Alias for -plist/-plist-html. Possible values: [plist|plist-html].
+  STATUS_BUGS_FLAG => "--status-bugs",
+  USE_CC => "--use-cc",
+  USE_CPP => "--use-c++",
+  ANALYZER_TARGET => "--analyzer-target",
+  VERBOSITY_LEVEL => "-v",   # Possible values: [1|2|3].
+  VIEW_FLAG => "-V",
+  NO_FAILURE_REPORTS_FLAG => "-no-failure-reports",
+  STATS_FLAG => "-stats",
+  MAXLOOP => "-maxloop",
+  INTERNAL_STATS_FLAG => "-internal-stats",
+  USE_ANALYZ

r252971 - Remove -Wobjc-weak-compat; there isn't a compelling use case for this.

2015-11-12 Thread John McCall via cfe-commits
Author: rjmccall
Date: Thu Nov 12 17:39:39 2015
New Revision: 252971

URL: http://llvm.org/viewvc/llvm-project?rev=252971&view=rev
Log:
Remove -Wobjc-weak-compat; there isn't a compelling use case for this.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/SemaObjC/property-in-class-extension-1.m

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=252971&r1=252970&r2=252971&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Nov 12 17:39:39 
2015
@@ -4561,9 +4561,6 @@ def err_synthesizing_arc_weak_property_d
 def err_synthesizing_arc_weak_property_no_runtime : Error<
   "cannot synthesize weak property because the current deployment target "
   "does not support weak references">;
-def warn_objc_weak_compat : Warning<
-  "the meaning of __weak has changed in manual reference-counting">,
-  InGroup>, DefaultIgnore;
 def err_arc_unsupported_weak_class : Error<
   "class is incompatible with __weak references">;
 def err_arc_weak_unavailable_assign : Error<

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=252971&r1=252970&r2=252971&view=diff
==
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Thu Nov 12 17:39:39 2015
@@ -5187,6 +5187,18 @@ static bool handleObjCOwnershipTypeAttr(
 type = S.Context.getAttributedType(AttributedType::attr_objc_ownership,
origType, type);
 
+  auto diagnoseOrDelay = [](Sema &S, SourceLocation loc,
+unsigned diagnostic, QualType type) {
+if (S.DelayedDiagnostics.shouldDelayDiagnostics()) {
+  S.DelayedDiagnostics.add(
+  sema::DelayedDiagnostic::makeForbiddenType(
+  S.getSourceManager().getExpansionLoc(loc),
+  diagnostic, type, /*ignored*/ 0));
+} else {
+  S.Diag(loc, diagnostic);
+}
+  };
+
   // Sometimes, __weak isn't allowed.
   if (lifetime == Qualifiers::OCL_Weak &&
   !S.getLangOpts().ObjCWeak && !NonObjCPointer) {
@@ -5197,26 +5209,12 @@ static bool handleObjCOwnershipTypeAttr(
: diag::err_arc_weak_no_runtime);
 
 // In any case, delay the diagnostic until we know what we're parsing.
-if (S.DelayedDiagnostics.shouldDelayDiagnostics()) {
-  S.DelayedDiagnostics.add(
-  sema::DelayedDiagnostic::makeForbiddenType(
-  S.getSourceManager().getExpansionLoc(AttrLoc),
-  diagnostic, type, /*ignored*/ 0));
-} else {
-  S.Diag(AttrLoc, diagnostic);
-}
+diagnoseOrDelay(S, AttrLoc, diagnostic, type);
 
 attr.setInvalid();
 return true;
   }
 
-  // If we accepted __weak, we might still need to warn about it.
-  if (lifetime == Qualifiers::OCL_Weak &&
-  !S.getLangOpts().ObjCAutoRefCount &&
-  S.getLangOpts().ObjCWeak) {
-S.Diag(AttrLoc, diag::warn_objc_weak_compat);
-  }
-
   // Forbid __weak for class objects marked as
   // objc_arc_weak_reference_unavailable
   if (lifetime == Qualifiers::OCL_Weak) {

Modified: cfe/trunk/test/SemaObjC/property-in-class-extension-1.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-in-class-extension-1.m?rev=252971&r1=252970&r2=252971&view=diff
==
--- cfe/trunk/test/SemaObjC/property-in-class-extension-1.m (original)
+++ cfe/trunk/test/SemaObjC/property-in-class-extension-1.m Thu Nov 12 17:39:39 
2015
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1  -fsyntax-only -triple x86_64-apple-darwin11 
-fobjc-runtime-has-weak -fobjc-weak -verify -Weverything -Wno-objc-weak-compat  
%s
-// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin11 
-fobjc-runtime-has-weak -fobjc-weak -fsyntax-only -verify -Weverything 
-Wno-objc-weak-compat %s
+// RUN: %clang_cc1  -fsyntax-only -triple x86_64-apple-darwin11 
-fobjc-runtime-has-weak -fobjc-weak -verify -Weverything %s
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin11 
-fobjc-runtime-has-weak -fobjc-weak -fsyntax-only -verify -Weverything %s
 // rdar://12103400
 
 @class NSString;


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


r252967 - Avoid duplicated diagnostic when lookup for a nested-name-specifier fails due to ambiguity.

2015-11-12 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Nov 12 16:40:09 2015
New Revision: 252967

URL: http://llvm.org/viewvc/llvm-project?rev=252967&view=rev
Log:
Avoid duplicated diagnostic when lookup for a nested-name-specifier fails due 
to ambiguity.

Modified:
cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
cfe/trunk/test/CXX/temp/temp.res/temp.local/p3.cpp
cfe/trunk/test/Modules/no-linkage.cpp

Modified: cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp?rev=252967&r1=252966&r2=252967&view=diff
==
--- cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp Thu Nov 12 16:40:09 2015
@@ -533,6 +533,9 @@ bool Sema::BuildCXXNestedNameSpecifier(S
 LookupName(Found, S);
   }
 
+  if (Found.isAmbiguous())
+return true;
+
   // If we performed lookup into a dependent context and did not find anything,
   // that's fine: just build a dependent nested-name-specifier.
   if (Found.empty() && isDependent &&
@@ -551,8 +554,6 @@ bool Sema::BuildCXXNestedNameSpecifier(S
 return false;
   }
 
-  // FIXME: Deal with ambiguities cleanly.
-
   if (Found.empty() && !ErrorRecoveryLookup) {
 // If identifier is not found as class-name-or-namespace-name, but is found
 // as other entity, don't look for typos.
@@ -562,6 +563,8 @@ bool Sema::BuildCXXNestedNameSpecifier(S
 else if (S && !isDependent)
   LookupName(R, S);
 if (!R.empty()) {
+  // Don't diagnose problems with this speculative lookup.
+  R.suppressDiagnostics();
   // The identifier is found in ordinary lookup. If correction to colon is
   // allowed, suggest replacement to ':'.
   if (IsCorrectedToColon) {

Modified: cfe/trunk/test/CXX/temp/temp.res/temp.local/p3.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.res/temp.local/p3.cpp?rev=252967&r1=252966&r2=252967&view=diff
==
--- cfe/trunk/test/CXX/temp/temp.res/temp.local/p3.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.res/temp.local/p3.cpp Thu Nov 12 16:40:09 2015
@@ -14,8 +14,7 @@ template  struct Derived: Base<
 t->Derived::Base::f();
 t->Base::f();
 t->Base::f(); // expected-error{{member 'Base' found in multiple base 
classes of different types}} \
-// expected-error{{no member named 'f' in 'X0'}} \
-// expected-error{{'Base' is not a class, namespace, or enumeration}}
+// expected-error{{no member named 'f' in 'X0'}}
   }
 };
 

Modified: cfe/trunk/test/Modules/no-linkage.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/no-linkage.cpp?rev=252967&r1=252966&r2=252967&view=diff
==
--- cfe/trunk/test/Modules/no-linkage.cpp (original)
+++ cfe/trunk/test/Modules/no-linkage.cpp Thu Nov 12 16:40:09 2015
@@ -28,7 +28,7 @@ void use_things() {
 
 void use_things_again() {
   use(Typedef().n); // expected-error {{ambiguous}}
-  use(NS::n); // expected-error {{ambiguous}} expected-error{{'NS' is not a 
class, namespace, or enumeration}}
+  use(NS::n); // expected-error {{ambiguous}}
   use(AliasDecl); // expected-error {{ambiguous}}
   use(Enumerator); // expected-error {{ambiguous}}
   use(UsingDecl); // expected-error {{ambiguous}}


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


r252961 - Mark clang/test/Driver/ms-bitfields.c as REQUIRES:clang-driver.

2015-11-12 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Thu Nov 12 16:25:38 2015
New Revision: 252961

URL: http://llvm.org/viewvc/llvm-project?rev=252961&view=rev
Log:
Mark clang/test/Driver/ms-bitfields.c as REQUIRES:clang-driver.

Modified:
cfe/trunk/test/Driver/ms-bitfields.c

Modified: cfe/trunk/test/Driver/ms-bitfields.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ms-bitfields.c?rev=252961&r1=252960&r2=252961&view=diff
==
--- cfe/trunk/test/Driver/ms-bitfields.c (original)
+++ cfe/trunk/test/Driver/ms-bitfields.c Thu Nov 12 16:25:38 2015
@@ -4,3 +4,5 @@
 
 // MSBITFIELDS: -mms-bitfields
 // NO-MSBITFIELDS-NOT: -mms-bitfields
+
+// REQUIRES: clang-driver


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


r252960 - [modules] Simplify and generalize the existing rule for finding hidden

2015-11-12 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Nov 12 16:19:45 2015
New Revision: 252960

URL: http://llvm.org/viewvc/llvm-project?rev=252960&view=rev
Log:
[modules] Simplify and generalize the existing rule for finding hidden
declarations in redeclaration lookup. A declaration is now visible to
lookup if:

 * It is visible (not in a module, or in an imported module), or
 * We're doing redeclaration lookup and it's externally-visible, or
 * We're doing typo correction and looking for unimported decls.

We now support multiple modules having different internal-linkage or no-linkage
definitions of the same name for all entities, not just for functions,
variables, and some typedefs. As previously, if multiple such entities are
visible, any attempt to use them will result in an ambiguity error.

This patch fixes the linkage calculation for a number of entities where we
previously didn't need to get it right (using-declarations, namespace aliases,
and so on).  It also classifies enumerators as always having no linkage, which
is a slight deviation from the C++ standard's definition, but not an observable
change outside modules (this change is being discussed on the -core reflector
currently).

This also removes the prior special case for tag lookup, which made some cases
of this work, but also led to bizarre, bogus "must use 'struct' to refer to type
'Foo' in this scope" diagnostics in C++.

Added:
cfe/trunk/test/Modules/Inputs/no-linkage/
cfe/trunk/test/Modules/Inputs/no-linkage/decls.h
cfe/trunk/test/Modules/Inputs/no-linkage/empty.h
cfe/trunk/test/Modules/Inputs/no-linkage/module.modulemap
cfe/trunk/test/Modules/no-linkage.cpp
Modified:
cfe/trunk/include/clang/Sema/Lookup.h
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/Index/linkage.c
cfe/trunk/test/Index/usrs.m
cfe/trunk/test/Modules/decldef.m
cfe/trunk/test/Modules/merge-enumerators.cpp
cfe/trunk/test/Modules/module-private.cpp
cfe/trunk/test/Modules/submodule-visibility-cycles.cpp
cfe/trunk/test/Modules/submodules-merge-defs.cpp

Modified: cfe/trunk/include/clang/Sema/Lookup.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=252960&r1=252959&r2=252960&view=diff
==
--- cfe/trunk/include/clang/Sema/Lookup.h (original)
+++ cfe/trunk/include/clang/Sema/Lookup.h Thu Nov 12 16:19:45 2015
@@ -139,8 +139,7 @@ public:
   Redecl(Redecl != Sema::NotForRedeclaration),
   HideTags(true),
   Diagnose(Redecl == Sema::NotForRedeclaration),
-  AllowHidden(Redecl == Sema::ForRedeclaration),
-  AllowHiddenInternal(AllowHidden),
+  AllowHidden(false),
   Shadowed(false)
   {
 configure();
@@ -162,8 +161,7 @@ public:
   Redecl(Redecl != Sema::NotForRedeclaration),
   HideTags(true),
   Diagnose(Redecl == Sema::NotForRedeclaration),
-  AllowHidden(Redecl == Sema::ForRedeclaration),
-  AllowHiddenInternal(AllowHidden),
+  AllowHidden(false),
   Shadowed(false)
   {
 configure();
@@ -184,7 +182,6 @@ public:
   HideTags(Other.HideTags),
   Diagnose(false),
   AllowHidden(Other.AllowHidden),
-  AllowHiddenInternal(Other.AllowHiddenInternal),
   Shadowed(false)
   {}
 
@@ -226,27 +223,16 @@ public:
   /// \brief Specify whether hidden declarations are visible, e.g.,
   /// for recovery reasons.
   void setAllowHidden(bool AH) {
-AllowHiddenInternal = AllowHidden = AH;
-  }
-
-  /// \brief Specify whether hidden internal declarations are visible.
-  void setAllowHiddenInternal(bool AHI) {
-AllowHiddenInternal = AHI;
+AllowHidden = AH;
   }
 
   /// \brief Determine whether this lookup is permitted to see hidden
   /// declarations, such as those in modules that have not yet been imported.
   bool isHiddenDeclarationVisible(NamedDecl *ND) const {
-// If a using-shadow declaration is hidden, it's never visible, not
-// even to redeclaration lookup.
-// FIXME: Should this apply to typedefs and namespace aliases too?
-if (isa(ND) && LookupKind != Sema::LookupUsingDeclName)
-  return false;
-return (AllowHidden &&
-(AllowHiddenInternal || ND->isExternallyVisible())) ||
-   LookupKind == Sema::LookupTagName;
+return AllowHidden ||
+   (isForRedeclaration() && ND->isExternallyVisible());
   }
-  
+
   /// Sets whether tag declarations should be hidden by non-tag
   /// declarations during resolution.  The default is true.
   void setHideTags(bool Hide) {
@@ -317,7 +303,8 @@ public:
 if (!D->isInIdentifierNamespace(IDNS))
   return nullptr;
 
-if (isHiddenDeclarationVisible(D) || isVisible(getSema(), D))
+if (!D->isHidden() || isHiddenDeclarationVisible(D) ||
+isVisibleSlow(getSema(), D))
   return D;
 
 return getAcceptableDeclSlow(D);
@@ -526,7 +513,6 @@ public:
   /// \brief Change this lookup's 

Re: [PATCH] D13144: [CUDA] propagate to CUDA sub-compilations target triple of opposite side.

2015-11-12 Thread Eric Christopher via cfe-commits
echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

One inline comment then OK for now.

-eric



Comment at: lib/Driver/Tools.cpp:3227-3240
@@ -3226,2 +3226,16 @@
 
+  if (IsCuda) {
+const ToolChain *AuxToolChain;
+if (&getToolChain() == C.getCudaDeviceToolChain())
+  AuxToolChain = C.getCudaHostToolChain();
+else if (&getToolChain() == C.getCudaHostToolChain())
+  AuxToolChain = C.getCudaDeviceToolChain();
+else
+  llvm_unreachable("Can't figure out CUDA compilation mode.");
+if (AuxToolChain) {
+  CmdArgs.push_back("-aux-triple");
+  CmdArgs.push_back(Args.MakeArgString(AuxToolChain->getTriple().str()));
+}
+  }
+
   if (Triple.isOSWindows() && (Triple.getArch() == llvm::Triple::arm ||

This is pretty heinous. I don't have a better way of doing it offhand, but 
please document this with a rather large FIXME and continue on the path to 
generic compilation support we've been talking about.


http://reviews.llvm.org/D13144



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


Re: [PATCH] D13170: [CUDA] Driver changes to pass flags needed to use detected CUDA installation.

2015-11-12 Thread Eric Christopher via cfe-commits
echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

This needs a very long commit message describing exactly what's going on and 
why since it's not documented anywhere. Possibly in the code as well at 
AddPreprocessingOptions and other places you add AuxToolChain. Some of this is 
going to need to get refactored in the medium term when we look at being able 
to preprocess and add multiple target argument passing, but this is an ok 
intermediate step.

Thanks!

-eric


http://reviews.llvm.org/D13170



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


Re: [PATCH] D14556: [CUDA] Detect and link with CUDA's libdevice bitcode library.

2015-11-12 Thread Eric Christopher via cfe-commits
echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

A couple of inline comments, but this is fine for now.

We need a command line option to select CUDA version as well.

-eric



Comment at: lib/Driver/ToolChains.cpp:1635
@@ -1634,2 +1634,3 @@
 CudaPathCandidates.push_back(D.SysRoot + "/usr/local/cuda");
+CudaPathCandidates.push_back(D.SysRoot + "/usr/local/cuda-7.5");
 CudaPathCandidates.push_back(D.SysRoot + "/usr/local/cuda-7.0");

Commit this part separately as an "add a newer version of cuda that we support".


Comment at: lib/Driver/ToolChains.cpp:4082
@@ +4081,3 @@
+// than LLVM defaults to. Use PTX4.2 which is the PTX version that
+// came with CUDA-7.0.
+CC1Args.push_back("-target-feature");

Explain in a bit more detail here, I understand why, but it's oddly complicated 
and annoying.

We should look into making this part of TargetInfo with the cuda version being 
a feature that then turns on associated minimal cpu features etc.


http://reviews.llvm.org/D14556



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


r252959 - DR407: Rationalize how we handle tags being hidden by typedefs. Even with

2015-11-12 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Nov 12 16:04:34 2015
New Revision: 252959

URL: http://llvm.org/viewvc/llvm-project?rev=252959&view=rev
Log:
DR407: Rationalize how we handle tags being hidden by typedefs. Even with
DR407, the C++ standard doesn't really say how this should work. Here's what we
do (which is consistent with DR407 as far as I can tell):

 * When performing name lookup for an elaborated-type-specifier, a tag
   declaration hides a typedef declaration that names the same type.
 * When performing any other kind of lookup, a typedef declaration hides
   a tag declaration that names the same type.

In any other case where lookup finds both a typedef and a tag (that is, when
they name different types), the lookup will be ambiguous. If lookup finds a
tag and a typedef that name the same type, and finds anything else, the lookup
will always be ambiguous (even if the other entity would hide the tag, it does
not also hide the typedef).

Modified:
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/test/CXX/drs/dr4xx.cpp
cfe/trunk/www/cxx_dr_status.html

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=252959&r1=252958&r2=252959&view=diff
==
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Thu Nov 12 16:04:34 2015
@@ -368,13 +368,17 @@ static bool isPreferredLookupResult(Sema
   auto *DUnderlying = D->getUnderlyingDecl();
   auto *EUnderlying = Existing->getUnderlyingDecl();
 
-  // If they have different underlying declarations, pick one arbitrarily
-  // (this happens when two type declarations denote the same type).
-  // FIXME: Should we prefer a struct declaration over a typedef or vice versa?
-  //If a name could be a typedef-name or a class-name, which is it?
+  // If they have different underlying declarations, prefer a typedef over the
+  // original type (this happens when two type declarations denote the same
+  // type), per a generous reading of C++ [dcl.typedef]p3 and p4. The typedef
+  // might carry additional semantic information, such as an alignment 
override.
+  // However, per C++ [dcl.typedef]p5, when looking up a tag name, prefer a tag
+  // declaration over a typedef.
   if (DUnderlying->getCanonicalDecl() != EUnderlying->getCanonicalDecl()) {
 assert(isa(DUnderlying) && isa(EUnderlying));
-return false;
+bool HaveTag = isa(EUnderlying);
+bool WantTag = Kind == Sema::LookupTagName;
+return HaveTag != WantTag;
   }
 
   // Pick the function with more default arguments.
@@ -434,6 +438,23 @@ static bool isPreferredLookupResult(Sema
   return !S.isVisible(Existing);
 }
 
+/// Determine whether \p D can hide a tag declaration.
+static bool canHideTag(NamedDecl *D) {
+  // C++ [basic.scope.declarative]p4:
+  //   Given a set of declarations in a single declarative region [...]
+  //   exactly one declaration shall declare a class name or enumeration name
+  //   that is not a typedef name and the other declarations shall all refer to
+  //   the same variable or enumerator, or all refer to functions and function
+  //   templates; in this case the class name or enumeration name is hidden.
+  // C++ [basic.scope.hiding]p2:
+  //   A class name or enumeration name can be hidden by the name of a
+  //   variable, data member, function, or enumerator declared in the same
+  //   scope.
+  D = D->getUnderlyingDecl();
+  return isa(D) || isa(D) || isa(D) ||
+ isa(D) || isa(D);
+}
+
 /// Resolves the result kind of this lookup.
 void LookupResult::resolveKind() {
   unsigned N = Decls.size();
@@ -489,15 +510,12 @@ void LookupResult::resolveKind() {
 // no ambiguity if they all refer to the same type, so unique based on the
 // canonical type.
 if (TypeDecl *TD = dyn_cast(D)) {
-  // FIXME: Why are nested type declarations treated differently?
-  if (!TD->getDeclContext()->isRecord()) {
-QualType T = getSema().Context.getTypeDeclType(TD);
-auto UniqueResult = UniqueTypes.insert(
-std::make_pair(getSema().Context.getCanonicalType(T), I));
-if (!UniqueResult.second) {
-  // The type is not unique.
-  ExistingI = UniqueResult.first->second;
-}
+  QualType T = getSema().Context.getTypeDeclType(TD);
+  auto UniqueResult = UniqueTypes.insert(
+  std::make_pair(getSema().Context.getCanonicalType(T), I));
+  if (!UniqueResult.second) {
+// The type is not unique.
+ExistingI = UniqueResult.first->second;
   }
 }
 
@@ -564,10 +582,13 @@ void LookupResult::resolveKind() {
   //   wherever the object, function, or enumerator name is visible.
   // But it's still an error if there are distinct tag types found,
   // even if they're not visible. (ref?)
-  if (HideTags && HasTag && !Ambiguous &&
+  if (N > 1 && HideTags && HasTag && !Ambiguous &&
   (HasFunction ||

r252957 - Revert r240335.

2015-11-12 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Nov 12 15:55:58 2015
New Revision: 252957

URL: http://llvm.org/viewvc/llvm-project?rev=252957&view=rev
Log:
Revert r240335.

This failed to solve the problem it was aimed at, and introduced just as many
issues as it resolved. Realistically, we need to deal with the possibility that
multiple modules might define different internal linkage symbols with the same
name, and this isn't a problem unless two such symbols are simultaneously
visible.

The case where two modules define equivalent internal linkage symbols is
handled by r252063: if lookup finds multiple sufficiently-similar entities from
different modules, we just pick one of them as an extension (but we keep them
separate).

Modified:
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Modules/submodules-merge-defs.cpp
cfe/trunk/test/Modules/using-decl.cpp

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=252957&r1=252956&r2=252957&view=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Thu Nov 12 15:55:58 2015
@@ -133,7 +133,6 @@ COMPATIBLE_LANGOPT(ModulesStrictDeclUse,
 BENIGN_LANGOPT(ModulesErrorRecovery, 1, 1, "automatically import modules as 
needed when performing error recovery")
 BENIGN_LANGOPT(ImplicitModules, 1, 1, "build modules that are not specified 
via -fmodule-file")
 COMPATIBLE_LANGOPT(ModulesLocalVisibility, 1, 0, "local submodule visibility")
-COMPATIBLE_LANGOPT(ModulesHideInternalLinkage, 1, 1, "hiding non-visible 
internal linkage declarations from redeclaration lookup")
 COMPATIBLE_LANGOPT(Optimize  , 1, 0, "__OPTIMIZE__ predefined macro")
 COMPATIBLE_LANGOPT(OptimizeSize  , 1, 0, "__OPTIMIZE_SIZE__ predefined 
macro")
 LANGOPT(Static, 1, 0, "__STATIC__ predefined macro (as opposed to 
__DYNAMIC__)")

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=252957&r1=252956&r2=252957&view=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Thu Nov 12 15:55:58 2015
@@ -388,10 +388,6 @@ def fmodules_local_submodule_visibility
 def fmodule_format_EQ : Joined<["-"], "fmodule-format=">,
   HelpText<"Select the container format for clang modules and PCH. "
"Supported options are 'raw' and 'obj'.">;
-def fno_modules_hide_internal_linkage :
-  Flag<["-"], "fno-modules-hide-internal-linkage">,
-  HelpText<"Make all declarations visible to redeclaration lookup, "
-   "even if they have internal linkage.">;
 def ftest_module_file_extension_EQ :
   Joined<["-"], "ftest-module-file-extension=">,
   HelpText<"introduce a module file extension for testing purposes. "

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=252957&r1=252956&r2=252957&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Thu Nov 12 15:55:58 2015
@@ -277,9 +277,7 @@ class Sema {
 // it will keep having external linkage. If it has internal linkage, we
 // will not link it. Since it has no previous decls, it will remain
 // with internal linkage.
-if (getLangOpts().ModulesHideInternalLinkage)
-  return isVisible(Old) || New->isExternallyVisible();
-return true;
+return isVisible(Old) || New->isExternallyVisible();
   }
 
 public:

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=252957&r1=252956&r2=252957&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Nov 12 15:55:58 2015
@@ -1627,8 +1627,6 @@ static void ParseLangArgs(LangOptions &O
   Args.hasArg(OPT_fmodules_decluse) || Opts.ModulesStrictDeclUse;
   Opts.ModulesLocalVisibility =
   Args.hasArg(OPT_fmodules_local_submodule_visibility);
-  Opts.ModulesHideInternalLinkage =
-  !Args.hasArg(OPT_fno_modules_hide_internal_linkage);
   Opts.ModulesSearchAll = Opts.Modules &&
 !Args.hasArg(OPT_fno_modules_search_all) &&
 Args.hasArg(OPT_fmodules_search_all);

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=252957&r1=252956&r2=252957&

r252955 - Additional tests from r252690 that I forgot to 'svn add'.

2015-11-12 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Nov 12 15:42:39 2015
New Revision: 252955

URL: http://llvm.org/viewvc/llvm-project?rev=252955&view=rev
Log:
Additional tests from r252690 that I forgot to 'svn add'.

From a patch by Nicholas Allegra!

Added:
cfe/trunk/test/Sema/auto-type.c
cfe/trunk/test/SemaCXX/auto-type-from-cxx.cpp

Added: cfe/trunk/test/Sema/auto-type.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/auto-type.c?rev=252955&view=auto
==
--- cfe/trunk/test/Sema/auto-type.c (added)
+++ cfe/trunk/test/Sema/auto-type.c Thu Nov 12 15:42:39 2015
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic -std=c11
+
+__auto_type a = 5; // expected-warning {{'__auto_type' is a GNU extension}}
+__extension__ __auto_type a1 = 5;
+#pragma clang diagnostic ignored "-Wgnu-auto-type"
+__auto_type b = 5.0;
+__auto_type c = &b;
+__auto_type d = (struct {int a;}) {5};
+_Static_assert(__builtin_types_compatible_p(__typeof(a), int), "");
+__auto_type e = e; // expected-error {{variable 'e' declared with 
'__auto_type' type cannot appear in its own initializer}}
+
+struct s { __auto_type a; }; // expected-error {{'__auto_type' not allowed in 
struct member}}
+
+__auto_type f = 1, g = 1.0; // expected-error {{'__auto_type' deduced as 'int' 
in declaration of 'f' and deduced as 'double' in declaration of 'g'}}
+
+__auto_type h() {} // expected-error {{'__auto_type' not allowed in function 
return type}}
+
+int i() {
+  struct bitfield { int field:2; };
+  __auto_type j = (struct bitfield){1}.field; // expected-error {{cannot pass 
bit-field as __auto_type initializer in C}}
+
+}
+
+int k(l)
+__auto_type l; // expected-error {{'__auto_type' not allowed in K&R-style 
function parameter}}
+{}

Added: cfe/trunk/test/SemaCXX/auto-type-from-cxx.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/auto-type-from-cxx.cpp?rev=252955&view=auto
==
--- cfe/trunk/test/SemaCXX/auto-type-from-cxx.cpp (added)
+++ cfe/trunk/test/SemaCXX/auto-type-from-cxx.cpp Thu Nov 12 15:42:39 2015
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify %s
+
+struct A {
+operator __auto_type() {} // expected-error {{'__auto_type' not allowed in 
conversion function type}}
+};
+
+__auto_type a() -> int; // expected-error {{'__auto_type' not allowed in 
function return type}}
+template 
+__auto_type b() { return T::x; } // expected-error {{'__auto_type' not allowed 
in function return type}}
+auto c() -> __auto_type { __builtin_unreachable(); } // expected-error 
{{'__auto_type' not allowed in function return type}}
+int d() {
+  decltype(__auto_type) e = 1; // expected-error {{expected expression}}
+  auto _ = [](__auto_type f) {}; // expected-error {{'__auto_type' not allowed 
in lambda parameter}}
+  __auto_type g = 2;
+  struct BitField { int field:2; };
+  __auto_type h = BitField{1}.field; // (should work from C++)
+  new __auto_type; // expected-error {{'__auto_type' not allowed in type 
allocated by 'new'}}
+}
+


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


Re: [PATCH] D12547: Add support for function attribute "disable_tail_calls"

2015-11-12 Thread Akira Hatanaka via cfe-commits
ahatanak marked an inline comment as done.
ahatanak added a comment.

I'll commit this patch shortly. Thank you for the review.


http://reviews.llvm.org/D12547



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


Re: [PATCH] D14560: [Clang] Fix Clang-tidy modernize-use-auto in some files in lib/AST; other minor cleanups.

2015-11-12 Thread Aaron Ballman via cfe-commits
On Thu, Nov 12, 2015 at 11:11 AM, David Blaikie  wrote:
>
>
> On Thu, Nov 12, 2015 at 6:36 AM, Aaron Ballman via cfe-commits
>  wrote:
>>
>> aaron.ballman added inline comments.
>>
>> 
>> Comment at: lib/AST/ASTContext.cpp:7930
>> @@ -7931,3 +7929,3 @@
>>
>> -ASTMutationListener::~ASTMutationListener() { }
>> +ASTMutationListener::~ASTMutationListener() = default;
>>
>> 
>> Eugene.Zelenko wrote:
>> > aaron.ballman wrote:
>> > > This is... interesting. Explicitly defaulting an out-of-line function
>> > > definition is not something I've ever encountered before. What benefit 
>> > > does
>> > > this provide?
>> > It's explicitly tells that destructor has default implementation.
>> I'm not certain this is an improvement. Using =default in the declaration
>> is an improvement because it tells the compiler up front "this has the
>> default implementation" and the compiler can benefit from that information
>> in other ways. When it's on an out-of-line definition, it does say "this has
>> the default implementation", but it doesn't give the compiler any benefit
>> over {}, so the only benefit is up to the reader of the code. I think
>> someone can read {} to easily tell it is the default behavior, it is
>> considerably shorter, and it doesn't cause anyone's eyes to trip over it
>> wondering about the construct.
>
>
> If we're talking coding style, I'll vote marginally in favor of "= default"
> even in out of line definitions. But yeah, I don't think it necessarily adds
> much either *shrug* I probably wouldn't hold up a code review on it either
> way myself. (this is not a directive, just my own commentary)

The good news is, I'm only marginally against "= default"! :-D I can
go either way, but many of the changes in the patch are not ones that
I think we wish to accept. We should address those first, and then we
can determine what road to take for out-of-line defaulted functions.

~Aaron

>
>>
>>
>>
>> Repository:
>>   rL LLVM
>>
>> http://reviews.llvm.org/D14560
>>
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12547: Add support for function attribute "disable_tail_calls"

2015-11-12 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM, thank you!


http://reviews.llvm.org/D12547



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


Re: [PATCH] D14619: [PATCH] clang-tidy checker for nothrow copy constructible exception objects

2015-11-12 Thread Aaron Ballman via cfe-commits
aaron.ballman marked an inline comment as done.


Comment at: clang-tidy/cert/ThrownExceptionTypeCheck.cpp:37
@@ +36,3 @@
+} // end namespace
+
+namespace tidy {

Your slight preference is my firmest desire! :-P Seriously, I think the code is 
more clear after implementing your suggestion, so thank you!


http://reviews.llvm.org/D14619



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


Re: [PATCH] D14619: [PATCH] clang-tidy checker for nothrow copy constructible exception objects

2015-11-12 Thread Aaron Ballman via cfe-commits
aaron.ballman updated this revision to Diff 40078.
aaron.ballman marked an inline comment as done.
aaron.ballman added a comment.

Addressing review comments.


http://reviews.llvm.org/D14619

Files:
  clang-tidy/cert/CERTTidyModule.cpp
  clang-tidy/cert/CMakeLists.txt
  clang-tidy/cert/ThrownExceptionTypeCheck.cpp
  clang-tidy/cert/ThrownExceptionTypeCheck.h
  docs/clang-tidy/checks/cert-thrown-exception-type.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/cert-throw-exception-type.cpp

Index: test/clang-tidy/cert-throw-exception-type.cpp
===
--- test/clang-tidy/cert-throw-exception-type.cpp
+++ test/clang-tidy/cert-throw-exception-type.cpp
@@ -0,0 +1,112 @@
+// RUN: %check_clang_tidy %s cert-err60-cpp %t -- -- -std=c++11 -fcxx-exceptions
+
+struct S {};
+struct T : S {};
+struct U {
+  U() = default;
+  U(const U&) = default;
+};
+
+struct V {
+  V() = default;
+  V(const V&) noexcept;
+};
+
+struct W {
+  W() = default;
+  W(const W&) noexcept(false);
+};
+
+struct X {
+  X() = default;
+  X(const X&) {}
+};
+
+struct Y {
+  Y() = default;
+  Y(const Y&) throw();
+};
+
+struct Z {
+  Z() = default;
+  Z(const Z&) throw(int);
+};
+
+void g() noexcept(false);
+
+struct A {
+  A() = default;
+  A(const A&) noexcept(noexcept(g()));
+};
+
+struct B {
+  B() = default;
+  B(const B&) = default;
+  B(const A&) noexcept(false);
+};
+
+class C {
+  W M; // W is not no-throw copy constructible
+public:
+  C() = default;
+  C(const C&) = default;
+};
+
+struct D {
+  D() = default;
+  D(const D&) noexcept(false);
+  D(D&) noexcept(true);
+};
+
+struct E {
+  E() = default;
+  E(E&) noexcept(true);
+  E(const E&) noexcept(false);
+};
+
+struct Allocates {
+  int *x;
+  Allocates() : x(new int(0)) {}
+  Allocates(const Allocates &other) : x(new int(*other.x)) {}
+};
+
+struct OptionallyAllocates {
+  int *x;
+  OptionallyAllocates() : x(new int(0)) {}
+  OptionallyAllocates(const Allocates &other) noexcept(true) {
+try {
+  x = new int(*other.x);
+} catch (...) {
+  x = nullptr;
+}
+  }
+};
+
+void f() {
+  throw 12; // ok
+  throw "test"; // ok
+  throw S(); // ok
+  throw T(); // ok
+  throw U(); // ok
+  throw V(); // ok
+  throw W(); // match, noexcept(false)
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible [cert-err60-cpp]
+  throw X(); // match, no noexcept clause, nontrivial
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw Y(); // ok
+  throw Z(); // match, throw(int)
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw A(); // match, noexcept(false)
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw B(); // ok
+  throw C(); // match, C has a member variable that makes it throwing on copy
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw D(); // match, has throwing copy constructor
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw E(); // match, has throwing copy constructor
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw Allocates(); // match, copy constructor throws
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw OptionallyAllocates(); // ok
+
+}
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -3,6 +3,7 @@
 
 .. toctree::
cert-setlongjmp
+   cert-thrown-exception-type
cert-variadic-function-def
cppcoreguidelines-pro-bounds-array-to-pointer-decay
cppcoreguidelines-pro-bounds-pointer-arithmetic
Index: docs/clang-tidy/checks/cert-thrown-exception-type.rst
===
--- docs/clang-tidy/checks/cert-thrown-exception-type.rst
+++ docs/clang-tidy/checks/cert-thrown-exception-type.rst
@@ -0,0 +1,9 @@
+cert-err60-cpp
+==
+
+This check flags all throw expressions where the exception object is not nothrow
+copy constructible.
+
+This check corresponds to the CERT C++ Coding Standard rule
+`ERR60-CPP. Exception objects must be nothrow copy constructible
+`_.
Index: clang-tidy/cert/ThrownExceptionTypeCheck.h
===
--- clang-tidy/cert/ThrownExceptionTypeCheck.h
+++ clang-tidy/cert/ThrownExceptionTypeCheck.h
@@ -0,0 +1,34 @@
+//===--- ThrownExceptionTypeCheck.h - clang-tidy-*- C++ -*-===//
+//
+// The LLVM Compiler 

Re: [Diffusion] rL244063: Add missing atomic libcall support.

2015-11-12 Thread Dimitry Andric via cfe-commits
dim added a comment.

Note that http://reviews.llvm.org/rL252920 does not apply to 3.7 cleanly, a few 
minor modifications are needed.


Users:
  jyknight (Author, Auditor)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)
  compnerd (Auditor)
  majnemer (Auditor)
  rsmith (Auditor)

http://reviews.llvm.org/rL244063



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


RE: r252834 - Provide a frontend based error for always_inline functions that require

2015-11-12 Thread Robinson, Paul via cfe-commits


> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of
> Eric Christopher via cfe-commits
> Sent: Wednesday, November 11, 2015 4:44 PM
> To: cfe-commits@lists.llvm.org
> Subject: r252834 - Provide a frontend based error for always_inline
> functions that require
> 
> Author: echristo
> Date: Wed Nov 11 18:44:12 2015
> New Revision: 252834
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=252834&view=rev
> Log:
> Provide a frontend based error for always_inline functions that require
> target features that the caller function doesn't provide. This matches
> the existing backend failure to inline functions that don't have
> matching target features - and diagnoses earlier in the case of
> always_inline.
> 
> Fix up a few test cases that were, in fact, invalid if you tried
> to generate code from the backend with the specified target features
> and add a couple of tests to illustrate what's going on.
> 
> This should fix PR25246.
> 
> Added:
> cfe/trunk/test/CodeGen/target-features-error-2.c
> cfe/trunk/test/CodeGen/target-features-error.c
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/lib/CodeGen/CGExpr.cpp
> cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
> cfe/trunk/test/CodeGen/3dnow-builtins.c
> cfe/trunk/test/CodeGen/avx512vl-builtins.c
> 
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=252834&r1
> =252833&r2=252834&view=diff
> ==
> 
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Nov 11
> 18:44:12 2015
> @@ -431,6 +431,9 @@ def err_builtin_definition : Error<"defi
>  def err_arm_invalid_specialreg : Error<"invalid special register for
> builtin">;
>  def err_invalid_cpu_supports : Error<"invalid cpu feature string for
> builtin">;
>  def err_builtin_needs_feature : Error<"%0 needs target feature %1">;
> +def err_function_needs_feature
> +: Error<"function %0 and always_inline callee function %1 are
> required to "
> +"have matching target features">;
>  def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
>InGroup, DefaultError;
>  def warn_dyn_class_memaccess : Warning<
> 
> Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=252834&r1=252833&r2=252834&vi
> ew=diff
> ==
> 
> --- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGExpr.cpp Wed Nov 11 18:44:12 2015
> @@ -3747,6 +3747,15 @@ RValue CodeGenFunction::EmitCall(QualTyp
>assert(CalleeType->isFunctionPointerType() &&
>   "Call must have function pointer type!");
> 
> +  if (const FunctionDecl *FD =
> dyn_cast_or_null(TargetDecl))
> +// If this isn't an always_inline function we can't guarantee that
> any
> +// function isn't being used correctly 

Uh... I wouldn't mind this not using no fewer negatives...
an "only if" kind of phrasing might help.
Thanks,
--paulr

> so only check if we have the
> +// attribute and a set of target attributes that might be different
> from
> +// our default.
> +if (TargetDecl->hasAttr() &&
> +TargetDecl->hasAttr())
> +  checkTargetFeatures(E, FD);
> +
>CalleeType = getContext().getCanonicalType(CalleeType);
> 
>const auto *FnType =
> 
> Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=252834&r1=252833&r2=
> 252834&view=diff
> ==
> 
> --- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Wed Nov 11 18:44:12 2015
> @@ -1843,7 +1843,8 @@ template void CGBuilderInserter  llvm::BasicBlock::iterator InsertPt) const;
>  #undef PreserveNames
> 
> -// Returns true if we have a valid set of target features.
> +// Emits an error if we don't have a valid set of target features for the
> +// called function.
>  void CodeGenFunction::checkTargetFeatures(const CallExpr *E,
>const FunctionDecl *TargetDecl)
> {
>// Early exit if this is an indirect call.
> @@ -1856,31 +1857,70 @@ void CodeGenFunction::checkTargetFeature
>if (!FD)
>  return;
> 
> +  // Grab the required features for the call. For a builtin this is
> listed in
> +  // the td file with the default cpu, for an always_inline function this
> is any
> +  // listed cpu and any listed features.
>unsigned BuiltinID = TargetDecl->getBuiltinID();
> -  const char *FeatureList =
> -  CGM.getContext().BuiltinInfo.getRequiredFeatures(BuiltinID);
> -
> -  if (!Feat

Re: [PATCH] D14441: [OpenCL] Pipe types support.

2015-11-12 Thread Pekka Jääskeläinen via cfe-commits
pekka.jaaskelainen accepted this revision.
This revision is now accepted and ready to land.


Comment at: include/clang/Serialization/ASTBitCodes.h:911
@@ +910,3 @@
+  TYPE_ADJUSTED  = 42,
+  /// \brief An PipeType record.
+  TYPE_PIPE  = 43

Sorry. I meant 'A PipeType' instead of 'An PipeType' :)


http://reviews.llvm.org/D14441



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


Re: [PATCH] D14619: [PATCH] clang-tidy checker for nothrow copy constructible exception objects

2015-11-12 Thread Ben Craig via cfe-commits
bcraig added a comment.

Looks good to me.


http://reviews.llvm.org/D14619



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


Re: [Diffusion] rL244063: Add missing atomic libcall support.

2015-11-12 Thread James Y Knight via cfe-commits
jyknight added a comment.

The concerns should be fixed by the followup commit 
http://reviews.llvm.org/rL252920. If merging to 3.7 branch, both revisions will 
need to be included.


Users:
  jyknight (Author, Auditor)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)
  compnerd (Auditor)
  majnemer (Auditor)
  rsmith (Auditor)

http://reviews.llvm.org/rL244063



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


Re: [PATCH] D14385: Correct atomic libcall support for __atomic_*_fetch builtins.

2015-11-12 Thread James Y Knight via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL252920: Correct atomic libcall support for __atomic_*_fetch 
builtins. (authored by jyknight).

Changed prior to commit:
  http://reviews.llvm.org/D14385?vs=39644&id=40068#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14385

Files:
  cfe/trunk/lib/CodeGen/CGAtomic.cpp
  cfe/trunk/test/CodeGen/atomic-ops-libcall.c

Index: cfe/trunk/test/CodeGen/atomic-ops-libcall.c
===
--- cfe/trunk/test/CodeGen/atomic-ops-libcall.c
+++ cfe/trunk/test/CodeGen/atomic-ops-libcall.c
@@ -74,36 +74,43 @@
 
 int test_atomic_add_fetch(int *p) {
   // CHECK: test_atomic_add_fetch
-  // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_add_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5)
+  // CHECK: [[CALL:%[^ ]*]] = tail call i32 @__atomic_fetch_add_4(i8* {{%[0-9]+}}, i32 55, i32 5)
+  // CHECK: {{%[^ ]*}} = add i32 [[CALL]], 55
   return __atomic_add_fetch(p, 55, memory_order_seq_cst);
 }
 
 int test_atomic_sub_fetch(int *p) {
   // CHECK: test_atomic_sub_fetch
-  // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_sub_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5)
+  // CHECK: [[CALL:%[^ ]*]] = tail call i32 @__atomic_fetch_sub_4(i8* {{%[0-9]+}}, i32 55, i32 5)
+  // CHECK: {{%[^ ]*}} = add i32 [[CALL]], -55
   return __atomic_sub_fetch(p, 55, memory_order_seq_cst);
 }
 
 int test_atomic_and_fetch(int *p) {
   // CHECK: test_atomic_and_fetch
-  // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_and_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5)
+  // CHECK: [[CALL:%[^ ]*]] = tail call i32 @__atomic_fetch_and_4(i8* {{%[0-9]+}}, i32 55, i32 5)
+  // CHECK: {{%[^ ]*}} = and i32 [[CALL]], 55
   return __atomic_and_fetch(p, 55, memory_order_seq_cst);
 }
 
 int test_atomic_or_fetch(int *p) {
   // CHECK: test_atomic_or_fetch
-  // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_or_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5)
+  // CHECK: [[CALL:%[^ ]*]] = tail call i32 @__atomic_fetch_or_4(i8* {{%[0-9]+}}, i32 55, i32 5)
+  // CHECK: {{%[^ ]*}} = or i32 [[CALL]], 55
   return __atomic_or_fetch(p, 55, memory_order_seq_cst);
 }
 
 int test_atomic_xor_fetch(int *p) {
   // CHECK: test_atomic_xor_fetch
-  // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_xor_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5)
+  // CHECK: [[CALL:%[^ ]*]] = tail call i32 @__atomic_fetch_xor_4(i8* {{%[0-9]+}}, i32 55, i32 5)
+  // CHECK: {{%[^ ]*}} = xor i32 [[CALL]], 55
   return __atomic_xor_fetch(p, 55, memory_order_seq_cst);
 }
 
 int test_atomic_nand_fetch(int *p) {
   // CHECK: test_atomic_nand_fetch
-  // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_nand_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5)
+  // CHECK: [[CALL:%[^ ]*]] = tail call i32 @__atomic_fetch_nand_4(i8* {{%[0-9]+}}, i32 55, i32 5)
+  // CHECK: [[OR:%[^ ]*]] = or i32 [[CALL]], -56
+  // CHECK: {{%[^ ]*}} = xor i32 [[OR]], 55
   return __atomic_nand_fetch(p, 55, memory_order_seq_cst);
 }
Index: cfe/trunk/lib/CodeGen/CGAtomic.cpp
===
--- cfe/trunk/lib/CodeGen/CGAtomic.cpp
+++ cfe/trunk/lib/CodeGen/CGAtomic.cpp
@@ -613,8 +613,8 @@
 break;
 
   case AtomicExpr::AO__atomic_nand_fetch:
-PostOp = llvm::Instruction::And;
-// Fall through.
+PostOp = llvm::Instruction::And; // the NOT is special cased below
+  // Fall through.
   case AtomicExpr::AO__atomic_fetch_nand:
 Op = llvm::AtomicRMWInst::Nand;
 break;
@@ -853,6 +853,7 @@
   MemTy->isPointerType() ? getContext().getIntPtrType() : MemTy;
 QualType RetTy;
 bool HaveRetTy = false;
+llvm::Instruction::BinaryOps PostOp = (llvm::Instruction::BinaryOps)0;
 switch (E->getOp()) {
 case AtomicExpr::AO__c11_atomic_init:
   llvm_unreachable("Already handled!");
@@ -906,84 +907,71 @@
 case AtomicExpr::AO__atomic_load_n:
   LibCallName = "__atomic_load";
   break;
+// T __atomic_add_fetch_N(T *mem, T val, int order)
 // T __atomic_fetch_add_N(T *mem, T val, int order)
+case AtomicExpr::AO__atomic_add_fetch:
+  PostOp = llvm::Instruction::Add;
+// Fall through.
 case AtomicExpr::AO__c11_atomic_fetch_add:
 case AtomicExpr::AO__atomic_fetch_add:
   LibCallName = "__atomic_fetch_add";
   AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(),
 LoweredMemTy, E->getExprLoc(), sizeChars);
   break;
+// T __atomic_and_fetch_N(T *mem, T val, int order)
 // T __atomic_fetch_and_N(T *mem, T val, int order)
+case AtomicExpr::AO__atomic_and_fetch:
+  PostOp = llvm::Instruction::And;
+// Fall through.
 case AtomicExpr::AO__c11_atomic_fetch_and:
 case AtomicExpr::AO__atomic_fetch_and:
   LibCallName = "__atomic_fetch_and";
   AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(),
 MemTy, E->getExprLoc(), sizeChars);
   break;
+// T __atomic_or_fetch_N(T *mem, T val, int order)
 // T 

r252920 - Correct atomic libcall support for __atomic_*_fetch builtins.

2015-11-12 Thread James Y Knight via cfe-commits
Author: jyknight
Date: Thu Nov 12 12:37:29 2015
New Revision: 252920

URL: http://llvm.org/viewvc/llvm-project?rev=252920&view=rev
Log:
Correct atomic libcall support for __atomic_*_fetch builtins.

In r244063, I had caused these builtins to call the same-named library
functions, __atomic_*_fetch_SIZE. However, this was incorrect: while
those functions are in fact supported by GCC's libatomic, they're not
documented by the spec (and gcc doesn't ever call them).

Instead, you're /supposed/ to call the __atomic_fetch_* builtins and
then redo the operation inline to return the final value.

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

Modified:
cfe/trunk/lib/CodeGen/CGAtomic.cpp
cfe/trunk/test/CodeGen/atomic-ops-libcall.c

Modified: cfe/trunk/lib/CodeGen/CGAtomic.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGAtomic.cpp?rev=252920&r1=252919&r2=252920&view=diff
==
--- cfe/trunk/lib/CodeGen/CGAtomic.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGAtomic.cpp Thu Nov 12 12:37:29 2015
@@ -613,8 +613,8 @@ static void EmitAtomicOp(CodeGenFunction
 break;
 
   case AtomicExpr::AO__atomic_nand_fetch:
-PostOp = llvm::Instruction::And;
-// Fall through.
+PostOp = llvm::Instruction::And; // the NOT is special cased below
+  // Fall through.
   case AtomicExpr::AO__atomic_fetch_nand:
 Op = llvm::AtomicRMWInst::Nand;
 break;
@@ -853,6 +853,7 @@ RValue CodeGenFunction::EmitAtomicExpr(A
   MemTy->isPointerType() ? getContext().getIntPtrType() : MemTy;
 QualType RetTy;
 bool HaveRetTy = false;
+llvm::Instruction::BinaryOps PostOp = (llvm::Instruction::BinaryOps)0;
 switch (E->getOp()) {
 case AtomicExpr::AO__c11_atomic_init:
   llvm_unreachable("Already handled!");
@@ -906,84 +907,71 @@ RValue CodeGenFunction::EmitAtomicExpr(A
 case AtomicExpr::AO__atomic_load_n:
   LibCallName = "__atomic_load";
   break;
+// T __atomic_add_fetch_N(T *mem, T val, int order)
 // T __atomic_fetch_add_N(T *mem, T val, int order)
+case AtomicExpr::AO__atomic_add_fetch:
+  PostOp = llvm::Instruction::Add;
+// Fall through.
 case AtomicExpr::AO__c11_atomic_fetch_add:
 case AtomicExpr::AO__atomic_fetch_add:
   LibCallName = "__atomic_fetch_add";
   AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(),
 LoweredMemTy, E->getExprLoc(), sizeChars);
   break;
+// T __atomic_and_fetch_N(T *mem, T val, int order)
 // T __atomic_fetch_and_N(T *mem, T val, int order)
+case AtomicExpr::AO__atomic_and_fetch:
+  PostOp = llvm::Instruction::And;
+// Fall through.
 case AtomicExpr::AO__c11_atomic_fetch_and:
 case AtomicExpr::AO__atomic_fetch_and:
   LibCallName = "__atomic_fetch_and";
   AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(),
 MemTy, E->getExprLoc(), sizeChars);
   break;
+// T __atomic_or_fetch_N(T *mem, T val, int order)
 // T __atomic_fetch_or_N(T *mem, T val, int order)
+case AtomicExpr::AO__atomic_or_fetch:
+  PostOp = llvm::Instruction::Or;
+// Fall through.
 case AtomicExpr::AO__c11_atomic_fetch_or:
 case AtomicExpr::AO__atomic_fetch_or:
   LibCallName = "__atomic_fetch_or";
   AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(),
 MemTy, E->getExprLoc(), sizeChars);
   break;
+// T __atomic_sub_fetch_N(T *mem, T val, int order)
 // T __atomic_fetch_sub_N(T *mem, T val, int order)
+case AtomicExpr::AO__atomic_sub_fetch:
+  PostOp = llvm::Instruction::Sub;
+// Fall through.
 case AtomicExpr::AO__c11_atomic_fetch_sub:
 case AtomicExpr::AO__atomic_fetch_sub:
   LibCallName = "__atomic_fetch_sub";
   AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(),
 LoweredMemTy, E->getExprLoc(), sizeChars);
   break;
+// T __atomic_xor_fetch_N(T *mem, T val, int order)
 // T __atomic_fetch_xor_N(T *mem, T val, int order)
+case AtomicExpr::AO__atomic_xor_fetch:
+  PostOp = llvm::Instruction::Xor;
+// Fall through.
 case AtomicExpr::AO__c11_atomic_fetch_xor:
 case AtomicExpr::AO__atomic_fetch_xor:
   LibCallName = "__atomic_fetch_xor";
   AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(),
 MemTy, E->getExprLoc(), sizeChars);
   break;
+// T __atomic_nand_fetch_N(T *mem, T val, int order)
 // T __atomic_fetch_nand_N(T *mem, T val, int order)
+case AtomicExpr::AO__atomic_nand_fetch:
+  PostOp = llvm::Instruction::And; // the NOT is special cased below
+// Fall through.
 case AtomicExpr::AO__atomic_fetch_nand:
   LibCallName = "__atomic_fetch_nand";
   AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(),
 MemTy, E-

Re: [PATCH] D14619: [PATCH] clang-tidy checker for nothrow copy constructible exception objects

2015-11-12 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: clang-tidy/cert/ThrownExceptionTypeCheck.cpp:36
@@ +35,3 @@
+  bool Diag = false;
+  for (const auto *Ctor : RD->ctors()) {
+if (Ctor->isCopyConstructor()) {

I'd slightly prefer this check to be expressed as a matcher:

  cxxThrowExpr(has(cxxConstructExpr(hasDeclaration(

Which is also a more correct thing to do and doesn't seem to be "a lot harder" 
;)


http://reviews.llvm.org/D14619



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


Re: [PATCH] D14277: [Analyzer] Make referenced SymbolMetadata live even if its region is dead

2015-11-12 Thread Jordan Rose via cfe-commits
jordan_rose added a comment.

So we just throw out the whole notion of "metadata in use"? That can work. 
There are two things I'd be concerned about changing here:

- What happens when you take a string's length, test it against something, 
throw it away, then remeasure the string? In this case we'd be okay because 
CStringChecker still hangs on to the symbol in its map until the region is 
invalidated.
- Will we keep more symbols alive than we did previously, increasing the 
analyzer's memory use? I think the answer is "yes", but not by very much: the 
live/dead checking is two-pass, so we'll mark a metadata symbol live in 
`checkLiveSymbols` but then find out we could have dropped it in 
`checkDeadSymbols` when the region is found to be dead. It'll get cleaned up 
the next time around, but I think that sort of conditional liveness is what the 
old mechanism was trying to accomplish.

Do you have any ideas for how we could make that better? I can think of a 
complicated case where you use `markInUse` if the metadata symbol exactly 
matches the key, but `markLive` otherwise…but at some point I'm not sure it's 
worth the complexity cost. (In particular, after this change, I'm not sure 
metadata symbols behave any differently from regular conjured symbols. This is 
a good thing.)

(We've also talked about having better REGISTER_MAP_WITH_PROGRAMSTATE that 
auto-remove any keys for dead symbols or dead regions. I'm sure Anna and Devin 
would be happy to see someone pick that up.)



Comment at: lib/StaticAnalyzer/Checkers/CStringChecker.cpp:2137-2141
@@ -2139,10 +2136,7 @@
 
-  CStringLengthTy::Factory &F = state->get_context();
-  for (CStringLengthTy::iterator I = Entries.begin(), E = Entries.end();
-   I != E; ++I) {
-SVal Len = I.getData();
-if (SymbolRef Sym = Len.getAsSymbol()) {
-  if (SR.isDead(Sym))
-Entries = F.remove(Entries, I.getKey());
-}
+  auto &F = state->get_context();
+  for (auto I = Entries.begin(), E = Entries.end(); I != E; ++I) {
+const MemRegion *MR = I.getKey();
+if (!SR.isLiveRegion(MR))
+  Entries = F.remove(Entries, MR);
   }

Huh, this is probably an improvement anyway!


Repository:
  rL LLVM

http://reviews.llvm.org/D14277



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


Re: [PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-11-12 Thread Jordan Rose via cfe-commits
jordan_rose accepted this revision.
jordan_rose added a comment.
This revision is now accepted and ready to land.

Let's just go with your simple version that makes the common case better. There 
are a lot of problems with `throw`, so I wouldn't worry about that right now.

(By the way, we don't remove unreachable blocks because we want to be able to 
diagnose unreachable code.)


http://reviews.llvm.org/D13973



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


Re: [PATCH] D14619: [PATCH] clang-tidy checker for nothrow copy constructible exception objects

2015-11-12 Thread Aaron Ballman via cfe-commits
aaron.ballman marked an inline comment as done.


Comment at: test/clang-tidy/cert-throw-exception-type.cpp:2
@@ +1,3 @@
+// RUN: %check_clang_tidy %s cert-err60-cpp %t -- -- -std=c++11 
-fcxx-exceptions
+
+struct S {};

> Doesn't this need an "| FileCheck %s"

No, check_clang_tidy handles that for you.


http://reviews.llvm.org/D14619



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


Re: [PATCH] D14619: [PATCH] clang-tidy checker for nothrow copy constructible exception objects

2015-11-12 Thread Aaron Ballman via cfe-commits
aaron.ballman updated this revision to Diff 40064.
aaron.ballman added a comment.

Added new test cases


http://reviews.llvm.org/D14619

Files:
  clang-tidy/cert/CERTTidyModule.cpp
  clang-tidy/cert/CMakeLists.txt
  clang-tidy/cert/ThrownExceptionTypeCheck.cpp
  clang-tidy/cert/ThrownExceptionTypeCheck.h
  docs/clang-tidy/checks/cert-thrown-exception-type.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/cert-throw-exception-type.cpp

Index: test/clang-tidy/cert-throw-exception-type.cpp
===
--- test/clang-tidy/cert-throw-exception-type.cpp
+++ test/clang-tidy/cert-throw-exception-type.cpp
@@ -0,0 +1,112 @@
+// RUN: %check_clang_tidy %s cert-err60-cpp %t -- -- -std=c++11 -fcxx-exceptions
+
+struct S {};
+struct T : S {};
+struct U {
+  U() = default;
+  U(const U&) = default;
+};
+
+struct V {
+  V() = default;
+  V(const V&) noexcept;
+};
+
+struct W {
+  W() = default;
+  W(const W&) noexcept(false);
+};
+
+struct X {
+  X() = default;
+  X(const X&) {}
+};
+
+struct Y {
+  Y() = default;
+  Y(const Y&) throw();
+};
+
+struct Z {
+  Z() = default;
+  Z(const Z&) throw(int);
+};
+
+void g() noexcept(false);
+
+struct A {
+  A() = default;
+  A(const A&) noexcept(noexcept(g()));
+};
+
+struct B {
+  B() = default;
+  B(const B&) = default;
+  B(const A&) noexcept(false);
+};
+
+class C {
+  W M; // W is not no-throw copy constructible
+public:
+  C() = default;
+  C(const C&) = default;
+};
+
+struct D {
+  D() = default;
+  D(const D&) noexcept(false);
+  D(D&) noexcept(true);
+};
+
+struct E {
+  E() = default;
+  E(E&) noexcept(true);
+  E(const E&) noexcept(false);
+};
+
+struct Allocates {
+  int *x;
+  Allocates() : x(new int(0)) {}
+  Allocates(const Allocates &other) : x(new int(*other.x)) {}
+};
+
+struct OptionallyAllocates {
+  int *x;
+  OptionallyAllocates() : x(new int(0)) {}
+  OptionallyAllocates(const Allocates &other) noexcept(true) {
+try {
+  x = new int(*other.x);
+} catch (...) {
+  x = nullptr;
+}
+  }
+};
+
+void f() {
+  throw 12; // ok
+  throw "test"; // ok
+  throw S(); // ok
+  throw T(); // ok
+  throw U(); // ok
+  throw V(); // ok
+  throw W(); // match, noexcept(false)
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible [cert-err60-cpp]
+  throw X(); // match, no noexcept clause, nontrivial
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw Y(); // ok
+  throw Z(); // match, throw(int)
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw A(); // match, noexcept(false)
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw B(); // ok
+  throw C(); // match, C has a member variable that makes it throwing on copy
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw D(); // match, has throwing copy constructor
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw E(); // match, has throwing copy constructor
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw Allocates(); // match, copy constructor throws
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw OptionallyAllocates(); // ok
+
+}
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -3,6 +3,7 @@
 
 .. toctree::
cert-setlongjmp
+   cert-thrown-exception-type
cert-variadic-function-def
cppcoreguidelines-pro-bounds-array-to-pointer-decay
cppcoreguidelines-pro-bounds-pointer-arithmetic
Index: docs/clang-tidy/checks/cert-thrown-exception-type.rst
===
--- docs/clang-tidy/checks/cert-thrown-exception-type.rst
+++ docs/clang-tidy/checks/cert-thrown-exception-type.rst
@@ -0,0 +1,9 @@
+cert-err60-cpp
+==
+
+This check flags all throw expressions where the exception object is not nothrow
+copy constructible.
+
+This check corresponds to the CERT C++ Coding Standard rule
+`ERR60-CPP. Exception objects must be nothrow copy constructible
+`_.
Index: clang-tidy/cert/ThrownExceptionTypeCheck.h
===
--- clang-tidy/cert/ThrownExceptionTypeCheck.h
+++ clang-tidy/cert/ThrownExceptionTypeCheck.h
@@ -0,0 +1,34 @@
+//===--- ThrownExceptionTypeCheck.h - clang-tidy-*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under t

Re: [PATCH] D14619: [PATCH] clang-tidy checker for nothrow copy constructible exception objects

2015-11-12 Thread Ben Craig via cfe-commits
bcraig added a subscriber: bcraig.
bcraig added a comment.

I would love to see a test case with dynamic allocation.  Something along the 
following...

struct Allocates {

  int *x;
  Allocates() : x(new int(0)) {}
  Allocates(const Allocates &other) : x(new int(*other.x)) {}

};

... and then the flip side of that ...

struct OptionallyAllocates {

  int *x;
  OptionallyAllocates () : x(new int(0)) {}
  OptionallyAllocates (const Allocates &other) {
// try / catch(...) would be fine here if std::nothrow is unappealing
x = new(std::nothrow) int(*other.x));
  }

};



Comment at: test/clang-tidy/cert-throw-exception-type.cpp:1
@@ +1,2 @@
+// RUN: %check_clang_tidy %s cert-err60-cpp %t -- -- -std=c++11 
-fcxx-exceptions
+

Doesn't this need an "| FileCheck %s"


http://reviews.llvm.org/D14619



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


r252912 - Add support for driver option -mno-ms-bitfields.

2015-11-12 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Thu Nov 12 11:21:22 2015
New Revision: 252912

URL: http://llvm.org/viewvc/llvm-project?rev=252912&view=rev
Log:
Add support for driver option -mno-ms-bitfields.

This option is used to cancel -mms-bitfields on the command line.

rdar://problem/15898553

Added:
cfe/trunk/test/Driver/ms-bitfields.c
Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=252912&r1=252911&r2=252912&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Thu Nov 12 11:21:22 2015
@@ -1273,6 +1273,8 @@ def mmacosx_version_min_EQ : Joined<["-"
   Group, HelpText<"Set Mac OS X deployment target">;
 def mms_bitfields : Flag<["-"], "mms-bitfields">, Group, 
Flags<[CC1Option]>,
   HelpText<"Set the default structure layout to be compatible with the 
Microsoft compiler standard">;
+def mno_ms_bitfields : Flag<["-"], "mno-ms-bitfields">, Group,
+  HelpText<"Do not set the default structure layout to be compatible with the 
Microsoft compiler standard">;
 def mstackrealign : Flag<["-"], "mstackrealign">, Group, 
Flags<[CC1Option]>,
   HelpText<"Force realign the stack at entry to every function">;
 def mstack_alignment : Joined<["-"], "mstack-alignment=">, Group, 
Flags<[CC1Option]>,

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=252912&r1=252911&r2=252912&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Nov 12 11:21:22 2015
@@ -3713,7 +3713,8 @@ void Clang::ConstructJob(Compilation &C,
   if (KernelOrKext && getToolChain().getTriple().isOSDarwin())
 CmdArgs.push_back("-fforbid-guard-variables");
 
-  if (Args.hasArg(options::OPT_mms_bitfields)) {
+  if (Args.hasFlag(options::OPT_mms_bitfields, options::OPT_mno_ms_bitfields,
+   false)) {
 CmdArgs.push_back("-mms-bitfields");
   }
 

Added: cfe/trunk/test/Driver/ms-bitfields.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ms-bitfields.c?rev=252912&view=auto
==
--- cfe/trunk/test/Driver/ms-bitfields.c (added)
+++ cfe/trunk/test/Driver/ms-bitfields.c Thu Nov 12 11:21:22 2015
@@ -0,0 +1,6 @@
+// RUN: %clang -### %s 2>&1 | FileCheck %s -check-prefix=NO-MSBITFIELDS
+// RUN: %clang -### -mno-ms-bitfields -mms-bitfields %s 2>&1 | FileCheck %s 
-check-prefix=MSBITFIELDS
+// RUN: %clang -### -mms-bitfields -mno-ms-bitfields %s 2>&1 | FileCheck %s 
-check-prefix=NO-MSBITFIELDS
+
+// MSBITFIELDS: -mms-bitfields
+// NO-MSBITFIELDS-NOT: -mms-bitfields


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


Re: [PATCH] D14441: [OpenCL] Pipe types support.

2015-11-12 Thread Alexey Bader via cfe-commits
bader updated this revision to Diff 40058.
bader marked 13 inline comments as done.
bader added a comment.

Applied code review comments.


http://reviews.llvm.org/D14441

Files:
  include/clang/AST/ASTContext.h
  include/clang/AST/DataRecursiveASTVisitor.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/AST/Type.h
  include/clang/AST/TypeLoc.h
  include/clang/AST/TypeNodes.def
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/Specifiers.h
  include/clang/Basic/TokenKinds.def
  include/clang/Sema/DeclSpec.h
  include/clang/Sema/Sema.h
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/ASTContext.cpp
  lib/AST/ASTImporter.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/MicrosoftMangle.cpp
  lib/AST/Type.cpp
  lib/AST/TypePrinter.cpp
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenTypes.cpp
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/Parse/ParseDecl.cpp
  lib/Sema/DeclSpec.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaLookup.cpp
  lib/Sema/SemaTemplate.cpp
  lib/Sema/SemaTemplateDeduction.cpp
  lib/Sema/SemaTemplateVariadic.cpp
  lib/Sema/SemaType.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTWriter.cpp
  test/CodeGenOpenCL/pipe_types.cl
  test/PCH/ocl_types.cl
  test/PCH/ocl_types.h
  test/SemaOpenCL/pipes-1.2-negative.cl
  tools/libclang/CIndex.cpp

Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -1685,6 +1685,10 @@
   return Visit(TL.getValueLoc());
 }
 
+bool CursorVisitor::VisitPipeTypeLoc(PipeTypeLoc TL) {
+  return Visit(TL.getValueLoc());
+}
+
 #define DEFAULT_TYPELOC_IMPL(CLASS, PARENT) \
 bool CursorVisitor::Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { \
   return Visit##PARENT##Loc(TL); \
Index: test/SemaOpenCL/pipes-1.2-negative.cl
===
--- /dev/null
+++ test/SemaOpenCL/pipes-1.2-negative.cl
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2
+
+void foo(read_only pipe int p); // expected-error {{expected parameter declarator}} expected-error {{expected ')'}} expected-note {{to match this '('}}
Index: test/PCH/ocl_types.h
===
--- test/PCH/ocl_types.h
+++ test/PCH/ocl_types.h
@@ -44,6 +44,7 @@
 // image2d_array_depth_t
 typedef image2d_array_depth_t img2darr_dep_t;
 
+#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable
 // image2d_msaa_t
 typedef image2d_msaa_t img2dmsaa_t;
 
@@ -56,4 +57,14 @@
 // image2d_array_msaa_depth_t
 typedef image2d_array_msaa_depth_t img2darrmsaadep_t;
 
+// pipe specifier
+
+typedef struct _person {
+  int id;
+  const char *name;
+} Person;
+
+void int_pipe_function(pipe int);
+
+void person_pipe_function(pipe Person);
 #endif
Index: test/PCH/ocl_types.cl
===
--- test/PCH/ocl_types.cl
+++ test/PCH/ocl_types.cl
@@ -1,9 +1,9 @@
 // Test this without pch.
-// RUN: %clang_cc1 -include %S/ocl_types.h -fsyntax-only %s
+// RUN: %clang_cc1 -include %S/ocl_types.h -fsyntax-only %s -cl-std=CL2.0 -D__OPENCL_VERSION__=200
 
 // Test with pch.
-// RUN: %clang_cc1 -x cl -emit-pch -o %t %S/ocl_types.h
-// RUN: %clang_cc1 -include-pch %t -fsyntax-only %s -ast-print
+// RUN: %clang_cc1 -x cl -emit-pch -o %t %S/ocl_types.h -cl-std=CL2.0 -D__OPENCL_VERSION__=200
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only %s -ast-print -cl-std=CL2.0 -D__OPENCL_VERSION__=200
 
 void foo1(img1d_t img);
 
@@ -24,3 +24,15 @@
 void foo8(evt_t evt) {
   evt_t loc_evt;
 }
+
+#if __OPENCL_VERSION__ >= 200
+
+void foo9(pipe int P) {
+  int_pipe_function(P);
+}
+
+void foo10(pipe Person P) {
+  person_pipe_function(P);
+}
+
+#endif
Index: test/CodeGenOpenCL/pipe_types.cl
===
--- /dev/null
+++ test/CodeGenOpenCL/pipe_types.cl
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
+
+// CHECK: %opencl.pipe_t = type opaque
+typedef unsigned char __attribute__((ext_vector_type(3))) uchar3;
+typedef int __attribute__((ext_vector_type(4))) int4;
+
+void test1(read_only pipe int p) {
+// CHECK: define void @test1(%opencl.pipe_t* %p)
+  reserve_id_t rid;
+// CHECK: %rid = alloca %opencl.reserve_id_t
+}
+
+void test2(write_only pipe float p) {
+// CHECK: define void @test2(%opencl.pipe_t* %p)
+  reserve_id_t rid;
+}
+
+void test3(read_only pipe const int p) {
+// CHECK: define void @test3(%opencl.pipe_t* %p)
+  reserve_id_t rid;
+// CHECK: %rid = alloca %opencl.reserve_id_t
+}
+
+void test4(read_only pipe uchar3 p) {
+// CHECK: define void @test4(%opencl.pipe_t* %p)
+  reserve_id_t rid;
+// CHECK: %rid = alloca %opencl.reserve_id_t
+}
+
+void test5(read_only pipe int4 p) {
+// CHECK: define void @test5(%opencl.pipe_t* %p)
+  reserve_id_t 

[PATCH] D14619: [PATCH] clang-tidy checker for nothrow copy constructible exception objects

2015-11-12 Thread Aaron Ballman via cfe-commits
aaron.ballman created this revision.
aaron.ballman added reviewers: alexfh, sbenza.
aaron.ballman added a subscriber: cfe-commits.

This patch adds a new clang-tidy checker that flags throw expressions whose 
thrown type is not nothrow copy constructible. While the compiler is free to 
elide copy constructor calls in some cases, it is under no obligation to do so, 
which makes the code a portability concern as well as a security concern.

This checker corresponds to the CERT secure coding rule: 
https://www.securecoding.cert.org/confluence/display/cplusplus/ERR60-CPP.+Exception+objects+must+be+nothrow+copy+constructible

http://reviews.llvm.org/D14619

Files:
  clang-tidy/cert/CERTTidyModule.cpp
  clang-tidy/cert/CMakeLists.txt
  clang-tidy/cert/ThrownExceptionTypeCheck.cpp
  clang-tidy/cert/ThrownExceptionTypeCheck.h
  docs/clang-tidy/checks/cert-thrown-exception-type.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/cert-throw-exception-type.cpp

Index: test/clang-tidy/cert-throw-exception-type.cpp
===
--- test/clang-tidy/cert-throw-exception-type.cpp
+++ test/clang-tidy/cert-throw-exception-type.cpp
@@ -0,0 +1,90 @@
+// RUN: %check_clang_tidy %s cert-err60-cpp %t -- -- -std=c++11 -fcxx-exceptions
+
+struct S {};
+struct T : S {};
+struct U {
+  U() = default;
+  U(const U&) = default;
+};
+
+struct V {
+  V() = default;
+  V(const V&) noexcept;
+};
+
+struct W {
+  W() = default;
+  W(const W&) noexcept(false);
+};
+
+struct X {
+  X() = default;
+  X(const X&) {}
+};
+
+struct Y {
+  Y() = default;
+  Y(const Y&) throw();
+};
+
+struct Z {
+  Z() = default;
+  Z(const Z&) throw(int);
+};
+
+void g() noexcept(false);
+
+struct A {
+  A() = default;
+  A(const A&) noexcept(noexcept(g()));
+};
+
+struct B {
+  B() = default;
+  B(const B&) = default;
+  B(const A&) noexcept(false);
+};
+
+class C {
+  W M; // W is not no-throw copy constructible
+public:
+  C() = default;
+  C(const C&) = default;
+};
+
+struct D {
+  D() = default;
+  D(const D&) noexcept(false);
+  D(D&) noexcept(true);
+};
+
+struct E {
+  E() = default;
+  E(E&) noexcept(true);
+  E(const E&) noexcept(false);
+};
+
+void f() {
+  throw 12; // ok
+  throw "test"; // ok
+  throw S(); // ok
+  throw T(); // ok
+  throw U(); // ok
+  throw V(); // ok
+  throw W(); // match, noexcept(false)
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible [cert-err60-cpp]
+  throw X(); // match, no noexcept clause, nontrivial
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw Y(); // ok
+  throw Z(); // match, throw(int)
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw A(); // match, noexcept(false)
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw B(); // ok
+  throw C(); // match, C has a member variable that makes it throwing on copy
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw D();
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw E();
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+}
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -3,6 +3,7 @@
 
 .. toctree::
cert-setlongjmp
+   cert-thrown-exception-type
cert-variadic-function-def
cppcoreguidelines-pro-bounds-array-to-pointer-decay
cppcoreguidelines-pro-bounds-pointer-arithmetic
Index: docs/clang-tidy/checks/cert-thrown-exception-type.rst
===
--- docs/clang-tidy/checks/cert-thrown-exception-type.rst
+++ docs/clang-tidy/checks/cert-thrown-exception-type.rst
@@ -0,0 +1,9 @@
+cert-err60-cpp
+==
+
+This check flags all throw expressions where the exception object is not nothrow
+copy constructible.
+
+This check corresponds to the CERT C++ Coding Standard rule
+`ERR60-CPP. Exception objects must be nothrow copy constructible
+`_.
Index: clang-tidy/cert/ThrownExceptionTypeCheck.h
===
--- clang-tidy/cert/ThrownExceptionTypeCheck.h
+++ clang-tidy/cert/ThrownExceptionTypeCheck.h
@@ -0,0 +1,34 @@
+//===--- ThrownExceptionTypeCheck.h - clang-tidy-*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--

Re: [PATCH] D12547: Add support for function attribute "disable_tail_calls"

2015-11-12 Thread Akira Hatanaka via cfe-commits
ahatanak updated this revision to Diff 40060.
ahatanak marked 2 inline comments as done.
ahatanak added a comment.

Added "expected-no-diagnostics" to test case.


http://reviews.llvm.org/D12547

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  lib/CodeGen/CGCall.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGen/attr-disable-tail-calls.c
  test/CodeGenCXX/attr-disable-tail-calls.cpp
  test/Sema/attr-disable-tail-calls.c
  test/SemaCXX/attr-disable-tail-calls.cpp

Index: test/SemaCXX/attr-disable-tail-calls.cpp
===
--- /dev/null
+++ test/SemaCXX/attr-disable-tail-calls.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+class B {
+public:
+  [[clang::disable_tail_calls]] virtual int foo1() { return 1; }
+  [[clang::disable_tail_calls]] int foo2() { return 2; }
+};
Index: test/Sema/attr-disable-tail-calls.c
===
--- /dev/null
+++ test/Sema/attr-disable-tail-calls.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void __attribute__((disable_tail_calls,naked)) foo1(int a) { // expected-error {{'disable_tail_calls' and 'naked' attributes are not compatible}}
+  __asm__("");
+}
+
+void __attribute__((naked,disable_tail_calls)) foo2(int a) { // expected-error {{'naked' and 'disable_tail_calls' attributes are not compatible}}
+  __asm__("");
+}
+
+int g0 __attribute__((disable_tail_calls)); // expected-warning {{'disable_tail_calls' attribute only applies to functions}}
+
+int foo3(int a) __attribute__((disable_tail_calls("abc"))); // expected-error {{'disable_tail_calls' attribute takes no arguments}}
Index: test/CodeGenCXX/attr-disable-tail-calls.cpp
===
--- /dev/null
+++ test/CodeGenCXX/attr-disable-tail-calls.cpp
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -triple=x86_64-apple-darwin -std=c++11 -emit-llvm -o - %s | FileCheck %s
+
+class B {
+public:
+  [[clang::disable_tail_calls]] virtual int m1() { return 1; }
+  virtual int m2() { return 2; }
+  int m3() { return 3; }
+  [[clang::disable_tail_calls]] int m4();
+};
+
+class D : public B {
+public:
+  int m1() override { return 11; }
+  [[clang::disable_tail_calls]] int m2() override { return 22; }
+};
+
+int foo1() {
+  B *b = new B;
+  D *d = new D;
+  int t = 0;
+  t += b->m1() + b->m2() + b->m3() + b->m4();
+  t += d->m1() + d->m2();
+  return t;
+}
+
+// CHECK: define linkonce_odr i32 @_ZN1B2m3Ev(%class.B* %this) [[ATTRFALSE:#[0-9]+]]
+// CHECK: declare i32 @_ZN1B2m4Ev(%class.B*) [[ATTRTRUE0:#[0-9]+]]
+// CHECK: define linkonce_odr i32 @_ZN1B2m1Ev(%class.B* %this) unnamed_addr [[ATTRTRUE1:#[0-9]+]]
+// CHECK: define linkonce_odr i32 @_ZN1B2m2Ev(%class.B* %this) unnamed_addr [[ATTRFALSE:#[0-9]+]]
+// CHECK: define linkonce_odr i32 @_ZN1D2m1Ev(%class.D* %this) unnamed_addr [[ATTRFALSE:#[0-9]+]]
+// CHECK: define linkonce_odr i32 @_ZN1D2m2Ev(%class.D* %this) unnamed_addr [[ATTRTRUE1:#[0-9]+]]
+
+// CHECK: attributes [[ATTRFALSE]] = { {{.*}}"disable-tail-calls"="false"{{.*}} }
+// CHECK: attributes [[ATTRTRUE0]] = { {{.*}}"disable-tail-calls"="true"{{.*}} }
+// CHECK: attributes [[ATTRTRUE1]] = { {{.*}}"disable-tail-calls"="true"{{.*}} }
Index: test/CodeGen/attr-disable-tail-calls.c
===
--- test/CodeGen/attr-disable-tail-calls.c
+++ test/CodeGen/attr-disable-tail-calls.c
@@ -1,11 +1,19 @@
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm -mdisable-tail-calls -o - | FileCheck %s -check-prefix=CHECK -check-prefix=DISABLE
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm -o - | FileCheck %s -check-prefix=CHECK -check-prefix=ENABLE
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm -mdisable-tail-calls -o - | FileCheck %s -check-prefix=DISABLE
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm -o - | FileCheck %s -check-prefix=ENABLE
 
-// CHECK: define i32 @f1() [[ATTR:#[0-9]+]] {
+// DISABLE: define i32 @f1() [[ATTRTRUE:#[0-9]+]] {
+// DISABLE: define i32 @f2() [[ATTRTRUE]] {
+// ENABLE: define i32 @f1() [[ATTRFALSE:#[0-9]+]] {
+// ENABLE: define i32 @f2() [[ATTRTRUE:#[0-9]+]] {
 
 int f1() {
   return 0;
 }
 
-// DISABLE: attributes [[ATTR]] = { {{.*}} "disable-tail-calls"="true" {{.*}} }
-// ENABLE: attributes [[ATTR]] = { {{.*}} "disable-tail-calls"="false" {{.*}} }
+int f2() __attribute__((disable_tail_calls)) {
+  return 0;
+}
+
+// DISABLE: attributes [[ATTRTRUE]] = { {{.*}}"disable-tail-calls"="true"{{.*}} }
+// ENABLE: attributes [[ATTRFALSE]] = { {{.*}}"disable-tail-calls"="false"{{.*}} }
+// ENABLE: attributes [[ATTRTRUE]] = { {{.*}}"disable-tail-calls"="true"{{.*}} }
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -1583,6 +1583,14 @

Re: [PATCH] D14441: [OpenCL] Pipe types support.

2015-11-12 Thread Alexey Bader via cfe-commits
bader added inline comments.


Comment at: include/clang/Sema/DeclSpec.h:1426
@@ +1425,3 @@
+struct PipeTypeInfo : TypeInfoCommon {
+/// The access writes.
+unsigned AccessWrites : 3;

pekka.jaaskelainen wrote:
> I think this needs a better comment than duplicating the variable name. What 
> is the purpose of the variable?
It looks like it was added to handle pipe access qualifiers, but as far as I 
can see it doesn't do anything useful right now. I'll remove it.


Comment at: include/clang/Serialization/ASTBitCodes.h:911
@@ +910,3 @@
+  TYPE_ADJUSTED  = 42,
+  /// \brief An PipeType record.
+  TYPE_PIPE  = 43

pekka.jaaskelainen wrote:
> A
No sure I understand that comment. Pekka, could you clarify, please?


Comment at: lib/AST/ASTContext.cpp:3141
@@ +3140,3 @@
+  }
+  PipeType *New = new (*this, TypeAlignment) PipeType(T, Canonical);
+  Types.push_back(New);

pekka.jaaskelainen wrote:
> Should we assign T to 'Canonical' if it already was Canonical or is this 
> intentional somehow?
My understanding is that it's not required. T is used in most cases and 
'Canonical' is queried only if T is not canonical. I looked at the similar 
methods of ASTContext - ASTContext::get*Type - they all pass default 
constructed 'Canonical' if original type is canonical.


Comment at: test/CodeGenOpenCL/pipe_types.cl:1
@@ +1,2 @@
+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
+

pekka.jaaskelainen wrote:
> Can you add a couple of more checks? For example:
> - the behavior when using CL1.2
> - when the inner type of the pipe has a 'const' or similar qualifier
> - It can only by a function arg. What if it's a local variable?
> 
I've added negative test that pipe types are not complied with CL1.2, but I'd 
like to note that this not the final patch. I'm also going to commit support 
for pipe built-ins and semantic checks as a separate patches.


Comment at: test/CodeGenOpenCL/pipe_types.cl:5
@@ +4,3 @@
+
+void test1(read_only pipe int p) {
+// CHECK: define void @test1(%opencl.pipe_t* %p)

pxli168 wrote:
> Great work!!
> But I have tried your patch and find it does not support opencl gentype like 
> int4 with the usual used typedef in other test cases.
> Maybe there is something wrong?
I've added a test case for vector element pipes. It works for me. Could you 
send me you reproducer, please?


http://reviews.llvm.org/D14441



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


Re: [PATCH] D10305: [Clang Static Analyzer] Bug identification

2015-11-12 Thread Sean Eveson via cfe-commits
seaneveson added a comment.

> If you have multiple users using a bug suppression system, I would design 
> such system using only a single hash version across all users; using a mix 
> seems error prone.. Once all of your users upgrade to a version of the 
> analyzer where a new hash version is available, you upgrade the hash in the 
> database to reflect that.


We want users to be able to take advantage of the new hash when they upgrade to 
a new version. There may be a large amount of time between the first user(s) to 
upgrade and the last. On top of this there is no way to identify when all the 
users have upgraded.

> Let's talk about your example.

>  You have user1 using hash_version_1 and user2 using hash_version_2. If the 
> second user suppresses an issue and hash_version_2 is used to record that, 
> how will user1 be able to identity that issue?


For each suppressed warning we will store all of the produced hashes, then the 
tool can compare any generated hash against the stored hashes.

> Also, as I've mentioned before, the newest issue hash would not necessarily 
> be the best.




> We could have a list of issue hashes and each item in the list containing 
> type_of_hash, hash_version, hash. However, I am not yet convinced that this 
> complexity is justified.


I did not consider that the hashes might be used for something other than 
suppression. In that case, our problem is identifying which hashes to use for 
suppression and knowing which order to use them in. Do you have any suggestions?


http://reviews.llvm.org/D10305



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


Re: [PATCH] D14570: Handle ARMv6KZ naming

2015-11-12 Thread Saleem Abdulrasool via cfe-commits
compnerd added a subscriber: compnerd.
compnerd accepted this revision.
compnerd added a reviewer: compnerd.
compnerd added a comment.
This revision is now accepted and ready to land.

Wow, this is tricky: the code change is in LLVM, and test change in clang :(.  
However, this does seem to preserve the features.

This is a dependent change so be careful about commit ordering.


http://reviews.llvm.org/D14570



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


Re: r252872 - Update clang regression tests for 'norecurse'

2015-11-12 Thread James Molloy via cfe-commits
Hi David,

Honestly, I really don't know. I just updated them due to a change in LLVM
- I hadn't considered doing an audit.

James

On Thu, 12 Nov 2015 at 16:08 David Blaikie via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Thu, Nov 12, 2015 at 2:56 AM, James Molloy via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: jamesm
>> Date: Thu Nov 12 04:56:51 2015
>> New Revision: 252872
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=252872&view=rev
>> Log:
>> Update clang regression tests for 'norecurse'
>>
>> FunctionAttrs has just been taught how to infer 'norecurse'. Update clang
>> tests for LLVM r252871.
>>
>
> Do all these tests need to run FunctionAttrs? Could some/all of them be
> switched to use -disable-llvm-optzns?
>
>
>>
>> Modified:
>> cfe/trunk/test/CodeGen/attr-minsize.cpp
>> cfe/trunk/test/CodeGen/function-attributes.c
>> cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp
>> cfe/trunk/test/CodeGenCXX/member-initializers.cpp
>> cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp
>>
>> Modified: cfe/trunk/test/CodeGen/attr-minsize.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/attr-minsize.cpp?rev=252872&r1=252871&r2=252872&view=diff
>>
>> ==
>> --- cfe/trunk/test/CodeGen/attr-minsize.cpp (original)
>> +++ cfe/trunk/test/CodeGen/attr-minsize.cpp Thu Nov 12 04:56:51 2015
>> @@ -76,4 +76,4 @@ void test5(float arg);
>>
>>  // Oz: attributes [[MINSIZE]] = { minsize{{.*}} }
>>
>> -// OTHER: attributes [[MS]] = { minsize nounwind{{.*}} }
>> +// OTHER: attributes [[MS]] = { minsize {{(norecurse )?}}nounwind{{.*}} }
>>
>> Modified: cfe/trunk/test/CodeGen/function-attributes.c
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/function-attributes.c?rev=252872&r1=252871&r2=252872&view=diff
>>
>> ==
>> --- cfe/trunk/test/CodeGen/function-attributes.c (original)
>> +++ cfe/trunk/test/CodeGen/function-attributes.c Thu Nov 12 04:56:51 2015
>> @@ -128,9 +128,9 @@ void f20(void) {
>>_setjmp(0);
>>  }
>>
>> -// CHECK: attributes [[NUW]] = { nounwind optsize readnone{{.*}} }
>> -// CHECK: attributes [[AI]] = { alwaysinline nounwind optsize
>> readnone{{.*}} }
>> -// CHECK: attributes [[ALIGN]] = { nounwind optsize readnone
>> alignstack=16{{.*}} }
>> +// CHECK: attributes [[NUW]] = { norecurse nounwind optsize
>> readnone{{.*}} }
>> +// CHECK: attributes [[AI]] = { alwaysinline norecurse nounwind optsize
>> readnone{{.*}} }
>> +// CHECK: attributes [[ALIGN]] = { norecurse nounwind optsize readnone
>> alignstack=16{{.*}} }
>>  // CHECK: attributes [[RT]] = { nounwind optsize returns_twice{{.*}} }
>>  // CHECK: attributes [[NR]] = { noreturn nounwind optsize }
>>  // CHECK: attributes [[NUW_RN]] = { nounwind optsize readnone }
>>
>> Modified: cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp?rev=252872&r1=252871&r2=252872&view=diff
>>
>> ==
>> --- cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp (original)
>> +++ cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp Thu Nov 12
>> 04:56:51 2015
>> @@ -35,4 +35,4 @@ int f() {
>>return count;
>>  }
>>
>> -// CHECK: attributes [[NUW]] = { nounwind{{.*}} }
>> +// CHECK: attributes [[NUW]] = { norecurse nounwind{{.*}} }
>>
>> Modified: cfe/trunk/test/CodeGenCXX/member-initializers.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/member-initializers.cpp?rev=252872&r1=252871&r2=252872&view=diff
>>
>> ==
>> --- cfe/trunk/test/CodeGenCXX/member-initializers.cpp (original)
>> +++ cfe/trunk/test/CodeGenCXX/member-initializers.cpp Thu Nov 12 04:56:51
>> 2015
>> @@ -32,4 +32,4 @@ int test_fold() {
>>return A(2).i;
>>  }
>>
>> -// CHECK: attributes [[NUW_RN]] = { nounwind readnone{{.*}} }
>> +// CHECK: attributes [[NUW_RN]] = { norecurse nounwind readnone{{.*}} }
>>
>> Modified: cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp?rev=252872&r1=252871&r2=252872&view=diff
>>
>> ==
>> --- cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp (original)
>> +++ cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp Thu Nov 12
>> 04:56:51 2015
>> @@ -295,4 +295,4 @@ U u;
>>  // CHECK-GLOBAL: @_ZN11IndirectPDM1uE = global %"union.IndirectPDM::U" {
>> %union.anon { i64 -1 } }, align 8
>>  }
>>
>> -// CHECK-O3: attributes [[NUW]] = { nounwind readnone{{.*}} }
>> +// CHECK-O3: attributes [[NUW]] = { norecurse nounwind readnone{{.*}} }
>>
>>
>> 

Re: r252872 - Update clang regression tests for 'norecurse'

2015-11-12 Thread David Blaikie via cfe-commits
On Thu, Nov 12, 2015 at 2:56 AM, James Molloy via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: jamesm
> Date: Thu Nov 12 04:56:51 2015
> New Revision: 252872
>
> URL: http://llvm.org/viewvc/llvm-project?rev=252872&view=rev
> Log:
> Update clang regression tests for 'norecurse'
>
> FunctionAttrs has just been taught how to infer 'norecurse'. Update clang
> tests for LLVM r252871.
>

Do all these tests need to run FunctionAttrs? Could some/all of them be
switched to use -disable-llvm-optzns?


>
> Modified:
> cfe/trunk/test/CodeGen/attr-minsize.cpp
> cfe/trunk/test/CodeGen/function-attributes.c
> cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp
> cfe/trunk/test/CodeGenCXX/member-initializers.cpp
> cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp
>
> Modified: cfe/trunk/test/CodeGen/attr-minsize.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/attr-minsize.cpp?rev=252872&r1=252871&r2=252872&view=diff
>
> ==
> --- cfe/trunk/test/CodeGen/attr-minsize.cpp (original)
> +++ cfe/trunk/test/CodeGen/attr-minsize.cpp Thu Nov 12 04:56:51 2015
> @@ -76,4 +76,4 @@ void test5(float arg);
>
>  // Oz: attributes [[MINSIZE]] = { minsize{{.*}} }
>
> -// OTHER: attributes [[MS]] = { minsize nounwind{{.*}} }
> +// OTHER: attributes [[MS]] = { minsize {{(norecurse )?}}nounwind{{.*}} }
>
> Modified: cfe/trunk/test/CodeGen/function-attributes.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/function-attributes.c?rev=252872&r1=252871&r2=252872&view=diff
>
> ==
> --- cfe/trunk/test/CodeGen/function-attributes.c (original)
> +++ cfe/trunk/test/CodeGen/function-attributes.c Thu Nov 12 04:56:51 2015
> @@ -128,9 +128,9 @@ void f20(void) {
>_setjmp(0);
>  }
>
> -// CHECK: attributes [[NUW]] = { nounwind optsize readnone{{.*}} }
> -// CHECK: attributes [[AI]] = { alwaysinline nounwind optsize
> readnone{{.*}} }
> -// CHECK: attributes [[ALIGN]] = { nounwind optsize readnone
> alignstack=16{{.*}} }
> +// CHECK: attributes [[NUW]] = { norecurse nounwind optsize
> readnone{{.*}} }
> +// CHECK: attributes [[AI]] = { alwaysinline norecurse nounwind optsize
> readnone{{.*}} }
> +// CHECK: attributes [[ALIGN]] = { norecurse nounwind optsize readnone
> alignstack=16{{.*}} }
>  // CHECK: attributes [[RT]] = { nounwind optsize returns_twice{{.*}} }
>  // CHECK: attributes [[NR]] = { noreturn nounwind optsize }
>  // CHECK: attributes [[NUW_RN]] = { nounwind optsize readnone }
>
> Modified: cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp?rev=252872&r1=252871&r2=252872&view=diff
>
> ==
> --- cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp Thu Nov 12
> 04:56:51 2015
> @@ -35,4 +35,4 @@ int f() {
>return count;
>  }
>
> -// CHECK: attributes [[NUW]] = { nounwind{{.*}} }
> +// CHECK: attributes [[NUW]] = { norecurse nounwind{{.*}} }
>
> Modified: cfe/trunk/test/CodeGenCXX/member-initializers.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/member-initializers.cpp?rev=252872&r1=252871&r2=252872&view=diff
>
> ==
> --- cfe/trunk/test/CodeGenCXX/member-initializers.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/member-initializers.cpp Thu Nov 12 04:56:51
> 2015
> @@ -32,4 +32,4 @@ int test_fold() {
>return A(2).i;
>  }
>
> -// CHECK: attributes [[NUW_RN]] = { nounwind readnone{{.*}} }
> +// CHECK: attributes [[NUW_RN]] = { norecurse nounwind readnone{{.*}} }
>
> Modified: cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp?rev=252872&r1=252871&r2=252872&view=diff
>
> ==
> --- cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp Thu Nov 12
> 04:56:51 2015
> @@ -295,4 +295,4 @@ U u;
>  // CHECK-GLOBAL: @_ZN11IndirectPDM1uE = global %"union.IndirectPDM::U" {
> %union.anon { i64 -1 } }, align 8
>  }
>
> -// CHECK-O3: attributes [[NUW]] = { nounwind readnone{{.*}} }
> +// CHECK-O3: attributes [[NUW]] = { norecurse nounwind readnone{{.*}} }
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14560: [Clang] Fix Clang-tidy modernize-use-auto in some files in lib/AST; other minor cleanups.

2015-11-12 Thread David Blaikie via cfe-commits
On Thu, Nov 12, 2015 at 6:36 AM, Aaron Ballman via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> aaron.ballman added inline comments.
>
> 
> Comment at: lib/AST/ASTContext.cpp:7930
> @@ -7931,3 +7929,3 @@
>
> -ASTMutationListener::~ASTMutationListener() { }
> +ASTMutationListener::~ASTMutationListener() = default;
>
> 
> Eugene.Zelenko wrote:
> > aaron.ballman wrote:
> > > This is... interesting. Explicitly defaulting an out-of-line function
> definition is not something I've ever encountered before. What benefit does
> this provide?
> > It's explicitly tells that destructor has default implementation.
> I'm not certain this is an improvement. Using =default in the declaration
> is an improvement because it tells the compiler up front "this has the
> default implementation" and the compiler can benefit from that information
> in other ways. When it's on an out-of-line definition, it does say "this
> has the default implementation", but it doesn't give the compiler any
> benefit over {}, so the only benefit is up to the reader of the code. I
> think someone can read {} to easily tell it is the default behavior, it is
> considerably shorter, and it doesn't cause anyone's eyes to trip over it
> wondering about the construct.
>

If we're talking coding style, I'll vote marginally in favor of "= default"
even in out of line definitions. But yeah, I don't think it necessarily
adds much either *shrug* I probably wouldn't hold up a code review on it
either way myself. (this is not a directive, just my own commentary)


>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D14560
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14578: Cull non-standard variants of ARM architectures (NFC)

2015-11-12 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL252904: Cull non-standard variants of ARM architectures 
(NFC) (authored by askrobov).

Changed prior to commit:
  http://reviews.llvm.org/D14578?vs=39943&id=40052#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14578

Files:
  cfe/trunk/lib/Basic/Targets.cpp

Index: cfe/trunk/lib/Basic/Targets.cpp
===
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -4366,15 +4366,10 @@
 default:
   return llvm::ARM::getCPUAttr(ArchKind);
 case llvm::ARM::AK_ARMV6M:
-case llvm::ARM::AK_ARMV6SM:
-case llvm::ARM::AK_ARMV6HL:
   return "6M";
 case llvm::ARM::AK_ARMV7S:
   return "7S";
-case llvm::ARM::AK_ARMV7:
 case llvm::ARM::AK_ARMV7A:
-case llvm::ARM::AK_ARMV7L:
-case llvm::ARM::AK_ARMV7HL:
   return "7A";
 case llvm::ARM::AK_ARMV7R:
   return "7R";


Index: cfe/trunk/lib/Basic/Targets.cpp
===
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -4366,15 +4366,10 @@
 default:
   return llvm::ARM::getCPUAttr(ArchKind);
 case llvm::ARM::AK_ARMV6M:
-case llvm::ARM::AK_ARMV6SM:
-case llvm::ARM::AK_ARMV6HL:
   return "6M";
 case llvm::ARM::AK_ARMV7S:
   return "7S";
-case llvm::ARM::AK_ARMV7:
 case llvm::ARM::AK_ARMV7A:
-case llvm::ARM::AK_ARMV7L:
-case llvm::ARM::AK_ARMV7HL:
   return "7A";
 case llvm::ARM::AK_ARMV7R:
   return "7R";
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r252905 - Implement P0074: Making owner_less more flexible

2015-11-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Nov 12 09:56:44 2015
New Revision: 252905

URL: http://llvm.org/viewvc/llvm-project?rev=252905&view=rev
Log:
Implement P0074: Making owner_less more flexible

Modified:
libcxx/trunk/include/memory

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/memory
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=252905&r1=252904&r2=252905&view=diff
==
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Thu Nov 12 09:56:44 2015
@@ -5351,7 +5351,11 @@ weak_ptr<_Tp>::lock() const _NOEXCEPT
 return __r;
 }
 
+#if _LIBCPP_STD_VER > 14
+template  struct owner_less;
+#else
 template  struct owner_less;
+#endif
 
 template 
 struct _LIBCPP_TYPE_VIS_ONLY owner_less >
@@ -5385,6 +5389,30 @@ struct _LIBCPP_TYPE_VIS_ONLY owner_less<
 {return __x.owner_before(__y);}
 };
 
+#if _LIBCPP_STD_VER > 14
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY owner_less
+{
+template 
+_LIBCPP_INLINE_VISIBILITY
+bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) 
const
+{return __x.owner_before(__y);}
+template 
+_LIBCPP_INLINE_VISIBILITY
+bool operator()( shared_ptr<_Tp> const& __x,  weak_ptr<_Up> const& __y) 
const
+{return __x.owner_before(__y);}
+template 
+_LIBCPP_INLINE_VISIBILITY
+bool operator()(   weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) 
const
+{return __x.owner_before(__y);}
+template 
+_LIBCPP_INLINE_VISIBILITY
+bool operator()(   weak_ptr<_Tp> const& __x,   weak_ptr<_Up> const& __y) 
const
+{return __x.owner_before(__y);}
+typedef void is_transparent;
+};
+#endif
+
 template
 class _LIBCPP_TYPE_VIS_ONLY enable_shared_from_this
 {

Modified: 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp?rev=252905&r1=252904&r2=252905&view=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
 Thu Nov 12 09:56:44 2015
@@ -30,9 +30,28 @@
 // bool operator()(shared_ptr const&, weak_ptr const&) const;
 // bool operator()(weak_ptr const&, shared_ptr const&) const;
 // };
+// 
+// Added in C++17
+// template<> struct owner_less
+// {
+// template
+// bool operator()(shared_ptr const&, shared_ptr const&) const;
+// template
+// bool operator()(shared_ptr const&, weak_ptr const&) const;
+// template
+// bool operator()(weak_ptr const&, shared_ptr const&) const;
+// template
+// bool operator()(weak_ptr const&, weak_ptr const&) const;
+// 
+// typedef unspecified is_transparent;
+// };
 
 #include 
 #include 
+#include 
+#include "test_macros.h"
+
+struct X {};
 
 int main()
 {
@@ -79,4 +98,25 @@ int main()
 assert(cs(w1, p3) || cs(w3, p1));
 assert(cs(w3, p1) == cs(w3, p2));
 }
+#if TEST_STD_VER > 14
+{
+std::shared_ptr sp1;
+std::shared_ptr sp2;
+std::shared_ptr sp3;
+std::weak_ptr wp1;
+
+std::owner_less<> cmp;
+cmp(sp1, sp2);
+cmp(sp1, wp1);
+cmp(sp1, sp3);
+cmp(wp1, sp1);
+cmp(wp1, wp1);
+}
+{
+// test heterogeneous lookups 
+std::set, std::owner_less<>> s;
+std::shared_ptr vp;
+s.find(vp);
+}
+#endif
 }

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=252905&r1=252904&r2=252905&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Thu Nov 12 09:56:44 2015
@@ -75,7 +75,7 @@
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0092R1.html";>P0092R1LWGPolishing
 KonaComplete3.8
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0007R1.html";>P0007R1LWGConstant
 View: A proposal for a std::as_const helper function 
template.KonaIn progress
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0156R0.htm"; 
>P0156R0LWGVariadic lock_guard(rev 
3).Kona
-   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0074R0.html";>P0074R0LWGMaking
 std::owner_less more flexibleKona
+   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0074R0.html";>P0074R0LWGMaking
 std::owner_less more 
flexibleKonaComplete3.8
http://www.open-std.org/jtc1/s

r252904 - Cull non-standard variants of ARM architectures (NFC)

2015-11-12 Thread Artyom Skrobov via cfe-commits
Author: askrobov
Date: Thu Nov 12 09:52:02 2015
New Revision: 252904

URL: http://llvm.org/viewvc/llvm-project?rev=252904&view=rev
Log:
Cull non-standard variants of ARM architectures (NFC)

Summary: Clang-side update, corresponding to D14577

Reviewers: rengolin

Subscribers: aemerson, cfe-commits, rengolin

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

Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=252904&r1=252903&r2=252904&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Nov 12 09:52:02 2015
@@ -4366,15 +4366,10 @@ class ARMTargetInfo : public TargetInfo
 default:
   return llvm::ARM::getCPUAttr(ArchKind);
 case llvm::ARM::AK_ARMV6M:
-case llvm::ARM::AK_ARMV6SM:
-case llvm::ARM::AK_ARMV6HL:
   return "6M";
 case llvm::ARM::AK_ARMV7S:
   return "7S";
-case llvm::ARM::AK_ARMV7:
 case llvm::ARM::AK_ARMV7A:
-case llvm::ARM::AK_ARMV7L:
-case llvm::ARM::AK_ARMV7HL:
   return "7A";
 case llvm::ARM::AK_ARMV7R:
   return "7R";


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


Re: [PATCH] D14615: [C++] Add the "norecurse" attribute to main() if in C++ mode

2015-11-12 Thread James Molloy via cfe-commits
jmolloy updated this revision to Diff 40050.
jmolloy added a comment.

Hi Aaron,

Thanks, this should all be fixed now.

Cheers,

James


Repository:
  rL LLVM

http://reviews.llvm.org/D14615

Files:
  lib/CodeGen/CodeGenFunction.cpp
  test/CodeGenCXX/main-norecurse.cpp
  test/CodeGenObjC/objc-literal-tests.m

Index: test/CodeGenObjC/objc-literal-tests.m
===
--- test/CodeGenObjC/objc-literal-tests.m
+++ test/CodeGenObjC/objc-literal-tests.m
@@ -94,4 +94,4 @@
   bar(^(void) { return YES; });
 }
 
-// CHECK: attributes [[NUW]] = { nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { {{(norecurse )?}}nounwind{{.*}} }
Index: test/CodeGenCXX/main-norecurse.cpp
===
--- /dev/null
+++ test/CodeGenCXX/main-norecurse.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: define i{{.*}} @main({{.*}}) #0
+int main(int argc, char **argv) {
+return 1;
+}
+
+// CHECK: attributes #0 = { norecurse{{.*}} }
Index: lib/CodeGen/CodeGenFunction.cpp
===
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -716,6 +716,14 @@
 }
   }
 
+  // If we're in C++ mode and the function name is "main", it is guaranteed
+  // to be norecurse by the standard (3.6.1.3 "The function main shall not be
+  // used within a program").
+  if (getLangOpts().CPlusPlus)
+if (const FunctionDecl *FD = dyn_cast_or_null(D))
+  if (FD->isMain())
+Fn->addFnAttr(llvm::Attribute::NoRecurse);
+  
   llvm::BasicBlock *EntryBB = createBasicBlock("entry", CurFn);
 
   // Create a marker to make it easy to insert allocas into the entryblock


Index: test/CodeGenObjC/objc-literal-tests.m
===
--- test/CodeGenObjC/objc-literal-tests.m
+++ test/CodeGenObjC/objc-literal-tests.m
@@ -94,4 +94,4 @@
   bar(^(void) { return YES; });
 }
 
-// CHECK: attributes [[NUW]] = { nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { {{(norecurse )?}}nounwind{{.*}} }
Index: test/CodeGenCXX/main-norecurse.cpp
===
--- /dev/null
+++ test/CodeGenCXX/main-norecurse.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: define i{{.*}} @main({{.*}}) #0
+int main(int argc, char **argv) {
+return 1;
+}
+
+// CHECK: attributes #0 = { norecurse{{.*}} }
Index: lib/CodeGen/CodeGenFunction.cpp
===
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -716,6 +716,14 @@
 }
   }
 
+  // If we're in C++ mode and the function name is "main", it is guaranteed
+  // to be norecurse by the standard (3.6.1.3 "The function main shall not be
+  // used within a program").
+  if (getLangOpts().CPlusPlus)
+if (const FunctionDecl *FD = dyn_cast_or_null(D))
+  if (FD->isMain())
+Fn->addFnAttr(llvm::Attribute::NoRecurse);
+  
   llvm::BasicBlock *EntryBB = createBasicBlock("entry", CurFn);
 
   // Create a marker to make it easy to insert allocas into the entryblock
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14615: [C++] Add the "norecurse" attribute to main() if in C++ mode

2015-11-12 Thread James Molloy via cfe-commits
jmolloy closed this revision.
jmolloy added a comment.

Thanks Aaron, committed in r252902.


Repository:
  rL LLVM

http://reviews.llvm.org/D14615



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


Re: [PATCH] D14570: Handle ARMv6KZ naming

2015-11-12 Thread A. Skrobov via cfe-commits
tyomitch added a comment.

In http://reviews.llvm.org/D14570#288022, @joerg wrote:

> The specific CPU was only chosen to match what the backend supported at the 
> time. As long as the feature set is identical, it doesn't really matter.


The feature set isn't quite identical; default ARMv6 CPU for non-NetBSD targets 
is "arm1136jf-s", which differs from "arm1176jzf-s" by not having the HasV6KOps 
and FeatureTrustZone backend features.

I don't understand why NetBSD is special in this respect; but anyway, my patch 
preserves its special handling.


http://reviews.llvm.org/D14570



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


r252902 - [C++] Add the "norecurse" attribute to main() if in C++ mode

2015-11-12 Thread James Molloy via cfe-commits
Author: jamesm
Date: Thu Nov 12 09:36:04 2015
New Revision: 252902

URL: http://llvm.org/viewvc/llvm-project?rev=252902&view=rev
Log:
[C++] Add the "norecurse" attribute to main() if in C++ mode

The C++ spec (3.6.1.3) says "The function `main` shall not be used within a 
program". This implies that it cannot recurse, so add the norecurse attribute 
to help the midend out a bit.

Added:
cfe/trunk/test/CodeGenCXX/main-norecurse.cpp
Modified:
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/test/CodeGenObjC/objc-literal-tests.m

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=252902&r1=252901&r2=252902&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Thu Nov 12 09:36:04 2015
@@ -716,6 +716,14 @@ void CodeGenFunction::StartFunction(Glob
 }
   }
 
+  // If we're in C++ mode and the function name is "main", it is guaranteed
+  // to be norecurse by the standard (3.6.1.3 "The function main shall not be
+  // used within a program").
+  if (getLangOpts().CPlusPlus)
+if (const FunctionDecl *FD = dyn_cast_or_null(D))
+  if (FD->isMain())
+Fn->addFnAttr(llvm::Attribute::NoRecurse);
+  
   llvm::BasicBlock *EntryBB = createBasicBlock("entry", CurFn);
 
   // Create a marker to make it easy to insert allocas into the entryblock

Added: cfe/trunk/test/CodeGenCXX/main-norecurse.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/main-norecurse.cpp?rev=252902&view=auto
==
--- cfe/trunk/test/CodeGenCXX/main-norecurse.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/main-norecurse.cpp Thu Nov 12 09:36:04 2015
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: define i{{.*}} @main({{.*}}) #0
+int main(int argc, char **argv) {
+return 1;
+}
+
+// CHECK: attributes #0 = { norecurse{{.*}} }

Modified: cfe/trunk/test/CodeGenObjC/objc-literal-tests.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/objc-literal-tests.m?rev=252902&r1=252901&r2=252902&view=diff
==
--- cfe/trunk/test/CodeGenObjC/objc-literal-tests.m (original)
+++ cfe/trunk/test/CodeGenObjC/objc-literal-tests.m Thu Nov 12 09:36:04 2015
@@ -94,4 +94,4 @@ void baz(void) {
   bar(^(void) { return YES; });
 }
 
-// CHECK: attributes [[NUW]] = { nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { {{(norecurse )?}}nounwind{{.*}} }


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


Re: [PATCH] D14615: [C++] Add the "norecurse" attribute to main() if in C++ mode

2015-11-12 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

Yup. LG, thanks!


Repository:
  rL LLVM

http://reviews.llvm.org/D14615



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


Re: [PATCH] D14615: [C++] Add the "norecurse" attribute to main() if in C++ mode

2015-11-12 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

After fixing the FileCheck and grammar issues, LGTM!


Repository:
  rL LLVM

http://reviews.llvm.org/D14615



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


[PATCH] D14616: [libcxx] Replace TEST_HAS_NO_EXCEPTIONS with _LIBCPP_NO_EXCEPTIONS [NFC]

2015-11-12 Thread Asiri Rathnayake via cfe-commits
rmaprath created this revision.
rmaprath added reviewers: EricWF, jroelofs, mclow.lists, rengolin.
rmaprath added a subscriber: cfe-commits.

The macro TEST_HAS_NO_EXCEPTIONS seems to be defined very similar to 
_LIBCPP_NO_EXCEPTIONS, I'm thinking of getting rid of the former as the latter 
is more general (defined in __config).

I'm curious as to why the TEST_HAS_NO_EXCEPTIONS macro was introduced? Until 
very recently, we did not have any -fno-exceptions test runs AFAIK.

If readability is the reason for this macro, we can instead do:

```
#define TEST_HAS_NO_EXCEPTIONS _LIBCPP_NO_EXCEPTIONS
```

No functional changes.

http://reviews.llvm.org/D14616

Files:
  test/std/experimental/any/any.class/any.assign/copy.pass.cpp
  test/std/experimental/any/any.class/any.assign/value.pass.cpp
  test/std/experimental/any/any.class/any.cons/copy.pass.cpp
  test/std/experimental/any/any.class/any.cons/move.pass.cpp
  test/std/experimental/any/any.class/any.cons/value.pass.cpp
  test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
  test/support/any_helpers.h
  test/support/test_macros.h

Index: test/support/test_macros.h
===
--- test/support/test_macros.h
+++ test/support/test_macros.h
@@ -92,10 +92,6 @@
 #define TEST_HAS_NO_RTTI
 #endif
 
-#if !TEST_HAS_FEATURE(cxx_exceptions) && !defined(__cxx_exceptions)
-#define TEST_HAS_NO_EXCEPTIONS
-#endif
-
 #if TEST_HAS_FEATURE(address_sanitizer) || TEST_HAS_FEATURE(memory_sanitizer) || \
 TEST_HAS_FEATURE(thread_sanitizer)
 #define TEST_HAS_SANITIZERS
Index: test/support/any_helpers.h
===
--- test/support/any_helpers.h
+++ test/support/any_helpers.h
@@ -216,7 +216,7 @@
 struct my_any_exception {};
 
 void throwMyAnyExpression() {
-#if !defined(TEST_HAS_NO_EXCEPTIONS)
+#ifndef _LIBCPP_NO_EXCEPTIONS
 throw my_any_exception();
 #else
 assert(false && "Exceptions are disabled");
Index: test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
===
--- test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
+++ test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
@@ -71,7 +71,7 @@
 template 
 void checkThrows(any& a)
 {
-#if !defined(TEST_HAS_NO_EXCEPTIONS)
+#ifndef _LIBCPP_NO_EXCEPTIONS
 try {
 any_cast(a);
 assert(false);
Index: test/std/experimental/any/any.class/any.cons/value.pass.cpp
===
--- test/std/experimental/any/any.class/any.cons/value.pass.cpp
+++ test/std/experimental/any/any.class/any.cons/value.pass.cpp
@@ -33,7 +33,7 @@
 template 
 void test_copy_value_throws()
 {
-#if !defined(TEST_HAS_NO_EXCEPTIONS)
+#ifndef _LIBCPP_NO_EXCEPTIONS
 assert(Type::count == 0);
 {
 Type const t(42);
@@ -55,7 +55,7 @@
 
 void test_move_value_throws()
 {
-#if !defined(TEST_HAS_NO_EXCEPTIONS)
+#ifndef _LIBCPP_NO_EXCEPTIONS
 assert(throws_on_move::count == 0);
 {
 throws_on_move v;
Index: test/std/experimental/any/any.class/any.cons/move.pass.cpp
===
--- test/std/experimental/any/any.class/any.cons/move.pass.cpp
+++ test/std/experimental/any/any.class/any.cons/move.pass.cpp
@@ -30,7 +30,7 @@
 // not the stored object.
 void test_move_does_not_throw()
 {
-#if !defined(TEST_HAS_NO_EXCEPTIONS)
+#ifndef _LIBCPP_NO_EXCEPTIONS
 assert(throws_on_move::count == 0);
 {
 throws_on_move v(42);
Index: test/std/experimental/any/any.class/any.cons/copy.pass.cpp
===
--- test/std/experimental/any/any.class/any.cons/copy.pass.cpp
+++ test/std/experimental/any/any.class/any.cons/copy.pass.cpp
@@ -25,7 +25,7 @@
 
 template 
 void test_copy_throws() {
-#if !defined(TEST_HAS_NO_EXCEPTIONS)
+#ifndef _LIBCPP_NO_EXCEPTIONS
 assert(Type::count == 0);
 {
 any const a((Type(42)));
Index: test/std/experimental/any/any.class/any.assign/value.pass.cpp
===
--- test/std/experimental/any/any.class/any.assign/value.pass.cpp
+++ test/std/experimental/any/any.class/any.assign/value.pass.cpp
@@ -113,7 +113,7 @@
 
 template 
 void test_assign_throws() {
-#if !defined(TEST_HAS_NO_EXCEPTIONS)
+#ifndef _LIBCPP_NO_EXCEPTIONS
 auto try_throw=
 [](any& lhs, auto&& rhs) {
 try {
Index: test/std/experimental/any/any.class/any.assign/copy.pass.cpp
===
--- test/std/experimental/any/any.class/any.assign/copy.pass.cpp
+++ test/std/experimental/any/any.class/any.assign/copy.pass.cpp
@@ -131,7 +131,7 @@
 template 
 void test_copy_assign_throws()
 {
-#if !defined(TEST_HAS_NO_EXCEPTIONS)
+#ifndef _LIBCPP_NO_EXCEPTIONS
 auto t

Re: [PATCH] D14615: [C++] Add the "norecurse" attribute to main() if in C++ mode

2015-11-12 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: lib/CodeGen/CodeGenFunction.cpp:721
@@ +720,3 @@
+  // to be norecurse by the standard (3.6.1.3 "The function main shall not be
+  // used within a program")
+  if (getLangOpts().CPlusPlus)

Missing a period at the end of the sentence.


Comment at: test/CodeGenCXX/main-norecurse.cpp:1
@@ +1,2 @@
+// RUN: %clang_cc1 -emit-llvm %s -o -
+

jmolloy wrote:
> Wow, I managed to forget in my copy-paste from another test to add "| 
> FileCheck %s" here.
> 
> I'll update this before committing.
Missing FileCheck?


Repository:
  rL LLVM

http://reviews.llvm.org/D14615



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


Re: [PATCH] D14615: [C++] Add the "norecurse" attribute to main() if in C++ mode

2015-11-12 Thread James Molloy via cfe-commits
jmolloy added inline comments.


Comment at: test/CodeGenCXX/main-norecurse.cpp:1
@@ +1,2 @@
+// RUN: %clang_cc1 -emit-llvm %s -o -
+

Wow, I managed to forget in my copy-paste from another test to add "| FileCheck 
%s" here.

I'll update this before committing.


Repository:
  rL LLVM

http://reviews.llvm.org/D14615



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


[PATCH] D14615: [C++] Add the "norecurse" attribute to main() if in C++ mode

2015-11-12 Thread James Molloy via cfe-commits
jmolloy created this revision.
jmolloy added a reviewer: aaron.ballman.
jmolloy added a subscriber: cfe-commits.
jmolloy set the repository for this revision to rL LLVM.

The C++ spec (3.6.1.3) says "The function `main` shall not be used within a 
program". This implies that it cannot recurse, so add the norecurse attribute 
to help the midend out a bit.

Repository:
  rL LLVM

http://reviews.llvm.org/D14615

Files:
  lib/CodeGen/CodeGenFunction.cpp
  test/CodeGenCXX/main-norecurse.cpp
  test/CodeGenObjC/objc-literal-tests.m

Index: test/CodeGenObjC/objc-literal-tests.m
===
--- test/CodeGenObjC/objc-literal-tests.m
+++ test/CodeGenObjC/objc-literal-tests.m
@@ -94,4 +94,4 @@
   bar(^(void) { return YES; });
 }
 
-// CHECK: attributes [[NUW]] = { nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { {{(norecurse )?}}nounwind{{.*}} }
Index: test/CodeGenCXX/main-norecurse.cpp
===
--- /dev/null
+++ test/CodeGenCXX/main-norecurse.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -emit-llvm %s -o -
+
+// CHECK: define i{{.*}} @main({{.*}}) [[A:#.*]]
+int main(int argc, char **argv) {
+return 1;
+}
+
+// CHECK: attribute [[A]] = attributes { norecurse{{.*}} }
Index: lib/CodeGen/CodeGenFunction.cpp
===
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -716,6 +716,14 @@
 }
   }
 
+  // If we're in C++ mode and the function name is "main", it is guaranteed
+  // to be norecurse by the standard (3.6.1.3 "The function main shall not be
+  // used within a program")
+  if (getLangOpts().CPlusPlus)
+if (const FunctionDecl *FD = dyn_cast_or_null(D))
+  if (FD->isMain())
+Fn->addFnAttr(llvm::Attribute::NoRecurse);
+  
   llvm::BasicBlock *EntryBB = createBasicBlock("entry", CurFn);
 
   // Create a marker to make it easy to insert allocas into the entryblock


Index: test/CodeGenObjC/objc-literal-tests.m
===
--- test/CodeGenObjC/objc-literal-tests.m
+++ test/CodeGenObjC/objc-literal-tests.m
@@ -94,4 +94,4 @@
   bar(^(void) { return YES; });
 }
 
-// CHECK: attributes [[NUW]] = { nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { {{(norecurse )?}}nounwind{{.*}} }
Index: test/CodeGenCXX/main-norecurse.cpp
===
--- /dev/null
+++ test/CodeGenCXX/main-norecurse.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -emit-llvm %s -o -
+
+// CHECK: define i{{.*}} @main({{.*}}) [[A:#.*]]
+int main(int argc, char **argv) {
+return 1;
+}
+
+// CHECK: attribute [[A]] = attributes { norecurse{{.*}} }
Index: lib/CodeGen/CodeGenFunction.cpp
===
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -716,6 +716,14 @@
 }
   }
 
+  // If we're in C++ mode and the function name is "main", it is guaranteed
+  // to be norecurse by the standard (3.6.1.3 "The function main shall not be
+  // used within a program")
+  if (getLangOpts().CPlusPlus)
+if (const FunctionDecl *FD = dyn_cast_or_null(D))
+  if (FD->isMain())
+Fn->addFnAttr(llvm::Attribute::NoRecurse);
+  
   llvm::BasicBlock *EntryBB = createBasicBlock("entry", CurFn);
 
   // Create a marker to make it easy to insert allocas into the entryblock
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r252836 - [CMake] Setup an install component for libclang and c-index-test.

2015-11-12 Thread Aaron Ballman via cfe-commits
Is this target needed by IDEs? It currently adds the target to the
root level of the solution in MSVC.

~Aaron

On Wed, Nov 11, 2015 at 7:46 PM, Argyrios Kyrtzidis via cfe-commits
 wrote:
> Author: akirtzidis
> Date: Wed Nov 11 18:46:57 2015
> New Revision: 252836
>
> URL: http://llvm.org/viewvc/llvm-project?rev=252836&view=rev
> Log:
> [CMake] Setup an install component for libclang and c-index-test.
>
> Also don't create libclang dylib symlinks on darwin.
>
> Modified:
> cfe/trunk/CMakeLists.txt
> cfe/trunk/tools/c-index-test/CMakeLists.txt
> cfe/trunk/tools/libclang/CMakeLists.txt
>
> Modified: cfe/trunk/CMakeLists.txt
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=252836&r1=252835&r2=252836&view=diff
> ==
> --- cfe/trunk/CMakeLists.txt (original)
> +++ cfe/trunk/CMakeLists.txt Wed Nov 11 18:46:57 2015
> @@ -354,7 +354,7 @@ endmacro()
>
>  macro(add_clang_library name)
>cmake_parse_arguments(ARG
> -""
> +"SHARED"
>  ""
>  "ADDITIONAL_HEADERS"
>  ${ARGN})
> @@ -390,17 +390,29 @@ macro(add_clang_library name)
>${ARG_ADDITIONAL_HEADERS} # It may contain unparsed unknown args.
>)
>endif()
> -  llvm_add_library(${name} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
> +  if(ARG_SHARED)
> +set(ARG_ENABLE_SHARED SHARED)
> +  endif()
> +  llvm_add_library(${name} ${ARG_ENABLE_SHARED} ${ARG_UNPARSED_ARGUMENTS} 
> ${srcs})
>
>if(TARGET ${name})
>  target_link_libraries(${name} ${cmake_2_8_12_INTERFACE} 
> ${LLVM_COMMON_LIBS})
>
>  if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "libclang")
>install(TARGETS ${name}
> +COMPONENT ${name}
>  EXPORT ClangTargets
>  LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
>  ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
>  RUNTIME DESTINATION bin)
> +
> +  if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
> +add_custom_target(install-${name}
> +  DEPENDS ${name}
> +  COMMAND "${CMAKE_COMMAND}"
> +  -DCMAKE_INSTALL_COMPONENT=${name}
> +  -P 
> "${CMAKE_BINARY_DIR}/cmake_install.cmake")
> +  endif()
>  endif()
>  set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
>else()
> @@ -451,6 +463,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
>  endif()
>
>  install(DIRECTORY include/clang-c
> +  COMPONENT libclang
>DESTINATION include
>FILES_MATCHING
>PATTERN "*.h"
>
> Modified: cfe/trunk/tools/c-index-test/CMakeLists.txt
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/CMakeLists.txt?rev=252836&r1=252835&r2=252836&view=diff
> ==
> --- cfe/trunk/tools/c-index-test/CMakeLists.txt (original)
> +++ cfe/trunk/tools/c-index-test/CMakeLists.txt Wed Nov 11 18:46:57 2015
> @@ -28,3 +28,12 @@ if (CLANG_HAVE_LIBXML)
>include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR})
>target_link_libraries(c-index-test ${LIBXML2_LIBRARIES})
>  endif()
> +
> +install(TARGETS c-index-test
> +  RUNTIME DESTINATION local/bin
> +  COMPONENT c-index-test)
> +add_custom_target(install-c-index-test
> +  DEPENDS c-index-test
> +  COMMAND "${CMAKE_COMMAND}"
> +  -DCMAKE_INSTALL_COMPONENT=c-index-test
> +  -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
>
> Modified: cfe/trunk/tools/libclang/CMakeLists.txt
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CMakeLists.txt?rev=252836&r1=252835&r2=252836&view=diff
> ==
> --- cfe/trunk/tools/libclang/CMakeLists.txt (original)
> +++ cfe/trunk/tools/libclang/CMakeLists.txt Wed Nov 11 18:46:57 2015
> @@ -102,18 +102,16 @@ if(ENABLE_SHARED)
>PROPERTIES
>VERSION ${LIBCLANG_LIBRARY_VERSION}
>DEFINE_SYMBOL _CINDEX_LIB_)
> -  else()
> -set_target_properties(libclang
> -  PROPERTIES
> -  VERSION ${LIBCLANG_LIBRARY_VERSION}
> -  DEFINE_SYMBOL _CINDEX_LIB_)
> -  endif()
> -
> -  if(APPLE)
> +  elseif(APPLE)
>  set(LIBCLANG_LINK_FLAGS " -Wl,-compatibility_version -Wl,1")
>  set(LIBCLANG_LINK_FLAGS "${LIBCLANG_LINK_FLAGS} -Wl,-current_version 
> -Wl,${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
>
>  set_property(TARGET libclang APPEND_STRING PROPERTY
>   LINK_FLAGS ${LIBCLANG_LINK_FLAGS})
> +  else()
> +set_target_properties(libclang
> +  PROPERTIES
> +  VERSION ${LIBCLANG_LIBRARY_VERSION}
> +  DEFINE_SYMBOL _CINDEX_LIB_)
>endif()
>  endif()
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llv

r252901 - Re-recommit: Add support for the new mips-mti-linux toolchain.

2015-11-12 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Thu Nov 12 09:26:54 2015
New Revision: 252901

URL: http://llvm.org/viewvc/llvm-project?rev=252901&view=rev
Log:
Re-recommit: Add support for the new mips-mti-linux toolchain.

Last time, this caused two Windows buildbots and a single ARM buildbot to fail.
I XFAIL'd the failing test on win32,win64 machines in order to see if the ARM
buildbot complains again.

Added:
cfe/trunk/test/Driver/Inputs/mips_mti_linux/
cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/
cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/
cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.so

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.so
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crt1.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crti.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crtn.o
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crt1.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crti.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crtn.o
cfe/trunk/test/Driver/mips-mti-linux.c
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=252901&r1=252900&r2=252901&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Thu Nov 12 09:26:54 2015
@@ -2154,6 +2154,11 @@ void Driver::generatePrefixedToolNames(
   // FIXME: Needs a better variable than DefaultTargetTriple
   Names.emplace_back(DefaultTargetTriple + "-" + Tool);
   Names.emplace_back(Tool);
+
+  // Allow the discovery of tools prefixed with LLVM's default target triple.
+  std::string LLVMDefaultTargetTriple = llvm::sys::getDefaultTargetTriple();
+  if (LLVMDefaultTargetTriple != DefaultTargetTriple)
+Names.emplace_back(LLVMDefaultTargetTriple + "-" + Tool);
 }
 
 static bool ScanDirForExecutable(SmallString<128> &Dir,
@@ -2251,6 +2256,9 @@ const ToolChain &Driver::getToolChain(co
 case llvm::Triple::Linux:
   if (Target.getArch() == llvm::Triple::hexagon)
 TC = new toolchains::HexagonToolChain(*this, Target, Args);
+  else if ((Target.getVendor() == llvm::Triple::MipsTechnologies) &&
+   !Target.hasEnvironment())
+TC = new toolchains::MipsLLVMToolChain(*this, Target, Args);
   else
 TC = new toolchains::Linux(*this, Target, Args);
   break;

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=252901&r1=252900&r2=252901&view=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Thu Nov 12 09:26:54 2015
@@ -333,7 +333,6 @@ Tool *ToolChain::SelectTool(const JobAct
 
 std::string ToolChain::GetFilePath(const char *Name) const {
   return D.GetFilePath(Name, *this);
-
 }
 
 std::string ToolChain::GetProgramPath(const char *Name) const {

Modified: cf

r252900 - Silencing an MSVC warning about linkage specifications and C-incompatible UDTs by moving a function definition out of an extern "C" block.

2015-11-12 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Thu Nov 12 09:25:06 2015
New Revision: 252900

URL: http://llvm.org/viewvc/llvm-project?rev=252900&view=rev
Log:
Silencing an MSVC warning about linkage specifications and C-incompatible UDTs 
by moving a function definition out of an extern "C" block.

Modified:
cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=252900&r1=252899&r2=252900&view=diff
==
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Thu Nov 12 09:25:06 2015
@@ -3538,6 +3538,26 @@ static SourceLocation getLocationFromExp
   return E->getLocStart();
 }
 
+static std::string getMangledStructor(std::unique_ptr &M,
+  std::unique_ptr &DL,
+  const NamedDecl *ND,
+  unsigned StructorType) {
+  std::string FrontendBuf;
+  llvm::raw_string_ostream FOS(FrontendBuf);
+
+  if (const auto *CD = dyn_cast_or_null(ND))
+M->mangleCXXCtor(CD, static_cast(StructorType), FOS);
+  else if (const auto *DD = dyn_cast_or_null(ND))
+M->mangleCXXDtor(DD, static_cast(StructorType), FOS);
+
+  std::string BackendBuf;
+  llvm::raw_string_ostream BOS(BackendBuf);
+
+  llvm::Mangler::getNameWithPrefix(BOS, llvm::Twine(FOS.str()), *DL);
+
+  return BOS.str();
+}
+
 extern "C" {
 
 unsigned clang_visitChildren(CXCursor parent,
@@ -3911,26 +3931,6 @@ CXString clang_Cursor_getMangling(CXCurs
   return cxstring::createDup(FinalBufOS.str());
 }
 
-static std::string getMangledStructor(std::unique_ptr &M,
-  std::unique_ptr &DL,
-  const NamedDecl *ND,
-  unsigned StructorType) {
-  std::string FrontendBuf;
-  llvm::raw_string_ostream FOS(FrontendBuf);
-
-  if (const auto *CD = dyn_cast_or_null(ND))
-M->mangleCXXCtor(CD, static_cast(StructorType), FOS);
-  else if (const auto *DD = dyn_cast_or_null(ND))
-M->mangleCXXDtor(DD, static_cast(StructorType), FOS);
-
-  std::string BackendBuf;
-  llvm::raw_string_ostream BOS(BackendBuf);
-
-  llvm::Mangler::getNameWithPrefix(BOS, llvm::Twine(FOS.str()), *DL);
-
-  return BOS.str();
-}
-
 CXStringSet *clang_Cursor_getCXXManglings(CXCursor C) {
   if (clang_isInvalid(C.kind) || !clang_isDeclaration(C.kind))
 return nullptr;


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


Re: [PATCH] D9600: Add scan-build python implementation

2015-11-12 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

If you you're familiar with git, I'm asking you to: squash, rebase, and `git 
diff -U999`, then upload the resulting patch.

If you use svn, I'm asking you to: `svn diff -r$(FirstCommit):$(LastCommit) 
--diff-cmd=diff -x -U999`, and upload that.

The reason to squash all your patches together is that partial diffs from a 
patch series don't work well with Phabricator's "Revision Update History" tool. 
Also, it makes it hard to pull out a patch that I can apply on my local tree to 
try it out.


http://reviews.llvm.org/D9600



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


Re: [PATCH] D14560: [Clang] Fix Clang-tidy modernize-use-auto in some files in lib/AST; other minor cleanups.

2015-11-12 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: lib/AST/ASTContext.cpp:7930
@@ -7931,3 +7929,3 @@
 
-ASTMutationListener::~ASTMutationListener() { }
+ASTMutationListener::~ASTMutationListener() = default;
 

Eugene.Zelenko wrote:
> aaron.ballman wrote:
> > This is... interesting. Explicitly defaulting an out-of-line function 
> > definition is not something I've ever encountered before. What benefit does 
> > this provide?
> It's explicitly tells that destructor has default implementation.
I'm not certain this is an improvement. Using =default in the declaration is an 
improvement because it tells the compiler up front "this has the default 
implementation" and the compiler can benefit from that information in other 
ways. When it's on an out-of-line definition, it does say "this has the default 
implementation", but it doesn't give the compiler any benefit over {}, so the 
only benefit is up to the reader of the code. I think someone can read {} to 
easily tell it is the default behavior, it is considerably shorter, and it 
doesn't cause anyone's eyes to trip over it wondering about the construct.


Repository:
  rL LLVM

http://reviews.llvm.org/D14560



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


Re: [PATCH] D12547: Add support for function attribute "disable_tail_calls"

2015-11-12 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: test/SemaCXX/attr-disable-tail-calls.cpp:2
@@ +1,3 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only %s
+
+class B {

Is this file missing an expected-no-diagnostics?


http://reviews.llvm.org/D12547



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


Re: [PATCH] D13746: [clang-tidy] add check cppcoreguidelines-pro-bounds-constant-array-index

2015-11-12 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Looks good with one comment.

Thank you!



Comment at: 
clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp:107
@@ +106,3 @@
+diag(Matched->getExprLoc(),
+ "array index %0 is before the beginning of the array")
+<< Index.toString(10);

To avoid confusion, I suggest explicitly stating that this is an std::array, 
not a regular array ("std::array<> index %0 is before ..."). Same for the 
message below.

Also, it's fine to have this in clang-tidy for now, but ultimately, it may be 
reasonable and more consistent to analyze this in Clang as a part of 
-Warray-bounds. However, I'm not sure whether it's better to make a 
library-specific warning in Clang or introduce some annotation to tell the 
compiler that it can statically check indexes using a certain expression, for 
example.


http://reviews.llvm.org/D13746



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


Re: [PATCH] D14517: Fix bug 25362 "cppcoreguidelines-pro-bounds-array-to-pointer-decay does not consider const"

2015-11-12 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Still LG.


http://reviews.llvm.org/D14517



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


Re: [PATCH] D12359: New warning -Wnonconst-parameter when a pointer parameter can be const

2015-11-12 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 40040.
danielmarjamaki added a comment.

Moved NonConstUse from VarDecl to ParmVarDecl to avoid waste of memory


http://reviews.llvm.org/D12359

Files:
  include/clang/AST/Decl.h
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseExpr.cpp
  lib/Parse/ParseStmt.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Serialization/ASTReaderDecl.cpp
  test/Analysis/NoReturn.m
  test/Analysis/bstring.c
  test/Analysis/casts.c
  test/Analysis/coverage.c
  test/Analysis/inlining/false-positive-suppression.c
  test/Analysis/inlining/inline-defensive-checks.c
  test/Analysis/inlining/path-notes.m
  test/Analysis/logical-ops.c
  test/Analysis/malloc.c
  test/Analysis/misc-ps-region-store.m
  test/Analysis/misc-ps.c
  test/Analysis/misc-ps.m
  test/Analysis/null-deref-ps.c
  test/Analysis/objc-boxing.m
  test/Analysis/pr22954.c
  test/Analysis/ptr-arith.c
  test/Analysis/retain-release-inline.m
  test/Analysis/retain-release.m
  test/Analysis/simple-stream-checks.c
  test/Analysis/stack-addr-ps.c
  test/Analysis/string.c
  test/Analysis/svalbuilder-logic.c
  test/Analysis/unix-fns.c
  test/CodeGen/builtins-arm-exclusive.c
  test/CodeGen/builtins-systemz.c
  test/FixIt/dereference-addressof.c
  test/Parser/MicrosoftExtensionsInlineAsm.c
  test/Parser/attributes.c
  test/Parser/declarators.c
  test/Parser/pointer-arithmetic.c
  test/Sema/annotate.c
  test/Sema/arm-neon-types.c
  test/Sema/atomic-ops.c
  test/Sema/builtin-assume-aligned.c
  test/Sema/builtin-assume.c
  test/Sema/builtins-arm-exclusive.c
  test/Sema/builtins-arm64-exclusive.c
  test/Sema/builtins.c
  test/Sema/builtins.cl
  test/Sema/c89.c
  test/Sema/compare.c
  test/Sema/crash-invalid-array.c
  test/Sema/empty1.c
  test/Sema/exprs.c
  test/Sema/function.c
  test/Sema/merge-decls.c
  test/Sema/ms-inline-asm.c
  test/Sema/pointer-subtract-compat.c
  test/Sema/transparent-union.c
  test/Sema/typecheck-binop.c
  test/Sema/typo-correction.c
  test/Sema/uninit-variables.c
  test/Sema/unused-expr.c
  test/Sema/varargs-x86-64.c
  test/Sema/warn-logical-not-compare.c
  test/Sema/warn-sizeof-arrayarg.c
  test/Sema/warn-strncat-size.c
  test/Sema/warn-thread-safety-analysis.c
  test/Sema/warn-type-safety-mpi-hdf5.c
  test/SemaObjC/nullability.m
  test/SemaObjC/uninit-variables.m
  test/SemaOpenCL/address-spaces.cl
  test/SemaOpenCL/cond.cl
  test/SemaOpenCL/event_t_overload.cl

Index: test/SemaOpenCL/event_t_overload.cl
===
--- test/SemaOpenCL/event_t_overload.cl
+++ test/SemaOpenCL/event_t_overload.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -verify -pedantic -Wno-nonconst-parameter -fsyntax-only
 
 void __attribute__((overloadable)) foo(event_t, __local char *); // expected-note {{candidate function not viable: no known conversion from '__global int *' to '__local char *' for 2nd argument}}
 void __attribute__((overloadable)) foo(event_t, __local float *); // expected-note {{candidate function not viable: no known conversion from '__global int *' to '__local float *' for 2nd argument}}
Index: test/SemaOpenCL/cond.cl
===
--- test/SemaOpenCL/cond.cl
+++ test/SemaOpenCL/cond.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -verify -pedantic -Wno-nonconst-parameter -fsyntax-only
 
 typedef unsigned char uchar;
 typedef unsigned char uchar2 __attribute__((ext_vector_type(2)));
Index: test/SemaOpenCL/address-spaces.cl
===
--- test/SemaOpenCL/address-spaces.cl
+++ test/SemaOpenCL/address-spaces.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -verify -pedantic -Wno-nonconst-parameter -fsyntax-only
 
 __constant int ci = 1;
 
Index: test/SemaObjC/uninit-variables.m
===
--- test/SemaObjC/uninit-variables.m
+++ test/SemaObjC/uninit-variables.m
@@ -36,7 +36,7 @@
   }
 }
 
-int test_abort_on_exceptions(int y, NSException *e, NSString *s, int *z, ...) {
+int test_abort_on_exceptions(int y, NSException *e, NSString *s, const int *z, ...) {
   int x; // expected-note {{initialize the variable 'x' to silence this warning}}
   if (y == 1) {
 va_list alist;
Index: test/SemaObjC/nullability.m
===
--- test/SemaObjC/nullability.m
+++ test/SemaObjC/nullability.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fblocks -Woverriding-method-mismatch -Wno-nullability-declspec %s -verify
+// RUN: %clang_cc1 -fsyntax-only -fblocks -Woverriding-method-mismatch -Wno-nullability-declspec -Wno-nonconst-parameter %s -verify
 
 __attribute__((objc_r

Re: [PATCH] D14570: Handle ARMv6KZ naming

2015-11-12 Thread Joerg Sonnenberger via cfe-commits
joerg added a comment.

The specific CPU was only chosen to match what the backend supported at the 
time. As long as the feature set is identical, it doesn't really matter.


http://reviews.llvm.org/D14570



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


r252890 - Fix c-index-test install path

2015-11-12 Thread Ismail Donmez via cfe-commits
Author: ismail
Date: Thu Nov 12 07:47:35 2015
New Revision: 252890

URL: http://llvm.org/viewvc/llvm-project?rev=252890&view=rev
Log:
Fix c-index-test install path

Modified:
cfe/trunk/tools/c-index-test/CMakeLists.txt

Modified: cfe/trunk/tools/c-index-test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/CMakeLists.txt?rev=252890&r1=252889&r2=252890&view=diff
==
--- cfe/trunk/tools/c-index-test/CMakeLists.txt (original)
+++ cfe/trunk/tools/c-index-test/CMakeLists.txt Thu Nov 12 07:47:35 2015
@@ -30,7 +30,7 @@ if (CLANG_HAVE_LIBXML)
 endif()
 
 install(TARGETS c-index-test
-  RUNTIME DESTINATION local/bin
+  RUNTIME DESTINATION bin
   COMPONENT c-index-test)
 add_custom_target(install-c-index-test
   DEPENDS c-index-test


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


Re: r252836 - [CMake] Setup an install component for libclang and c-index-test.

2015-11-12 Thread Ismail Donmez via cfe-commits
Fixed in r252890

On Thu, Nov 12, 2015 at 2:17 PM, Ismail Donmez  wrote:

> Hi,
>
> On Thu, Nov 12, 2015 at 2:46 AM, Argyrios Kyrtzidis via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> --- cfe/trunk/tools/c-index-test/CMakeLists.txt (original)
>> +++ cfe/trunk/tools/c-index-test/CMakeLists.txt Wed Nov 11 18:46:57 2015
>> @@ -28,3 +28,12 @@ if (CLANG_HAVE_LIBXML)
>>include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR})
>>target_link_libraries(c-index-test ${LIBXML2_LIBRARIES})
>>  endif()
>> +
>> +install(TARGETS c-index-test
>> +  RUNTIME DESTINATION local/bin
>> +  COMPONENT c-index-test)
>>
>
> This doesn't look right, all of the llvm/clang install binaries under
> $PREFIX/bin, with this change c-index-test is going under $PREFIX/local/bin
>
> ismail
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14582: [clang-tidy] cppcoreguidelines-pro-bounds-pointer-arithmetic: ignore generated pointer arithmetic

2015-11-12 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

It may be more effective to filter out expressions that operate on implicit 
variables, e.g. by adding this constraint to the binaryOperator matcher:

  unless(hasLHS(ignoringImpCasts(declRefExpr(to(isImplicit())

(maybe also for RHS).

The benefit of this would be that it doesn't use hasAncestor/hasDescendant 
which can be rather expensive.


http://reviews.llvm.org/D14582



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


[PATCH] D14609: [ARM,AArch64] Fix __rev16l and __rev16ll intrinsics

2015-11-12 Thread Oliver Stannard via cfe-commits
olista01 created this revision.
olista01 added a subscriber: cfe-commits.
olista01 set the repository for this revision to rL LLVM.
Herald added subscribers: rengolin, aemerson.

These two intrinsics are defined in arm_acle.h.

__rev16l needs to rotate by 16 bits, bit it was actually rotating by 2 bits. 
For AArch64, where long is 64 bits, this would still be wrong.

__rev16ll was incorrect, it reversed the bytes in each 32-bit word, rather than 
each 16-bit halfword. The correct implementation is to apply __rev16 to the top 
and bottom words of the 64-bit value.

For AArch32 targets, these get compiled down to the hardware rev16 instruction 
at -O1 and above. For AArch64 targets, the 64-bit ones get compiled to two 
32-bit rev16 instructions, because there is not currently a pattern for the 
64-bit rev16 instruction.

Repository:
  rL LLVM

http://reviews.llvm.org/D14609

Files:
  lib/Headers/arm_acle.h
  test/CodeGen/arm_acle.c

Index: test/CodeGen/arm_acle.c
===
--- test/CodeGen/arm_acle.c
+++ test/CodeGen/arm_acle.c
@@ -186,27 +186,53 @@
 
 // ARM-LABEL: test_rev16
 // ARM: llvm.bswap
-// ARM: lshr
-// ARM: shl
+// ARM: lshr {{.*}}, 16
+// ARM: shl {{.*}}, 16
 // ARM: or
 uint32_t test_rev16(uint32_t t) {
   return __rev16(t);
 }
 
 // ARM-LABEL: test_rev16l
-// ARM: llvm.bswap
-// ARM: lshr
-// ARM: shl
-// ARM: or
+// AArch32: llvm.bswap
+// AArch32: lshr {{.*}}, 16
+// AArch32: shl {{.*}}, 16
+// AArch32: or
+// AArch64: [[T1:%.*]] = lshr i64 [[IN:%.*]], 32
+// AArch64: [[T2:%.*]] = trunc i64 [[T1]] to i32
+// AArch64: [[T3:%.*]] = tail call i32 @llvm.bswap.i32(i32 [[T2]])
+// AArch64: [[T4:%.*]] = lshr i32 [[T3]], 16
+// AArch64: [[T5:%.*]] = shl i32 [[T3]], 16
+// AArch64: [[T6:%.*]] = or i32 [[T5]], [[T4]]
+// AArch64: [[T7:%.*]] = zext i32 [[T6]] to i64
+// AArch64: [[T8:%.*]] = shl nuw i64 [[T7]], 32
+// AArch64: [[T9:%.*]] = trunc i64 [[IN]] to i32
+// AArch64: [[T10:%.*]] = tail call i32 @llvm.bswap.i32(i32 [[T9]])
+// AArch64: [[T11:%.*]] = lshr i32 [[T10]], 16
+// AArch64: [[T12:%.*]] = shl i32 [[T10]], 16
+// AArch64: [[T13:%.*]] = or i32 [[T12]], [[T11]]
+// AArch64: [[T14:%.*]] = zext i32 [[T13]] to i64
+// AArch64: [[T15:%.*]] = or i64 [[T8]], [[T14]]
 long test_rev16l(long t) {
   return __rev16l(t);
 }
 
 // ARM-LABEL: test_rev16ll
-// ARM: llvm.bswap
-// ARM: lshr
-// ARM: shl
-// ARM: or
+// ARM: [[T1:%.*]] = lshr i64 [[IN:%.*]], 32
+// ARM: [[T2:%.*]] = trunc i64 [[T1]] to i32
+// ARM: [[T3:%.*]] = tail call i32 @llvm.bswap.i32(i32 [[T2]])
+// ARM: [[T4:%.*]] = lshr i32 [[T3]], 16
+// ARM: [[T5:%.*]] = shl i32 [[T3]], 16
+// ARM: [[T6:%.*]] = or i32 [[T5]], [[T4]]
+// ARM: [[T7:%.*]] = zext i32 [[T6]] to i64
+// ARM: [[T8:%.*]] = shl nuw i64 [[T7]], 32
+// ARM: [[T9:%.*]] = trunc i64 [[IN]] to i32
+// ARM: [[T10:%.*]] = tail call i32 @llvm.bswap.i32(i32 [[T9]])
+// ARM: [[T11:%.*]] = lshr i32 [[T10]], 16
+// ARM: [[T12:%.*]] = shl i32 [[T10]], 16
+// ARM: [[T13:%.*]] = or i32 [[T12]], [[T11]]
+// ARM: [[T14:%.*]] = zext i32 [[T13]] to i64
+// ARM: [[T15:%.*]] = or i64 [[T8]], [[T14]]
 uint64_t test_rev16ll(uint64_t t) {
   return __rev16ll(t);
 }
Index: lib/Headers/arm_acle.h
===
--- lib/Headers/arm_acle.h
+++ lib/Headers/arm_acle.h
@@ -175,14 +175,18 @@
   return __ror(__rev(t), 16);
 }
 
-static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
-  __rev16l(unsigned long t) {
-return __rorl(__revl(t), sizeof(long) / 2);
-}
-
 static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
   __rev16ll(uint64_t t) {
-  return __rorll(__revll(t), 32);
+  return (((uint64_t)__rev16(t >> 32)) << 32) | __rev16(t);
+}
+
+static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
+  __rev16l(unsigned long t) {
+#if __SIZEOF_LONG__ == 4
+return __rev16(t);
+#else
+return __rev16ll(t);
+#endif
 }
 
 /* REVSH */


Index: test/CodeGen/arm_acle.c
===
--- test/CodeGen/arm_acle.c
+++ test/CodeGen/arm_acle.c
@@ -186,27 +186,53 @@
 
 // ARM-LABEL: test_rev16
 // ARM: llvm.bswap
-// ARM: lshr
-// ARM: shl
+// ARM: lshr {{.*}}, 16
+// ARM: shl {{.*}}, 16
 // ARM: or
 uint32_t test_rev16(uint32_t t) {
   return __rev16(t);
 }
 
 // ARM-LABEL: test_rev16l
-// ARM: llvm.bswap
-// ARM: lshr
-// ARM: shl
-// ARM: or
+// AArch32: llvm.bswap
+// AArch32: lshr {{.*}}, 16
+// AArch32: shl {{.*}}, 16
+// AArch32: or
+// AArch64: [[T1:%.*]] = lshr i64 [[IN:%.*]], 32
+// AArch64: [[T2:%.*]] = trunc i64 [[T1]] to i32
+// AArch64: [[T3:%.*]] = tail call i32 @llvm.bswap.i32(i32 [[T2]])
+// AArch64: [[T4:%.*]] = lshr i32 [[T3]], 16
+// AArch64: [[T5:%.*]] = shl i32 [[T3]], 16
+// AArch64: [[T6:%.*]] = or i32 [[T5]], [[T4]]
+// AArch64: [[T7:%.*]] = zext i32 [[T6]] to i64
+// AArch64: [[T8:%.*]] = shl nuw i64 [[T7]], 32
+// AArch64: [[T9:%.*]] = tru

Re: r252836 - [CMake] Setup an install component for libclang and c-index-test.

2015-11-12 Thread Ismail Donmez via cfe-commits
Hi,

On Thu, Nov 12, 2015 at 2:46 AM, Argyrios Kyrtzidis via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> --- cfe/trunk/tools/c-index-test/CMakeLists.txt (original)
> +++ cfe/trunk/tools/c-index-test/CMakeLists.txt Wed Nov 11 18:46:57 2015
> @@ -28,3 +28,12 @@ if (CLANG_HAVE_LIBXML)
>include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR})
>target_link_libraries(c-index-test ${LIBXML2_LIBRARIES})
>  endif()
> +
> +install(TARGETS c-index-test
> +  RUNTIME DESTINATION local/bin
> +  COMPONENT c-index-test)
>

This doesn't look right, all of the llvm/clang install binaries under
$PREFIX/bin, with this change c-index-test is going under $PREFIX/local/bin

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


r252872 - Update clang regression tests for 'norecurse'

2015-11-12 Thread James Molloy via cfe-commits
Author: jamesm
Date: Thu Nov 12 04:56:51 2015
New Revision: 252872

URL: http://llvm.org/viewvc/llvm-project?rev=252872&view=rev
Log:
Update clang regression tests for 'norecurse'

FunctionAttrs has just been taught how to infer 'norecurse'. Update clang tests 
for LLVM r252871.

Modified:
cfe/trunk/test/CodeGen/attr-minsize.cpp
cfe/trunk/test/CodeGen/function-attributes.c
cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp
cfe/trunk/test/CodeGenCXX/member-initializers.cpp
cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp

Modified: cfe/trunk/test/CodeGen/attr-minsize.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/attr-minsize.cpp?rev=252872&r1=252871&r2=252872&view=diff
==
--- cfe/trunk/test/CodeGen/attr-minsize.cpp (original)
+++ cfe/trunk/test/CodeGen/attr-minsize.cpp Thu Nov 12 04:56:51 2015
@@ -76,4 +76,4 @@ void test5(float arg);
 
 // Oz: attributes [[MINSIZE]] = { minsize{{.*}} }
 
-// OTHER: attributes [[MS]] = { minsize nounwind{{.*}} }
+// OTHER: attributes [[MS]] = { minsize {{(norecurse )?}}nounwind{{.*}} }

Modified: cfe/trunk/test/CodeGen/function-attributes.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/function-attributes.c?rev=252872&r1=252871&r2=252872&view=diff
==
--- cfe/trunk/test/CodeGen/function-attributes.c (original)
+++ cfe/trunk/test/CodeGen/function-attributes.c Thu Nov 12 04:56:51 2015
@@ -128,9 +128,9 @@ void f20(void) {
   _setjmp(0);
 }
 
-// CHECK: attributes [[NUW]] = { nounwind optsize readnone{{.*}} }
-// CHECK: attributes [[AI]] = { alwaysinline nounwind optsize readnone{{.*}} }
-// CHECK: attributes [[ALIGN]] = { nounwind optsize readnone 
alignstack=16{{.*}} }
+// CHECK: attributes [[NUW]] = { norecurse nounwind optsize readnone{{.*}} }
+// CHECK: attributes [[AI]] = { alwaysinline norecurse nounwind optsize 
readnone{{.*}} }
+// CHECK: attributes [[ALIGN]] = { norecurse nounwind optsize readnone 
alignstack=16{{.*}} }
 // CHECK: attributes [[RT]] = { nounwind optsize returns_twice{{.*}} }
 // CHECK: attributes [[NR]] = { noreturn nounwind optsize }
 // CHECK: attributes [[NUW_RN]] = { nounwind optsize readnone }

Modified: cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp?rev=252872&r1=252871&r2=252872&view=diff
==
--- cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp Thu Nov 12 
04:56:51 2015
@@ -35,4 +35,4 @@ int f() {
   return count;
 }
 
-// CHECK: attributes [[NUW]] = { nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { norecurse nounwind{{.*}} }

Modified: cfe/trunk/test/CodeGenCXX/member-initializers.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/member-initializers.cpp?rev=252872&r1=252871&r2=252872&view=diff
==
--- cfe/trunk/test/CodeGenCXX/member-initializers.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/member-initializers.cpp Thu Nov 12 04:56:51 2015
@@ -32,4 +32,4 @@ int test_fold() {
   return A(2).i;
 }
 
-// CHECK: attributes [[NUW_RN]] = { nounwind readnone{{.*}} }
+// CHECK: attributes [[NUW_RN]] = { norecurse nounwind readnone{{.*}} }

Modified: cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp?rev=252872&r1=252871&r2=252872&view=diff
==
--- cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp Thu Nov 12 04:56:51 
2015
@@ -295,4 +295,4 @@ U u;
 // CHECK-GLOBAL: @_ZN11IndirectPDM1uE = global %"union.IndirectPDM::U" { 
%union.anon { i64 -1 } }, align 8
 }
 
-// CHECK-O3: attributes [[NUW]] = { nounwind readnone{{.*}} }
+// CHECK-O3: attributes [[NUW]] = { norecurse nounwind readnone{{.*}} }


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


Re: [PATCH] D14471: [AArch64] Fix a crash in driver

2015-11-12 Thread Renato Golin via cfe-commits
rengolin added a comment.

In http://reviews.llvm.org/D14471#287635, @ahatanak wrote:

> I didn't include a test case because I didn't know how to write a test that 
> passes on an aarch64 host and fails on anything else. Do you know of any test 
> cases in trunk that pass or fail depending on which host it is running on?


It's possible to do something with the python config, though I don't know how.

> Wouldn't it break on an aarch64 host? With "-mtune=native", the current code 
> in trunk will get the host cpu name (which I believe is currently always 
> "generic" for aarch64). But if I apply this patch, it will error out because 
> "native" is not a valid cpu name.


That's my point. It shouldn't break.

If you can get the CPU name, return it. If not, return "native". If you're on 
AArch64 and you can't get the CPU name, that's a bug that needs fixing. If it's 
always "generic", that's another piece of code that needs fixing. If whatever 
getCPU function you use doesn't return a valid name, and the name chosen was 
"native", you should return "native".

--renato


http://reviews.llvm.org/D14471



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


[libcxx] r252870 - [libcxx] Fixup a few fumbles in the initial no-exceptions XFAILs list.

2015-11-12 Thread Asiri Rathnayake via cfe-commits
Author: asiri
Date: Thu Nov 12 04:41:57 2015
New Revision: 252870

URL: http://llvm.org/viewvc/llvm-project?rev=252870&view=rev
Log:
[libcxx] Fixup a few fumbles in the initial no-exceptions XFAILs list.

The initial buildbot run found a few missing bits in the initial XFAIL list
for the no-exceptions libc++ variant. These discrepancies are as follows:

[1] Following two tests need XFAILs on the no-exceptions library variant.
My local runs had these two disabled for other reasons (unsupported):

  - localization/locales/locale/locale.cons/char_pointer.pass.cpp
  - numerics/complex.number/complex.ops/complex_divide_complex.pass.cpp

[2] These three does not need XFAILs, they were failing on my local runs for
other reasons:

  - depr/depr.c.headers/uchar_h.pass.cpp
  - input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp
  - .../category.collate/locale.collate.byname/transform.pass.cpp

(these are failing on my box for the default build as well)

The current patch fixes both the cases above. Additionally, I've run the
following scan to make sure I've covered all the cases:

> grep ' catch \| try \| throw ' -R . | perl -pe 's|(.*?):.*|\1|' | sort | \
  uniq > 1.txt
> grep 'libcpp-no-exceptions' -R . | perl -pe 's|(.*?):.*|\1|' | sort | \
  uniq > 2.txt
> diff 1.txt 2.txt

This showed up a few extra interesting cases:

[3] These two tests do not use try/catch/throw statements, but they fail at
runtime. Need to be investigated, I've left the XFAILs in.

  - std/thread/futures/futures.shared_future/dtor.pass.cpp
  - std/thread/futures/futures.unique_future/dtor.pass.cpp

[4] These tests use a macro named TEST_HAS_NO_EXCEPTIONS to conditionally
exclude try/catch/throw statements when running without exceptions. I'm not
entirely sure why this was needed (AFAIK, we didn't have a no-exceptions
library build before). The macro's defintion is quite similar to that of
_LIBCPP_NO_EXCEPTIONS. I will investigate if this can be reused for my test
fixes or if it should be replaced with _LIBCPP_NO_EXCEPTIONS.

  - std/experimental/any/*

Change-Id: I9ad1e0edd78f305406eaa0ab148b1ab693f7e26a

Modified:
libcxx/trunk/test/std/depr/depr.c.headers/uchar_h.pass.cpp

libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp

libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp

libcxx/trunk/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp

libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_divide_complex.pass.cpp

Modified: libcxx/trunk/test/std/depr/depr.c.headers/uchar_h.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/uchar_h.pass.cpp?rev=252870&r1=252869&r2=252870&view=diff
==
--- libcxx/trunk/test/std/depr/depr.c.headers/uchar_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/uchar_h.pass.cpp Thu Nov 12 
04:41:57 2015
@@ -9,7 +9,6 @@
 //
 // XFAIL: apple-darwin
 // XFAIL: newlib
-// XFAIL: libcpp-no-exceptions
 
 // 
 

Modified: 
libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp?rev=252870&r1=252869&r2=252870&view=diff
==
--- 
libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp
 Thu Nov 12 04:41:57 2015
@@ -7,6 +7,7 @@
 //
 
//===--===//
 
+// XFAIL: libcpp-no-exceptions
 // REQUIRES: locale.en_US.UTF-8
 // REQUIRES: locale.fr_FR.UTF-8
 

Modified: 
libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp?rev=252870&r1=252869&r2=252870&view=diff
==
--- 
libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp
 Thu Nov 12 04:41:57 2015
@@ -7,7 +7,6 @@
 //
 
//===--===//
 
-// XFAIL: libcpp-no-exceptions
 // 
 
 // template  class collate_byname

Modified: 
libcxx/trunk/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp?re

Re: [PATCH] D14203: [analyzer] Improve pointer arithmetic checker.

2015-11-12 Thread Gábor Horváth via cfe-commits
xazax.hun added inline comments.


Comment at: lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp:28
@@ -24,1 +27,3 @@
 namespace {
+enum class AllocKind {
+  SingletonNew,

dcoughlin wrote:
> Is it necessary to distinguish so many cases here? For example, why do we 
> need to distinguish between PlacementNew and OverloadedNew?
> 
> Another thought: given the expense of tracking stuff in the GDM could we 
> instead track whether pointer arithmetic is explicitly disallowed for a given 
> region? Then we wouldn't have to track any data for the "good" pointers.
> 
> Also, how does AllocKind relate to the AllocationFamily from MallocChecker? 
> Could that checker's state be used so we don't have to track any additional 
> information here?
> 
> If you do keep AllocKind, I think it would be good to add a comment 
> describing how this enum is used and the intended meaning of each element.
I think this way it is more explicit that we are not going to reason about 
PlacementNew and OverLoadedNew. Turning this information into comments and 
reduce the number of elements of the enum is fine. I am going to do that. 

Storing information only for singletons or only for arrays seems like a good 
idea for me. However it is possible that there are more pointers for single 
objects than arrays? In this case it would be better to store data only for 
"good" pointers.

AllocationFamily does not distinguish placement and overloaded new for 
instance. The current approach to this checker is to be conservative and do not 
try to reason about them. Other than that in the future I planned to add 
heuristics when a malloc call is likely to allocate and array and when it is 
likely to allocate a single object (heuristics on the AST). The 
AllocationFamily do not distinguish these cases.   
 


Comment at: lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp:29
@@ +28,3 @@
+enum class AllocKind {
+  SingletonNew,
+  ArrayNew,

dcoughlin wrote:
> I'm not sure "singleton" is the right term here. I associate "singleton" with 
> the design pattern of only having a single instance of a class allocated at a 
> given time (a form of global shared state).  Also, SingletonMalloc doesn't 
> appear to be used anywhere.
What about SingleObjectNew? Currently this checker does not reason about 
malloced pointers, because it does not distinguish the case where the malloc is 
used to allocate an array and where it is used to allocate a single object. I 
was planning to do this classification based on some heuristics on AST 
matching. 


Comment at: lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp:88
@@ -28,1 +87,3 @@
+  mutable std::unique_ptr BT_polyArray;
+  mutable llvm::SmallVector AllocFunctions;
 

dcoughlin wrote:
> I think it would be better to use llvm::SmallSet here.
I will change that, thanks.


Comment at: lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp:137
@@ -43,2 +136,3 @@
 
-  const MemRegion *LR = LV.getAsRegion();
+const MemRegion *PointerArithChecker::getArrayRegion(const MemRegion *Region,
+ bool &Polymorphic,

dcoughlin wrote:
> I think it would be good to add a doc comment for this function describing 
> what the function does and its parameters as well as whether they are input 
> or output parameters.
> 
> I also wonder if this logic is better expressed as a loop rather than 
> recursion. What do you think?
I will rewrite it without recursion and check the results but I suspect that 
you are right.


Comment at: lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp:150
@@ +149,3 @@
+return getArrayRegion(Region, Polymorphic, AKind, C);
+  default:
+break;

dcoughlin wrote:
> In general, I think it is better to avoid default in cases like these so that 
> when an enum case is added the compiler issues a warning and thus forces the 
> person adding the change to think about what the behavior of the new case 
> should be.
I will enumerate the rest of the kinds here.


Comment at: lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp:198
@@ +197,3 @@
+this, "Dangerous pointer arithmetic",
+"Pointer arithmetic does not account for polymorphic object sizes "
+"and attempting to perform pointer arithmetic on a polymorphic "

dcoughlin wrote:
> I think "polymorphic" is a bit jargony.  Can this diagnostic be explained in 
> terms of base and derived classes?
Sure, I will try to come up with something.


http://reviews.llvm.org/D14203



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


Re: [PATCH] D14203: [analyzer] Improve pointer arithmetic checker.

2015-11-12 Thread Gábor Horváth via cfe-commits
xazax.hun added a comment.

In http://reviews.llvm.org/D14203#287303, @dcoughlin wrote:

> Gabor,
>
> This is an alpha checker. Do you anticipate turning it on by default?
>
> Comments inline.


I could see two kinds of false positives with this checker when running this on 
the LLVM codebase.

When objects are allocated in a way that one object is allocated together with 
an array (the array is after the original object in), and the object contains 
getter code like:

  reinterpret_cast(this + 1);

When a function is written like this:

  Obj* f() {
  if (opaqueCond)
  return singleObject;
  return array;
  }

And used like this:

  f()[5];

Other then these two cases I think the results are good.


http://reviews.llvm.org/D14203



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


Re: [PATCH] D9600: Add scan-build python implementation

2015-11-12 Thread Laszlo Nagy via cfe-commits
rizsotto.mailinglist added a comment.

In http://reviews.llvm.org/D9600#287157, @jroelofs wrote:

> Would you mind re-uploading this patch as a diff against upstream trunk with 
> full context?


i'm not sure i do understand what do you ask. i wish i could upload these 
changes as a single patch, but don't know is that possible?


http://reviews.llvm.org/D9600



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