Re: [PATCH] D22584: constexpr array support C++1z (P0031)

2016-08-31 Thread Marshall Clow via cfe-commits
mclow.lists added a comment.

Other than the iterator.primitives/iterator.operations/prev.pass.cpp test, I 
think this is good to go.



Comment at: 
test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp:47
@@ +46,3 @@
+
+{
+constexpr const char* s = "1234567890";

Won't this fail on C++11 (i.e, doesn't it need a `#if TEST_STD_VER > 14`)?



https://reviews.llvm.org/D22584



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


[PATCH] D24119: [libc++] add linker option "-Wl, -z, defs" in standalone build

2016-08-31 Thread Lei Zhang via cfe-commits
zlei created this revision.
zlei added a reviewer: cfe-commits.

This option is used to avoid underlinking. It's available in LLVM's main tree, 
but not in a standalone build of libc++. This patch ensures the option is 
passed in whether libc++ is built in-tree or out-of-tree.

https://reviews.llvm.org/D24119

Files:
  CMakeLists.txt

Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -305,6 +305,18 @@
 # so they don't get transformed into -Wno and -errors respectivly.
 remove_flags(-Wno-pedantic -pedantic-errors -pedantic)
 
+# FIXME: this is cribbed from HandleLLVMOptions.cmake.
+if(LIBCXX_STANDALONE_BUILD)
+  # Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO
+  # build might work on ELF but fail on MachO/COFF.
+  if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32 OR CYGWIN OR
+  ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
+  ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") AND
+ NOT LLVM_USE_SANITIZER)
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
+  endif()
+endif()
+
 # Required flags ==
 set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build 
dialect")
 add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER})


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -305,6 +305,18 @@
 # so they don't get transformed into -Wno and -errors respectivly.
 remove_flags(-Wno-pedantic -pedantic-errors -pedantic)
 
+# FIXME: this is cribbed from HandleLLVMOptions.cmake.
+if(LIBCXX_STANDALONE_BUILD)
+  # Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO
+  # build might work on ELF but fail on MachO/COFF.
+  if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32 OR CYGWIN OR
+  ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
+  ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") AND
+ NOT LLVM_USE_SANITIZER)
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
+  endif()
+endif()
+
 # Required flags ==
 set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build dialect")
 add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER})
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24110: [Sema] Don't diagnose an array type mismatch when the new or previous declaration has a dependent type

2016-08-31 Thread Akira Hatanaka via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL280330: [Sema] Don't diagnose an array type mismatch when 
the new or previous (authored by ahatanak).

Changed prior to commit:
  https://reviews.llvm.org/D24110?vs=69927=69935#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24110

Files:
  cfe/trunk/lib/Sema/SemaDecl.cpp
  cfe/trunk/test/SemaTemplate/array-redeclaration.cpp

Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -3367,11 +3367,11 @@
   // We are merging a variable declaration New into Old. If it has an array
   // bound, and that bound differs from Old's bound, we should diagnose the
   // mismatch.
