[PATCH] D50616: [Fixed Point Arithmetic] FixedPointCast

2018-10-10 Thread Bevin Hansson via Phabricator via cfe-commits
ebevhan added a comment.

I agree with John, after that I think it's fine for me.


Repository:
  rC Clang

https://reviews.llvm.org/D50616



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


r344117 - [X86] Remove FeatureRTM from Skylake processor list

2018-10-10 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Wed Oct 10 00:43:45 2018
New Revision: 344117

URL: http://llvm.org/viewvc/llvm-project?rev=344117&view=rev
Log:
[X86] Remove FeatureRTM from Skylake processor list

Summary:
There are a LOT of Skylakes and later without TSX-NI. Examples:
- SKL: 
https://ark.intel.com/products/136863/Intel-Core-i3-8121U-Processor-4M-Cache-up-to-3-20-GHz-
- KBL: 
https://ark.intel.com/products/97540/Intel-Core-i7-7560U-Processor-4M-Cache-up-to-3-80-GHz-
- KBL-R: 
https://ark.intel.com/products/149091/Intel-Core-i7-8565U-Processor-8M-Cache-up-to-4-60-GHz-
- CNL: 
https://ark.intel.com/products/136863/Intel-Core-i3-8121U-Processor-4M-Cache-up-to-3_20-GHz

This feature seems to be present only on high-end desktop and server
chips (I can't find any SKX without). This commit leaves it disabled
for all processors, but can be re-enabled for specific builds with
-mrtm.

Matches https://reviews.llvm.org/D53041

Patch by Thiago Macieira

Reviewers: erichkeane, craig.topper

Reviewed By: craig.topper

Subscribers: lebedev.ri, cfe-commits

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

Modified:
cfe/trunk/lib/Basic/Targets/X86.cpp
cfe/trunk/test/Preprocessor/predefined-arch-macros.c

Modified: cfe/trunk/lib/Basic/Targets/X86.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/X86.cpp?rev=344117&r1=344116&r2=344117&view=diff
==
--- cfe/trunk/lib/Basic/Targets/X86.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/X86.cpp Wed Oct 10 00:43:45 2018
@@ -169,7 +169,6 @@ bool X86TargetInfo::initFeatureMap(
 if (Kind != CK_SkylakeServer) // SKX inherits all SKL features, except SGX
   setFeatureEnabledImpl(Features, "sgx", true);
 setFeatureEnabledImpl(Features, "clflushopt", true);
-setFeatureEnabledImpl(Features, "rtm", true);
 setFeatureEnabledImpl(Features, "aes", true);
 LLVM_FALLTHROUGH;
   case CK_Broadwell:

Modified: cfe/trunk/test/Preprocessor/predefined-arch-macros.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/predefined-arch-macros.c?rev=344117&r1=344116&r2=344117&view=diff
==
--- cfe/trunk/test/Preprocessor/predefined-arch-macros.c (original)
+++ cfe/trunk/test/Preprocessor/predefined-arch-macros.c Wed Oct 10 00:43:45 
2018
@@ -670,7 +670,6 @@
 // CHECK_SKL_M32: #define __PRFCHW__ 1
 // CHECK_SKL_M32: #define __RDRND__ 1
 // CHECK_SKL_M32: #define __RDSEED__ 1
-// CHECK_SKL_M32: #define __RTM__ 1
 // CHECK_SKL_M32: #define __SGX__ 1
 // CHECK_SKL_M32: #define __SSE2__ 1
 // CHECK_SKL_M32: #define __SSE3__ 1
@@ -706,7 +705,6 @@
 // CHECK_SKL_M64: #define __PRFCHW__ 1
 // CHECK_SKL_M64: #define __RDRND__ 1
 // CHECK_SKL_M64: #define __RDSEED__ 1
-// CHECK_SKL_M64: #define __RTM__ 1
 // CHECK_SKL_M64: #define __SGX__ 1
 // CHECK_SKL_M64: #define __SSE2_MATH__ 1
 // CHECK_SKL_M64: #define __SSE2__ 1
@@ -747,7 +745,6 @@
 // CHECK_KNL_M32: #define __PREFETCHWT1__ 1
 // CHECK_KNL_M32: #define __PRFCHW__ 1
 // CHECK_KNL_M32: #define __RDRND__ 1
-// CHECK_KNL_M32: #define __RTM__ 1
 // CHECK_KNL_M32: #define __SSE2__ 1
 // CHECK_KNL_M32: #define __SSE3__ 1
 // CHECK_KNL_M32: #define __SSE4_1__ 1
@@ -785,7 +782,6 @@
 // CHECK_KNL_M64: #define __PREFETCHWT1__ 1
 // CHECK_KNL_M64: #define __PRFCHW__ 1
 // CHECK_KNL_M64: #define __RDRND__ 1
-// CHECK_KNL_M64: #define __RTM__ 1
 // CHECK_KNL_M64: #define __SSE2_MATH__ 1
 // CHECK_KNL_M64: #define __SSE2__ 1
 // CHECK_KNL_M64: #define __SSE3__ 1
@@ -827,7 +823,6 @@
 // CHECK_KNM_M32: #define __PREFETCHWT1__ 1
 // CHECK_KNM_M32: #define __PRFCHW__ 1
 // CHECK_KNM_M32: #define __RDRND__ 1
-// CHECK_KNM_M32: #define __RTM__ 1
 // CHECK_KNM_M32: #define __SSE2__ 1
 // CHECK_KNM_M32: #define __SSE3__ 1
 // CHECK_KNM_M32: #define __SSE4_1__ 1
@@ -863,7 +858,6 @@
 // CHECK_KNM_M64: #define __PREFETCHWT1__ 1
 // CHECK_KNM_M64: #define __PRFCHW__ 1
 // CHECK_KNM_M64: #define __RDRND__ 1
-// CHECK_KNM_M64: #define __RTM__ 1
 // CHECK_KNM_M64: #define __SSE2_MATH__ 1
 // CHECK_KNM_M64: #define __SSE2__ 1
 // CHECK_KNM_M64: #define __SSE3__ 1
@@ -907,7 +901,6 @@
 // CHECK_SKX_M32: #define __PRFCHW__ 1
 // CHECK_SKX_M32: #define __RDRND__ 1
 // CHECK_SKX_M32: #define __RDSEED__ 1
-// CHECK_SKX_M32: #define __RTM__ 1
 // CHECK_SKX_M32-NOT: #define __SGX__ 1
 // CHECK_SKX_M32: #define __SSE2__ 1
 // CHECK_SKX_M32: #define __SSE3__ 1
@@ -954,7 +947,6 @@
 // CHECK_SKX_M64: #define __PRFCHW__ 1
 // CHECK_SKX_M64: #define __RDRND__ 1
 // CHECK_SKX_M64: #define __RDSEED__ 1
-// CHECK_SKX_M64: #define __RTM__ 1
 // CHECK_SKX_M64-NOT: #define __SGX__ 1
 // CHECK_SKX_M64: #define __SSE2_MATH__ 1
 // CHECK_SKX_M64: #define __SSE2__ 1
@@ -1006,7 +998,6 @@
 // CHECK_CNL_M32: #define __PRFCHW__ 1
 // CHECK_CNL_M32: #define __RDRND__ 1
 // CHECK_CNL_M32: #define __RDSEED__ 1
-// CHECK_CNL_M32: #define __RTM__ 1
 // CHECK_CNL_M32: #define __SGX__ 1
 // CHECK_CNL_M32: #d

[clang-tools-extra] r344118 - [clangd] Make FSProvider const-correct. NFC

2018-10-10 Thread Sam McCall via cfe-commits
Author: sammccall
Date: Wed Oct 10 00:46:15 2018
New Revision: 344118

URL: http://llvm.org/viewvc/llvm-project?rev=344118&view=rev
Log:
[clangd] Make FSProvider const-correct. NFC

Modified:
clang-tools-extra/trunk/clangd/ClangdServer.cpp
clang-tools-extra/trunk/clangd/ClangdServer.h
clang-tools-extra/trunk/clangd/FSProvider.h
clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp
clang-tools-extra/trunk/unittests/clangd/TestFS.h

Modified: clang-tools-extra/trunk/clangd/ClangdServer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdServer.cpp?rev=344118&r1=344117&r2=344118&view=diff
==
--- clang-tools-extra/trunk/clangd/ClangdServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdServer.cpp Wed Oct 10 00:46:15 2018
@@ -97,8 +97,8 @@ ClangdServer::Options ClangdServer::opts
   return Opts;
 }
 
-ClangdServer::ClangdServer(GlobalCompilationDatabase &CDB,
-   FileSystemProvider &FSProvider,
+ClangdServer::ClangdServer(const GlobalCompilationDatabase &CDB,
+   const FileSystemProvider &FSProvider,
DiagnosticsConsumer &DiagConsumer,
const Options &Opts)
 : CDB(CDB), DiagConsumer(DiagConsumer), FSProvider(FSProvider),

Modified: clang-tools-extra/trunk/clangd/ClangdServer.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdServer.h?rev=344118&r1=344117&r2=344118&view=diff
==
--- clang-tools-extra/trunk/clangd/ClangdServer.h (original)
+++ clang-tools-extra/trunk/clangd/ClangdServer.h Wed Oct 10 00:46:15 2018
@@ -109,7 +109,8 @@ public:
   /// \p DiagConsumer. Note that a callback to \p DiagConsumer happens on a
   /// worker thread. Therefore, instances of \p DiagConsumer must properly
   /// synchronize access to shared state.
-  ClangdServer(GlobalCompilationDatabase &CDB, FileSystemProvider &FSProvider,
+  ClangdServer(const GlobalCompilationDatabase &CDB,
+   const FileSystemProvider &FSProvider,
DiagnosticsConsumer &DiagConsumer, const Options &Opts);
 
   /// Set the root path of the workspace.
@@ -227,9 +228,9 @@ private:
 
   tooling::CompileCommand getCompileCommand(PathRef File);
 
-  GlobalCompilationDatabase &CDB;
+  const GlobalCompilationDatabase &CDB;
   DiagnosticsConsumer &DiagConsumer;
-  FileSystemProvider &FSProvider;
+  const FileSystemProvider &FSProvider;
 
   /// Used to synchronize diagnostic responses for added and removed files.
   llvm::StringMap InternalVersion;

Modified: clang-tools-extra/trunk/clangd/FSProvider.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/FSProvider.h?rev=344118&r1=344117&r2=344118&view=diff
==
--- clang-tools-extra/trunk/clangd/FSProvider.h (original)
+++ clang-tools-extra/trunk/clangd/FSProvider.h Wed Oct 10 00:46:15 2018
@@ -25,13 +25,13 @@ public:
   /// Context::current() will be the context passed to the clang entrypoint,
   /// such as addDocument(), and will also be propagated to result callbacks.
   /// Embedders may use this to isolate filesystem accesses.
-  virtual IntrusiveRefCntPtr getFileSystem() = 0;
+  virtual IntrusiveRefCntPtr getFileSystem() const = 0;
 };
 
 class RealFileSystemProvider : public FileSystemProvider {
 public:
   // FIXME: returns the single real FS instance, which is not threadsafe.
-  IntrusiveRefCntPtr getFileSystem() override {
+  IntrusiveRefCntPtr getFileSystem() const override {
 return vfs::getRealFileSystem();
   }
 };

Modified: clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp?rev=344118&r1=344117&r2=344118&view=diff
==
--- clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp Wed Oct 10 
00:46:15 2018
@@ -264,11 +264,11 @@ int b = a;
 TEST_F(ClangdVFSTest, PropagatesContexts) {
   static Key Secret;
   struct FSProvider : public FileSystemProvider {
-IntrusiveRefCntPtr getFileSystem() override {
+IntrusiveRefCntPtr getFileSystem() const override {
   Got = Context::current().getExisting(Secret);
   return buildTestFS({});
 }
-int Got;
+mutable int Got;
   } FS;
   struct DiagConsumer : public DiagnosticsConsumer {
 void onDiagnosticsReady(PathRef File,
@@ -973,7 +973,7 @@ TEST(ClangdTests, PreambleVFSStatCache)
 ListenStatsFSProvider(llvm::StringMap &CountStats)
 : CountStats(CountStats) {}
 
-IntrusiveRefCntPtr getFileSystem() override {
+IntrusiveRefCntPtr getFileSystem() const override {
   class ListenStatVFS : public vfs::

[PATCH] D53042: [X86] Remove FeatureRTM from Skylake processor list

2018-10-10 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL344117: [X86] Remove FeatureRTM from Skylake processor list 
(authored by ctopper, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D53042?vs=168936&id=168944#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D53042

Files:
  cfe/trunk/lib/Basic/Targets/X86.cpp
  cfe/trunk/test/Preprocessor/predefined-arch-macros.c

Index: cfe/trunk/test/Preprocessor/predefined-arch-macros.c
===
--- cfe/trunk/test/Preprocessor/predefined-arch-macros.c
+++ cfe/trunk/test/Preprocessor/predefined-arch-macros.c
@@ -670,7 +670,6 @@
 // CHECK_SKL_M32: #define __PRFCHW__ 1
 // CHECK_SKL_M32: #define __RDRND__ 1
 // CHECK_SKL_M32: #define __RDSEED__ 1
-// CHECK_SKL_M32: #define __RTM__ 1
 // CHECK_SKL_M32: #define __SGX__ 1
 // CHECK_SKL_M32: #define __SSE2__ 1
 // CHECK_SKL_M32: #define __SSE3__ 1
@@ -706,7 +705,6 @@
 // CHECK_SKL_M64: #define __PRFCHW__ 1
 // CHECK_SKL_M64: #define __RDRND__ 1
 // CHECK_SKL_M64: #define __RDSEED__ 1
-// CHECK_SKL_M64: #define __RTM__ 1
 // CHECK_SKL_M64: #define __SGX__ 1
 // CHECK_SKL_M64: #define __SSE2_MATH__ 1
 // CHECK_SKL_M64: #define __SSE2__ 1
@@ -747,7 +745,6 @@
 // CHECK_KNL_M32: #define __PREFETCHWT1__ 1
 // CHECK_KNL_M32: #define __PRFCHW__ 1
 // CHECK_KNL_M32: #define __RDRND__ 1
-// CHECK_KNL_M32: #define __RTM__ 1
 // CHECK_KNL_M32: #define __SSE2__ 1
 // CHECK_KNL_M32: #define __SSE3__ 1
 // CHECK_KNL_M32: #define __SSE4_1__ 1
@@ -785,7 +782,6 @@
 // CHECK_KNL_M64: #define __PREFETCHWT1__ 1
 // CHECK_KNL_M64: #define __PRFCHW__ 1
 // CHECK_KNL_M64: #define __RDRND__ 1
-// CHECK_KNL_M64: #define __RTM__ 1
 // CHECK_KNL_M64: #define __SSE2_MATH__ 1
 // CHECK_KNL_M64: #define __SSE2__ 1
 // CHECK_KNL_M64: #define __SSE3__ 1
@@ -827,7 +823,6 @@
 // CHECK_KNM_M32: #define __PREFETCHWT1__ 1
 // CHECK_KNM_M32: #define __PRFCHW__ 1
 // CHECK_KNM_M32: #define __RDRND__ 1
-// CHECK_KNM_M32: #define __RTM__ 1
 // CHECK_KNM_M32: #define __SSE2__ 1
 // CHECK_KNM_M32: #define __SSE3__ 1
 // CHECK_KNM_M32: #define __SSE4_1__ 1
@@ -863,7 +858,6 @@
 // CHECK_KNM_M64: #define __PREFETCHWT1__ 1
 // CHECK_KNM_M64: #define __PRFCHW__ 1
 // CHECK_KNM_M64: #define __RDRND__ 1
-// CHECK_KNM_M64: #define __RTM__ 1
 // CHECK_KNM_M64: #define __SSE2_MATH__ 1
 // CHECK_KNM_M64: #define __SSE2__ 1
 // CHECK_KNM_M64: #define __SSE3__ 1
@@ -907,7 +901,6 @@
 // CHECK_SKX_M32: #define __PRFCHW__ 1
 // CHECK_SKX_M32: #define __RDRND__ 1
 // CHECK_SKX_M32: #define __RDSEED__ 1
-// CHECK_SKX_M32: #define __RTM__ 1
 // CHECK_SKX_M32-NOT: #define __SGX__ 1
 // CHECK_SKX_M32: #define __SSE2__ 1
 // CHECK_SKX_M32: #define __SSE3__ 1
@@ -954,7 +947,6 @@
 // CHECK_SKX_M64: #define __PRFCHW__ 1
 // CHECK_SKX_M64: #define __RDRND__ 1
 // CHECK_SKX_M64: #define __RDSEED__ 1
-// CHECK_SKX_M64: #define __RTM__ 1
 // CHECK_SKX_M64-NOT: #define __SGX__ 1
 // CHECK_SKX_M64: #define __SSE2_MATH__ 1
 // CHECK_SKX_M64: #define __SSE2__ 1
@@ -1006,7 +998,6 @@
 // CHECK_CNL_M32: #define __PRFCHW__ 1
 // CHECK_CNL_M32: #define __RDRND__ 1
 // CHECK_CNL_M32: #define __RDSEED__ 1
-// CHECK_CNL_M32: #define __RTM__ 1
 // CHECK_CNL_M32: #define __SGX__ 1
 // CHECK_CNL_M32: #define __SHA__ 1
 // CHECK_CNL_M32: #define __SSE2__ 1
@@ -1056,7 +1047,6 @@
 // CHECK_CNL_M64: #define __PRFCHW__ 1
 // CHECK_CNL_M64: #define __RDRND__ 1
 // CHECK_CNL_M64: #define __RDSEED__ 1
-// CHECK_CNL_M64: #define __RTM__ 1
 // CHECK_CNL_M64: #define __SGX__ 1
 // CHECK_CNL_M64: #define __SHA__ 1
 // CHECK_CNL_M64: #define __SSE2__ 1
@@ -1113,7 +1103,6 @@
 // CHECK_ICL_M32: #define __RDPID__ 1
 // CHECK_ICL_M32: #define __RDRND__ 1
 // CHECK_ICL_M32: #define __RDSEED__ 1
-// CHECK_ICL_M32: #define __RTM__ 1
 // CHECK_ICL_M32: #define __SGX__ 1
 // CHECK_ICL_M32: #define __SHA__ 1
 // CHECK_ICL_M32: #define __SSE2__ 1
@@ -1172,7 +1161,6 @@
 // CHECK_ICL_M64: #define __RDPID__ 1
 // CHECK_ICL_M64: #define __RDRND__ 1
 // CHECK_ICL_M64: #define __RDSEED__ 1
-// CHECK_ICL_M64: #define __RTM__ 1
 // CHECK_ICL_M64: #define __SGX__ 1
 // CHECK_ICL_M64: #define __SHA__ 1
 // CHECK_ICL_M64: #define __SSE2__ 1
@@ -1233,7 +1221,6 @@
 // CHECK_ICX_M32: #define __RDPID__ 1
 // CHECK_ICX_M32: #define __RDRND__ 1
 // CHECK_ICX_M32: #define __RDSEED__ 1
-// CHECK_ICX_M32: #define __RTM__ 1
 // CHECK_ICX_M32: #define __SGX__ 1
 // CHECK_ICX_M32: #define __SHA__ 1
 // CHECK_ICX_M32: #define __SSE2__ 1
@@ -1293,7 +1280,6 @@
 // CHECK_ICX_M64: #define __RDPID__ 1
 // CHECK_ICX_M64: #define __RDRND__ 1
 // CHECK_ICX_M64: #define __RDSEED__ 1
-// CHECK_ICX_M64: #define __RTM__ 1
 // CHECK_ICX_M64: #define __SGX__ 1
 // CHECK_ICX_M64: #define __SHA__ 1
 // CHECK_ICX_M64: #define __SSE2__ 1
Index: cfe/trunk/lib/Basic/Targets/X86.cpp
===
--- cfe/trunk/lib/Basic/Targets/X86.cpp
+++ cfe/trunk/lib/Basic/Targ

[PATCH] D52610: [Esan] Port cache frag to FreeBSD

2018-10-10 Thread David CARLIER via Phabricator via cfe-commits
devnexen added inline comments.



Comment at: lib/CodeGen/BackendUtil.cpp:323
 Opts.ToolType = EfficiencySanitizerOptions::ESAN_CacheFrag;
-  else if (LangOpts.Sanitize.has(SanitizerKind::EfficiencyWorkingSet))
+  else if (T.getOS() == Triple::Linux &&
+LangOpts.Sanitize.has(SanitizerKind::EfficiencyWorkingSet))

krytarowski wrote:
> Is it possible to port it to FreeBSD and skip some conditions in generic code?
Not for now, working-set hangs at init time on FreeBSD and unit tests had been 
disabled in the compiler-rt part.


Repository:
  rC Clang

https://reviews.llvm.org/D52610



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


[PATCH] D52654: [OpenCL][NFC] Unify ZeroToOCL* cast types

2018-10-10 Thread Alexey Sachkov via Phabricator via cfe-commits
AlexeySachkov updated this revision to Diff 168947.
AlexeySachkov added a comment.

Applied comments from Anastasia. Updated patch with more code unified


https://reviews.llvm.org/D52654

Files:
  include/clang/AST/OperationKinds.def
  include/clang/Sema/Initialization.h
  lib/AST/Expr.cpp
  lib/AST/ExprConstant.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGExprAgg.cpp
  lib/CodeGen/CGExprComplex.cpp
  lib/CodeGen/CGExprConstant.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/Edit/RewriteObjCFoundationAPI.cpp
  lib/Sema/SemaCast.cpp
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaInit.cpp
  lib/StaticAnalyzer/Core/ExprEngineC.cpp

Index: lib/StaticAnalyzer/Core/ExprEngineC.cpp
===
--- lib/StaticAnalyzer/Core/ExprEngineC.cpp
+++ lib/StaticAnalyzer/Core/ExprEngineC.cpp
@@ -412,8 +412,7 @@
   case CK_BlockPointerToObjCPointerCast:
   case CK_AnyPointerToBlockPointerCast:
   case CK_ObjCObjectLValueCast:
-  case CK_ZeroToOCLEvent:
-  case CK_ZeroToOCLQueue:
+  case CK_ZeroToOCLOpaqueType:
   case CK_IntToOCLSampler:
   case CK_LValueBitCast: {
 state =
Index: lib/Sema/SemaInit.cpp
===
--- lib/Sema/SemaInit.cpp
+++ lib/Sema/SemaInit.cpp
@@ -3261,8 +3261,7 @@
   case SK_StdInitializerList:
   case SK_StdInitializerListConstructorCall:
   case SK_OCLSamplerInit:
-  case SK_OCLZeroEvent:
-  case SK_OCLZeroQueue:
+  case SK_OCLZeroOpaqueType:
 break;
 
   case SK_ConversionSequence:
@@ -3548,16 +3547,9 @@
   Steps.push_back(S);
 }
 
-void InitializationSequence::AddOCLZeroEventStep(QualType T) {
+void InitializationSequence::AddOCLZeroOpaqueTypeStep(QualType T) {
   Step S;
-  S.Kind = SK_OCLZeroEvent;
-  S.Type = T;
-  Steps.push_back(S);
-}
-
-void InitializationSequence::AddOCLZeroQueueStep(QualType T) {
-  Step S;
-  S.Kind = SK_OCLZeroQueue;
+  S.Kind = SK_OCLZeroOpaqueType;
   S.Type = T;
   Steps.push_back(S);
 }
@@ -5260,39 +5252,31 @@
   return true;
 }
 
-//
-// OpenCL 1.2 spec, s6.12.10
-//
-// The event argument can also be used to associate the
-// async_work_group_copy with a previous async copy allowing
-// an event to be shared by multiple async copies; otherwise
-// event should be zero.
-//
-static bool TryOCLZeroEventInitialization(Sema &S,
-  InitializationSequence &Sequence,
-  QualType DestType,
-  Expr *Initializer) {
-  if (!S.getLangOpts().OpenCL || !DestType->isEventT() ||
-  !Initializer->isIntegerConstantExpr(S.getASTContext()) ||
-  (Initializer->EvaluateKnownConstInt(S.getASTContext()) != 0))
+static bool TryOCLZeroOpaqueTypeInitialization(Sema &S,
+   InitializationSequence &Sequence,
+   QualType DestType,
+   Expr *Initializer) {
+  if (!S.getLangOpts().OpenCL)
 return false;
 
-  Sequence.AddOCLZeroEventStep(DestType);
-  return true;
-}
+  //
+  // OpenCL 1.2 spec, s6.12.10
+  //
+  // The event argument can also be used to associate the
+  // async_work_group_copy with a previous async copy allowing
+  // an event to be shared by multiple async copies; otherwise
+  // event should be zero.
+  //
+  if (DestType->isEventT() || DestType->isQueueT()) {
+if (!Initializer->isIntegerConstantExpr(S.getASTContext()) ||
+(Initializer->EvaluateKnownConstInt(S.getASTContext()) != 0))
+  return false;
 
-static bool TryOCLZeroQueueInitialization(Sema &S,
-  InitializationSequence &Sequence,
-  QualType DestType,
-  Expr *Initializer) {
-  if (!S.getLangOpts().OpenCL || S.getLangOpts().OpenCLVersion < 200 ||
-  !DestType->isQueueT() ||
-  !Initializer->isIntegerConstantExpr(S.getASTContext()) ||
-  (Initializer->EvaluateKnownConstInt(S.getASTContext()) != 0))
-return false;
+Sequence.AddOCLZeroOpaqueTypeStep(DestType);
+return true;
+  }
 
-  Sequence.AddOCLZeroQueueStep(DestType);
-  return true;
+  return false;
 }
 
 InitializationSequence::InitializationSequence(Sema &S,
@@ -5566,12 +5550,9 @@
 if (TryOCLSamplerInitialization(S, *this, DestType, Initializer))
   return;
 
-if (TryOCLZeroEventInitialization(S, *this, DestType, Initializer))
+if (TryOCLZeroOpaqueTypeInitialization(S, *this, DestType, Initializer))
   return;
 
-if (TryOCLZeroQueueInitialization(S, *this, DestType, Initializer))
-   return;
-
 // Handle initialization in C
 AddCAssignmentStep(DestType);
 MaybeProduceObjCObject(S, *this, Entity);
@@ -7393,8 +7374,7 @@
   case SK_ProduceObjCObject:
   case SK_StdInitializerList:
   case SK_OCLSamplerInit:
-  case SK_OCLZeroEvent:
-  case SK_OCLZeroQueue: {
+  case S

[PATCH] D52654: [OpenCL][NFC] Unify ZeroToOCL* cast types

2018-10-10 Thread Alexey Sachkov via Phabricator via cfe-commits
AlexeySachkov marked an inline comment as done.
AlexeySachkov added inline comments.



Comment at: lib/Sema/SemaInit.cpp:5291
 
-  Sequence.AddOCLZeroQueueStep(DestType);
-  return true;
+Sequence.AddOCLZeroQueueStep(DestType);
+return true;

Anastasia wrote:
> I guess this one can't be generalized?
Actually, it is generalized now


https://reviews.llvm.org/D52654



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


[PATCH] D52610: [Esan] Port cache frag to FreeBSD

2018-10-10 Thread Kamil Rytarowski via Phabricator via cfe-commits
krytarowski added inline comments.



Comment at: lib/CodeGen/BackendUtil.cpp:323
 Opts.ToolType = EfficiencySanitizerOptions::ESAN_CacheFrag;
-  else if (LangOpts.Sanitize.has(SanitizerKind::EfficiencyWorkingSet))
+  else if (T.getOS() == Triple::Linux &&
+LangOpts.Sanitize.has(SanitizerKind::EfficiencyWorkingSet))

devnexen wrote:
> krytarowski wrote:
> > Is it possible to port it to FreeBSD and skip some conditions in generic 
> > code?
> Not for now, working-set hangs at init time on FreeBSD and unit tests had 
> been disabled in the compiler-rt part.
So can the support be extended in compiler-rt? I would find it more useful to 
handle featured sanitizer in the first place.


Repository:
  rC Clang

https://reviews.llvm.org/D52610



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


[PATCH] D52610: [Esan] Port cache frag to FreeBSD

2018-10-10 Thread David CARLIER via Phabricator via cfe-commits
devnexen added inline comments.



Comment at: lib/CodeGen/BackendUtil.cpp:323
 Opts.ToolType = EfficiencySanitizerOptions::ESAN_CacheFrag;
-  else if (LangOpts.Sanitize.has(SanitizerKind::EfficiencyWorkingSet))
+  else if (T.getOS() == Triple::Linux &&
+LangOpts.Sanitize.has(SanitizerKind::EfficiencyWorkingSet))

krytarowski wrote:
> devnexen wrote:
> > krytarowski wrote:
> > > Is it possible to port it to FreeBSD and skip some conditions in generic 
> > > code?
> > Not for now, working-set hangs at init time on FreeBSD and unit tests had 
> > been disabled in the compiler-rt part.
> So can the support be extended in compiler-rt? I would find it more useful to 
> handle featured sanitizer in the first place.
Not sure of the feasibility yet, let s say for now it s just a starting point.


Repository:
  rC Clang

https://reviews.llvm.org/D52610



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


[PATCH] D52296: [Clang] - Add -gsingle-file-split-dwarf option.

2018-10-10 Thread George Rimar via Phabricator via cfe-commits
grimar added a comment.

In https://reviews.llvm.org/D52296#1258677, @alexshap wrote:

> @grimar, this is an interesting observation which I've had on my mind for 
> quite some time as well; a couple of things which I have not double-checked 
> yet - just in case - do both gold and lld completely ignore dwo-related 
> sections ? (did you check that ?),


LLVM emits them with the SHF_EXCLUDE flag since the 
https://reviews.llvm.org/rL342800 "[lib/MC] - Set SHF_EXCLUDE flag for .dwo 
sections.". So if linker supports SHF_EXCLUDE flag properly, it will ignore it 
properly.
That is true for bfd/gold/LLD atm.

LLD does not ignore ".dwo" sections by name and I do not expect other linkers 
do (and that is fine, we do not want to ignore sections by name generally), so 
having this flag is an important and clean thing for things to work.

> and another small question - just wondering if the debuggers (GDB and LLDB) 
> are okay with it / or smth needs to be adjusted or fixed on their side. I 
> guess everything should be fine, but asking just in case.

The patch for LLDB is ready to be landed: https://reviews.llvm.org/D52403. It 
waits for this one, since its test case mentions/uses -gsingle-file-split-dwarf 
option.
I am thinking about rewriting the comment and landing it independently.

I did not check the GDB yet.


https://reviews.llvm.org/D52296



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


r344125 - [MinGW] Fix passing a sanitizer lib name as dependent lib

2018-10-10 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed Oct 10 02:01:00 2018
New Revision: 344125

URL: http://llvm.org/viewvc/llvm-project?rev=344125&view=rev
Log:
[MinGW] Fix passing a sanitizer lib name as dependent lib

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

Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/Driver/fsanitize.c

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=344125&r1=344124&r2=344125&view=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Wed Oct 10 02:01:00 2018
@@ -2337,7 +2337,7 @@ static std::string qualifyWindowsLibrary
   bool Quote = (Lib.find(" ") != StringRef::npos);
   std::string ArgStr = Quote ? "\"" : "";
   ArgStr += Lib;
-  if (!Lib.endswith_lower(".lib"))
+  if (!Lib.endswith_lower(".lib") && !Lib.endswith_lower(".a"))
 ArgStr += ".lib";
   ArgStr += Quote ? "\"" : "";
   return ArgStr;

Modified: cfe/trunk/test/Driver/fsanitize.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fsanitize.c?rev=344125&r1=344124&r2=344125&view=diff
==
--- cfe/trunk/test/Driver/fsanitize.c (original)
+++ cfe/trunk/test/Driver/fsanitize.c Wed Oct 10 02:01:00 2018
@@ -17,9 +17,11 @@
 // RUN: %clang -target i386-pc-win32 -fsanitize=undefined %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN 
--check-prefix=CHECK-UNDEFINED-WIN32
 // RUN: %clang -target i386-pc-win32 -fsanitize=undefined -x c++ %s -### 2>&1 
| FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN 
--check-prefix=CHECK-UNDEFINED-WIN32 --check-prefix=CHECK-UNDEFINED-WIN-CXX
 // RUN: %clang -target x86_64-pc-win32 -fsanitize=undefined %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN 
--check-prefix=CHECK-UNDEFINED-WIN64
+// RUN: %clang -target x86_64-w64-mingw32 -fsanitize=undefined %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN 
--check-prefix=CHECK-UNDEFINED-WIN64-MINGW
 // RUN: %clang -target x86_64-pc-win32 -fsanitize=undefined -x c++ %s -### 
2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN 
--check-prefix=CHECK-UNDEFINED-WIN64 --check-prefix=CHECK-UNDEFINED-WIN-CXX
 // CHECK-UNDEFINED-WIN32: "--dependent-lib={{[^"]*}}ubsan_standalone-i386.lib"
 // CHECK-UNDEFINED-WIN64: 
"--dependent-lib={{[^"]*}}ubsan_standalone-x86_64.lib"
+// CHECK-UNDEFINED-WIN64-MINGW: 
"--dependent-lib={{[^"]*}}libclang_rt.ubsan_standalone-x86_64.a"
 // CHECK-UNDEFINED-WIN-CXX: 
"--dependent-lib={{[^"]*}}ubsan_standalone_cxx{{[^"]*}}.lib"
 // CHECK-UNDEFINED-WIN-SAME: 
"-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|pointer-overflow|float-cast-overflow|array-bounds|enum|bool|builtin|returns-nonnull-attribute|nonnull-attribute),?){18}"}}
 


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


[PATCH] D52990: [MinGW] Fix passing a sanitizer lib name as dependent lib

2018-10-10 Thread Martin Storsjö via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC344125: [MinGW] Fix passing a sanitizer lib name as 
dependent lib (authored by mstorsjo, committed by ).

Repository:
  rC Clang

https://reviews.llvm.org/D52990

Files:
  lib/CodeGen/TargetInfo.cpp
  test/Driver/fsanitize.c


Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -2337,7 +2337,7 @@
   bool Quote = (Lib.find(" ") != StringRef::npos);
   std::string ArgStr = Quote ? "\"" : "";
   ArgStr += Lib;
-  if (!Lib.endswith_lower(".lib"))
+  if (!Lib.endswith_lower(".lib") && !Lib.endswith_lower(".a"))
 ArgStr += ".lib";
   ArgStr += Quote ? "\"" : "";
   return ArgStr;
Index: test/Driver/fsanitize.c
===
--- test/Driver/fsanitize.c
+++ test/Driver/fsanitize.c
@@ -17,9 +17,11 @@
 // RUN: %clang -target i386-pc-win32 -fsanitize=undefined %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN 
--check-prefix=CHECK-UNDEFINED-WIN32
 // RUN: %clang -target i386-pc-win32 -fsanitize=undefined -x c++ %s -### 2>&1 
| FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN 
--check-prefix=CHECK-UNDEFINED-WIN32 --check-prefix=CHECK-UNDEFINED-WIN-CXX
 // RUN: %clang -target x86_64-pc-win32 -fsanitize=undefined %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN 
--check-prefix=CHECK-UNDEFINED-WIN64
+// RUN: %clang -target x86_64-w64-mingw32 -fsanitize=undefined %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN 
--check-prefix=CHECK-UNDEFINED-WIN64-MINGW
 // RUN: %clang -target x86_64-pc-win32 -fsanitize=undefined -x c++ %s -### 
2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN 
--check-prefix=CHECK-UNDEFINED-WIN64 --check-prefix=CHECK-UNDEFINED-WIN-CXX
 // CHECK-UNDEFINED-WIN32: "--dependent-lib={{[^"]*}}ubsan_standalone-i386.lib"
 // CHECK-UNDEFINED-WIN64: 
"--dependent-lib={{[^"]*}}ubsan_standalone-x86_64.lib"
+// CHECK-UNDEFINED-WIN64-MINGW: 
"--dependent-lib={{[^"]*}}libclang_rt.ubsan_standalone-x86_64.a"
 // CHECK-UNDEFINED-WIN-CXX: 