-  if (!NewArray->isIncompleteArrayType()) {
+  if (!NewArray->isIncompleteArrayType() && !NewArray->isDependentType()) {
 for (VarDecl *PrevVD = Old->getMostRecentDecl(); PrevVD;
  PrevVD = PrevVD->getPreviousDecl()) {
   const ArrayType *PrevVDTy = 
Context.getAsArrayType(PrevVD->getType());
-  if (PrevVDTy->isIncompleteArrayType())
+  if (PrevVDTy->isIncompleteArrayType() || PrevVDTy->isDependentType())
 continue;
 
   if (!Context.hasSameType(NewArray, PrevVDTy))
Index: cfe/trunk/test/SemaTemplate/array-redeclaration.cpp
===
--- cfe/trunk/test/SemaTemplate/array-redeclaration.cpp
+++ cfe/trunk/test/SemaTemplate/array-redeclaration.cpp
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+extern int array[1];
+
+template 
+class C {
+  enum { D };
+public:
+  template  void foo1() {
+extern int array[((int)C::k > (int)D) ? 1 : -1];
+  }
+};
+
+template<>
+class C {
+public:
+  const static int k = 2;
+};
+
+void foo2() {
+  C c;
+  c.foo1();
+}
+
+template
+void foo3() {
+  extern int array[n ? 1 : -1];
+}
+
+void foo4() {
+  foo3<5>();
+}


Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -3367,11 +3367,11 @@
   // We are merging a variable declaration New into Old. If it has an array
   // bound, and that bound differs from Old's bound, we should diagnose the
   // mismatch.
-  if (!NewArray->isIncompleteArrayType()) {
+  if (!NewArray->isIncompleteArrayType() && !NewArray->isDependentType()) {
 for (VarDecl *PrevVD = Old->getMostRecentDecl(); PrevVD;
  PrevVD = PrevVD->getPreviousDecl()) {
   const ArrayType *PrevVDTy = Context.getAsArrayType(PrevVD->getType());
-  if (PrevVDTy->isIncompleteArrayType())
+  if (PrevVDTy->isIncompleteArrayType() || PrevVDTy->isDependentType())
 continue;
 
   if (!Context.hasSameType(NewArray, PrevVDTy))
Index: cfe/trunk/test/SemaTemplate/array-redeclaration.cpp
===
--- cfe/trunk/test/SemaTemplate/array-redeclaration.cpp
+++ cfe/trunk/test/SemaTemplate/array-redeclaration.cpp
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+extern int array[1];
+
+template 
+class C {
+  enum { D };
+public:
+  template  void foo1() {
+extern int array[((int)C::k > (int)D) ? 1 : -1];
+  }
+};
+
+template<>
+class C {
+public:
+  const static int k = 2;
+};
+
+void foo2() {
+  C c;
+  c.foo1();
+}
+
+template
+void foo3() {
+  extern int array[n ? 1 : -1];
+}
+
+void foo4() {
+  foo3<5>();
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r280335 - Fix libc++ configuration with -fsanitize-coverage

2016-08-31 Thread Ivan Krasin via cfe-commits
Author: krasin
Date: Wed Aug 31 20:38:32 2016
New Revision: 280335

URL: http://llvm.org/viewvc/llvm-project?rev=280335=rev
Log:
Fix libc++ configuration with -fsanitize-coverage

Summary:
a recent change (r280015) in libc++ configuration broke LibFuzzer bot:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/12245

It's not restricted just to that bot; any code that uses the sanitize coverage 
and configures libc++ hits it.

This CL fixes the issue.

Reviewers: compnerd

Subscribers: aizatsky

Differential Revision: https://reviews.llvm.org/D24116

Modified:
libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
libcxx/trunk/cmake/config-ix.cmake

Modified: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake?rev=280335=280334=280335=diff
==
--- libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake (original)
+++ libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake Wed Aug 31 20:38:32 2016
@@ -16,6 +16,9 @@ function(check_cxx_atomics varname)
   if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")
   endif()
+  if (CMAKE_C_FLAGS MATCHES -fsanitize-coverage OR CMAKE_CXX_FLAGS MATCHES 
-fsanitize-coverage)
+set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} 
-fno-sanitize-coverage=edge,trace-cmp,indirect-calls,8bit-counters")
+  endif()
   check_cxx_source_compiles("
 #include 
 #include 

Modified: libcxx/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/config-ix.cmake?rev=280335=280334=280335=diff
==
--- libcxx/trunk/cmake/config-ix.cmake (original)
+++ libcxx/trunk/cmake/config-ix.cmake Wed Aug 31 20:38:32 2016
@@ -27,6 +27,9 @@ if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
   if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")
   endif ()
+  if (CMAKE_C_FLAGS MATCHES -fsanitize-coverage OR CMAKE_CXX_FLAGS MATCHES 
-fsanitize-coverage)
+set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} 
-fno-sanitize-coverage=edge,trace-cmp,indirect-calls,8bit-counters")
+  endif ()
 endif ()
 
 include(CheckLibcxxAtomic)


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


r280333 - Fix typos in comments.

2016-08-31 Thread George Burgess IV via cfe-commits
Author: gbiv
Date: Wed Aug 31 20:26:58 2016
New Revision: 280333

URL: http://llvm.org/viewvc/llvm-project?rev=280333=rev
Log:
Fix typos in comments.

Modified:
cfe/trunk/lib/Sema/SemaExprObjC.cpp

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=280333=280332=280333=diff
==
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Wed Aug 31 20:26:58 2016
@@ -2645,7 +2645,7 @@ ExprResult Sema::BuildInstanceMessage(Ex
   CollectMultipleMethodsInGlobalPool(Sel, Methods, true/*InstanceFirst*/,
  true/*CheckTheOther*/, typeBound);
   if (!Methods.empty()) {
-// We chose the first method as the initial condidate, then try to
+// We choose the first method as the initial candidate, then try to
 // select a better one.
 Method = Methods[0];
 
@@ -2701,7 +2701,7 @@ ExprResult Sema::BuildInstanceMessage(Ex
false/*InstanceFirst*/,
true/*CheckTheOther*/);
 if (!Methods.empty()) {
-  // We chose the first method as the initial condidate, then try
+  // We choose the first method as the initial candidate, then try
   // to select a better one.
   Method = Methods[0];
 
@@ -2789,7 +2789,7 @@ ExprResult Sema::BuildInstanceMessage(Ex
  true/*InstanceFirst*/,
  false/*CheckTheOther*/);
   if (!Methods.empty()) {
-// We chose the first method as the initial condidate, then try
+// We choose the first method as the initial candidate, then 
try
 // to select a better one.
 Method = Methods[0];
 


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


[PATCH] D24115: [Clang] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes

2016-08-31 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko created this revision.
Eugene.Zelenko added reviewers: mehdi_amini, compnerd.
Eugene.Zelenko added a subscriber: cfe-commits.
Eugene.Zelenko set the repository for this revision to rL LLVM.

I checked this patch on my own build on RHEL 6. Regressions were OK.

Repository:
  rL LLVM

https://reviews.llvm.org/D24115

Files:
  lib/Lex/Lexer.cpp
  lib/Lex/LiteralSupport.cpp
  lib/Lex/PPDirectives.cpp
  lib/Lex/PPExpressions.cpp
  lib/Lex/PPMacroExpansion.cpp
  lib/Lex/Pragma.cpp
  lib/Lex/Preprocessor.cpp
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTWriter.cpp

Index: lib/Serialization/ASTWriter.cpp
===
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -16,18 +16,27 @@
 #include "ASTReaderInternals.h"
 #include "MultiOnDiskHashTable.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/ASTUnresolvedSet.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclContextInternals.h"
+#include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclFriend.h"
-#include "clang/AST/DeclLookups.h"
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
+#include "clang/AST/LambdaCapture.h"
+#include "clang/AST/NestedNameSpecifier.h"
+#include "clang/AST/RawCommentList.h"
+#include "clang/AST/TemplateName.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeLocVisitor.h"
 #include "clang/Basic/DiagnosticOptions.h"
 #include "clang/Basic/FileManager.h"
-#include "clang/Basic/FileSystemStatCache.h"
+#include "clang/Basic/FileSystemOptions.h"
+#include "clang/Basic/LangOptions.h"
+#include "clang/Basic/LLVM.h"
+#include "clang/Basic/Module.h"
+#include "clang/Basic/ObjCRuntime.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/SourceManagerInternals.h"
 #include "clang/Basic/TargetInfo.h"
@@ -37,28 +46,48 @@
 #include "clang/Lex/HeaderSearch.h"
 #include "clang/Lex/HeaderSearchOptions.h"
 #include "clang/Lex/MacroInfo.h"
+#include "clang/Lex/ModuleMap.h"
 #include "clang/Lex/PreprocessingRecord.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/PreprocessorOptions.h"
+#include "clang/Lex/Token.h"
 #include "clang/Sema/IdentifierResolver.h"
+#include "clang/Sema/ObjCMethodList.h"
 #include "clang/Sema/Sema.h"
+#include "clang/Sema/Weak.h"
 #include "clang/Serialization/ASTReader.h"
+#include "clang/Serialization/Module.h"
 #include "clang/Serialization/ModuleFileExtension.h"
 #include "clang/Serialization/SerializationDiagnostic.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/Hashing.h"
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/SmallSet.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/Bitcode/BitCodes.h"
 #include "llvm/Bitcode/BitstreamWriter.h"
+#include "llvm/Support/Casting.h"
 #include "llvm/Support/Compression.h"
 #include "llvm/Support/EndianStream.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/OnDiskHashTable.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
+#include "llvm/Support/raw_ostream.h"
 #include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 
 using namespace clang;
@@ -82,6 +111,7 @@
 //===--===//
 
 namespace clang {
+
   class ASTTypeWriter {
 ASTWriter 
 ASTRecordWriter Record;
@@ -126,6 +156,7 @@
 #define ABSTRACT_TYPE(Class, Base)
 #include "clang/AST/TypeNodes.def"
   };
+
 } // end namespace clang
 
 void ASTTypeWriter::VisitBuiltinType(const BuiltinType *T) {
@@ -503,6 +534,7 @@
 void TypeLocWriter::VisitQualifiedTypeLoc(QualifiedTypeLoc TL) {
   // nothing to do
 }
+
 void TypeLocWriter::VisitBuiltinTypeLoc(BuiltinTypeLoc TL) {
   Record.AddSourceLocation(TL.getBuiltinLoc());
   if (TL.needsExtraLocalData()) {
@@ -512,31 +544,40 @@
 Record.push_back(TL.hasModeAttr());
   }
 }
+
 void TypeLocWriter::VisitComplexTypeLoc(ComplexTypeLoc TL) {
   Record.AddSourceLocation(TL.getNameLoc());
 }
+
 void TypeLocWriter::VisitPointerTypeLoc(PointerTypeLoc TL) {
   Record.AddSourceLocation(TL.getStarLoc());
 }
+
 void TypeLocWriter::VisitDecayedTypeLoc(DecayedTypeLoc TL) {
   // nothing to do
 }
+
 void TypeLocWriter::VisitAdjustedTypeLoc(AdjustedTypeLoc TL) {
   // nothing to do
 }
+
 void TypeLocWriter::VisitBlockPointerTypeLoc(BlockPointerTypeLoc TL) {
   Record.AddSourceLocation(TL.getCaretLoc());
 }
+
 void TypeLocWriter::VisitLValueReferenceTypeLoc(LValueReferenceTypeLoc TL) {
   Record.AddSourceLocation(TL.getAmpLoc());
 }
+
 void TypeLocWriter::VisitRValueReferenceTypeLoc(RValueReferenceTypeLoc TL) {
   Record.AddSourceLocation(TL.getAmpAmpLoc());
 }
+
 void TypeLocWriter::VisitMemberPointerTypeLoc(MemberPointerTypeLoc TL) {
   

r280330 - [Sema] Don't diagnose an array type mismatch when the new or previous

2016-08-31 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Wed Aug 31 20:03:21 2016
New Revision: 280330

URL: http://llvm.org/viewvc/llvm-project?rev=280330=rev
Log:
[Sema] Don't diagnose an array type mismatch when the new or previous
declaration has a dependent type.

This fixes a bug where clang errors out on a valid code.

rdar://problem/28051467

Differential Revision: https://reviews.llvm.org/D24110

Added:
cfe/trunk/test/SemaTemplate/array-redeclaration.cpp
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=280330=280329=280330=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Aug 31 20:03:21 2016
@@ -3367,11 +3367,11 @@ void Sema::MergeVarDeclTypes(VarDecl *Ne
   // We are merging a variable declaration New into Old. If it has an array
   // bound, and that bound differs from Old's bound, we should diagnose the
   // mismatch.
-  if (!NewArray->isIncompleteArrayType()) {
+  if (!NewArray->isIncompleteArrayType() && !NewArray->isDependentType()) {
 for (VarDecl *PrevVD = Old->getMostRecentDecl(); PrevVD;
  PrevVD = PrevVD->getPreviousDecl()) {
   const ArrayType *PrevVDTy = 
Context.getAsArrayType(PrevVD->getType());
-  if (PrevVDTy->isIncompleteArrayType())
+  if (PrevVDTy->isIncompleteArrayType() || PrevVDTy->isDependentType())
 continue;
 
   if (!Context.hasSameType(NewArray, PrevVDTy))

Added: cfe/trunk/test/SemaTemplate/array-redeclaration.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/array-redeclaration.cpp?rev=280330=auto
==
--- cfe/trunk/test/SemaTemplate/array-redeclaration.cpp (added)
+++ cfe/trunk/test/SemaTemplate/array-redeclaration.cpp Wed Aug 31 20:03:21 2016
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+extern int array[1];
+
+template 
+class C {
+  enum { D };
+public:
+  template  void foo1() {
+extern int array[((int)C::k > (int)D) ? 1 : -1];
+  }
+};
+
+template<>
+class C {
+public:
+  const static int k = 2;
+};
+
+void foo2() {
+  C c;
+  c.foo1();
+}
+
+template
+void foo3() {
+  extern int array[n ? 1 : -1];
+}
+
+void foo4() {
+  foo3<5>();
+}


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


Re: [PATCH] D24110: [Sema] Don't diagnose an array type mismatch when the new or previous declaration has a dependent type

2016-08-31 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment.

I'll commit the patch as-is first and come up with a new patch which implements 
the improvements you suggested later.


https://reviews.llvm.org/D24110



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


Re: [PATCH] D24110: [Sema] Don't diagnose an array type mismatch when the new or previous declaration has a dependent type

2016-08-31 Thread Akira Hatanaka via cfe-commits
ahatanak added inline comments.


Comment at: lib/Sema/SemaDecl.cpp:3377-3378
@@ -3376,4 +3376,4 @@
 
   if (!Context.hasSameType(NewArray, PrevVDTy))
 return diagnoseVarDeclTypeMismatch(*this, New, PrevVD);
 }

rsmith wrote:
> ahatanak wrote:
> > rsmith wrote:
> > > If you do use `isDependentSizedArrayType()`, you'll need to change this 
> > > to check the bounds of the array types rather than the type.
> > It seems to me that you don't want to do the check when either the array 
> > bound or the element type is dependent. Which case would we miss if 
> > isDependentType is used here instead of isDependentSizedArrayType? Could 
> > you show an example?
> Sure. We could diagnose both declarations in the template here:
> 
> int a[5];
> int b[5];
> template void f() {
>   extern T a[6];
>   extern float b[N];
> }
> 
> ... because in both cases the type can never match. However, we don't do this 
> sort of partial type matching in any other cases, so it's very much just a 
> "nice-to-have".
Ah, I see your point.

If we want to catch those cases too, perhaps we should define and use a 
function "hasDifferentType" which returns true only if the new and old arrays 
are known to have different types. In your example, the function would return 
true for "T a[6]" because we can see it will never match "int a[5]" regardless 
of what T is.


https://reviews.llvm.org/D24110



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


Re: [PATCH] D24069: Document option '-rtlib' in clang's man page and help info

2016-08-31 Thread Bruno Cardoso Lopes via cfe-commits
bruno added inline comments.


Comment at: docs/CommandGuide/clang.rst:114
@@ -110,1 +113,3 @@
+ compiler-rt.
+
 .. option:: -ansi

zlei wrote:
> bruno wrote:
> > It might be worth mentioning what's the default behaviour in case the flag 
> > isn't specified?
> This option behaves a lot like `-stdlib`, so I want their doc entries to look 
> alike too. Perhaps I should update them both to state the default behavior?
That would be great, but feel free to do this update in follow up 
patches/commits if you want to.


https://reviews.llvm.org/D24069



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


[PATCH] D24113: Allow implicit conversions between incompatible pointer types in overload resolution in C.

2016-08-31 Thread George Burgess IV via cfe-commits
george.burgess.iv created this revision.
george.burgess.iv added a reviewer: rsmith.
george.burgess.iv added a subscriber: cfe-commits.

In C, we allow pointer conversions like:

```
void foo(int *a);
long b;
void runFoo() { foo(); }
```

...But not when overloading:

```
int bar(char *a) __attribute__((overloadable));
int bar(struct{}) __attribute__((overloadable));
unsigned char d;
void runBar() { bar(); } // error: no matching function for call to 'bar'
```

This patch makes it so `bar()` isn't an error.

A few notes:

- We'll still emit a warning about the conversion, assuming the user hasn't 
opted out of said warnings.
- Every such conversion is ranked as the worst possible thing. So, if there's 
any ambiguity at all (e.g. if bar had a `void(signed char*)` overload, as 
well), we'll still emit an error.
- We consider conversions that drop qualifiers to be equally as bad as 
converting between incompatible pointer types. I'm happy to make conversions 
that only drop qualifiers preferred over incompatible pointer types, if that 
would be better.

https://reviews.llvm.org/D24113

Files:
  include/clang/Basic/AttrDocs.td
  include/clang/Sema/Overload.h
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaOverload.cpp
  test/CodeGen/builtins-systemz-zvector-error.c
  test/CodeGen/overloadable.c
  test/Sema/overloadable.c
  test/Sema/pass-object-size.c
  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,11 +1,11 @@
 // RUN: %clang_cc1 %s -verify -pedantic -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}}
+void __attribute__((overloadable)) foo(event_t, __local char *); // expected-note {{candidate function}}
+void __attribute__((overloadable)) foo(event_t, __local float *); // expected-note {{candidate function}}
 
 void kernel ker(__local char *src1, __local float *src2, __global int *src3) {
   event_t evt;
   foo(evt, src1);
   foo(0, src2);
-  foo(evt, src3); // expected-error {{no matching function for call to 'foo'}}
+  foo(evt, src3); // expected-error {{call to 'foo' is ambiguous}}
 }
Index: test/Sema/pass-object-size.c
===
--- test/Sema/pass-object-size.c
+++ test/Sema/pass-object-size.c
@@ -52,5 +52,5 @@
 
   int P;
   ()(); //expected-error{{cannot take address of function 'NotOverloaded' because parameter 1 has pass_object_size attribute}}
-  ()(); //expected-error{{no matching function}} expected-note@35{{candidate address cannot be taken because parameter 1 has pass_object_size attribute}} expected-note@36{{candidate function not viable: no known conversion from 'int *' to 'char *' for 1st argument}}
+  ()(); //expected-warning{{incompatible pointer types passing 'int *' to parameter of type 'char *'}} expected-note@36{{passing argument to parameter 'p' here}}
 }
Index: test/Sema/overloadable.c
===
--- test/Sema/overloadable.c
+++ test/Sema/overloadable.c
@@ -23,7 +23,7 @@
 void test_funcptr(int (*f1)(int, double),
   int (*f2)(int, float)) {
   float *fp = accept_funcptr(f1);
-  accept_funcptr(f2); // expected-error{{no matching function for call to 'accept_funcptr'}}
+  accept_funcptr(f2); // expected-error{{call to 'accept_funcptr' is ambiguous}}
 }
 
 struct X { int x; float y; };
@@ -122,3 +122,32 @@
 
   void *specific_disabled = 
 }
+
+void incompatible_pointer_type_conversions() {
+  char charbuf[1];
+  unsigned char ucharbuf[1];
+  int intbuf[1];
+
+  void foo(char *c) __attribute__((overloadable));
+  void foo(short *c) __attribute__((overloadable));
+  foo(charbuf);
+  foo(ucharbuf); // expected-error{{call to 'foo' is ambiguous}} expected-note@131{{candidate function}} expected-note@132{{candidate function}}
+  foo(intbuf); // expected-error{{call to 'foo' is ambiguous}} expected-note@131{{candidate function}} expected-note@132{{candidate function}}
+
+  void bar(unsigned char *c) __attribute__((overloadable));
+  void bar(signed char *c) __attribute__((overloadable));
+  bar(charbuf); // expected-error{{call to 'bar' is ambiguous}} expected-note@137{{candidate function}} expected-note@138{{candidate function}}
+  bar(ucharbuf);
+  bar(intbuf); // expected-error{{call to 'bar' is ambiguous}} expected-note@137{{candidate function}} expected-note@138{{candidate function}}
+}
+
+void dropping_qualifiers_is_incompatible() {
+  const char ccharbuf[1];
+  volatile char vcharbuf[1];
+
+  void foo(char *c) 

Re: [PATCH] D24110: [Sema] Don't diagnose an array type mismatch when the new or previous declaration has a dependent type

2016-08-31 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: lib/Sema/SemaDecl.cpp:3377-3378
@@ -3376,4 +3376,4 @@
 
   if (!Context.hasSameType(NewArray, PrevVDTy))
 return diagnoseVarDeclTypeMismatch(*this, New, PrevVD);
 }

ahatanak wrote:
> rsmith wrote:
> > If you do use `isDependentSizedArrayType()`, you'll need to change this to 
> > check the bounds of the array types rather than the type.
> It seems to me that you don't want to do the check when either the array 
> bound or the element type is dependent. Which case would we miss if 
> isDependentType is used here instead of isDependentSizedArrayType? Could you 
> show an example?
Sure. We could diagnose both declarations in the template here:

int a[5];
int b[5];
template void f() {
  extern T a[6];
  extern float b[N];
}

... because in both cases the type can never match. However, we don't do this 
sort of partial type matching in any other cases, so it's very much just a 
"nice-to-have".


https://reviews.llvm.org/D24110



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


Re: [PATCH] D24110: [Sema] Don't diagnose an array type mismatch when the new or previous declaration has a dependent type

2016-08-31 Thread Akira Hatanaka via cfe-commits
ahatanak added inline comments.


Comment at: lib/Sema/SemaDecl.cpp:3377-3378
@@ -3376,4 +3376,4 @@
 
   if (!Context.hasSameType(NewArray, PrevVDTy))
 return diagnoseVarDeclTypeMismatch(*this, New, PrevVD);
 }

rsmith wrote:
> If you do use `isDependentSizedArrayType()`, you'll need to change this to 
> check the bounds of the array types rather than the type.
It seems to me that you don't want to do the check when either the array bound 
or the element type is dependent. Which case would we miss if isDependentType 
is used here instead of isDependentSizedArrayType? Could you show an example?


https://reviews.llvm.org/D24110



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


Re: [PATCH] D24110: [Sema] Don't diagnose an array type mismatch when the new or previous declaration has a dependent type

2016-08-31 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

LGTM as-is, but one suggestion if you want to still allow diagnosing a few more 
cases.



Comment at: lib/Sema/SemaDecl.cpp:3377-3378
@@ -3376,4 +3376,4 @@
 
   if (!Context.hasSameType(NewArray, PrevVDTy))
 return diagnoseVarDeclTypeMismatch(*this, New, PrevVD);
 }

If you do use `isDependentSizedArrayType()`, you'll need to change this to 
check the bounds of the array types rather than the type.


https://reviews.llvm.org/D24110



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


Re: [PATCH] D24110: [Sema] Don't diagnose an array type mismatch when the new or previous declaration has a dependent type

2016-08-31 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: lib/Sema/SemaDecl.cpp:3370-3374
@@ -3369,7 +3369,7 @@
   // mismatch.
-  if (!NewArray->isIncompleteArrayType()) {
+  if (!NewArray->isIncompleteArrayType() && !NewArray->isDependentType()) {
 for (VarDecl *PrevVD = Old->getMostRecentDecl(); PrevVD;
  PrevVD = PrevVD->getPreviousDecl()) {
   const ArrayType *PrevVDTy = 
Context.getAsArrayType(PrevVD->getType());
-  if (PrevVDTy->isIncompleteArrayType())
+  if (PrevVDTy->isIncompleteArrayType() || PrevVDTy->isDependentType())
 continue;

Maybe use `isDependentSizedArrayType()` here instead, so we still diagnose 
cases where the element type is dependent but the array bound is non-dependent 
and differs.


https://reviews.llvm.org/D24110



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


[PATCH] D24110: [Sema] Don't diagnose an array type mismatch when the new or previous declaration has a dependent type

2016-08-31 Thread Akira Hatanaka via cfe-commits
ahatanak created this revision.
ahatanak added reviewers: v.g.vassilev, rsmith.
ahatanak added a subscriber: cfe-commits.

We shouldn't compare the bounds of two arrays and issue a diagnostic if one of 
them is dependent.

https://reviews.llvm.org/D24110

Files:
  lib/Sema/SemaDecl.cpp
  test/SemaTemplate/array-redeclaration.cpp

Index: test/SemaTemplate/array-redeclaration.cpp
===
--- /dev/null
+++ test/SemaTemplate/array-redeclaration.cpp
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+extern int array[1];
+
+template 
+class C {
+  enum { D };
+public:
+  template  void foo1() {
+extern int array[((int)C::k > (int)D) ? 1 : -1];
+  }
+};
+
+template<>
+class C {
+public:
+  const static int k = 2;
+};
+
+void foo2() {
+  C c;
+  c.foo1();
+}
+
+template
+void foo3() {
+  extern int array[n ? 1 : -1];
+}
+
+void foo4() {
+  foo3<5>();
+}
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -3367,11 +3367,11 @@
   // We are merging a variable declaration New into Old. If it has an array
   // bound, and that bound differs from Old's bound, we should diagnose the
   // mismatch.
-  if (!NewArray->isIncompleteArrayType()) {
+  if (!NewArray->isIncompleteArrayType() && !NewArray->isDependentType()) {
 for (VarDecl *PrevVD = Old->getMostRecentDecl(); PrevVD;
  PrevVD = PrevVD->getPreviousDecl()) {
   const ArrayType *PrevVDTy = 
Context.getAsArrayType(PrevVD->getType());
-  if (PrevVDTy->isIncompleteArrayType())
+  if (PrevVDTy->isIncompleteArrayType() || PrevVDTy->isDependentType())
 continue;
 
   if (!Context.hasSameType(NewArray, PrevVDTy))


Index: test/SemaTemplate/array-redeclaration.cpp
===
--- /dev/null
+++ test/SemaTemplate/array-redeclaration.cpp
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+extern int array[1];
+
+template 
+class C {
+  enum { D };
+public:
+  template  void foo1() {
+extern int array[((int)C::k > (int)D) ? 1 : -1];
+  }
+};
+
+template<>
+class C {
+public:
+  const static int k = 2;
+};
+
+void foo2() {
+  C c;
+  c.foo1();
+}
+
+template
+void foo3() {
+  extern int array[n ? 1 : -1];
+}
+
+void foo4() {
+  foo3<5>();
+}
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -3367,11 +3367,11 @@
   // We are merging a variable declaration New into Old. If it has an array
   // bound, and that bound differs from Old's bound, we should diagnose the
   // mismatch.
-  if (!NewArray->isIncompleteArrayType()) {
+  if (!NewArray->isIncompleteArrayType() && !NewArray->isDependentType()) {
 for (VarDecl *PrevVD = Old->getMostRecentDecl(); PrevVD;
  PrevVD = PrevVD->getPreviousDecl()) {
   const ArrayType *PrevVDTy = Context.getAsArrayType(PrevVD->getType());
-  if (PrevVDTy->isIncompleteArrayType())
+  if (PrevVDTy->isIncompleteArrayType() || PrevVDTy->isDependentType())
 continue;
 
   if (!Context.hasSameType(NewArray, PrevVDTy))
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24091: [Driver] Warn on -nodefaultlibs and -fsanitize

2016-08-31 Thread Chris Bieneman via cfe-commits
beanz updated this revision to Diff 69926.
beanz added a comment.

- Changed warning text based on feedback from bruno
- Made the warning apply to -nostdlib as well as -nodefaultlibs based on 
offline discussion with Anna


https://reviews.llvm.org/D24091

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/Driver/SanitizerArgs.h
  lib/Driver/Driver.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/Tools.cpp
  test/Driver/nodefaultlib.c
  test/Driver/nostdlib.c

Index: test/Driver/nostdlib.c
===
--- test/Driver/nostdlib.c
+++ test/Driver/nostdlib.c
@@ -29,3 +29,12 @@
 // CHECK-LINUX-NOSTDLIB: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
 // CHECK-LINUX-NOSTDLIB-NOT: "{{.*}}/Inputs/resource_dir{{/|}}lib{{/|}}linux{{/|}}libclang_rt.builtins-i686.a"
 // CHECK-MSVC-NOSTDLIB: warning: argument unused during compilation: '--rtlib=compiler-rt'
+
+// RUN: %clang -target i686-pc-linux-gnu -nostdlib -fsanitize=address -### %s 2>&1 | FileCheck -check-prefix=TEST3 %s
+// RUN: %clang -target i686-unknown-freebsd -nodefaultlibs -fsanitize=address -### %s 2>&1 | FileCheck -check-prefix=TEST3 %s
+// TEST3: warning: -nodefaultlibs and -nostdlib do not skip sanitizer runtime libs when used with -fsanitize.
+// TEST3: libclang_rt.asan-i686.a
+
+// RUN: %clang -target i686-apple-darwin -nostdlib -fsanitize=address -### %s 2>&1 | FileCheck -check-prefix=TEST4 %s
+// TEST4: warning: -nodefaultlibs and -nostdlib do not skip sanitizer runtime libs when used with -fsanitize.
+// TEST4: libclang_rt.asan_osx_dynamic.dylib
Index: test/Driver/nodefaultlib.c
===
--- test/Driver/nodefaultlib.c
+++ test/Driver/nodefaultlib.c
@@ -8,3 +8,12 @@
 // RUN: %clang -target i686-pc-linux-gnu -stdlib=libc++ -nodefaultlibs -lstdc++ -### %s 2>&1 | FileCheck -check-prefix=TEST2 %s
 // TEST2-NOT: "-lc++"
 // TEST2: "-lstdc++"
+
+// RUN: %clang -target i686-pc-linux-gnu -nodefaultlibs -fsanitize=address -### %s 2>&1 | FileCheck -check-prefix=TEST3 %s
+// RUN: %clang -target i686-unknown-freebsd -nodefaultlibs -fsanitize=address -### %s 2>&1 | FileCheck -check-prefix=TEST3 %s
+// TEST3: warning: -nodefaultlibs and -nostdlib do not skip sanitizer runtime libs when used with -fsanitize.
+// TEST3: libclang_rt.asan-i686.a
+
+// RUN: %clang -target i686-apple-darwin -nodefaultlibs -fsanitize=address -### %s 2>&1 | FileCheck -check-prefix=TEST4 %s
+// TEST4: warning: -nodefaultlibs and -nostdlib do not skip sanitizer runtime libs when used with -fsanitize.
+// TEST4: libclang_rt.asan_osx_dynamic.dylib
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -8768,6 +8768,10 @@
 AddGoldPlugin(ToolChain, Args, CmdArgs, D.getLTOMode() == LTOK_Thin);
 
   bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
+
+  if (NeedsSanitizerDeps &&
+  Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs))
+D.Diag(clang::diag::warn_drv_sanitizers_and_nodefaultlibs);
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs);
 
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
@@ -9604,6 +9608,11 @@
 CmdArgs.push_back("--no-demangle");
 
   bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
+
+  if (NeedsSanitizerDeps &&
+  Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs))
+D.Diag(clang::diag::warn_drv_sanitizers_and_nodefaultlibs);
+
   bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs);
   // The profile runtime also needs access to system libraries.
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -321,6 +321,8 @@
 CmdArgs.push_back("-rpath");
 CmdArgs.push_back(Args.MakeArgString(Dir));
   }
+  if (Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs))
+getDriver().Diag(clang::diag::warn_drv_sanitizers_and_nodefaultlibs);
 }
 
 StringRef Darwin::getPlatformFamily() const {
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -1546,9 +1546,8 @@
   Arg *FinalPhaseArg;
   phases::ID FinalPhase = getFinalPhase(Args, );
 
-  if (FinalPhase == phases::Link && Args.hasArg(options::OPT_emit_llvm)) {
+  if (FinalPhase == phases::Link && Args.hasArg(options::OPT_emit_llvm))
 Diag(clang::diag::err_drv_emit_llvm_link);
-  }
 
   // Reject -Z* at the top level, these options should never have been exposed
   // by gcc.
Index: include/clang/Driver/SanitizerArgs.h
===
--- include/clang/Driver/SanitizerArgs.h
+++ include/clang/Driver/SanitizerArgs.h
@@ -63,6 +63,8 @@
 return 

[libunwind] r280324 - Creating release candidate final from release_390 branch

2016-08-31 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug 31 18:31:40 2016
New Revision: 280324

URL: http://llvm.org/viewvc/llvm-project?rev=280324=rev
Log:
Creating release candidate final from release_390 branch

Added:
libunwind/tags/RELEASE_390/final/   (props changed)
  - copied from r280323, libunwind/branches/release_39/

Propchange: libunwind/tags/RELEASE_390/final/
--
svn:mergeinfo = /libunwind/trunk:276128,277868,278029


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


[libcxxabi] r280318 - Creating release candidate final from release_390 branch

2016-08-31 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug 31 18:31:22 2016
New Revision: 280318

URL: http://llvm.org/viewvc/llvm-project?rev=280318=rev
Log:
Creating release candidate final from release_390 branch

Added:
libcxxabi/tags/RELEASE_390/final/   (props changed)
  - copied from r280317, libcxxabi/branches/release_39/

Propchange: libcxxabi/tags/RELEASE_390/final/
--
svn:mergeinfo = /libcxxabi/trunk:278030,278579


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


[libcxx] r280317 - Creating release candidate final from release_390 branch

2016-08-31 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug 31 18:31:18 2016
New Revision: 280317

URL: http://llvm.org/viewvc/llvm-project?rev=280317=rev
Log:
Creating release candidate final from release_390 branch

Added:
libcxx/tags/RELEASE_390/final/   (props changed)
  - copied from r280316, libcxx/branches/release_39/

Propchange: libcxx/tags/RELEASE_390/final/
--
--- svn:mergeinfo (added)
+++ svn:mergeinfo Wed Aug 31 18:31:18 2016
@@ -0,0 +1,2 @@
+/libcxx/branches/apple:136569-137939
+/libcxx/trunk:278282,278357,278387,278904,279008


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


Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).

2016-08-31 Thread Anna Zaks via cfe-commits
zaks.anna added inline comments.


Comment at: lib/StaticAnalyzer/Core/PathDiagnostic.cpp:216
@@ +215,3 @@
+llvm::raw_svector_ostream warning(buf);
+warning << "warning: Path diagnostic report is not generated. Current "
+<< "output format does not support diagnostics that cross file "

ayartsev wrote:
> ayartsev wrote:
> > zaks.anna wrote:
> > > ayartsev wrote:
> > > > zaks.anna wrote:
> > > > > Can/should we be specific about what the user-specified output format 
> > > > > is?
> > > > It's unable to extract information about user-specified output format 
> > > > from the "PathDiagnosticConsumer" interface. And this class seem to be 
> > > > too generic to contain "AnalyzerOptions" member or to have e.g. "pure 
> > > > virtual getOutputFormatName()".
> > > > So the only way I see to get info about output format is to use 
> > > > "PathDiagnosticConsumer::getName()".
> > > > Maybe it makes sense just to add a hint to use "--analyzer-output" 
> > > > driver option to change output format. However this option is not 
> > > > documented at all and is not displayed in clang help. What do you think?
> > > I think mentioning the option is the best option. What is that option 
> > > called in scan-build?
> > scan-build (both perl and python versions) has two options: "-plist" and 
> > "-plist-html" that are translated to "-analyzer-output=plist" and 
> > "-analyzer-output=plist-html" frontend options respectively.
> I suggest to document the "--analyzer-output" option and to mention this 
> option in the warning.
That sounds good to me.


https://reviews.llvm.org/D22494



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


r280309 - Fix all tests under test/CXX (and test/Analysis) to pass if clang's default

2016-08-31 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Aug 31 18:24:08 2016
New Revision: 280309

URL: http://llvm.org/viewvc/llvm-project?rev=280309=rev
Log:
Fix all tests under test/CXX (and test/Analysis) to pass if clang's default
C++ language standard is not C++98.

Modified:
cfe/trunk/test/Analysis/misc-ps-region-store.cpp
cfe/trunk/test/CXX/class.access/class.friend/p1.cpp
cfe/trunk/test/CXX/class.access/p4.cpp
cfe/trunk/test/CXX/class/class.union/p1.cpp
cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x-fixits.cpp
cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
cfe/trunk/test/CXX/dcl.decl/dcl.init/p5.cpp
cfe/trunk/test/CXX/special/class.dtor/p9.cpp
cfe/trunk/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp
cfe/trunk/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp
cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p4.cpp

Modified: cfe/trunk/test/Analysis/misc-ps-region-store.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps-region-store.cpp?rev=280309=280308=280309=diff
==
--- cfe/trunk/test/Analysis/misc-ps-region-store.cpp (original)
+++ cfe/trunk/test/Analysis/misc-ps-region-store.cpp Wed Aug 31 18:24:08 2016
@@ -138,7 +138,7 @@ void pr7675_test() {
   pr7675(10.0);
   pr7675(10);
   pr7675('c');
-  pr7675_i(4.0i);
+  pr7675_i(4.0j);
 
   // Add check to ensure we are analyzing the code up to this point.
   clang_analyzer_warnIfReached();  // expected-warning{{REACHABLE}}

Modified: cfe/trunk/test/CXX/class.access/class.friend/p1.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class.access/class.friend/p1.cpp?rev=280309=280308=280309=diff
==
--- cfe/trunk/test/CXX/class.access/class.friend/p1.cpp (original)
+++ cfe/trunk/test/CXX/class.access/class.friend/p1.cpp Wed Aug 31 18:24:08 2016
@@ -1,3 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 
 // C++'0x [class.friend] p1:
@@ -216,9 +219,17 @@ namespace test6 {
   struct A {};
 
   struct B {
-friend A::A();
+friend
+#if __cplusplus >= 201103L
+  constexpr
+#endif
+  A::A();
 friend A::~A();
-friend A ::operator=(const A&);
+friend
+#if __cplusplus >= 201402L
+  constexpr
+#endif
+  A ::operator=(const A&);
   };
 }
 
@@ -233,7 +244,11 @@ namespace test7 {
   class A {
 friend void X::foo();
 friend X::X();
-friend X::X(const X&);
+friend
+#if __cplusplus >= 201103L
+  constexpr
+#endif
+  X::X(const X&);
 
   private:
 A(); // expected-note 2 {{declared private here}}

Modified: cfe/trunk/test/CXX/class.access/p4.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class.access/p4.cpp?rev=280309=280308=280309=diff
==
--- cfe/trunk/test/CXX/class.access/p4.cpp (original)
+++ cfe/trunk/test/CXX/class.access/p4.cpp Wed Aug 31 18:24:08 2016
@@ -1,3 +1,5 @@
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify 
-std=c++98 %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify 
-std=c++11 %s
 // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
 
 // C++0x [class.access]p4:
@@ -88,7 +90,7 @@ namespace test1 {
 namespace test2 {
   class A {
   private:
-A(); // expected-note 3 {{declared private here}}
+A(); // expected-note 1+{{declared private here}}
 
 static A foo;
   };
@@ -96,6 +98,7 @@ namespace test2 {
   A a; // expected-error {{calling a private constructor}}
   A A::foo; // okay
   
+#if __cplusplus < 201103L
   class B : A { }; // expected-error {{base class 'test2::A' has private 
default constructor}}
   B b; // expected-note{{implicit default constructor}}
   
@@ -106,6 +109,19 @@ namespace test2 {
 
   class D : C { }; // expected-error {{inherited virtual base class 'test2::A' 
has private default constructor}}
   D d; // expected-note{{implicit default constructor}}
+#else
+  class B : A { }; // expected-note {{base class 'test2::A' has an 
inaccessible default constructor}}
+  B b; // expected-error {{call to implicitly-deleted default constructor}}
+  
+  // FIXME: Do a better job of explaining how we get here from class D.
+  class C : virtual A { // expected-note {{default constructor of 'D' is 
implicitly deleted because base class 'test2::A' has an inaccessible default 
constructor}}
+  public:
+C();
+  };
+
+  class D : C { };
+  D d; // expected-error {{call to implicitly-deleted default constructor}}
+#endif
 }
 
 // Implicit destructor calls.
@@ -123,6 +139,7 @@ namespace test3 {
 A local; // expected-error {{variable of type 'test3::A' has private 
destructor}}
   }
 
+#if 

r280308 - DR259: Demote the pedantic error for an explicit instantiation after an

2016-08-31 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Aug 31 18:23:25 2016
New Revision: 280308

URL: http://llvm.org/viewvc/llvm-project?rev=280308=rev
Log:
DR259: Demote the pedantic error for an explicit instantiation after an
explicit specialization to a warning for C++98 mode (this is a defect report
resolution, so per our informal policy it should apply in C++98), and turn
the warning on by default for C++11 and later. In all cases where it fires, the
right thing to do is to remove the pointless explicit instantiation.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/CXX/drs/dr2xx.cpp
cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/examples.cpp
cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p4.cpp
cfe/trunk/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
cfe/trunk/test/SemaCXX/cxx98-compat-pedantic.cpp
cfe/trunk/test/SemaCXX/cxx98-compat.cpp
cfe/trunk/test/SemaTemplate/temp_explicit.cpp
cfe/trunk/www/cxx_dr_status.html

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=280308=280307=280308=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Aug 31 18:23:25 
2016
@@ -4076,14 +4076,10 @@ def ext_explicit_instantiation_duplicate
 InGroup;
 def note_previous_explicit_instantiation : Note<
 "previous explicit instantiation is here">;
-def ext_explicit_instantiation_after_specialization : Extension<
-"explicit instantiation of %0 that occurs after an explicit "
-"specialization will be ignored (C++11 extension)">,
-InGroup;
-def warn_cxx98_compat_explicit_instantiation_after_specialization : Warning<
-"explicit instantiation of %0 that occurs after an explicit "
-"specialization is incompatible with C++98">,
-InGroup, DefaultIgnore;
+def warn_explicit_instantiation_after_specialization : Warning<
+  "explicit instantiation of %0 that occurs after an explicit "
+  "specialization has no effect">,
+  InGroup>;
 def note_previous_template_specialization : Note<
 "previous template specialization is here">;
 def err_explicit_instantiation_nontemplate_type : Error<

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=280308=280307=280308=diff
==
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Wed Aug 31 18:23:25 2016
@@ -6821,13 +6821,7 @@ Sema::CheckSpecializationInstantiationRe
   //   instantiation of a template appears after a declaration of
   //   an explicit specialization for that template, the explicit
   //   instantiation has no effect.
-  //
-  // In C++98/03 mode, we only give an extension warning here, because it
-  // is not harmful to try to explicitly instantiate something that
-  // has been explicitly specialized.
-  Diag(NewLoc, getLangOpts().CPlusPlus11 ?
-   diag::warn_cxx98_compat_explicit_instantiation_after_specialization 
:
-   diag::ext_explicit_instantiation_after_specialization)
+  Diag(NewLoc, diag::warn_explicit_instantiation_after_specialization)
 << PrevDecl;
   Diag(PrevDecl->getLocation(),
diag::note_previous_template_specialization);

Modified: cfe/trunk/test/CXX/drs/dr2xx.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr2xx.cpp?rev=280308=280307=280308=diff
==
--- cfe/trunk/test/CXX/drs/dr2xx.cpp (original)
+++ cfe/trunk/test/CXX/drs/dr2xx.cpp Wed Aug 31 18:23:25 2016
@@ -679,17 +679,13 @@ namespace dr258 { // dr258: yes
   } f; // expected-error {{abstract}}
 }
 
-namespace dr259 { // dr259: yes c++11
+namespace dr259 { // dr259: 4.0
   template struct A {};
   template struct A; // expected-note {{previous}}
   template struct A; // expected-error {{duplicate explicit 
instantiation}}
 
-  // FIXME: We only apply this DR in C++11 mode.
-  template<> struct A;
-  template struct A;
-#if __cplusplus < 201103L
-  // expected-error@-2 {{extension}} expected-note@-3 {{here}}
-#endif
+  template<> struct A; // expected-note {{previous}}
+  template struct A; // expected-warning {{has no effect}}
 
   template struct A; // expected-note {{here}}
   template<> struct A; // expected-error {{explicit specialization of 
'dr259::A' after instantiation}}
@@ -702,11 +698,8 @@ namespace dr259 { // dr259: yes c++11
   template struct B; // expected-note {{here}}
   template struct B; // expected-error {{undefined}}
 
-  template<> 

r280306 - Add -fprofile-dir= to clang.

2016-08-31 Thread Nick Lewycky via cfe-commits
Author: nicholas
Date: Wed Aug 31 18:04:32 2016
New Revision: 280306

URL: http://llvm.org/viewvc/llvm-project?rev=280306=rev
Log:
Add -fprofile-dir= to clang.

-fprofile-dir=path allows the user to specify where .gcda files should be
emitted when the program is run. In particular, this is the first flag that
causes the .gcno and .o files to have different paths, LLVM is extended to
support this. -fprofile-dir= does not change the file name in the .gcno (and
thus where lcov looks for the source) but it does change the name in the .gcda
(and thus where the runtime library writes the .gcda file). It's different from
a GCOV_PREFIX because a user can observe that the GCOV_PREFIX_STRIP will strip
paths off of -fprofile-dir= but not off of a supplied GCOV_PREFIX.

To implement this we split -coverage-file into -coverage-data-file and
-coverage-notes-file to specify the two different names. The !llvm.gcov
metadata node grows from a 2-element form {string coverage-file, node dbg.cu}
to 3-elements, {string coverage-notes-file, string coverage-data-file, node
dbg.cu}. In the 3-element form, the file name is already "mangled" with
.gcno/.gcda suffixes, while the 2-element form left that to the middle end
pass.

Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.h
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/CodeGen/code-coverage.c
cfe/trunk/test/Driver/clang_f_opts.c
cfe/trunk/test/Driver/coverage_no_integrated_as.c

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=280306=280305=280306=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Wed Aug 31 18:04:32 2016
@@ -192,9 +192,14 @@ def femit_coverage_notes : Flag<["-"], "
   HelpText<"Emit a gcov coverage notes file when compiling.">;
 def femit_coverage_data: Flag<["-"], "femit-coverage-data">,
   HelpText<"Instrument the program to emit gcov coverage data when run.">;
-def coverage_file : Separate<["-"], "coverage-file">,
-  HelpText<"Emit coverage data to this filename. The extension will be 
replaced.">;
-def coverage_file_EQ : Joined<["-"], "coverage-file=">, Alias;
+def coverage_data_file : Separate<["-"], "coverage-data-file">,
+  HelpText<"Emit coverage data to this filename.">;
+def coverage_data_file_EQ : Joined<["-"], "coverage-data-file=">,
+  Alias;
+def coverage_notes_file : Separate<["-"], "coverage-notes-file">,
+  HelpText<"Emit coverage notes to this filename.">;
+def coverage_notes_file_EQ : Joined<["-"], "coverage-notes-file=">,
+  Alias;
 def coverage_cfg_checksum : Flag<["-"], "coverage-cfg-checksum">,
   HelpText<"Emit CFG checksum for functions in .gcno files.">;
 def coverage_no_function_names_in_data : Flag<["-"], 
"coverage-no-function-names-in-data">,

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=280306=280305=280306=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Wed Aug 31 18:04:32 2016
@@ -2117,7 +2117,7 @@ multiclass BooleanFFlag {
 
 defm : BooleanFFlag<"keep-inline-functions">, 
Group;
 
-def fprofile_dir : Joined<["-"], "fprofile-dir=">, 
Group;
+def fprofile_dir : Joined<["-"], "fprofile-dir=">, Group;
 
 def fuse_ld_EQ : Joined<["-"], "fuse-ld=">, Group;
 

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.h?rev=280306=280305=280306=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.h Wed Aug 31 18:04:32 2016
@@ -99,9 +99,13 @@ public:
   /// The code model to use (-mcmodel).
   std::string CodeModel;
 
-  /// The filename with path we use for coverage files. The extension will be
-  /// replaced.
-  std::string CoverageFile;
+  /// The filename with path we use for coverage data files. The runtime
+  /// allows further manipulation with the GCOV_PREFIX and GCOV_PREFIX_STRIP
+  /// environment variables.
+  std::string CoverageDataFile;
+
+  /// The filename with path we use for coverage notes files.
+  std::string CoverageNotesFile;
 
   /// The version string to put into coverage files.
   char CoverageVersion[4];

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=280306=280305=280306=diff

Re: [PATCH] D24091: [Driver] Warn on -nodefaultlibs and -fsanitize

2016-08-31 Thread Bruno Cardoso Lopes via cfe-commits
bruno added inline comments.


Comment at: include/clang/Basic/DiagnosticDriverKinds.td:276
@@ +275,3 @@
+def warn_drv_sanitizers_and_nodefaultlibs : Warning<
+  "Passing -nodefaultlibs and -fsanitize has resulted in linking sanitizer 
runtimes.">,
+  InGroup>;

What about something like: "-nodefaultlibs does not skip sanitizer runtime libs 
when used with -fsanitize." ?


https://reviews.llvm.org/D24091



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


[PATCH] D24105: [libc++] Limit gets to CRT versions below 14

2016-08-31 Thread Shoaib Meenai via cfe-commits
smeenai created this revision.
smeenai added reviewers: compnerd, EricWF, mclow.lists.
smeenai added subscribers: cfe-commits, kastiglione.

Microsoft removed gets from the CRT in Visual Studio 2015 onwards [1].
Attempting to reference it when targeting CRT versions 14 and above will
cause compile errors.

[1] https://msdn.microsoft.com/en-us/library/2029ea5f.aspx

https://reviews.llvm.org/D24105

Files:
  include/cstdio

Index: include/cstdio
===
--- include/cstdio
+++ include/cstdio
@@ -98,6 +98,9 @@
 
 #include <__config>
 #include 
+#if defined(_LIBCPP_MSVCRT)
+#include 
+#endif
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -155,7 +158,8 @@
 
 #ifndef _LIBCPP_HAS_NO_STDIN
 using ::getchar;
-#if _LIBCPP_STD_VER <= 11
+#if _LIBCPP_STD_VER <= 11 && \
+(!defined(_VC_CRT_MAJOR_VERSION) || _VC_CRT_MAJOR_VERSION < 14)
 using ::gets;
 #endif
 using ::scanf;


Index: include/cstdio
===
--- include/cstdio
+++ include/cstdio
@@ -98,6 +98,9 @@
 
 #include <__config>
 #include 
+#if defined(_LIBCPP_MSVCRT)
+#include 
+#endif
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -155,7 +158,8 @@
 
 #ifndef _LIBCPP_HAS_NO_STDIN
 using ::getchar;
-#if _LIBCPP_STD_VER <= 11
+#if _LIBCPP_STD_VER <= 11 && \
+(!defined(_VC_CRT_MAJOR_VERSION) || _VC_CRT_MAJOR_VERSION < 14)
 using ::gets;
 #endif
 using ::scanf;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).

2016-08-31 Thread Anton Yartsev via cfe-commits
ayartsev added inline comments.


Comment at: lib/StaticAnalyzer/Core/PathDiagnostic.cpp:216
@@ +215,3 @@
+llvm::raw_svector_ostream warning(buf);
+warning << "warning: Path diagnostic report is not generated. Current "
+<< "output format does not support diagnostics that cross file "

zaks.anna wrote:
> ayartsev wrote:
> > zaks.anna wrote:
> > > Can/should we be specific about what the user-specified output format is?
> > It's unable to extract information about user-specified output format from 
> > the "PathDiagnosticConsumer" interface. And this class seem to be too 
> > generic to contain "AnalyzerOptions" member or to have e.g. "pure virtual 
> > getOutputFormatName()".
> > So the only way I see to get info about output format is to use 
> > "PathDiagnosticConsumer::getName()".
> > Maybe it makes sense just to add a hint to use "--analyzer-output" driver 
> > option to change output format. However this option is not documented at 
> > all and is not displayed in clang help. What do you think?
> I think mentioning the option is the best option. What is that option called 
> in scan-build?
scan-build (both perl and python versions) has two options: "-plist" and 
"-plist-html" that are translated to "-analyzer-output=plist" and 
"-analyzer-output=plist-html" frontend options respectively.


https://reviews.llvm.org/D22494



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


Re: [PATCH] D24091: [Driver] Warn on -nodefaultlibs and -fsanitize

2016-08-31 Thread Chris Bieneman via cfe-commits
beanz updated this revision to Diff 69910.
beanz added a comment.

Updates based on bruno's feedback.


https://reviews.llvm.org/D24091

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/Driver/SanitizerArgs.h
  lib/Driver/Driver.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/Tools.cpp
  test/Driver/nodefaultlib.c

Index: test/Driver/nodefaultlib.c
===
--- test/Driver/nodefaultlib.c
+++ test/Driver/nodefaultlib.c
@@ -8,3 +8,12 @@
 // RUN: %clang -target i686-pc-linux-gnu -stdlib=libc++ -nodefaultlibs 
-lstdc++ -### %s 2>&1 | FileCheck -check-prefix=TEST2 %s
 // TEST2-NOT: "-lc++"
 // TEST2: "-lstdc++"
+
+// RUN: %clang -target i686-pc-linux-gnu -nodefaultlibs -fsanitize=address 
-### %s 2>&1 | FileCheck -check-prefix=TEST3 %s
+// RUN: %clang -target i686-unknown-freebsd -nodefaultlibs -fsanitize=address 
-### %s 2>&1 | FileCheck -check-prefix=TEST3 %s
+// TEST3: warning: Passing -nodefaultlibs and -fsanitize has resulted in 
linking sanitizer runtimes.
+// TEST3: libclang_rt.asan-i686.a
+
+// RUN: %clang -target i686-apple-darwin -nodefaultlibs -fsanitize=address 
-### %s 2>&1 | FileCheck -check-prefix=TEST4 %s
+// TEST4: warning: Passing -nodefaultlibs and -fsanitize has resulted in 
linking sanitizer runtimes.
+// TEST4: libclang_rt.asan_osx_dynamic.dylib
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -8768,6 +8768,9 @@
 AddGoldPlugin(ToolChain, Args, CmdArgs, D.getLTOMode() == LTOK_Thin);
 
   bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
+
+  if (NeedsSanitizerDeps && Args.hasArg(options::OPT_nodefaultlibs))
+D.Diag(clang::diag::warn_drv_sanitizers_and_nodefaultlibs);
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs);
 
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
@@ -9604,6 +9607,10 @@
 CmdArgs.push_back("--no-demangle");
 
   bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
+  
+  if (NeedsSanitizerDeps && Args.hasArg(options::OPT_nodefaultlibs))
+D.Diag(clang::diag::warn_drv_sanitizers_and_nodefaultlibs);
+
   bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs);
   // The profile runtime also needs access to system libraries.
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -321,6 +321,8 @@
 CmdArgs.push_back("-rpath");
 CmdArgs.push_back(Args.MakeArgString(Dir));
   }
+  if (Args.hasArg(options::OPT_nodefaultlibs))
+getDriver().Diag(clang::diag::warn_drv_sanitizers_and_nodefaultlibs);
 }
 
 StringRef Darwin::getPlatformFamily() const {
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -1546,9 +1546,8 @@
   Arg *FinalPhaseArg;
   phases::ID FinalPhase = getFinalPhase(Args, );
 
-  if (FinalPhase == phases::Link && Args.hasArg(options::OPT_emit_llvm)) {
+  if (FinalPhase == phases::Link && Args.hasArg(options::OPT_emit_llvm))
 Diag(clang::diag::err_drv_emit_llvm_link);
-  }
 
   // Reject -Z* at the top level, these options should never have been exposed
   // by gcc.
Index: include/clang/Driver/SanitizerArgs.h
===
--- include/clang/Driver/SanitizerArgs.h
+++ include/clang/Driver/SanitizerArgs.h
@@ -63,6 +63,8 @@
 return Sanitizers.hasOneOf(SanitizerKind::Efficiency);
   }
 
+  bool hasSanitizers() const { return !Sanitizers.empty(); }
+
   bool requiresPIE() const;
   bool needsUnwindTables() const;
   bool linkCXXRuntimes() const { return LinkCXXRuntimes; }
Index: include/clang/Basic/DiagnosticDriverKinds.td
===
--- include/clang/Basic/DiagnosticDriverKinds.td
+++ include/clang/Basic/DiagnosticDriverKinds.td
@@ -271,4 +271,8 @@
   InGroup;
 
 def err_drv_unsupported_linker : Error<"unsupported value '%0' for -linker 
option">;
+
+def warn_drv_sanitizers_and_nodefaultlibs : Warning<
+  "Passing -nodefaultlibs and -fsanitize has resulted in linking sanitizer 
runtimes.">,
+  InGroup>;
 }


Index: test/Driver/nodefaultlib.c
===
--- test/Driver/nodefaultlib.c
+++ test/Driver/nodefaultlib.c
@@ -8,3 +8,12 @@
 // RUN: %clang -target i686-pc-linux-gnu -stdlib=libc++ -nodefaultlibs -lstdc++ -### %s 2>&1 | FileCheck -check-prefix=TEST2 %s
 // TEST2-NOT: "-lc++"
 // TEST2: "-lstdc++"
+
+// RUN: %clang -target i686-pc-linux-gnu -nodefaultlibs -fsanitize=address -### %s 2>&1 | FileCheck -check-prefix=TEST3 %s
+// RUN: %clang -target i686-unknown-freebsd -nodefaultlibs -fsanitize=address -### %s 2>&1 | 

Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).

2016-08-31 Thread Anna Zaks via cfe-commits
zaks.anna added inline comments.


Comment at: lib/StaticAnalyzer/Core/PathDiagnostic.cpp:216
@@ +215,3 @@
+llvm::raw_svector_ostream warning(buf);
+warning << "warning: Path diagnostic report is not generated. Current "
+<< "output format does not support diagnostics that cross file "

ayartsev wrote:
> zaks.anna wrote:
> > Can/should we be specific about what the user-specified output format is?
> It's unable to extract information about user-specified output format from 
> the "PathDiagnosticConsumer" interface. And this class seem to be too generic 
> to contain "AnalyzerOptions" member or to have e.g. "pure virtual 
> getOutputFormatName()".
> So the only way I see to get info about output format is to use 
> "PathDiagnosticConsumer::getName()".
> Maybe it makes sense just to add a hint to use "--analyzer-output" driver 
> option to change output format. However this option is not documented at all 
> and is not displayed in clang help. What do you think?
I think mentioning the option is the best option. What is that option called in 
scan-build?


https://reviews.llvm.org/D22494



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


Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-08-31 Thread Chris Bieneman via cfe-commits
beanz added a comment.

@zaks.anna, the driver behind this is supporting building libcxx with 
sanitizers. The drivers for GNUTools and FreeBSD already support this workflow.

I have updates to the test in https://reviews.llvm.org/D24091, which also cover 
this code. I'll push the updated test shortly.


https://reviews.llvm.org/D24048



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


Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).

2016-08-31 Thread Anton Yartsev via cfe-commits
ayartsev added a comment.

Gentle ping.


https://reviews.llvm.org/D22494



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


[PATCH] D24091: [Driver] Warn on -nodefaultlibs and -fsanitize

2016-08-31 Thread Chris Bieneman via cfe-commits
beanz created this revision.
beanz added reviewers: bogner, zaks.anna, bruno, filcab.
beanz added a subscriber: cfe-commits.
Herald added a subscriber: emaste.

The FreeBSD and GNUTools drivers support -fsanitize arguments bypassing 
-nodefaultlibs. With https://reviews.llvm.org/D24048, Darwin will support that 
behavior as well.

To make this a little less magical and behind the curtain this warning will 
fire when -nodefaultlibs is used with sanitizer arguments.

https://reviews.llvm.org/D24091

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  lib/Driver/Driver.cpp
  test/Driver/nodefaultlib.c

Index: test/Driver/nodefaultlib.c
===
--- test/Driver/nodefaultlib.c
+++ test/Driver/nodefaultlib.c
@@ -8,3 +8,7 @@
 // RUN: %clang -target i686-pc-linux-gnu -stdlib=libc++ -nodefaultlibs 
-lstdc++ -### %s 2>&1 | FileCheck -check-prefix=TEST2 %s
 // TEST2-NOT: "-lc++"
 // TEST2: "-lstdc++"
+
+// RUN: %clang -target i686-pc-linux-gnu -nodefaultlibs -fsanitize=address 
-### %s 2>&1 | FileCheck -check-prefix=TEST3 %s
+// TEST3: warning: Passing -nodefaultlibs and -fsanitize may result in linking 
sanitizer runtimes.
+// TEST3: libclang_rt.asan-i686.a
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -1546,8 +1546,12 @@
   Arg *FinalPhaseArg;
   phases::ID FinalPhase = getFinalPhase(Args, );
 
-  if (FinalPhase == phases::Link && Args.hasArg(options::OPT_emit_llvm)) {
-Diag(clang::diag::err_drv_emit_llvm_link);
+  if (FinalPhase == phases::Link) {
+if(Args.hasArg(options::OPT_emit_llvm))
+  Diag(clang::diag::err_drv_emit_llvm_link);
+if (Args.hasArg(options::OPT_nodefaultlibs) &&
+Args.hasArg(options::OPT_fsanitize_EQ))
+  Diag(clang::diag::warn_drv_sanitizers_and_nodefaultlibs);
   }
 
   // Reject -Z* at the top level, these options should never have been exposed
Index: include/clang/Basic/DiagnosticDriverKinds.td
===
--- include/clang/Basic/DiagnosticDriverKinds.td
+++ include/clang/Basic/DiagnosticDriverKinds.td
@@ -271,4 +271,7 @@
   InGroup;
 
 def err_drv_unsupported_linker : Error<"unsupported value '%0' for -linker 
option">;
+
+def warn_drv_sanitizers_and_nodefaultlibs : Warning<
+  "Passing -nodefaultlibs and -fsanitize may result in linking sanitizer 
runtimes.">;
 }


Index: test/Driver/nodefaultlib.c
===
--- test/Driver/nodefaultlib.c
+++ test/Driver/nodefaultlib.c
@@ -8,3 +8,7 @@
 // RUN: %clang -target i686-pc-linux-gnu -stdlib=libc++ -nodefaultlibs -lstdc++ -### %s 2>&1 | FileCheck -check-prefix=TEST2 %s
 // TEST2-NOT: "-lc++"
 // TEST2: "-lstdc++"
+
+// RUN: %clang -target i686-pc-linux-gnu -nodefaultlibs -fsanitize=address -### %s 2>&1 | FileCheck -check-prefix=TEST3 %s
+// TEST3: warning: Passing -nodefaultlibs and -fsanitize may result in linking sanitizer runtimes.
+// TEST3: libclang_rt.asan-i686.a
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -1546,8 +1546,12 @@
   Arg *FinalPhaseArg;
   phases::ID FinalPhase = getFinalPhase(Args, );
 