"--dependent-lib={{[^"]*}}ubsan_standalone_cxx{{[^"]*}}.lib"
 // CHECK-UNDEFINED-WIN-SAME: 
"-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|pointer-overflow|float-cast-overflow|array-bounds|enum|bool|builtin|returns-nonnull-attribute|nonnull-attribute),?){18}"}}
 


Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -2337,7 +2337,7 @@
   bool Quote = (Lib.find(" ") != StringRef::npos);
   std::string ArgStr = Quote ? "\"" : "";
   ArgStr += Lib;
-  if (!Lib.endswith_lower(".lib"))
+  if (!Lib.endswith_lower(".lib") && !Lib.endswith_lower(".a"))
 ArgStr += ".lib";
   ArgStr += Quote ? "\"" : "";
   return ArgStr;
Index: test/Driver/fsanitize.c
===
--- test/Driver/fsanitize.c
+++ test/Driver/fsanitize.c
@@ -17,9 +17,11 @@
 // RUN: %clang -target i386-pc-win32 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN32
 // RUN: %clang -target i386-pc-win32 -fsanitize=undefined -x c++ %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN32 --check-prefix=CHECK-UNDEFINED-WIN-CXX
 // RUN: %clang -target x86_64-pc-win32 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN64
+// RUN: %clang -target x86_64-w64-mingw32 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN64-MINGW
 // RUN: %clang -target x86_64-pc-win32 -fsanitize=undefined -x c++ %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN64 --check-prefix=CHECK-UNDEFINED-WIN-CXX
 // CHECK-UNDEFINED-WIN32: "--dependent-lib={{[^"]*}}ubsan_standalone-i386.lib"
 // CHECK-UNDEFINED-WIN64: "--dependent-lib={{[^"]*}}ubsan_standalone-x86_64.lib"
+// CHECK-UNDEFINED-WIN64-MINGW: "--dependent-lib={{[^"]*}}libclang_rt.ubsan_standalone-x86_64.a"
 // CHECK-UNDEFINED-WIN-CXX: "--dependent-lib={{[^"]*}}ubsan_standalone_cxx{{[^"]*}}.lib"
 // CHECK-UNDEFINED-WIN-SAME: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|pointer-overflow|float-cast-overflow|array-bounds|enum|bool|builtin|returns-nonnull-attribute|nonnull-attribute),?){18}"}}
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53013: [MinGW] Support MinGW style library names for default library pragmas

2018-10-10 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo abandoned this revision.
mstorsjo added a comment.

Not needed as we placed this logic in lld, in https://reviews.llvm.org/D53017, 
for now.


Repository:
  rC Clang

https://reviews.llvm.org/D53013



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


[PATCH] D53066: [RFC] [MinGW] Print paths with forward slashes in commands printed with -v

2018-10-10 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo created this revision.
mstorsjo added reviewers: rnk, smeenai, compnerd, phosek, rupprecht.

libtool inspects the output of `$CC -v` to detect what object files and 
libraries are linked in by default. When clang is built as a native windows 
executable, all paths are formatted with backslashes, and the backslashes cause 
each argument to be enclosed in quotes. The backslashes and quotes break 
further processing within libtool (which is implemented in shell script, 
running in e.g. msys) pretty badly.

Between unix style pathes (that only work in tools that are linked to the msys 
runtime, essentially the same as cygwin) and proper windows style paths (with 
backslashes, that don't work within shell scripts and msys environments), the 
best compromise is to use windows style paths (starting with e.g. `c:`) but 
with forward slashes, which both msys based tools, shell scripts and native 
windows executables can cope with. This incidentally turns out to be the form 
of paths that GCC prints out when run with `-v` on windows as well.

This patch applies a rewrite from backslashes to forwad slashes on all command 
line arguments printed when compiling with `-v`, if the target triple is 
mingw/cygwin.

The patch isn't super pretty but hopefully should be acceptable unless there 
are better suggestions on how to handle it. Any suggestions on how would one go 
about to add a test for this?


Repository:
  rC Clang

https://reviews.llvm.org/D53066

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

Index: lib/Driver/Job.cpp
===
--- lib/Driver/Job.cpp
+++ lib/Driver/Job.cpp
@@ -98,7 +98,13 @@
   return false;
 }
 
-void Command::printArg(raw_ostream &OS, StringRef Arg, bool Quote) {
+void Command::printArg(raw_ostream &OS, StringRef Arg, bool Quote,
+   llvm::sys::path::Style PathStyle) {
+  std::string Buf;
+  if (PathStyle == llvm::sys::path::Style::posix) {
+Buf = llvm::sys::path::convert_to_slash(Arg);
+Arg = Buf;
+  }
   const bool Escape = Arg.find_first_of("\"\\$") != StringRef::npos;
 
   if (!Quote && !Escape) {
@@ -212,10 +218,11 @@
 }
 
 void Command::Print(raw_ostream &OS, const char *Terminator, bool Quote,
-CrashReportInfo *CrashInfo) const {
+CrashReportInfo *CrashInfo,
+llvm::sys::path::Style PathStyle) const {
   // Always quote the exe.
   OS << ' ';
-  printArg(OS, Executable, /*Quote=*/true);
+  printArg(OS, Executable, /*Quote=*/true, PathStyle);
 
   ArrayRef Args = Arguments;
   SmallVector ArgsRespFile;
@@ -263,14 +270,14 @@
 }
 
 OS << ' ';
-printArg(OS, Arg, Quote);
+printArg(OS, Arg, Quote, PathStyle);
   }
 
   if (CrashInfo && HaveCrashVFS) {
 OS << ' ';
-printArg(OS, "-ivfsoverlay", Quote);
+printArg(OS, "-ivfsoverlay", Quote, PathStyle);
 OS << ' ';
-printArg(OS, CrashInfo->VFSPath.str(), Quote);
+printArg(OS, CrashInfo->VFSPath.str(), Quote, PathStyle);
 
 // The leftover modules from the crash are stored in
 //  .cache/vfs/modules
@@ -285,7 +292,7 @@
 ModCachePath.append(RelModCacheDir.c_str());
 
 OS << ' ';
-printArg(OS, ModCachePath, Quote);
+printArg(OS, ModCachePath, Quote, PathStyle);
   }
 
   if (ResponseFile != nullptr) {
@@ -372,11 +379,12 @@
 : Command(Source_, Creator_, Executable_, Arguments_, Inputs),
   Fallback(std::move(Fallback_)) {}
 
-void FallbackCommand::Print(raw_ostream &OS, const char *Terminator,
-bool Quote, CrashReportInfo *CrashInfo) const {
-  Command::Print(OS, "", Quote, CrashInfo);
+void FallbackCommand::Print(raw_ostream &OS, const char *Terminator, bool Quote,
+CrashReportInfo *CrashInfo,
+llvm::sys::path::Style PathStyle) const {
+  Command::Print(OS, "", Quote, CrashInfo, PathStyle);
   OS << " ||";
-  Fallback->Print(OS, Terminator, Quote, CrashInfo);
+  Fallback->Print(OS, Terminator, Quote, CrashInfo, PathStyle);
 }
 
 static bool ShouldFallback(int ExitCode) {
@@ -413,7 +421,8 @@
 : Command(Source_, Creator_, Executable_, Arguments_, Inputs) {}
 
 void ForceSuccessCommand::Print(raw_ostream &OS, const char *Terminator,
-bool Quote, CrashReportInfo *CrashInfo) const {
+bool Quote, CrashReportInfo *CrashInfo,
+llvm::sys::path::Style PathStyle) const {
   Command::Print(OS, "", Quote, CrashInfo);
   OS << " || (exit 0)" << Terminator;
 }
Index: lib/Driver/Compilation.cpp
===
--- lib/Driver/Compilation.cpp
+++ lib/Driver/Compilation.cpp
@@ -174,7 +174,12 @@
 if (getDriver().CCPrintOptions)
   *OS << "[Logging clang options]";
 
-C.Print(*OS, "\n", /*Quote=*/getDriver().CCPrintOptions);
+llvm::Triple TT(llvm::Triple::normalize(

[PATCH] D53069: [analyzer][www] Update avaible_checks.html

2018-10-10 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus created this revision.
Szelethus added reviewers: NoQ, george.karpenkov, MTC, xazax.hun.
Herald added subscribers: cfe-commits, mikhail.ramalho, a.sidorin, 
JDevlieghere, rnkovacs, szepet, whisperity.

Title says it all. I never ever used ObjC, so I couldn't really add examples on 
many occasions.

Five checkers are still in existence that aren't on the website just yet:

- apiModeling.StdCLibraryFunctions
- apiModeling.TrustNonnull
- apiModeling.google.GTest
- core.DynamicTypePropagation
- core.NonnilStringConstants

I suspect these are implicit checks, and should be placed in 
implicit_checks.html, but I'll make sure that that page isn't as well hidden as 
it is now.


Repository:
  rC Clang

https://reviews.llvm.org/D53069

Files:
  www/analyzer/available_checks.html

Index: www/analyzer/available_checks.html
===
--- www/analyzer/available_checks.html
+++ www/analyzer/available_checks.html
@@ -38,11 +38,13 @@
 Core Checkers model core language features and perform general-purpose checks such as division by zero, null pointer dereference, usage of uninitialized values, etc.
 C++ Checkers perform C++-specific checks
 Dead Code Checkers check for unused code
+LLVM Checkers for LLVM developers
 Nullability Checkers 
 Optin Checkers 
 OS X Checkers perform Objective-C-specific checks and check the use of Apple's SDKs (OS X and iOS)
 Security Checkers check for insecure API usage and perform checks based on the CERT Secure Coding Standards
 Unix Checkers check the use of Unix and POSIX APIs
+Variable Argument Checkers
 
 
 
@@ -369,6 +371,28 @@
 Name, DescriptionExample
 
 
+
+
+
+cplusplus.InnerPointer
+(C++)
+Check for inner pointers of C++ containers used after re/deallocation.
+
+
+
+void consume (const char *) {}
+
+void deref_after_scope_char() {
+  const char *c;
+  {
+std::string s;
+c = s.c_str();
+  }
+  consume(c); // warn: Use of memory after it is freed
+}
+
+
+
 
 cplusplus.NewDelete
 (C++)
@@ -435,6 +459,27 @@
 } // warn
 
 
+
+
+cplusplus.InnerPointer
+(C++)
+Check for inner pointers of C++ containers used after re/deallocation.
+
+
+
+void consume (const char *) {}
+
+void deref_after_scope_char() {
+  const char *c;
+  {
+std::string s;
+c = s.c_str();
+  }
+  consume(c); // warn: Use of memory after it is freed
+}
+
+
+
 
 
 
@@ -458,6 +503,25 @@
 
 
 
+
+LLVM Checkers
+
+
+Name, DescriptionExample
+
+
+
+llvm.Conventions
+(C)
+Check code for LLVM codebase conventions.
+
+
+
+
+
+
+
+
 
 Nullability Checkers
 
@@ -535,6 +599,21 @@
 }
 
 
+
+
+nullability.NullableReturnedFromNonnull
+(ObjC)
+Warns when a nullable pointer is returned from a function that has _Nonnull return type.
+
+
+typedef struct Dummy { int val; } Dummy;
+
+Dummy *_Nonnull test(Dummy *_Nullable a) {
+  Dummy *p = a;
+  return p; // warn
+}
+
+
 
 
 
@@ -610,6 +689,62 @@
 [alarmStateLabel setText:alarmText];
 
 
+
+
+optin.performance.GCDAntipattern
+(ObjC)
+Check for performance anti-patterns when using Grand Central Dispatch.
+
+
+
+void use_semaphor_antipattern() {
+  dispatch_semaphore_t sema = dispatch_semaphore_create(0);
+
+  func(^{
+  dispatch_semaphore_signal(sema);
+  });
+  dispatch_semaphore_wait(sema, 100); // warn: waiting on a callback using a
+  //   semaphore
+}
+
+
+
+
+optin.performance.Padding
+(C)
+Check for excessively padded structs.
+
+
+
+class PaddedA { // warn: excessive padding
+  char c1;
+  int i;
+  char c2;
+};
+
+
+
+
+optin.portability.UnixAPI
+(C)
+Finds implementation-defined behavior in UNIX/Posix functions.
+
+calloc
+malloc
+realloc
+reallocf
+alloca, __builtin_alloca
+__builtin_alloca_with_align
+valloc
+
+
+
+void *f(int n) {
+  return malloc(n * 0 * sizeof(int)); // warn: Call to 'malloc' has an
+  //   allocation size of 0 bytes
+}
+
+
 
 
 
@@ -649,6 +784,16 @@
 
 
 
+
+osx.ObjCProperty
+(ObjC)
+Check for proper uses of Objective-C properties
+
+
+
+
+
+
 
 osx.SecKeychainAPI
 (C)
@@ -732,7 +877,8 @@
 
 osx.cocoa.AtSync
 (ObjC)
-Check for nil pointers used as mutexes for @synchronized.
+Check for nil pointers used as mutexes for @synchronized.
+
 
 
 void test(id x) {
@@ -748,6 +894,17 @@
 
 
 
+
+osx.cocoa.AutoreleaseWrite
+(ObjC)
+Warn about potentially crashing writes to autoreleasing objects from different
+autoreleasing pools in Objective-C.
+
+
+
+
+
+
 
 osx.cocoa.ClassRelease
 (ObjC)
@@ -848,6 +1005,17 @@
 
 
 
+
+
+osx.cocoa.Loops
+(ObjC)
+Improved modeling of loops using Cocoa collection types.
+
+
+
+
+
+
 
 alpha.osx.cocoa.MissingSuperCall
 (ObjC)
@@ -931,6 +1099,17 @@
 
 
 
+
+osx.cocoa.NonNilReturnValue
+(ObjC)
+Model the APIs that are guaranteed to return a non-nil value.
+
+
+
+
+
+
+
 
 osx.cocoa.ObjCGenerics
 (ObjC)
@@ -964,6 +1143,17 @@
 
 
 
+
+osx.cocoa.RunLoopAutoreleaseLeak
+(ObjC)
+Check for leaked memory in autorelease pools that will never be drained.
+
+
+
+
+
+
+
 
 osx.cocoa.Self

[PATCH] D53069: [analyzer][www] Update avaible_checks.html

2018-10-10 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus updated this revision to Diff 168966.
Szelethus edited the summary of this revision.
Szelethus added a reviewer: rnkovacs.

https://reviews.llvm.org/D53069

Files:
  www/analyzer/available_checks.html

Index: www/analyzer/available_checks.html
===
--- www/analyzer/available_checks.html
+++ www/analyzer/available_checks.html
@@ -38,11 +38,13 @@
 Core Checkers model core language features and perform general-purpose checks such as division by zero, null pointer dereference, usage of uninitialized values, etc.
 C++ Checkers perform C++-specific checks
 Dead Code Checkers check for unused code
+LLVM Checkers for LLVM developers
 Nullability Checkers 
 Optin Checkers 
 OS X Checkers perform Objective-C-specific checks and check the use of Apple's SDKs (OS X and iOS)
 Security Checkers check for insecure API usage and perform checks based on the CERT Secure Coding Standards
 Unix Checkers check the use of Unix and POSIX APIs
+Variable Argument Checkers
 
 
 
@@ -369,6 +371,28 @@
 Name, DescriptionExample
 
 
+
+
+
+cplusplus.InnerPointer
+(C++)
+Check for inner pointers of C++ containers used after re/deallocation.
+
+
+
+void consume (const char *) {}
+
+void deref_after_scope_char() {
+  const char *c;
+  {
+std::string s;
+c = s.c_str();
+  }
+  consume(c); // warn: Use of memory after it is freed
+}
+
+
+
 
 cplusplus.NewDelete
 (C++)
@@ -435,6 +459,7 @@
 } // warn
 
 
+
 
 
 
@@ -458,6 +483,25 @@
 
 
 
+
+LLVM Checkers
+
+
+Name, DescriptionExample
+
+
+
+llvm.Conventions
+(C)
+Check code for LLVM codebase conventions.
+
+
+
+
+
+
+
+
 
 Nullability Checkers
 
@@ -535,6 +579,21 @@
 }
 
 
+
+
+nullability.NullableReturnedFromNonnull
+(ObjC)
+Warns when a nullable pointer is returned from a function that has _Nonnull return type.
+
+
+typedef struct Dummy { int val; } Dummy;
+
+Dummy *_Nonnull test(Dummy *_Nullable a) {
+  Dummy *p = a;
+  return p; // warn
+}
+
+
 
 
 
@@ -610,6 +669,62 @@
 [alarmStateLabel setText:alarmText];
 
 
+
+
+optin.performance.GCDAntipattern
+(ObjC)
+Check for performance anti-patterns when using Grand Central Dispatch.
+
+
+
+void use_semaphor_antipattern() {
+  dispatch_semaphore_t sema = dispatch_semaphore_create(0);
+
+  func(^{
+  dispatch_semaphore_signal(sema);
+  });
+  dispatch_semaphore_wait(sema, 100); // warn: waiting on a callback using a
+  //   semaphore
+}
+
+
+
+
+optin.performance.Padding
+(C)
+Check for excessively padded structs.
+
+
+
+class PaddedA { // warn: excessive padding
+  char c1;
+  int i;
+  char c2;
+};
+
+
+
+
+optin.portability.UnixAPI
+(C)
+Finds implementation-defined behavior in UNIX/Posix functions.
+
+calloc
+malloc
+realloc
+reallocf
+alloca, __builtin_alloca
+__builtin_alloca_with_align
+valloc
+
+
+
+void *f(int n) {
+  return malloc(n * 0 * sizeof(int)); // warn: Call to 'malloc' has an
+  //   allocation size of 0 bytes
+}
+
+
 
 
 
@@ -649,6 +764,16 @@
 
 
 
+
+osx.ObjCProperty
+(ObjC)
+Check for proper uses of Objective-C properties
+
+
+
+
+
+
 
 osx.SecKeychainAPI
 (C)
@@ -732,7 +857,8 @@
 
 osx.cocoa.AtSync
 (ObjC)
-Check for nil pointers used as mutexes for @synchronized.
+Check for nil pointers used as mutexes for @synchronized.
+
 
 
 void test(id x) {
@@ -748,6 +874,17 @@
 
 
 
+
+osx.cocoa.AutoreleaseWrite
+(ObjC)
+Warn about potentially crashing writes to autoreleasing objects from different
+autoreleasing pools in Objective-C.
+
+
+
+
+
+
 
 osx.cocoa.ClassRelease
 (ObjC)
@@ -848,6 +985,17 @@
 
 
 
+
+
+osx.cocoa.Loops
+(ObjC)
+Improved modeling of loops using Cocoa collection types.
+
+
+
+
+
+
 
 alpha.osx.cocoa.MissingSuperCall
 (ObjC)
@@ -931,6 +1079,17 @@
 
 
 
+
+osx.cocoa.NonNilReturnValue
+(ObjC)
+Model the APIs that are guaranteed to return a non-nil value.
+
+
+
+
+
+
+
 
 osx.cocoa.ObjCGenerics
 (ObjC)
@@ -964,6 +1123,17 @@
 
 
 
+
+osx.cocoa.RunLoopAutoreleaseLeak
+(ObjC)
+Check for leaked memory in autorelease pools that will never be drained.
+
+
+
+
+
+
+
 
 osx.cocoa.SelfInit
 (ObjC)
@@ -1571,6 +1741,74 @@
 
 
 
+
+
+Variable Argument Checkers
+
+
+Name, DescriptionExample
+
+
+
+valist.CopyToSelf
+(C)
+Calls to the va_copy macro should not copy onto itself.
+
+
+#include 
+
+void test(int x, ...) {
+  va_list args;
+  va_start(args, x);
+  va_copy(args, args); // warn
+  va_end(args);
+}
+
+
+
+valist.Uninitialized
+(C)
+Calls to the va_arg, va_copy, or
+va_end macro must happen after calling va_start and
+before calling va_end.
+
+
+#include 
+
+void test(int x, ...) {
+  va_list args;
+  int y = va_arg(args, int); // warn
+}
+
+
+#include 
+
+void test(int x, ...) {
+  va_list args;
+  va_start(args, x);
+  va_end(args);
+  int z = va_arg(args, int); // warn
+}
+
+
+
+valist.Unterminated
+(C)
+Every va_start must be matched by a va_end. A va_list
+can only be ended once.
+
+
+#include 
+
+void test(int x,

[PATCH] D53069: [analyzer][www] Update avaible_checks.html

2018-10-10 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added inline comments.



Comment at: www/analyzer/available_checks.html:376-393
+
+cplusplus.InnerPointer
+(C++)
+Check for inner pointers of C++ containers used after re/deallocation.
+
+
+

@rnkovacs Is this a good description of your checker?


https://reviews.llvm.org/D53069



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


[PATCH] D53069: [analyzer][www] Update avaible_checks.html

2018-10-10 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment.

I am not sure what to do about implcit checks. Those are probably should never 
be turned on or off by the user, but they should be on or off by default based 
on the set of checks the user enabled and the platform she is using. Thus, I am 
perfectly ok with the implicit_checks.html only being accessible from the 
checker development manual. Maybe we should extend the checker list with a 
notice that the user should never disable the core checks.


https://reviews.llvm.org/D53069



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


[PATCH] D27621: [clang-tidy] check to find declarations declaring more than one name

2018-10-10 Thread Firat Kasmis via Phabricator via cfe-commits
firolino added a comment.

In https://reviews.llvm.org/D27621#1248849, @JonasToth wrote:

> Hi @firolino,
>  I implemented a less general version of you check 
> https://reviews.llvm.org/D51949 as I wanted to achieve a slightly different 
> goal (and this revision seems to be abonded). My aim is to have general 
> transformation capabilities to separate declarations (variables for now, as 
> these refactorings are most important) that can isolate single variables, or 
> split whole declarations.
>
> I used parts of your test-suite as it is very complete. If you plan to 
> continue working on this check, I'd propose to include it into the other 
> (right now almost) finished version.
>
> My Best, Jonas


Thanks for the information. Looking forward to your final patch!


https://reviews.llvm.org/D27621



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


[PATCH] D52806: [python] Support overriding library path via environment

2018-10-10 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a reviewer: steveire.
mgorny added a comment.

Gentle ping.


https://reviews.llvm.org/D52806



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


[PATCH] D53070: [CodeComplete] Fix crash when completing params function declarations.

2018-10-10 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision.
sammccall added a reviewer: kadircet.
Herald added a subscriber: cfe-commits.

In a decl like `int AA(BB cc)` where BB isn't defined, we end up trying to
parse `BB cc` as an expression (vexing parse) and end up triggering the
parser's "recovery-in-function" completion with no actual function
scope.

This patch avoids the assumption that such a scope exists in this context.


Repository:
  rC Clang

https://reviews.llvm.org/D53070

Files:
  lib/Sema/SemaCodeComplete.cpp
  test/CodeCompletion/crash-func-decl.cpp


Index: test/CodeCompletion/crash-func-decl.cpp
===
--- /dev/null
+++ test/CodeCompletion/crash-func-decl.cpp
@@ -0,0 +1,5 @@
+// Important that BB is unknown.
+// This triggers completion in PCC_RecoveryInFunction context, with no 
function.
+int AA(BB cc);
+// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:3:12 %s | 
FileCheck %s
+// CHECK: COMPLETION: char
Index: lib/Sema/SemaCodeComplete.cpp
===
--- lib/Sema/SemaCodeComplete.cpp
+++ lib/Sema/SemaCodeComplete.cpp
@@ -1881,7 +1881,8 @@
 }
 
 // Switch-specific statements.
-if (!SemaRef.getCurFunction()->SwitchStack.empty()) {
+if (SemaRef.getCurFunction() &&
+!SemaRef.getCurFunction()->SwitchStack.empty()) {
   // case expression:
   Builder.AddTypedTextChunk("case");
   Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);


Index: test/CodeCompletion/crash-func-decl.cpp
===
--- /dev/null
+++ test/CodeCompletion/crash-func-decl.cpp
@@ -0,0 +1,5 @@
+// Important that BB is unknown.
+// This triggers completion in PCC_RecoveryInFunction context, with no function.
+int AA(BB cc);
+// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:3:12 %s | FileCheck %s
+// CHECK: COMPLETION: char
Index: lib/Sema/SemaCodeComplete.cpp
===
--- lib/Sema/SemaCodeComplete.cpp
+++ lib/Sema/SemaCodeComplete.cpp
@@ -1881,7 +1881,8 @@
 }
 
 // Switch-specific statements.
-if (!SemaRef.getCurFunction()->SwitchStack.empty()) {
+if (SemaRef.getCurFunction() &&
+!SemaRef.getCurFunction()->SwitchStack.empty()) {
   // case expression:
   Builder.AddTypedTextChunk("case");
   Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42242: Make libc++abi work with gcc's ARM unwind library

2018-10-10 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

@bebuch, I agree with @mclow.lists here that the new errors are completely 
unrelated to the problem solved by this patch, and the fix to it belongs in a 
separate changeset. Can we get the original problem fixed first then?


https://reviews.llvm.org/D42242



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


[PATCH] D42242: Make libc++abi work with gcc's ARM unwind library

2018-10-10 Thread Benjamin Buch via Phabricator via cfe-commits
bebuch accepted this revision.
bebuch added a comment.
This revision is now accepted and ready to land.

Okay, sorry for the blockage!


https://reviews.llvm.org/D42242



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


[PATCH] D51949: [clang-tidy] new check 'readability-isolate-declaration'

2018-10-10 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added a comment.

In https://reviews.llvm.org/D51949#1257430, @JonasToth wrote:

> @kbobyrev is it ok for you if I stick with the `Optional<>` style in the 
> check?


Yes, I think it's fine. Thank you very much for working on the patch, I am 
indeed very excited about this check.

Unfortunately, I won't be able to review the code in the upcoming few weeks as 
I caught a cold and I'm trying to get better before the LLVM Meeting, so if 
there is anyone else interested in reviewing proposed changes please feel free 
to jump in.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51949



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


[PATCH] D52967: Extend shelf-life by 70 years

2018-10-10 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon resigned from this revision.
RKSimon added reviewers: rsmith, bruno, rtrieu.
RKSimon added a comment.

Sorry I'm not the right person to review this - adding some other potentials


Repository:
  rC Clang

https://reviews.llvm.org/D52967



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


[PATCH] D53070: [CodeComplete] Fix crash when completing params function declarations.

2018-10-10 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


Repository:
  rC Clang

https://reviews.llvm.org/D53070



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


[PATCH] D53070: [CodeComplete] Fix crash when completing params function declarations.

2018-10-10 Thread Sam McCall via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC344133: [CodeComplete] Fix crash when completing params 
function declarations. (authored by sammccall, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D53070?vs=168967&id=168974#toc

Repository:
  rC Clang

https://reviews.llvm.org/D53070

Files:
  lib/Sema/SemaCodeComplete.cpp
  test/CodeCompletion/crash-func-decl.cpp


Index: test/CodeCompletion/crash-func-decl.cpp
===
--- test/CodeCompletion/crash-func-decl.cpp
+++ test/CodeCompletion/crash-func-decl.cpp
@@ -0,0 +1,5 @@
+// Important that BB is unknown.
+// This triggers completion in PCC_RecoveryInFunction context, with no 
function.
+int AA(BB cc);
+// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:3:12 %s | 
FileCheck %s
+// CHECK: COMPLETION: char
Index: lib/Sema/SemaCodeComplete.cpp
===
--- lib/Sema/SemaCodeComplete.cpp
+++ lib/Sema/SemaCodeComplete.cpp
@@ -1881,7 +1881,8 @@
 }
 
 // Switch-specific statements.
-if (!SemaRef.getCurFunction()->SwitchStack.empty()) {
+if (SemaRef.getCurFunction() &&
+!SemaRef.getCurFunction()->SwitchStack.empty()) {
   // case expression:
   Builder.AddTypedTextChunk("case");
   Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);


Index: test/CodeCompletion/crash-func-decl.cpp
===
--- test/CodeCompletion/crash-func-decl.cpp
+++ test/CodeCompletion/crash-func-decl.cpp
@@ -0,0 +1,5 @@
+// Important that BB is unknown.
+// This triggers completion in PCC_RecoveryInFunction context, with no function.
+int AA(BB cc);
+// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:3:12 %s | FileCheck %s
+// CHECK: COMPLETION: char
Index: lib/Sema/SemaCodeComplete.cpp
===
--- lib/Sema/SemaCodeComplete.cpp
+++ lib/Sema/SemaCodeComplete.cpp
@@ -1881,7 +1881,8 @@
 }
 
 // Switch-specific statements.
-if (!SemaRef.getCurFunction()->SwitchStack.empty()) {
+if (SemaRef.getCurFunction() &&
+!SemaRef.getCurFunction()->SwitchStack.empty()) {
   // case expression:
   Builder.AddTypedTextChunk("case");
   Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r344133 - [CodeComplete] Fix crash when completing params function declarations.

2018-10-10 Thread Sam McCall via cfe-commits
Author: sammccall
Date: Wed Oct 10 03:51:48 2018
New Revision: 344133

URL: http://llvm.org/viewvc/llvm-project?rev=344133&view=rev
Log:
[CodeComplete] Fix crash when completing params function declarations.

Summary:
In a decl like `int AA(BB cc)` where BB isn't defined, we end up trying to
parse `BB cc` as an expression (vexing parse) and end up triggering the
parser's "recovery-in-function" completion with no actual function
scope.

This patch avoids the assumption that such a scope exists in this context.

Reviewers: kadircet

Subscribers: cfe-commits

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

Added:
cfe/trunk/test/CodeCompletion/crash-func-decl.cpp
Modified:
cfe/trunk/lib/Sema/SemaCodeComplete.cpp

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=344133&r1=344132&r2=344133&view=diff
==
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Wed Oct 10 03:51:48 2018
@@ -1881,7 +1881,8 @@ static void AddOrdinaryNameResults(Sema:
 }
 
 // Switch-specific statements.
-if (!SemaRef.getCurFunction()->SwitchStack.empty()) {
+if (SemaRef.getCurFunction() &&
+!SemaRef.getCurFunction()->SwitchStack.empty()) {
   // case expression:
   Builder.AddTypedTextChunk("case");
   Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);

Added: cfe/trunk/test/CodeCompletion/crash-func-decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/crash-func-decl.cpp?rev=344133&view=auto
==
--- cfe/trunk/test/CodeCompletion/crash-func-decl.cpp (added)
+++ cfe/trunk/test/CodeCompletion/crash-func-decl.cpp Wed Oct 10 03:51:48 2018
@@ -0,0 +1,5 @@
+// Important that BB is unknown.
+// This triggers completion in PCC_RecoveryInFunction context, with no 
function.
+int AA(BB cc);
+// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:3:12 %s | 
FileCheck %s
+// CHECK: COMPLETION: char


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


[PATCH] D53069: [analyzer][www] Update avaible_checks.html

2018-10-10 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added a comment.

Thats a great idea.

About implicit checks, they are so well hidden, I didn't even find them until I 
wanted to update the website (although, this is at least in part my fault, but 
why would anyone carefully read through a website that hasn't been touched for 
years?). I think with a big enough warning that it shouldn't be touched by 
normal users, it should be on this page.


https://reviews.llvm.org/D53069



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


[PATCH] D51340: Add /Zc:DllexportInlines option to clang-cl

2018-10-10 Thread Takuto Ikuta via Phabricator via cfe-commits
takuto.ikuta updated this revision to Diff 168979.
takuto.ikuta added a comment.

address comment


https://reviews.llvm.org/D51340

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/LangOptions.h
  clang/include/clang/Driver/CC1Options.td
  clang/include/clang/Driver/CLCompatOptions.td
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/CodeGenCXX/dllexport-no-dllexport-inlines.cpp

Index: clang/test/CodeGenCXX/dllexport-no-dllexport-inlines.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/dllexport-no-dllexport-inlines.cpp
@@ -0,0 +1,160 @@
+// RUN: %clang_cc1 %s -fms-extensions -triple x86_64-windows-msvc   \
+// RUN: -fno-dllexport-inlines -emit-llvm -O0 -o - |\
+// RUN: FileCheck --check-prefix=DEFAULT --check-prefix=NOINLINE %s
+
+// RUN: %clang_cc1 %s -fms-extensions -triple x86_64-windows-msvc   \
+// RUN: -emit-llvm -O0 -o - |   \
+// RUN: FileCheck --check-prefix=DEFAULT --check-prefix=INLINE %s
+
+
+// Function
+
+// DEFAULT-DAG: define dso_local dllexport void @"?NormalFunction@@YAXXZ"()
+void __declspec(dllexport) NormalFunction() {}
+
+
+// DEFAULT-DAG: define weak_odr dso_local dllexport void @"?AlwaysInlineFunction@@YAXXZ"
+__forceinline void __declspec(dllexport) AlwaysInlineFunction() {}
+
+// DEFAULT-DAG: @"?static_variable@?1??AlwaysInlineWithStaticVariableExported@@YAHXZ@4HA" = weak_odr dso_local dllexport global i32 0, comdat, align 4
+__forceinline int __declspec(dllexport) AlwaysInlineWithStaticVariableExported() {
+  static int static_variable = 0;
+  ++static_variable;
+  return static_variable;
+}
+
+// DEFAULT-DAG: @"?static_variable@?1??AlwaysInlineWithStaticVariableImported@@YAHXZ@4HA" = available_externally dllimport global i32 0, align 4
+__forceinline int __declspec(dllimport) AlwaysInlineWithStaticVariableImported() {
+  static int static_variable = 0;
+  ++static_variable;
+  return static_variable;
+}
+
+int ImportedFunctionUser() {
+  return AlwaysInlineWithStaticVariableImported();
+}
+
+// Class member function
+
+// check for local static variables
+// NOINLINE-DAG: @"?static_variable@?1??InclassDefFuncWithStaticVariable@NoTemplateExportedClass@@QEAAHXZ@4HA" = weak_odr dso_local dllexport global i32 0, comdat, align 4
+
+// INLINE-DAG: @"?static_variable@?1??InclassDefFuncWithStaticVariable@NoTemplateExportedClass@@QEAAHXZ@4HA" = weak_odr dso_local dllexport global i32 0, comdat, align 4
+class __declspec(dllexport) NoTemplateExportedClass {
+ public:
+  // DEFAULT-NOT: NoTemplateExportedClass@NoTemplateExportedClass@@
+  NoTemplateExportedClass() = default;
+
+  // NOINLINE-NOT: InclassDefFunc@NoTemplateExportedClass
+  // INLINE-DAG: define weak_odr dso_local dllexport void @"?InclassDefFunc@NoTemplateExportedClass@@
+  void InclassDefFunc() {}
+
+  int f();
+
+  // DEFAULT-DAG: define weak_odr dso_local dllexport i32 @"?InclassDefFuncWithStaticVariable@NoTemplateExportedClass@@QEAAHXZ"
+  int InclassDefFuncWithStaticVariable() {
+static int static_variable = 0;
+++static_variable;
+return static_variable;
+  }
+
+  // DEFAULT-DAG: define weak_odr dso_local dllexport i32 @"?InclassDefFunctWithLambdaStaticVariable@NoTemplateExportedClass@@QEAAHXZ"
+  int InclassDefFunctWithLambdaStaticVariable() {
+return ([]() { static int static_x; return ++static_x; })();
+  }
+
+  // DEFAULT-NOT: InlineOutclassDefFuncWihtoutDefinition
+  __forceinline void InlineOutclassDefFuncWihtoutDefinition();
+
+  // DEFAULT-NOT: InlineOutclassDefFunc@NoTemplateExportedClass@@
+  __forceinline void InlineOutclassDefFunc();
+
+  // DEFAULT-NOT: InlineOutclassDefFuncWithStaticVariable@NoTemplateExportedClass@@
+  __forceinline int InlineOutclassDefFuncWithStaticVariable();
+
+  // DEFAULT-DAG: define dso_local dllexport void @"?OutclassDefFunc@NoTemplateExportedClass@@QEAAXXZ"
+  void OutclassDefFunc();
+};
+
+void NoTemplateExportedClass::OutclassDefFunc() {}
+
+__forceinline void NoTemplateExportedClass::InlineOutclassDefFunc() {}
+
+__forceinline int NoTemplateExportedClass::InlineOutclassDefFuncWithStaticVariable() {
+  static int static_variable = 0;
+  return ++static_variable;
+}
+
+void __declspec(dllexport) NoTemplateExportedClassUser() {
+  NoTemplateExportedClass a;
+  a.InlineOutclassDefFunc();
+}
+
+template
+class __declspec(dllexport) TemplateExportedClass {
+  void InclassDefFunc() {}
+  void OutclassDefFunc();
+
+  T templateValue;
+};
+
+// DEFAULT-NOT: define dso_local dllexport void @"?OutclassDefFunc@NoTemplateExportedClass@@
+template void TemplateExportedClass::OutclassDefFunc() {}
+
+class A11{};
+class B22{};
+
+// DEFAULT-DAG: define weak_odr dso_local dllexport void @"?InclassDefFunc@?$TemplateExportedClass@VA11@@
+// DEFAULT-DAG: define weak_odr dso_local dllexport void @"?OutclassDefFu

[PATCH] D51340: Add /Zc:DllexportInlines option to clang-cl

2018-10-10 Thread Takuto Ikuta via Phabricator via cfe-commits
takuto.ikuta added a comment.

Thank you for review!




Comment at: clang/lib/Sema/SemaDeclCXX.cpp:5599
 
+bool Sema::isInlineFunctionDLLExportable(const CXXMethodDecl *MD) {
+  assert(MD->isInlined());

hans wrote:
> Okay, breaking out this logic is a little better, but I still don't like that 
> we now have split the "inherit dllexport attribute" in two places: one for 
> non-inline functions and one for inline (even if they both call this 
> function). It feels like it will be hard to maintain.
> 
> Here is another idea:
> 
> When we inherit the dllexport attribute to class members, if 
> getLangOpts().DllExportInlines is false, we don't put dllexport on inline 
> functions, but instead we put a new attribute "dllexportstaticlocals".
> 
> That attribute only has the effect that it makes static locals exported. We 
> would check for it when computing the linkage of the static local, similar to 
> how it works in hidden functions.
> 
> This has two benefits: it doesn't complicate the "inherit dllexport" code 
> very much, and it avoids the need for a separate AST walk of the function.
> 
> What do you think?
I implemented your idea the way I understood.
Use new attribute to check static local var later.

Due to difference of treating between linkage and dll attribute, I inherit dll 
attribute in Sema/SemaDecl.cpp instead of  AST/Decl.cpp


https://reviews.llvm.org/D51340



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


[PATCH] D53072: [clang-format] Introduce the flag which allows not to shrink lines

2018-10-10 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan created this revision.
yvvan added reviewers: klimek, djasper, krasimir.

Currently there's no way to prevent to lines optimization even if you have 
intentionally put  to split the line.

In general case it's fine. So I would prefer to have such option which you can 
enable in special cases (for me it's an IDE related use case).


https://reviews.llvm.org/D53072

Files:
  include/clang/Format/Format.h
  lib/Format/Format.cpp
  lib/Format/UnwrappedLineFormatter.cpp
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -349,6 +349,14 @@
"  void funk() {}\n"
"};",
Style));
+
+  Style.KeepLineBreaksForNonEmptyLines = true;
+  Style.ColumnLimit = 0;
+  EXPECT_EQ("int foo(int a,\n"
+"int b) {}",
+format("int foo(int a,\n"
+   "int b) {}",
+   Style));
 }
 
 TEST_F(FormatTest, RecognizesBinaryOperatorKeywords) {
Index: lib/Format/UnwrappedLineFormatter.cpp
===
--- lib/Format/UnwrappedLineFormatter.cpp
+++ lib/Format/UnwrappedLineFormatter.cpp
@@ -672,7 +672,7 @@
   LineFormatter(ContinuationIndenter *Indenter, WhitespaceManager *Whitespaces,
 const FormatStyle &Style,
 UnwrappedLineFormatter *BlockFormatter)
-  : Indenter(Indenter), Whitespaces(Whitespaces), Style(Style),
+  : Indenter(Indenter), Style(Style), Whitespaces(Whitespaces),
 BlockFormatter(BlockFormatter) {}
   virtual ~LineFormatter() {}
 
@@ -760,10 +760,10 @@
   }
 
   ContinuationIndenter *Indenter;
+  const FormatStyle &Style;
 
 private:
   WhitespaceManager *Whitespaces;
-  const FormatStyle &Style;
   UnwrappedLineFormatter *BlockFormatter;
 };
 
@@ -786,7 +786,8 @@
 while (State.NextToken) {
   bool Newline =
   Indenter->mustBreak(State) ||
-  (Indenter->canBreak(State) && State.NextToken->NewlinesBefore > 0);
+  (State.NextToken->NewlinesBefore > 0 &&
+   (Style.KeepLineBreaksForNonEmptyLines || Indenter->canBreak(State)));
   unsigned Penalty = 0;
   formatChildren(State, Newline, /*DryRun=*/false, Penalty);
   Indenter->addTokenToState(State, Newline, /*DryRun=*/false);
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -416,6 +416,8 @@
Style.IndentWrappedFunctionNames);
 IO.mapOptional("JavaScriptQuotes", Style.JavaScriptQuotes);
 IO.mapOptional("JavaScriptWrapImports", Style.JavaScriptWrapImports);
+IO.mapOptional("KeepLineBreaksForNonEmptyLines",
+   Style.KeepLineBreaksForNonEmptyLines);
 IO.mapOptional("KeepEmptyLinesAtTheStartOfBlocks",
Style.KeepEmptyLinesAtTheStartOfBlocks);
 IO.mapOptional("MacroBlockBegin", Style.MacroBlockBegin);
@@ -676,6 +678,7 @@
   LLVMStyle.JavaScriptWrapImports = true;
   LLVMStyle.TabWidth = 8;
   LLVMStyle.MaxEmptyLinesToKeep = 1;
+  LLVMStyle.KeepLineBreaksForNonEmptyLines = false;
   LLVMStyle.KeepEmptyLinesAtTheStartOfBlocks = true;
   LLVMStyle.NamespaceIndentation = FormatStyle::NI_None;
   LLVMStyle.ObjCBinPackProtocolList = FormatStyle::BPS_Auto;
@@ -741,6 +744,7 @@
   {"^", 2}, {"^<.*\\.h>", 1}, {"^<.*", 2}, {".*", 3}};
   GoogleStyle.IncludeStyle.IncludeIsMainRegex = "([-_](test|unittest))?$";
   GoogleStyle.IndentCaseLabels = true;
+  GoogleStyle.KeepLineBreaksForNonEmptyLines = false;
   GoogleStyle.KeepEmptyLinesAtTheStartOfBlocks = false;
   GoogleStyle.ObjCBinPackProtocolList = FormatStyle::BPS_Never;
   GoogleStyle.ObjCSpaceAfterProperty = false;
Index: include/clang/Format/Format.h
===
--- include/clang/Format/Format.h
+++ include/clang/Format/Format.h
@@ -1160,6 +1160,16 @@
   /// \endcode
   bool JavaScriptWrapImports;
 
+  /// If true, no line breaks are optimized out (works only with ColumnLimit = 0)
+  /// \code
+  ///true:  false:
+  ///int foo(int a, vs. int foo(int a, int b) {
+  ///int b) {
+  ///  bar(); bar();
+  ///}  }
+  /// \endcode
+  bool KeepLineBreaksForNonEmptyLines;
+
   /// If true, the empty line at the start of blocks is kept.
   /// \code
   ///true:  false:
@@ -1726,6 +1736,7 @@
IndentWrappedFunctionNames == R.IndentWrappedFunctionNames &&
JavaScriptQuotes == R.JavaScriptQuotes &&
JavaScriptWrapImports == R.JavaScriptWrapImports &&
+   KeepLineBreaksForNonEmptyLines == R.KeepLineBreaksForNonEmptyLines &&
KeepEmptyLinesAtTheStartO

[PATCH] D53069: [analyzer][www] Update avaible_checks.html

2018-10-10 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs added inline comments.



Comment at: www/analyzer/available_checks.html:376-393
+
+cplusplus.InnerPointer
+(C++)
+Check for inner pointers of C++ containers used after re/deallocation.
+
+
+

Szelethus wrote:
> @rnkovacs Is this a good description of your checker?
Hmm, how about:

```
void log(const char *str);

void test(int value) {
  const char *msg = std::to_string(value).c_str();
  // msg points to the buffer of a temporary that is now destroyed
  log(msg);  // warn: inner pointer of container used after re/deallocation
}
```

Most of the issues it found in real code looked like this.
Thanks a lot!


https://reviews.llvm.org/D53069



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


[PATCH] D52727: [clang-tidy] White List Option for performance-unnecessary-value-param, performance-unnecessary-copy-initialization and performance-for-range-copy

2018-10-10 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 168993.
baloghadamsoftware added a comment.

Matching of allowed types happens now on the top-level type, not the canonical 
one.


https://reviews.llvm.org/D52727

Files:
  clang-tidy/performance/ForRangeCopyCheck.cpp
  clang-tidy/performance/ForRangeCopyCheck.h
  clang-tidy/performance/UnnecessaryCopyInitialization.cpp
  clang-tidy/performance/UnnecessaryCopyInitialization.h
  clang-tidy/performance/UnnecessaryValueParamCheck.cpp
  clang-tidy/performance/UnnecessaryValueParamCheck.h
  clang-tidy/utils/Matchers.h
  docs/clang-tidy/checks/performance-for-range-copy.rst
  docs/clang-tidy/checks/performance-unnecessary-copy-initialization.rst
  docs/clang-tidy/checks/performance-unnecessary-value-param.rst
  test/clang-tidy/performance-for-range-copy-allowed-types.cpp
  test/clang-tidy/performance-unnecessary-copy-initialization-allowed-types.cpp
  test/clang-tidy/performance-unnecessary-value-param-allowed-types.cpp

Index: test/clang-tidy/performance-unnecessary-value-param-allowed-types.cpp
===
--- /dev/null
+++ test/clang-tidy/performance-unnecessary-value-param-allowed-types.cpp
@@ -0,0 +1,75 @@
+// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t -- -config="{CheckOptions: [{key: performance-unnecessary-value-param.AllowedTypes, value: '[Pp]ointer$;[Pp]tr$;[Rr]ef(erence)?$'}]}" --
+
+struct SmartPointer {
+  ~SmartPointer();
+};
+
+struct smart_pointer {
+  ~smart_pointer();
+};
+
+struct SmartPtr {
+  ~SmartPtr();
+};
+
+struct smart_ptr {
+  ~smart_ptr();
+};
+
+struct SmartReference {
+  ~SmartReference();
+};
+
+struct smart_reference {
+  ~smart_reference();
+};
+
+struct SmartRef {
+  ~SmartRef();
+};
+
+struct smart_ref {
+  ~smart_ref();
+};
+
+struct OtherType {
+  ~OtherType();
+};
+
+template  struct SomeComplexTemplate {
+  ~SomeComplexTemplate();
+};
+
+typedef SomeComplexTemplate NotTooComplexRef;
+
+void negativeSmartPointer(SmartPointer P) {
+}
+
+void negative_smart_pointer(smart_pointer p) {
+}
+
+void negativeSmartPtr(SmartPtr P) {
+}
+
+void negative_smart_ptr(smart_ptr p) {
+}
+
+void negativeSmartReference(SmartReference R) {
+}
+
+void negative_smart_reference(smart_reference r) {
+}
+
+void negativeSmartRef(SmartRef R) {
+}
+
+void negative_smart_ref(smart_ref r) {
+}
+
+void positiveOtherType(OtherType O) {
+  // CHECK-MESSAGES: [[@LINE-1]]:34: warning: the parameter 'O' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
+  // CHECK-FIXES: void positiveOtherType(const OtherType& O) {
+}
+
+void negativeNotTooComplexRef(NotTooComplexRef R) {
+}
Index: test/clang-tidy/performance-unnecessary-copy-initialization-allowed-types.cpp
===
--- /dev/null
+++ test/clang-tidy/performance-unnecessary-copy-initialization-allowed-types.cpp
@@ -0,0 +1,98 @@
+// RUN: %check_clang_tidy %s performance-unnecessary-copy-initialization %t -- -config="{CheckOptions: [{key: performance-unnecessary-copy-initialization.AllowedTypes, value: '[Pp]ointer$;[Pp]tr$;[Rr]ef(erence)?$'}]}" --
+
+struct SmartPointer {
+  ~SmartPointer();
+};
+
+struct smart_pointer {
+  ~smart_pointer();
+};
+
+struct SmartPtr {
+  ~SmartPtr();
+};
+
+struct smart_ptr {
+  ~smart_ptr();
+};
+
+struct SmartReference {
+  ~SmartReference();
+};
+
+struct smart_reference {
+  ~smart_reference();
+};
+
+struct SmartRef {
+  ~SmartRef();
+};
+
+struct smart_ref {
+  ~smart_ref();
+};
+
+struct OtherType {
+  ~OtherType();
+};
+
+template  struct SomeComplexTemplate {
+  ~SomeComplexTemplate();
+};
+
+typedef SomeComplexTemplate NotTooComplexRef;
+
+const SmartPointer &getSmartPointer();
+const smart_pointer &get_smart_pointer();
+const SmartPtr &getSmartPtr();
+const smart_ptr &get_smart_ptr();
+const SmartReference &getSmartReference();
+const smart_reference &get_smart_reference();
+const SmartRef &getSmartRef();
+const smart_ref &get_smart_ref();
+const OtherType &getOtherType();
+const NotTooComplexRef &getNotTooComplexRef();
+
+void negativeSmartPointer() {
+  const auto P = getSmartPointer();
+}
+
+void negative_smart_pointer() {
+  const auto p = get_smart_pointer();
+}
+
+void negativeSmartPtr() {
+  const auto P = getSmartPtr();
+}
+
+void negative_smart_ptr() {
+  const auto p = get_smart_ptr();
+}
+
+void negativeSmartReference() {
+  const auto R = getSmartReference();
+}
+
+void negative_smart_reference() {
+  const auto r = get_smart_reference();
+}
+
+void negativeSmartRef() {
+  const auto R = getSmartRef();
+}
+
+void negative_smart_ref() {
+  const auto r = get_smart_ref();
+}
+
+void positiveOtherType() {
+  const auto O = getOtherType();
+  // CHECK-MESSAGES: [[@LINE-1]]:14: warning: the const qualified variable 'O' is copy-constructed from a const reference; consider making it a const reference [performance-unnecessary-copy-initializat

[clang-tools-extra] r344140 - Lift VFS from clang to llvm (NFC)

2018-10-10 Thread Jonas Devlieghere via cfe-commits
Author: jdevlieghere
Date: Wed Oct 10 06:27:25 2018
New Revision: 344140

URL: http://llvm.org/viewvc/llvm-project?rev=344140&view=rev
Log:
Lift VFS from clang to llvm (NFC)

This patch moves the virtual file system form clang to llvm so it can be
used by more projects.

Concretely the patch:
 - Moves VirtualFileSystem.{h|cpp} from clang/Basic to llvm/Support.
 - Moves the corresponding unit test from clang to llvm.
 - Moves the vfs namespace from clang::vfs to llvm::vfs.
 - Formats the lines affected by this change, mostly this is the result of
   the added llvm namespace.

RFC on the mailing list:
http://lists.llvm.org/pipermail/llvm-dev/2018-October/126657.html

Differential revision: https://reviews.llvm.org/D52783

Modified:
clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
clang-tools-extra/trunk/clang-tidy/ClangTidy.h
clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp
clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h
clang-tools-extra/trunk/clangd/ClangdUnit.cpp
clang-tools-extra/trunk/clangd/ClangdUnit.h
clang-tools-extra/trunk/clangd/CodeComplete.cpp
clang-tools-extra/trunk/clangd/CodeComplete.h
clang-tools-extra/trunk/clangd/Compiler.cpp
clang-tools-extra/trunk/clangd/Compiler.h
clang-tools-extra/trunk/clangd/FS.cpp
clang-tools-extra/trunk/clangd/FS.h
clang-tools-extra/trunk/clangd/FSProvider.h
clang-tools-extra/trunk/clangd/Headers.h
clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp
clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h
clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp
clang-tools-extra/trunk/unittests/clangd/FSTests.cpp
clang-tools-extra/trunk/unittests/clangd/SymbolCollectorTests.cpp
clang-tools-extra/trunk/unittests/clangd/TestFS.h
clang-tools-extra/trunk/unittests/include-fixer/IncludeFixerTest.cpp

clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=344140&r1=344139&r2=344140&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Wed Oct 10 06:27:25 2018
@@ -96,7 +96,7 @@ private:
 class ErrorReporter {
 public:
   ErrorReporter(ClangTidyContext &Context, bool ApplyFixes,
-llvm::IntrusiveRefCntPtr BaseFS)
+llvm::IntrusiveRefCntPtr BaseFS)
   : Files(FileSystemOptions(), BaseFS), DiagOpts(new DiagnosticOptions()),
 DiagPrinter(new TextDiagnosticPrinter(llvm::outs(), &*DiagOpts)),
 Diags(IntrusiveRefCntPtr(new DiagnosticIDs), &*DiagOpts,
@@ -503,7 +503,7 @@ getCheckOptions(const ClangTidyOptions &
 void runClangTidy(clang::tidy::ClangTidyContext &Context,
   const CompilationDatabase &Compilations,
   ArrayRef InputFiles,
-  llvm::IntrusiveRefCntPtr BaseFS,
+  llvm::IntrusiveRefCntPtr BaseFS,
   bool EnableCheckProfile, llvm::StringRef StoreCheckProfile) {
   ClangTool Tool(Compilations, InputFiles,
  std::make_shared(), BaseFS);
@@ -590,9 +590,9 @@ void runClangTidy(clang::tidy::ClangTidy
 
 void handleErrors(ClangTidyContext &Context, bool Fix,
   unsigned &WarningsAsErrorsCount,
-  llvm::IntrusiveRefCntPtr BaseFS) {
+  llvm::IntrusiveRefCntPtr BaseFS) {
   ErrorReporter Reporter(Context, Fix, BaseFS);
-  vfs::FileSystem &FileSystem =
+  llvm::vfs::FileSystem &FileSystem =
   *Reporter.getSourceManager().getFileManager().getVirtualFileSystem();
   auto InitialWorkingDir = FileSystem.getCurrentWorkingDirectory();
   if (!InitialWorkingDir)

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.h?rev=344140&r1=344139&r2=344140&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.h (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.h Wed Oct 10 06:27:25 2018
@@ -233,7 +233,7 @@ getCheckOptions(const ClangTidyOptions &
 void runClangTidy(clang::tidy::ClangTidyContext &Context,
   const tooling::CompilationDatabase &Compilations,
   ArrayRef InputFiles,
-  llvm::IntrusiveRefCntPtr BaseFS,
+  llvm::IntrusiveRefCntPtr BaseFS,
   bool EnableCheckProfile = false,
   llvm::StringRef StoreCheckProfile = StringRef());
 
@@ -245,7 +245,7 @@ void runClangTidy(clang::tidy::ClangTidy
 /// clang-format configuration file is found, the given \P FormatStyle is used.
 void handleErrors(ClangTidyContext &Context, bool Fix,
   unsigned &War

[PATCH] D52949: [Diagnostics] Implement -Wsizeof-pointer-div

2018-10-10 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment.

In https://reviews.llvm.org/D52949#1259947, @jfb wrote:

> Can you add tests with arrays?


Yes :)

> The error message doesn't really say what to do instead. What's wrong? What's 
> correct instead?

What do you suggest? "division produces the incorrect number of array elements; 
pass the length of array as a function argument"?

> In C++17 and later we should suggest using `std::size` for some cases instead.

Ok, good idea.


https://reviews.llvm.org/D52949



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


[PATCH] D52773: clang-cl: Add /showFilenames option (PR31957)

2018-10-10 Thread Hans Wennborg via Phabricator via cfe-commits
hans updated this revision to Diff 168999.
hans added a comment.

Here's a version now using cc1 flags, but printing directly from the driver. 
Please take a look.


https://reviews.llvm.org/D52773

Files:
  include/clang/Driver/CLCompatOptions.td
  include/clang/Driver/Job.h
  lib/Driver/Job.cpp
  lib/Driver/ToolChains/Clang.cpp
  test/Driver/cl-showfilenames.c


Index: test/Driver/cl-showfilenames.c
===
--- /dev/null
+++ test/Driver/cl-showfilenames.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cl /c /showFilenames -- %s 2>&1 | FileCheck -check-prefix=show 
%s
+// RUN: %clang_cl /c /showFilenames -- %s %S/Inputs/wildcard*.c 2>&1 | 
FileCheck -check-prefix=multiple %s
+
+// show: cl-showfilenames.c
+
+// multiple: cl-showfilenames.c
+// multiple-NEXT: wildcard1.c
+// multiple-NEXT: wildcard2.c
Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -5066,6 +5066,13 @@
 C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs));
   }
 
+  // Make the compile command echo its inputs for /showFilenames.
+  if (Output.getType() == types::TY_Object &&
+  Args.hasFlag(options::OPT__SLASH_showFilenames,
+   options::OPT__SLASH_showFilenames_, false)) {
+C.getJobs().getJobs().back()->setPrintInputFilenames(true);
+  }
+
   if (Arg *A = Args.getLastArg(options::OPT_pg))
 if (!shouldUseFramePointer(Args, Triple))
   D.Diag(diag::err_drv_argument_not_allowed_with) << "-fomit-frame-pointer"
Index: lib/Driver/Job.cpp
===
--- lib/Driver/Job.cpp
+++ lib/Driver/Job.cpp
@@ -315,6 +315,11 @@
 
 int Command::Execute(ArrayRef> Redirects,
  std::string *ErrMsg, bool *ExecutionFailed) const {
+  if (PrintInputFilenames) {
+for (const char *Arg : InputFilenames)
+  llvm::outs() << llvm::sys::path::filename(Arg) << "\n";
+  }
+
   SmallVector Argv;
 
   Optional> Env;
Index: include/clang/Driver/Job.h
===
--- include/clang/Driver/Job.h
+++ include/clang/Driver/Job.h
@@ -59,6 +59,9 @@
   /// The list of program arguments which are inputs.
   llvm::opt::ArgStringList InputFilenames;
 
+  /// Whether to print the input filenames when executing.
+  bool PrintInputFilenames = false;
+
   /// Response file name, if this command is set to use one, or nullptr
   /// otherwise
   const char *ResponseFile = nullptr;
@@ -128,6 +131,9 @@
 
   /// Print a command argument, and optionally quote it.
   static void printArg(llvm::raw_ostream &OS, StringRef Arg, bool Quote);
+
+  /// Set whether to print the input filenames when executing.
+  void setPrintInputFilenames(bool P) { PrintInputFilenames = P; }
 };
 
 /// Like Command, but with a fallback which is executed in case
Index: include/clang/Driver/CLCompatOptions.td
===
--- include/clang/Driver/CLCompatOptions.td
+++ include/clang/Driver/CLCompatOptions.td
@@ -158,6 +158,10 @@
 def _SLASH_showIncludes : CLFlag<"showIncludes">,
   HelpText<"Print info about included files to stderr">,
   Alias;
+def _SLASH_showFilenames : CLFlag<"showFilenames">,
+  HelpText<"Print the name of each compiled file">;
+def _SLASH_showFilenames_ : CLFlag<"showFilenames-">,
+  HelpText<"Don't print the name of each compiled file (default)">;
 def _SLASH_source_charset : CLCompileJoined<"source-charset:">,
   HelpText<"Source encoding, supports only UTF-8">, Alias;
 def _SLASH_execution_charset : CLCompileJoined<"execution-charset:">,


Index: test/Driver/cl-showfilenames.c
===
--- /dev/null
+++ test/Driver/cl-showfilenames.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cl /c /showFilenames -- %s 2>&1 | FileCheck -check-prefix=show %s
+// RUN: %clang_cl /c /showFilenames -- %s %S/Inputs/wildcard*.c 2>&1 | FileCheck -check-prefix=multiple %s
+
+// show: cl-showfilenames.c
+
+// multiple: cl-showfilenames.c
+// multiple-NEXT: wildcard1.c
+// multiple-NEXT: wildcard2.c
Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -5066,6 +5066,13 @@
 C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs));
   }
 
+  // Make the compile command echo its inputs for /showFilenames.
+  if (Output.getType() == types::TY_Object &&
+  Args.hasFlag(options::OPT__SLASH_showFilenames,
+   options::OPT__SLASH_showFilenames_, false)) {
+C.getJobs().getJobs().back()->setPrintInputFilenames(true);
+  }
+
   if (Arg *A = Args.getLastArg(options::OPT_pg))
 if (!shouldUseFramePointer(Args, Triple))
   D.Diag(diag::err_drv_argument_not_allowed_with) << "-fomit-frame-pointer"
Index: lib/Dr

[PATCH] D51340: Add /Zc:DllexportInlines option to clang-cl

2018-10-10 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

Thanks! I think this is getting close now.




Comment at: clang/lib/Sema/SemaDecl.cpp:11976
+
+while (FD && !getDLLAttr(FD) &&
+   !FD->hasAttr() &&

Why does this need to be a loop? I don't think FunctionDecl's can be nested?



Comment at: clang/lib/Sema/SemaDecl.cpp:11995
+
+// Function having static local variables should be exported.
+auto *ExportAttr = 
cast(NewAttr->clone(getASTContext()));

Isn't it enough that the static local is exported, does the function itself 
need to be exported too?



Comment at: clang/lib/Sema/SemaDeclCXX.cpp:5703
+if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
+!getLangOpts().DllExportInlines &&
+TSK != TSK_ExplicitInstantiationDeclaration &&

I don't think checking for Microsoft ABI is necessary, just checking the 
DllExportInlines flag should be enough.



Comment at: clang/lib/Sema/SemaDeclCXX.cpp:5705
+TSK != TSK_ExplicitInstantiationDeclaration &&
+TSK != TSK_ExplicitInstantiationDefinition) {
+  if (ClassExported) {

But I don't understand why the template stuff is checked here...

The way I imagined this, we'd only need to change the code when creating 
NewAttr below..
Something like

```
NewAttr = ClassAtr->clone()...
if (!getLandOpts().DllExportInlines() && Member is an inline method)
  NewAttr = our new dllimport/export static locals attribute
```

What do you think?


https://reviews.llvm.org/D51340



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


[PATCH] D52727: [clang-tidy] White List Option for performance-unnecessary-value-param, performance-unnecessary-copy-initialization and performance-for-range-copy

2018-10-10 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a reviewer: JonasToth.
lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

LG unless @JonasToth or @aaron.ballman has any further comments.


https://reviews.llvm.org/D52727



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


[PATCH] D53079: [OPENMP] Add 'dynamic_allocators' clause to OMP5.0 'requires' directive

2018-10-10 Thread Patrick Lyster via Phabricator via cfe-commits
patricklyster created this revision.
patricklyster added reviewers: ABataev, Hahnfeld, RaviNarayanaswamy, mikerice, 
kkwli0, hfinkel, gtbercea.
patricklyster added a project: clang.
Herald added subscribers: cfe-commits, arphaman, guansong.

Added new `dynamic_allocators` clause to existing OMP5.0 `requires` directive.


Repository:
  rC Clang

https://reviews.llvm.org/D53079

Files:
  clang/include/clang/AST/OpenMPClause.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/Basic/OpenMPKinds.def
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/OpenMPClause.cpp
  clang/lib/AST/StmtPrinter.cpp
  clang/lib/AST/StmtProfile.cpp
  clang/lib/Basic/OpenMPKinds.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/OpenMP/requires_unified_address_ast_print.cpp
  clang/test/OpenMP/requires_unified_address_messages.cpp
  clang/tools/libclang/CIndex.cpp

Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -2216,6 +2216,9 @@
 void OMPClauseEnqueue::VisitOMPReverseOffloadClause(
 const OMPReverseOffloadClause *) {}
 
+void OMPClauseEnqueue::VisitOMPDynamicAllocatorsClause(
+const OMPDynamicAllocatorsClause *) {}
+
 void OMPClauseEnqueue::VisitOMPDeviceClause(const OMPDeviceClause *C) {
   Visitor->AddStmt(C->getDevice());
 }
Index: clang/test/OpenMP/requires_unified_address_messages.cpp
===
--- clang/test/OpenMP/requires_unified_address_messages.cpp
+++ clang/test/OpenMP/requires_unified_address_messages.cpp
@@ -14,6 +14,11 @@
 
 #pragma omp requires reverse_offload, reverse_offload // expected-error {{Only one reverse_offload clause can appear on a requires directive in a single translation unit}} expected-error {{directive '#pragma omp requires' cannot contain more than one 'reverse_offload' clause}}
 
+#pragma omp requires dynamic_allocators // expected-note {{dynamic_allocators clause previously used here}} expected-note {{dynamic_allocators clause previously used here}}
+
+#pragma omp requires dynamic_allocators, dynamic_allocators // expected-error {{Only one dynamic_allocators clause can appear on a requires directive in a single translation unit}} expected-error {{directive '#pragma omp requires' cannot contain more than one 'dynamic_allocators' clause}}
+
+
 #pragma omp requires // expected-error {{expected at least one clause on '#pragma omp requires' directive}}
 
 #pragma omp requires invalid_clause // expected-warning {{extra tokens at the end of '#pragma omp requires' are ignored}} expected-error {{expected at least one clause on '#pragma omp requires' directive}}
@@ -24,7 +29,7 @@
 
 #pragma omp requires invalid_clause unified_address // expected-warning {{extra tokens at the end of '#pragma omp requires' are ignored}} expected-error {{expected at least one clause on '#pragma omp requires' directive}}
 
-#pragma omp requires unified_shared_memory, unified_address, reverse_offload // expected-error {{Only one unified_shared_memory clause can appear on a requires directive in a single translation unit}} expected-error{{Only one unified_address clause can appear on a requires directive in a single translation unit}} expected-error{{Only one reverse_offload clause can appear on a requires directive in a single translation unit}}
+#pragma omp requires unified_shared_memory, unified_address, reverse_offload, dynamic_allocators // expected-error {{Only one unified_shared_memory clause can appear on a requires directive in a single translation unit}} expected-error{{Only one unified_address clause can appear on a requires directive in a single translation unit}} expected-error{{Only one reverse_offload clause can appear on a requires directive in a single translation unit}} expected-error{{Only one dynamic_allocators clause can appear on a requires directive in a single translation unit}}
 
 namespace A {
   #pragma omp requires unified_address // expected-error {{Only one unified_address clause can appear on a requires directive in a single translation unit}}
Index: clang/test/OpenMP/requires_unified_address_ast_print.cpp
===
--- clang/test/OpenMP/requires_unified_address_ast_print.cpp
+++ clang/test/OpenMP/requires_unified_address_ast_print.cpp
@@ -19,4 +19,7 @@
 #pragma omp requires reverse_offload
 // CHECK:#pragma omp requires reverse_offload
 
+#pragma omp requires dynamic_allocators
+// CHECK:#pragma omp requires dynamic_allocators
+
 #endif
Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -6937,3 +6937

[PATCH] D53079: [OPENMP] Add 'dynamic_allocators' clause to OMP5.0 'requires' directive

2018-10-10 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


Repository:
  rC Clang

https://reviews.llvm.org/D53079



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


[PATCH] D52857: Deprecate 'set output foo' API of clang-query

2018-10-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In https://reviews.llvm.org/D52857#1259522, @steveire wrote:

> > What's more, given that clang-output has no real documentation to speak of, 
> > how will users even *know* to update their scripts?
>
> The release notes will tell them.


That's not user friendly.

> But your comment also raises a different point: If there is so little 
> clang-query documentation, what justification is there for relying on current 
> behavior?

That's pretty much the only reason I think it's reasonable to consider 
deprecating the command in the first place. The justification for relying on it 
is: this has been the behavior since Day 1 of clang-query and we do not often 
remove user-facing options without there being a Very Good Reason to do so. 
This is not a situation where it's an undocumented feature that's in-flux or 
there's no indication it's being used.

> Also, what scripts are you referring to that rely on clang-query? Do we know 
> of any that are expected to work long-term without maintenance (unlikely, as 
> the AST itself is not stable), or is this concern imagined?

I'm referring to third-party scripts kept by people out of tree. I have 
several, I know a few other folks internally at my company who do as well.

I think it's reasonable to expect differences in AST output when updating 
clang-query, but this is not that. It's reasonable to expect command stability.

>> can you expound on your concerns?
> 
> After this patch, the user writes
> 
>   set dump-output true
> 
> 
> or `false`.
> 
> and after the follow-up (https://reviews.llvm.org/D52859) they write
> 
>   set matcher-output true
> 
> 
> After more features I have in the pipeline they will write other similar 
> commands.
> 
> With my command-design, if a user wants to enable dump output in addition to 
> what they have, they just
> 
>   set dump-output true
> 
> 
> In your design, they have to recall/find out what options are currently 
> enabled, and add them in a comma separated list. That is not user-friendly.

Yes -- you are required to make a decision that you want to opt in to new 
functionality. The exact same thing is true with your proposal -- you have to 
find the right place to stick the `set dump-output true` in order to enable it.

>> wonder whether set blah-output options are mutually exclusive or not.
> 
> These options are obviously and clearly toggles.

Your notions of obvious and clear do not match mine.

> There is definitely no reason to think that they are mutually exclusive any 
> more than there is reason to think `set output dump` is mutually exclusive 
> with `set bind-root false`.

Well, except for the fact that each of these commands says "output" in the name 
and they are replacing a command argument named "output" that was mutually 
exclusive and there's zero documentation explaining the commands.

> And even if someone did wonder that, they would just try it and learn that 
> they are toggles.

I don't see this functionality being so critical that we need to deprecate the 
existing spelling when there are backwards compatible options available, which 
is why I'm opposed to this patch going in with the proposed syntax.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52857



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


[PATCH] D52857: Deprecate 'set output foo' API of clang-query

2018-10-10 Thread Stephen Kelly via Phabricator via cfe-commits
steveire added a comment.

>   you have to find the right place to stick the `set dump-output true` in 
> order to enable it.

What do you mean "the right place"?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52857



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


[PATCH] D52857: Deprecate 'set output foo' API of clang-query

2018-10-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In https://reviews.llvm.org/D52857#1260455, @steveire wrote:

> >   you have to find the right place to stick the `set dump-output true` in 
> > order to enable it.
>
> What do you mean "the right place"?


The point from which they want to enable dump outputting.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52857



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


[PATCH] D53081: [clang-doc] Add unit tests for serialization

2018-10-10 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett created this revision.
juliehockett added reviewers: leonardchan, jakehehrlich, lebedev.ri.
juliehockett added a project: clang-tools-extra.
Herald added subscribers: kadircet, arphaman, mgorny.

This is part of a move to convert clang-doc's tests to a more maintainable unit 
test framework, with a smaller number of integration tests to maintain and more 
granular failure feedback.


https://reviews.llvm.org/D53081

Files:
  clang-tools-extra/unittests/CMakeLists.txt
  clang-tools-extra/unittests/clang-doc/CMakeLists.txt
  clang-tools-extra/unittests/clang-doc/ClangDocTest.cpp
  clang-tools-extra/unittests/clang-doc/ClangDocTest.h
  clang-tools-extra/unittests/clang-doc/SerializeTest.cpp

Index: clang-tools-extra/unittests/clang-doc/SerializeTest.cpp
===
--- /dev/null
+++ clang-tools-extra/unittests/clang-doc/SerializeTest.cpp
@@ -0,0 +1,346 @@
+//===-- clang-doc/SerializeTest.cpp ---===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "Serialize.h"
+#include "ClangDocTest.h"
+#include "Representation.h"
+#include "clang/AST/Comment.h"
+#include "clang/AST/RecursiveASTVisitor.h"
+#include "gtest/gtest.h"
+
+namespace clang {
+namespace doc {
+
+class ClangDocSerializeTestVisitor
+: public RecursiveASTVisitor {
+
+  EmittedInfoList &EmittedInfos;
+  bool Public;
+
+comments::FullComment *
+getComment(const NamedDecl *D) const {
+  if (RawComment *Comment = D->getASTContext().getRawCommentForDeclNoCache(D)) {
+Comment->setAttached();
+return Comment->parse(D->getASTContext(), nullptr, D);
+  }
+  return nullptr;
+}
+
+public:
+  ClangDocSerializeTestVisitor(EmittedInfoList &EmittedInfos, bool Public)
+  : EmittedInfos(EmittedInfos), Public(Public) {}
+
+  bool VisitNamespaceDecl(const NamespaceDecl *D) {
+auto I = serialize::emitInfo(D, getComment(D), /*Line*/ 0,
+ /*File=*/"test.cpp", Public);
+if (I)
+  EmittedInfos.emplace_back(std::move(I));
+return true;
+  }
+
+  bool VisitFunctionDecl(const FunctionDecl *D) {
+// Don't visit CXXMethodDecls twice
+if (dyn_cast(D))
+  return true;
+auto I = serialize::emitInfo(D, getComment(D), /*Line*/ 0,
+ /*File=*/"test.cpp", Public);
+if (I)
+  EmittedInfos.emplace_back(std::move(I));
+return true;
+  }
+
+  bool VisitCXXMethodDecl(const CXXMethodDecl *D) {
+auto I = serialize::emitInfo(D, getComment(D), /*Line*/ 0,
+ /*File=*/"test.cpp", Public);
+if (I)
+  EmittedInfos.emplace_back(std::move(I));
+return true;
+  }
+
+  bool VisitRecordDecl(const RecordDecl *D) {
+auto I = serialize::emitInfo(D, getComment(D), /*Line*/ 0,
+ /*File=*/"test.cpp", Public);
+if (I)
+  EmittedInfos.emplace_back(std::move(I));
+return true;
+  }
+
+  bool VisitEnumDecl(const EnumDecl *D) {
+auto I = serialize::emitInfo(D, getComment(D), /*Line*/ 0,
+ /*File=*/"test.cpp", Public);
+if (I)
+  EmittedInfos.emplace_back(std::move(I));
+return true;
+  }
+};
+
+void ExtractInfosFromCode(StringRef Code, size_t NumExpectedInfos, bool Public,
+  EmittedInfoList &EmittedInfos) {
+  auto ASTUnit = clang::tooling::buildASTFromCode(Code);
+  auto TU = ASTUnit->getASTContext().getTranslationUnitDecl();
+  ClangDocSerializeTestVisitor Visitor(EmittedInfos, Public);
+  Visitor.TraverseTranslationUnitDecl(TU);
+  ASSERT_EQ(NumExpectedInfos, EmittedInfos.size());
+}
+
+void ExtractInfosFromCodeWithArgs(StringRef Code, size_t NumExpectedInfos, bool Public,
+  EmittedInfoList &EmittedInfos, std::vector& Args) {
+  auto ASTUnit = clang::tooling::buildASTFromCodeWithArgs(Code, Args);
+  auto TU = ASTUnit->getASTContext().getTranslationUnitDecl();
+  ClangDocSerializeTestVisitor Visitor(EmittedInfos, Public);
+  Visitor.TraverseTranslationUnitDecl(TU);
+  ASSERT_EQ(NumExpectedInfos, EmittedInfos.size());
+}
+
+// Test serialization of namespace declarations.
+TEST(SerializeTest, emitNamespaceInfo) {
+  EmittedInfoList Infos;
+  ExtractInfosFromCode("namespace A { namespace B { void f() {} } }", 3,
+   /*Public=*/false, Infos);
+
+  NamespaceInfo *A = InfoAsNamespace(Infos[0].get());
+  NamespaceInfo ExpectedA(EmptySID, "A");
+  CheckNamespaceInfo(&ExpectedA, A);
+
+  NamespaceInfo *B = InfoAsNamespace(Infos[1].get());
+  NamespaceInfo ExpectedB(EmptySID, "B");
+  ExpectedB.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
+  CheckNamespaceInfo(&ExpectedB, B);
+
+  NamespaceInfo *BWithFunction = InfoAsNamespace(Infos[2].get());

[PATCH] D53084: [clang-doc] Add unit tests for YAML

2018-10-10 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett created this revision.
juliehockett added reviewers: leonardchan, jakehehrlich, lebedev.ri.
juliehockett added a project: clang-tools-extra.
Herald added a subscriber: mgorny.

This is part of a move to convert clang-doc's tests to a more maintainable unit 
test framework, with a smaller number of integration tests to maintain and more 
granular failure feedback.


https://reviews.llvm.org/D53084

Files:
  clang-tools-extra/unittests/clang-doc/CMakeLists.txt
  clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp

Index: clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp
===
--- /dev/null
+++ clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp
@@ -0,0 +1,422 @@
+//===-- clang-doc/YAMLGeneratorTest.cpp
+//===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "ClangDocTest.h"
+#include "Generators.h"
+#include "Representation.h"
+#include "gtest/gtest.h"
+
+namespace clang {
+namespace doc {
+
+std::unique_ptr getYAMLGenerator() {
+  auto G = doc::findGeneratorByName("yaml");
+  if (!G)
+return nullptr;
+  return std::move(G.get());
+}
+
+TEST(YAMLGeneratorTest, emitNamespaceYAML) {
+  NamespaceInfo I;
+  I.Name = "Namespace";
+  I.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
+
+  I.ChildNamespaces.emplace_back(EmptySID, "ChildNamespace",
+ InfoType::IT_namespace);
+  I.ChildRecords.emplace_back(EmptySID, "ChildStruct", InfoType::IT_record);
+  I.ChildFunctions.emplace_back();
+  I.ChildFunctions.back().Name = "OneFunction";
+  I.ChildEnums.emplace_back();
+  I.ChildEnums.back().Name = "OneEnum";
+
+  auto G = getYAMLGenerator();
+  assert(G);
+  std::string Buffer;
+  llvm::raw_string_ostream Actual(Buffer);
+  auto Err = G->generateDocForInfo(&I, Actual);
+  assert(!Err);
+  std::string Expected =
+  "---\n"
+  "USR: ''\n"
+  "Name:'Namespace'\n"
+  "Namespace:   \n"
+  "  - Type:Namespace\n"
+  "Name:'A'\n"
+  "ChildNamespaces: \n"
+  "  - Type:Namespace\n"
+  "Name:'ChildNamespace'\n"
+  "ChildRecords:\n"
+  "  - Type:Record\n"
+  "Name:'ChildStruct'\n"
+  "ChildFunctions:  \n"
+  "  - USR: ''\n"
+  "Name:'OneFunction'\n"
+  "ReturnType:  \n"
+  "ChildEnums:  \n"
+  "  - USR: ''\n"
+  "Name:'OneEnum'\n"
+  "...\n";
+  EXPECT_EQ(Expected, Actual.str());
+}
+
+TEST(YAMLGeneratorTest, emitRecordYAML) {
+  RecordInfo I;
+  I.Name = "r";
+  I.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
+
+  I.DefLoc = Location(10, llvm::SmallString<16>("test.cpp"));
+  I.Loc.emplace_back(12, llvm::SmallString<16>("test.cpp"));
+
+  I.Members.emplace_back("int", "X", AccessSpecifier::AS_private);
+  I.TagType = TagTypeKind::TTK_Class;
+  I.Parents.emplace_back(EmptySID, "F", InfoType::IT_record);
+  I.VirtualParents.emplace_back(EmptySID, "G", InfoType::IT_record);
+
+  I.ChildRecords.emplace_back(EmptySID, "ChildStruct", InfoType::IT_record);
+  I.ChildFunctions.emplace_back();
+  I.ChildFunctions.back().Name = "OneFunction";
+  I.ChildEnums.emplace_back();
+  I.ChildEnums.back().Name = "OneEnum";
+
+  auto G = getYAMLGenerator();
+  assert(G);
+  std::string Buffer;
+  llvm::raw_string_ostream Actual(Buffer);
+  auto Err = G->generateDocForInfo(&I, Actual);
+  assert(!Err);
+  std::string Expected =
+  "---\n"
+  "USR: ''\n"
+  "Name:'r'\n"
+  "Namespace:   \n"
+  "  - Type:Namespace\n"
+  "Name:'A'\n"
+  "DefLocation: \n"
+  "  LineNumber:  10\n"
+  "  Filename:'test.cpp'\n"
+  "Location:\n"
+  "  - LineNumber:  12\n"
+  "Filename:'test.cpp'\n"
+  "TagType: Class\n"
+  "Members: \n"
+  "  - Type:\n"
+  "  Name:'int'\n"
+  "Name:'X'\n"
+  "Access:  Private\n"
+  "Parents: \n"
+  "  - Type:Record\n"
+  "Name:'F'\n"
+  "VirtualParents:  \n"
+  "  - Type:Record\n"
+  "Name:'G'\n"
+  "ChildRecords:\n"
+  "  - Type:Record\n"
+  "Name:'ChildStruct'\n"
+  "ChildFunctions:  \n"
+  "  - USR: '0

[PATCH] D53085: [clang-doc] Add unit tests for Markdown

2018-10-10 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett created this revision.
juliehockett added reviewers: leonardchan, jakehehrlich, lebedev.ri.
juliehockett added a project: clang-tools-extra.
Herald added a subscriber: mgorny.

This is part of a move to convert clang-doc's tests to a more maintainable unit 
test framework, with a smaller number of integration tests to maintain and more 
granular failure feedback.


https://reviews.llvm.org/D53085

Files:
  clang-tools-extra/unittests/clang-doc/CMakeLists.txt
  clang-tools-extra/unittests/clang-doc/MDGeneratorTest.cpp

Index: clang-tools-extra/unittests/clang-doc/MDGeneratorTest.cpp
===
--- /dev/null
+++ clang-tools-extra/unittests/clang-doc/MDGeneratorTest.cpp
@@ -0,0 +1,356 @@
+//===-- clang-doc/MDGeneratorTest.cpp -===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "ClangDocTest.h"
+#include "Generators.h"
+#include "Representation.h"
+#include "gtest/gtest.h"
+
+namespace clang {
+namespace doc {
+
+std::unique_ptr getMDGenerator() {
+  auto G = doc::findGeneratorByName("md");
+  if (!G)
+return nullptr;
+  return std::move(G.get());
+}
+
+TEST(MDGeneratorTest, emitNamespaceMD) {
+  NamespaceInfo I;
+  I.Name = "Namespace";
+  I.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
+
+  I.ChildNamespaces.emplace_back(EmptySID, "ChildNamespace",
+ InfoType::IT_namespace);
+  I.ChildRecords.emplace_back(EmptySID, "ChildStruct", InfoType::IT_record);
+  I.ChildFunctions.emplace_back();
+  I.ChildFunctions.back().Name = "OneFunction";
+  I.ChildEnums.emplace_back();
+  I.ChildEnums.back().Name = "OneEnum";
+
+  auto G = getMDGenerator();
+  assert(G);
+  std::string Buffer;
+  llvm::raw_string_ostream Actual(Buffer);
+  auto Err = G->generateDocForInfo(&I, Actual);
+  assert(!Err);
+  std::string Expected = "# namespace Namespace\n"
+ "\n"
+ "\n"
+ "\n"
+ "## Namespaces\n"
+ "\n"
+ "ChildNamespace\n"
+ "\n"
+ "\n"
+ "\n"
+ "## Records\n"
+ "\n"
+ "ChildStruct\n"
+ "\n"
+ "\n"
+ "\n"
+ "## Functions\n"
+ "\n"
+ "### OneFunction\n"
+ "\n"
+ "* OneFunction()*\n"
+ "\n"
+ "\n"
+ "\n"
+ "## Enums\n"
+ "\n"
+ "| enum OneEnum |\n"
+ "\n"
+ "--\n"
+ "\n"
+ "\n"
+ "\n"
+ "\n"
+ "\n";
+  EXPECT_EQ(Expected, Actual.str());
+}
+
+TEST(MDGeneratorTest, emitRecordMD) {
+  RecordInfo I;
+  I.Name = "r";
+  I.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
+
+  I.DefLoc = Location(10, llvm::SmallString<16>("test.cpp"));
+  I.Loc.emplace_back(12, llvm::SmallString<16>("test.cpp"));
+
+  I.Members.emplace_back("int", "X", AccessSpecifier::AS_private);
+  I.TagType = TagTypeKind::TTK_Class;
+  I.Parents.emplace_back(EmptySID, "F", InfoType::IT_record);
+  I.VirtualParents.emplace_back(EmptySID, "G", InfoType::IT_record);
+
+  I.ChildRecords.emplace_back(EmptySID, "ChildStruct", InfoType::IT_record);
+  I.ChildFunctions.emplace_back();
+  I.ChildFunctions.back().Name = "OneFunction";
+  I.ChildEnums.emplace_back();
+  I.ChildEnums.back().Name = "OneEnum";
+
+  auto G = getMDGenerator();
+  assert(G);
+  std::string Buffer;
+  llvm::raw_string_ostream Actual(Buffer);
+  auto Err = G->generateDocForInfo(&I, Actual);
+  assert(!Err);
+  std::string Expected = "# class r\n"
+ "\n"
+ "*Defined at line 10 of test.cpp*\n"
+ "\n"
+ "Inherits from F, G\n"
+ "\n"
+ "\n"
+ "\n"
+ "## Members\n"
+ "\n"
+ "private int X\n"
+ "\n"
+ "\n"
+ "\n"
+ "## Records\n"
+ "\n"
+ "ChildStruct\n"
+ "\n"
+ "\n"
+ "\n"
+  

[PATCH] D53076: [analyzer] WIP: Enhance ConditionBRVisitor to write out more information

2018-10-10 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added a comment.

I'm sadly not that knowledgeable on visitors to help you, but the idea is 
awesome, thank you for working on this!


https://reviews.llvm.org/D53076



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


[PATCH] D53046: [Sema] Fix an error-on-valid with friends and templates

2018-10-10 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D53046



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


r344146 - [clang] Properly apply attributes on explicit instantiations of static data members

2018-10-10 Thread Louis Dionne via cfe-commits
Author: ldionne
Date: Wed Oct 10 08:32:29 2018
New Revision: 344146

URL: http://llvm.org/viewvc/llvm-project?rev=344146&view=rev
Log:
[clang] Properly apply attributes on explicit instantiations of static data 
members

Summary: https://llvm.org/PR39118

Reviewers: aaron.ballman, rnk

Subscribers: dexonsmith, cfe-commits

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

Added:
cfe/trunk/test/SemaCXX/attr-on-explicit-template-instantiation.cpp
Modified:
cfe/trunk/lib/Sema/SemaTemplate.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=344146&r1=344145&r2=344146&view=diff
==
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Wed Oct 10 08:32:29 2018
@@ -9173,10 +9173,8 @@ DeclResult Sema::ActOnExplicitInstantiat
 if (!HasNoEffect) {
   // Instantiate static data member or variable template.
   Prev->setTemplateSpecializationKind(TSK, D.getIdentifierLoc());
-  if (PrevTemplate) {
-// Merge attributes.
-ProcessDeclAttributeList(S, Prev, D.getDeclSpec().getAttributes());
-  }
+  // Merge attributes.
+  ProcessDeclAttributeList(S, Prev, D.getDeclSpec().getAttributes());
   if (TSK == TSK_ExplicitInstantiationDefinition)
 InstantiateVariableDefinition(D.getIdentifierLoc(), Prev);
 }

Added: cfe/trunk/test/SemaCXX/attr-on-explicit-template-instantiation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-on-explicit-template-instantiation.cpp?rev=344146&view=auto
==
--- cfe/trunk/test/SemaCXX/attr-on-explicit-template-instantiation.cpp (added)
+++ cfe/trunk/test/SemaCXX/attr-on-explicit-template-instantiation.cpp Wed Oct 
10 08:32:29 2018
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+
+// PR39118
+// Make sure that attributes are properly applied to explicit template
+// instantiations.
+
+#define HIDDEN __attribute__((__visibility__("hidden")))
+#define VISIBLE __attribute__((__visibility__("default")))
+
+namespace ns HIDDEN {
+struct A { };
+template  struct B { static A a; };
+template  A B::a;
+
+// CHECK: @_ZN2ns1BIiE1aE = weak_odr global
+// CHECK-NOT: hidden
+template VISIBLE A B::a;
+}
+
+struct C { };
+template  struct D { static C c; };
+template  C D::c;
+
+// CHECK-DAG: @_ZN1DIiE1cB3TAGE
+template __attribute__((abi_tag("TAG"))) C D::c;


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


[PATCH] D52675: [clang] Properly apply attributes on explicit instantiations of static data members

2018-10-10 Thread Louis Dionne via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL344146: [clang] Properly apply attributes on explicit 
instantiations of static data… (authored by ldionne, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D52675?vs=167564&id=169020#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D52675

Files:
  cfe/trunk/lib/Sema/SemaTemplate.cpp
  cfe/trunk/test/SemaCXX/attr-on-explicit-template-instantiation.cpp


Index: cfe/trunk/test/SemaCXX/attr-on-explicit-template-instantiation.cpp
===
--- cfe/trunk/test/SemaCXX/attr-on-explicit-template-instantiation.cpp
+++ cfe/trunk/test/SemaCXX/attr-on-explicit-template-instantiation.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+
+// PR39118
+// Make sure that attributes are properly applied to explicit template
+// instantiations.
+
+#define HIDDEN __attribute__((__visibility__("hidden")))
+#define VISIBLE __attribute__((__visibility__("default")))
+
+namespace ns HIDDEN {
+struct A { };
+template  struct B { static A a; };
+template  A B::a;
+
+// CHECK: @_ZN2ns1BIiE1aE = weak_odr global
+// CHECK-NOT: hidden
+template VISIBLE A B::a;
+}
+
+struct C { };
+template  struct D { static C c; };
+template  C D::c;
+
+// CHECK-DAG: @_ZN1DIiE1cB3TAGE
+template __attribute__((abi_tag("TAG"))) C D::c;
Index: cfe/trunk/lib/Sema/SemaTemplate.cpp
===
--- cfe/trunk/lib/Sema/SemaTemplate.cpp
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp
@@ -9173,10 +9173,8 @@
 if (!HasNoEffect) {
   // Instantiate static data member or variable template.
   Prev->setTemplateSpecializationKind(TSK, D.getIdentifierLoc());
-  if (PrevTemplate) {
-// Merge attributes.
-ProcessDeclAttributeList(S, Prev, D.getDeclSpec().getAttributes());
-  }
+  // Merge attributes.
+  ProcessDeclAttributeList(S, Prev, D.getDeclSpec().getAttributes());
   if (TSK == TSK_ExplicitInstantiationDefinition)
 InstantiateVariableDefinition(D.getIdentifierLoc(), Prev);
 }


Index: cfe/trunk/test/SemaCXX/attr-on-explicit-template-instantiation.cpp
===
--- cfe/trunk/test/SemaCXX/attr-on-explicit-template-instantiation.cpp
+++ cfe/trunk/test/SemaCXX/attr-on-explicit-template-instantiation.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+
+// PR39118
+// Make sure that attributes are properly applied to explicit template
+// instantiations.
+
+#define HIDDEN __attribute__((__visibility__("hidden")))
+#define VISIBLE __attribute__((__visibility__("default")))
+
+namespace ns HIDDEN {
+struct A { };
+template  struct B { static A a; };
+template  A B::a;
+
+// CHECK: @_ZN2ns1BIiE1aE = weak_odr global
+// CHECK-NOT: hidden
+template VISIBLE A B::a;
+}
+
+struct C { };
+template  struct D { static C c; };
+template  C D::c;
+
+// CHECK-DAG: @_ZN1DIiE1cB3TAGE
+template __attribute__((abi_tag("TAG"))) C D::c;
Index: cfe/trunk/lib/Sema/SemaTemplate.cpp
===
--- cfe/trunk/lib/Sema/SemaTemplate.cpp
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp
@@ -9173,10 +9173,8 @@
 if (!HasNoEffect) {
   // Instantiate static data member or variable template.
   Prev->setTemplateSpecializationKind(TSK, D.getIdentifierLoc());
-  if (PrevTemplate) {
-// Merge attributes.
-ProcessDeclAttributeList(S, Prev, D.getDeclSpec().getAttributes());
-  }
+  // Merge attributes.
+  ProcessDeclAttributeList(S, Prev, D.getDeclSpec().getAttributes());
   if (TSK == TSK_ExplicitInstantiationDefinition)
 InstantiateVariableDefinition(D.getIdentifierLoc(), Prev);
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53038: [Hexagon] Use GetLinkerPath method instead of hard-coded linker name.

2018-10-10 Thread Sid Manning via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC344147: [Hexagon] Use GetLinkerPath instead of hard-coded 
string. (authored by sidneym, committed by ).

Repository:
  rC Clang

https://reviews.llvm.org/D53038

Files:
  lib/Driver/ToolChains/Hexagon.cpp
  lib/Driver/ToolChains/Hexagon.h


Index: lib/Driver/ToolChains/Hexagon.cpp
===
--- lib/Driver/ToolChains/Hexagon.cpp
+++ lib/Driver/ToolChains/Hexagon.cpp
@@ -369,9 +369,8 @@
   constructHexagonLinkArgs(C, JA, HTC, Output, Inputs, Args, CmdArgs,
LinkingOutput);
 
-  std::string Linker = HTC.GetProgramPath("hexagon-link");
-  C.addCommand(llvm::make_unique(JA, *this, 
Args.MakeArgString(Linker),
-  CmdArgs, Inputs));
+  const char *Exec = Args.MakeArgString(HTC.GetLinkerPath());
+  C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs));
 }
 // Hexagon tools end.
 
Index: lib/Driver/ToolChains/Hexagon.h
===
--- lib/Driver/ToolChains/Hexagon.h
+++ lib/Driver/ToolChains/Hexagon.h
@@ -81,6 +81,9 @@
   void addLibStdCxxIncludePaths(
   const llvm::opt::ArgList &DriverArgs,
   llvm::opt::ArgStringList &CC1Args) const override;
+
+  const char *getDefaultLinker() const override { return "hexagon-link"; }
+
   CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const 
override;
 
   StringRef GetGCCLibAndIncVersion() const { return GCCLibAndIncVersion.Text; }


Index: lib/Driver/ToolChains/Hexagon.cpp
===
--- lib/Driver/ToolChains/Hexagon.cpp
+++ lib/Driver/ToolChains/Hexagon.cpp
@@ -369,9 +369,8 @@
   constructHexagonLinkArgs(C, JA, HTC, Output, Inputs, Args, CmdArgs,
LinkingOutput);
 
-  std::string Linker = HTC.GetProgramPath("hexagon-link");
-  C.addCommand(llvm::make_unique(JA, *this, Args.MakeArgString(Linker),
-  CmdArgs, Inputs));
+  const char *Exec = Args.MakeArgString(HTC.GetLinkerPath());
+  C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs));
 }
 // Hexagon tools end.
 
Index: lib/Driver/ToolChains/Hexagon.h
===
--- lib/Driver/ToolChains/Hexagon.h
+++ lib/Driver/ToolChains/Hexagon.h
@@ -81,6 +81,9 @@
   void addLibStdCxxIncludePaths(
   const llvm::opt::ArgList &DriverArgs,
   llvm::opt::ArgStringList &CC1Args) const override;
+
+  const char *getDefaultLinker() const override { return "hexagon-link"; }
+
   CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
 
   StringRef GetGCCLibAndIncVersion() const { return GCCLibAndIncVersion.Text; }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r344147 - [Hexagon] Use GetLinkerPath instead of hard-coded string.

2018-10-10 Thread Sid Manning via cfe-commits
Author: sidneym
Date: Wed Oct 10 08:37:03 2018
New Revision: 344147

URL: http://llvm.org/viewvc/llvm-project?rev=344147&view=rev
Log:
[Hexagon] Use GetLinkerPath instead of hard-coded string.

Add GetLinkerPath and set the default to "hexagon-link".
Use GetLinkerPath instead of the hard-coded string.

This change will allow -fuse-ld to function correctly.

Differential revision: https://reviews.llvm.org/D53038

Modified:
cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp
cfe/trunk/lib/Driver/ToolChains/Hexagon.h

Modified: cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp?rev=344147&r1=344146&r2=344147&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp Wed Oct 10 08:37:03 2018
@@ -369,9 +369,8 @@ void hexagon::Linker::ConstructJob(Compi
   constructHexagonLinkArgs(C, JA, HTC, Output, Inputs, Args, CmdArgs,
LinkingOutput);
 
-  std::string Linker = HTC.GetProgramPath("hexagon-link");
-  C.addCommand(llvm::make_unique(JA, *this, 
Args.MakeArgString(Linker),
-  CmdArgs, Inputs));
+  const char *Exec = Args.MakeArgString(HTC.GetLinkerPath());
+  C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs));
 }
 // Hexagon tools end.
 

Modified: cfe/trunk/lib/Driver/ToolChains/Hexagon.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Hexagon.h?rev=344147&r1=344146&r2=344147&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Hexagon.h (original)
+++ cfe/trunk/lib/Driver/ToolChains/Hexagon.h Wed Oct 10 08:37:03 2018
@@ -81,6 +81,9 @@ public:
   void addLibStdCxxIncludePaths(
   const llvm::opt::ArgList &DriverArgs,
   llvm::opt::ArgStringList &CC1Args) const override;
+
+  const char *getDefaultLinker() const override { return "hexagon-link"; }
+
   CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const 
override;
 
   StringRef GetGCCLibAndIncVersion() const { return GCCLibAndIncVersion.Text; }


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


[PATCH] D52857: Deprecate 'set output foo' API of clang-query

2018-10-10 Thread Stephen Kelly via Phabricator via cfe-commits
steveire added a comment.

> I don't see this functionality being so critical that we need to deprecate 
> the existing spelling when there are backwards compatible options available, 
> which is why I'm opposed to this patch going in with the proposed syntax.

I don't think we're going to go anywhere except around in circles :). I don't 
see your comma separated syntax as viable. Maybe there is a third way that both 
of us don't see.

I tried to catch you on IRC without success. Thanks for the reviews! I 
appreciate your time. I'll see if I can find a different reviewer for this in a 
while.

Thanks,


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52857



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


[PATCH] D52418: [driver][mips] Enable integrated assembler for MIPS64 except N32 ABI selected

2018-10-10 Thread Simon Atanasyan via Phabricator via cfe-commits
atanasyan added a comment.

In https://reviews.llvm.org/D52418#1256189, @brad wrote:

> Simon, and what about lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp?


Good point. In fact, integrated assembler for GNUABIN32 was enabled in the 
`MipsMCAsmInfo` ctor by me and by mistake. I have another patch which fix it. 
But anyway there is a problem - we cannot check command line options in the 
`MipsMCAsmInfo`. So I'm going to test current MIPS N32 ABI implementation. 
Maybe we are ready to enable integrated assembler for it. In that case both 
`Generic_GCC::IsIntegratedAssemblerDefault()` and `MipsMCAsmInfo` ctor can be 
simplified.


Repository:
  rC Clang

https://reviews.llvm.org/D52418



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


[PATCH] D51464: clang: fix MIPS/N32 triple and paths

2018-10-10 Thread Simon Atanasyan via Phabricator via cfe-commits
atanasyan added a comment.

I'm going to test current MIPS N32 ABI implementation. Maybe we are ready to 
enable integrated assembler for it. In that case both 
`Generic_GCC::IsIntegratedAssemblerDefault()` and `MipsMCAsmInfo` ctor can be 
simplified.


https://reviews.llvm.org/D51464



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


r344148 - [OpenCL] Fixed address space cast in C style cast of C++ parsing

2018-10-10 Thread Anastasia Stulova via cfe-commits
Author: stulova
Date: Wed Oct 10 09:05:22 2018
New Revision: 344148

URL: http://llvm.org/viewvc/llvm-project?rev=344148&view=rev
Log:
[OpenCL] Fixed address space cast in C style cast of C++ parsing

C style cast in OpenCL C++ was ignoring the address space
conversions from OpenCL C and as a result accepting incorrect
code to compile. This commit adds special function for checking 
correctness of address spaces that is shared between C and C++
casts.
 

Modified:
cfe/trunk/lib/Sema/SemaCast.cpp
cfe/trunk/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
cfe/trunk/test/SemaOpenCL/address-spaces.cl

Modified: cfe/trunk/lib/Sema/SemaCast.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCast.cpp?rev=344148&r1=344147&r2=344148&view=diff
==
--- cfe/trunk/lib/Sema/SemaCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCast.cpp Wed Oct 10 09:05:22 2018
@@ -131,6 +131,9 @@ namespace {
   return PlaceholderKind == K;
 }
 
+// Language specific cast restrictions for address spaces.
+void checkAddressSpaceCast(QualType SrcType, QualType DestType);
+
 void checkCastAlign() {
   Self.CheckCastAlign(SrcExpr.get(), DestType, OpRange);
 }
@@ -2276,6 +2279,27 @@ static TryCastResult TryReinterpretCast(
   return SuccessResult;
 }
 
+void CastOperation::checkAddressSpaceCast(QualType SrcType, QualType DestType) 
{
+  // In OpenCL only conversions between pointers to objects in overlapping
+  // addr spaces are allowed. v2.0 s6.5.5 - Generic addr space overlaps
+  // with any named one, except for constant.
+  if (Self.getLangOpts().OpenCL) {
+auto SrcPtrType = SrcType->getAs();
+if (!SrcPtrType)
+  return;
+auto DestPtrType = DestType->getAs();
+if (!DestPtrType)
+  return;
+if (!DestPtrType->isAddressSpaceOverlapping(*SrcPtrType)) {
+  Self.Diag(OpRange.getBegin(),
+diag::err_typecheck_incompatible_address_space)
+  << SrcType << DestType << Sema::AA_Casting
+  << SrcExpr.get()->getSourceRange();
+  SrcExpr = ExprError();
+}
+  }
+}
+
 void CastOperation::CheckCXXCStyleCast(bool FunctionalStyle,
bool ListInitialization) {
   assert(Self.getLangOpts().CPlusPlus);
@@ -2403,6 +2427,8 @@ void CastOperation::CheckCXXCStyleCast(b
 }
   }
 
+  checkAddressSpaceCast(SrcExpr.get()->getType(), DestType);
+
   if (isValidCast(tcr)) {
 if (Kind == CK_BitCast)
   checkCastAlign();
@@ -2489,20 +2515,9 @@ void CastOperation::CheckCStyleCast() {
 
   assert(!SrcType->isPlaceholderType());
 
-  // OpenCL v1 s6.5: Casting a pointer to address space A to a pointer to
-  // address space B is illegal.
-  if (Self.getLangOpts().OpenCL && DestType->isPointerType() &&
-  SrcType->isPointerType()) {
-const PointerType *DestPtr = DestType->getAs();
-if (!DestPtr->isAddressSpaceOverlapping(*SrcType->getAs())) {
-  Self.Diag(OpRange.getBegin(),
-diag::err_typecheck_incompatible_address_space)
-  << SrcType << DestType << Sema::AA_Casting
-  << SrcExpr.get()->getSourceRange();
-  SrcExpr = ExprError();
-  return;
-}
-  }
+  checkAddressSpaceCast(SrcType, DestType);
+  if (SrcExpr.isInvalid())
+return;
 
   if (Self.RequireCompleteType(OpRange.getBegin(), DestType,
diag::err_typecheck_cast_to_incomplete)) {

Modified: cfe/trunk/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl?rev=344148&r1=344147&r2=344148&view=diff
==
--- cfe/trunk/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl (original)
+++ cfe/trunk/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl Wed Oct 10 
09:05:22 2018
@@ -1,6 +1,9 @@
 // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only 
-DCONSTANT -cl-std=CL2.0
 // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only 
-DGLOBAL -cl-std=CL2.0
 // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only 
-DGENERIC -cl-std=CL2.0
+// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only 
-DCONSTANT -cl-std=c++
+// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only 
-DGLOBAL -cl-std=c++
+// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only 
-DGENERIC -cl-std=c++
 
 /* OpenCLC v2.0 adds a set of restrictions for conversions between pointers to
 *  different address spaces, mainly described in Sections 6.5.5 and 6.5.6.
@@ -17,71 +20,111 @@
 */
 
 #ifdef GENERIC
-#define AS generic
-#define AS_COMP local
-#define AS_INCOMP constant
+#define AS __generic
+#define AS_COMP __local
+#define AS_INCOMP __constant
 #endif
 
 #ifdef GLOBAL
-#define AS global
-#define AS_COMP global
-#d

[PATCH] D52598: [OpenCL] Fixed address space cast in C style cast of C++ parsing

2018-10-10 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia closed this revision.
Anastasia added a comment.

Committed in r344148. The review link was forgotten and therefore didn't get 
closed automatically.


https://reviews.llvm.org/D52598



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


[PATCH] D52891: [AMDGPU] Add -fvisibility-amdgpu-non-kernel-functions

2018-10-10 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

In https://reviews.llvm.org/D52891#1258070, @scott.linder wrote:

> I will update the patch to modify the HIP toolchain and to add tests for 
> global variables.
>
> As far as the semantics are concerned, are we OK with this being AMDGPU only? 
> I do not see a means of determining what is a "kernel" in a language-agnostic 
> way other than checking for our AMDGPU-specific calling convention. If there 
> is a more general mechanism, this could be implemented in 
> `LinkageComputer::getLVForNamespaceScopeDecl` instead. As it stands, it 
> sounds like being AMDGPU specific, but omitting `amdgpu` from the option name 
> is preferred?


The checking of kernel functions can be made target independent. For now we 
only need to consider OpenCL and CUDA/HIP.  We can check function attribute 
AT_CUDAGlobal and AT_OpenCLKernel. Then this option can be made target 
independent. HCC can add its own check out of tree.

> What about:
> 
>   -fvisibility-non-offload-functions=

This name looks good to me.


https://reviews.llvm.org/D52891



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


[PATCH] D46441: [clang][CodeGenCXX] Noalias attr for 'this' parameter

2018-10-10 Thread Anton Bikineev via Phabricator via cfe-commits
AntonBikineev added a comment.

@rsmith, thanks. Le'ts see if there is a need for the command-line option down 
the road.


Repository:
  rL LLVM

https://reviews.llvm.org/D46441



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


[PATCH] D42242: Make libc++abi work with gcc's ARM unwind library

2018-10-10 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists closed this revision.
mclow.lists added a comment.

Committed as revision 344152


https://reviews.llvm.org/D42242



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


[PATCH] D52418: [driver][mips] Enable integrated assembler for MIPS64 except N32 ABI selected

2018-10-10 Thread Brad Smith via Phabricator via cfe-commits
brad added a comment.

IMHO it would be best to try and deal with as many known / exposed issues with 
the N32 support and then just enable IAS across the board. Then tackle any 
remaining issues as they come up.


Repository:
  rC Clang

https://reviews.llvm.org/D52418



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


[PATCH] D52784: [ARM][AArch64] Pass through endianness flags to the GNU assembler

2018-10-10 Thread Peter Smith via Phabricator via cfe-commits
peter.smith added a comment.

Ping. Does anyone have any changes they'd like me to make?


https://reviews.llvm.org/D52784



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


r344157 - [Sema] Fix a multiple definition bug with friends and templates

2018-10-10 Thread Erik Pilkington via cfe-commits
Author: epilk
Date: Wed Oct 10 10:17:51 2018
New Revision: 344157

URL: http://llvm.org/viewvc/llvm-project?rev=344157&view=rev
Log:
[Sema] Fix a multiple definition bug with friends and templates

The problem was that MergeFunctionDecl sometimes needs the injected template
arguments of a FunctionTemplateDecl, but is called before adding the new
template to the redecl chain. This leads to multiple common pointers in the same
redecl chain, each with their own identical instantiation. Fix this by merging
the the common state before inserting the new template into the redecl chain.

rdar://44810129

Differential revision: https://reviews.llvm.org/D53046

Added:
cfe/trunk/test/SemaCXX/friend-template-redecl.cpp
Modified:
cfe/trunk/include/clang/AST/DeclTemplate.h
cfe/trunk/lib/AST/DeclTemplate.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=344157&r1=344156&r2=344157&view=diff
==
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Wed Oct 10 10:17:51 2018
@@ -1093,6 +1093,9 @@ public:
   /// template.
   ArrayRef getInjectedTemplateArgs();
 
+  /// Merge our RedeclarableTemplateDecl::Common with \param Prev.
+  void mergePrevDecl(FunctionTemplateDecl *Prev);
+
   /// Create a function template node.
   static FunctionTemplateDecl *Create(ASTContext &C, DeclContext *DC,
   SourceLocation L,

Modified: cfe/trunk/lib/AST/DeclTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclTemplate.cpp?rev=344157&r1=344156&r2=344157&view=diff
==
--- cfe/trunk/lib/AST/DeclTemplate.cpp (original)
+++ cfe/trunk/lib/AST/DeclTemplate.cpp Wed Oct 10 10:17:51 2018
@@ -300,6 +300,42 @@ ArrayRef FunctionTempl
   return llvm::makeArrayRef(CommonPtr->InjectedArgs, Params->size());
 }
 
+void FunctionTemplateDecl::mergePrevDecl(FunctionTemplateDecl *Prev) {
+  using Base = RedeclarableTemplateDecl;
+
+  // If we haven't created a common pointer yet, then it can just be created
+  // with the usual method.
+  if (!Base::Common)
+return;
+
+  Common *ThisCommon = static_cast(Base::Common);
+  Common *PrevCommon = nullptr;
+  SmallVector PreviousDecls;
+  for (; Prev; Prev = Prev->getPreviousDecl()) {
+if (Prev->Base::Common) {
+  PrevCommon = static_cast(Prev->Base::Common);
+  break;
+}
+PreviousDecls.push_back(Prev);
+  }
+
+  // If the previous redecl chain hasn't created a common pointer yet, then 
just
+  // use this common pointer.
+  if (!PrevCommon) {
+for (auto *D : PreviousDecls)
+  D->Base::Common = ThisCommon;
+return;
+  }
+
+  // Ensure we don't leak any important state.
+  assert(ThisCommon->Specializations.size() == 0 &&
+ !ThisCommon->InstantiatedFromMember.getPointer() &&
+ !ThisCommon->InstantiatedFromMember.getInt() &&
+ "Can't merge incompatible declarations!");
+
+  Base::Common = PrevCommon;
+}
+
 
//===--===//
 // ClassTemplateDecl Implementation
 
//===--===//

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=344157&r1=344156&r2=344157&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Oct 10 10:17:51 2018
@@ -10022,11 +10022,17 @@ bool Sema::CheckFunctionDeclaration(Scop
 if (FunctionTemplateDecl *OldTemplateDecl =
 dyn_cast(OldDecl)) {
   auto *OldFD = OldTemplateDecl->getTemplatedDecl();
-  NewFD->setPreviousDeclaration(OldFD);
-  adjustDeclContextForDeclaratorDecl(NewFD, OldFD);
   FunctionTemplateDecl *NewTemplateDecl
 = NewFD->getDescribedFunctionTemplate();
   assert(NewTemplateDecl && "Template/non-template mismatch");
+
+  // The call to MergeFunctionDecl above may have created some state in
+  // NewTemplateDecl that needs to be merged with OldTemplateDecl before we
+  // can add it as a redeclaration.
+  NewTemplateDecl->mergePrevDecl(OldTemplateDecl);
+
+  NewFD->setPreviousDeclaration(OldFD);
+  adjustDeclContextForDeclaratorDecl(NewFD, OldFD);
   if (NewFD->isCXXClassMember()) {
 NewFD->setAccess(OldTemplateDecl->getAccess());
 NewTemplateDecl->setAccess(OldTemplateDecl->getAccess());

Added: cfe/trunk/test/SemaCXX/friend-template-redecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/friend-template-redecl.cpp?rev=344157&view=auto
===

[PATCH] D53046: [Sema] Fix an error-on-valid with friends and templates

2018-10-10 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL344157: [Sema] Fix a multiple definition bug with friends 
and templates (authored by epilk, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D53046?vs=168939&id=169037#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D53046

Files:
  cfe/trunk/include/clang/AST/DeclTemplate.h
  cfe/trunk/lib/AST/DeclTemplate.cpp
  cfe/trunk/lib/Sema/SemaDecl.cpp
  cfe/trunk/test/SemaCXX/friend-template-redecl.cpp

Index: cfe/trunk/lib/AST/DeclTemplate.cpp
===
--- cfe/trunk/lib/AST/DeclTemplate.cpp
+++ cfe/trunk/lib/AST/DeclTemplate.cpp
@@ -300,6 +300,42 @@
   return llvm::makeArrayRef(CommonPtr->InjectedArgs, Params->size());
 }
 
+void FunctionTemplateDecl::mergePrevDecl(FunctionTemplateDecl *Prev) {
+  using Base = RedeclarableTemplateDecl;
+
+  // If we haven't created a common pointer yet, then it can just be created
+  // with the usual method.
+  if (!Base::Common)
+return;
+
+  Common *ThisCommon = static_cast(Base::Common);
+  Common *PrevCommon = nullptr;
+  SmallVector PreviousDecls;
+  for (; Prev; Prev = Prev->getPreviousDecl()) {
+if (Prev->Base::Common) {
+  PrevCommon = static_cast(Prev->Base::Common);
+  break;
+}
+PreviousDecls.push_back(Prev);
+  }
+
+  // If the previous redecl chain hasn't created a common pointer yet, then just
+  // use this common pointer.
+  if (!PrevCommon) {
+for (auto *D : PreviousDecls)
+  D->Base::Common = ThisCommon;
+return;
+  }
+
+  // Ensure we don't leak any important state.
+  assert(ThisCommon->Specializations.size() == 0 &&
+ !ThisCommon->InstantiatedFromMember.getPointer() &&
+ !ThisCommon->InstantiatedFromMember.getInt() &&
+ "Can't merge incompatible declarations!");
+
+  Base::Common = PrevCommon;
+}
+
 //===--===//
 // ClassTemplateDecl Implementation
 //===--===//
Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -10022,11 +10022,17 @@
 if (FunctionTemplateDecl *OldTemplateDecl =
 dyn_cast(OldDecl)) {
   auto *OldFD = OldTemplateDecl->getTemplatedDecl();
-  NewFD->setPreviousDeclaration(OldFD);
-  adjustDeclContextForDeclaratorDecl(NewFD, OldFD);
   FunctionTemplateDecl *NewTemplateDecl
 = NewFD->getDescribedFunctionTemplate();
   assert(NewTemplateDecl && "Template/non-template mismatch");
+
+  // The call to MergeFunctionDecl above may have created some state in
+  // NewTemplateDecl that needs to be merged with OldTemplateDecl before we
+  // can add it as a redeclaration.
+  NewTemplateDecl->mergePrevDecl(OldTemplateDecl);
+
+  NewFD->setPreviousDeclaration(OldFD);
+  adjustDeclContextForDeclaratorDecl(NewFD, OldFD);
   if (NewFD->isCXXClassMember()) {
 NewFD->setAccess(OldTemplateDecl->getAccess());
 NewTemplateDecl->setAccess(OldTemplateDecl->getAccess());
Index: cfe/trunk/include/clang/AST/DeclTemplate.h
===
--- cfe/trunk/include/clang/AST/DeclTemplate.h
+++ cfe/trunk/include/clang/AST/DeclTemplate.h
@@ -1093,6 +1093,9 @@
   /// template.
   ArrayRef getInjectedTemplateArgs();
 
+  /// Merge our RedeclarableTemplateDecl::Common with \param Prev.
+  void mergePrevDecl(FunctionTemplateDecl *Prev);
+
   /// Create a function template node.
   static FunctionTemplateDecl *Create(ASTContext &C, DeclContext *DC,
   SourceLocation L,
Index: cfe/trunk/test/SemaCXX/friend-template-redecl.cpp
===
--- cfe/trunk/test/SemaCXX/friend-template-redecl.cpp
+++ cfe/trunk/test/SemaCXX/friend-template-redecl.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -std=c++17 -verify -emit-llvm-only %s
+
+// expected-no-diagnostics
+
+template  void bar(const T &t) { foo(t); }
+
+template 
+struct HasFriend {
+  template 
+  friend void foo(const HasFriend &m) noexcept(false);
+};
+
+template 
+void foo(const HasFriend &m) noexcept(false) {}
+
+void f() {
+  HasFriend x;
+  foo(x);
+  bar(x);
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53076: [analyzer] WIP: Enhance ConditionBRVisitor to write out more information

2018-10-10 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov added a comment.

The change makes sense to me, but:

1. Note that "Assuming X" directives are useful for the analyzer developers, 
since they know that's where the checker makes arbitrary assumptions, but to 
end users that mostly feels like noise ("Taking true branch" is there already, 
why there should be "Assuming 'i' is > 0" as well?)

2. @NoQ do you know why the GDM comparison was there in the first place? The 
commit was made by Ted in 2011, maybe constraint changes had to be reflected in 
the GDM at that point (?)


https://reviews.llvm.org/D53076



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


[PATCH] D52857: Deprecate 'set output foo' API of clang-query

2018-10-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

@steveire and I chatted over IRC and I wanted to capture another alternate 
proposal idea as part of the review (we did not reach agreement on this 
proposal, however). I've provided it side-by-side with the other proposals for 
comparison purposes.

  # Original proposal
  set dump-output true
  match foo(bar(baz())) # Uses one output format
  match bar(foo()) # Uses one output format
  set diag-output true
  set matcher-output true
  match foo(bar(baz())) # Uses all three output formats
  match bar(foo()) # Uses all three output formats
  set diag-output false
  set dump-output false
  match foo(bar(baz())) # Uses only matcher output
   
  # First Alternative
  set output dump
  match foo(bar(baz())) # Uses one output format
  match bar(foo()) # Uses one output format
  set output dump, diag, matcher
  match foo(bar(baz())) # Uses all three output formats
  match bar(foo()) # Uses all three output formats
  set output matcher
  match foo(bar(baz())) # Uses only matcher output
   
  # Second Alternative
  set output dump
  match foo(bar(baz())) # Uses one output format
  match bar(foo()) # Uses one output format
  set output diag toggle on
  set output matcher toggle on
  match foo(bar(baz())) # Uses all three output formats
  match bar(foo()) # Uses all three output formats
  set output matcher
  match foo(bar(baz())) # Uses only matcher output


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52857



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


[PATCH] D52676: [clang-format] tweaked another case of lambda formatting

2018-10-10 Thread Oleg Smolsky via Phabricator via cfe-commits
oleg.smolsky added a comment.

@djasper @klimek could you chime in please? This patch strives to cleanup a 
quirk in lambda formatting which pushes code too far to the right. Here is the 
problematic case:

  void f() {
something.something.something.Method(some_arg,
 [] {
 // the code here incurs
 // excessive wrapping
 // such as
 Method(
 some_med_arg,
 some_med_arg);
 some_var =
 some_expr + something;
});

Here everything is technically correct, yet the code looks bad due to excessive 
wrapping. Things look a lot better when the lambda body starts from a new line, 
which happens already in some cases. The patch this "from the next line" onto a 
few more cases.

The full discussion of the cases with @krasimir is above.

Thanks!


Repository:
  rC Clang

https://reviews.llvm.org/D52676



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


r344159 - [clang] Fix failing attribute test on Windows

2018-10-10 Thread Louis Dionne via cfe-commits
Author: ldionne
Date: Wed Oct 10 10:37:37 2018
New Revision: 344159

URL: http://llvm.org/viewvc/llvm-project?rev=344159&view=rev
Log:
[clang] Fix failing attribute test on Windows

The test added in r344146 was failing because the ABI on Windows is
different, and that test includes ABI-specific details. The test now
harcodes which ABI to use so we can rely on those details.

Modified:
cfe/trunk/test/SemaCXX/attr-on-explicit-template-instantiation.cpp

Modified: cfe/trunk/test/SemaCXX/attr-on-explicit-template-instantiation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-on-explicit-template-instantiation.cpp?rev=344159&r1=344158&r2=344159&view=diff
==
--- cfe/trunk/test/SemaCXX/attr-on-explicit-template-instantiation.cpp 
(original)
+++ cfe/trunk/test/SemaCXX/attr-on-explicit-template-instantiation.cpp Wed Oct 
10 10:37:37 2018
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - | 
FileCheck %s
 
 // PR39118
 // Make sure that attributes are properly applied to explicit template


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


[PATCH] D53069: [analyzer][www] Update avaible_checks.html

2018-10-10 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov requested changes to this revision.
george.karpenkov added a comment.
This revision now requires changes to proceed.
Herald added a subscriber: donat.nagy.

Great idea, thanks!

Should be good to go once examples are added, and implicit checks are removed.




Comment at: www/analyzer/available_checks.html:770
+(ObjC)
+Check for proper uses of Objective-C properties
+

`proper uses` is not particularly descriptive?



Comment at: www/analyzer/available_checks.html:884
+
+
+

Yep, not very useful without an example. I'm pretty sure the code and tests 
have one.



Comment at: www/analyzer/available_checks.html:988
 
+
+

Yeah, doesn't seem useful to the user.


https://reviews.llvm.org/D53069



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


[PATCH] D53069: [analyzer][www] Update avaible_checks.html

2018-10-10 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added a comment.

Well, the reason why I didn't add tests for these, is that I know so little of 
ObjC, I am not even sure when a test case begins and ends. I could go ahead and 
google something about the language, but for a site that advertises to find 
bugs, maybe someone with more expertise should do the explanation.

Can someone fill those couple bits in? I tried, but fell flat on my face.




Comment at: www/analyzer/available_checks.html:770
+(ObjC)
+Check for proper uses of Objective-C properties
+

george.karpenkov wrote:
> `proper uses` is not particularly descriptive?
Well, I copied it from the actual checker description :/ I genuinely have no 
idea how properties work in ObjC, so I can't really update it on my own.


https://reviews.llvm.org/D53069



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


[PATCH] D52984: [analyzer] Checker reviewer's checklist

2018-10-10 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov added a comment.
Herald added a subscriber: donat.nagy.

@Szelethus @xazax.hun Since you guys are looking into the website, do you know 
why the top bar has disappeared from all pages? (E.g. 
http://clang-analyzer.llvm.org/available_checks.html )


https://reviews.llvm.org/D52984



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


[PATCH] D46027: [clang-tidy] Fix PR35824

2018-10-10 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment.

In https://reviews.llvm.org/D46027#1259989, @ZaMaZaN4iK wrote:

> What is the status of the PR?


I believe xazax doesnt have time to work further, you can commandeer if you 
want :)


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D46027



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


[PATCH] D52984: [analyzer] Checker reviewer's checklist

2018-10-10 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added a comment.

I noticed it too, it's already on my TODO list. Didn't look into the causes 
just yet though.


https://reviews.llvm.org/D52984



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


[PATCH] D52784: [ARM][AArch64] Pass through endianness flags to the GNU assembler

2018-10-10 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment.

I think we should pass these flags along to the linker, too. Not just the 
assembler.  Maybe within tools::gnutools::Linker::ConstructJob() within 
lib/Driver/ToolChains/Gnu.cpp?


https://reviews.llvm.org/D52784



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


[PATCH] D52193: RFC: [clang] Multithreaded compilation support

2018-10-10 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea added a comment.

Updated tests again. This time I've closed all applications, all unused 
services, and tried to have a "clean" machine.

New timings without the child `clang-cl.exe` being invoked (hacked from 
https://reviews.llvm.org/D52411). The test consists in building Clang+LLVM+LLD 
at r343846 using the compiler specified on each line of the table.

**Config 1:** Intel Xeon Haswell 6 cores / 12 HW threads, 3.5 GHz, 15 MB cache, 
128 GB RAM, SSD 550 MB/s (Windows 10 Fall Creators update 1709)

__Ninja:__

| MSVC 15.8.6 (cl + link)   
  | 29 min 4 sec  |
| clang-cl + lld-link 7.0 official release  
  | 25 min 45 sec |
| clang-cl + lld-link 8.0 r343846 //built with clang-cl 7.0 official// **(no 
child)** | **23 min 27 sec** |
|

**Config 2:** Intel Xeon Skylake 18 cores / 36 HW threads, x2 (Dual CPU), 72 HW 
threads total, 2.3 GHz, 24.75 MB cache each, 128 GB RAM, NVMe SSD 4.6 GB/s 
(Windows 10 Fall Creators update 1709)

__Ninja:__

| MSVC 15.8.6 (cl + link)   
  | 6 min 40 sec |
| clang-cl + lld-link 7.0 official release  
  | 6 min 24 sec |
| clang-cl + lld-link 8.0 r343846 //built with clang-cl 7.0 official// **(no 
child)** | **5 min 10 sec** |
|

I'm wondering if the improvement is of the same order on Linux. I'd be 
interested to see your build times, out of curiosity? Can any of you try it 
with and without https://reviews.llvm.org/D52411?


Repository:
  rC Clang

https://reviews.llvm.org/D52193



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


[PATCH] D53100: clang: Add ARCTargetInfo

2018-10-10 Thread Tatyana Krasnukha via Phabricator via cfe-commits
tatyana-krasnukha created this revision.
tatyana-krasnukha added reviewers: petecoup, rjmccall, rsmith.
tatyana-krasnukha added a project: clang.
Herald added subscribers: cfe-commits, mgorny.

This patch is an updated version of https://reviews.llvm.org/D43089 with 
changes in arguments classifying. If a calling convention item is not specified 
by ARC ABI, it follows Itanium C++ ABI.


Repository:
  rC Clang

https://reviews.llvm.org/D53100

Files:
  lib/Basic/CMakeLists.txt
  lib/Basic/Targets.cpp
  lib/Basic/Targets/ARC.cpp
  lib/Basic/Targets/ARC.h
  lib/CodeGen/TargetInfo.cpp
  test/CodeGen/arc/arguments.c
  test/CodeGen/arc/struct-align.c
  test/CodeGen/target-data.c

Index: test/CodeGen/target-data.c
===
--- test/CodeGen/target-data.c
+++ test/CodeGen/target-data.c
@@ -151,6 +151,10 @@
 // RUN: %s | FileCheck %s -check-prefix=ARM-GNU
 // ARM-GNU: target datalayout = "e-m:e-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
 
+// RUN: %clang_cc1 -triple arc-unknown-unknown -o - -emit-llvm %s | \
+// RUN: FileCheck %s -check-prefix=ARC
+// ARC: target datalayout = "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-f32:32:32-i64:32-f64:32-a:0:32-n32"
+
 // RUN: %clang_cc1 -triple hexagon-unknown -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=HEXAGON
 // HEXAGON: target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
Index: test/CodeGen/arc/struct-align.c
===
--- test/CodeGen/arc/struct-align.c
+++ test/CodeGen/arc/struct-align.c
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -triple arc-unknown-unknown %s -emit-llvm -o - \
+// RUN:   | FileCheck %s
+
+// 64-bit fields need only be 32-bit aligned for arc.
+
+typedef struct {
+  int aa;
+  double bb;
+} s1;
+
+// CHECK: define i32 @f1
+// CHECK: ret i32 12
+int f1() {
+  return sizeof(s1);
+}
+
+typedef struct {
+  int aa;
+  long long bb;
+} s2;
+// CHECK: define i32 @f2
+// CHECK: ret i32 12
+int f2() {
+  return sizeof(s2);
+}
+
Index: test/CodeGen/arc/arguments.c
===
--- test/CodeGen/arc/arguments.c
+++ test/CodeGen/arc/arguments.c
@@ -0,0 +1,135 @@
+// RUN: %clang_cc1 -triple arc-unknown-unknown %s -emit-llvm -o - \
+// RUN:   | FileCheck %s
+
+// Basic argument tests for ARC.
+
+// CHECK: define void @f0(i32 inreg %i, i32 inreg %j, i32 inreg %k.coerce0, i32 inreg %k.coerce1)
+void f0(int i, long j, long long k) {}
+
+typedef struct {
+  int aa;
+  int bb;
+} s1;
+// CHECK: define void @f1(i32 inreg %i.coerce0, i32 inreg %i.coerce1)
+void f1(s1 i) {}
+
+typedef struct {
+  char aa; char bb; char cc; char dd;
+} cs1;
+// CHECK: define void @cf1(i32 inreg %i.coerce)
+void cf1(cs1 i) {}
+
+typedef struct {
+  int cc;
+} s2;
+// CHECK: define void @f2(%struct.s2* noalias sret %agg.result)
+s2 f2() {
+  s2 foo;
+  return foo;
+}
+
+typedef struct {
+  int cc;
+  int dd;
+} s3;
+// CHECK: define void @f3(%struct.s3* noalias sret %agg.result)
+s3 f3() {
+  s3 foo;
+  return foo;
+}
+
+// CHECK: define void @f4(i32 inreg %i.coerce0, i32 inreg %i.coerce1)
+void f4(long long i) {}
+
+// CHECK: define void @f5(i8 inreg signext %a, i16 inreg signext %b)
+void f5(signed char a, short b) {}
+
+// CHECK: define void @f6(i8 inreg zeroext %a, i16 inreg zeroext %b)
+void f6(unsigned char a, unsigned short b) {}
+
+enum my_enum {
+  ENUM1,
+  ENUM2,
+  ENUM3,
+};
+// Enums should be treated as the underlying i32.
+// CHECK: define void @f7(i32 inreg %a)
+void f7(enum my_enum a) {}
+
+enum my_big_enum {
+  ENUM4 = 0x,
+};
+// Big enums should be treated as the underlying i64.
+// CHECK: define void @f8(i32 inreg %a.coerce0, i32 inreg %a.coerce1)
+void f8(enum my_big_enum a) {}
+
+union simple_union {
+  int a;
+  char b;
+};
+// Unions should be passed inreg.
+// CHECK: define void @f9(i32 inreg %s.coerce)
+void f9(union simple_union s) {}
+
+typedef struct {
+  int b4 : 4;
+  int b3 : 3;
+  int b8 : 8;
+} bitfield1;
+// Bitfields should be passed inreg.
+// CHECK: define void @f10(i32 inreg %bf1.coerce)
+void f10(bitfield1 bf1) {}
+
+// CHECK: define inreg { float, float } @cplx1(float inreg %r)
+_Complex float cplx1(float r) {
+  return r + 2.0fi;
+}
+
+// CHECK: define inreg { double, double } @cplx2(i32 inreg %r.coerce0, i32 inreg %r.coerce1)
+_Complex double cplx2(double r) {
+  return r + 2.0i;
+}
+
+// CHECK: define inreg { i32, i32 } @cplx3(i32 inreg %r)
+_Complex int cplx3(int r) {
+  return r + 2i;
+}
+
+// CHECK: define inreg { i64, i64 } @cplx4(i32 inreg %r.coerce0, i32 inreg %r.coerce1)
+_Complex long long cplx4(long long r) {
+  return r + 2i;
+}
+
+// CHECK: define inreg { i8, i8 } @cplx6(i8 inreg signext %r)
+_Complex signed char cplx6(signed char r) {
+  return r + 2i;
+}
+
+// CHECK: define inreg { i16, i16 } @cplx7(i16 inre

[PATCH] D53076: [analyzer] WIP: Enhance ConditionBRVisitor to write out more information

2018-10-10 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso added subscribers: baloghadamsoftware, whisperity.
Charusso added a comment.

In https://reviews.llvm.org/D53076#1260663, @george.karpenkov wrote:

> The change makes sense to me, but:
>
> 1. Note that "Assuming X" directives are useful for the analyzer developers, 
> since they know that's where the checker makes arbitrary assumptions, but to 
> end users that mostly feels like noise ("Taking true branch" is there 
> already, why there should be "Assuming 'i' is > 0" as well?)
> 2. @NoQ do you know why the GDM comparison was there in the first place? The 
> commit was made by Ted in 2011, maybe constraint changes had to be reflected 
> in the GDM at that point (?)


Based on @baloghadamsoftware's idea (https://reviews.llvm.org/D34508) the main 
goal is to print out trivial values for the Clang SA, but lot of time consuming 
nonsense for developers. As you mentioned it is bad to have multiple 
assumptions, but half of the reporters behave like that, and the other half 
does not print any/useful information.

That two separate project based on that current project: **create** the 
reports, and make the style identical, so that we could enhance them. The best 
example here is `test/Analysis/diagnostics/macros.cpp`: on line 27 you could 
see the message `Assuming the condition is true` but the upper conditions miss 
this report.


https://reviews.llvm.org/D53076



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


Re: [PATCH] D52193: RFC: [clang] Multithreaded compilation support

2018-10-10 Thread Zachary Turner via cfe-commits
I can try to get some timings from my machine.  How do we handle crash
recovery in the case where we don't spawn a child process?  I thought the
whole reason for spawning the cc1 driver as a separate process was so that
we could collect and report crash information in a nice way.  Not having
that seems like a heavy price to pay.

On Wed, Oct 10, 2018 at 11:34 AM Alexandre Ganea via Phabricator <
revi...@reviews.llvm.org> wrote:

> aganea added a comment.
>
> Updated tests again. This time I've closed all applications, all unused
> services, and tried to have a "clean" machine.
>
> New timings without the child `clang-cl.exe` being invoked (hacked from
> https://reviews.llvm.org/D52411). The test consists in building
> Clang+LLVM+LLD at r343846 using the compiler specified on each line of the
> table.
>
> **Config 1:** Intel Xeon Haswell 6 cores / 12 HW threads, 3.5 GHz, 15 MB
> cache, 128 GB RAM, SSD 550 MB/s (Windows 10 Fall Creators update 1709)
>
> __Ninja:__
>
> | MSVC 15.8.6 (cl + link)
>| 29 min 4 sec  |
> | clang-cl + lld-link 7.0 official release
> | 25 min 45 sec |
> | clang-cl + lld-link 8.0 r343846 //built with clang-cl 7.0 official//
> **(no child)** | **23 min 27 sec** |
> |
>
> **Config 2:** Intel Xeon Skylake 18 cores / 36 HW threads, x2 (Dual CPU),
> 72 HW threads total, 2.3 GHz, 24.75 MB cache each, 128 GB RAM, NVMe SSD 4.6
> GB/s (Windows 10 Fall Creators update 1709)
>
> __Ninja:__
>
> | MSVC 15.8.6 (cl + link)
>| 6 min 40 sec |
> | clang-cl + lld-link 7.0 official release
> | 6 min 24 sec |
> | clang-cl + lld-link 8.0 r343846 //built with clang-cl 7.0 official//
> **(no child)** | **5 min 10 sec** |
> |
>
> I'm wondering if the improvement is of the same order on Linux. I'd be
> interested to see your build times, out of curiosity? Can any of you try it
> with and without https://reviews.llvm.org/D52411?
>
>
> Repository:
>   rC Clang
>
> https://reviews.llvm.org/D52193
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52193: RFC: [clang] Multithreaded compilation support

2018-10-10 Thread Zachary Turner via Phabricator via cfe-commits
zturner added a comment.

I can try to get some timings from my machine.  How do we handle crash
recovery in the case where we don't spawn a child process?  I thought the
whole reason for spawning the cc1 driver as a separate process was so that
we could collect and report crash information in a nice way.  Not having
that seems like a heavy price to pay.


Repository:
  rC Clang

https://reviews.llvm.org/D52193



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


[PATCH] D53101: [ARC] Add option for enabling reduced register file mode

2018-10-10 Thread Tatyana Krasnukha via Phabricator via cfe-commits
tatyana-krasnukha created this revision.
tatyana-krasnukha added a reviewer: petecoup.
tatyana-krasnukha added a project: clang.
Herald added subscribers: cfe-commits, mgorny.
tatyana-krasnukha added a dependency: D53100: clang: Add ARCTargetInfo.

This option affects registers count for passing arguments.


Repository:
  rC Clang

https://reviews.llvm.org/D53101

Files:
  include/clang/Driver/Options.td
  lib/Basic/CMakeLists.txt
  lib/Basic/Targets.cpp
  lib/Basic/Targets/ARC.cpp
  lib/Basic/Targets/ARC.h
  lib/CodeGen/TargetInfo.cpp
  lib/Driver/CMakeLists.txt
  lib/Driver/ToolChains/Arch/ARC.cpp
  lib/Driver/ToolChains/Arch/ARC.h
  lib/Driver/ToolChains/Clang.cpp
  test/CodeGen/arc/arguments.c
  test/CodeGen/arc/struct-align.c
  test/CodeGen/target-data.c
  test/Driver/arc-target-features.c

Index: test/Driver/arc-target-features.c
===
--- test/Driver/arc-target-features.c
+++ test/Driver/arc-target-features.c
@@ -0,0 +1,5 @@
+// REQUIRES: arc-registered-target
+
+// RUN: %clang -target arc-unknown-unknown -### -S %s -mrf16 2>&1 | FileCheck %s -check-prefix=CHECK-RF16
+// CHECK-RF16: "-target-feature" "+rf16"
+// CHECK: #define __ARC_RF16__
Index: test/CodeGen/target-data.c
===
--- test/CodeGen/target-data.c
+++ test/CodeGen/target-data.c
@@ -151,6 +151,10 @@
 // RUN: %s | FileCheck %s -check-prefix=ARM-GNU
 // ARM-GNU: target datalayout = "e-m:e-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
 
+// RUN: %clang_cc1 -triple arc-unknown-unknown -o - -emit-llvm %s | \
+// RUN: FileCheck %s -check-prefix=ARC
+// ARC: target datalayout = "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-f32:32:32-i64:32-f64:32-a:0:32-n32"
+
 // RUN: %clang_cc1 -triple hexagon-unknown -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=HEXAGON
 // HEXAGON: target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
Index: test/CodeGen/arc/struct-align.c
===
--- test/CodeGen/arc/struct-align.c
+++ test/CodeGen/arc/struct-align.c
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -triple arc-unknown-unknown %s -emit-llvm -o - \
+// RUN:   | FileCheck %s
+
+// 64-bit fields need only be 32-bit aligned for arc.
+
+typedef struct {
+  int aa;
+  double bb;
+} s1;
+
+// CHECK: define i32 @f1
+// CHECK: ret i32 12
+int f1() {
+  return sizeof(s1);
+}
+
+typedef struct {
+  int aa;
+  long long bb;
+} s2;
+// CHECK: define i32 @f2
+// CHECK: ret i32 12
+int f2() {
+  return sizeof(s2);
+}
+
Index: test/CodeGen/arc/arguments.c
===
--- test/CodeGen/arc/arguments.c
+++ test/CodeGen/arc/arguments.c
@@ -0,0 +1,135 @@
+// RUN: %clang_cc1 -triple arc-unknown-unknown %s -emit-llvm -o - \
+// RUN:   | FileCheck %s
+
+// Basic argument tests for ARC.
+
+// CHECK: define void @f0(i32 inreg %i, i32 inreg %j, i32 inreg %k.coerce0, i32 inreg %k.coerce1)
+void f0(int i, long j, long long k) {}
+
+typedef struct {
+  int aa;
+  int bb;
+} s1;
+// CHECK: define void @f1(i32 inreg %i.coerce0, i32 inreg %i.coerce1)
+void f1(s1 i) {}
+
+typedef struct {
+  char aa; char bb; char cc; char dd;
+} cs1;
+// CHECK: define void @cf1(i32 inreg %i.coerce)
+void cf1(cs1 i) {}
+
+typedef struct {
+  int cc;
+} s2;
+// CHECK: define void @f2(%struct.s2* noalias sret %agg.result)
+s2 f2() {
+  s2 foo;
+  return foo;
+}
+
+typedef struct {
+  int cc;
+  int dd;
+} s3;
+// CHECK: define void @f3(%struct.s3* noalias sret %agg.result)
+s3 f3() {
+  s3 foo;
+  return foo;
+}
+
+// CHECK: define void @f4(i32 inreg %i.coerce0, i32 inreg %i.coerce1)
+void f4(long long i) {}
+
+// CHECK: define void @f5(i8 inreg signext %a, i16 inreg signext %b)
+void f5(signed char a, short b) {}
+
+// CHECK: define void @f6(i8 inreg zeroext %a, i16 inreg zeroext %b)
+void f6(unsigned char a, unsigned short b) {}
+
+enum my_enum {
+  ENUM1,
+  ENUM2,
+  ENUM3,
+};
+// Enums should be treated as the underlying i32.
+// CHECK: define void @f7(i32 inreg %a)
+void f7(enum my_enum a) {}
+
+enum my_big_enum {
+  ENUM4 = 0x,
+};
+// Big enums should be treated as the underlying i64.
+// CHECK: define void @f8(i32 inreg %a.coerce0, i32 inreg %a.coerce1)
+void f8(enum my_big_enum a) {}
+
+union simple_union {
+  int a;
+  char b;
+};
+// Unions should be passed inreg.
+// CHECK: define void @f9(i32 inreg %s.coerce)
+void f9(union simple_union s) {}
+
+typedef struct {
+  int b4 : 4;
+  int b3 : 3;
+  int b8 : 8;
+} bitfield1;
+// Bitfields should be passed inreg.
+// CHECK: define void @f10(i32 inreg %bf1.coerce)
+void f10(bitfield1 bf1) {}
+
+// CHECK: define inreg { float, float } @cplx1(float inreg %r)
+_Complex float cplx1(float r) {
+  return r + 2.0fi;
+}
+
+// CHECK: define inreg { double, double } @cplx2(i32 in

[PATCH] D53102: Support for the mno-tls-direct-seg-refs flag

2018-10-10 Thread Ruslan Nikolaev via Phabricator via cfe-commits
nruslan created this revision.
nruslan added reviewers: hans, craig.topper.
Herald added a subscriber: cfe-commits.

Allows to disable direct TLS segment access (%fs or %gs). GCC supports a 
similar flag, it can be useful in some circumstances, e.g. when a thread 
context block needs to be updated directly from user space. More info and 
specific use cases: https://bugs.llvm.org/show_bug.cgi?id=16145

There is another revision for LLVM as well.


Repository:
  rC Clang

https://reviews.llvm.org/D53102

Files:
  docs/ClangCommandLineReference.rst
  include/clang/Driver/CC1Options.td
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/CGCall.cpp
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/indirect-tls-seg-refs.c
  test/Driver/indirect-tls-seg-refs.c

Index: test/Driver/indirect-tls-seg-refs.c
===
--- /dev/null
+++ test/Driver/indirect-tls-seg-refs.c
@@ -0,0 +1,7 @@
+// RUN: %clang -### %s 2>&1 | FileCheck %s -check-prefix=TLSDIRECT
+// RUN: %clang -### -mno-tls-direct-seg-refs -mtls-direct-seg-refs %s 2>&1 | FileCheck %s -check-prefix=TLSDIRECT
+// RUN: %clang -### -mtls-direct-seg-refs -mno-tls-direct-seg-refs %s 2>&1 | FileCheck %s -check-prefix=NO-TLSDIRECT
+// REQUIRES: clang-driver
+
+// NO-TLSDIRECT: -indirect-tls-seg-refs
+// TLSDIRECT-NOT: -indirect-tls-seg-refs
Index: test/CodeGen/indirect-tls-seg-refs.c
===
--- /dev/null
+++ test/CodeGen/indirect-tls-seg-refs.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - -indirect-tls-seg-refs | FileCheck %s -check-prefix=NO-TLSDIRECT
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s -check-prefix=TLSDIRECT
+
+// NO-TLSDIRECT: attributes #{{[0-9]+}} = {{{.*}} "indirect-tls-seg-refs"
+// TLSDIRECT-NOT: attributes #{{[0-9]+}} = {{{.*}} "indirect-tls-seg-refs"
+
+void test1() {
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -614,6 +614,7 @@
   Opts.DisableLifetimeMarkers = Args.hasArg(OPT_disable_lifetimemarkers);
   Opts.DisableO0ImplyOptNone = Args.hasArg(OPT_disable_O0_optnone);
   Opts.DisableRedZone = Args.hasArg(OPT_disable_red_zone);
+  Opts.IndirectTlsSegRefs = Args.hasArg(OPT_indirect_tls_seg_refs);
   Opts.ForbidGuardVariables = Args.hasArg(OPT_fforbid_guard_variables);
   Opts.UseRegisterSizedBitfieldAccess = Args.hasArg(
 OPT_fuse_register_sized_bitfield_access);
Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -1739,6 +1739,10 @@
   Args.hasArg(options::OPT_fapple_kext))
 CmdArgs.push_back("-disable-red-zone");
 
+  if (!Args.hasFlag(options::OPT_mtls_direct_seg_refs,
+  options::OPT_mno_tls_direct_seg_refs, true))
+CmdArgs.push_back("-indirect-tls-seg-refs");
+
   // Default to avoid implicit floating-point for kernel/kext code, but allow
   // that to be overridden with -mno-soft-float.
   bool NoImplicitFloat = (Args.hasArg(options::OPT_mkernel) ||
Index: lib/CodeGen/CGCall.cpp
===
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -1709,6 +1709,8 @@
 
   if (CodeGenOpts.DisableRedZone)
 FuncAttrs.addAttribute(llvm::Attribute::NoRedZone);
+  if (CodeGenOpts.IndirectTlsSegRefs)
+FuncAttrs.addAttribute("indirect-tls-seg-refs");
   if (CodeGenOpts.NoImplicitFloat)
 FuncAttrs.addAttribute(llvm::Attribute::NoImplicitFloat);
 
Index: include/clang/Frontend/CodeGenOptions.def
===
--- include/clang/Frontend/CodeGenOptions.def
+++ include/clang/Frontend/CodeGenOptions.def
@@ -62,6 +62,8 @@
 CODEGENOPT(DebugPassManager, 1, 0) ///< Prints debug information for the new
///< pass manager.
 CODEGENOPT(DisableRedZone, 1, 0) ///< Set when -mno-red-zone is enabled.
+CODEGENOPT(IndirectTlsSegRefs, 1, 0) ///< Set when -mno-tls-direct-seg-refs
+ ///< is specified.
 CODEGENOPT(DisableTailCalls  , 1, 0) ///< Do not emit tail calls.
 CODEGENOPT(NoEscapingBlockTailCalls, 1, 0) ///< Do not emit tail calls from
///< escaping blocks.
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -2006,6 +2006,8 @@
 def mno_pascal_strings : Flag<["-"], "mno-pascal-strings">,
   Alias;
 def mno_red_zone : Flag<["-"], "mno-red-zone">, Group;
+def mno_tls_direct_seg_refs : Flag<["-"], "mno-tls-direct-seg-refs">, Group,
+  HelpText<"Disable direct TLS access through segment registers">;

[PATCH] D52784: [ARM][AArch64] Pass through endianness flags to the GNU assembler

2018-10-10 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added inline comments.



Comment at: lib/Driver/ToolChains/Gnu.cpp:543-549
+static const char* GetEndianArg(bool IsBigEndian, const ArgList &Args) {
+  if (Arg *A = Args.getLastArg(options::OPT_mlittle_endian,
+   options::OPT_mbig_endian)) {
+  IsBigEndian = !A->getOption().matches(options::OPT_mlittle_endian);
+  }
+  return (IsBigEndian) ? "-EB" : "-EL";
+}

If you passed `llvm::Triple` instead of `bool`, then I think you could do 
something like:

```
static const char* GetEndianArg(const llvm::Triple &triple, const ArgList 
&Args) {
  const bool IsBigEndian = triple == llvm::Triple::armeb ||
   triple == llvm::Triple::thumbeb ||
   triple == llvm::Triple::aarch64_be ||
   Args.getLastArg(options::OPT_mlittle_endian,
   
options::OPT_mbig_endian)->getOption().matches(options::OPT_mbig_endian);
  return IsBigEndian ? "-EB" : "-EL";
}
```

Might encapsulate the logic from the call sites better, but that's a minor nit.



Comment at: lib/Driver/ToolChains/Gnu.cpp:544-547
+  if (Arg *A = Args.getLastArg(options::OPT_mlittle_endian,
+   options::OPT_mbig_endian)) {
+  IsBigEndian = !A->getOption().matches(options::OPT_mlittle_endian);
+  }

Just so I understand this check, even if we didn't have a BE triple, we set 
`IsBigEndian` if `-mlittle-endian` was not set?  Is `-mlittle-endian` a default 
set flag, or does this set `"-EB"` even if no `-m*-endian` flag is specified (I 
think we want little-endian to be the default, and IIUC, this would change 
that)?


https://reviews.llvm.org/D52784



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


[PATCH] D52193: RFC: [clang] Multithreaded compilation support

2018-10-10 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea added a comment.

In https://reviews.llvm.org/D52193#1260862, @zturner wrote:

> I can try to get some timings from my machine.  How do we handle crash
>  recovery in the case where we don't spawn a child process?  I thought the
>  whole reason for spawning the cc1 driver as a separate process was so that
>  we could collect and report crash information in a nice way.  Not having
>  that seems like a heavy price to pay.


`clang.exe` has already a general exception handler (installed by 
`InitLLVM::InitLLVM/sys::PrintStackTraceOnErrorSignal`), which prints the 
callstack in case of a crash. So you wouldn't need the child process to do 
post-crash processing.

However, when running within a parent `clang.exe`, the parents calls 
`Driver::generateCompilationDiagnostics()` after a crash to create the repro 
(preprocessed source).

In a scenario where a single `clang.exe` is running (no child) we could modify 
`Driver::generateCompilationDiagnostics()` so it gets called from within the 
exception handler, and invoke a child process to collect the preprocessed 
source.

I wrote a fully fledged crash reporting system which does that, so I know 
that's possible. The tricky thing is to ensure 
`Driver::generateCompilationDiagnostics()` doesn't touch potentially invalid 
structures (if a crash occured) or allocate memory. The way around that is to 
pre-allocate and pre-copy the structures that you will be accessing in the case 
of a crash. But I don't see it as a hurdle in this case.


Repository:
  rC Clang

https://reviews.llvm.org/D52193



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


[PATCH] D52973: Add type_info predefined decl

2018-10-10 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

In https://reviews.llvm.org/D52973#1259992, @mwasplund wrote:

> In https://reviews.llvm.org/D52973#1259909, @rsmith wrote:
>
> > Generally this looks good, but it needs an accompanying test.
>
>
> I was looking into that and trying to read up on the documentation for adding 
> tests. I think I understand the crazy comment RUN test invocation, but got 
> lost in the directory structure. Is there documentation on naming and placing 
> regression tests? At first glance it seems arbitrary to me if the file is 
> something like p6.cpp (which don't appear to be sequential) or 
> my-test-name.cpp.


The tests under test/CXX are organized by section and paragraph of the C++ 
standard (we also have subdirectories for TSes, which are organized likewise, 
and for DRs, which are organized by number). The tests outside test/CXX are 
organized by the relevant part or feature of the compiler. Since this is a 
modules-specific failure but it's not related to a specific part of the Modules 
TS (in fact, it's an interaction between an MSVC-compatibility hack and our 
Modules TS implementation), the best home for it is probably a test in 
test/Modules, which you can name after the behavior you're testing (eg, 
ms-compat-typeinfo.cpp or similar). All inputs to the test other than the main 
test file should go in test/Modules/Inputs, in a subdirectory named after the 
stem of the test file (eg, test/Modules/Inputs/ms-compat-typeinfo).


Repository:
  rC Clang

https://reviews.llvm.org/D52973



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


[PATCH] D52193: RFC: [clang] Multithreaded compilation support

2018-10-10 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

In https://reviews.llvm.org/D52193#1260933, @aganea wrote:

> I wrote a fully fledged crash reporting system which does that, so I know 
> that's possible. The tricky thing is to ensure 
> `Driver::generateCompilationDiagnostics()` doesn't touch potentially invalid 
> structures (if a crash occured) or allocate memory. The way around that is to 
> pre-allocate and pre-copy the structures that you will be accessing in the 
> case of a crash. But I don't see it as a hurdle in this case.


Our existing stack dumper breaks all kinds of rules in this area. It uses 
std::vectors to make the stack trace. As much as it pains me that it's not 110% 
correct, nobody has complained so far that they don't get stack traces from 
clang when it crashes asynchronously inside of malloc.

Nice, the numbers for avoiding -cc1 are pretty compelling. It would also make 
debugging easier. I'd love to never see that question again on cfe-dev.

To handle pre-processed source generation, the best idea I could come up with 
was to pre-allocate the "generate crash diagnostics" command line and then 
spawn off a child process in the signal/exception handler to the heavy lifting. 
We're not concerned about generating pre-processed source in cases of system 
low memory or instability, so the relative unreliability of creating a child 
process isn't a huge concern.


Repository:
  rC Clang

https://reviews.llvm.org/D52193



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


[PATCH] D52773: clang-cl: Add /showFilenames option (PR31957)

2018-10-10 Thread Reid Kleckner via Phabricator via cfe-commits
rnk accepted this revision.
rnk added a comment.

lgtm




Comment at: lib/Driver/Job.cpp:319
+  if (PrintInputFilenames) {
+for (const char *Arg : InputFilenames)
+  llvm::outs() << llvm::sys::path::filename(Arg) << "\n";

Huh, a -cc1 action can have multiple inputs? Go figure.



Comment at: test/Driver/cl-showfilenames.c:7-8
+// multiple: cl-showfilenames.c
+// multiple-NEXT: wildcard1.c
+// multiple-NEXT: wildcard2.c

I think it'd be nice to have the test show that diagnostics come out 
interleaved between the filenames. You can use `#pragma message` in the input 
files or something else to create warnings.


https://reviews.llvm.org/D52773



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


Re: [clang-tools-extra] r280840 - Add a clang-tidy visual studio extension.

2018-10-10 Thread Aaron Ballman via cfe-commits
On Wed, Sep 7, 2016 at 2:37 PM Zachary Turner via cfe-commits
 wrote:
>
> Author: zturner
> Date: Wed Sep  7 13:28:55 2016
> New Revision: 280840
>
> URL: http://llvm.org/viewvc/llvm-project?rev=280840&view=rev
> Log:
> Add a clang-tidy visual studio extension.
>
> For now this only adds the UI necessary to configure clang-tidy
> settings graphically, and it enables reading in and saving out
> of .clang-tidy files.  It does not actually run clang-tidy on
> any source files yet.

Sorry to resurrect an old commit, but this commit added the following:

Added: 
clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml?rev=280840&view=auto
==
--- 
clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml
(added)
+++ 
clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml
Wed Sep  7 13:28:55 2016
@@ -0,0 +1,325 @@
+---
+Checks:
+   # This file should be updated when new checks are added, and
eventually we should
+   # generate this file automatically from the .rst files in clang-tidy.

However, as best I can tell, this file is not reliably updated and is
currently *very* out of date (in fact, it's only been updated twice in
two years). You had mentioned in the review thread that you wanted to
think of a way to automate this from RST
(https://reviews.llvm.org/D23848?id=69168#inline-204743) -- any chance
you're still thinking on that and have a solution in mind? ;-)

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


Re: [clang-tools-extra] r280840 - Add a clang-tidy visual studio extension.

2018-10-10 Thread Zachary Turner via cfe-commits
Honestly I hadn’t thought about this ever since the patch. Out of
curiosity, have you tried the clang power tools extension? I think it’s
more actively maintained and at this point probably even is good enough
that this one could just go away
On Wed, Oct 10, 2018 at 1:52 PM Aaron Ballman 
wrote:

> On Wed, Sep 7, 2016 at 2:37 PM Zachary Turner via cfe-commits
>  wrote:
> >
> > Author: zturner
> > Date: Wed Sep  7 13:28:55 2016
> > New Revision: 280840
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=280840&view=rev
> > Log:
> > Add a clang-tidy visual studio extension.
> >
> > For now this only adds the UI necessary to configure clang-tidy
> > settings graphically, and it enables reading in and saving out
> > of .clang-tidy files.  It does not actually run clang-tidy on
> > any source files yet.
>
> Sorry to resurrect an old commit, but this commit added the following:
>
> Added:
> clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml?rev=280840&view=auto
>
> ==
> ---
> clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml
> (added)
> +++
> clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml
> Wed Sep  7 13:28:55 2016
> @@ -0,0 +1,325 @@
> +---
> +Checks:
> +   # This file should be updated when new checks are added, and
> eventually we should
> +   # generate this file automatically from the .rst files in clang-tidy.
>
> However, as best I can tell, this file is not reliably updated and is
> currently *very* out of date (in fact, it's only been updated twice in
> two years). You had mentioned in the review thread that you wanted to
> think of a way to automate this from RST
> (https://reviews.llvm.org/D23848?id=69168#inline-204743) -- any chance
> you're still thinking on that and have a solution in mind? ;-)
>
> ~Aaron
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang-tools-extra] r280840 - Add a clang-tidy visual studio extension.

2018-10-10 Thread Aaron Ballman via cfe-commits
On Wed, Oct 10, 2018 at 4:54 PM Zachary Turner  wrote:
>
> Honestly I hadn’t thought about this ever since the patch. Out of curiosity, 
> have you tried the clang power tools extension? I think it’s more actively 
> maintained and at this point probably even is good enough that this one could 
> just go away

I've not tried either, truth be told. :-D This came up in GrammaTech
while I was reviewing someone's clang-tidy check for upstreaming.
Given how much I review clang-tidy checks on trunk, the fact that I
hadn't heard of this file surprised me so I did some code archaeology
and here we are. I don't have a strong opinion on whether this has
been superseded or not, but I probably should know whether clang-tidy
check authors are required to maintain this or not.

Btw, I didn't see any bug reports about missing checks. In fact, the
only bug report I can find for clang-tidy-vs suggests it may not even
work. https://bugs.llvm.org/show_bug.cgi?id=34176

~Aaron

> On Wed, Oct 10, 2018 at 1:52 PM Aaron Ballman  wrote:
>>
>> On Wed, Sep 7, 2016 at 2:37 PM Zachary Turner via cfe-commits
>>  wrote:
>> >
>> > Author: zturner
>> > Date: Wed Sep  7 13:28:55 2016
>> > New Revision: 280840
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=280840&view=rev
>> > Log:
>> > Add a clang-tidy visual studio extension.
>> >
>> > For now this only adds the UI necessary to configure clang-tidy
>> > settings graphically, and it enables reading in and saving out
>> > of .clang-tidy files.  It does not actually run clang-tidy on
>> > any source files yet.
>>
>> Sorry to resurrect an old commit, but this commit added the following:
>>
>> Added: 
>> clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml
>> URL: 
>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml?rev=280840&view=auto
>> ==
>> --- 
>> clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml
>> (added)
>> +++ 
>> clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml
>> Wed Sep  7 13:28:55 2016
>> @@ -0,0 +1,325 @@
>> +---
>> +Checks:
>> +   # This file should be updated when new checks are added, and
>> eventually we should
>> +   # generate this file automatically from the .rst files in clang-tidy.
>>
>> However, as best I can tell, this file is not reliably updated and is
>> currently *very* out of date (in fact, it's only been updated twice in
>> two years). You had mentioned in the review thread that you wanted to
>> think of a way to automate this from RST
>> (https://reviews.llvm.org/D23848?id=69168#inline-204743) -- any chance
>> you're still thinking on that and have a solution in mind? ;-)
>>
>> ~Aaron
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D36527: Implemented P0428R2 - Familiar template syntax for generic lambdas

2018-10-10 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.
Herald added a subscriber: arphaman.

This looks great, thanks!

In https://reviews.llvm.org/D36527#892395, @hamzasood wrote:

> Could you expand on your first point a bit more? Do you have an example that 
> shows the issue?


You have very little test coverage for the case where a lambda with explicit 
template parameters is used within another template. Eg, something like 
(untested):

  template constexpr T f() {
return []() { return V; }.operator()<12345>(); // expected-error {{no 
viable function}} expected-note {{candidate}}
  }
  static_assert(f() == 12345); // ok
  int *p = f(); // expected-note {{in instantiation of}}




Comment at: lib/AST/DeclCXX.cpp:1396-1397
+
+  return std::count_if(List->begin(), List->end(),
+   [](const NamedDecl *D) { return !D->isImplicit(); });
+}

Given that you've already assert-checked `is_partitioned`, maybe use a binary 
search here (eg, `lower_bound`)?



Comment at: lib/AST/DeclPrinter.cpp:107-108
 
-void printTemplateParameters(const TemplateParameterList *Params);
+void printTemplateParameters(const TemplateParameterList *Params,
+ bool OmitTemplateKW = false);
 void printTemplateArguments(const TemplateArgumentList &Args,

Nit: I'd prefer splitting this into two functions (one that prints 'template', 
calls the other, then prints a space, and the other to print the actual 
template parameters) rather than passing a boolean flag.



Comment at: lib/AST/ItaniumMangle.cpp:1710
+Out << "Ty";
+  }
+  else if (auto *Tn = dyn_cast(Decl)) {

No newline between `}` and `else`, please.



Comment at: lib/AST/ItaniumMangle.cpp:1752-1757
+const auto *List = Lambda->getGenericLambdaTemplateParameterList();
+assert(List && "Lambda says it has explicit template parameters, "
+   "but it doesn't have a template parameter list");
+for (auto It = List->begin(), End = It + ExplcitTemplateParamCount;
+ It != End;
+ ++It)

Might be nice to add an accessor that returns the range of explicit parameters. 
(The `if` surrounding this code would then also be redundant.)



Comment at: lib/Parse/ParseExprCXX.cpp:1139
+TemplateParams, LAngleLoc, RAngleLoc)) {
+  return ExprError();
+}

You need to do something here to leave the lambda scope that was pushed near 
the start of this function.



Comment at: unittests/AST/StmtPrinterTest.cpp:109
 
-::testing::AssertionResult
-PrintedStmtCXX98Matches(StringRef Code, const StatementMatcher &NodeMatch,
-StringRef ExpectedPrinted) {
-  std::vector Args;
-  Args.push_back("-std=c++98");
-  Args.push_back("-Wno-unused-value");
-  return PrintedStmtMatches(Code, Args, NodeMatch, ExpectedPrinted);
-}
-
-::testing::AssertionResult PrintedStmtCXX98Matches(
-  StringRef Code,
-  StringRef ContainingFunction,
-  StringRef ExpectedPrinted) {
-  std::vector Args;
-  Args.push_back("-std=c++98");
-  Args.push_back("-Wno-unused-value");
-  return PrintedStmtMatches(Code,
-Args,
-functionDecl(hasName(ContainingFunction),
- 
has(compoundStmt(has(stmt().bind("id"),
-ExpectedPrinted);
+enum class StdVer { CXX98, CXX11, CXX14, CXX17, CXX2a };
+

Please commit the refactoring portion of the changes to this file separately.


https://reviews.llvm.org/D36527



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


Re: [clang-tools-extra] r280840 - Add a clang-tidy visual studio extension.

2018-10-10 Thread Zachary Turner via cfe-commits
Yea, that’s actually another reason I suggest trying the Clang Power Tools
extension. It seems to have “won” in this area, and few people ever used
the LLVM one to begin with.
On Wed, Oct 10, 2018 at 2:09 PM Aaron Ballman 
wrote:

> On Wed, Oct 10, 2018 at 4:54 PM Zachary Turner  wrote:
> >
> > Honestly I hadn’t thought about this ever since the patch. Out of
> curiosity, have you tried the clang power tools extension? I think it’s
> more actively maintained and at this point probably even is good enough
> that this one could just go away
>
> I've not tried either, truth be told. :-D This came up in GrammaTech
> while I was reviewing someone's clang-tidy check for upstreaming.
> Given how much I review clang-tidy checks on trunk, the fact that I
> hadn't heard of this file surprised me so I did some code archaeology
> and here we are. I don't have a strong opinion on whether this has
> been superseded or not, but I probably should know whether clang-tidy
> check authors are required to maintain this or not.
>
> Btw, I didn't see any bug reports about missing checks. In fact, the
> only bug report I can find for clang-tidy-vs suggests it may not even
> work. https://bugs.llvm.org/show_bug.cgi?id=34176
>
> ~Aaron
>
> > On Wed, Oct 10, 2018 at 1:52 PM Aaron Ballman 
> wrote:
> >>
> >> On Wed, Sep 7, 2016 at 2:37 PM Zachary Turner via cfe-commits
> >>  wrote:
> >> >
> >> > Author: zturner
> >> > Date: Wed Sep  7 13:28:55 2016
> >> > New Revision: 280840
> >> >
> >> > URL: http://llvm.org/viewvc/llvm-project?rev=280840&view=rev
> >> > Log:
> >> > Add a clang-tidy visual studio extension.
> >> >
> >> > For now this only adds the UI necessary to configure clang-tidy
> >> > settings graphically, and it enables reading in and saving out
> >> > of .clang-tidy files.  It does not actually run clang-tidy on
> >> > any source files yet.
> >>
> >> Sorry to resurrect an old commit, but this commit added the following:
> >>
> >> Added:
> clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml
> >> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml?rev=280840&view=auto
> >>
> ==
> >> ---
> clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml
> >> (added)
> >> +++
> clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml
> >> Wed Sep  7 13:28:55 2016
> >> @@ -0,0 +1,325 @@
> >> +---
> >> +Checks:
> >> +   # This file should be updated when new checks are added, and
> >> eventually we should
> >> +   # generate this file automatically from the .rst files in
> clang-tidy.
> >>
> >> However, as best I can tell, this file is not reliably updated and is
> >> currently *very* out of date (in fact, it's only been updated twice in
> >> two years). You had mentioned in the review thread that you wanted to
> >> think of a way to automate this from RST
> >> (https://reviews.llvm.org/D23848?id=69168#inline-204743) -- any chance
> >> you're still thinking on that and have a solution in mind? ;-)
> >>
> >> ~Aaron
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang-tools-extra] r280840 - Add a clang-tidy visual studio extension.

2018-10-10 Thread Aaron Ballman via cfe-commits
On Wed, Oct 10, 2018 at 5:11 PM Zachary Turner  wrote:
>
> Yea, that’s actually another reason I suggest trying the Clang Power Tools 
> extension. It seems to have “won” in this area, and few people ever used the 
> LLVM one to begin with.

Given that this isn't being updated and it may not work, should this
be removed (with some public discussion in a more appropriate, new
thread) or left to bit rot? I can start the discussion and do the
removal if you agree that's the right approach here.

~Aaron

> On Wed, Oct 10, 2018 at 2:09 PM Aaron Ballman  wrote:
>>
>> On Wed, Oct 10, 2018 at 4:54 PM Zachary Turner  wrote:
>> >
>> > Honestly I hadn’t thought about this ever since the patch. Out of 
>> > curiosity, have you tried the clang power tools extension? I think it’s 
>> > more actively maintained and at this point probably even is good enough 
>> > that this one could just go away
>>
>> I've not tried either, truth be told. :-D This came up in GrammaTech
>> while I was reviewing someone's clang-tidy check for upstreaming.
>> Given how much I review clang-tidy checks on trunk, the fact that I
>> hadn't heard of this file surprised me so I did some code archaeology
>> and here we are. I don't have a strong opinion on whether this has
>> been superseded or not, but I probably should know whether clang-tidy
>> check authors are required to maintain this or not.
>>
>> Btw, I didn't see any bug reports about missing checks. In fact, the
>> only bug report I can find for clang-tidy-vs suggests it may not even
>> work. https://bugs.llvm.org/show_bug.cgi?id=34176
>>
>> ~Aaron
>>
>> > On Wed, Oct 10, 2018 at 1:52 PM Aaron Ballman  
>> > wrote:
>> >>
>> >> On Wed, Sep 7, 2016 at 2:37 PM Zachary Turner via cfe-commits
>> >>  wrote:
>> >> >
>> >> > Author: zturner
>> >> > Date: Wed Sep  7 13:28:55 2016
>> >> > New Revision: 280840
>> >> >
>> >> > URL: http://llvm.org/viewvc/llvm-project?rev=280840&view=rev
>> >> > Log:
>> >> > Add a clang-tidy visual studio extension.
>> >> >
>> >> > For now this only adds the UI necessary to configure clang-tidy
>> >> > settings graphically, and it enables reading in and saving out
>> >> > of .clang-tidy files.  It does not actually run clang-tidy on
>> >> > any source files yet.
>> >>
>> >> Sorry to resurrect an old commit, but this commit added the following:
>> >>
>> >> Added: 
>> >> clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml
>> >> URL: 
>> >> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml?rev=280840&view=auto
>> >> ==
>> >> --- 
>> >> clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml
>> >> (added)
>> >> +++ 
>> >> clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml
>> >> Wed Sep  7 13:28:55 2016
>> >> @@ -0,0 +1,325 @@
>> >> +---
>> >> +Checks:
>> >> +   # This file should be updated when new checks are added, and
>> >> eventually we should
>> >> +   # generate this file automatically from the .rst files in clang-tidy.
>> >>
>> >> However, as best I can tell, this file is not reliably updated and is
>> >> currently *very* out of date (in fact, it's only been updated twice in
>> >> two years). You had mentioned in the review thread that you wanted to
>> >> think of a way to automate this from RST
>> >> (https://reviews.llvm.org/D23848?id=69168#inline-204743) -- any chance
>> >> you're still thinking on that and have a solution in mind? ;-)
>> >>
>> >> ~Aaron
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53109: [Driver] Default Android toolchains to libc++.

2018-10-10 Thread Dan Albert via Phabricator via cfe-commits
danalbert created this revision.
danalbert added reviewers: srhines, pirama.
Herald added a reviewer: EricWF.

Repository:
  rC Clang

https://reviews.llvm.org/D53109

Files:
  lib/Driver/ToolChains/Linux.cpp
  lib/Driver/ToolChains/Linux.h
  test/Driver/android-ndk-standalone.cpp

Index: test/Driver/android-ndk-standalone.cpp
===
--- test/Driver/android-ndk-standalone.cpp
+++ test/Driver/android-ndk-standalone.cpp
@@ -2,21 +2,13 @@
 // toolchain.
 //
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target arm-linux-androideabi21 -stdlib=libstdc++ \
+// RUN: -target arm-linux-androideabi21 \
 // RUN: -B%S/Inputs/basic_android_ndk_tree \
 // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
 // RUN:   | FileCheck  %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
 // CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
-// CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9"
-// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb"
-// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a"
-// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb"
-// CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi"
-// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb"
-// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a"
-// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb"
-// CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9/backward"
+// CHECK: "-internal-isystem" "{{.*}}/include/c++/v1"
 // CHECK: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
 // CHECK: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|)}}include"
 // CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/arm-linux-androideabi"
@@ -49,21 +41,47 @@
 // CHECK-14: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi"
 //
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target armv7a-none-linux-androideabi21 -stdlib=libstdc++ \
+// RUN: -target arm-linux-androideabi21 -stdlib=libstdc++ \
+// RUN: -B%S/Inputs/basic_android_ndk_tree \
+// RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
+// RUN:   | FileCheck --check-prefix=CHECK-STDCXX %s
+// CHECK-STDCXX: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-STDCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-STDCXX: "-internal-isystem" "{{.*}}/include/c++/4.9"
+// CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb"
+// CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a"
+// CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb"
+// CHECK-STDCXX: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi"
+// CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb"
+// CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a"
+// CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb"
+// CHECK-STDCXX: "-internal-isystem" "{{.*}}/include/c++/4.9/backward"
+// CHECK-STDCXX: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb"
+// CHECK-STDCXX: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a/thumb"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb"
+// CHECK-STDCXX: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi/21"
+// CHECK-STDCXX: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi"
+// CHECK-STDCXX: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/arm-linux-androideabi/lib"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a/thumb"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target armv7a-none-linux-androideabi21 \
 // RUN: -B%S/Inputs/basic_android_ndk_tree \
 // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
 // RUN:   | FileCheck  --check-prefix=CHECK-ARMV

[PATCH] D50766: Fix false positive unsequenced access and modification warning in array subscript expression.

2018-10-10 Thread Nicolas Lesser via Phabricator via cfe-commits
Rakete added a comment.

Sorry, for some reason I didn't see your updates.

Can you add a test for C++17? Then your patch is good to go! :)


https://reviews.llvm.org/D50766



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


[PATCH] D53109: [Driver] Default Android toolchains to libc++.

2018-10-10 Thread Dan Albert via Phabricator via cfe-commits
danalbert planned changes to this revision.
danalbert added a comment.

Oops, ignore this for a moment. Accidentally ran `check-cxx` instead of 
`check-clang`.


Repository:
  rC Clang

https://reviews.llvm.org/D53109



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


[PATCH] D53109: [Driver] Default Android toolchains to libc++.

2018-10-10 Thread Dan Albert via Phabricator via cfe-commits
danalbert updated this revision to Diff 169097.
danalbert added a comment.

Fixed bad merge conflict resolution.


Repository:
  rC Clang

https://reviews.llvm.org/D53109

Files:
  lib/Driver/ToolChains/Linux.cpp
  lib/Driver/ToolChains/Linux.h
  test/Driver/android-ndk-standalone.cpp

Index: test/Driver/android-ndk-standalone.cpp
===
--- test/Driver/android-ndk-standalone.cpp
+++ test/Driver/android-ndk-standalone.cpp
@@ -2,21 +2,13 @@
 // toolchain.
 //
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target arm-linux-androideabi21 -stdlib=libstdc++ \
+// RUN: -target arm-linux-androideabi21 \
 // RUN: -B%S/Inputs/basic_android_ndk_tree \
 // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
 // RUN:   | FileCheck  %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
 // CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
-// CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9"
-// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb"
-// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a"
-// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb"
-// CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi"
-// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb"
-// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a"
-// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb"
-// CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9/backward"
+// CHECK: "-internal-isystem" "{{.*}}/include/c++/v1"
 // CHECK: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
 // CHECK: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|)}}include"
 // CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/arm-linux-androideabi"
@@ -49,21 +41,47 @@
 // CHECK-14: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi"
 //
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target armv7a-none-linux-androideabi21 -stdlib=libstdc++ \
+// RUN: -target arm-linux-androideabi21 -stdlib=libstdc++ \
+// RUN: -B%S/Inputs/basic_android_ndk_tree \
+// RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
+// RUN:   | FileCheck --check-prefix=CHECK-STDCXX %s
+// CHECK-STDCXX: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-STDCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-STDCXX: "-internal-isystem" "{{.*}}/include/c++/4.9"
+// CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb"
+// CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a"
+// CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb"
+// CHECK-STDCXX: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi"
+// CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb"
+// CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a"
+// CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb"
+// CHECK-STDCXX: "-internal-isystem" "{{.*}}/include/c++/4.9/backward"
+// CHECK-STDCXX: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb"
+// CHECK-STDCXX: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a/thumb"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb"
+// CHECK-STDCXX: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi/21"
+// CHECK-STDCXX: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi"
+// CHECK-STDCXX: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/arm-linux-androideabi/lib"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a/thumb"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a"
+// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target armv7a-none-linux-androideabi21 \
 // RUN: -B%S/Inputs/basic_android_ndk_tree \
 // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
 // RUN:   | FileCheck  --check-prefix=CHECK-

[PATCH] D53076: [analyzer] WIP: Enhance ConditionBRVisitor to write out more information

2018-10-10 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

In https://reviews.llvm.org/D53076#1260663, @george.karpenkov wrote:

> 1. Note that "Assuming X" directives are useful for the analyzer developers, 
> since they know that's where the checker makes arbitrary assumptions, but to 
> end users that mostly feels like noise ("Taking true branch" is there 
> already, why there should be "Assuming 'i' is > 0" as well?)


I believe that distinction between "Assuming..." (event piece, yellow bar in 
scan-build) and "Taking..." (control-flow piece, grey bar in scan-build, 
depicted with arrows //without text// in a number of other UIs) is useful for 
the users as well, not just for hackers. I agree that the distinction isn't 
obvious and for now this part of the UI is not very useful. But now that you're 
at it, i think it'd be better to fix this problem by making diagnostics more 
understandable rather than by simplifying out the distinction.

For example, in the `inline-plist.c`'s `bar()` on line 45, Static Analyzer 
indeed doesn't assume that `p` is equal to null; instead, Static Analyzer 
*knows* it for sure. There's no guess made here, and that's not an assumption 
that the user would need to agree or disagree with while looking at the report. 
Instead, it is an inevitable consequence of the previous events that occurred 
on this path. So i guess we could say something like "Knowing that 'p' is equal 
to null" or "'p' is inevitably null" and it should make the distinction 
apparent to the user. The user would notice that there's a change in the way 
we're talking about the fact.

The other reason why it's important is that those arbitrary assumptions are one 
of the fundamental weakness of the technique behind Static Analyzer: the user 
is indeed allowed to disagree with these assumptions and then mark the positive 
as false and suppress it with an assertion. In a code with a single branch such 
approach works fine because it is based on "presumption of no deadcode" (i.e., 
if there's an `if` in the code, both branches should be reached sometimes), but 
when there are N consequent branches, it is not necessary for all 2^N possible 
execution paths to be feasible: an O(N) number of paths can cover all the 
branches. But when it comes to actual facts that are inevitably true after the 
user has agreed with all previous assumptions on the path, the user can't 
disagree with those facts anymore, and that's an important piece of info to 
convey.

In https://reviews.llvm.org/D53076#1260663, @george.karpenkov wrote:

> 2. @NoQ do you know why the GDM comparison was there in the first place? The 
> commit was made by Ted in 2011, maybe constraint changes had to be reflected 
> in the GDM at that point (?)


It's likely that back then GDM only contained constraints and checker info (and 
program point kind guaranteed that checker info could not have changed). But 
that's not the case anymore (we have more core traits - dynamic type info, C++ 
constructor support, taint, etc.), so this code is definitely incorrect; not 
sure how often does it matter. In order to produce an actual correct logic, we 
probably need to add a method to `ConstraintManager` to ask whether constraints 
have changed between two states.


https://reviews.llvm.org/D53076



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


[PATCH] D53052: [AST] Use -fvisibility value when ignoring -fv-i-h* inline static locals

2018-10-10 Thread Reid Kleckner via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC344190: [AST] Use -fvisibility value when ignoring -fv-i-h* 
inline static locals (authored by rnk, committed by ).
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D53052?vs=169103&id=169104#toc

Repository:
  rC Clang

https://reviews.llvm.org/D53052

Files:
  lib/AST/Decl.cpp
  test/CodeGenCXX/visibility-inlines-hidden-staticvar.cpp

Index: test/CodeGenCXX/visibility-inlines-hidden-staticvar.cpp
===
--- test/CodeGenCXX/visibility-inlines-hidden-staticvar.cpp
+++ test/CodeGenCXX/visibility-inlines-hidden-staticvar.cpp
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 -fvisibility-inlines-hidden -emit-llvm -o - %s -O2 -disable-llvm-passes | FileCheck %s
 // RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 -emit-llvm -o - %s -O2 -disable-llvm-passes | FileCheck -check-prefixes=CHECK-NO-VIH %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 -fvisibility hidden -fvisibility-inlines-hidden -emit-llvm -o - %s -O2 -disable-llvm-passes | FileCheck %s --check-prefix=CHECK-VIS-HIDDEN
+// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 -fvisibility protected -fvisibility-inlines-hidden -emit-llvm -o - %s -O2 -disable-llvm-passes | FileCheck %s --check-prefix=CHECK-VIS-PROTECTED
 
 // When a function is hidden due to -fvisibility-inlines-hidden option, static local variables of the function should not be hidden by the option.
 
@@ -9,26 +11,63 @@
 // CHECK-DAG: @_ZZ11inline_funcvE3var = linkonce_odr global i32 0, comdat
 // CHECK-DAG: @_ZZ18inline_hidden_funcvE3var = linkonce_odr hidden global i32 0, comdat
 // CHECK-DAG: @_ZZ19inline_default_funcvE3var = linkonce_odr global i32 0, comdat
+// CHECK-DAG: @_ZZN13ExportedClass10inl_methodEvE3var = linkonce_odr global i32 0, comdat, align 4
 // CHECK-DAG: define i32 @_Z4funcv()
 // CHECK-DAG: define hidden i32 @_Z11hidden_funcv()
 // CHECK-DAG: define i32 @_Z12default_funcv()
 // CHECK-DAG: define linkonce_odr hidden i32 @_Z11inline_funcv()
 // CHECK-DAG: define linkonce_odr hidden i32 @_Z18inline_hidden_funcv()
 // CHECK-DAG: define linkonce_odr i32 @_Z19inline_default_funcv()
+// CHECK-DAG: define linkonce_odr hidden i32 @_ZN13ExportedClass10inl_methodEv({{.*}})
+// CHECK-DAG: define i32 @_ZN13ExportedClass10ext_methodEv({{.*}})
 
 // CHECK-NO-VIH-DAG: @_ZZ4funcvE3var = internal global i32 0
 // CHECK-NO-VIH-DAG: @_ZZ11hidden_funcvE3var = internal global i32 0
 // CHECK-NO-VIH-DAG: @_ZZ12default_funcvE3var = internal global i32 0
 // CHECK-NO-VIH-DAG: @_ZZ11inline_funcvE3var = linkonce_odr global i32 0, comdat
 // CHECK-NO-VIH-DAG: @_ZZ18inline_hidden_funcvE3var = linkonce_odr hidden global i32 0, comdat
 // CHECK-NO-VIH-DAG: @_ZZ19inline_default_funcvE3var = linkonce_odr global i32 0, comdat
+// CHECK-NO-VIH-DAG: @_ZZN13ExportedClass10inl_methodEvE3var = linkonce_odr global i32 0, comdat, align 4
 // CHECK-NO-VIH-DAG: define i32 @_Z4funcv()
 // CHECK-NO-VIH-DAG: define hidden i32 @_Z11hidden_funcv()
 // CHECK-NO-VIH-DAG: define i32 @_Z12default_funcv()
 // CHECK-NO-VIH-DAG: define linkonce_odr i32 @_Z11inline_funcv()
 // CHECK-NO-VIH-DAG: define linkonce_odr hidden i32 @_Z18inline_hidden_funcv()
 // CHECK-NO-VIH-DAG: define linkonce_odr i32 @_Z19inline_default_funcv()
+// CHECK-NO-VIH-DAG: define linkonce_odr i32 @_ZN13ExportedClass10inl_methodEv({{.*}})
+// CHECK-NO-VIH-DAG: define i32 @_ZN13ExportedClass10ext_methodEv({{.*}})
 
+// CHECK-VIS-HIDDEN-DAG: @_ZZ4funcvE3var = internal global i32 0
+// CHECK-VIS-HIDDEN-DAG: @_ZZ11hidden_funcvE3var = internal global i32 0
+// CHECK-VIS-HIDDEN-DAG: @_ZZ12default_funcvE3var = internal global i32 0
+// CHECK-VIS-HIDDEN-DAG: @_ZZ11inline_funcvE3var = linkonce_odr hidden global i32 0, comdat
+// CHECK-VIS-HIDDEN-DAG: @_ZZ18inline_hidden_funcvE3var = linkonce_odr hidden global i32 0, comdat
+// CHECK-VIS-HIDDEN-DAG: @_ZZ19inline_default_funcvE3var = linkonce_odr global i32 0, comdat
+// CHECK-VIS-HIDDEN-DAG: @_ZZN13ExportedClass10inl_methodEvE3var = linkonce_odr global i32 0, comdat, align 4
+// CHECK-VIS-HIDDEN-DAG: define hidden i32 @_Z4funcv()
+// CHECK-VIS-HIDDEN-DAG: define hidden i32 @_Z11hidden_funcv()
+// CHECK-VIS-HIDDEN-DAG: define i32 @_Z12default_funcv()
+// CHECK-VIS-HIDDEN-DAG: define linkonce_odr hidden i32 @_Z11inline_funcv()
+// CHECK-VIS-HIDDEN-DAG: define linkonce_odr hidden i32 @_Z18inline_hidden_funcv()
+// CHECK-VIS-HIDDEN-DAG: define linkonce_odr i32 @_Z19inline_default_funcv()
+// CHECK-VIS-HIDDEN-DAG: define linkonce_odr hidden i32 @_ZN13ExportedClass10inl_methodEv({{.*}})
+// CHECK-VIS-HIDDEN-DAG: define i32 @_ZN13ExportedClass10ext_methodEv({{.*}})
+
+// CHECK-VIS-PROTECTED-DAG: @_ZZ4funcvE3var = internal global i32 0
+// CHECK-VIS-PROTECTED-DAG: @_ZZ11hidden_funcvE3var = internal global i32 0
+// CHECK-VIS-PROTECTED-DAG: @_ZZ12default_funcvE3var = int

r344190 - [AST] Use -fvisibility value when ignoring -fv-i-h* inline static locals

2018-10-10 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Wed Oct 10 14:59:56 2018
New Revision: 344190

URL: http://llvm.org/viewvc/llvm-project?rev=344190&view=rev
Log:
[AST] Use -fvisibility value when ignoring -fv-i-h* inline static locals

Summary:
In r340386 we added code to give static locals in inline functions
default visibility. Instead, we should use the "default" visibility
passed on the command line, which could be hidden or protected, as GCC
does.

Some code bases use both -fvisibility=hidden and
-fvisibility-inlines-hidden to hide inline functions of classes that are
explicitly marked with default visibility.

Fixes PR39236

Reviewers: hans, thakis

Subscribers: eraman, llvm-commits

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

Modified:
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden-staticvar.cpp

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=344190&r1=344189&r2=344190&view=diff
==
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Wed Oct 10 14:59:56 2018
@@ -725,7 +725,7 @@ LinkageComputer::getLVForNamespaceScopeD
   // If we're paying attention to global visibility, apply
   // -finline-visibility-hidden if this is an inline method.
   if (useInlineVisibilityHidden(D))
-LV.mergeVisibility(HiddenVisibility, true);
+LV.mergeVisibility(HiddenVisibility, /*visibilityExplicit=*/false);
 }
   }
 
@@ -915,7 +915,7 @@ LinkageComputer::getLVForClassMember(con
 // Note that we do this before merging information about
 // the class visibility.
 if (!LV.isVisibilityExplicit() && useInlineVisibilityHidden(D))
-  LV.mergeVisibility(HiddenVisibility, true);
+  LV.mergeVisibility(HiddenVisibility, /*visibilityExplicit=*/false);
   }
 
   // If this class member has an explicit visibility attribute, the only
@@ -1265,14 +1265,24 @@ LinkageInfo LinkageComputer::getLVForLoc
 // If a function is hidden by -fvisibility-inlines-hidden option and
 // is not explicitly attributed as a hidden function,
 // we should not make static local variables in the function hidden.
+LV = getLVForDecl(FD, computation);
 if (isa(D) && useInlineVisibilityHidden(FD) &&
-!(!hasExplicitVisibilityAlready(computation) &&
-  getExplicitVisibility(FD, computation))) {
+!LV.isVisibilityExplicit()) {
   assert(cast(D)->isStaticLocal());
-  return LinkageInfo(VisibleNoLinkage, DefaultVisibility, false);
+  // If this was an implicitly hidden inline method, check again for
+  // explicit visibility on the parent class, and use that for static 
locals
+  // if present.
+  if (const auto *MD = dyn_cast(FD))
+LV = getLVForDecl(MD->getParent(), computation);
+  if (!LV.isVisibilityExplicit()) {
+Visibility globalVisibility =
+computation.isValueVisibility()
+? Context.getLangOpts().getValueVisibilityMode()
+: Context.getLangOpts().getTypeVisibilityMode();
+return LinkageInfo(VisibleNoLinkage, globalVisibility,
+   /*visibilityExplicit=*/false);
+  }
 }
-
-LV = getLVForDecl(FD, computation);
   }
   if (!isExternallyVisible(LV.getLinkage()))
 return LinkageInfo::none();

Modified: cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden-staticvar.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden-staticvar.cpp?rev=344190&r1=344189&r2=344190&view=diff
==
--- cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden-staticvar.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden-staticvar.cpp Wed Oct 
10 14:59:56 2018
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 
-fvisibility-inlines-hidden -emit-llvm -o - %s -O2 -disable-llvm-passes | 
FileCheck %s
 // RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 -emit-llvm -o - %s 
-O2 -disable-llvm-passes | FileCheck -check-prefixes=CHECK-NO-VIH %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 -fvisibility hidden 
-fvisibility-inlines-hidden -emit-llvm -o - %s -O2 -disable-llvm-passes | 
FileCheck %s --check-prefix=CHECK-VIS-HIDDEN
+// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 -fvisibility 
protected -fvisibility-inlines-hidden -emit-llvm -o - %s -O2 
-disable-llvm-passes | FileCheck %s --check-prefix=CHECK-VIS-PROTECTED
 
 // When a function is hidden due to -fvisibility-inlines-hidden option, static 
local variables of the function should not be hidden by the option.
 
@@ -9,12 +11,15 @@
 // CHECK-DAG: @_ZZ11inline_funcvE3var = linkonce_odr global i32 0, comdat
 // CHECK-DAG: @_ZZ18inline_hidden_funcvE3var = linkonce_odr hidden global i32 
0, comdat
 // CHECK-DAG: @_ZZ19inline_default_funcvE3var = linkonce_odr gl

  1   2   >