-  if (FinalPhase == phases::Link && Args.hasArg(options::OPT_emit_llvm)) {
-Diag(clang::diag::err_drv_emit_llvm_link);
+  if (FinalPhase == phases::Link) {
+if(Args.hasArg(options::OPT_emit_llvm))
+  Diag(clang::diag::err_drv_emit_llvm_link);
+if (Args.hasArg(options::OPT_nodefaultlibs) &&
+Args.hasArg(options::OPT_fsanitize_EQ))
+  Diag(clang::diag::warn_drv_sanitizers_and_nodefaultlibs);
   }
 
   // Reject -Z* at the top level, these options should never have been exposed
Index: include/clang/Basic/DiagnosticDriverKinds.td
===
--- include/clang/Basic/DiagnosticDriverKinds.td
+++ include/clang/Basic/DiagnosticDriverKinds.td
@@ -271,4 +271,7 @@
   InGroup;
 
 def err_drv_unsupported_linker : Error<"unsupported value '%0' for -linker option">;
+
+def warn_drv_sanitizers_and_nodefaultlibs : Warning<
+  "Passing -nodefaultlibs and -fsanitize may result in linking sanitizer runtimes.">;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24097: Add testcases for PR30188

2016-08-31 Thread Richard Smith via cfe-commits
rsmith added a subscriber: rsmith.
rsmith requested changes to this revision.
rsmith added a reviewer: rsmith.
rsmith added a comment.
This revision now requires changes to proceed.

This belongs in LLVM's test suite, not Clang's.


https://reviews.llvm.org/D24097



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


Re: [PATCH] D23734: Add -fprofile-dir= to clang.

2016-08-31 Thread Nick Lewycky via cfe-commits
nlewycky updated this revision to Diff 69905.

https://reviews.llvm.org/D23734

Files:
  lib/Transforms/Instrumentation/GCOVProfiling.cpp
  test/Transforms/GCOVProfiling/three-element-mdnode.ll
  tools/clang/include/clang/Driver/CC1Options.td
  tools/clang/include/clang/Driver/Options.td
  tools/clang/include/clang/Frontend/CodeGenOptions.h
  tools/clang/lib/CodeGen/CodeGenModule.cpp
  tools/clang/lib/Driver/Tools.cpp
  tools/clang/lib/Frontend/CompilerInvocation.cpp
  tools/clang/test/CodeGen/code-coverage.c
  tools/clang/test/Driver/clang_f_opts.c
  tools/clang/test/Driver/coverage_no_integrated_as.c

Index: tools/clang/test/Driver/coverage_no_integrated_as.c
===
--- tools/clang/test/Driver/coverage_no_integrated_as.c
+++ tools/clang/test/Driver/coverage_no_integrated_as.c
@@ -17,7 +17,7 @@
 // RUN: %clang -### -c -fprofile-arcs -no-integrated-as %s -o foo/bar.o 2>&1 | FileCheck -check-prefix=CHECK-GCNO-LOCATION-REL-PATH %s
 
 
-// CHECK-GCNO-DEFAULT-LOCATION: "-coverage-file" "{{.*}}{{/|}}coverage_no_integrated_as.c"
-// CHECK-GCNO-DEFAULT-LOCATION-NOT: "-coverage-file" "/tmp/{{.*}}/coverage_no_integrated_as.c"
-// CHECK-GCNO-LOCATION: "-coverage-file" "{{.*}}/foo/bar.o"
-// CHECK-GCNO-LOCATION-REL-PATH: "-coverage-file" "{{.*}}{{/|}}foo/bar.o"
+// CHECK-GCNO-DEFAULT-LOCATION: "-coverage-notes-file" "{{.*}}{{/|}}coverage_no_integrated_as.c"
+// CHECK-GCNO-DEFAULT-LOCATION-NOT: "-coverage-notes-file" "/tmp/{{.*}}/coverage_no_integrated_as.c"
+// CHECK-GCNO-LOCATION: "-coverage-notes-file" "{{.*}}/foo/bar.gcno"
+// CHECK-GCNO-LOCATION-REL-PATH: "-coverage-notes-file" "{{.*}}{{/|}}foo/bar.gcno"
Index: tools/clang/test/Driver/clang_f_opts.c
===
--- tools/clang/test/Driver/clang_f_opts.c
+++ tools/clang/test/Driver/clang_f_opts.c
@@ -66,6 +66,16 @@
 // CHECK-PROFILE-ARCS: "-femit-coverage-data"
 // CHECK-NO-PROFILE-ARCS-NOT: "-femit-coverage-data"
 
+// RUN: %clang -### -S -fprofile-dir=abc %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-DIR-UNUSED %s
+// RUN: %clang -### -S -ftest-coverage -fprofile-dir=abc %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-DIR-UNUSED %s
+// RUN: %clang -### -S -fprofile-arcs -fprofile-dir=abc %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-DIR %s
+// RUN: %clang -### -S --coverage -fprofile-dir=abc %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-DIR %s
+// RUN: %clang -### -S -fprofile-arcs -fno-profile-arcs -fprofile-dir=abc %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-DIR-NEITHER %s
+// CHECK-PROFILE-DIR: "-coverage-data-file" "abc
+// CHECK-PROFILE-DIR-UNUSED: argument unused
+// CHECK-PROFILE-DIR-UNUSED-NOT: "-coverage-data-file" "abc
+// CHECK-PROFILE-DIR-NEITHER-NOT: argument unused
+
 // RUN: %clang -### -S -fprofile-generate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-LLVM %s
 // RUN: %clang -### -S -fprofile-instr-generate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s
 // RUN: %clang -### -S -fprofile-generate=/some/dir %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-DIR %s
@@ -212,7 +222,6 @@
 // RUN: -fdefer-pop -fno-defer-pop\
 // RUN: -fprefetch-loop-arrays -fno-prefetch-loop-arrays  \
 // RUN: -fprofile-correction -fno-profile-correction  \
-// RUN: -fprofile-dir=bar \
 // RUN: -fprofile-values -fno-profile-values  \
 // RUN: -frounding-math -fno-rounding-math\
 // RUN: -fsee -fno-see\
@@ -290,7 +299,6 @@
 // RUN: -fkeep-inline-functions   \
 // RUN: -fno-keep-inline-functions\
 // RUN: -freorder-blocks  \
-// RUN: -fprofile-dir=/rand/dir   \
 // RUN: -falign-functions \
 // RUN: -falign-functions=1   \
 // RUN: -ffloat-store \
@@ -357,7 +365,6 @@
 // CHECK-WARNING-DAG: optimization flag '-fkeep-inline-functions' is not supported
 // CHECK-WARNING-DAG: optimization flag '-fno-keep-inline-functions' is not supported
 // CHECK-WARNING-DAG: optimization flag '-freorder-blocks' is not supported
-// CHECK-WARNING-DAG: optimization flag '-fprofile-dir=/rand/dir' is not supported
 // CHECK-WARNING-DAG: optimization flag '-falign-functions' is not supported
 // CHECK-WARNING-DAG: optimization flag '-falign-functions=1' is not supported
 // CHECK-WARNING-DAG: optimization flag '-ffloat-store' is not supported
Index: tools/clang/test/CodeGen/code-coverage.c

r280290 - DebugInfo: Fix -gsplit-dwarf + -fno-split-dwarf-inlining

2016-08-31 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Wed Aug 31 15:54:35 2016
New Revision: 280290

URL: http://llvm.org/viewvc/llvm-project?rev=280290=rev
Log:
DebugInfo: Fix -gsplit-dwarf + -fno-split-dwarf-inlining

I tested the cases involving split-dwarf + gmlt +
no-split-dwarf-inlining, but didn't verify the simpler case without
gmlt.

The logic is, admittedly, a little hairy, but seems about as simple as I
could wrangle it.

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/split-debug.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=280290=280289=280290=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Aug 31 15:54:35 2016
@@ -4602,8 +4602,6 @@ void Clang::ConstructJob(Compilation ,
   bool splitDwarfInlining =
   Args.hasFlag(options::OPT_fsplit_dwarf_inlining,
options::OPT_fno_split_dwarf_inlining, true);
-  if (!splitDwarfInlining)
-CmdArgs.push_back("-fno-split-dwarf-inlining");
 
   Args.ClaimAllArgs(options::OPT_g_Group);
   Arg *SplitDwarfArg = Args.getLastArg(options::OPT_gsplit_dwarf);
@@ -4619,11 +4617,15 @@ void Clang::ConstructJob(Compilation ,
   // split-dwarf and line-tables-only, so let those compose naturally in
   // that case.
   // And if you just turned off debug info, (-gsplit-dwarf -g0) - do that.
-  if (SplitDwarfArg && A->getIndex() > SplitDwarfArg->getIndex() &&
-  ((DebugInfoKind == codegenoptions::DebugLineTablesOnly &&
-splitDwarfInlining) ||
-   DebugInfoKind == codegenoptions::NoDebugInfo))
-SplitDwarfArg = nullptr;
+  if (SplitDwarfArg) {
+if (A->getIndex() > SplitDwarfArg->getIndex()) {
+  if (DebugInfoKind == codegenoptions::NoDebugInfo ||
+  (DebugInfoKind == codegenoptions::DebugLineTablesOnly &&
+   splitDwarfInlining))
+SplitDwarfArg = nullptr;
+} else if (splitDwarfInlining)
+  DebugInfoKind = codegenoptions::NoDebugInfo;
+  }
 } else
   // For any other 'g' option, use Limited.
   DebugInfoKind = codegenoptions::LimitedDebugInfo;
@@ -4678,7 +4680,9 @@ void Clang::ConstructJob(Compilation ,
   // splitting and extraction.
   // FIXME: Currently only works on Linux.
   if (getToolChain().getTriple().isOSLinux() && SplitDwarfArg) {
-if (splitDwarfInlining)
+if (!splitDwarfInlining)
+  CmdArgs.push_back("-fno-split-dwarf-inlining");
+if (DebugInfoKind == codegenoptions::NoDebugInfo)
   DebugInfoKind = codegenoptions::LimitedDebugInfo;
 CmdArgs.push_back("-backend-option");
 CmdArgs.push_back("-split-dwarf=Enable");

Modified: cfe/trunk/test/Driver/split-debug.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/split-debug.c?rev=280290=280289=280290=diff
==
--- cfe/trunk/test/Driver/split-debug.c (original)
+++ cfe/trunk/test/Driver/split-debug.c Wed Aug 31 15:54:35 2016
@@ -47,6 +47,13 @@
 // CHECK-SPLIT-WITH-GMLT: "-debug-info-kind=line-tables-only"
 // CHECK-SPLIT-WITH-GMLT: "-split-dwarf-file"
 
+// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf 
-fno-split-dwarf-inlining -S -### %s 2> %t
+// RUN: FileCheck -check-prefix=CHECK-SPLIT-WITH-NOINL < %t %s
+//
+// CHECK-SPLIT-WITH-NOINL: "-split-dwarf=Enable"
+// CHECK-SPLIT-WITH-NOINL: "-debug-info-kind=limited"
+// CHECK-SPLIT-WITH-NOINL: "-split-dwarf-file"
+
 // RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -gmlt -S -### %s 
2> %t
 // RUN: FileCheck -check-prefix=CHECK-GMLT-OVER-SPLIT < %t %s
 //


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


Re: [PATCH] D24097: Add testcases for PR30188

2016-08-31 Thread David Li via cfe-commits
davidxl added inline comments.


Comment at: clang/test/CodeGen/pr30188.c:3
@@ +2,3 @@
+
+// Check that optimizers are able to optimize the number of loads in the loop.
+// CHECK: load

Can you just do 

... | grep load  | count 3


Comment at: clang/test/CodeGen/pr30188.c:7
@@ +6,3 @@
+// CHECK: load
+// CHECK-NOT: load
+

Also check there is no store


Comment at: clang/test/CodeGenCXX/pr30188.cpp:5
@@ +4,3 @@
+// CHECK: load
+// CHECK-NOT: load
+

check no store as well?


https://reviews.llvm.org/D24097



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


Re: r262189 - [modules] Prefer more complete array types.

2016-08-31 Thread Vassil Vassilev via cfe-commits

Hi Akira,
  Thanks for your email. I am on vacation right now and I will try to 
look at this issue as soon as I can.

  Sorry for the inconvenience.
Cheers,
Vassil
On 31/08/16 22:56, Akira Hatanaka wrote:

Vassil and Richard,

After this commit, clang errors out when compiling the following code, 
which used to compile without any errors.


$ cat f2.cpp
extern int compile_time_assert_failed[1];

template 
class C {
enum { D };
public:
template  void foo1() {
extern int compile_time_assert_failed[ ((int)C::k > (int)D) ? 1 : -1];
}
};

template<>
class C {
public:
const static int k = 2;
};

void foo2() {
C c;
c.foo1();
}

$ cat f3.cpp
void foo1() {
  extern int foo0[1];
}

template
void foo2() {
  extern int foo0[n ? 1 : -1];
}

void foo3() {
  foo2<5>();
}

The code looks legal, so I don’t think clang should complain?

On Feb 28, 2016, at 11:08 AM, Vassil Vassilev via cfe-commits 
> wrote:


Author: vvassilev
Date: Sun Feb 28 13:08:24 2016
New Revision: 262189

URL: http://llvm.org/viewvc/llvm-project?rev=262189=rev
Log:
[modules] Prefer more complete array types.

If we import a module that has a complete array type and one that has an
incomplete array type, the declaration found by name lookup might be 
the one with

the incomplete type, possibly resulting in rejects-valid.

Now, the name lookup prefers decls with a complete array types. Also,
diagnose cases when the redecl chain has array bound, different from 
the merge

candidate.

Reviewed by Richard Smith.

Modified:
   cfe/trunk/lib/Sema/SemaDecl.cpp
   cfe/trunk/lib/Sema/SemaLookup.cpp
   cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
   cfe/trunk/test/CXX/dcl.decl/dcl.meaning/dcl.array/p3.cpp
   cfe/trunk/test/Modules/Inputs/PR26179/A.h
   cfe/trunk/test/Modules/Inputs/PR26179/B.h
   cfe/trunk/test/Modules/Inputs/PR26179/basic_string.h

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=262189=262188=262189=diff

==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sun Feb 28 13:08:24 2016
@@ -3245,6 +3245,22 @@ void Sema::mergeObjCMethodDecls(ObjCMeth
  CheckObjCMethodOverride(newMethod, oldMethod);
}

+static void diagnoseVarDeclTypeMismatch(Sema , VarDecl *New, 
VarDecl* Old) {

+  assert(!S.Context.hasSameType(New->getType(), Old->getType()));
+
+  S.Diag(New->getLocation(), New->isThisDeclarationADefinition()
+ ? diag::err_redefinition_different_type
+ : diag::err_redeclaration_different_type)
+<< New->getDeclName() << New->getType() << Old->getType();
+
+  diag::kind PrevDiag;
+  SourceLocation OldLocation;
+  std::tie(PrevDiag, OldLocation)
+= getNoteDiagForInvalidRedeclaration(Old, New);
+  S.Diag(OldLocation, PrevDiag);
+  New->setInvalidDecl();
+}
+
/// MergeVarDeclTypes - We parsed a variable 'New' which has the same 
name and
/// scope as a previous declaration 'Old'.  Figure out how to merge 
their types,

/// emitting diagnostics as appropriate.
@@ -3271,21 +3287,40 @@ void Sema::MergeVarDeclTypes(VarDecl *Ne
//   object or function shall be identical, except that 
declarations for an
//   array object can specify array types that differ by the 
presence or

//   absence of a major array bound (8.3.4).
-else if (Old->getType()->isIncompleteArrayType() &&
- New->getType()->isArrayType()) {
-  const ArrayType *OldArray = 
Context.getAsArrayType(Old->getType());
-  const ArrayType *NewArray = 
Context.getAsArrayType(New->getType());

-  if (Context.hasSameType(OldArray->getElementType(),
-  NewArray->getElementType()))
-MergedT = New->getType();
-} else if (Old->getType()->isArrayType() &&
-   New->getType()->isIncompleteArrayType()) {
+else if (Old->getType()->isArrayType() && 
New->getType()->isArrayType()) {

  const ArrayType *OldArray = Context.getAsArrayType(Old->getType());
  const ArrayType *NewArray = Context.getAsArrayType(New->getType());
-  if (Context.hasSameType(OldArray->getElementType(),
-  NewArray->getElementType()))
-MergedT = Old->getType();
-} else if (New->getType()->isObjCObjectPointerType() &&
+
+  // We are merging a variable declaration New into Old. If it 
has an array
+  // bound, and that bound differs from Old's bound, we should 
diagnose the

+  // mismatch.
+  if (!NewArray->isIncompleteArrayType()) {
+for (VarDecl *PrevVD = Old->getMostRecentDecl(); PrevVD;
+ PrevVD = PrevVD->getPreviousDecl()) {
+  const ArrayType *PrevVDTy = 
Context.getAsArrayType(PrevVD->getType());

+  if (PrevVDTy->isIncompleteArrayType())
+continue;
+
+  if (!Context.hasSameType(NewArray, PrevVDTy))
+return 

r280289 - Don't diagnoes a mismatch between implicit and explicit exception

2016-08-31 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Aug 31 15:38:32 2016
New Revision: 280289

URL: http://llvm.org/viewvc/llvm-project?rev=280289=rev
Log:
Don't diagnoes a mismatch between implicit and explicit exception
specifications under -fno-exceptions, just as we don't diagnose other exception
specification mismatch errors.

Modified:
cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
cfe/trunk/test/CXX/basic/basic.stc/basic.stc.dynamic/p2-noexceptions.cpp
cfe/trunk/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp

Modified: cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExceptionSpec.cpp?rev=280289=280288=280289=diff
==
--- cfe/trunk/lib/Sema/SemaExceptionSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExceptionSpec.cpp Wed Aug 31 15:38:32 2016
@@ -235,7 +235,7 @@ bool Sema::CheckEquivalentExceptionSpec(
 //   If a declaration of a function has an implicit
 //   exception-specification, other declarations of the function shall
 //   not specify an exception-specification.
-if (getLangOpts().CPlusPlus11 &&
+if (getLangOpts().CPlusPlus11 && getLangOpts().CXXExceptions &&
 hasImplicitExceptionSpec(Old) != hasImplicitExceptionSpec(New)) {
   Diag(New->getLocation(), diag::ext_implicit_exception_spec_mismatch)
 << hasImplicitExceptionSpec(Old);

Modified: 
cfe/trunk/test/CXX/basic/basic.stc/basic.stc.dynamic/p2-noexceptions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/basic/basic.stc/basic.stc.dynamic/p2-noexceptions.cpp?rev=280289=280288=280289=diff
==
--- cfe/trunk/test/CXX/basic/basic.stc/basic.stc.dynamic/p2-noexceptions.cpp 
(original)
+++ cfe/trunk/test/CXX/basic/basic.stc/basic.stc.dynamic/p2-noexceptions.cpp 
Wed Aug 31 15:38:32 2016
@@ -1,3 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 // expected-no-diagnostics
 namespace std {

Modified: cfe/trunk/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp?rev=280289=280288=280289=diff
==
--- cfe/trunk/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp (original)
+++ cfe/trunk/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp Wed Aug 31 
15:38:32 2016
@@ -1,3 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -fexceptions -fcxx-exceptions -verify 
-std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -fexceptions -fcxx-exceptions -verify 
-std=c++11 %s
 // RUN: %clang_cc1 -fsyntax-only -fexceptions -fcxx-exceptions -verify %s
 int *use_new(int N) {
   if (N == 1)
@@ -19,10 +21,21 @@ namespace std {
   typedef __SIZE_TYPE__ size_t;
 }
 
-void* operator new(std::size_t) throw(std::bad_alloc); // 
expected-note{{previous declaration}}
+void* operator new(std::size_t) throw(std::bad_alloc);
+#if __cplusplus < 201103L
+// expected-note@-2 {{previous declaration}}
+#endif
 void* operator new[](std::size_t) throw(std::bad_alloc); 
 void operator delete(void*) throw(); // expected-note{{previous declaration}}
 void operator delete[](void*) throw();
 
-void* operator new(std::size_t); // expected-warning{{'operator new' is 
missing exception specification 'throw(std::bad_alloc)'}}
-void operator delete(void*); // expected-warning{{'operator delete' is missing 
exception specification 'throw()'}}
+void* operator new(std::size_t);
+#if __cplusplus < 201103L
+// expected-warning@-2 {{'operator new' is missing exception specification 
'throw(std::bad_alloc)'}}
+#endif
+void operator delete(void*);
+#if __cplusplus < 201103L
+// expected-warning@-2 {{'operator delete' is missing exception specification 
'throw()'}}
+#else
+// expected-warning@-4 {{previously declared with an explicit exception 
specification redeclared with an implicit}}
+#endif


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


r280288 - Fix mishandling of deletedness for assignment operators of classes with

2016-08-31 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Aug 31 15:37:39 2016
New Revision: 280288

URL: http://llvm.org/viewvc/llvm-project?rev=280288=rev
Log:
Fix mishandling of deletedness for assignment operators of classes with
indirect virtual bases. We don't need to be able to invoke such an assignment
operator from the derived class, and we shouldn't delete the derived assignment
op if we can't do so.

Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/CXX/special/class.copy/p20.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=280288=280287=280288=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Aug 31 15:37:39 2016
@@ -6765,13 +6765,14 @@ bool Sema::ShouldDeleteSpecialMember(CXX
   SpecialMemberDeletionInfo SMI(*this, MD, CSM, ICI, Diagnose);
 
   for (auto  : RD->bases())
-if (!BI.isVirtual() &&
+if ((SMI.IsAssignment || !BI.isVirtual()) &&
 SMI.shouldDeleteForBase())
   return true;
 
   // Per DR1611, do not consider virtual bases of constructors of abstract
-  // classes, since we are not going to construct them.
-  if (!RD->isAbstract() || !SMI.IsConstructor) {
+  // classes, since we are not going to construct them. For assignment
+  // operators, we only assign (and thus only consider) direct bases.
+  if ((!RD->isAbstract() || !SMI.IsConstructor) && !SMI.IsAssignment) {
 for (auto  : RD->vbases())
   if (SMI.shouldDeleteForBase())
 return true;

Modified: cfe/trunk/test/CXX/special/class.copy/p20.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.copy/p20.cpp?rev=280288=280287=280288=diff
==
--- cfe/trunk/test/CXX/special/class.copy/p20.cpp (original)
+++ cfe/trunk/test/CXX/special/class.copy/p20.cpp Wed Aug 31 15:37:39 2016
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 
 struct ConstCopy {
   ConstCopy();


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


r280287 - [codeview] Don't emit vshape info for classes without vfptrs

2016-08-31 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Wed Aug 31 15:35:01 2016
New Revision: 280287

URL: http://llvm.org/viewvc/llvm-project?rev=280287=rev
Log:
[codeview] Don't emit vshape info for classes without vfptrs

Classes with no virtual methods or whose virtual methods were all
inherited from virtual bases don't have a vfptr at offset zero. We were
crashing attempting to get the layout of that non-existent vftable.

We don't need any vshape info in this case because the debugger can
infer it from the base class information. The current class may not
introduce any virtual methods if we are in this situation.

Added:
cfe/trunk/test/CodeGenCXX/debug-info-ms-vbase.cpp
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=280287=280286=280287=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Aug 31 15:35:01 2016
@@ -1555,6 +1555,14 @@ void CGDebugInfo::CollectVTableInfo(cons
   if (!RD->isDynamicClass())
 return;
 
+  // Don't emit any vtable shape or vptr info if this class doesn't have an
+  // extendable vfptr. This can happen if the class doesn't have virtual
+  // methods, or in the MS ABI if those virtual methods only come from 
virtually
+  // inherited bases.
+  const ASTRecordLayout  = CGM.getContext().getASTRecordLayout(RD);
+  if (!RL.hasExtendableVFPtr())
+return;
+
   // CodeView needs to know how large the vtable of every dynamic class is, so
   // emit a special named pointer type into the element list. The vptr type
   // points to this type as well.
@@ -1580,7 +1588,6 @@ void CGDebugInfo::CollectVTableInfo(cons
   }
 
   // If there is a primary base then the artificial vptr member lives there.
-  const ASTRecordLayout  = CGM.getContext().getASTRecordLayout(RD);
   if (RL.getPrimaryBase())
 return;
 

Added: cfe/trunk/test/CodeGenCXX/debug-info-ms-vbase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-ms-vbase.cpp?rev=280287=auto
==
--- cfe/trunk/test/CodeGenCXX/debug-info-ms-vbase.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/debug-info-ms-vbase.cpp Wed Aug 31 15:35:01 2016
@@ -0,0 +1,54 @@
+// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-info-kind=limited 
-gcodeview -emit-llvm -o - | FileCheck %s
+
+// Tests virtual bases in the MS ABI.
+
+struct POD { int pod; };
+
+struct DynamicNoVFPtr : virtual POD { };
+
+DynamicNoVFPtr dynamic_no_vfptr;
+
+// CHECK: ![[DynamicNoVFPtr:[0-9]+]] = distinct !DICompositeType(tag: 
DW_TAG_structure_type, name: "DynamicNoVFPtr",
+// CHECK-SAME: elements: ![[elements:[0-9]+]]
+
+// CHECK: ![[elements]] = !{![[POD_base:[0-9]+]]}
+
+// CHECK: ![[POD_base]] = !DIDerivedType(tag: DW_TAG_inheritance, scope: 
![[DynamicNoVFPtr]],
+// CHECK-SAME: baseType: ![[POD:[0-9]+]], offset: 4, flags: DIFlagVirtual)
+
+// CHECK: ![[POD]] = distinct !DICompositeType(tag: DW_TAG_structure_type, 
name: "POD"
+
+struct HasVirtualMethod { virtual void f(); };
+
+struct NoPrimaryBase : virtual HasVirtualMethod { };
+
+NoPrimaryBase no_primary_base;
+
+// CHECK: ![[NoPrimaryBase:[0-9]+]] = distinct !DICompositeType(tag: 
DW_TAG_structure_type, name: "NoPrimaryBase",
+// CHECK-SAME: elements: ![[elements:[0-9]+]]
+
+// CHECK: ![[elements]] = !{![[NoPrimaryBase_base:[0-9]+]]}
+
+// CHECK: ![[NoPrimaryBase_base]] = !DIDerivedType(tag: DW_TAG_inheritance, 
scope: ![[NoPrimaryBase]],
+// CHECK-SAME: baseType: ![[HasVirtualMethod:[0-9]+]], offset: 4, flags: 
DIFlagVirtual)
+
+// CHECK: ![[HasVirtualMethod]] = distinct !DICompositeType(tag: 
DW_TAG_structure_type, name: "HasVirtualMethod"
+
+struct SecondaryVTable { virtual void g(); };
+
+struct HasPrimaryBase : virtual SecondaryVTable, HasVirtualMethod { };
+
+HasPrimaryBase has_primary_base;
+
+// CHECK: ![[HasPrimaryBase:[0-9]+]] = distinct !DICompositeType(tag: 
DW_TAG_structure_type, name: "HasPrimaryBase",
+// CHECK-SAME: elements: ![[elements:[0-9]+]]
+
+// CHECK: ![[elements]] = !{![[SecondaryVTable_base:[0-9]+]], 
![[HasVirtualMethod_base:[0-9]+]], ![[vshape:[0-9]+]]}
+
+// CHECK: ![[SecondaryVTable_base]] = !DIDerivedType(tag: DW_TAG_inheritance, 
scope: ![[HasPrimaryBase]],
+// CHECK-SAME: baseType: ![[SecondaryVTable:[0-9]+]], offset: 4, flags: 
DIFlagVirtual)
+
+// CHECK: ![[SecondaryVTable]] = distinct !DICompositeType(tag: 
DW_TAG_structure_type, name: "SecondaryVTable"
+
+// CHECK: ![[HasVirtualMethod_base]] = !DIDerivedType(tag: DW_TAG_inheritance, 
scope: ![[HasPrimaryBase]], baseType: ![[HasVirtualMethod]])
+


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


[PATCH] D24099: [libc++] Don't add -fPIC on Windows

2016-08-31 Thread Shoaib Meenai via cfe-commits
smeenai created this revision.
smeenai added reviewers: compnerd, EricWF, mclow.lists.
smeenai added a subscriber: cfe-commits.

-fPIC doesn't make much sense for Windows, since Windows DLLs aren't
compiled position independent and are instead relocated at runtime
instead.

https://reviews.llvm.org/D24099

Files:
  lib/CMakeLists.txt

Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -72,7 +72,9 @@
 add_library_flags_if(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB atomic)
 
 # Setup flags.
-add_flags_if_supported(-fPIC)
+if (NOT WIN32)
+  add_flags_if_supported(-fPIC)
+endif()
 add_link_flags_if_supported(-nodefaultlibs)
 
 if ( APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR


Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -72,7 +72,9 @@
 add_library_flags_if(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB atomic)
 
 # Setup flags.
-add_flags_if_supported(-fPIC)
+if (NOT WIN32)
+  add_flags_if_supported(-fPIC)
+endif()
 add_link_flags_if_supported(-nodefaultlibs)
 
 if ( APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxxabi] r280286 - libc++abi: fix some -Wunused-function warnings

2016-08-31 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Wed Aug 31 15:29:05 2016
New Revision: 280286

URL: http://llvm.org/viewvc/llvm-project?rev=280286=rev
Log:
libc++abi: fix some -Wunused-function warnings

is_initialized is only used in the no threads case or if on non ARM Apple
targets.  Use the preprocessor to remove the function otherwise.  NFC.

Modified:
libcxxabi/trunk/src/cxa_guard.cpp

Modified: libcxxabi/trunk/src/cxa_guard.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_guard.cpp?rev=280286=280285=280286=diff
==
--- libcxxabi/trunk/src/cxa_guard.cpp (original)
+++ libcxxabi/trunk/src/cxa_guard.cpp Wed Aug 31 15:29:05 2016
@@ -34,35 +34,39 @@ namespace
 {
 
 #ifdef __arm__
-
 // A 32-bit, 4-byte-aligned static data value. The least significant 2 bits 
must
 // be statically initialized to 0.
 typedef uint32_t guard_type;
 
-// Test the lowest bit.
-inline bool is_initialized(guard_type* guard_object) {
-return (*guard_object) & 1;
-}
-
 inline void set_initialized(guard_type* guard_object) {
 *guard_object |= 1;
 }
-
 #else
-
 typedef uint64_t guard_type;
 
-bool is_initialized(guard_type* guard_object) {
+void set_initialized(guard_type* guard_object) {
 char* initialized = (char*)guard_object;
-return *initialized;
+*initialized = 1;
 }
+#endif
 
-void set_initialized(guard_type* guard_object) {
+#if LIBCXXABI_HAS_NO_THREADS || (defined(__APPLE__) && !defined(__arm__))
+#ifdef __arm__
+
+// Test the lowest bit.
+inline bool is_initialized(guard_type* guard_object) {
+return (*guard_object) & 1;
+}
+
+#else
+
+bool is_initialized(guard_type* guard_object) {
 char* initialized = (char*)guard_object;
-*initialized = 1;
+return *initialized;
 }
 
 #endif
+#endif
 
 #if !LIBCXXABI_HAS_NO_THREADS
 pthread_mutex_t guard_mut = PTHREAD_MUTEX_INITIALIZER;


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


Re: [PATCH] D24091: [Driver] Warn on -nodefaultlibs and -fsanitize

2016-08-31 Thread Chris Bieneman via cfe-commits
beanz added a comment.

I can change the implementation, but that quickly falls into target specific 
driver code. It results in adding the warning in one place for Darwin, another 
for FreeBSD, and a third for GNUTools.

If that is the preferred way I can work up that patch.


https://reviews.llvm.org/D24091



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


Re: r262189 - [modules] Prefer more complete array types.

2016-08-31 Thread Akira Hatanaka via cfe-commits
Vassil and Richard,

After this commit, clang errors out when compiling the following code, which 
used to compile without any errors.

$ cat f2.cpp
extern int compile_time_assert_failed[1]; 

template 
class C {
enum { D };
public:
template  void foo1() {
  extern int compile_time_assert_failed[ ((int)C::k > (int)D) ? 1 : -1];
}
};

template<>
class C {
public:
  const static int k = 2;
};

void foo2() {
  C c;
  c.foo1();
}

$ cat f3.cpp 
void foo1() {
  extern int foo0[1];
}

template
void foo2() {
  extern int foo0[n ? 1 : -1];
}

void foo3() {
  foo2<5>();
}

The code looks legal, so I don’t think clang should complain?

> On Feb 28, 2016, at 11:08 AM, Vassil Vassilev via cfe-commits 
>  wrote:
> 
> Author: vvassilev
> Date: Sun Feb 28 13:08:24 2016
> New Revision: 262189
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=262189=rev
> Log:
> [modules] Prefer more complete array types.
> 
> If we import a module that has a complete array type and one that has an
> incomplete array type, the declaration found by name lookup might be the one 
> with
> the incomplete type, possibly resulting in rejects-valid.
> 
> Now, the name lookup prefers decls with a complete array types. Also,
> diagnose cases when the redecl chain has array bound, different from the merge
> candidate.
> 
> Reviewed by Richard Smith.
> 
> Modified:
>cfe/trunk/lib/Sema/SemaDecl.cpp
>cfe/trunk/lib/Sema/SemaLookup.cpp
>cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>cfe/trunk/test/CXX/dcl.decl/dcl.meaning/dcl.array/p3.cpp
>cfe/trunk/test/Modules/Inputs/PR26179/A.h
>cfe/trunk/test/Modules/Inputs/PR26179/B.h
>cfe/trunk/test/Modules/Inputs/PR26179/basic_string.h
> 
> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=262189=262188=262189=diff
> ==
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Sun Feb 28 13:08:24 2016
> @@ -3245,6 +3245,22 @@ void Sema::mergeObjCMethodDecls(ObjCMeth
>   CheckObjCMethodOverride(newMethod, oldMethod);
> }
> 
> +static void diagnoseVarDeclTypeMismatch(Sema , VarDecl *New, VarDecl* Old) 
> {
> +  assert(!S.Context.hasSameType(New->getType(), Old->getType()));
> +
> +  S.Diag(New->getLocation(), New->isThisDeclarationADefinition()
> + ? diag::err_redefinition_different_type
> + : diag::err_redeclaration_different_type)
> +<< New->getDeclName() << New->getType() << Old->getType();
> +
> +  diag::kind PrevDiag;
> +  SourceLocation OldLocation;
> +  std::tie(PrevDiag, OldLocation)
> += getNoteDiagForInvalidRedeclaration(Old, New);
> +  S.Diag(OldLocation, PrevDiag);
> +  New->setInvalidDecl();
> +}
> +
> /// MergeVarDeclTypes - We parsed a variable 'New' which has the same name and
> /// scope as a previous declaration 'Old'.  Figure out how to merge their 
> types,
> /// emitting diagnostics as appropriate.
> @@ -3271,21 +3287,40 @@ void Sema::MergeVarDeclTypes(VarDecl *Ne
> //   object or function shall be identical, except that declarations for 
> an
> //   array object can specify array types that differ by the presence or
> //   absence of a major array bound (8.3.4).
> -else if (Old->getType()->isIncompleteArrayType() &&
> - New->getType()->isArrayType()) {
> -  const ArrayType *OldArray = Context.getAsArrayType(Old->getType());
> -  const ArrayType *NewArray = Context.getAsArrayType(New->getType());
> -  if (Context.hasSameType(OldArray->getElementType(),
> -  NewArray->getElementType()))
> -MergedT = New->getType();
> -} else if (Old->getType()->isArrayType() &&
> -   New->getType()->isIncompleteArrayType()) {
> +else if (Old->getType()->isArrayType() && New->getType()->isArrayType()) 
> {
>   const ArrayType *OldArray = Context.getAsArrayType(Old->getType());
>   const ArrayType *NewArray = Context.getAsArrayType(New->getType());
> -  if (Context.hasSameType(OldArray->getElementType(),
> -  NewArray->getElementType()))
> -MergedT = Old->getType();
> -} else if (New->getType()->isObjCObjectPointerType() &&
> +
> +  // We are merging a variable declaration New into Old. If it has an 
> array
> +  // bound, and that bound differs from Old's bound, we should diagnose 
> the
> +  // mismatch.
> +  if (!NewArray->isIncompleteArrayType()) {
> +for (VarDecl *PrevVD = Old->getMostRecentDecl(); PrevVD;
> + PrevVD = PrevVD->getPreviousDecl()) {
> +  const ArrayType *PrevVDTy = 
> Context.getAsArrayType(PrevVD->getType());
> +  if (PrevVDTy->isIncompleteArrayType())
> +continue;
> +
> +  if (!Context.hasSameType(NewArray, PrevVDTy))
> +return diagnoseVarDeclTypeMismatch(*this, New, PrevVD);
> +}
> +  }
> +
> + 

r280281 - Revert "Driver: use the canonical static library naming"

2016-08-31 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Wed Aug 31 14:27:07 2016
New Revision: 280281

URL: http://llvm.org/viewvc/llvm-project?rev=280281=rev
Log:
Revert "Driver: use the canonical static library naming"

This breaks chromium and its unclear if this is actually a modern convention.

This reverts SVN r280169.

Modified:
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/test/Driver/arm-compiler-rt.c
cfe/trunk/test/Driver/windows-cross.c

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=280281=280280=280281=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Wed Aug 31 14:27:07 2016
@@ -288,13 +288,13 @@ std::string ToolChain::getCompilerRT(con
  bool Shared) const {
   const llvm::Triple  = getTriple();
   const char *Env = TT.isAndroid() ? "-android" : "";
-  bool IsWindowsIAMSVC =
+  bool IsITANMSVCWindows =
   TT.isWindowsMSVCEnvironment() || TT.isWindowsItaniumEnvironment();
 
   StringRef Arch = getArchNameForCompilerRTLib(*this, Args);
-  const char *Prefix = (IsWindowsIAMSVC && Shared) ? "" : "lib";
+  const char *Prefix = IsITANMSVCWindows ? "" : "lib";
   const char *Suffix = Shared ? (Triple.isOSWindows() ? ".dll" : ".so")
-  : (IsWindowsIAMSVC ? ".lib" : ".a");
+  : (IsITANMSVCWindows ? ".lib" : ".a");
 
   SmallString<128> Path(getDriver().ResourceDir);
   StringRef OSLibName = Triple.isOSFreeBSD() ? "freebsd" : getOS();

Modified: cfe/trunk/test/Driver/arm-compiler-rt.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-compiler-rt.c?rev=280281=280280=280281=diff
==
--- cfe/trunk/test/Driver/arm-compiler-rt.c (original)
+++ cfe/trunk/test/Driver/arm-compiler-rt.c Wed Aug 31 14:27:07 2016
@@ -11,7 +11,7 @@
 // ARM-GNUEABIHF-ABI: "{{.*[/\\]}}libclang_rt.builtins-arm.a"
 
 // RUN: %clang -target arm-windows-itanium -rtlib=compiler-rt -### %s 2>&1 | 
FileCheck %s -check-prefix ARM-WINDOWS
-// ARM-WINDOWS: "{{.*[/\\]}}libclang_rt.builtins-arm.lib"
+// ARM-WINDOWS: "{{.*[/\\]}}clang_rt.builtins-arm.lib"
 
 // RUN: %clang -target arm-linux-androideabi -rtlib=compiler-rt -### %s 2>&1 | 
FileCheck %s -check-prefix ARM-ANDROID
 // ARM-ANDROID: "{{.*[/\\]}}libclang_rt.builtins-arm-android.a"

Modified: cfe/trunk/test/Driver/windows-cross.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/windows-cross.c?rev=280281=280280=280281=diff
==
--- cfe/trunk/test/Driver/windows-cross.c (original)
+++ cfe/trunk/test/Driver/windows-cross.c Wed Aug 31 14:27:07 2016
@@ -6,27 +6,27 @@
 // RUN: %clang -### -target armv7-windows-itanium --sysroot 
%s/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin 
-rtlib=compiler-rt -stdlib=libstdc++ -o /dev/null %s 2>&1 \
 // RUN:   | FileCheck %s --check-prefix CHECK-RTLIB
 
-// CHECK-RTLIB: armv7-windows-itanium-ld" 
"--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" 
"mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" 
"{{.*}}/Inputs/Windows/ARM/8.1/usr/lib/crtbegin.obj" 
"-L{{.*}}/Inputs/Windows/ARM/8.1/usr/lib" 
"-L{{.*}}/Inputs/Windows/ARM/8.1/usr/lib/gcc" "{{.*}}.o" "-lmsvcrt" 
"{{.*[\\/]}}libclang_rt.builtins-arm.lib"
+// CHECK-RTLIB: armv7-windows-itanium-ld" 
"--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" 
"mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" 
"{{.*}}/Inputs/Windows/ARM/8.1/usr/lib/crtbegin.obj" 
"-L{{.*}}/Inputs/Windows/ARM/8.1/usr/lib" 
"-L{{.*}}/Inputs/Windows/ARM/8.1/usr/lib/gcc" "{{.*}}.o" "-lmsvcrt" 
"{{.*[\\/]}}clang_rt.builtins-arm.lib"
 
 // RUN: %clang -### -target armv7-windows-itanium --sysroot 
%S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin 
-rtlib=compiler-rt -stdlib=libc++ -o /dev/null %s 2>&1 \
 // RUN:   | FileCheck %s --check-prefix CHECK-C-LIBCXX
 
-// CHECK-C-LIBCXX: armv7-windows-itanium-ld" 
"--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" 
"mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" 
"{{.*}}/Inputs/Windows/ARM/8.1/usr/lib/crtbegin.obj" "{{.*}}.o" "-lmsvcrt" 
"{{.*[\\/]}}libclang_rt.builtins-arm.lib"
+// CHECK-C-LIBCXX: armv7-windows-itanium-ld" 
"--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" 
"mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" 
"{{.*}}/Inputs/Windows/ARM/8.1/usr/lib/crtbegin.obj" "{{.*}}.o" "-lmsvcrt" 
"{{.*[\\/]}}clang_rt.builtins-arm.lib"
 
 // RUN: %clangxx -### -target armv7-windows-itanium --sysroot 
%S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin 
-rtlib=compiler-rt -stdlib=libc++ -o /dev/null %s 2>&1 \
 // RUN:   | FileCheck %s 

Re: [PATCH] D24091: [Driver] Warn on -nodefaultlibs and -fsanitize

2016-08-31 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a comment.

Hi Chris,

Thanks for doing this.



Comment at: lib/Driver/Driver.cpp:1554
@@ -1551,1 +1553,3 @@
+Args.hasArg(options::OPT_fsanitize_EQ))
+  Diag(clang::diag::warn_drv_sanitizers_and_nodefaultlibs);
   }

How hard is to fire the warning only when the target assumes this behavior? It 
seems misleading (and noisy) to warn when -nodefaultlibs isn't bypassed.


https://reviews.llvm.org/D24091



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


[PATCH] D24097: Add testcases for PR30188

2016-08-31 Thread Sebastian Pop via cfe-commits
sebpop created this revision.
sebpop added reviewers: jmolloy, danielcdh, davidxl, mkuper, dberlin.
sebpop added subscribers: llvm-commits, cfe-commits.

Add testcases to clang test/ to make sure that the combined middle-end
optimizations do not regress on optimizing the number of loads in the loops.


https://reviews.llvm.org/D24097

Files:
  clang/test/CodeGen/pr30188.c
  clang/test/CodeGenCXX/pr30188.cpp

Index: clang/test/CodeGenCXX/pr30188.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/pr30188.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -O2 -emit-llvm -o - %s | FileCheck %s
+
+// Check that optimizers are able to optimize the number of loads in the loop.
+// CHECK: load
+// CHECK-NOT: load
+
+int test(float exp, float *array) {
+  int hi = 255;
+  int lo = 0;
+  int offset = 0;
+
+  while(hi > lo) {
+unsigned delta = (hi - lo) / 2u;
+delta = 1u > delta ? 1u : delta;
+offset = lo + delta;
+
+if (array[offset] > exp)
+  hi = hi - delta;
+else
+  lo = lo + delta;
+  }
+
+  return offset;
+}
Index: clang/test/CodeGen/pr30188.c
===
--- /dev/null
+++ clang/test/CodeGen/pr30188.c
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -O2 -emit-llvm -o - %s | FileCheck %s
+
+// Check that optimizers are able to optimize the number of loads in the loop.
+// CHECK: load
+// CHECK: load
+// CHECK: load
+// CHECK-NOT: load
+
+struct b {
+  int x_;
+};
+
+struct a {
+  int l_;
+  struct b *data_;
+};
+
+int BinarySearch(struct a *input, struct b t) {
+  if (input->l_ > 0) {
+int low = 0;
+int high = input->l_;
+while (high != low + 1) {
+  int mid = (high + low) / 2;
+  if (input->data_[mid].x_ > t.x_)
+high = mid;
+  else
+low = mid;
+}
+return low;
+  }
+  return -1;
+}


Index: clang/test/CodeGenCXX/pr30188.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/pr30188.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -O2 -emit-llvm -o - %s | FileCheck %s
+
+// Check that optimizers are able to optimize the number of loads in the loop.
+// CHECK: load
+// CHECK-NOT: load
+
+int test(float exp, float *array) {
+  int hi = 255;
+  int lo = 0;
+  int offset = 0;
+
+  while(hi > lo) {
+unsigned delta = (hi - lo) / 2u;
+delta = 1u > delta ? 1u : delta;
+offset = lo + delta;
+
+if (array[offset] > exp)
+  hi = hi - delta;
+else
+  lo = lo + delta;
+  }
+
+  return offset;
+}
Index: clang/test/CodeGen/pr30188.c
===
--- /dev/null
+++ clang/test/CodeGen/pr30188.c
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -O2 -emit-llvm -o - %s | FileCheck %s
+
+// Check that optimizers are able to optimize the number of loads in the loop.
+// CHECK: load
+// CHECK: load
+// CHECK: load
+// CHECK-NOT: load
+
+struct b {
+  int x_;
+};
+
+struct a {
+  int l_;
+  struct b *data_;
+};
+
+int BinarySearch(struct a *input, struct b t) {
+  if (input->l_ > 0) {
+int low = 0;
+int high = input->l_;
+while (high != low + 1) {
+  int mid = (high + low) / 2;
+  if (input->data_[mid].x_ > t.x_)
+high = mid;
+  else
+low = mid;
+}
+return low;
+  }
+  return -1;
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-08-31 Thread Ben Craig via cfe-commits
bcraig added a comment.

In https://reviews.llvm.org/D21803#530678, @tavianator wrote:

> Ping?


Well, I still think it's fine.  Maybe a direct message to @mclow.lists or 
@EricWF?


https://reviews.llvm.org/D21803



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


Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-08-31 Thread Tavian Barnes via cfe-commits
tavianator added a comment.

Ping?


https://reviews.llvm.org/D21803



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


Re: r280169 - Driver: use the canonical static library naming

2016-08-31 Thread Reid Kleckner via cfe-commits
This broke the win asan build:
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/28203

More generally, though, this seems like it's a Boost convention and an
MSVCRT convention, and not a general Windows convention:
http://www.boost.org/doc/libs/1_42_0/more/getting_started/windows.html#library-naming
https://msdn.microsoft.com/en-us/library/aa272081(v=vs.60).aspx
https://cmake.org/Bug/view.php?id=10190#c19315

Our pre-existing convention was to name the dynamic library
clang_rt.${lib}_${arch}_dynamic, because that works across platforms. I
don't think we'll want to undo that convention across Windows, OS X, and
Linux. There are probably enough projects out there already using those
library names directly.

On Tue, Aug 30, 2016 at 3:10 PM, Saleem Abdulrasool via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: compnerd
> Date: Tue Aug 30 17:10:27 2016
> New Revision: 280169
>
> URL: http://llvm.org/viewvc/llvm-project?rev=280169=rev
> Log:
> Driver: use the canonical static library naming
>
> On Windows, static libraries are named lib.lib while import
> libraries are
> named .lib.  Use the appropriate naming on itanium and msvc
> environments.
> This is setup properly so that if a dynamic builtins is used on Windows, it
> would do the right thing, although this is not currently wired through the
> driver (i.e. there is no equivalent to -{shared,static}-gcc).
>
> Modified:
> cfe/trunk/lib/Driver/ToolChain.cpp
> cfe/trunk/test/Driver/arm-compiler-rt.c
> cfe/trunk/test/Driver/windows-cross.c
>
> Modified: cfe/trunk/lib/Driver/ToolChain.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
> ToolChain.cpp?rev=280169=280168=280169=diff
> 
> ==
> --- cfe/trunk/lib/Driver/ToolChain.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChain.cpp Tue Aug 30 17:10:27 2016
> @@ -288,13 +288,13 @@ std::string ToolChain::getCompilerRT(con
>   bool Shared) const {
>const llvm::Triple  = getTriple();
>const char *Env = TT.isAndroid() ? "-android" : "";
> -  bool IsITANMSVCWindows =
> +  bool IsWindowsIAMSVC =
>TT.isWindowsMSVCEnvironment() || TT.isWindowsItaniumEnvironment();
>
>StringRef Arch = getArchNameForCompilerRTLib(*this, Args);
> -  const char *Prefix = IsITANMSVCWindows ? "" : "lib";
> +  const char *Prefix = (IsWindowsIAMSVC && Shared) ? "" : "lib";
>const char *Suffix = Shared ? (Triple.isOSWindows() ? ".dll" : ".so")
> -  : (IsITANMSVCWindows ? ".lib" : ".a");
> +  : (IsWindowsIAMSVC ? ".lib" : ".a");
>
>SmallString<128> Path(getDriver().ResourceDir);
>StringRef OSLibName = Triple.isOSFreeBSD() ? "freebsd" : getOS();
>
> Modified: cfe/trunk/test/Driver/arm-compiler-rt.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/
> arm-compiler-rt.c?rev=280169=280168=280169=diff
> 
> ==
> --- cfe/trunk/test/Driver/arm-compiler-rt.c (original)
> +++ cfe/trunk/test/Driver/arm-compiler-rt.c Tue Aug 30 17:10:27 2016
> @@ -11,7 +11,7 @@
>  // ARM-GNUEABIHF-ABI: "{{.*[/\\]}}libclang_rt.builtins-arm.a"
>
>  // RUN: %clang -target arm-windows-itanium -rtlib=compiler-rt -### %s
> 2>&1 | FileCheck %s -check-prefix ARM-WINDOWS
> -// ARM-WINDOWS: "{{.*[/\\]}}clang_rt.builtins-arm.lib"
> +// ARM-WINDOWS: "{{.*[/\\]}}libclang_rt.builtins-arm.lib"
>
>  // RUN: %clang -target arm-linux-androideabi -rtlib=compiler-rt -### %s
> 2>&1 | FileCheck %s -check-prefix ARM-ANDROID
>  // ARM-ANDROID: "{{.*[/\\]}}libclang_rt.builtins-arm-android.a"
>
> Modified: cfe/trunk/test/Driver/windows-cross.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/
> windows-cross.c?rev=280169=280168=280169=diff
> 
> ==
> --- cfe/trunk/test/Driver/windows-cross.c (original)
> +++ cfe/trunk/test/Driver/windows-cross.c Tue Aug 30 17:10:27 2016
> @@ -6,27 +6,27 @@
>  // RUN: %clang -### -target armv7-windows-itanium --sysroot
> %s/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin
> -rtlib=compiler-rt -stdlib=libstdc++ -o /dev/null %s 2>&1 \
>  // RUN:   | FileCheck %s --check-prefix CHECK-RTLIB
>
> -// CHECK-RTLIB: armv7-windows-itanium-ld" 
> "--sysroot={{.*}}/Inputs/Windows/ARM/8.1"
> "-m" "thumb2pe" "-Bdynamic" "--entry" "mainCRTStartup"
> "--allow-multiple-definition" "-o" "{{[^"]*}}" 
> "{{.*}}/Inputs/Windows/ARM/8.1/usr/lib/crtbegin.obj"
> "-L{{.*}}/Inputs/Windows/ARM/8.1/usr/lib" 
> "-L{{.*}}/Inputs/Windows/ARM/8.1/usr/lib/gcc"
> "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins-arm.lib"
> +// CHECK-RTLIB: armv7-windows-itanium-ld" 
> "--sysroot={{.*}}/Inputs/Windows/ARM/8.1"
> "-m" "thumb2pe" "-Bdynamic" "--entry" "mainCRTStartup"
> "--allow-multiple-definition" "-o" "{{[^"]*}}" 
> 

r280269 - Fix a typo in a comment.

2016-08-31 Thread George Burgess IV via cfe-commits
Author: gbiv
Date: Wed Aug 31 13:14:15 2016
New Revision: 280269

URL: http://llvm.org/viewvc/llvm-project?rev=280269=rev
Log:
Fix a typo in a comment.

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

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=280269=280268=280269=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Wed Aug 31 13:14:15 2016
@@ -8711,8 +8711,8 @@ public:
 /// are not compatible, but we accept them as an extension.
 IncompatiblePointer,
 
-/// IncompatiblePointer - The assignment is between two pointers types 
which
-/// point to integers which have a different sign, but are otherwise
+/// IncompatiblePointerSign - The assignment is between two pointers types
+/// which point to integers which have a different sign, but are otherwise
 /// identical. This is a subset of the above, but broken out because it's 
by
 /// far the most common case of incompatible pointers.
 IncompatiblePointerSign,


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


Re: [PATCH] D24083: [CMake] Fix libc++abi __aeabi_idiv() link error.

2016-08-31 Thread Renato Golin via cfe-commits
rengolin added a comment.

This looks like a work around the fact that --rtlib is being ignored with 
--nodefaultlibs. I'm not sure that's a sane behaviour, if you explicitly 
specify --rtlib.


https://reviews.llvm.org/D24083



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


Re: [PATCH] D24069: Document option '-rtlib' in clang's man page and help info

2016-08-31 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a subscriber: bruno.
bruno added a comment.

Hi Lei,

Thanks for the doc improvement!



Comment at: docs/CommandGuide/clang.rst:114
@@ -110,1 +113,3 @@
+ compiler-rt.
+
 .. option:: -ansi

It might be worth mentioning what's the default behaviour in case the flag 
isn't specified?


https://reviews.llvm.org/D24069



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


Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-08-31 Thread Chris Bieneman via cfe-commits
beanz added a comment.

I've sent out an additional patch that adds a warning for using -nostdlibs and 
-fsanitize (See: https://reviews.llvm.org/D24091)


https://reviews.llvm.org/D24048



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


Re: [PATCH] D19910: [unwinder] Get rid of unused code

2016-08-31 Thread Logan Chien via cfe-commits
logan accepted this revision.
logan added a comment.
This revision is now accepted and ready to land.

Sorry for the late reply.  Thanks for your work.  Yes, this is correct.

However, it seems that this differential can be closed since it has been 
committed as https://reviews.llvm.org/rL271737.


https://reviews.llvm.org/D19910



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


Re: [PATCH] D24040: codechecker tool core

2016-08-31 Thread Mehdi AMINI via cfe-commits
mehdi_amini added a comment.

> This looks like a fairly large tool. Should it get its own "subproject level" 
> directory in the SVN instead of being nested within clang?


I'd add that the clang-tools-extra are more closely tied to clang than what 
this seems to be. Is there a strong rev-lock with clang that I missed?


https://reviews.llvm.org/D24040



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


Re: [PATCH] D24040: codechecker tool core

2016-08-31 Thread Mehdi AMINI via cfe-commits
mehdi_amini added a subscriber: mehdi_amini.
mehdi_amini added a comment.

This looks like a fairly large tool. Should it get its own "subproject level" 
directory in the SVN instead of being nested within clang?



Comment at: tools/codechecker/README.md:50
@@ +49,3 @@
+# get source code
+git clone https://github.com/Ericsson/codechecker.git
+cd codechecker

Is it outdated?


https://reviews.llvm.org/D24040



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


r280257 - s/static inline/static/ for headers I have changed in r279475. NFC.

2016-08-31 Thread Tim Shen via cfe-commits
Author: timshen
Date: Wed Aug 31 11:48:13 2016
New Revision: 280257

URL: http://llvm.org/viewvc/llvm-project?rev=280257=rev
Log:
s/static inline/static/ for headers I have changed in r279475. NFC.

Modified:
cfe/trunk/include/clang/AST/StmtGraphTraits.h
cfe/trunk/include/clang/Analysis/Analyses/Dominators.h
cfe/trunk/include/clang/Analysis/CFG.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h

Modified: cfe/trunk/include/clang/AST/StmtGraphTraits.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtGraphTraits.h?rev=280257=280256=280257=diff
==
--- cfe/trunk/include/clang/AST/StmtGraphTraits.h (original)
+++ cfe/trunk/include/clang/AST/StmtGraphTraits.h Wed Aug 31 11:48:13 2016
@@ -31,12 +31,12 @@ template <> struct GraphTraitschild_begin();
 else return ChildIteratorType();
   }
 
-  static inline ChildIteratorType child_end(NodeRef N) {
+  static ChildIteratorType child_end(NodeRef N) {
 if (N) return N->child_end();
 else return ChildIteratorType();
   }
@@ -58,12 +58,12 @@ template <> struct GraphTraitschild_begin();
 else return ChildIteratorType();
   }
 
-  static inline ChildIteratorType child_end(NodeRef N) {
+  static ChildIteratorType child_end(NodeRef N) {
 if (N) return N->child_end();
 else return ChildIteratorType();
   }

Modified: cfe/trunk/include/clang/Analysis/Analyses/Dominators.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Analyses/Dominators.h?rev=280257=280256=280257=diff
==
--- cfe/trunk/include/clang/Analysis/Analyses/Dominators.h (original)
+++ cfe/trunk/include/clang/Analysis/Analyses/Dominators.h Wed Aug 31 11:48:13 
2016
@@ -171,8 +171,8 @@ template <> struct GraphTraits< ::clang:
   typedef ::clang::DomTreeNode::iterator ChildIteratorType;
 
   static NodeRef getEntryNode(NodeRef N) { return N; }
-  static inline ChildIteratorType child_begin(NodeRef N) { return N->begin(); }
-  static inline ChildIteratorType child_end(NodeRef N) { return N->end(); }
+  static ChildIteratorType child_begin(NodeRef N) { return N->begin(); }
+  static ChildIteratorType child_end(NodeRef N) { return N->end(); }
 
   typedef llvm::pointer_iterator>
   nodes_iterator;

Modified: cfe/trunk/include/clang/Analysis/CFG.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CFG.h?rev=280257=280256=280257=diff
==
--- cfe/trunk/include/clang/Analysis/CFG.h (original)
+++ cfe/trunk/include/clang/Analysis/CFG.h Wed Aug 31 11:48:13 2016
@@ -950,11 +950,9 @@ template <> struct GraphTraits< ::clang:
 
   static NodeRef getEntryNode(::clang::CFGBlock *BB) { return BB; }
 
-  static inline ChildIteratorType child_begin(NodeRef N) {
-return N->succ_begin();
-  }
+  static ChildIteratorType child_begin(NodeRef N) { return N->succ_begin(); }
 
-  static inline ChildIteratorType child_end(NodeRef N) { return N->succ_end(); 
}
+  static ChildIteratorType child_end(NodeRef N) { return N->succ_end(); }
 };
 
 template <> struct GraphTraits< const ::clang::CFGBlock *> {
@@ -963,11 +961,9 @@ template <> struct GraphTraits< const ::
 
   static NodeRef getEntryNode(const clang::CFGBlock *BB) { return BB; }
 
-  static inline ChildIteratorType child_begin(NodeRef N) {
-return N->succ_begin();
-  }
+  static ChildIteratorType child_begin(NodeRef N) { return N->succ_begin(); }
 
-  static inline ChildIteratorType child_end(NodeRef N) { return N->succ_end(); 
}
+  static ChildIteratorType child_end(NodeRef N) { return N->succ_end(); }
 };
 
 template <> struct GraphTraits > {
@@ -978,11 +974,9 @@ template <> struct GraphTraitspred_begin();
-  }
+  static ChildIteratorType child_begin(NodeRef N) { return N->pred_begin(); }
 
-  static inline ChildIteratorType child_end(NodeRef N) { return N->pred_end(); 
}
+  static ChildIteratorType child_end(NodeRef N) { return N->pred_end(); }
 };
 
 template <> struct GraphTraits {
@@ -993,11 +987,9 @@ template <> struct GraphTraitspred_begin(); }
 
-  static inline ChildIteratorType child_end(NodeRef N) { return N->pred_end(); 
}
+  static ChildIteratorType child_end(NodeRef N) { return N->pred_end(); }
 };
 
 // Traits for: CFG

Modified: 
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h?rev=280257=280256=280257=diff
==
--- 

Re: [PATCH] D23848: Add a clang-tidy Visual Studio extension

2016-08-31 Thread Zachary Turner via cfe-commits
zturner added a comment.

I am planning to submit this today if there are no further suggestions.


https://reviews.llvm.org/D23848



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


Re: [PATCH] D24084: [CMake] Cleanup libunwind lookup code.

2016-08-31 Thread Renato Golin via cfe-commits
rengolin added a comment.

In https://reviews.llvm.org/D24084#530427, @logan wrote:

> We can either (1) specify the path to libunwind or (2) manually download 
> `unwind.h` header from libunwind project and place it to `include` directory.


That is a horrible dependency... I never hit it because I always test libc++ 
with libunwind.

Marshall (@mclow.lists), isn't there a better way of doing this? It sounds 
terrible...

cheers,
--renato


https://reviews.llvm.org/D24084



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


Re: [PATCH] D24084: [CMake] Cleanup libunwind lookup code.

2016-08-31 Thread Logan Chien via cfe-commits
logan added a comment.

In https://reviews.llvm.org/D24084#530433, @rengolin wrote:

> That is a horrible dependency... I never hit it because I always test libc++ 
> with libunwind.


I think the best solution is to move/merge `libunwind/include/unwind.h` to/with 
`clang/lib/Headers/unwind.h`.  And, modify the libc++abi code base, so that 
libc++abi can accept the `` bundled with clang or gcc.   However, it 
takes time to reach that point.


https://reviews.llvm.org/D24084



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


[PATCH] D24087: [lit] Allow more file extensions for test cases.

2016-08-31 Thread Logan Chien via cfe-commits
logan created this revision.
logan added reviewers: mclow.lists, EricWF.
logan added a subscriber: cfe-commits.

This commit splits the file extensions before determining the test
format.  This allows libc++abi to add assembly-based test cases.

https://reviews.llvm.org/D24087

Files:
  test/libcxx/test/format.py

Index: test/libcxx/test/format.py
===
--- test/libcxx/test/format.py
+++ test/libcxx/test/format.py
@@ -65,9 +65,10 @@
 
 def _execute(self, test, lit_config):
 name = test.path_in_suite[-1]
-is_sh_test = name.endswith('.sh.cpp')
-is_pass_test = name.endswith('.pass.cpp')
-is_fail_test = name.endswith('.fail.cpp')
+name_root, name_ext = os.path.splitext(name)
+is_sh_test = name_root.endswith('.sh')
+is_pass_test = name_root.endswith('.pass')
+is_fail_test = name_root.endswith('.fail')
 
 if test.config.unsupported:
 return (lit.Test.UNSUPPORTED,


Index: test/libcxx/test/format.py
===
--- test/libcxx/test/format.py
+++ test/libcxx/test/format.py
@@ -65,9 +65,10 @@
 
 def _execute(self, test, lit_config):
 name = test.path_in_suite[-1]
-is_sh_test = name.endswith('.sh.cpp')
-is_pass_test = name.endswith('.pass.cpp')
-is_fail_test = name.endswith('.fail.cpp')
+name_root, name_ext = os.path.splitext(name)
+is_sh_test = name_root.endswith('.sh')
+is_pass_test = name_root.endswith('.pass')
+is_fail_test = name_root.endswith('.fail')
 
 if test.config.unsupported:
 return (lit.Test.UNSUPPORTED,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r280255 - [codeview] Pass through vftable shape information

2016-08-31 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Wed Aug 31 11:11:43 2016
New Revision: 280255

URL: http://llvm.org/viewvc/llvm-project?rev=280255=rev
Log:
[codeview] Pass through vftable shape information

The shape is really just the number of methods in the vftable, since we
don't support 16 bit far calls. All calls are near. Encode this number
in the size of the artificial __vtbl_ptr_type DIDerivedType that we
generate. For DWARF, this will be a normal pointer, but for codeview
this will be a wide pointer that gets pattern matched into a
VFTableShape record. Insert this type into the element list of all
dynamic classes when emitting CodeView, so that the backend can emit the
shape even if the vptr lives in a primary base class.

Fixes PR28150

Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=280255=280254=280255=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Aug 31 11:11:43 2016
@@ -1549,22 +1549,49 @@ StringRef CGDebugInfo::getVTableName(con
 }
 
 void CGDebugInfo::CollectVTableInfo(const CXXRecordDecl *RD, llvm::DIFile 
*Unit,
-SmallVectorImpl ) 
{
-  const ASTRecordLayout  = CGM.getContext().getASTRecordLayout(RD);
+SmallVectorImpl ,
+llvm::DICompositeType *RecordTy) {
+  // If this class is not dynamic then there is not any vtable info to collect.
+  if (!RD->isDynamicClass())
+return;
+
+  // CodeView needs to know how large the vtable of every dynamic class is, so
+  // emit a special named pointer type into the element list. The vptr type
+  // points to this type as well.
+  llvm::DIType *VPtrTy = nullptr;
+  bool NeedVTableShape = CGM.getCodeGenOpts().EmitCodeView &&
+ CGM.getTarget().getCXXABI().isMicrosoft();
+  if (NeedVTableShape) {
+uint64_t PtrWidth =
+CGM.getContext().getTypeSize(CGM.getContext().VoidPtrTy);
+const VTableLayout  =
+CGM.getMicrosoftVTableContext().getVFTableLayout(RD, 
CharUnits::Zero());
+unsigned VSlotCount =
+VFTLayout.getNumVTableComponents() - CGM.getLangOpts().RTTIData;
+unsigned VTableWidth = PtrWidth * VSlotCount;
+
+// Create a very wide void* type and insert it directly in the element 
list.
+llvm::DIType *VTableType =
+DBuilder.createPointerType(nullptr, VTableWidth, 0, "__vtbl_ptr_type");
+EltTys.push_back(VTableType);
 
-  // If there is a primary base then it will hold vtable info.
+// The vptr is a pointer to this special vtable type.
+VPtrTy = DBuilder.createPointerType(VTableType, PtrWidth);
+  }
+
+  // If there is a primary base then the artificial vptr member lives there.
+  const ASTRecordLayout  = CGM.getContext().getASTRecordLayout(RD);
   if (RL.getPrimaryBase())
 return;
 
-  // If this class is not dynamic then there is not any vtable info to collect.
-  if (!RD->isDynamicClass())
-return;
+  if (!VPtrTy)
+VPtrTy = getOrCreateVTablePtrType(Unit);
 
   unsigned Size = CGM.getContext().getTypeSize(CGM.getContext().VoidPtrTy);
-  llvm::DIType *VPTR = DBuilder.createMemberType(
+  llvm::DIType *VPtrMember = DBuilder.createMemberType(
   Unit, getVTableName(RD), Unit, 0, Size, 0, 0,
-  llvm::DINode::FlagArtificial, getOrCreateVTablePtrType(Unit));
-  EltTys.push_back(VPTR);
+  llvm::DINode::FlagArtificial, VPtrTy);
+  EltTys.push_back(VPtrMember);
 }
 
 llvm::DIType *CGDebugInfo::getOrCreateRecordType(QualType RTy,
@@ -1761,7 +1788,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDef
   const auto *CXXDecl = dyn_cast(RD);
   if (CXXDecl) {
 CollectCXXBases(CXXDecl, DefUnit, EltTys, FwdDecl);
-CollectVTableInfo(CXXDecl, DefUnit, EltTys);
+CollectVTableInfo(CXXDecl, DefUnit, EltTys, FwdDecl);
   }
 
   // Collect data fields (including static variables and any initializers).

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=280255=280254=280255=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Wed Aug 31 11:11:43 2016
@@ -264,7 +264,8 @@ class CGDebugInfo {
   /// If the C++ class has vtable info then insert appropriate debug
   /// info entry in EltTys vector.
   void CollectVTableInfo(const CXXRecordDecl *Decl, llvm::DIFile *F,
- SmallVectorImpl );
+ SmallVectorImpl ,
+ llvm::DICompositeType *RecordTy);
   /// @}
 
   /// Create a new lexical block node and push it on the stack.

Modified: 

Re: [PATCH] D24082: [CMake] Fix libc++abi arm build w/o libunwind.

2016-08-31 Thread Renato Golin via cfe-commits
rengolin added a comment.

That match would only make sense if LLVM's unwinder was forced on ARM targets, 
and they're most certainly not. Expecting both unwindwers to behave identically 
makes no sense.

This fix looks good to me, but I'll let Marshall or Eric have a look first.


https://reviews.llvm.org/D24082



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


Re: [PATCH] D24084: [CMake] Cleanup libunwind lookup code.

2016-08-31 Thread Logan Chien via cfe-commits
logan added a comment.

Yes.  This is what we have today.

We can either (1) specify the path to libunwind or (2) manually download 
`unwind.h` header from libunwind project and place it to `include` directory.


https://reviews.llvm.org/D24084



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


Re: [PATCH] D24024: Checkout cfe when building clang-tools-extra docs.

2016-08-31 Thread Dmitri Gribenko via cfe-commits
gribozavr accepted this revision.
gribozavr added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


https://reviews.llvm.org/D24024



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


[PATCH] D24081: [CMake] Fix libc++abi standalone cmake build.

2016-08-31 Thread Logan Chien via cfe-commits
logan created this revision.
logan added reviewers: mclow.lists, rengolin, EricWF.
logan added a subscriber: cfe-commits.

The cmake files install directory has been changed to
${prefix}/lib/cmake/llvm since r259821.  Searching cmake modules in
${prefix}/share/llvm/cmake will result in fatal errors.

This commit fixes the out-of-tree build by changing the CMake module
search path to: "$(llvm-config --obj-root)/lib/cmake/llvm"

https://reviews.llvm.org/D24081

Files:
  CMakeLists.txt

Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -49,7 +49,7 @@
 set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
 set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
 set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source 
tree")
-set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/share/llvm/cmake")
+set(LLVM_CMAKE_PATH 
"${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
 set(LLVM_LIT_PATH "${LLVM_PATH}/utils/lit/lit.py")
   else()
 message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not 
defined. "


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -49,7 +49,7 @@
 set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
 set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
 set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
-set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/share/llvm/cmake")
+set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
 set(LLVM_LIT_PATH "${LLVM_PATH}/utils/lit/lit.py")
   else()
 message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. "
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24084: [CMake] Cleanup libunwind lookup code.

2016-08-31 Thread Renato Golin via cfe-commits
rengolin added a comment.

> We have to do so because we need the modified "unwind.h" from libunwind. 
> (Note:  which is bundled with clang/gcc is not sufficient.)


So, you need libunwind's sources, even if you're not building or using them, to 
build libc++abi?


https://reviews.llvm.org/D24084



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


[PATCH] D24084: [CMake] Cleanup libunwind lookup code.

2016-08-31 Thread Logan Chien via cfe-commits
logan created this revision.
logan added reviewers: mclow.lists, rengolin, EricWF, danalbert, thakis.
logan added a subscriber: cfe-commits.

This commit refines the code for libunwind lookup.

First, this commit will always search for libunwind no matter LLVM
unwinder is enabled or not.  We have to do so because we need the
modified "unwind.h" from libunwind.  (Note:  which is bundled
with clang/gcc is not sufficient.)

Second, this commit removes LIBCXXABI_LIBUNWIND_INCLUDE_INTERNAL and
refines the find_path() function.  Now, it looks similar to the one for
libc++.

Third, this commit removes LIBCXXABI_LIBUNWIND_SOURCES since it haven't
been used for a while.  (Note: The reference to "libunwind_ext.h" has
been removed since r241993.)

https://reviews.llvm.org/D24084

Files:
  CMakeLists.txt

Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -137,6 +137,7 @@
   message(FATAL_ERROR "libc++abi must be built as either a shared or static 
library.")
 endif()
 
+# Find libc++ include path and source path.
 find_path(
   LIBCXXABI_LIBCXX_INCLUDES
   vector
@@ -167,6 +168,25 @@
 set(LIBCXXABI_LIBCXX_PATH "${LIBCXXABI_LIBCXX_PATH}" CACHE PATH
 "Specify path to libc++ source." FORCE)
 
+# Find libunwind include path (for unwind.h)
+find_path(
+  LIBCXXABI_LIBUNWIND_INCLUDES
+  libunwind.h
+  PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES}
+${LIBCXXABI_LIBUNWIND_PATH}/include
+${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBUNWIND_INCLUDES}
+${LLVM_MAIN_SRC_DIR}/projects/libunwind/include
+  NO_DEFAULT_PATH
+)
+
+if (LIBCXXABI_LIBUNWIND_INCLUDES STREQUAL 
"LIBCXXABI_LIBUNWIND_INCLUDES-NOTFOUND")
+  message(WARNING "LIBCXXABI_LIBUNWIND_INCLUDES was not specified and couldn't 
be infered.")
+  set(LIBCXXABI_LIBUNWIND_INCLUDES "")
+endif()
+
+set(LIBCXXABI_LIBUNWIND_INCLUDES "${LIBCXXABI_LIBUNWIND_INCLUDES}" CACHE PATH
+"Specify path to libunwind includes." FORCE)
+
 
#===
 # Configure System
 
#===
@@ -351,40 +371,13 @@
 # Setup Source Code
 
#===
 
-set(LIBCXXABI_LIBUNWIND_INCLUDES "${LIBCXXABI_LIBUNWIND_INCLUDES}" CACHE PATH
-"Specify path to libunwind includes." FORCE)
-set(LIBCXXABI_LIBUNWIND_PATH "${LIBCXXABI_LIBUNWIND_PATH}" CACHE PATH
-"Specify path to libunwind source." FORCE)
+# Add libunwind include to header search path (for unwind.h)
+if (LIBCXXABI_LIBUNWIND_INCLUDES)
+  include_directories("${LIBCXXABI_LIBUNWIND_INCLUDES}")
+endif()
 
+# Add libc++abi include to header search path.
 include_directories(include)
-if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
-  find_path(
-LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL
-libunwind.h
-PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES}
-  ${LIBCXXABI_LIBUNWIND_PATH}/include
-  ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBUNWIND_INCLUDES}
-  ${LLVM_MAIN_SRC_DIR}/projects/libunwind/include
-NO_DEFAULT_PATH
-  )
-
-  find_path(
-LIBCXXABI_LIBUNWIND_SOURCES
-libunwind_ext.h
-PATHS ${LIBCXXABI_LIBUNWIND_PATH}/src/
-  ${LIBCXXABI_LIBUNWIND_INCLUDES}/../src/
-  ${LLVM_MAIN_SRC_DIR}/projects/libunwind/src/
-NO_DEFAULT_PATH
-  )
-
-  if (LIBCXXABI_LIBUNWIND_SOURCES STREQUAL 
"LIBCXXABI_LIBUNWIND_SOURCES-NOTFOUND")
-message(WARNING "LIBCXXABI_LIBUNWIND_SOURCES was not specified and 
couldn't be infered.")
-set(LIBCXXABI_LIBUNWIND_SOURCES "")
-  endif()
-
-  include_directories("${LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL}")
-  include_directories("${LIBCXXABI_LIBUNWIND_SOURCES}")
-endif()
 
 # Add source code. This also contains all of the logic for deciding linker 
flags
 # soname, etc...


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -137,6 +137,7 @@
   message(FATAL_ERROR "libc++abi must be built as either a shared or static library.")
 endif()
 
+# Find libc++ include path and source path.
 find_path(
   LIBCXXABI_LIBCXX_INCLUDES
   vector
@@ -167,6 +168,25 @@
 set(LIBCXXABI_LIBCXX_PATH "${LIBCXXABI_LIBCXX_PATH}" CACHE PATH
 "Specify path to libc++ source." FORCE)
 
+# Find libunwind include path (for unwind.h)
+find_path(
+  LIBCXXABI_LIBUNWIND_INCLUDES
+  libunwind.h
+  PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES}
+${LIBCXXABI_LIBUNWIND_PATH}/include
+${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBUNWIND_INCLUDES}
+${LLVM_MAIN_SRC_DIR}/projects/libunwind/include
+  NO_DEFAULT_PATH
+)
+
+if (LIBCXXABI_LIBUNWIND_INCLUDES STREQUAL "LIBCXXABI_LIBUNWIND_INCLUDES-NOTFOUND")
+  message(WARNING "LIBCXXABI_LIBUNWIND_INCLUDES was not specified and couldn't be infered.")
+  set(LIBCXXABI_LIBUNWIND_INCLUDES "")
+endif()
+
+set(LIBCXXABI_LIBUNWIND_INCLUDES "${LIBCXXABI_LIBUNWIND_INCLUDES}" CACHE 

[PATCH] D24082: [CMake] Fix libc++abi arm build w/o libunwind.

2016-08-31 Thread Logan Chien via cfe-commits
logan created this revision.
logan added reviewers: mclow.lists, rengolin, EricWF.
logan added a subscriber: cfe-commits.
Herald added subscribers: samparker, rengolin, aemerson.

This commit fixes libc++abi build when LLVM unwinder (libunwind_llvm) is
not enabled.

This commit fixes the problem by removing "LLVM_NATIVE_ARCH MATCHES ARM"
from CMakeLists.txt so that LIBCXXABI_USE_LLVM_UNWINDER will only be
defined when LLVM unwinder is enabled.

We need LIBCXXABI_USE_LLVM_UNWINDER becase there is a subtle difference
between the unwinder from libgcc and the one from libunwind_llvm.  For
the unwinder from libgcc, we have to initialize register r12 with the
address of _Unwind_Control_Block; otherwise,
_Unwind_GetLanguageSpecificData() and _Unwind_GetRegionStart() won't
work properly.  Consequently, there is an extra _Unwind_SetGR() when
LLVM unwinder is disabled.  Check cxa_personality.cpp for details.

https://reviews.llvm.org/D24082

Files:
  CMakeLists.txt

Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -339,7 +339,7 @@
 endif()
 
 # Define LIBCXXABI_USE_LLVM_UNWINDER for conditional compilation.
-if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
+if (LIBCXXABI_USE_LLVM_UNWINDER)
   add_definitions(-DLIBCXXABI_USE_LLVM_UNWINDER=1)
 endif()
 


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -339,7 +339,7 @@
 endif()
 
 # Define LIBCXXABI_USE_LLVM_UNWINDER for conditional compilation.
-if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
+if (LIBCXXABI_USE_LLVM_UNWINDER)
   add_definitions(-DLIBCXXABI_USE_LLVM_UNWINDER=1)
 endif()
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24083: [CMake] Fix libc++abi __aeabi_idiv() link error.

2016-08-31 Thread Logan Chien via cfe-commits
logan created this revision.
logan added reviewers: mclow.lists, rengolin, EricWF.
logan added a subscriber: cfe-commits.
Herald added a subscriber: aemerson.

This commit fixes __aeabi_idiv() link error when we are building
libc++abi with compiler-rt.

When compiler-rt is enabled, the option `--rtlib=compiler-rt` will be
added to link flags.  However, if `-nodefaultlibs` is specified
simultaneously, `--rtlib` will be ignored and compiler-rt libraries will
not be linked.  Consequently, several ARM built-in functions, e.g.
__aeabi_idiv(), will not be available.

https://reviews.llvm.org/D24083

Files:
  src/CMakeLists.txt

Index: src/CMakeLists.txt
===
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -70,7 +70,9 @@
 
 # Setup flags.
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_FPIC_FLAG -fPIC)
-append_if(LIBCXXABI_LINK_FLAGS LIBCXXABI_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
+if (NOT LIBCXXABI_USE_COMPILER_RT)
+  append_if(LIBCXXABI_LINK_FLAGS LIBCXXABI_HAS_NODEFAULTLIBS_FLAG 
-nodefaultlibs)
+endif()
 
 set(LIBCXXABI_SHARED_LINK_FLAGS)
 


Index: src/CMakeLists.txt
===
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -70,7 +70,9 @@
 
 # Setup flags.
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_FPIC_FLAG -fPIC)
-append_if(LIBCXXABI_LINK_FLAGS LIBCXXABI_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
+if (NOT LIBCXXABI_USE_COMPILER_RT)
+  append_if(LIBCXXABI_LINK_FLAGS LIBCXXABI_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
+endif()
 
 set(LIBCXXABI_SHARED_LINK_FLAGS)
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24085: arm: Fix ttype encoding assertion failure.

2016-08-31 Thread Logan Chien via cfe-commits
logan created this revision.
logan added reviewers: mclow.lists, rengolin.
logan added a subscriber: cfe-commits.
Herald added subscribers: samparker, rengolin, aemerson.

GCC 4.7 or newer emits 0x90 (indirect | pcrel) as the ttype encoding.
This would hit an assertion in cxa_personality.cpp.  This commit fixes
the problem by relaxing the assertion.

http://llvm.org/PR28884

https://reviews.llvm.org/D24085

Files:
  src/cxa_personality.cpp
  test/lit.cfg
  test/lit.site.cfg.in
  test/native/arm-linux-eabi/lit.local.cfg
  test/native/arm-linux-eabi/ttype-encoding-00.pass.sh.s
  test/native/arm-linux-eabi/ttype-encoding-90.pass.sh.s

Index: test/native/arm-linux-eabi/ttype-encoding-90.pass.sh.s
===
--- /dev/null
+++ test/native/arm-linux-eabi/ttype-encoding-90.pass.sh.s
@@ -0,0 +1,96 @@
+@ RUN: %cxx %flags %link_flags %s -o %t.exe
+@ RUN: %exec %t.exe
+
+@ PURPOSE: Check that 0x90 is a valid value for ttype encoding.
+
+@ NOTE:
+@
+@ This file is generated from the following C++ source code and then change the
+@ `TType Encoding` to 0x90.
+@
+@ ```
+@ int main() {
+@   try {
+@ throw 5;
+@   } catch (int i) {
+@ if (i != 5)
+@   abort();
+@ return 0;
+@   }
+@ }
+@ ```
+
+	.syntax unified
+
+	.text
+	.globl	main
+	.p2align	2
+	.type	main,%function
+main:   @ @main
+.Lfunc_begin0:
+	.fnstart
+@ BB#0: @ %entry
+	.save	{r11, lr}
+	push	{r11, lr}
+	.setfp	r11, sp
+	mov	r11, sp
+	mov	r0, #4
+	bl	__cxa_allocate_exception
+	mov	r1, #5
+	str	r1, [r0]
+.Ltmp0:
+	ldr	r1, .LCPI0_0
+	mov	r2, #0
+	bl	__cxa_throw
+.Ltmp1:
+
+@ BB#2: @ %lpad
+.Ltmp2:
+	bl	__cxa_begin_catch
+	ldr	r0, [r0]
+	cmp	r0, #5
+	bne	.LBB0_4
+@ BB#3: @ %if.end
+	bl	__cxa_end_catch
+	mov	r0, #0
+	pop	{r11, lr}
+	bx	lr
+.LBB0_4:@ %if.then
+	bl	abort
+	.p2align	2
+@ BB#5:
+.LCPI0_0:
+	.long	_ZTIi
+.Lfunc_end0:
+
+	.size	main, .Lfunc_end0-main
+	.globl	__gxx_personality_v0
+	.personality __gxx_personality_v0
+	.handlerdata
+	.p2align	2
+GCC_except_table0:
+.Lexception0:
+	.byte	255 @ @LPStart Encoding = omit
+	.byte	0x90@ @TType Encoding = indirect | pcrel
+	.asciz	"\257\200"  @ @TType base offset
+	.byte	3   @ Call site Encoding = udata4
+	.byte	39  @ Call site table length
+	.long	.Lfunc_begin0-.Lfunc_begin0 @ >> Call Site 1 <<
+	.long	.Ltmp0-.Lfunc_begin0@   Call between .Lfunc_begin0 and .Ltmp0
+	.long	0   @ has no landing pad
+	.byte	0   @   On action: cleanup
+	.long	.Ltmp0-.Lfunc_begin0@ >> Call Site 2 <<
+	.long	.Ltmp1-.Ltmp0   @   Call between .Ltmp0 and .Ltmp1
+	.long	.Ltmp2-.Lfunc_begin0@ jumps to .Ltmp2
+	.byte	1   @   On action: 1
+	.long	.Ltmp1-.Lfunc_begin0@ >> Call Site 3 <<
+	.long	.Lfunc_end0-.Ltmp1  @   Call between .Ltmp1 and .Lfunc_end0
+	.long	0   @ has no landing pad
+	.byte	0   @   On action: cleanup
+	.byte	1   @ >> Action Record 1 <<
+@   Catch TypeInfo 1
+	.byte	0   @   No further actions
+@ >> Catch TypeInfos <<
+	.long	_ZTIi(target2)  @ TypeInfo 1
+	.p2align	2
+	.fnend
Index: test/native/arm-linux-eabi/ttype-encoding-00.pass.sh.s
===
--- /dev/null
+++ test/native/arm-linux-eabi/ttype-encoding-00.pass.sh.s
@@ -0,0 +1,97 @@
+@ RUN: %cxx %flags %link_flags %s -o %t.exe
+@ RUN: %exec %t.exe
+
+@ PURPOSE: Check that 0x00 is a valid value for ttype encoding.  LLVM and
+@ GCC 4.6 are generating 0x00 as ttype encoding.  libc++abi should provide
+@ legacy support.
+
+@ NOTE:
+@
+@ This file is generated from the following C++ source code:
+@
+@ ```
+@ int main() {
+@   try {
+@ throw 5;
+@   } catch (int i) {
+@ if (i != 5)
+@   abort();
+@ return 0;
+@   }
+@ }
+@ ```
+
+	.syntax unified
+
+	.text
+	.globl	main
+	.p2align	2
+	.type	main,%function
+main:   @ @main
+.Lfunc_begin0:
+	.fnstart
+@ BB#0: @ %entry
+	.save	{r11, lr}
+	push	{r11, lr}
+	.setfp	r11, sp
+	mov	r11, sp
+	mov	r0, #4
+	bl	__cxa_allocate_exception
+	mov	r1, #5
+	str	r1, [r0]
+.Ltmp0:
+	ldr	r1, .LCPI0_0
+	mov	r2, #0
+	bl	__cxa_throw
+.Ltmp1:
+
+@ BB#2: @ %lpad
+.Ltmp2:
+	bl	__cxa_begin_catch
+	ldr	r0, [r0]
+	cmp	r0, #5
+	bne	.LBB0_4
+@ BB#3: @ %if.end
+	bl	__cxa_end_catch
+	mov	r0, #0
+	pop	{r11, lr}
+	bx	lr
+.LBB0_4:@ %if.then
+	bl	abort
+	.p2align	2
+@ BB#5:
+.LCPI0_0:
+	.long	_ZTIi
+.Lfunc_end0:
+
+	.size	main, .Lfunc_end0-main
+	.globl	

[PATCH] D24080: [lit] Replace print with lit_config.note().

2016-08-31 Thread Logan Chien via cfe-commits
logan created this revision.
logan added reviewers: mclow.lists, rengolin, EricWF.
logan added a subscriber: cfe-commits.

This commit replaces print statement with lit_config.note().  This fixes
python3 support for check-libcxxabi.

https://reviews.llvm.org/D24080

Files:
  test/lit.cfg

Index: test/lit.cfg
===
--- test/lit.cfg
+++ test/lit.cfg
@@ -55,7 +55,7 @@
 
 cfg_variant = getattr(config, 'configuration_variant', 'libcxxabi')
 if cfg_variant:
-print 'Using configuration variant: %s' % cfg_variant
+lit_config.note('Using configuration variant: %s' % cfg_variant)
 
 # Load the Configuration class from the module name .test.config.
 config_module_name = '.'.join([cfg_variant, 'test', 'config'])


Index: test/lit.cfg
===
--- test/lit.cfg
+++ test/lit.cfg
@@ -55,7 +55,7 @@
 
 cfg_variant = getattr(config, 'configuration_variant', 'libcxxabi')
 if cfg_variant:
-print 'Using configuration variant: %s' % cfg_variant
+lit_config.note('Using configuration variant: %s' % cfg_variant)
 
 # Load the Configuration class from the module name .test.config.
 config_module_name = '.'.join([cfg_variant, 'test', 'config'])
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxxabi] r280251 - Wrap LIBCXXABI_USE_LLVM_UNWINDER with defined().

2016-08-31 Thread Logan Chien via cfe-commits
Author: logan
Date: Wed Aug 31 10:16:40 2016
New Revision: 280251

URL: http://llvm.org/viewvc/llvm-project?rev=280251=rev
Log:
Wrap LIBCXXABI_USE_LLVM_UNWINDER with defined().

This commit fixes -Wundef by replacing:

#if !LIBCXXABI_USE_LLVM_UNWINDER

with:

#if !defined(LIBCXXABI_USE_LLVM_UNWINDER)

Modified:
libcxxabi/trunk/src/cxa_personality.cpp

Modified: libcxxabi/trunk/src/cxa_personality.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_personality.cpp?rev=280251=280250=280251=diff
==
--- libcxxabi/trunk/src/cxa_personality.cpp (original)
+++ libcxxabi/trunk/src/cxa_personality.cpp Wed Aug 31 10:16:40 2016
@@ -1035,7 +1035,7 @@ static _Unwind_Reason_Code continue_unwi
 }
 
 // ARM register names
-#if !LIBCXXABI_USE_LLVM_UNWINDER
+#if !defined(LIBCXXABI_USE_LLVM_UNWINDER)
 static const uint32_t REG_UCB = 12;  // Register to save _Unwind_Control_Block
 #endif
 static const uint32_t REG_SP = 13;
@@ -1071,7 +1071,7 @@ __gxx_personality_v0(_Unwind_State state
 bool native_exception = (unwind_exception->exception_class & 
get_vendor_and_language) ==
 (kOurExceptionClass & get_vendor_and_language);
 
-#if !LIBCXXABI_USE_LLVM_UNWINDER
+#if !defined(LIBCXXABI_USE_LLVM_UNWINDER)
 // Copy the address of _Unwind_Control_Block to r12 so that
 // _Unwind_GetLanguageSpecificData() and _Unwind_GetRegionStart() can
 // return correct address.


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


Re: [PATCH] D24040: codechecker tool core

2016-08-31 Thread Artem Tamazov via cfe-commits
artem.tamazov resigned from this revision.
artem.tamazov removed a reviewer: artem.tamazov.
artem.tamazov added a comment.

It seems that my name got into reviewers list by mistake.


https://reviews.llvm.org/D24040



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


Re: [PATCH] D24075: [include-fixer] Add a `query-symbol` option to query symbol without parsing the source file.

2016-08-31 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 69847.
hokein added a comment.

Update the test.


https://reviews.llvm.org/D24075

Files:
  include-fixer/find-all-symbols/SymbolInfo.h
  include-fixer/tool/ClangIncludeFixer.cpp
  test/include-fixer/query_symbol.cpp

Index: test/include-fixer/query_symbol.cpp
===
--- /dev/null
+++ test/include-fixer/query_symbol.cpp
@@ -0,0 +1,13 @@
+// RUN: clang-include-fixer -db=fixed -input='foo= "foo.h","bar.h"' 
-query-symbol="foo" test.cpp -- | FileCheck %s
+
+// CHECK: "FilePath": "test.cpp",
+// CHECK-NEXT:"QuerySymbolInfos": [
+// CHECK-NEXT:   {"RawIdentifier": "foo",
+// CHECK-NEXT:"Range":{"Offset":0,"Length":0}}
+// CHECK-NEXT:],
+// CHECK-NEXT:"HeaderInfos": [
+// CHECK-NEXT:  {"Header": "\"foo.h\"",
+// CHECK-NEXT:   "QualifiedName": "foo"},
+// CHECK-NEXT:  {"Header": "\"bar.h\"",
+// CHECK-NEXT:   "QualifiedName": "foo"}
+// CHECK-NEXT:]
Index: include-fixer/tool/ClangIncludeFixer.cpp
===
--- include-fixer/tool/ClangIncludeFixer.cpp
+++ include-fixer/tool/ClangIncludeFixer.cpp
@@ -98,6 +98,12 @@
cl::desc("String to initialize the database"),
cl::cat(IncludeFixerCategory));
 
+cl::opt
+QuerySymbol("query-symbol",
+ cl::desc("Query a given symbol (e.g. \"a::b::foo\") in\n"
+  "database directly without parsing the file."),
+ cl::cat(IncludeFixerCategory));
+
 cl::opt
 MinimizeIncludePaths("minimize-paths",
  cl::desc("Whether to minimize added include paths"),
@@ -236,6 +242,7 @@
   tooling::ClangTool tool(options.getCompilations(),
   options.getSourcePathList());
 
+  llvm::StringRef SourceFilePath = options.getSourcePathList().front();
   // In STDINMode, we override the file content with the  input.
   // Since `tool.mapVirtualFile` takes `StringRef`, we define `Code` outside of
   // the if-block so that `Code` is not released after the if-block.
@@ -253,7 +260,7 @@
 if (Code->getBufferSize() == 0)
   return 0;  // Skip empty files.
 
-tool.mapVirtualFile(options.getSourcePathList().front(), 
Code->getBuffer());
+tool.mapVirtualFile(SourceFilePath, Code->getBuffer());
   }
 
   if (!InsertHeader.empty()) {
@@ -314,10 +321,31 @@
 
   // Set up data source.
   std::unique_ptr SymbolIndexMgr =
-  createSymbolIndexManager(options.getSourcePathList().front());
+  createSymbolIndexManager(SourceFilePath);
   if (!SymbolIndexMgr)
 return 1;
 
+  // Query symbol mode.
+  if (!QuerySymbol.empty()) {
+auto MatchedSymbols = SymbolIndexMgr->search(QuerySymbol);
+for (auto  : MatchedSymbols) {
+  std::string HeaderPath = Symbol.getFilePath().str();
+  Symbol.SetFilePath(((HeaderPath[0] == '"' || HeaderPath[0] == '<')
+  ? HeaderPath
+  : "\"" + HeaderPath + "\""));
+}
+
+// We leave an empty symbol range as we don't know the range of the symbol
+// being queried in this mode. include-fixer won't add namespace qualifiers
+// if the symbol range is empty, which also fits this case.
+IncludeFixerContext::QuerySymbolInfo Symbol;
+Symbol.RawIdentifier = QuerySymbol;
+auto Context =
+IncludeFixerContext(SourceFilePath, {Symbol}, MatchedSymbols);
+writeToJson(llvm::outs(), Context);
+return 0;
+  }
+
   // Now run our tool.
   std::vector Contexts;
   include_fixer::IncludeFixerActionFactory Factory(*SymbolIndexMgr, Contexts,
Index: include-fixer/find-all-symbols/SymbolInfo.h
===
--- include-fixer/find-all-symbols/SymbolInfo.h
+++ include-fixer/find-all-symbols/SymbolInfo.h
@@ -54,6 +54,8 @@
  int LineNumber, const std::vector ,
  unsigned NumOccurrences = 0);
 
+  void SetFilePath(llvm::StringRef Path) { FilePath = Path; }
+
   /// \brief Get symbol name.
   llvm::StringRef getName() const { return Name; }
 


Index: test/include-fixer/query_symbol.cpp
===
--- /dev/null
+++ test/include-fixer/query_symbol.cpp
@@ -0,0 +1,13 @@
+// RUN: clang-include-fixer -db=fixed -input='foo= "foo.h","bar.h"' -query-symbol="foo" test.cpp -- | FileCheck %s
+
+// CHECK: "FilePath": "test.cpp",
+// CHECK-NEXT:"QuerySymbolInfos": [
+// CHECK-NEXT:   {"RawIdentifier": "foo",
+// CHECK-NEXT:"Range":{"Offset":0,"Length":0}}
+// CHECK-NEXT:],
+// CHECK-NEXT:"HeaderInfos": [
+// CHECK-NEXT:  {"Header": "\"foo.h\"",
+// CHECK-NEXT:   "QualifiedName": "foo"},
+// CHECK-NEXT:  {"Header": "\"bar.h\"",
+// CHECK-NEXT:   "QualifiedName": "foo"}
+// CHECK-NEXT:]
Index: include-fixer/tool/ClangIncludeFixer.cpp
===
--- 

Re: [PATCH] D23918: [clang-tidy docs] Add missing option docs.

2016-08-31 Thread Haojian Wu via cfe-commits
This revision was automatically updated to reflect the committed changes.
hokein marked an inline comment as done.
Closed by commit rL280236: [clang-tidy docs] Add missing option docs. (authored 
by hokein).

Changed prior to commit:
  https://reviews.llvm.org/D23918?vs=69839=69840#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23918

Files:
  
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-namespaces.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/google-global-names-in-headers.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/google-runtime-int.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-header-guard.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-namespace-comment.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/misc-definitions-in-headers.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/misc-move-constructor-init.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/misc-sizeof-expression.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-constructor.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-missing-comma.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-string-compare.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-pass-by-value.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/performance-for-range-copy.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/performance-unnecessary-value-param.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/readability-implicit-bool-cast.rst

Index: clang-tools-extra/trunk/docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
===
--- clang-tools-extra/trunk/docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
@@ -5,15 +5,15 @@
 
 This check warns about the performance overhead arising from concatenating
 strings using the ``operator+``, for instance:
-
+
 .. code-block:: c++
 
 std::string a("Foo"), b("Bar");
 a = a + b;
 
 Instead of this structure you should use ``operator+=`` or ``std::string``'s
 (``std::basic_string``) class member function ``append()``. For instance:
-   
+
 .. code-block:: c++
 
std::string a("Foo"), b("Baz");
@@ -28,7 +28,7 @@
std::string a("Foo"), b("Baz");
for (int i = 0; i < 2; ++i) {
a.append("Bar").append(b);
-   } 
+   }
 
 And this can be rewritten too:
 
@@ -49,3 +49,11 @@
void g() {
f(std::string(a).append("Bar").append(b));
}
+
+Options
+---
+
+.. option:: StrictMode
+
+   When zero, the check will only check the string usage in ``while``, ``for``
+   and ``for-range`` statements. Default is `0`.
Index: clang-tools-extra/trunk/docs/clang-tidy/checks/performance-for-range-copy.rst
===
--- clang-tools-extra/trunk/docs/clang-tidy/checks/performance-for-range-copy.rst
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/performance-for-range-copy.rst
@@ -17,3 +17,11 @@
 2. The loop variable is not const, but only const methods or operators are
invoked on it, or it is used as const reference or value argument in
constructors or function calls.
+
+Options
+---
+
+.. option:: WarnOnAllAutoCopies
+
+   When non-zero, warns on any use of `auto` as the type of the range-based for
+   loop variable. Default is `0`.
Index: clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-namespaces.rst
===
--- clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-namespaces.rst
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-namespaces.rst
@@ -10,3 +10,14 @@
 https://google.github.io/styleguide/cppguide.html#Namespaces
 
 Corresponding cpplint.py check name: `build/namespaces`.
+
+Options
+---
+
+.. option:: HeaderFileExtensions
+
+   A comma-separated list of filename extensions of header files (the filename
+   extensions should not include "." prefix). Default is "h,hh,hpp,hxx".
+   For header files without an extension, use an empty string (if there are no
+   other desired extensions) or leave an empty element in the list. e.g.,
+   "h,hh,hpp,hxx," (note the trailing comma).
Index: clang-tools-extra/trunk/docs/clang-tidy/checks/google-runtime-int.rst
===
--- clang-tools-extra/trunk/docs/clang-tidy/checks/google-runtime-int.rst
+++ 

r280245 - clang-format: Set default WebKit style to use C++11.

2016-08-31 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Wed Aug 31 09:05:56 2016
New Revision: 280245

URL: http://llvm.org/viewvc/llvm-project?rev=280245=rev
Log:
clang-format: Set default WebKit style to use C++11.

The WebKit style page says to use nullptr, so this should be fine:
https://webkit.org/code-style-guidelines/

This fixes: llvm.org/PR30220

Modified:
cfe/trunk/lib/Format/Format.cpp

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=280245=280244=280245=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Wed Aug 31 09:05:56 2016
@@ -685,7 +685,6 @@ FormatStyle getWebKitStyle() {
   Style.ObjCBlockIndentWidth = 4;
   Style.ObjCSpaceAfterProperty = true;
   Style.PointerAlignment = FormatStyle::PAS_Left;
-  Style.Standard = FormatStyle::LS_Cpp03;
   return Style;
 }
 


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


Re: [PATCH] D24040: codechecker tool core

2016-08-31 Thread Laszlo Nagy via cfe-commits
rizsotto.mailinglist added a comment.

Gyorgy and the ericsson team, thanks for doing this. very good job! good 
targeted functionality. i don't want to underestimate the complexity it 
requires, but to me this is a giant code. i do miss the explanation of the 
overall functional description what a module does and how it relates to other 
modules. i found a gap between the high level overview and the code comments.
generally speaking i found this code under documented and a bit verbose. the 
comments in the code is not really paint the picture that i need in order to 
fix a bug, or implement a feature. and it might only be my personal taste, but 
found that creating types (or classes this case) in a dynamically typed script 
language, it makes the code very verbose while it does not implement much.
was commented only on two random modules, but found the same patterns in many 
other ones.
found that this code is not `pep8` conform. `pylint` found a lot of errors and 
warnings, and a couple of duplicate codes.
i hope we can fix these findings and that would make this code more solid and 
understood by others.



Comment at: tools/codechecker/bin/CodeChecker:35
@@ +34,3 @@
+
+python = os.path.join('python')
+common_lib = os.path.join(package_root,

wow, that looks woodoo. can you explain (in code comment) why is that necessary?


Comment at: tools/codechecker/bin/CodeChecker:67
@@ +66,3 @@
+
+original_env = os.environ.copy()
+checker_env = original_env

can you explain (in code comment) why are you playing with the environment? 
what problem does it solve and why do you need a backup?


Comment at: tools/codechecker/bin/CodeChecker:70
@@ +69,3 @@
+
+tmp_dir = tempfile.mkdtemp()
+

can you backport `tempfile.TemporaryDirectory` (from python 3.2) in one of your 
modules and use it inside `with` for proper resource guarding?


Comment at: tools/codechecker/bin/CodeChecker:85
@@ +84,3 @@
+pid = os.getpid()
+for p in procPool:
+os.kill(p, signal.SIGINT)

why not store the `subprocess.Popen` object and send signal via `send_signal`? 
(that would make it more portable too.)


Comment at: tools/codechecker/libcodechecker/build_manager.py:30
@@ +29,3 @@
+"""
+proc = subprocess.Popen(command,
+bufsize=-1,

is there any reason not to use `subprocess.call` instead? if you want that to 
be in silent, you shall pass `{'stdout': subprocess.PIPE, 'stderr': 
subprocess.STDOUT}` to it, otherwise it prints the output without you doing the 
copy. also noticed the `shell=True` which makes it very non-portable. and the 
`command` parameter is a string instead of a list. is there any reason for 
doing like this?


Comment at: tools/codechecker/libcodechecker/build_manager.py:55
@@ +54,3 @@
+
+try:
+original_env_file = os.environ['CODECHECKER_ORIGINAL_BUILD_ENV']

save-to-file and restore-from-file the environment would deserve a separate 
module i would say. is there any reason why it's not having those utility 
methods?


Comment at: tools/codechecker/libcodechecker/build_manager.py:131
@@ +130,3 @@
+return None
+except AttributeError as ex:
+# args.log_file was not set

why not have a command line parameter accessor method, that would either return 
the value if that was given or None? i found this pattern multiple files. that 
would get rid of the `try` block completely.


Comment at: tools/codechecker/libcodechecker/build_manager.py:150
@@ +149,3 @@
+
+if intercept_build_executable == None:
+if platform.system() == 'Linux':

`if intercept_build_executable is None:` would be more python.


Comment at: tools/codechecker/libcodechecker/build_manager.py:169
@@ +168,3 @@
+
+open(log_file, 'a').close()  # same as linux's touch
+

the comment is not really helpful!
why does it need a touch? or you just create an empty one? what for?


Comment at: tools/codechecker/libcodechecker/build_manager.py:177
@@ +176,3 @@
+except AttributeError as aerr:
+LOG.error(aerr)
+sys.exit(1)

`logger.exception` is logging the exception value implicitly at `ERROR` level 
too. but what i'm trying to say is, there is no error message in this line. you 
just throw the exception into the user face. can you add some explanation or 
instruction for the user?


https://reviews.llvm.org/D24040



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


Re: [PATCH] D23918: [clang-tidy docs] Add missing option docs.

2016-08-31 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 69839.
hokein added a comment.

Update HeaderFileExtensions doc for all documents.


https://reviews.llvm.org/D23918

Files:
  docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst
  docs/clang-tidy/checks/google-build-namespaces.rst
  docs/clang-tidy/checks/google-global-names-in-headers.rst
  docs/clang-tidy/checks/google-runtime-int.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/llvm-header-guard.rst
  docs/clang-tidy/checks/llvm-namespace-comment.rst
  docs/clang-tidy/checks/misc-definitions-in-headers.rst
  docs/clang-tidy/checks/misc-move-constructor-init.rst
  docs/clang-tidy/checks/misc-sizeof-expression.rst
  docs/clang-tidy/checks/misc-string-constructor.rst
  docs/clang-tidy/checks/misc-suspicious-missing-comma.rst
  docs/clang-tidy/checks/misc-suspicious-string-compare.rst
  docs/clang-tidy/checks/modernize-pass-by-value.rst
  docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
  docs/clang-tidy/checks/performance-for-range-copy.rst
  docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
  docs/clang-tidy/checks/performance-unnecessary-value-param.rst
  docs/clang-tidy/checks/readability-implicit-bool-cast.rst

Index: docs/clang-tidy/checks/readability-implicit-bool-cast.rst
===
--- docs/clang-tidy/checks/readability-implicit-bool-cast.rst
+++ docs/clang-tidy/checks/readability-implicit-bool-cast.rst
@@ -116,3 +116,15 @@
 
 Occurrences of implicit casts inside macros and template instantiations are
 deliberately ignored, as it is not clear how to deal with such cases.
+
+Options
+---
+
+.. option::  AllowConditionalIntegerCasts
+
+   When non-zero, the check will allow conditional integer casts. Default is
+   `0`.
+
+.. option::  AllowConditionalPointerCasts
+
+   When non-zero, the check will allow conditional pointer casts. Default is `0`.
Index: docs/clang-tidy/checks/performance-unnecessary-value-param.rst
===
--- docs/clang-tidy/checks/performance-unnecessary-value-param.rst
+++ docs/clang-tidy/checks/performance-unnecessary-value-param.rst
@@ -53,3 +53,11 @@
   void setValue(string Value) {
 Field = std::move(Value);
   }
+
+Options
+---
+
+.. option:: IncludeStyle
+
+   A string specifying which include-style is used, `llvm` or `google`. Default
+   is `llvm`.
Index: docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
===
--- docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
+++ docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
@@ -5,15 +5,15 @@
 
 This check warns about the performance overhead arising from concatenating
 strings using the ``operator+``, for instance:
-
+
 .. code-block:: c++
 
 std::string a("Foo"), b("Bar");
 a = a + b;
 
 Instead of this structure you should use ``operator+=`` or ``std::string``'s
 (``std::basic_string``) class member function ``append()``. For instance:
-   
+
 .. code-block:: c++
 
std::string a("Foo"), b("Baz");
@@ -28,7 +28,7 @@
std::string a("Foo"), b("Baz");
for (int i = 0; i < 2; ++i) {
a.append("Bar").append(b);
-   } 
+   }
 
 And this can be rewritten too:
 
@@ -49,3 +49,11 @@
void g() {
f(std::string(a).append("Bar").append(b));
}
+
+Options
+---
+
+.. option:: StrictMode
+
+   When zero, the check will only check the string usage in ``while``, ``for``
+   and ``for-range`` statements. Default is `0`.
Index: docs/clang-tidy/checks/performance-for-range-copy.rst
===
--- docs/clang-tidy/checks/performance-for-range-copy.rst
+++ docs/clang-tidy/checks/performance-for-range-copy.rst
@@ -17,3 +17,11 @@
 2. The loop variable is not const, but only const methods or operators are
invoked on it, or it is used as const reference or value argument in
constructors or function calls.
+
+Options
+---
+
+.. option:: WarnOnAllAutoCopies
+
+   When non-zero, warns on any use of `auto` as the type of the range-based for
+   loop variable. Default is `0`.
Index: docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
===
--- docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
+++ docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
@@ -70,3 +70,10 @@
 
  // only 'f()' (or similar) will trigger the replacement.
 
+Options
+---
+
+.. option:: IncludeStyle
+
+   A string specifying which include-style is used, `llvm` or `google`. Default
+   is `llvm`.
Index: docs/clang-tidy/checks/modernize-pass-by-value.rst
===
--- docs/clang-tidy/checks/modernize-pass-by-value.rst
+++ docs/clang-tidy/checks/modernize-pass-by-value.rst
@@ -151,3 +151,11 

r280240 - [clang-format-vim] Support vim linked against py3

2016-08-31 Thread Luke Drummond via cfe-commits
Author: ldrumm
Date: Wed Aug 31 08:36:36 2016
New Revision: 280240

URL: http://llvm.org/viewvc/llvm-project?rev=280240=rev
Log:
[clang-format-vim] Support vim linked against py3

clang-format.py previously only worked in vim compiled against python2.

This patch adds the necessary syntax changes to make this work with vim
linked against python3, which is now shipped by default for at least Ubuntu16 
and Arch.

Differential Revision: https://reviews.llvm.org/D23319

Subscribers: cfe-commits

Modified:
cfe/trunk/tools/clang-format/clang-format.py

Modified: cfe/trunk/tools/clang-format/clang-format.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/clang-format.py?rev=280240=280239=280240=diff
==
--- cfe/trunk/tools/clang-format/clang-format.py (original)
+++ cfe/trunk/tools/clang-format/clang-format.py Wed Aug 31 08:36:36 2016
@@ -25,6 +25,7 @@
 #
 # It operates on the current, potentially unsaved buffer and does not create
 # or save any files. To revert a formatting, just undo.
+from __future__ import print_function
 
 import difflib
 import json
@@ -49,6 +50,7 @@ if vim.eval('exists("g:clang_format_fall
 
 def main():
   # Get the current text.
+  encoding = vim.eval("")
   buf = vim.current.buffer
   text = '\n'.join(buf)
 
@@ -61,7 +63,7 @@ def main():
   # Determine the cursor position.
   cursor = int(vim.eval('line2byte(line("."))+col(".")')) - 2
   if cursor < 0:
-print 'Couldn\'t determine cursor position. Is your file empty?'
+print('Couldn\'t determine cursor position. Is your file empty?')
 return
 
   # Avoid flashing an ugly, ugly cmd prompt on Windows when invoking 
clang-format.
@@ -82,17 +84,19 @@ def main():
   p = subprocess.Popen(command,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
stdin=subprocess.PIPE, startupinfo=startupinfo)
-  stdout, stderr = p.communicate(input=text)
+  stdout, stderr = p.communicate(input=text.encode(encoding))
 
   # If successful, replace buffer contents.
   if stderr:
-print stderr
+print(stderr)
 
   if not stdout:
-print ('No output from clang-format (crashed?).\n' +
-'Please report to bugs.llvm.org.')
+print(
+'No output from clang-format (crashed?).\n'
+'Please report to bugs.llvm.org.'
+)
   else:
-lines = stdout.split('\n')
+lines = stdout.decode(encoding).split('\n')
 output = json.loads(lines[0])
 lines = lines[1:]
 sequence = difflib.SequenceMatcher(None, vim.current.buffer, lines)
@@ -100,7 +104,7 @@ def main():
   if op[0] is not 'equal':
 vim.current.buffer[op[1]:op[2]] = lines[op[3]:op[4]]
 if output.get('IncompleteFormat'):
-  print 'clang-format: incomplete (syntax errors)'
+  print('clang-format: incomplete (syntax errors)')
 vim.command('goto %d' % (output['Cursor'] + 1))
 
 main()


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


[clang-tools-extra] r280236 - [clang-tidy docs] Add missing option docs.

2016-08-31 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Wed Aug 31 08:21:18 2016
New Revision: 280236

URL: http://llvm.org/viewvc/llvm-project?rev=280236=rev
Log:
[clang-tidy docs] Add missing option docs.

Reviewers: alexfh, Eugene.Zelenko, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

Differential Revision: https://reviews.llvm.org/D23918

Modified:

clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-namespaces.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/google-global-names-in-headers.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/google-runtime-int.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-header-guard.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-namespace-comment.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-definitions-in-headers.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-move-constructor-init.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-sizeof-expression.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-constructor.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-missing-comma.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-string-compare.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-pass-by-value.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-replace-auto-ptr.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/performance-for-range-copy.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/performance-unnecessary-value-param.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/readability-implicit-bool-cast.rst

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst?rev=280236=280235=280236=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst
 (original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst
 Wed Aug 31 08:21:18 2016
@@ -18,3 +18,8 @@ Options
 
The check can generate fixes after this option has been set to the name of
the include file that contains ``gsl::at()``, e.g. `"gsl/gsl.h"`.
+
+.. option:: IncludeStyle
+
+   A string specifying which include-style is used, `llvm` or `google`. Default
+   is `llvm`.

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-namespaces.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-namespaces.rst?rev=280236=280235=280236=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-namespaces.rst 
(original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-namespaces.rst 
Wed Aug 31 08:21:18 2016
@@ -10,3 +10,14 @@ Finds anonymous namespaces in headers.
 https://google.github.io/styleguide/cppguide.html#Namespaces
 
 Corresponding cpplint.py check name: `build/namespaces`.
+
+Options
+---
+
+.. option:: HeaderFileExtensions
+
+   A comma-separated list of filename extensions of header files (the filename
+   extensions should not include "." prefix). Default is "h,hh,hpp,hxx".
+   For header files without an extension, use an empty string (if there are no
+   other desired extensions) or leave an empty element in the list. e.g.,
+   "h,hh,hpp,hxx," (note the trailing comma).

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/google-global-names-in-headers.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/google-global-names-in-headers.rst?rev=280236=280235=280236=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/google-global-names-in-headers.rst
 (original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/google-global-names-in-headers.rst
 Wed Aug 31 08:21:18 2016
@@ -15,6 +15,7 @@ Options
 .. option:: HeaderFileExtensions
 
A comma-separated list of filename extensions of header files (the filename
-   extensions should not contain "." prefix). "h" by default. For 
extension-less
-   header files, using an empty string or leaving an empty string between ","
-   if there are other filename extensions.
+   extensions should not contain "." prefix). Default is "h".
+   For header files without an extension, use an empty string (if there are no
+   other desired extensions) or leave 

[clang-tools-extra] r280235 - [docs] Fix docs build error.

2016-08-31 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Wed Aug 31 08:17:48 2016
New Revision: 280235

URL: http://llvm.org/viewvc/llvm-project?rev=280235=rev
Log:
[docs] Fix docs build error.

Modified:
clang-tools-extra/trunk/docs/ReleaseNotes.rst

Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ReleaseNotes.rst?rev=280235=280234=280235=diff
==
--- clang-tools-extra/trunk/docs/ReleaseNotes.rst (original)
+++ clang-tools-extra/trunk/docs/ReleaseNotes.rst Wed Aug 31 08:17:48 2016
@@ -98,6 +98,7 @@ Improvements to clang-tidy
   a constant type instead.
 
 Fixed bugs:
+
 - `modernize-make-unique
   `_
   and `modernize-make-shared


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


Re: [PATCH] D23918: [clang-tidy docs] Add missing option docs.

2016-08-31 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 69838.
hokein marked 3 inline comments as done.
hokein added a comment.

Fix more comments.


https://reviews.llvm.org/D23918

Files:
  docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst
  docs/clang-tidy/checks/google-build-namespaces.rst
  docs/clang-tidy/checks/google-runtime-int.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/llvm-header-guard.rst
  docs/clang-tidy/checks/llvm-namespace-comment.rst
  docs/clang-tidy/checks/misc-definitions-in-headers.rst
  docs/clang-tidy/checks/misc-move-constructor-init.rst
  docs/clang-tidy/checks/misc-sizeof-expression.rst
  docs/clang-tidy/checks/misc-string-constructor.rst
  docs/clang-tidy/checks/misc-suspicious-missing-comma.rst
  docs/clang-tidy/checks/misc-suspicious-string-compare.rst
  docs/clang-tidy/checks/modernize-pass-by-value.rst
  docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
  docs/clang-tidy/checks/performance-for-range-copy.rst
  docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
  docs/clang-tidy/checks/performance-unnecessary-value-param.rst
  docs/clang-tidy/checks/readability-implicit-bool-cast.rst

Index: docs/clang-tidy/checks/readability-implicit-bool-cast.rst
===
--- docs/clang-tidy/checks/readability-implicit-bool-cast.rst
+++ docs/clang-tidy/checks/readability-implicit-bool-cast.rst
@@ -116,3 +116,15 @@
 
 Occurrences of implicit casts inside macros and template instantiations are
 deliberately ignored, as it is not clear how to deal with such cases.
+
+Options
+---
+
+.. option::  AllowConditionalIntegerCasts
+
+   When non-zero, the check will allow conditional integer casts. Default is
+   `0`.
+
+.. option::  AllowConditionalPointerCasts
+
+   When non-zero, the check will allow conditional pointer casts. Default is `0`.
Index: docs/clang-tidy/checks/performance-unnecessary-value-param.rst
===
--- docs/clang-tidy/checks/performance-unnecessary-value-param.rst
+++ docs/clang-tidy/checks/performance-unnecessary-value-param.rst
@@ -53,3 +53,11 @@
   void setValue(string Value) {
 Field = std::move(Value);
   }
+
+Options
+---
+
+.. option:: IncludeStyle
+
+   A string specifying which include-style is used, `llvm` or `google`. Default
+   is `llvm`.
Index: docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
===
--- docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
+++ docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
@@ -5,15 +5,15 @@
 
 This check warns about the performance overhead arising from concatenating
 strings using the ``operator+``, for instance:
-
+
 .. code-block:: c++
 
 std::string a("Foo"), b("Bar");
 a = a + b;
 
 Instead of this structure you should use ``operator+=`` or ``std::string``'s
 (``std::basic_string``) class member function ``append()``. For instance:
-   
+
 .. code-block:: c++
 
std::string a("Foo"), b("Baz");
@@ -28,7 +28,7 @@
std::string a("Foo"), b("Baz");
for (int i = 0; i < 2; ++i) {
a.append("Bar").append(b);
-   } 
+   }
 
 And this can be rewritten too:
 
@@ -49,3 +49,11 @@
void g() {
f(std::string(a).append("Bar").append(b));
}
+
+Options
+---
+
+.. option:: StrictMode
+
+   When zero, the check will only check the string usage in ``while``, ``for``
+   and ``for-range`` statements. Default is `0`.
Index: docs/clang-tidy/checks/performance-for-range-copy.rst
===
--- docs/clang-tidy/checks/performance-for-range-copy.rst
+++ docs/clang-tidy/checks/performance-for-range-copy.rst
@@ -17,3 +17,11 @@
 2. The loop variable is not const, but only const methods or operators are
invoked on it, or it is used as const reference or value argument in
constructors or function calls.
+
+Options
+---
+
+.. option:: WarnOnAllAutoCopies
+
+   When non-zero, warns on any use of `auto` as the type of the range-based for
+   loop variable. Default is `0`.
Index: docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
===
--- docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
+++ docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
@@ -70,3 +70,10 @@
 
  // only 'f()' (or similar) will trigger the replacement.
 
+Options
+---
+
+.. option:: IncludeStyle
+
+   A string specifying which include-style is used, `llvm` or `google`. Default
+   is `llvm`.
Index: docs/clang-tidy/checks/modernize-pass-by-value.rst
===
--- docs/clang-tidy/checks/modernize-pass-by-value.rst
+++ docs/clang-tidy/checks/modernize-pass-by-value.rst
@@ -151,3 +151,11 @@
   For more information about the pass-by-value 

Re: [PATCH] D23918: [clang-tidy docs] Add missing option docs.

2016-08-31 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 for the updated documentation!


https://reviews.llvm.org/D23918



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


Re: [PATCH] D23918: [clang-tidy docs] Add missing option docs.

2016-08-31 Thread Haojian Wu via cfe-commits
hokein marked an inline comment as done.


Comment at: docs/clang-tidy/checks/google-build-namespaces.rst:21
@@ +20,3 @@
+   extensions should not include "." prefix). Default is "h,hh,hpp,hxx".
+   For header files without an extension, use an empty string (if there are no
+   other desired extensions) or leave an empty element in the list. e.g.,

All related documents have been updated now.


https://reviews.llvm.org/D23918



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


Re: [PATCH] D23918: [clang-tidy docs] Add missing option docs.

2016-08-31 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: docs/clang-tidy/checks/google-build-namespaces.rst:21
@@ +20,3 @@
+   extensions should not include "." prefix). Default is "h,hh,hpp,hxx".
+   For header files without an extension, use an empty string (if there are no
+   other desired extensions) or leave an empty element in the list. e.g.,

Okay, that make sense to me then. This change should also be applied to other 
places that have the extension list.


https://reviews.llvm.org/D23918



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


Re: [PATCH] D23918: [clang-tidy docs] Add missing option docs.

2016-08-31 Thread Haojian Wu via cfe-commits
hokein added inline comments.


Comment at: docs/clang-tidy/checks/google-build-namespaces.rst:21
@@ +20,3 @@
+   extensions should not include "." prefix). Default is "h,hh,hpp,hxx".
+   For header files without an extension, use an empty string (if there are no
+   other desired extensions) or leave an empty element in the list. e.g.,

aaron.ballman wrote:
> I may be confused then -- does the string "h,hh,hpp,hxx" (no trailing comma) 
> also wind up including header files without extensions? If so, we should 
> document that. If not, would adding a trailing comma cause it to include 
> header files without an extension? If so, that's what my example was trying 
> to point out, but perhaps my phrasing needs clarifying.
Aha, sorry, I misunderstood your words here. Yeah, we should add trailing `,` 
for the non-extension headers. 


https://reviews.llvm.org/D23918



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


Re: [libcxx] r279955 - Fix pair::operator=(TupleLike&&).

2016-08-31 Thread Eric Fiselier via cfe-commits
ping.

On Sun, Aug 28, 2016 at 7:52 PM, Eric Fiselier  wrote:

> @Hans While working on the std::tuple bug I found this bug in std::pair.
> Since we are already doing another RC I would like to merge this fix.
>
> @Marshall Sound OK to you?
>
> /Eric
>
> On Sun, Aug 28, 2016 at 7:43 PM, Eric Fiselier via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: ericwf
>> Date: Sun Aug 28 20:43:41 2016
>> New Revision: 279955
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=279955=rev
>> Log:
>> Fix pair::operator=(TupleLike&&).
>>
>> This assignment operator was previously broken since the SFINAE always
>> resulted
>> in substitution failure. This caused assignments to turn into
>> copy construction + assignment.
>>
>> This patch was originally committed as r279953 but was reverted due to
>> warnings
>> in the test-suite. This new patch corrects those warnings.
>>
>> Added:
>> libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/
>> assign_tuple.pass.cpp
>> Modified:
>> libcxx/trunk/include/utility
>>
>> Modified: libcxx/trunk/include/utility
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/uti
>> lity?rev=279955=279954=279955=diff
>> 
>> ==
>> --- libcxx/trunk/include/utility (original)
>> +++ libcxx/trunk/include/utility Sun Aug 28 20:43:41 2016
>> @@ -515,7 +515,7 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
>>  }
>>
>>  template > -_CheckTLC<_Tuple>::template __enable_assign()
>> +_CheckTLC<_Tuple>::template __enable_assign<_Tuple>()
>>   > = false>
>>  _LIBCPP_INLINE_VISIBILITY
>>  pair& operator=(_Tuple&& __p) {
>>
>> Added: libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/
>> assign_tuple.pass.cpp
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/ut
>> ilities/utility/pairs/pairs.pair/assign_tuple.pass.cpp?rev=
>> 279955=auto
>> 
>> ==
>> --- 
>> libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/assign_tuple.pass.cpp
>> (added)
>> +++ 
>> libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/assign_tuple.pass.cpp
>> Sun Aug 28 20:43:41 2016
>> @@ -0,0 +1,140 @@
>> +//===--
>> ===//
>> +//
>> +// The LLVM Compiler Infrastructure
>> +//
>> +// This file is dual licensed under the MIT and the University of
>> Illinois Open
>> +// Source Licenses. See LICENSE.TXT for details.
>> +//
>> +//===--
>> ===//
>> +
>> +// UNSUPPORTED: c++98, c++03
>> +
>> +// 
>> +
>> +// template  struct pair
>> +
>> +// template pair& operator=(tuple&& p);
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +// Clang warns about missing braces when initializing std::array.
>> +#if defined(__clang__)
>> +#pragma clang diagnostic ignored "-Wmissing-braces"
>> +#endif
>> +
>> +struct CountingType {
>> +  static int constructed;
>> +  static int copy_constructed;
>> +  static int move_constructed;
>> +  static int assigned;
>> +  static int copy_assigned;
>> +  static int move_assigned;
>> +  static void reset() {
>> +  constructed = copy_constructed = move_constructed = 0;
>> +  assigned = copy_assigned = move_assigned = 0;
>> +  }
>> +  CountingType() : value(0) { ++constructed; }
>> +  CountingType(int v) : value(v) { ++constructed; }
>> +  CountingType(CountingType const& o) : value(o.value) { ++constructed;
>> ++copy_constructed; }
>> +  CountingType(CountingType&& o) : value(o.value) { ++constructed;
>> ++move_constructed; o.value = -1;}
>> +
>> +  CountingType& operator=(CountingType const& o) {
>> +  ++assigned;
>> +  ++copy_assigned;
>> +  value = o.value;
>> +  return *this;
>> +  }
>> +  CountingType& operator=(CountingType&& o) {
>> +  ++assigned;
>> +  ++move_assigned;
>> +  value = o.value;
>> +  o.value = -1;
>> +  return *this;
>> +  }
>> +  int value;
>> +};
>> +int CountingType::constructed;
>> +int CountingType::copy_constructed;
>> +int CountingType::move_constructed;
>> +int CountingType::assigned;
>> +int CountingType::copy_assigned;
>> +int CountingType::move_assigned;
>> +
>> +int main()
>> +{
>> +using C = CountingType;
>> +{
>> +   using P = std::pair;
>> +   using T = std::tuple;
>> +   T t(42, C{42});
>> +   P p(101, C{101});
>> +   C::reset();
>> +   p = t;
>> +   assert(C::constructed == 0);
>> +   assert(C::assigned == 1);
>> +   assert(C::copy_assigned == 1);
>> +   assert(C::move_assigned == 0);
>> +   assert(p.first == 42);
>> +   assert(p.second.value == 42);
>> +}
>> +{
>> +   using P = std::pair;
>> +   using T = std::tuple;
>> +   T t(42, -42);
>> +   P p(101, 101);
>> +   

Re: [PATCH] D23918: [clang-tidy docs] Add missing option docs.

2016-08-31 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: docs/clang-tidy/checks/google-build-namespaces.rst:21
@@ +20,3 @@
+   extensions should not include "." prefix). Default is "h,hh,hpp,hxx".
+   For header files without an extension, use an empty string (if there are no
+   other desired extensions) or leave an empty element in the list. e.g.,

I may be confused then -- does the string "h,hh,hpp,hxx" (no trailing comma) 
also wind up including header files without extensions? If so, we should 
document that. If not, would adding a trailing comma cause it to include header 
files without an extension? If so, that's what my example was trying to point 
out, but perhaps my phrasing needs clarifying.


Comment at: docs/clang-tidy/checks/misc-sizeof-expression.rst:154
@@ +153,2 @@
+   ``sizeof(epxr) <= k`` for a suspicious constant `k` while `k` is `0` or
+   bigger than `0x8000`. Default is `1`.

s/bigger than/greater than


Comment at: docs/clang-tidy/checks/performance-for-range-copy.rst:26
@@ +25,3 @@
+
+   When non-zero, warns on any use of auto as the type of the range-based for
+   loop variable. Default is `0`.

Should quote auto with backtics, I suppose.


https://reviews.llvm.org/D23918



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


r280227 - Revision r280064 adds new options -fdenormal-fp-math and passes through option

2016-08-31 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Wed Aug 31 07:31:03 2016
New Revision: 280227

URL: http://llvm.org/viewvc/llvm-project?rev=280227=rev
Log:
Revision r280064 adds new options -fdenormal-fp-math and passes through option
-ffast-math to CC1, but it included a wrong llvm regression tests which was
removed in r280065.  Although regression test noexceptionsfpmath.c makes sure
-fno-trapping-math ends up as a function attribute, this adds a test that
explicitly checks the driver output for -fno-trapping-math.

Modified:
cfe/trunk/test/Driver/fast-math.c

Modified: cfe/trunk/test/Driver/fast-math.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fast-math.c?rev=280227=280226=280227=diff
==
--- cfe/trunk/test/Driver/fast-math.c (original)
+++ cfe/trunk/test/Driver/fast-math.c Wed Aug 31 07:31:03 2016
@@ -232,12 +232,15 @@
 // CHECK-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math"
 // CHECK-NO-UNSAFE-MATH: "-o"
 //
+// RUN: %clang -### -ftrapping-math -fno-trapping-math -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-TRAPPING-MATH %s
 // RUN: %clang -### -fdenormal-fp-math=ieee -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-IEEE %s
 // RUN: %clang -### -fdenormal-fp-math=preserve-sign -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PS %s
 // RUN: %clang -### -fdenormal-fp-math=positive-zero -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PZ %s
+// CHECK-NO-TRAPPING-MATH: "-fno-trapping-math"
 // CHECK-FP-DENORMAL-IEEE: "-fdenormal-fp-math=ieee"
 // CHECK-FP-DENORMAL-PS: "-fdenormal-fp-math=preserve-sign"
 // CHECK-FP-DENORMAL-PZ: "-fdenormal-fp-math=positive-zero"


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


[PATCH] D24075: [include-fixer] Add a `query-symbol` option to query symbol without parsing the source file.

2016-08-31 Thread Haojian Wu via cfe-commits
hokein created this revision.
hokein added a reviewer: bkramer.
hokein added a subscriber: cfe-commits.

https://reviews.llvm.org/D24075

Files:
  include-fixer/find-all-symbols/SymbolInfo.h
  include-fixer/tool/ClangIncludeFixer.cpp
  test/include-fixer/query_symbol.cpp

Index: test/include-fixer/query_symbol.cpp
===
--- /dev/null
+++ test/include-fixer/query_symbol.cpp
@@ -0,0 +1,13 @@
+// RUN: clang-include-fixer -db=fixed -input='foo= "foo.h","bar.h"' 
-search-symbol="foo" test.cpp -- | FileCheck %s
+
+// CHECK: "FilePath": "test.cpp",
+// CHECK-NEXT:"QuerySymbolInfos": [
+// CHECK-NEXT:   {"RawIdentifier": "foo",
+// CHECK-NEXT:"Range":{"Offset":0,"Length":0}}
+// CHECK-NEXT:],
+// CHECK-NEXT:"HeaderInfos": [
+// CHECK-NEXT:  {"Header": "\"foo.h\"",
+// CHECK-NEXT:   "QualifiedName": "foo"},
+// CHECK-NEXT:  {"Header": "\"bar.h\"",
+// CHECK-NEXT:   "QualifiedName": "foo"}
+// CHECK-NEXT:]
Index: include-fixer/tool/ClangIncludeFixer.cpp
===
--- include-fixer/tool/ClangIncludeFixer.cpp
+++ include-fixer/tool/ClangIncludeFixer.cpp
@@ -98,6 +98,12 @@
cl::desc("String to initialize the database"),
cl::cat(IncludeFixerCategory));
 
+cl::opt
+QuerySymbol("query-symbol",
+ cl::desc("Query a given symbol (e.g. \"a::b::foo\") in\n"
+  "database directly without parsing the file."),
+ cl::cat(IncludeFixerCategory));
+
 cl::opt
 MinimizeIncludePaths("minimize-paths",
  cl::desc("Whether to minimize added include paths"),
@@ -236,6 +242,7 @@
   tooling::ClangTool tool(options.getCompilations(),
   options.getSourcePathList());
 
+  llvm::StringRef SourceFilePath = options.getSourcePathList().front();
   // In STDINMode, we override the file content with the  input.
   // Since `tool.mapVirtualFile` takes `StringRef`, we define `Code` outside of
   // the if-block so that `Code` is not released after the if-block.
@@ -253,7 +260,7 @@
 if (Code->getBufferSize() == 0)
   return 0;  // Skip empty files.
 
-tool.mapVirtualFile(options.getSourcePathList().front(), 
Code->getBuffer());
+tool.mapVirtualFile(SourceFilePath, Code->getBuffer());
   }
 
   if (!InsertHeader.empty()) {
@@ -314,10 +321,31 @@
 
   // Set up data source.
   std::unique_ptr SymbolIndexMgr =
-  createSymbolIndexManager(options.getSourcePathList().front());
+  createSymbolIndexManager(SourceFilePath);
   if (!SymbolIndexMgr)
 return 1;
 
+  // Query symbol mode.
+  if (!QuerySymbol.empty()) {
+auto MatchedSymbols = SymbolIndexMgr->search(QuerySymbol);
+for (auto  : MatchedSymbols) {
+  std::string HeaderPath = Symbol.getFilePath().str();
+  Symbol.SetFilePath(((HeaderPath[0] == '"' || HeaderPath[0] == '<')
+  ? HeaderPath
+  : "\"" + HeaderPath + "\""));
+}
+
+// We leave an empty symbol range as we don't know the range of the symbol
+// being queried in this mode. include-fixer won't add namespace qualifiers
+// if the symbol range is empty, which also fits this case.
+IncludeFixerContext::QuerySymbolInfo Symbol;
+Symbol.RawIdentifier = QuerySymbol;
+auto Context =
+IncludeFixerContext(SourceFilePath, {Symbol}, MatchedSymbols);
+writeToJson(llvm::outs(), Context);
+return 0;
+  }
+
   // Now run our tool.
   std::vector Contexts;
   include_fixer::IncludeFixerActionFactory Factory(*SymbolIndexMgr, Contexts,
Index: include-fixer/find-all-symbols/SymbolInfo.h
===
--- include-fixer/find-all-symbols/SymbolInfo.h
+++ include-fixer/find-all-symbols/SymbolInfo.h
@@ -54,6 +54,8 @@
  int LineNumber, const std::vector ,
  unsigned NumOccurrences = 0);
 
+  void SetFilePath(llvm::StringRef Path) { FilePath = Path; }
+
   /// \brief Get symbol name.
   llvm::StringRef getName() const { return Name; }
 


Index: test/include-fixer/query_symbol.cpp
===
--- /dev/null
+++ test/include-fixer/query_symbol.cpp
@@ -0,0 +1,13 @@
+// RUN: clang-include-fixer -db=fixed -input='foo= "foo.h","bar.h"' -search-symbol="foo" test.cpp -- | FileCheck %s
+
+// CHECK: "FilePath": "test.cpp",
+// CHECK-NEXT:"QuerySymbolInfos": [
+// CHECK-NEXT:   {"RawIdentifier": "foo",
+// CHECK-NEXT:"Range":{"Offset":0,"Length":0}}
+// CHECK-NEXT:],
+// CHECK-NEXT:"HeaderInfos": [
+// CHECK-NEXT:  {"Header": "\"foo.h\"",
+// CHECK-NEXT:   "QualifiedName": "foo"},
+// CHECK-NEXT:  {"Header": "\"bar.h\"",
+// CHECK-NEXT:   "QualifiedName": "foo"}
+// CHECK-NEXT:]
Index: include-fixer/tool/ClangIncludeFixer.cpp
===
--- 

Re: r280065 - Fix for commit 280064 that break the build.

2016-08-31 Thread Renato Golin via cfe-commits
On 31 August 2016 at 11:30, Sjoerd Meijer  wrote:
> Regression test test/CodeGen/noexceptionsfpmath.c makes sure 
> -fno-trapping-math ends up as a function attribute, and I relied on that. 
> Flag -fno-trapping-math is used a lot in test/Driver/fast-math.c, but you are 
> right that there is no test that test that explicitly test the output for 
> this. I will add a test case for that.

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


r280220 - Attempt to pacify buildbots after r280217

2016-08-31 Thread James Molloy via cfe-commits
Author: jamesm
Date: Wed Aug 31 06:01:41 2016
New Revision: 280220

URL: http://llvm.org/viewvc/llvm-project?rev=280220=rev
Log:
Attempt to pacify buildbots after r280217

These clang tests check diagnostics from the backend by giving it an 
unvectorizable loop. This loop is now vectorized :/

Make it really unvectorizable by making it unprofitable to ifconvert.

Modified:
cfe/trunk/test/Misc/backend-optimization-failure-nodbg.cpp
cfe/trunk/test/Misc/backend-optimization-failure.cpp

Modified: cfe/trunk/test/Misc/backend-optimization-failure-nodbg.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/backend-optimization-failure-nodbg.cpp?rev=280220=280219=280220=diff
==
--- cfe/trunk/test/Misc/backend-optimization-failure-nodbg.cpp (original)
+++ cfe/trunk/test/Misc/backend-optimization-failure-nodbg.cpp Wed Aug 31 
06:01:41 2016
@@ -4,7 +4,7 @@
 // Test verifies optimization failures generated by the backend are handled
 // correctly by clang. LLVM tests verify all of the failure conditions.
 
-void test_switch(int *A, int *B, int Length) { /* expected-warning {{loop not 
vectorized: failed explicitly specified loop vectorization}} */
+void test_switch(int *A, int *B, int Length, int J) { /* expected-warning 
{{loop not vectorized: failed explicitly specified loop vectorization}} */
 #pragma clang loop vectorize(enable) unroll(disable)
   for (int i = 0; i < Length; i++) {
 switch (A[i]) {
@@ -12,7 +12,7 @@ void test_switch(int *A, int *B, int Len
   B[i] = 1;
   break;
 case 1:
-  B[i] = 2;
+  B[J] = 2;
   break;
 default:
   B[i] = 3;

Modified: cfe/trunk/test/Misc/backend-optimization-failure.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/backend-optimization-failure.cpp?rev=280220=280219=280220=diff
==
--- cfe/trunk/test/Misc/backend-optimization-failure.cpp (original)
+++ cfe/trunk/test/Misc/backend-optimization-failure.cpp Wed Aug 31 06:01:41 
2016
@@ -4,7 +4,7 @@
 // Test verifies optimization failures generated by the backend are handled
 // correctly by clang. LLVM tests verify all of the failure conditions.
 
-void test_switch(int *A, int *B, int Length) {
+void test_switch(int *A, int *B, int Length,int J) {
 #pragma clang loop vectorize(enable) unroll(disable)
   for (int i = 0; i < Length; i++) {
 /* expected-warning@-1 {{loop not vectorized: failed explicitly specified loop 
vectorization}} */ switch (A[i]) {
@@ -12,7 +12,7 @@ void test_switch(int *A, int *B, int Len
   B[i] = 1;
   break;
 case 1:
-  B[i] = 2;
+  B[J] = 2;
   break;
 default:
   B[i] = 3;


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


RE: r280065 - Fix for commit 280064 that break the build.

2016-08-31 Thread Sjoerd Meijer via cfe-commits
Hi,

I uploaded the incorrect patch, it shouldn't have included the 
-fexceptions-fp-math because we decided to use trapping-math and therefore I 
removed these test lines in the quick fix.

Regression test test/CodeGen/noexceptionsfpmath.c makes sure -fno-trapping-math 
ends up as a function attribute, and I relied on that. Flag -fno-trapping-math 
is used a lot in test/Driver/fast-math.c, but you are right that there is no 
test that test that explicitly test the output for this. I will add a test case 
for that.

Thanks,

Sjoerd.


-Original Message-
From: Renato Golin [mailto:renato.go...@linaro.org]
Sent: 31 August 2016 11:10
To: Sjoerd Meijer
Cc: Clang Commits; Diana Picus; James Molloy
Subject: Re: r280065 - Fix for commit 280064 that break the build.

On 30 August 2016 at 09:56, Sjoerd Meijer via cfe-commits 
 wrote:
> Author: sjoerdmeijer
> Date: Tue Aug 30 03:56:00 2016
> New Revision: 280065
>
> URL: http://llvm.org/viewvc/llvm-project?rev=280065=rev
> Log:
> Fix for commit 280064 that break the build.

Any more info on this? Is this being worked to replace the deleted tests?

cheers,
-renato

IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r280065 - Fix for commit 280064 that break the build.

2016-08-31 Thread Renato Golin via cfe-commits
On 30 August 2016 at 09:56, Sjoerd Meijer via cfe-commits
 wrote:
> Author: sjoerdmeijer
> Date: Tue Aug 30 03:56:00 2016
> New Revision: 280065
>
> URL: http://llvm.org/viewvc/llvm-project?rev=280065=rev
> Log:
> Fix for commit 280064 that break the build.

Any more info on this? Is this being worked to replace the deleted tests?

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


Re: r280133 - PR30195: Fix clang-cl attempting to precompile bogus (non-precompilable) input types.

2016-08-31 Thread Renato Golin via cfe-commits
Thanks!

On 31 August 2016 at 01:02, Richard Smith  wrote:
> Hopefully r280178 should fix this.
>
> On Tue, Aug 30, 2016 at 4:00 PM, Renato Golin 
> wrote:
>>
>> On 30 August 2016 at 22:44, Renato Golin  wrote:
>> > This breakage was hidden by Duncan's build breakage:
>> >
>> > http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/11172
>>
>> Also,
>> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/9813
>>
>> Same error...
>>
>> cheers,
>> --renato
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23279: clang-reorder-fields

2016-08-31 Thread Daniel Jasper via cfe-commits
djasper added a comment.

Looks good :).


Repository:
  rL LLVM

https://reviews.llvm.org/D23279



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


Re: [PATCH] D23279: clang-reorder-fields

2016-08-31 Thread Alexander Shaposhnikov via cfe-commits
alexshap marked an inline comment as done.
alexshap added a comment.

Repository:
  rL LLVM

https://reviews.llvm.org/D23279



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


Re: [PATCH] D23279: clang-reorder-fields

2016-08-31 Thread Alexander Shaposhnikov via cfe-commits
alexshap marked an inline comment as done.
alexshap added a comment.

Repository:
  rL LLVM

https://reviews.llvm.org/D23279



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


  1   2   >