[PATCH] D55916: [clang] Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]

2018-12-20 Thread Michał Górny via Phabricator via cfe-commits
mgorny created this revision.
mgorny added a reviewer: krytarowski.
Herald added subscribers: jsji, atanasyan, jrtc27, fedor.sergeev, kbarton, 
javed.absar, nemanjai, sdardis, emaste, jyknight.

Replace multiple comparisons of getOS() value with FreeBSD, NetBSD,
OpenBSD and DragonFly with matching isOS*BSD() methods.  This should
improve the consistency of coding style without changing the behavior.
Direct getOS() comparisons were left whenever used in switch or switch-
like context.


Repository:
  rC Clang

https://reviews.llvm.org/D55916

Files:
  lib/Basic/Targets/AArch64.cpp
  lib/Basic/Targets/ARM.cpp
  lib/Basic/Targets/Mips.h
  lib/Basic/Targets/PPC.cpp
  lib/Basic/Targets/PPC.h
  lib/Basic/Targets/Sparc.h
  lib/Driver/ToolChains/Arch/Mips.cpp
  lib/Driver/ToolChains/Clang.cpp
  lib/Driver/ToolChains/CommonArgs.cpp
  lib/Driver/ToolChains/Gnu.cpp
  lib/Driver/XRayArgs.cpp
  lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp

Index: lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
===
--- lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
+++ lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
@@ -29,10 +29,10 @@
   const llvm::Triple &T = Ctx.getTargetInfo().getTriple();
   return T.getVendor() == llvm::Triple::Apple ||
  T.getOS() == llvm::Triple::CloudABI ||
- T.getOS() == llvm::Triple::FreeBSD ||
- T.getOS() == llvm::Triple::NetBSD ||
- T.getOS() == llvm::Triple::OpenBSD ||
- T.getOS() == llvm::Triple::DragonFly;
+ T.isOSFreeBSD() ||
+ T.isOSNetBSD() ||
+ T.isOSOpenBSD() ||
+ T.isOSDragonFly();
 }
 
 namespace {
Index: lib/Driver/XRayArgs.cpp
===
--- lib/Driver/XRayArgs.cpp
+++ lib/Driver/XRayArgs.cpp
@@ -50,9 +50,9 @@
 D.Diag(diag::err_drv_clang_unsupported)
 << (std::string(XRayInstrumentOption) + " on " + Triple.str());
   }
-} else if (Triple.getOS() == llvm::Triple::FreeBSD ||
-   Triple.getOS() == llvm::Triple::OpenBSD ||
-   Triple.getOS() == llvm::Triple::NetBSD ||
+} else if (Triple.isOSFreeBSD() ||
+   Triple.isOSOpenBSD() ||
+   Triple.isOSNetBSD() ||
Triple.getOS() == llvm::Triple::Darwin) {
   if (Triple.getArch() != llvm::Triple::x86_64) {
 D.Diag(diag::err_drv_clang_unsupported)
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -2597,7 +2597,7 @@
   bool UseInitArrayDefault =
   getTriple().getArch() == llvm::Triple::aarch64 ||
   getTriple().getArch() == llvm::Triple::aarch64_be ||
-  (getTriple().getOS() == llvm::Triple::FreeBSD &&
+  (getTriple().isOSFreeBSD() &&
getTriple().getOSMajorVersion() >= 12) ||
   (getTriple().getOS() == llvm::Triple::Linux &&
((!GCCInstallation.isValid() || !V.isOlderThan(4, 7, 0)) ||
Index: lib/Driver/ToolChains/CommonArgs.cpp
===
--- lib/Driver/ToolChains/CommonArgs.cpp
+++ lib/Driver/ToolChains/CommonArgs.cpp
@@ -603,19 +603,19 @@
   if (TC.getTriple().getOS() != llvm::Triple::RTEMS &&
   !TC.getTriple().isAndroid()) {
 CmdArgs.push_back("-lpthread");
-if (TC.getTriple().getOS() != llvm::Triple::OpenBSD)
+if (TC.getTriple().isOSOpenBSD())
   CmdArgs.push_back("-lrt");
   }
   CmdArgs.push_back("-lm");
   // There's no libdl on all OSes.
-  if (TC.getTriple().getOS() != llvm::Triple::FreeBSD &&
-  TC.getTriple().getOS() != llvm::Triple::NetBSD &&
-  TC.getTriple().getOS() != llvm::Triple::OpenBSD &&
-  TC.getTriple().getOS() != llvm::Triple::RTEMS)
+  if (!TC.getTriple().isOSFreeBSD() &&
+  !TC.getTriple().isOSNetBSD() &&
+  !TC.getTriple().isOSOpenBSD() &&
+   TC.getTriple().getOS() != llvm::Triple::RTEMS)
 CmdArgs.push_back("-ldl");
   // Required for backtrace on some OSes
-  if (TC.getTriple().getOS() == llvm::Triple::NetBSD ||
-  TC.getTriple().getOS() == llvm::Triple::FreeBSD)
+  if (TC.getTriple().isOSFreeBSD() ||
+  TC.getTriple().isOSNetBSD())
 CmdArgs.push_back("-lexecinfo");
 }
 
@@ -790,13 +790,13 @@
 void tools::linkXRayRuntimeDeps(const ToolChain &TC, ArgStringList &CmdArgs) {
   CmdArgs.push_back("--no-as-needed");
   CmdArgs.push_back("-lpthread");
-  if (TC.getTriple().getOS() != llvm::Triple::OpenBSD)
+  if (!TC.getTriple().isOSOpenBSD())
 CmdArgs.push_back("-lrt");
   CmdArgs.push_back("-lm");
 
-  if (TC.getTriple().getOS() != llvm::Triple::FreeBSD &&
-  TC.getTriple().getOS() != llvm::Triple::NetBSD &&
-  TC.getTriple().getOS() != llvm::Triple::OpenBSD)
+  if (!TC.getTriple().isOSFreeBSD() &&
+  !TC.getTriple().isOSNetBSD() &&
+  !TC.getTriple().isOSOpenBSD())
 CmdArgs.push_back("-ldl");
 }
 
@@ -933,

[PATCH] D55916: [clang] Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]

2018-12-20 Thread Michał Górny via Phabricator via cfe-commits
mgorny updated this revision to Diff 179021.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55916/new/

https://reviews.llvm.org/D55916

Files:
  lib/Basic/Targets/AArch64.cpp
  lib/Basic/Targets/ARM.cpp
  lib/Basic/Targets/Mips.h
  lib/Basic/Targets/PPC.cpp
  lib/Basic/Targets/PPC.h
  lib/Basic/Targets/Sparc.h
  lib/Driver/ToolChains/Arch/Mips.cpp
  lib/Driver/ToolChains/Clang.cpp
  lib/Driver/ToolChains/CommonArgs.cpp
  lib/Driver/ToolChains/Gnu.cpp
  lib/Driver/XRayArgs.cpp
  lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp

Index: lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
===
--- lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
+++ lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
@@ -29,10 +29,10 @@
   const llvm::Triple &T = Ctx.getTargetInfo().getTriple();
   return T.getVendor() == llvm::Triple::Apple ||
  T.getOS() == llvm::Triple::CloudABI ||
- T.getOS() == llvm::Triple::FreeBSD ||
- T.getOS() == llvm::Triple::NetBSD ||
- T.getOS() == llvm::Triple::OpenBSD ||
- T.getOS() == llvm::Triple::DragonFly;
+ T.isOSFreeBSD() ||
+ T.isOSNetBSD() ||
+ T.isOSOpenBSD() ||
+ T.isOSDragonFly();
 }
 
 namespace {
Index: lib/Driver/XRayArgs.cpp
===
--- lib/Driver/XRayArgs.cpp
+++ lib/Driver/XRayArgs.cpp
@@ -50,9 +50,9 @@
 D.Diag(diag::err_drv_clang_unsupported)
 << (std::string(XRayInstrumentOption) + " on " + Triple.str());
   }
-} else if (Triple.getOS() == llvm::Triple::FreeBSD ||
-   Triple.getOS() == llvm::Triple::OpenBSD ||
-   Triple.getOS() == llvm::Triple::NetBSD ||
+} else if (Triple.isOSFreeBSD() ||
+   Triple.isOSOpenBSD() ||
+   Triple.isOSNetBSD() ||
Triple.getOS() == llvm::Triple::Darwin) {
   if (Triple.getArch() != llvm::Triple::x86_64) {
 D.Diag(diag::err_drv_clang_unsupported)
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -2597,7 +2597,7 @@
   bool UseInitArrayDefault =
   getTriple().getArch() == llvm::Triple::aarch64 ||
   getTriple().getArch() == llvm::Triple::aarch64_be ||
-  (getTriple().getOS() == llvm::Triple::FreeBSD &&
+  (getTriple().isOSFreeBSD() &&
getTriple().getOSMajorVersion() >= 12) ||
   (getTriple().getOS() == llvm::Triple::Linux &&
((!GCCInstallation.isValid() || !V.isOlderThan(4, 7, 0)) ||
Index: lib/Driver/ToolChains/CommonArgs.cpp
===
--- lib/Driver/ToolChains/CommonArgs.cpp
+++ lib/Driver/ToolChains/CommonArgs.cpp
@@ -603,19 +603,19 @@
   if (TC.getTriple().getOS() != llvm::Triple::RTEMS &&
   !TC.getTriple().isAndroid()) {
 CmdArgs.push_back("-lpthread");
-if (TC.getTriple().getOS() != llvm::Triple::OpenBSD)
+if (TC.getTriple().isOSOpenBSD())
   CmdArgs.push_back("-lrt");
   }
   CmdArgs.push_back("-lm");
   // There's no libdl on all OSes.
-  if (TC.getTriple().getOS() != llvm::Triple::FreeBSD &&
-  TC.getTriple().getOS() != llvm::Triple::NetBSD &&
-  TC.getTriple().getOS() != llvm::Triple::OpenBSD &&
-  TC.getTriple().getOS() != llvm::Triple::RTEMS)
+  if (!TC.getTriple().isOSFreeBSD() &&
+  !TC.getTriple().isOSNetBSD() &&
+  !TC.getTriple().isOSOpenBSD() &&
+   TC.getTriple().getOS() != llvm::Triple::RTEMS)
 CmdArgs.push_back("-ldl");
   // Required for backtrace on some OSes
-  if (TC.getTriple().getOS() == llvm::Triple::NetBSD ||
-  TC.getTriple().getOS() == llvm::Triple::FreeBSD)
+  if (TC.getTriple().isOSFreeBSD() ||
+  TC.getTriple().isOSNetBSD())
 CmdArgs.push_back("-lexecinfo");
 }
 
@@ -790,13 +790,13 @@
 void tools::linkXRayRuntimeDeps(const ToolChain &TC, ArgStringList &CmdArgs) {
   CmdArgs.push_back("--no-as-needed");
   CmdArgs.push_back("-lpthread");
-  if (TC.getTriple().getOS() != llvm::Triple::OpenBSD)
+  if (!TC.getTriple().isOSOpenBSD())
 CmdArgs.push_back("-lrt");
   CmdArgs.push_back("-lm");
 
-  if (TC.getTriple().getOS() != llvm::Triple::FreeBSD &&
-  TC.getTriple().getOS() != llvm::Triple::NetBSD &&
-  TC.getTriple().getOS() != llvm::Triple::OpenBSD)
+  if (!TC.getTriple().isOSFreeBSD() &&
+  !TC.getTriple().isOSNetBSD() &&
+  !TC.getTriple().isOSOpenBSD())
 CmdArgs.push_back("-ldl");
 }
 
@@ -933,7 +933,7 @@
   }
 
   // OpenBSD-specific defaults for PIE
-  if (Triple.getOS() == llvm::Triple::OpenBSD) {
+  if (Triple.isOSOpenBSD()) {
 switch (ToolChain.getArch()) {
 case llvm::Triple::arm:
 case llvm::Triple::aarch64:
Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolCha

[PATCH] D55552: [Sema] Better static assert diagnostics for expressions involving temporaries.

2018-12-20 Thread Clement Courbet via Phabricator via cfe-commits
courbet added a comment.

Thanks for the comments !




Comment at: include/clang/AST/Type.h:995
   void getAsStringInternal(std::string &Str,
-   const PrintingPolicy &Policy) const {
-return getAsStringInternal(split(), Str, Policy);
-  }
+   const PrintingPolicy &Policy) const;
 

Quuxplusone wrote:
> Nit: could this function have been left in-line, and just changed `split()` 
> to `splitAccordingToPolicy(this, Policy)`?
> Even simpler, could `splitAccordingToPolicy` be made a member function of 
> `QualType`, so that most of these diffs could be simply 
> `s/split()/splitAccordingToPolicy(Policy)/` without introducing any new 
> temporary variables or anything?  I.e.
> ```
> void getAsStringInternal(std::string &Str,
>   const PrintingPolicy &Policy) const {
> return getAsStringInternal(splitAccordingToPolicy(Policy), Str, 
> Policy);
> }
> ```
> But if that would make the code harder to read instead of easier, then don't 
> mind me.
I'd rather avoid polluting the `QualType` API with `splitAccordingToPolicy()` 
which is really only useful for this use case.

>  without introducing any new temporary variables or anything? i.e.

Actually this is independent of the above change, done.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D2/new/

https://reviews.llvm.org/D2



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


r349729 - [Sema] Better static assert diagnostics for expressions involving temporaries/casts/....

2018-12-20 Thread Clement Courbet via cfe-commits
Author: courbet
Date: Thu Dec 20 01:05:15 2018
New Revision: 349729

URL: http://llvm.org/viewvc/llvm-project?rev=349729&view=rev
Log:
[Sema] Better static assert diagnostics for expressions involving 
temporaries/casts/

Summary:
Handles expressions such as:
 - `std::is_const()`
 - `std::is_const()()`;
 - `std::is_same(decltype(U()), V>::value`;

Reviewers: aaron.ballman, Quuxplusone

Subscribers: cfe-commits, llvm-commits

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

Modified:
cfe/trunk/include/clang/AST/PrettyPrinter.h
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/lib/AST/TypePrinter.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/SemaCXX/static-assert-cxx17.cpp
cfe/trunk/test/SemaCXX/static-assert.cpp

Modified: cfe/trunk/include/clang/AST/PrettyPrinter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/PrettyPrinter.h?rev=349729&r1=349728&r2=349729&view=diff
==
--- cfe/trunk/include/clang/AST/PrettyPrinter.h (original)
+++ cfe/trunk/include/clang/AST/PrettyPrinter.h Thu Dec 20 01:05:15 2018
@@ -51,7 +51,7 @@ struct PrintingPolicy {
 MSWChar(LO.MicrosoftExt && !LO.WChar), IncludeNewlines(true),
 MSVCFormatting(false), ConstantsAsWritten(false),
 SuppressImplicitBase(false), FullyQualifiedName(false),
-RemapFilePaths(false) {}
+RemapFilePaths(false), PrintCanonicalTypes(false) {}
 
   /// Adjust this printing policy for cases where it's known that we're
   /// printing C++ code (for instance, if AST dumping reaches a C++-only
@@ -228,6 +228,9 @@ struct PrintingPolicy {
   /// Whether to apply -fdebug-prefix-map to any file paths.
   unsigned RemapFilePaths : 1;
 
+  /// Whether to print types as written or canonically.
+  unsigned PrintCanonicalTypes : 1;
+
   /// When RemapFilePaths is true, this function performs the action.
   std::function remapPath;
 };

Modified: cfe/trunk/include/clang/AST/Type.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=349729&r1=349728&r2=349729&view=diff
==
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Thu Dec 20 01:05:15 2018
@@ -980,9 +980,7 @@ public:
 
   void print(raw_ostream &OS, const PrintingPolicy &Policy,
  const Twine &PlaceHolder = Twine(),
- unsigned Indentation = 0) const {
-print(split(), OS, Policy, PlaceHolder, Indentation);
-  }
+ unsigned Indentation = 0) const;
 
   static void print(SplitQualType split, raw_ostream &OS,
 const PrintingPolicy &policy, const Twine &PlaceHolder,
@@ -996,9 +994,7 @@ public:
 unsigned Indentation = 0);
 
   void getAsStringInternal(std::string &Str,
-   const PrintingPolicy &Policy) const {
-return getAsStringInternal(split(), Str, Policy);
-  }
+   const PrintingPolicy &Policy) const;
 
   static void getAsStringInternal(SplitQualType split, std::string &out,
   const PrintingPolicy &policy) {

Modified: cfe/trunk/lib/AST/TypePrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypePrinter.cpp?rev=349729&r1=349728&r2=349729&view=diff
==
--- cfe/trunk/lib/AST/TypePrinter.cpp (original)
+++ cfe/trunk/lib/AST/TypePrinter.cpp Thu Dec 20 01:05:15 2018
@@ -117,9 +117,7 @@ namespace {
 void spaceBeforePlaceHolder(raw_ostream &OS);
 void printTypeSpec(NamedDecl *D, raw_ostream &OS);
 
-void printBefore(const Type *ty, Qualifiers qs, raw_ostream &OS);
 void printBefore(QualType T, raw_ostream &OS);
-void printAfter(const Type *ty, Qualifiers qs, raw_ostream &OS);
 void printAfter(QualType T, raw_ostream &OS);
 void AppendScope(DeclContext *DC, raw_ostream &OS);
 void printTag(TagDecl *T, raw_ostream &OS);
@@ -129,6 +127,10 @@ namespace {
 void print##CLASS##Before(const CLASS##Type *T, raw_ostream &OS); \
 void print##CLASS##After(const CLASS##Type *T, raw_ostream &OS);
 #include "clang/AST/TypeNodes.def"
+
+  private:
+void printBefore(const Type *ty, Qualifiers qs, raw_ostream &OS);
+void printAfter(const Type *ty, Qualifiers qs, raw_ostream &OS);
   };
 
 } // namespace
@@ -160,8 +162,15 @@ void TypePrinter::spaceBeforePlaceHolder
 OS << ' ';
 }
 
+static SplitQualType splitAccordingToPolicy(QualType QT,
+const PrintingPolicy &Policy) {
+  if (Policy.PrintCanonicalTypes)
+QT = QT.getCanonicalType();
+  return QT.split();
+}
+
 void TypePrinter::print(QualType t, raw_ostream &OS, StringRef PlaceHolder) {
-  SplitQualType split = t.split();
+  SplitQualType split = splitAccordingToPolicy(t, Policy);
   print(split.Ty, split.Quals, OS, PlaceHolder);

[PATCH] D55552: [Sema] Better static assert diagnostics for expressions involving temporaries.

2018-12-20 Thread Clement Courbet via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL349729: [Sema] Better static assert diagnostics for 
expressions involving… (authored by courbet, committed by ).

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D2/new/

https://reviews.llvm.org/D2

Files:
  cfe/trunk/include/clang/AST/PrettyPrinter.h
  cfe/trunk/include/clang/AST/Type.h
  cfe/trunk/lib/AST/TypePrinter.cpp
  cfe/trunk/lib/Sema/SemaTemplate.cpp
  cfe/trunk/test/SemaCXX/static-assert-cxx17.cpp
  cfe/trunk/test/SemaCXX/static-assert.cpp

Index: cfe/trunk/include/clang/AST/PrettyPrinter.h
===
--- cfe/trunk/include/clang/AST/PrettyPrinter.h
+++ cfe/trunk/include/clang/AST/PrettyPrinter.h
@@ -51,7 +51,7 @@
 MSWChar(LO.MicrosoftExt && !LO.WChar), IncludeNewlines(true),
 MSVCFormatting(false), ConstantsAsWritten(false),
 SuppressImplicitBase(false), FullyQualifiedName(false),
-RemapFilePaths(false) {}
+RemapFilePaths(false), PrintCanonicalTypes(false) {}
 
   /// Adjust this printing policy for cases where it's known that we're
   /// printing C++ code (for instance, if AST dumping reaches a C++-only
@@ -228,6 +228,9 @@
   /// Whether to apply -fdebug-prefix-map to any file paths.
   unsigned RemapFilePaths : 1;
 
+  /// Whether to print types as written or canonically.
+  unsigned PrintCanonicalTypes : 1;
+
   /// When RemapFilePaths is true, this function performs the action.
   std::function remapPath;
 };
Index: cfe/trunk/include/clang/AST/Type.h
===
--- cfe/trunk/include/clang/AST/Type.h
+++ cfe/trunk/include/clang/AST/Type.h
@@ -980,9 +980,7 @@
 
   void print(raw_ostream &OS, const PrintingPolicy &Policy,
  const Twine &PlaceHolder = Twine(),
- unsigned Indentation = 0) const {
-print(split(), OS, Policy, PlaceHolder, Indentation);
-  }
+ unsigned Indentation = 0) const;
 
   static void print(SplitQualType split, raw_ostream &OS,
 const PrintingPolicy &policy, const Twine &PlaceHolder,
@@ -996,9 +994,7 @@
 unsigned Indentation = 0);
 
   void getAsStringInternal(std::string &Str,
-   const PrintingPolicy &Policy) const {
-return getAsStringInternal(split(), Str, Policy);
-  }
+   const PrintingPolicy &Policy) const;
 
   static void getAsStringInternal(SplitQualType split, std::string &out,
   const PrintingPolicy &policy) {
Index: cfe/trunk/test/SemaCXX/static-assert.cpp
===
--- cfe/trunk/test/SemaCXX/static-assert.cpp
+++ cfe/trunk/test/SemaCXX/static-assert.cpp
@@ -76,6 +76,8 @@
   static const Tp value = v;
   typedef Tp value_type;
   typedef integral_constant type;
+  constexpr operator value_type() const noexcept { return value; }
+  constexpr value_type operator()() const noexcept { return value; }
 };
 
 template 
@@ -103,6 +105,7 @@
 } // namespace std
 
 struct ExampleTypes {
+  explicit ExampleTypes(int);
   using T = int;
   using U = float;
 };
@@ -119,6 +122,18 @@
 // expected-error@-1{{static_assert failed due to requirement 'std::is_const::value == false' "message"}}
 static_assert(!(std::is_const::value == true), "message");
 // expected-error@-1{{static_assert failed due to requirement '!(std::is_const::value == true)' "message"}}
+static_assert(std::is_const(), "message");
+// expected-error@-1{{static_assert failed due to requirement 'std::is_const()' "message"}}
+static_assert(!(std::is_const()()), "message");
+// expected-error@-1{{static_assert failed due to requirement '!(std::is_const()())' "message"}}
+static_assert(std::is_same()), int>::value, "message");
+// expected-error@-1{{static_assert failed due to requirement 'std::is_same, int>::value' "message"}}
+static_assert(std::is_const::value, "message");
+// expected-error@-1{{static_assert failed due to requirement 'std::is_const::value' "message"}}
+static_assert(std::is_const::value, "message");
+// expected-error@-1{{static_assert failed due to requirement 'std::is_const::value' "message"}}
+static_assert(std::is_const::value, "message");
+// expected-error@-1{{static_assert failed due to requirement 'std::is_const::value' "message"}}
 
 struct BI_tag {};
 struct RAI_tag : BI_tag {};
Index: cfe/trunk/test/SemaCXX/static-assert-cxx17.cpp
===
--- cfe/trunk/test/SemaCXX/static-assert-cxx17.cpp
+++ cfe/trunk/test/SemaCXX/static-assert-cxx17.cpp
@@ -54,3 +54,44 @@
 }
 template void foo5();
 // expected-note@-1{{in instantiation of function template specialization 'foo5' requested here}}
+
+struct ExampleTypes {
+  explicit ExampleTypes(int);
+  using T = int;
+  using U = float;
+};
+
+template 
+struct X {
+  int i = 0;
+  int j = 

[PATCH] D55916: [clang] Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]

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



Comment at: lib/Basic/Targets/ARM.cpp:285
 default:
-  if (Triple.getOS() == llvm::Triple::NetBSD)
+  if (Triple.isOSNetBSD())
 setABI("apcs-gnu");

Actually we could use IsNetBSD and IsOpenBSD here.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55916/new/

https://reviews.llvm.org/D55916



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


[PATCH] D55918: [clangd] Don't miss the expected type in merge.

2018-12-20 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision.
hokein added a reviewer: ilya-biryukov.
Herald added subscribers: kadircet, arphaman, jkorous, MaskRay, ioeric.

Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D55918

Files:
  clangd/index/Merge.cpp
  unittests/clangd/IndexTests.cpp


Index: unittests/clangd/IndexTests.cpp
===
--- unittests/clangd/IndexTests.cpp
+++ unittests/clangd/IndexTests.cpp
@@ -219,6 +219,7 @@
   R.Documentation = "--doc--";
   L.Origin = SymbolOrigin::Dynamic;
   R.Origin = SymbolOrigin::Static;
+  R.Type = "expectedType";
 
   Symbol M = mergeSymbol(L, R);
   EXPECT_EQ(M.Name, "Foo");
@@ -227,6 +228,7 @@
   EXPECT_EQ(M.Signature, "()");
   EXPECT_EQ(M.CompletionSnippetSuffix, "{$1:0}");
   EXPECT_EQ(M.Documentation, "--doc--");
+  EXPECT_EQ(M.Type, "expectedType");
   EXPECT_EQ(M.Origin,
 SymbolOrigin::Dynamic | SymbolOrigin::Static | 
SymbolOrigin::Merge);
 }
Index: clangd/index/Merge.cpp
===
--- clangd/index/Merge.cpp
+++ clangd/index/Merge.cpp
@@ -134,6 +134,8 @@
 S.Documentation = O.Documentation;
   if (S.ReturnType == "")
 S.ReturnType = O.ReturnType;
+  if (S.Type == "")
+S.Type = O.Type;
   for (const auto &OI : O.IncludeHeaders) {
 bool Found = false;
 for (auto &SI : S.IncludeHeaders) {


Index: unittests/clangd/IndexTests.cpp
===
--- unittests/clangd/IndexTests.cpp
+++ unittests/clangd/IndexTests.cpp
@@ -219,6 +219,7 @@
   R.Documentation = "--doc--";
   L.Origin = SymbolOrigin::Dynamic;
   R.Origin = SymbolOrigin::Static;
+  R.Type = "expectedType";
 
   Symbol M = mergeSymbol(L, R);
   EXPECT_EQ(M.Name, "Foo");
@@ -227,6 +228,7 @@
   EXPECT_EQ(M.Signature, "()");
   EXPECT_EQ(M.CompletionSnippetSuffix, "{$1:0}");
   EXPECT_EQ(M.Documentation, "--doc--");
+  EXPECT_EQ(M.Type, "expectedType");
   EXPECT_EQ(M.Origin,
 SymbolOrigin::Dynamic | SymbolOrigin::Static | SymbolOrigin::Merge);
 }
Index: clangd/index/Merge.cpp
===
--- clangd/index/Merge.cpp
+++ clangd/index/Merge.cpp
@@ -134,6 +134,8 @@
 S.Documentation = O.Documentation;
   if (S.ReturnType == "")
 S.ReturnType = O.ReturnType;
+  if (S.Type == "")
+S.Type = O.Type;
   for (const auto &OI : O.IncludeHeaders) {
 bool Found = false;
 for (auto &SI : S.IncludeHeaders) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D55916: [clang] Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]

2018-12-20 Thread Michał Górny via Phabricator via cfe-commits
mgorny updated this revision to Diff 179031.
mgorny marked 2 inline comments as done.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55916/new/

https://reviews.llvm.org/D55916

Files:
  lib/Basic/Targets/AArch64.cpp
  lib/Basic/Targets/ARM.cpp
  lib/Basic/Targets/Mips.h
  lib/Basic/Targets/PPC.cpp
  lib/Basic/Targets/PPC.h
  lib/Basic/Targets/Sparc.h
  lib/Driver/ToolChains/Arch/Mips.cpp
  lib/Driver/ToolChains/Clang.cpp
  lib/Driver/ToolChains/CommonArgs.cpp
  lib/Driver/ToolChains/Gnu.cpp
  lib/Driver/XRayArgs.cpp
  lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp

Index: lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
===
--- lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
+++ lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
@@ -29,10 +29,10 @@
   const llvm::Triple &T = Ctx.getTargetInfo().getTriple();
   return T.getVendor() == llvm::Triple::Apple ||
  T.getOS() == llvm::Triple::CloudABI ||
- T.getOS() == llvm::Triple::FreeBSD ||
- T.getOS() == llvm::Triple::NetBSD ||
- T.getOS() == llvm::Triple::OpenBSD ||
- T.getOS() == llvm::Triple::DragonFly;
+ T.isOSFreeBSD() ||
+ T.isOSNetBSD() ||
+ T.isOSOpenBSD() ||
+ T.isOSDragonFly();
 }
 
 namespace {
Index: lib/Driver/XRayArgs.cpp
===
--- lib/Driver/XRayArgs.cpp
+++ lib/Driver/XRayArgs.cpp
@@ -50,9 +50,9 @@
 D.Diag(diag::err_drv_clang_unsupported)
 << (std::string(XRayInstrumentOption) + " on " + Triple.str());
   }
-} else if (Triple.getOS() == llvm::Triple::FreeBSD ||
-   Triple.getOS() == llvm::Triple::OpenBSD ||
-   Triple.getOS() == llvm::Triple::NetBSD ||
+} else if (Triple.isOSFreeBSD() ||
+   Triple.isOSOpenBSD() ||
+   Triple.isOSNetBSD() ||
Triple.getOS() == llvm::Triple::Darwin) {
   if (Triple.getArch() != llvm::Triple::x86_64) {
 D.Diag(diag::err_drv_clang_unsupported)
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -2597,7 +2597,7 @@
   bool UseInitArrayDefault =
   getTriple().getArch() == llvm::Triple::aarch64 ||
   getTriple().getArch() == llvm::Triple::aarch64_be ||
-  (getTriple().getOS() == llvm::Triple::FreeBSD &&
+  (getTriple().isOSFreeBSD() &&
getTriple().getOSMajorVersion() >= 12) ||
   (getTriple().getOS() == llvm::Triple::Linux &&
((!GCCInstallation.isValid() || !V.isOlderThan(4, 7, 0)) ||
Index: lib/Driver/ToolChains/CommonArgs.cpp
===
--- lib/Driver/ToolChains/CommonArgs.cpp
+++ lib/Driver/ToolChains/CommonArgs.cpp
@@ -603,19 +603,19 @@
   if (TC.getTriple().getOS() != llvm::Triple::RTEMS &&
   !TC.getTriple().isAndroid()) {
 CmdArgs.push_back("-lpthread");
-if (TC.getTriple().getOS() != llvm::Triple::OpenBSD)
+if (TC.getTriple().isOSOpenBSD())
   CmdArgs.push_back("-lrt");
   }
   CmdArgs.push_back("-lm");
   // There's no libdl on all OSes.
-  if (TC.getTriple().getOS() != llvm::Triple::FreeBSD &&
-  TC.getTriple().getOS() != llvm::Triple::NetBSD &&
-  TC.getTriple().getOS() != llvm::Triple::OpenBSD &&
-  TC.getTriple().getOS() != llvm::Triple::RTEMS)
+  if (!TC.getTriple().isOSFreeBSD() &&
+  !TC.getTriple().isOSNetBSD() &&
+  !TC.getTriple().isOSOpenBSD() &&
+   TC.getTriple().getOS() != llvm::Triple::RTEMS)
 CmdArgs.push_back("-ldl");
   // Required for backtrace on some OSes
-  if (TC.getTriple().getOS() == llvm::Triple::NetBSD ||
-  TC.getTriple().getOS() == llvm::Triple::FreeBSD)
+  if (TC.getTriple().isOSFreeBSD() ||
+  TC.getTriple().isOSNetBSD())
 CmdArgs.push_back("-lexecinfo");
 }
 
@@ -790,13 +790,13 @@
 void tools::linkXRayRuntimeDeps(const ToolChain &TC, ArgStringList &CmdArgs) {
   CmdArgs.push_back("--no-as-needed");
   CmdArgs.push_back("-lpthread");
-  if (TC.getTriple().getOS() != llvm::Triple::OpenBSD)
+  if (!TC.getTriple().isOSOpenBSD())
 CmdArgs.push_back("-lrt");
   CmdArgs.push_back("-lm");
 
-  if (TC.getTriple().getOS() != llvm::Triple::FreeBSD &&
-  TC.getTriple().getOS() != llvm::Triple::NetBSD &&
-  TC.getTriple().getOS() != llvm::Triple::OpenBSD)
+  if (!TC.getTriple().isOSFreeBSD() &&
+  !TC.getTriple().isOSNetBSD() &&
+  !TC.getTriple().isOSOpenBSD())
 CmdArgs.push_back("-ldl");
 }
 
@@ -933,7 +933,7 @@
   }
 
   // OpenBSD-specific defaults for PIE
-  if (Triple.getOS() == llvm::Triple::OpenBSD) {
+  if (Triple.isOSOpenBSD()) {
 switch (ToolChain.getArch()) {
 case llvm::Triple::arm:
 case llvm::Triple::aarch64:
Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/To

[PATCH] D55916: [clang] Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]

2018-12-20 Thread Michał Górny via Phabricator via cfe-commits
mgorny added inline comments.



Comment at: lib/Basic/Targets/ARM.cpp:285
 default:
-  if (Triple.getOS() == llvm::Triple::NetBSD)
+  if (Triple.isOSNetBSD())
 setABI("apcs-gnu");

krytarowski wrote:
> Actually we could use IsNetBSD and IsOpenBSD here.
Good catch. Thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55916/new/

https://reviews.llvm.org/D55916



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


[PATCH] D55862: [Sema] Don't try to account for the size of an incomplete type in CheckArrayAccess

2018-12-20 Thread Bruno Ricci via Phabricator via cfe-commits
riccibruno updated this revision to Diff 179035.
riccibruno added a comment.

Used `ArrayTy->getElementType()`


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55862/new/

https://reviews.llvm.org/D55862

Files:
  lib/Sema/SemaChecking.cpp
  test/SemaCXX/array-bounds.cpp


Index: test/SemaCXX/array-bounds.cpp
===
--- test/SemaCXX/array-bounds.cpp
+++ test/SemaCXX/array-bounds.cpp
@@ -284,3 +284,12 @@
 int test_struct_multiarray() {
   return multi2[4].arr[0]; // expected-warning {{array index 4 is past the end 
of the array (which contains 4 elements)}}
 }
+
+namespace PR39746 {
+  struct S;
+  extern S xxx[2];
+  class C {};
+
+  C &f() { return reinterpret_cast(xxx)[1]; } // no-warning
+  C &g() { return reinterpret_cast(xxx)[2]; } // no-warning
+}
Index: lib/Sema/SemaChecking.cpp
===
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -12353,10 +12353,19 @@
   BaseExpr->getType()->getPointeeOrArrayElementType();
   BaseExpr = BaseExpr->IgnoreParenCasts();
   const ConstantArrayType *ArrayTy =
-Context.getAsConstantArrayType(BaseExpr->getType());
+  Context.getAsConstantArrayType(BaseExpr->getType());
+
   if (!ArrayTy)
 return;
 
+  const Type *BaseType = ArrayTy->getElementType().getTypePtr();
+  // It is possible that the type of the base expression after IgnoreParenCasts
+  // is incomplete, even though the type of the base expression before
+  // IgnoreParenCasts is complete (see PR39746 for an example). In this case we
+  // have no information about whether the array access is out-of-bounds.
+  if (BaseType->isIncompleteType())
+return;
+
   Expr::EvalResult Result;
   if (!IndexExpr->EvaluateAsInt(Result, Context, Expr::SE_AllowSideEffects))
 return;
@@ -12376,7 +12385,6 @@
 if (!size.isStrictlyPositive())
   return;
 
-const Type *BaseType = BaseExpr->getType()->getPointeeOrArrayElementType();
 if (BaseType != EffectiveType) {
   // Make sure we're comparing apples to apples when comparing index to 
size
   uint64_t ptrarith_typesize = Context.getTypeSize(EffectiveType);


Index: test/SemaCXX/array-bounds.cpp
===
--- test/SemaCXX/array-bounds.cpp
+++ test/SemaCXX/array-bounds.cpp
@@ -284,3 +284,12 @@
 int test_struct_multiarray() {
   return multi2[4].arr[0]; // expected-warning {{array index 4 is past the end of the array (which contains 4 elements)}}
 }
+
+namespace PR39746 {
+  struct S;
+  extern S xxx[2];
+  class C {};
+
+  C &f() { return reinterpret_cast(xxx)[1]; } // no-warning
+  C &g() { return reinterpret_cast(xxx)[2]; } // no-warning
+}
Index: lib/Sema/SemaChecking.cpp
===
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -12353,10 +12353,19 @@
   BaseExpr->getType()->getPointeeOrArrayElementType();
   BaseExpr = BaseExpr->IgnoreParenCasts();
   const ConstantArrayType *ArrayTy =
-Context.getAsConstantArrayType(BaseExpr->getType());
+  Context.getAsConstantArrayType(BaseExpr->getType());
+
   if (!ArrayTy)
 return;
 
+  const Type *BaseType = ArrayTy->getElementType().getTypePtr();
+  // It is possible that the type of the base expression after IgnoreParenCasts
+  // is incomplete, even though the type of the base expression before
+  // IgnoreParenCasts is complete (see PR39746 for an example). In this case we
+  // have no information about whether the array access is out-of-bounds.
+  if (BaseType->isIncompleteType())
+return;
+
   Expr::EvalResult Result;
   if (!IndexExpr->EvaluateAsInt(Result, Context, Expr::SE_AllowSideEffects))
 return;
@@ -12376,7 +12385,6 @@
 if (!size.isStrictlyPositive())
   return;
 
-const Type *BaseType = BaseExpr->getType()->getPointeeOrArrayElementType();
 if (BaseType != EffectiveType) {
   // Make sure we're comparing apples to apples when comparing index to size
   uint64_t ptrarith_typesize = Context.getTypeSize(EffectiveType);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42043: c-index: CXString: fix MSAN read-past-end bug

2018-12-20 Thread Bruno Ricci via Phabricator via cfe-commits
riccibruno added a comment.

Is anyone working on this ? This is the only persistent msan failure when doing 
`check-clang` on my machine.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D42043/new/

https://reviews.llvm.org/D42043



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


r349743 - [X86][SSE] Auto upgrade PADDS/PSUBS intrinsics to SADD_SAT/SSUB_SAT generic intrinsics (clang)

2018-12-20 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Thu Dec 20 03:53:45 2018
New Revision: 349743

URL: http://llvm.org/viewvc/llvm-project?rev=349743&view=rev
Log:
[X86][SSE] Auto upgrade PADDS/PSUBS intrinsics to SADD_SAT/SSUB_SAT generic 
intrinsics (clang)

This emits SADD_SAT/SSUB_SAT generic intrinsics for the SSE signed saturated 
math intrinsics.

LLVM counterpart: https://reviews.llvm.org/D55894

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

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/avx2-builtins.c
cfe/trunk/test/CodeGen/avx512bw-builtins.c
cfe/trunk/test/CodeGen/avx512vlbw-builtins.c
cfe/trunk/test/CodeGen/sse2-builtins.c

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=349743&r1=349742&r2=349743&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Dec 20 03:53:45 2018
@@ -9487,12 +9487,13 @@ static Value *EmitX86SExtMask(CodeGenFun
   return CGF.Builder.CreateSExt(Mask, DstTy, "vpmovm2");
 }
 
-// Emit addition or subtraction with unsigned saturation.
-// TODO: Handle signed intrinsics.
+// Emit addition or subtraction with signed/unsigned saturation.
 static Value *EmitX86AddSubSatExpr(CodeGenFunction &CGF,
-   SmallVectorImpl &Ops,
+   ArrayRef Ops, bool IsSigned,
bool IsAddition) {
-  Intrinsic::ID IID = IsAddition ? Intrinsic::uadd_sat : Intrinsic::usub_sat;
+  Intrinsic::ID IID =
+  IsSigned ? (IsAddition ? Intrinsic::sadd_sat : Intrinsic::ssub_sat)
+   : (IsAddition ? Intrinsic::uadd_sat : Intrinsic::usub_sat);
   llvm::Function *F = CGF.CGM.getIntrinsic(IID, Ops[0]->getType());
   return CGF.Builder.CreateCall(F, {Ops[0], Ops[1]});
 }
@@ -11359,20 +11360,34 @@ Value *CodeGenFunction::EmitX86BuiltinEx
 Load->setVolatile(true);
 return Load;
   }
+  case X86::BI__builtin_ia32_paddsb512:
+  case X86::BI__builtin_ia32_paddsw512:
+  case X86::BI__builtin_ia32_paddsb256:
+  case X86::BI__builtin_ia32_paddsw256:
+  case X86::BI__builtin_ia32_paddsb128:
+  case X86::BI__builtin_ia32_paddsw128:
+return EmitX86AddSubSatExpr(*this, Ops, true, true);
   case X86::BI__builtin_ia32_paddusb512:
   case X86::BI__builtin_ia32_paddusw512:
   case X86::BI__builtin_ia32_paddusb256:
   case X86::BI__builtin_ia32_paddusw256:
   case X86::BI__builtin_ia32_paddusb128:
   case X86::BI__builtin_ia32_paddusw128:
-return EmitX86AddSubSatExpr(*this, Ops, true /* IsAddition */);
+return EmitX86AddSubSatExpr(*this, Ops, false, true);
+  case X86::BI__builtin_ia32_psubsb512:
+  case X86::BI__builtin_ia32_psubsw512:
+  case X86::BI__builtin_ia32_psubsb256:
+  case X86::BI__builtin_ia32_psubsw256:
+  case X86::BI__builtin_ia32_psubsb128:
+  case X86::BI__builtin_ia32_psubsw128:
+return EmitX86AddSubSatExpr(*this, Ops, true, false);
   case X86::BI__builtin_ia32_psubusb512:
   case X86::BI__builtin_ia32_psubusw512:
   case X86::BI__builtin_ia32_psubusb256:
   case X86::BI__builtin_ia32_psubusw256:
   case X86::BI__builtin_ia32_psubusb128:
   case X86::BI__builtin_ia32_psubusw128:
-return EmitX86AddSubSatExpr(*this, Ops, false /* IsAddition */);
+return EmitX86AddSubSatExpr(*this, Ops, false, false);
   }
 }
 

Modified: cfe/trunk/test/CodeGen/avx2-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx2-builtins.c?rev=349743&r1=349742&r2=349743&view=diff
==
--- cfe/trunk/test/CodeGen/avx2-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx2-builtins.c Thu Dec 20 03:53:45 2018
@@ -56,13 +56,13 @@ __m256i test_mm256_add_epi64(__m256i a,
 
 __m256i test_mm256_adds_epi8(__m256i a, __m256i b) {
   // CHECK-LABEL: test_mm256_adds_epi8
-  // CHECK: call <32 x i8> @llvm.x86.avx2.padds.b(<32 x i8> %{{.*}}, <32 x i8> 
%{{.*}})
+  // CHECK: call <32 x i8> @llvm.sadd.sat.v32i8(<32 x i8> %{{.*}}, <32 x i8> 
%{{.*}})
   return _mm256_adds_epi8(a, b);
 }
 
 __m256i test_mm256_adds_epi16(__m256i a, __m256i b) {
   // CHECK-LABEL: test_mm256_adds_epi16
-  // CHECK: call <16 x i16> @llvm.x86.avx2.padds.w(<16 x i16> %{{.*}}, <16 x 
i16> %{{.*}})
+  // CHECK: call <16 x i16> @llvm.sadd.sat.v16i16(<16 x i16> %{{.*}}, <16 x 
i16> %{{.*}})
   return _mm256_adds_epi16(a, b);
 }
 
@@ -1171,13 +1171,13 @@ __m256i test_mm256_sub_epi64(__m256i a,
 
 __m256i test_mm256_subs_epi8(__m256i a, __m256i b) {
   // CHECK-LABEL: test_mm256_subs_epi8
-  // CHECK: call <32 x i8> @llvm.x86.avx2.psubs.b(<32 x i8> %{{.*}}, <32 x i8> 
%{{.*}})
+  // CHECK: call <32 x i8> @llvm.ssub.sat.v32i8(<32 x i8> %{{.*}}, <32 x i8> 
%{{.*}})
   return _mm256_subs_epi8(a, b);
 }
 
 __m256i test_mm256_subs_epi16(__m256i a, __m256i b) {
   // CHECK-LABEL: test_mm256_subs_epi16
-  // CHECK: call <16 x i

[PATCH] D55890: [X86][SSE] Auto upgrade PADDS/PSUBS intrinsics to SADD_SAT/SSUB_SAT generic intrinsics (clang)

2018-12-20 Thread Simon Pilgrim via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL349743: [X86][SSE] Auto upgrade PADDS/PSUBS intrinsics to 
SADD_SAT/SSUB_SAT generic… (authored by RKSimon, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D55890?vs=178946&id=179036#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55890/new/

https://reviews.llvm.org/D55890

Files:
  cfe/trunk/lib/CodeGen/CGBuiltin.cpp
  cfe/trunk/test/CodeGen/avx2-builtins.c
  cfe/trunk/test/CodeGen/avx512bw-builtins.c
  cfe/trunk/test/CodeGen/avx512vlbw-builtins.c
  cfe/trunk/test/CodeGen/sse2-builtins.c

Index: cfe/trunk/test/CodeGen/avx2-builtins.c
===
--- cfe/trunk/test/CodeGen/avx2-builtins.c
+++ cfe/trunk/test/CodeGen/avx2-builtins.c
@@ -56,13 +56,13 @@
 
 __m256i test_mm256_adds_epi8(__m256i a, __m256i b) {
   // CHECK-LABEL: test_mm256_adds_epi8
-  // CHECK: call <32 x i8> @llvm.x86.avx2.padds.b(<32 x i8> %{{.*}}, <32 x i8> %{{.*}})
+  // CHECK: call <32 x i8> @llvm.sadd.sat.v32i8(<32 x i8> %{{.*}}, <32 x i8> %{{.*}})
   return _mm256_adds_epi8(a, b);
 }
 
 __m256i test_mm256_adds_epi16(__m256i a, __m256i b) {
   // CHECK-LABEL: test_mm256_adds_epi16
-  // CHECK: call <16 x i16> @llvm.x86.avx2.padds.w(<16 x i16> %{{.*}}, <16 x i16> %{{.*}})
+  // CHECK: call <16 x i16> @llvm.sadd.sat.v16i16(<16 x i16> %{{.*}}, <16 x i16> %{{.*}})
   return _mm256_adds_epi16(a, b);
 }
 
@@ -1171,13 +1171,13 @@
 
 __m256i test_mm256_subs_epi8(__m256i a, __m256i b) {
   // CHECK-LABEL: test_mm256_subs_epi8
-  // CHECK: call <32 x i8> @llvm.x86.avx2.psubs.b(<32 x i8> %{{.*}}, <32 x i8> %{{.*}})
+  // CHECK: call <32 x i8> @llvm.ssub.sat.v32i8(<32 x i8> %{{.*}}, <32 x i8> %{{.*}})
   return _mm256_subs_epi8(a, b);
 }
 
 __m256i test_mm256_subs_epi16(__m256i a, __m256i b) {
   // CHECK-LABEL: test_mm256_subs_epi16
-  // CHECK: call <16 x i16> @llvm.x86.avx2.psubs.w(<16 x i16> %{{.*}}, <16 x i16> %{{.*}})
+  // CHECK: call <16 x i16> @llvm.ssub.sat.v16i16(<16 x i16> %{{.*}}, <16 x i16> %{{.*}})
   return _mm256_subs_epi16(a, b);
 }
 
Index: cfe/trunk/test/CodeGen/avx512vlbw-builtins.c
===
--- cfe/trunk/test/CodeGen/avx512vlbw-builtins.c
+++ cfe/trunk/test/CodeGen/avx512vlbw-builtins.c
@@ -1075,49 +1075,49 @@
 
 __m128i test_mm_mask_adds_epi8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B) {
   // CHECK-LABEL: @test_mm_mask_adds_epi8
-  // CHECK: @llvm.x86.sse2.padds.b
+  // CHECK: @llvm.sadd.sat.v16i8
   // CHECK: select <16 x i1> %{{.*}}, <16 x i8> %{{.*}}, <16 x i8> %{{.*}}
   return _mm_mask_adds_epi8(__W,__U,__A,__B); 
 }
 __m128i test_mm_maskz_adds_epi8(__mmask16 __U, __m128i __A, __m128i __B) {
   // CHECK-LABEL: @test_mm_maskz_adds_epi8
-  // CHECK: @llvm.x86.sse2.padds.b
+  // CHECK: @llvm.sadd.sat.v16i8
   // CHECK: select <16 x i1> %{{.*}}, <16 x i8> %{{.*}}, <16 x i8> %{{.*}}
   return _mm_maskz_adds_epi8(__U,__A,__B); 
 }
 __m256i test_mm256_mask_adds_epi8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B) {
   // CHECK-LABEL: @test_mm256_mask_adds_epi8
-  // CHECK: @llvm.x86.avx2.padds.b
+  // CHECK: @llvm.sadd.sat.v32i8
   // CHECK: select <32 x i1> %{{.*}}, <32 x i8> %{{.*}}, <32 x i8> %{{.*}}
   return _mm256_mask_adds_epi8(__W,__U,__A,__B); 
 }
 __m256i test_mm256_maskz_adds_epi8(__mmask32 __U, __m256i __A, __m256i __B) {
   // CHECK-LABEL: @test_mm256_maskz_adds_epi8
-  // CHECK: @llvm.x86.avx2.padds.b
+  // CHECK: @llvm.sadd.sat.v32i8
   // CHECK: select <32 x i1> %{{.*}}, <32 x i8> %{{.*}}, <32 x i8> %{{.*}}
   return _mm256_maskz_adds_epi8(__U,__A,__B); 
 }
 __m128i test_mm_mask_adds_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
   // CHECK-LABEL: @test_mm_mask_adds_epi16
-  // CHECK: @llvm.x86.sse2.padds.w
+  // CHECK: @llvm.sadd.sat.v8i16
   // CHECK: select <8 x i1> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}}
   return _mm_mask_adds_epi16(__W,__U,__A,__B); 
 }
 __m128i test_mm_maskz_adds_epi16(__mmask8 __U, __m128i __A, __m128i __B) {
   // CHECK-LABEL: @test_mm_maskz_adds_epi16
-  // CHECK: @llvm.x86.sse2.padds.w
+  // CHECK: @llvm.sadd.sat.v8i16
   // CHECK: select <8 x i1> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}}
   return _mm_maskz_adds_epi16(__U,__A,__B); 
 }
 __m256i test_mm256_mask_adds_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B) {
   // CHECK-LABEL: @test_mm256_mask_adds_epi16
-  // CHECK: @llvm.x86.avx2.padds.w
+  // CHECK: @llvm.sadd.sat.v16i16
   // CHECK: select <16 x i1> %{{.*}}, <16 x i16> %{{.*}}, <16 x i16> %{{.*}}
   return _mm256_mask_adds_epi16(__W,__U,__A,__B); 
 }
 __m256i test_mm256_maskz_adds_epi16(__mmask16 __U, __m256i __A, __m256i __B) {
   // CHECK-LABEL: @test_mm256_maskz_adds_epi16
-  // CHECK: @llvm.x86.avx2.padds.w
+  // CHECK: @llvm.sadd.sat.v16i16
   // CHECK: select <16 x i1> %{{.*}}, <16 x i16> %{{.*}}, <16 x i16> %{{.*}}
   return _mm256_maskz_adds_epi16(__U,__A

[PATCH] D55363: [clangd] Expose FileStatus in LSP.

2018-12-20 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 179041.
hokein marked 3 inline comments as done.
hokein added a comment.

address review comments.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55363/new/

https://reviews.llvm.org/D55363

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/Protocol.cpp
  clangd/Protocol.h
  clangd/TUScheduler.cpp
  clangd/TUScheduler.h
  clangd/index/Merge.cpp
  test/clangd/filestatus.test
  unittests/clangd/IndexTests.cpp

Index: unittests/clangd/IndexTests.cpp
===
--- unittests/clangd/IndexTests.cpp
+++ unittests/clangd/IndexTests.cpp
@@ -219,6 +219,7 @@
   R.Documentation = "--doc--";
   L.Origin = SymbolOrigin::Dynamic;
   R.Origin = SymbolOrigin::Static;
+  R.Type = "expectedType";
 
   Symbol M = mergeSymbol(L, R);
   EXPECT_EQ(M.Name, "Foo");
@@ -227,6 +228,7 @@
   EXPECT_EQ(M.Signature, "()");
   EXPECT_EQ(M.CompletionSnippetSuffix, "{$1:0}");
   EXPECT_EQ(M.Documentation, "--doc--");
+  EXPECT_EQ(M.Type, "expectedType");
   EXPECT_EQ(M.Origin,
 SymbolOrigin::Dynamic | SymbolOrigin::Static | SymbolOrigin::Merge);
 }
Index: test/clangd/filestatus.test
===
--- /dev/null
+++ test/clangd/filestatus.test
@@ -0,0 +1,14 @@
+# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
+{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"initializationOptions":{"fileStatus": true},"trace":"off"}}
+---
+{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"int x; int y = x;"}}}
+#  CHECK:  "method": "textDocument/clangd.fileStatus",
+# CHECK-NEXT:  "params": {
+# CHECK-NEXT:"details": [],
+# CHECK-NEXT:"state": "parsing includes",
+# CHECK-NEXT:"uri": "{{.*}}/main.cpp"
+# CHECK-NEXT:  }
+---
+{"jsonrpc":"2.0","id":3,"method":"shutdown"}
+---
+{"jsonrpc":"2.0","method":"exit"}
Index: clangd/index/Merge.cpp
===
--- clangd/index/Merge.cpp
+++ clangd/index/Merge.cpp
@@ -134,6 +134,8 @@
 S.Documentation = O.Documentation;
   if (S.ReturnType == "")
 S.ReturnType = O.ReturnType;
+  if (S.Type == "")
+S.Type = O.Type;
   for (const auto &OI : O.IncludeHeaders) {
 bool Found = false;
 for (auto &SI : S.IncludeHeaders) {
Index: clangd/TUScheduler.h
===
--- clangd/TUScheduler.h
+++ clangd/TUScheduler.h
@@ -77,6 +77,8 @@
 /// Indicates whether we reused the prebuilt AST.
 bool ReuseAST = false;
   };
+  /// Serialize this to an LSP file status item.
+  FileStatus render(PathRef File) const;
 
   TUAction Action;
   BuildDetails Details;
Index: clangd/TUScheduler.cpp
===
--- clangd/TUScheduler.cpp
+++ clangd/TUScheduler.cpp
@@ -729,6 +729,33 @@
   return wait(Lock, RequestsCV, Timeout, [&] { return Requests.empty(); });
 }
 
+// Render a TUAction to a user-facing string representation.
+// TUAction represents clangd-internal states, we don't intend to expose them
+// to users (say C++ programmers) directly to avoid confusion, we use terms that
+// are familiar by C++ programmers.
+std::string renderTUAction(const TUAction& Action) {
+  std::string Result;
+  raw_string_ostream OS(Result);
+  switch (Action.S) {
+  case TUAction::Queued:
+OS << "file is queued";
+break;
+  case TUAction::RunningAction:
+OS << "running " << Action.Name;
+break;
+  case TUAction::BuildingPreamble:
+OS << "parsing includes";
+break;
+  case TUAction::BuildingFile:
+OS << "parsing main file";
+break;
+  case TUAction::Idle:
+OS << "idle";
+break;
+  }
+  return OS.str();
+}
+
 } // namespace
 
 unsigned getDefaultAsyncThreadsCount() {
@@ -741,6 +768,17 @@
   return HardwareConcurrency;
 }
 
+FileStatus TUStatus::render(PathRef File) const {
+  FileStatus FStatus;
+  FStatus.uri = URIForFile::canonicalize(File, /*TUPath=*/File);
+  FStatus.state = renderTUAction(Action);
+  if (Details.BuildFailed)
+FStatus.details.push_back({MessageType::Error, "failed to build the file"});
+  if (Details.ReuseAST)
+FStatus.details.push_back({MessageType::Info, "reused the AST"});
+  return FStatus;
+}
+
 struct TUScheduler::FileData {
   /// Latest inputs, passed to TUScheduler::update().
   std::string Contents;
Index: clangd/Protocol.h
===
--- clangd/Protocol.h
+++ clangd/Protocol.h
@@ -397,6 +397,9 @@
   // the compilation database doesn't describe an opened file.
   // The command used will be approximately `clang $FILE $fallbackFlags`.
   std::vector fallbackFlags;
+
+  /// Clients supports show file status for textDocument/clangd.fileStatus.

[PATCH] D55363: [clangd] Expose FileStatus in LSP.

2018-12-20 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

In D55363#1336315 , @ilya-biryukov 
wrote:

> Could we add a capability to the init request to check for this extension? We 
> don't want to send those notifications to clients that don't have the code to 
> handle them.


yes, I think we should add it to `initializationOptions`, since LSP clients 
don't provide interfaces to customize `TextDocumentClientCapabilities`.

> Another observation: when I played around with the previous version of the 
> patch, `RunningAction` and `BuildingAST` where constantly "blinking", i.e. it 
> changes faster than I can read it.
>  This lead to them being irritating and not providing any actual value.

This depends on the file, for some huge files, `BuildingAST` `RunningAction` 
may take a while, but I agree that for most small files, these two are fast :).

> Maybe consider sending an update after some period of time, e.g. `0.5s`? (I 
> expect this particular strategy to be a bit complicated and out of scope of 
> this patch, so another alternative is to simply not send them to the clients 
> in the first version). WDYT?

Sounds fair, keeping status bar  `blinking` seems annony to users. Added a 
FIXME.




Comment at: clangd/Protocol.h:999
+  /// Details of the state that are worth sufacing to users.
+  std::vector details;
+};

ilya-biryukov wrote:
> Why not `vector`? What's the use of the `MessageType`?
`MessageType` indicates the importance of the message. Editors might choose 
different UI for showing different message (e.g. in vscode, `error` message are 
prompted with a red icon; while `Info` are prompted with a yellow icon).


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55363/new/

https://reviews.llvm.org/D55363



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


[PATCH] D55918: [clangd] Don't miss the expected type in merge.

2018-12-20 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55918/new/

https://reviews.llvm.org/D55918



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


[clang-tools-extra] r349750 - [clangd] Don't miss the expected type in merge.

2018-12-20 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Thu Dec 20 05:05:46 2018
New Revision: 349750

URL: http://llvm.org/viewvc/llvm-project?rev=349750&view=rev
Log:
[clangd] Don't miss the expected type in merge.

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

Modified:
clang-tools-extra/trunk/clangd/index/Merge.cpp
clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp

Modified: clang-tools-extra/trunk/clangd/index/Merge.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/Merge.cpp?rev=349750&r1=349749&r2=349750&view=diff
==
--- clang-tools-extra/trunk/clangd/index/Merge.cpp (original)
+++ clang-tools-extra/trunk/clangd/index/Merge.cpp Thu Dec 20 05:05:46 2018
@@ -134,6 +134,8 @@ Symbol mergeSymbol(const Symbol &L, cons
 S.Documentation = O.Documentation;
   if (S.ReturnType == "")
 S.ReturnType = O.ReturnType;
+  if (S.Type == "")
+S.Type = O.Type;
   for (const auto &OI : O.IncludeHeaders) {
 bool Found = false;
 for (auto &SI : S.IncludeHeaders) {

Modified: clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp?rev=349750&r1=349749&r2=349750&view=diff
==
--- clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp Thu Dec 20 05:05:46 
2018
@@ -219,6 +219,7 @@ TEST(MergeTest, Merge) {
   R.Documentation = "--doc--";
   L.Origin = SymbolOrigin::Dynamic;
   R.Origin = SymbolOrigin::Static;
+  R.Type = "expectedType";
 
   Symbol M = mergeSymbol(L, R);
   EXPECT_EQ(M.Name, "Foo");
@@ -227,6 +228,7 @@ TEST(MergeTest, Merge) {
   EXPECT_EQ(M.Signature, "()");
   EXPECT_EQ(M.CompletionSnippetSuffix, "{$1:0}");
   EXPECT_EQ(M.Documentation, "--doc--");
+  EXPECT_EQ(M.Type, "expectedType");
   EXPECT_EQ(M.Origin,
 SymbolOrigin::Dynamic | SymbolOrigin::Static | 
SymbolOrigin::Merge);
 }


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


[PATCH] D55918: [clangd] Don't miss the expected type in merge.

2018-12-20 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL349750: [clangd] Don't miss the expected type in merge. 
(authored by hokein, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55918/new/

https://reviews.llvm.org/D55918

Files:
  clang-tools-extra/trunk/clangd/index/Merge.cpp
  clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp


Index: clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp
===
--- clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp
+++ clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp
@@ -219,6 +219,7 @@
   R.Documentation = "--doc--";
   L.Origin = SymbolOrigin::Dynamic;
   R.Origin = SymbolOrigin::Static;
+  R.Type = "expectedType";
 
   Symbol M = mergeSymbol(L, R);
   EXPECT_EQ(M.Name, "Foo");
@@ -227,6 +228,7 @@
   EXPECT_EQ(M.Signature, "()");
   EXPECT_EQ(M.CompletionSnippetSuffix, "{$1:0}");
   EXPECT_EQ(M.Documentation, "--doc--");
+  EXPECT_EQ(M.Type, "expectedType");
   EXPECT_EQ(M.Origin,
 SymbolOrigin::Dynamic | SymbolOrigin::Static | 
SymbolOrigin::Merge);
 }
Index: clang-tools-extra/trunk/clangd/index/Merge.cpp
===
--- clang-tools-extra/trunk/clangd/index/Merge.cpp
+++ clang-tools-extra/trunk/clangd/index/Merge.cpp
@@ -134,6 +134,8 @@
 S.Documentation = O.Documentation;
   if (S.ReturnType == "")
 S.ReturnType = O.ReturnType;
+  if (S.Type == "")
+S.Type = O.Type;
   for (const auto &OI : O.IncludeHeaders) {
 bool Found = false;
 for (auto &SI : S.IncludeHeaders) {


Index: clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp
===
--- clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp
+++ clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp
@@ -219,6 +219,7 @@
   R.Documentation = "--doc--";
   L.Origin = SymbolOrigin::Dynamic;
   R.Origin = SymbolOrigin::Static;
+  R.Type = "expectedType";
 
   Symbol M = mergeSymbol(L, R);
   EXPECT_EQ(M.Name, "Foo");
@@ -227,6 +228,7 @@
   EXPECT_EQ(M.Signature, "()");
   EXPECT_EQ(M.CompletionSnippetSuffix, "{$1:0}");
   EXPECT_EQ(M.Documentation, "--doc--");
+  EXPECT_EQ(M.Type, "expectedType");
   EXPECT_EQ(M.Origin,
 SymbolOrigin::Dynamic | SymbolOrigin::Static | SymbolOrigin::Merge);
 }
Index: clang-tools-extra/trunk/clangd/index/Merge.cpp
===
--- clang-tools-extra/trunk/clangd/index/Merge.cpp
+++ clang-tools-extra/trunk/clangd/index/Merge.cpp
@@ -134,6 +134,8 @@
 S.Documentation = O.Documentation;
   if (S.ReturnType == "")
 S.ReturnType = O.ReturnType;
+  if (S.Type == "")
+S.Type = O.Type;
   for (const auto &OI : O.IncludeHeaders) {
 bool Found = false;
 for (auto &SI : S.IncludeHeaders) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r349751 - [SystemZ] Fix wrong codegen caused by typos in vecintrin.h

2018-12-20 Thread Ulrich Weigand via cfe-commits
Author: uweigand
Date: Thu Dec 20 05:09:09 2018
New Revision: 349751

URL: http://llvm.org/viewvc/llvm-project?rev=349751&view=rev
Log:
[SystemZ] Fix wrong codegen caused by typos in vecintrin.h

The following two bugs in SystemZ high-level vector intrinsics are
fixes by this patch:

- The float case of vec_insert_and_zero should generate a VLLEZF
  pattern, but currently erroneously generates VLLEZLF.

- The float and double versions of vec_orc erroneously generate
  and-with-complement instead of or-with-complement.

The patch also fixes a couple of typos in the associated test.


Modified:
cfe/trunk/lib/Headers/vecintrin.h
cfe/trunk/test/CodeGen/builtins-systemz-zvector2.c

Modified: cfe/trunk/lib/Headers/vecintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/vecintrin.h?rev=349751&r1=349750&r2=349751&view=diff
==
--- cfe/trunk/lib/Headers/vecintrin.h (original)
+++ cfe/trunk/lib/Headers/vecintrin.h Thu Dec 20 05:09:09 2018
@@ -381,7 +381,7 @@ vec_insert_and_zero(const unsigned long
 static inline __ATTRS_o_ai vector float
 vec_insert_and_zero(const float *__ptr) {
   vector float __vec = (vector float)0;
-  __vec[0] = *__ptr;
+  __vec[1] = *__ptr;
   return __vec;
 }
 #endif
@@ -5942,13 +5942,13 @@ vec_orc(vector unsigned long long __a, v
 
 static inline __ATTRS_o_ai vector float
 vec_orc(vector float __a, vector float __b) {
-  return (vector float)((vector unsigned int)__a &
+  return (vector float)((vector unsigned int)__a |
 ~(vector unsigned int)__b);
 }
 
 static inline __ATTRS_o_ai vector double
 vec_orc(vector double __a, vector double __b) {
-  return (vector double)((vector unsigned long long)__a &
+  return (vector double)((vector unsigned long long)__a |
  ~(vector unsigned long long)__b);
 }
 #endif

Modified: cfe/trunk/test/CodeGen/builtins-systemz-zvector2.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-systemz-zvector2.c?rev=349751&r1=349750&r2=349751&view=diff
==
--- cfe/trunk/test/CodeGen/builtins-systemz-zvector2.c (original)
+++ cfe/trunk/test/CodeGen/builtins-systemz-zvector2.c Thu Dec 20 05:09:09 2018
@@ -65,9 +65,9 @@ void test_core(void) {
   d = vec_extract(vd, idx);
   // CHECK: extractelement <2 x double> %{{.*}}, i32 %{{.*}}
 
-  vf = vec_insert(d, vf, idx);
+  vf = vec_insert(f, vf, idx);
   // CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 %{{.*}}
-  vd = vec_insert(f, vd, idx);
+  vd = vec_insert(d, vd, idx);
   // CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 %{{.*}}
 
   vf = vec_promote(f, idx);
@@ -76,7 +76,7 @@ void test_core(void) {
   // CHECK: insertelement <2 x double> undef, double %{{.*}}, i32 %{{.*}}
 
   vf = vec_insert_and_zero(cptrf);
-  // CHECK: insertelement <4 x float> , float %{{.*}}, i32 0
+  // CHECK: insertelement <4 x float> , float %{{.*}}, i32 1
   vd = vec_insert_and_zero(cptrd);
   // CHECK: insertelement <2 x double> , 
double %{{.*}}, i32 0
 
@@ -227,8 +227,8 @@ void test_compare(void) {
   idx = vec_all_lt(vd, vd);
   // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchdbs(<2 x double> %{{.*}}, 
<2 x double> %{{.*}})
 
-  idx = vec_all_nge(vd, vd);
-  // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchedbs(<2 x double> %{{.*}}, 
<2 x double> %{{.*}})
+  idx = vec_all_nge(vf, vf);
+  // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchesbs(<4 x float> %{{.*}}, 
<4 x float> %{{.*}})
   idx = vec_all_nge(vd, vd);
   // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchedbs(<2 x double> %{{.*}}, 
<2 x double> %{{.*}})
 


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


r349752 - Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]

2018-12-20 Thread Michal Gorny via cfe-commits
Author: mgorny
Date: Thu Dec 20 05:09:30 2018
New Revision: 349752

URL: http://llvm.org/viewvc/llvm-project?rev=349752&view=rev
Log:
Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]

Replace multiple comparisons of getOS() value with FreeBSD, NetBSD,
OpenBSD and DragonFly with matching isOS*BSD() methods.  This should
improve the consistency of coding style without changing the behavior.
Direct getOS() comparisons were left whenever used in switch or switch-
like context.

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

Modified:
cfe/trunk/lib/Basic/Targets/AArch64.cpp
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/lib/Basic/Targets/Mips.h
cfe/trunk/lib/Basic/Targets/PPC.cpp
cfe/trunk/lib/Basic/Targets/PPC.h
cfe/trunk/lib/Basic/Targets/Sparc.h
cfe/trunk/lib/Driver/ToolChains/Arch/Mips.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
cfe/trunk/lib/Driver/XRayArgs.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp

Modified: cfe/trunk/lib/Basic/Targets/AArch64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/AArch64.cpp?rev=349752&r1=349751&r2=349752&view=diff
==
--- cfe/trunk/lib/Basic/Targets/AArch64.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/AArch64.cpp Thu Dec 20 05:09:30 2018
@@ -37,11 +37,11 @@ const Builtin::Info AArch64TargetInfo::B
 AArch64TargetInfo::AArch64TargetInfo(const llvm::Triple &Triple,
  const TargetOptions &Opts)
 : TargetInfo(Triple), ABI("aapcs") {
-  if (getTriple().getOS() == llvm::Triple::OpenBSD) {
+  if (getTriple().isOSOpenBSD()) {
 Int64Type = SignedLongLong;
 IntMaxType = SignedLongLong;
   } else {
-if (!getTriple().isOSDarwin() && getTriple().getOS() != 
llvm::Triple::NetBSD)
+if (!getTriple().isOSDarwin() && !getTriple().isOSNetBSD())
   WCharType = UnsignedInt;
 
 Int64Type = SignedLong;

Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=349752&r1=349751&r2=349752&view=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp Thu Dec 20 05:09:30 2018
@@ -28,8 +28,8 @@ void ARMTargetInfo::setABIAAPCS() {
   DoubleAlign = LongLongAlign = LongDoubleAlign = SuitableAlign = 64;
   const llvm::Triple &T = getTriple();
 
-  bool IsNetBSD = T.getOS() == llvm::Triple::NetBSD;
-  bool IsOpenBSD = T.getOS() == llvm::Triple::OpenBSD;
+  bool IsNetBSD = T.isOSNetBSD();
+  bool IsOpenBSD = T.isOSOpenBSD();
   if (!T.isOSWindows() && !IsNetBSD && !IsOpenBSD)
 WCharType = UnsignedInt;
 
@@ -217,8 +217,8 @@ ARMTargetInfo::ARMTargetInfo(const llvm:
  const TargetOptions &Opts)
 : TargetInfo(Triple), FPMath(FP_Default), IsAAPCS(true), LDREX(0),
   HW_FP(0) {
-  bool IsOpenBSD = Triple.getOS() == llvm::Triple::OpenBSD;
-  bool IsNetBSD = Triple.getOS() == llvm::Triple::NetBSD;
+  bool IsOpenBSD = Triple.isOSOpenBSD();
+  bool IsNetBSD = Triple.isOSNetBSD();
 
   // FIXME: the isOSBinFormatMachO is a workaround for identifying a 
Darwin-like
   // environment where size_t is `unsigned long` rather than `unsigned int`
@@ -282,9 +282,9 @@ ARMTargetInfo::ARMTargetInfo(const llvm:
   setABI("apcs-gnu");
   break;
 default:
-  if (Triple.getOS() == llvm::Triple::NetBSD)
+  if (IsNetBSD)
 setABI("apcs-gnu");
-  else if (Triple.getOS() == llvm::Triple::OpenBSD)
+  else if (IsOpenBSD)
 setABI("aapcs-linux");
   else
 setABI("aapcs");

Modified: cfe/trunk/lib/Basic/Targets/Mips.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/Mips.h?rev=349752&r1=349751&r2=349752&view=diff
==
--- cfe/trunk/lib/Basic/Targets/Mips.h (original)
+++ cfe/trunk/lib/Basic/Targets/Mips.h Thu Dec 20 05:09:30 2018
@@ -78,8 +78,8 @@ public:
 
 CPU = ABI == "o32" ? "mips32r2" : "mips64r2";
 
-CanUseBSDABICalls = Triple.getOS() == llvm::Triple::FreeBSD ||
-Triple.getOS() == llvm::Triple::OpenBSD;
+CanUseBSDABICalls = Triple.isOSFreeBSD() ||
+Triple.isOSOpenBSD();
   }
 
   bool isIEEE754_2008Default() const {
@@ -132,7 +132,7 @@ public:
   void setN32N64ABITypes() {
 LongDoubleWidth = LongDoubleAlign = 128;
 LongDoubleFormat = &llvm::APFloat::IEEEquad();
-if (getTriple().getOS() == llvm::Triple::FreeBSD) {
+if (getTriple().isOSFreeBSD()) {
   LongDoubleWidth = LongDoubleAlign = 64;
   LongDoubleFormat = &llvm::APFloat::IEEEdouble();
 }
@@ -142,7 +142,7 @@ public:
 
   void setN64ABITypes() {
 setN32N64ABITypes();
-if (getT

[PATCH] D55363: [clangd] Expose FileStatus in LSP.

2018-12-20 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments.



Comment at: clangd/Protocol.cpp:769
   O.map("fallbackFlags", Opts.fallbackFlags);
+  O.map("fileStatus", Opts.FileStatus);
   return true;

Ah, there's a non-zero chance of name clash here in case the protocol 
implements something similar.
Maybe name the JSON field "clangdFileStatus" to be completely sure this won't 
clash later.



Comment at: clangd/Protocol.h:1002
+  /// Details of the state that are worth sufacing to users.
+  std::vector details;
+};

As discussed offline, maybe leave out the 'details' field in the first version?
It does not seem to provide much value as of now. Could be totally useful if we 
showed a fallback compile command used or similar.



Comment at: clangd/index/Merge.cpp:137
 S.ReturnType = O.ReturnType;
+  if (S.Type == "")
+S.Type = O.Type;

Accidental change?



Comment at: unittests/clangd/IndexTests.cpp:222
   R.Origin = SymbolOrigin::Static;
+  R.Type = "expectedType";
 

Accidental change?


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55363/new/

https://reviews.llvm.org/D55363



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


[PATCH] D55916: [clang] Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]

2018-12-20 Thread Michał Górny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC349752: Replace getOS() == llvm::Triple::*BSD with 
isOS*BSD() [NFCI] (authored by mgorny, committed by ).

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55916/new/

https://reviews.llvm.org/D55916

Files:
  lib/Basic/Targets/AArch64.cpp
  lib/Basic/Targets/ARM.cpp
  lib/Basic/Targets/Mips.h
  lib/Basic/Targets/PPC.cpp
  lib/Basic/Targets/PPC.h
  lib/Basic/Targets/Sparc.h
  lib/Driver/ToolChains/Arch/Mips.cpp
  lib/Driver/ToolChains/Clang.cpp
  lib/Driver/ToolChains/CommonArgs.cpp
  lib/Driver/ToolChains/Gnu.cpp
  lib/Driver/XRayArgs.cpp
  lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp

Index: lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
===
--- lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
+++ lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
@@ -29,10 +29,10 @@
   const llvm::Triple &T = Ctx.getTargetInfo().getTriple();
   return T.getVendor() == llvm::Triple::Apple ||
  T.getOS() == llvm::Triple::CloudABI ||
- T.getOS() == llvm::Triple::FreeBSD ||
- T.getOS() == llvm::Triple::NetBSD ||
- T.getOS() == llvm::Triple::OpenBSD ||
- T.getOS() == llvm::Triple::DragonFly;
+ T.isOSFreeBSD() ||
+ T.isOSNetBSD() ||
+ T.isOSOpenBSD() ||
+ T.isOSDragonFly();
 }
 
 namespace {
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -2597,7 +2597,7 @@
   bool UseInitArrayDefault =
   getTriple().getArch() == llvm::Triple::aarch64 ||
   getTriple().getArch() == llvm::Triple::aarch64_be ||
-  (getTriple().getOS() == llvm::Triple::FreeBSD &&
+  (getTriple().isOSFreeBSD() &&
getTriple().getOSMajorVersion() >= 12) ||
   (getTriple().getOS() == llvm::Triple::Linux &&
((!GCCInstallation.isValid() || !V.isOlderThan(4, 7, 0)) ||
Index: lib/Driver/ToolChains/Arch/Mips.cpp
===
--- lib/Driver/ToolChains/Arch/Mips.cpp
+++ lib/Driver/ToolChains/Arch/Mips.cpp
@@ -47,12 +47,12 @@
   }
 
   // MIPS3 is the default for mips64*-unknown-openbsd.
-  if (Triple.getOS() == llvm::Triple::OpenBSD)
+  if (Triple.isOSOpenBSD())
 DefMips64CPU = "mips3";
 
   // MIPS2 is the default for mips(el)?-unknown-freebsd.
   // MIPS3 is the default for mips64(el)?-unknown-freebsd.
-  if (Triple.getOS() == llvm::Triple::FreeBSD) {
+  if (Triple.isOSFreeBSD()) {
 DefMips32CPU = "mips2";
 DefMips64CPU = "mips3";
   }
Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -526,7 +526,7 @@
 break;
   }
 
-  if (Triple.getOS() == llvm::Triple::NetBSD) {
+  if (Triple.isOSNetBSD()) {
 return !areOptimizationsEnabled(Args);
   }
 
@@ -2848,8 +2848,8 @@
 } else {
   bool IsARM = T.isARM() || T.isThumb() || T.isAArch64();
   CmdArgs.push_back("-fwchar-type=int");
-  if (IsARM && !(T.isOSWindows() || T.getOS() == llvm::Triple::NetBSD ||
- T.getOS() == llvm::Triple::OpenBSD))
+  if (IsARM && !(T.isOSWindows() || T.isOSNetBSD() ||
+ T.isOSOpenBSD()))
 CmdArgs.push_back("-fno-signed-wchar");
   else
 CmdArgs.push_back("-fsigned-wchar");
@@ -5274,8 +5274,8 @@
(TC.getTriple().isOSBinFormatELF() ||
 TC.getTriple().isOSBinFormatCOFF()) &&
   !TC.getTriple().isPS4() &&
-   TC.useIntegratedAs() &&
-   RawTriple.getOS() != llvm::Triple::NetBSD))
+  !TC.getTriple().isOSNetBSD() &&
+   TC.useIntegratedAs()))
 CmdArgs.push_back("-faddrsig");
 
   // Finally add the compile command to the compilation.
Index: lib/Driver/ToolChains/CommonArgs.cpp
===
--- lib/Driver/ToolChains/CommonArgs.cpp
+++ lib/Driver/ToolChains/CommonArgs.cpp
@@ -603,19 +603,19 @@
   if (TC.getTriple().getOS() != llvm::Triple::RTEMS &&
   !TC.getTriple().isAndroid()) {
 CmdArgs.push_back("-lpthread");
-if (TC.getTriple().getOS() != llvm::Triple::OpenBSD)
+if (TC.getTriple().isOSOpenBSD())
   CmdArgs.push_back("-lrt");
   }
   CmdArgs.push_back("-lm");
   // There's no libdl on all OSes.
-  if (TC.getTriple().getOS() != llvm::Triple::FreeBSD &&
-  TC.getTriple().getOS() != llvm::Triple::NetBSD &&
-  TC.getTriple().getOS() != llvm::Triple::OpenBSD &&
-  TC.getTriple().getOS() != llvm::Triple::RTEMS)
+  if (!TC.getTriple().isOSFreeBSD() &&
+  !TC.getTriple().isOSNetBSD() &&
+  !TC.getTriple().isOSOpenBSD() &&
+   TC.getTriple().getOS() 

[PATCH] D55628: Add support for "labels" on push/pop directives in #pragma clang attribute

2018-12-20 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman marked an inline comment as done.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!




Comment at: clang/lib/Parse/ParsePragma.cpp:3161
+  if (!Tok.is(tok::period)) {
+PP.Diag(Tok.getLocation(), diag::err_pragma_attribute_expected_period)
+<< II;

erik.pilkington wrote:
> aaron.ballman wrote:
> > Can you reuse `diag::err_expected_after` instead of making a new diagnostic?
> I was kinda concerned about how we would diagnose a case like this:
> ```
> #pragma clang attribute add (...) // add isn't a thing!
> ```
> A generic diagnostic about the missing `.` would be pretty unhelpful. The 
> custom diagnostic reads as "expected '.' after pragma attribute namespace 
> 'add'", which makes how the parser interpreted the code a lot more clear.
Okay, that's a good reason to go with a separate diagnostic, thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55628/new/

https://reviews.llvm.org/D55628



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


[PATCH] D55363: [clangd] Expose FileStatus in LSP.

2018-12-20 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 179046.
hokein marked 4 inline comments as done.
hokein added a comment.

Remove details.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55363/new/

https://reviews.llvm.org/D55363

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/Protocol.cpp
  clangd/Protocol.h
  clangd/TUScheduler.cpp
  clangd/TUScheduler.h
  clangd/index/Merge.cpp
  test/clangd/filestatus.test
  unittests/clangd/IndexTests.cpp

Index: unittests/clangd/IndexTests.cpp
===
--- unittests/clangd/IndexTests.cpp
+++ unittests/clangd/IndexTests.cpp
@@ -219,6 +219,7 @@
   R.Documentation = "--doc--";
   L.Origin = SymbolOrigin::Dynamic;
   R.Origin = SymbolOrigin::Static;
+  R.Type = "expectedType";
 
   Symbol M = mergeSymbol(L, R);
   EXPECT_EQ(M.Name, "Foo");
@@ -227,6 +228,7 @@
   EXPECT_EQ(M.Signature, "()");
   EXPECT_EQ(M.CompletionSnippetSuffix, "{$1:0}");
   EXPECT_EQ(M.Documentation, "--doc--");
+  EXPECT_EQ(M.Type, "expectedType");
   EXPECT_EQ(M.Origin,
 SymbolOrigin::Dynamic | SymbolOrigin::Static | SymbolOrigin::Merge);
 }
Index: test/clangd/filestatus.test
===
--- /dev/null
+++ test/clangd/filestatus.test
@@ -0,0 +1,13 @@
+# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
+{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"initializationOptions":{"clangdFileStatus": true},"trace":"off"}}
+---
+{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"int x; int y = x;"}}}
+#  CHECK:  "method": "textDocument/clangd.fileStatus",
+# CHECK-NEXT:  "params": {
+# CHECK-NEXT:"state": "parsing includes",
+# CHECK-NEXT:"uri": "{{.*}}/main.cpp"
+# CHECK-NEXT:  }
+---
+{"jsonrpc":"2.0","id":3,"method":"shutdown"}
+---
+{"jsonrpc":"2.0","method":"exit"}
Index: clangd/index/Merge.cpp
===
--- clangd/index/Merge.cpp
+++ clangd/index/Merge.cpp
@@ -134,6 +134,8 @@
 S.Documentation = O.Documentation;
   if (S.ReturnType == "")
 S.ReturnType = O.ReturnType;
+  if (S.Type == "")
+S.Type = O.Type;
   for (const auto &OI : O.IncludeHeaders) {
 bool Found = false;
 for (auto &SI : S.IncludeHeaders) {
Index: clangd/TUScheduler.h
===
--- clangd/TUScheduler.h
+++ clangd/TUScheduler.h
@@ -77,6 +77,8 @@
 /// Indicates whether we reused the prebuilt AST.
 bool ReuseAST = false;
   };
+  /// Serialize this to an LSP file status item.
+  FileStatus render(PathRef File) const;
 
   TUAction Action;
   BuildDetails Details;
Index: clangd/TUScheduler.cpp
===
--- clangd/TUScheduler.cpp
+++ clangd/TUScheduler.cpp
@@ -729,6 +729,33 @@
   return wait(Lock, RequestsCV, Timeout, [&] { return Requests.empty(); });
 }
 
+// Render a TUAction to a user-facing string representation.
+// TUAction represents clangd-internal states, we don't intend to expose them
+// to users (say C++ programmers) directly to avoid confusion, we use terms that
+// are familiar by C++ programmers.
+std::string renderTUAction(const TUAction& Action) {
+  std::string Result;
+  raw_string_ostream OS(Result);
+  switch (Action.S) {
+  case TUAction::Queued:
+OS << "file is queued";
+break;
+  case TUAction::RunningAction:
+OS << "running " << Action.Name;
+break;
+  case TUAction::BuildingPreamble:
+OS << "parsing includes";
+break;
+  case TUAction::BuildingFile:
+OS << "parsing main file";
+break;
+  case TUAction::Idle:
+OS << "idle";
+break;
+  }
+  return OS.str();
+}
+
 } // namespace
 
 unsigned getDefaultAsyncThreadsCount() {
@@ -741,6 +768,13 @@
   return HardwareConcurrency;
 }
 
+FileStatus TUStatus::render(PathRef File) const {
+  FileStatus FStatus;
+  FStatus.uri = URIForFile::canonicalize(File, /*TUPath=*/File);
+  FStatus.state = renderTUAction(Action);
+  return FStatus;
+}
+
 struct TUScheduler::FileData {
   /// Latest inputs, passed to TUScheduler::update().
   std::string Contents;
Index: clangd/Protocol.h
===
--- clangd/Protocol.h
+++ clangd/Protocol.h
@@ -397,6 +397,9 @@
   // the compilation database doesn't describe an opened file.
   // The command used will be approximately `clang $FILE $fallbackFlags`.
   std::vector fallbackFlags;
+
+  /// Clients supports show file status for textDocument/clangd.fileStatus.
+  bool FileStatus = false;
 };
 bool fromJSON(const llvm::json::Value &, InitializationOptions &);
 
@@ -973,6 +976,18 @@
 };
 bool fromJSON(const llvm::json::Value &, ReferenceParams &);
 
+/// Clangd extension: indicates the current state

[PATCH] D55363: [clangd] Expose FileStatus in LSP.

2018-12-20 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 179047.
hokein added a comment.

Rebase


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55363/new/

https://reviews.llvm.org/D55363

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/Protocol.cpp
  clangd/Protocol.h
  clangd/TUScheduler.cpp
  clangd/TUScheduler.h
  test/clangd/filestatus.test

Index: test/clangd/filestatus.test
===
--- /dev/null
+++ test/clangd/filestatus.test
@@ -0,0 +1,13 @@
+# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
+{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"initializationOptions":{"clangdFileStatus": true},"trace":"off"}}
+---
+{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"int x; int y = x;"}}}
+#  CHECK:  "method": "textDocument/clangd.fileStatus",
+# CHECK-NEXT:  "params": {
+# CHECK-NEXT:"state": "parsing includes",
+# CHECK-NEXT:"uri": "{{.*}}/main.cpp"
+# CHECK-NEXT:  }
+---
+{"jsonrpc":"2.0","id":3,"method":"shutdown"}
+---
+{"jsonrpc":"2.0","method":"exit"}
Index: clangd/TUScheduler.h
===
--- clangd/TUScheduler.h
+++ clangd/TUScheduler.h
@@ -77,6 +77,8 @@
 /// Indicates whether we reused the prebuilt AST.
 bool ReuseAST = false;
   };
+  /// Serialize this to an LSP file status item.
+  FileStatus render(PathRef File) const;
 
   TUAction Action;
   BuildDetails Details;
Index: clangd/TUScheduler.cpp
===
--- clangd/TUScheduler.cpp
+++ clangd/TUScheduler.cpp
@@ -729,6 +729,33 @@
   return wait(Lock, RequestsCV, Timeout, [&] { return Requests.empty(); });
 }
 
+// Render a TUAction to a user-facing string representation.
+// TUAction represents clangd-internal states, we don't intend to expose them
+// to users (say C++ programmers) directly to avoid confusion, we use terms that
+// are familiar by C++ programmers.
+std::string renderTUAction(const TUAction& Action) {
+  std::string Result;
+  raw_string_ostream OS(Result);
+  switch (Action.S) {
+  case TUAction::Queued:
+OS << "file is queued";
+break;
+  case TUAction::RunningAction:
+OS << "running " << Action.Name;
+break;
+  case TUAction::BuildingPreamble:
+OS << "parsing includes";
+break;
+  case TUAction::BuildingFile:
+OS << "parsing main file";
+break;
+  case TUAction::Idle:
+OS << "idle";
+break;
+  }
+  return OS.str();
+}
+
 } // namespace
 
 unsigned getDefaultAsyncThreadsCount() {
@@ -741,6 +768,13 @@
   return HardwareConcurrency;
 }
 
+FileStatus TUStatus::render(PathRef File) const {
+  FileStatus FStatus;
+  FStatus.uri = URIForFile::canonicalize(File, /*TUPath=*/File);
+  FStatus.state = renderTUAction(Action);
+  return FStatus;
+}
+
 struct TUScheduler::FileData {
   /// Latest inputs, passed to TUScheduler::update().
   std::string Contents;
Index: clangd/Protocol.h
===
--- clangd/Protocol.h
+++ clangd/Protocol.h
@@ -397,6 +397,9 @@
   // the compilation database doesn't describe an opened file.
   // The command used will be approximately `clang $FILE $fallbackFlags`.
   std::vector fallbackFlags;
+
+  /// Clients supports show file status for textDocument/clangd.fileStatus.
+  bool FileStatus = false;
 };
 bool fromJSON(const llvm::json::Value &, InitializationOptions &);
 
@@ -973,6 +976,18 @@
 };
 bool fromJSON(const llvm::json::Value &, ReferenceParams &);
 
+/// Clangd extension: indicates the current state of the file in clangd,
+/// sent from server via the `textDocument/clangd.fileStatus` notification.
+struct FileStatus {
+  /// The text document's URI.
+  URIForFile uri;
+  /// The human-readable string presents the current state of the file, can be
+  /// shown in the UI (e.g. status bar).
+  std::string state;
+  // FIXME: add detail messages.
+};
+llvm::json::Value toJSON(const FileStatus &FStatus);
+
 } // namespace clangd
 } // namespace clang
 
Index: clangd/Protocol.cpp
===
--- clangd/Protocol.cpp
+++ clangd/Protocol.cpp
@@ -716,6 +716,13 @@
   };
 }
 
+llvm::json::Value toJSON(const FileStatus &FStatus) {
+  return json::Object{
+  {"uri", FStatus.uri},
+  {"state", FStatus.state},
+  };
+}
+
 raw_ostream &operator<<(raw_ostream &O, const DocumentHighlight &V) {
   O << V.range;
   if (V.kind == DocumentHighlightKind::Read)
@@ -752,6 +759,7 @@
   fromJSON(Params, Opts.ConfigSettings);
   O.map("compilationDatabasePath", Opts.compilationDatabasePath);
   O.map("fallbackFlags", Opts.fallbackFlags);
+  O.map("clangdFileStatus", Opts.FileStatus);
   return true;
 }
 
Index: clangd/ClangdLSPServer.h
=

[PATCH] D55363: [clangd] Expose FileStatus in LSP.

2018-12-20 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments.



Comment at: clangd/index/Merge.cpp:137
 S.ReturnType = O.ReturnType;
+  if (S.Type == "")
+S.Type = O.Type;

ilya-biryukov wrote:
> Accidental change?
oops, I rebased this branch on top of my another branch. Fixed.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55363/new/

https://reviews.llvm.org/D55363



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


[PATCH] D55710: add pragmas to control Software Pipelining optimisation

2018-12-20 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: include/clang/Basic/AttrDocs.td:2673
+
+Check `Software pipelining`, `Modulo scheduling` to get more details on 
optimisation.
+

"Check" -- check where? Perhaps "Search for" but I still don't think that's 
very satisfying for our documentation as there's no telling what users will 
find or how it relates (if at all) to this feature.

on optimisation -> on this optimization

I find this sentence doesn't really direct me to much of value (research 
presentations and class lectures, mostly), so I'd rather see the important 
details spelled out in our docs so that users don't have to guess as much.



Comment at: include/clang/Basic/AttrDocs.td:2677-2678
+`language extensions
+`_
+for further details, including limitations of the pipeline hints.
+  }];

There is nothing in the linked documentation that describes pipeline initiation 
intervals, so I'm still left wondering how to pick a value for the attribute 
argument. I think the docs need a bit more detail for what that value means and 
how it impacts the user's code.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55710/new/

https://reviews.llvm.org/D55710



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


r349754 - [Driver] Fix accidentally reversed condition in r349752

2018-12-20 Thread Michal Gorny via cfe-commits
Author: mgorny
Date: Thu Dec 20 05:27:37 2018
New Revision: 349754

URL: http://llvm.org/viewvc/llvm-project?rev=349754&view=rev
Log:
[Driver] Fix accidentally reversed condition in r349752

Modified:
cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp?rev=349754&r1=349753&r2=349754&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp Thu Dec 20 05:27:37 2018
@@ -603,7 +603,7 @@ void tools::linkSanitizerRuntimeDeps(con
   if (TC.getTriple().getOS() != llvm::Triple::RTEMS &&
   !TC.getTriple().isAndroid()) {
 CmdArgs.push_back("-lpthread");
-if (TC.getTriple().isOSOpenBSD())
+if (!TC.getTriple().isOSOpenBSD())
   CmdArgs.push_back("-lrt");
   }
   CmdArgs.push_back("-lm");


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


r349755 - [Sema][NFC] Add test for static_assert diagnistics with constexpr template functions.

2018-12-20 Thread Clement Courbet via cfe-commits
Author: courbet
Date: Thu Dec 20 05:30:40 2018
New Revision: 349755

URL: http://llvm.org/viewvc/llvm-project?rev=349755&view=rev
Log:
[Sema][NFC] Add test for static_assert diagnistics with constexpr template 
functions.

Modified:
cfe/trunk/test/SemaCXX/static-assert-cxx17.cpp

Modified: cfe/trunk/test/SemaCXX/static-assert-cxx17.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/static-assert-cxx17.cpp?rev=349755&r1=349754&r2=349755&view=diff
==
--- cfe/trunk/test/SemaCXX/static-assert-cxx17.cpp (original)
+++ cfe/trunk/test/SemaCXX/static-assert-cxx17.cpp Thu Dec 20 05:30:40 2018
@@ -15,6 +15,11 @@ struct S2 {
 };
 
 template 
+inline constexpr bool constexpr_return_false() {
+  return false;
+}
+
+template 
 void foo() {
   static_assert(S1::value);
   // expected-error@-1{{static_assert failed due to requirement 'S1::value'}}
@@ -92,6 +97,8 @@ void foo6() {
   // expected-error@-1{{static_assert failed due to requirement '(X 
const[0]){} == nullptr'}}
   static_assert(sizeof(X().X::~X())>) 
== 0);
   // expected-error@-1{{static_assert failed due to requirement 
'sizeof(X) == 0'}}
+  static_assert(constexpr_return_false());
+  // expected-error@-1{{static_assert failed due to requirement 
'constexpr_return_false()'}}
 }
 template void foo6();
 // expected-note@-1{{in instantiation of function template specialization 
'foo6' requested here}}


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


[PATCH] D55710: add pragmas to control Software Pipelining optimisation

2018-12-20 Thread Alexey Lapshin via Phabricator via cfe-commits
alexey.lapshin marked an inline comment as done.
alexey.lapshin added inline comments.



Comment at: include/clang/Basic/AttrDocs.td:2673
+
+Check `Software pipelining`, `Modulo scheduling` to get more details on 
optimisation.
+

aaron.ballman wrote:
> "Check" -- check where? Perhaps "Search for" but I still don't think that's 
> very satisfying for our documentation as there's no telling what users will 
> find or how it relates (if at all) to this feature.
> 
> on optimisation -> on this optimization
> 
> I find this sentence doesn't really direct me to much of value (research 
> presentations and class lectures, mostly), so I'd rather see the important 
> details spelled out in our docs so that users don't have to guess as much.
I am just unsure which references to include here ... links to wikipedia or 
some concrete resources do not look good. 

So you are suggesting to spell things out here... Ok, I will prepare short 
explanation...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55710/new/

https://reviews.llvm.org/D55710



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


[PATCH] D55916: [clang] Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]

2018-12-20 Thread Ulrich Weigand via Phabricator via cfe-commits
uweigand added a comment.

This causes test case failures due to no longer linking with -lrt on Linux.




Comment at: lib/Driver/ToolChains/CommonArgs.cpp:606
 CmdArgs.push_back("-lpthread");
-if (TC.getTriple().getOS() != llvm::Triple::OpenBSD)
+if (TC.getTriple().isOSOpenBSD())
   CmdArgs.push_back("-lrt");

Looks like this is missing a ! here.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55916/new/

https://reviews.llvm.org/D55916



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


[PATCH] D55916: [clang] Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]

2018-12-20 Thread Ulrich Weigand via Phabricator via cfe-commits
uweigand added a comment.

In D55916#1337427 , @uweigand wrote:

> This causes test case failures due to no longer linking with -lrt on Linux.


Never mind, already fixed :-)   Thanks!


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55916/new/

https://reviews.llvm.org/D55916



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


[PATCH] D55912: [gn build] Add build files for clang/lib/Lex and clang/lib/AST

2018-12-20 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL349756: [gn build] Add build files for clang/lib/Lex and 
clang/lib/AST (authored by nico, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D55912?vs=179006&id=179051#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55912/new/

https://reviews.llvm.org/D55912

Files:
  llvm/trunk/utils/gn/secondary/BUILD.gn
  llvm/trunk/utils/gn/secondary/clang/include/clang/AST/BUILD.gn
  llvm/trunk/utils/gn/secondary/clang/lib/AST/BUILD.gn
  llvm/trunk/utils/gn/secondary/clang/lib/Lex/BUILD.gn
  llvm/trunk/utils/gn/secondary/llvm/tools/llvm-config/BUILD.gn

Index: llvm/trunk/utils/gn/secondary/llvm/tools/llvm-config/BUILD.gn
===
--- llvm/trunk/utils/gn/secondary/llvm/tools/llvm-config/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/llvm/tools/llvm-config/BUILD.gn
@@ -39,9 +39,13 @@
 l = "-l"
 lib = ""
   }
+
   # Windows doesn't use any of libxml2,terminfo, zlib by default.
   # Make GN not warn about these variables being unused.
-  not_needed(["l", "lib"])
+  not_needed([
+   "l",
+   "lib",
+ ])
 
   system_libs = ""
   if (host_os == "win") {
Index: llvm/trunk/utils/gn/secondary/clang/lib/Lex/BUILD.gn
===
--- llvm/trunk/utils/gn/secondary/clang/lib/Lex/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/clang/lib/Lex/BUILD.gn
@@ -0,0 +1,31 @@
+static_library("Lex") {
+  output_name = "clangLex"
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang/lib/Basic",
+"//llvm/lib/Support",
+  ]
+  sources = [
+"HeaderMap.cpp",
+"HeaderSearch.cpp",
+"Lexer.cpp",
+"LiteralSupport.cpp",
+"MacroArgs.cpp",
+"MacroInfo.cpp",
+"ModuleMap.cpp",
+"PPCaching.cpp",
+"PPCallbacks.cpp",
+"PPConditionalDirectiveRecord.cpp",
+"PPDirectives.cpp",
+"PPExpressions.cpp",
+"PPLexerChange.cpp",
+"PPMacroExpansion.cpp",
+"Pragma.cpp",
+"PreprocessingRecord.cpp",
+"Preprocessor.cpp",
+"PreprocessorLexer.cpp",
+"ScratchBuffer.cpp",
+"TokenConcatenation.cpp",
+"TokenLexer.cpp",
+  ]
+}
Index: llvm/trunk/utils/gn/secondary/clang/lib/AST/BUILD.gn
===
--- llvm/trunk/utils/gn/secondary/clang/lib/AST/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/clang/lib/AST/BUILD.gn
@@ -0,0 +1,101 @@
+static_library("AST") {
+  output_name = "clangAST"
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang/include/clang/AST:AttrDump",
+"//clang/include/clang/AST:AttrImpl",
+"//clang/include/clang/AST:CommentCommandInfo",
+"//clang/include/clang/AST:CommentHTMLNamedCharacterReferences",
+"//clang/include/clang/AST:CommentHTMLTags",
+"//clang/include/clang/AST:CommentHTMLTagsProperties",
+"//clang/include/clang/AST:DeclNodes",
+"//clang/lib/Basic",
+"//clang/lib/Lex",
+"//llvm/lib/BinaryFormat",
+"//llvm/lib/Support",
+  ]
+
+  # Generated files used in public headers should be in public_deps, the rest
+  # in regular deps.
+  public_deps = [
+"//clang/include/clang/AST:AttrVisitor",
+"//clang/include/clang/AST:Attrs",
+"//clang/include/clang/AST:CommentCommandList",
+"//clang/include/clang/AST:CommentNodes",
+"//clang/include/clang/AST:StmtNodes",
+  ]
+  sources = [
+"APValue.cpp",
+"ASTConsumer.cpp",
+"ASTContext.cpp",
+"ASTDiagnostic.cpp",
+"ASTDumper.cpp",
+"ASTImporter.cpp",
+"ASTImporterLookupTable.cpp",
+"ASTStructuralEquivalence.cpp",
+"ASTTypeTraits.cpp",
+"AttrImpl.cpp",
+"CXXInheritance.cpp",
+"Comment.cpp",
+"CommentBriefParser.cpp",
+"CommentCommandTraits.cpp",
+"CommentLexer.cpp",
+"CommentParser.cpp",
+"CommentSema.cpp",
+"ComparisonCategories.cpp",
+"DataCollection.cpp",
+"Decl.cpp",
+"DeclBase.cpp",
+"DeclCXX.cpp",
+"DeclFriend.cpp",
+"DeclGroup.cpp",
+"DeclObjC.cpp",
+"DeclOpenMP.cpp",
+"DeclPrinter.cpp",
+"DeclTemplate.cpp",
+"DeclarationName.cpp",
+"Expr.cpp",
+"ExprCXX.cpp",
+"ExprClassification.cpp",
+"ExprConstant.cpp",
+"ExprObjC.cpp",
+"ExternalASTMerger.cpp",
+"ExternalASTSource.cpp",
+"FormatString.cpp",
+"InheritViz.cpp",
+"ItaniumCXXABI.cpp",
+"ItaniumMangle.cpp",
+"Mangle.cpp",
+"MicrosoftCXXABI.cpp",
+"MicrosoftMangle.cpp",
+"NSAPI.cpp",
+"NestedNameSpecifier.cpp",
+"ODRHash.cpp",
+"OSLog.cpp",
+"OpenMPClause.cpp",
+"ParentMap.cpp",
+"PrintfFormatString.cpp",
+"QualTypeNames.cpp",
+"RawCommentList.cpp",
+"RecordLayout.cpp",
+"RecordLayoutBuilder.cpp",
+"ScanfFormatString.cpp",
+"SelectorLocationsKind.cpp",
+"Stmt.cpp",
+

[PATCH] D55710: add pragmas to control Software Pipelining optimisation

2018-12-20 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: include/clang/Basic/AttrDocs.td:2673
+
+Check `Software pipelining`, `Modulo scheduling` to get more details on 
optimisation.
+

alexey.lapshin wrote:
> aaron.ballman wrote:
> > "Check" -- check where? Perhaps "Search for" but I still don't think that's 
> > very satisfying for our documentation as there's no telling what users will 
> > find or how it relates (if at all) to this feature.
> > 
> > on optimisation -> on this optimization
> > 
> > I find this sentence doesn't really direct me to much of value (research 
> > presentations and class lectures, mostly), so I'd rather see the important 
> > details spelled out in our docs so that users don't have to guess as much.
> I am just unsure which references to include here ... links to wikipedia or 
> some concrete resources do not look good. 
> 
> So you are suggesting to spell things out here... Ok, I will prepare short 
> explanation...
> I am just unsure which references to include here ... links to wikipedia or 
> some concrete resources do not look good.

If there's a definitive source for the information, like a research paper or a 
Wikipedia entry that does a great job explaining it, then feel free to link to 
it. We can always update dead links when they arise.

> So you are suggesting to spell things out here... Ok, I will prepare short 
> explanation...

If there's not a good place to link to that has the information, then yes, 
spelling it out would be great. Basically, someone reading these docs should 
have enough information available (directly or through links) to help them 
understand the feature even if it doesn't make them an expert in the topic. My 
concern with the docs right now is that I have no idea what value to put there 
(Does it have to be positive? Nonzero? Is there an upper bound?) because I 
can't find an explanation about what that value actually controls.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55710/new/

https://reviews.llvm.org/D55710



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


[PATCH] D55913: [gn build] Add build files for clang/lib/{Analysis, Edit, Sema}

2018-12-20 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL349757: [gn build] Add build files for 
clang/lib/{Analysis,Edit,Sema} (authored by nico, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D55913?vs=179007&id=179053#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55913/new/

https://reviews.llvm.org/D55913

Files:
  llvm/trunk/utils/gn/secondary/BUILD.gn
  llvm/trunk/utils/gn/secondary/clang/include/clang/Sema/BUILD.gn
  llvm/trunk/utils/gn/secondary/clang/lib/Analysis/BUILD.gn
  llvm/trunk/utils/gn/secondary/clang/lib/Edit/BUILD.gn
  llvm/trunk/utils/gn/secondary/clang/lib/Sema/BUILD.gn

Index: llvm/trunk/utils/gn/secondary/clang/include/clang/Sema/BUILD.gn
===
--- llvm/trunk/utils/gn/secondary/clang/include/clang/Sema/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/clang/include/clang/Sema/BUILD.gn
@@ -0,0 +1,46 @@
+import("//clang/utils/TableGen/clang_tablegen.gni")
+
+clang_tablegen("AttrTemplateInstantiate") {
+  args = [
+"-gen-clang-attr-template-instantiate",
+"-I",
+rebase_path("../..", root_out_dir),
+  ]
+  td_file = "../Basic/Attr.td"
+}
+
+clang_tablegen("AttrParsedAttrList") {
+  args = [
+"-gen-clang-attr-parsed-attr-list",
+"-I",
+rebase_path("../..", root_out_dir),
+  ]
+  td_file = "../Basic/Attr.td"
+}
+
+clang_tablegen("AttrParsedAttrKinds") {
+  args = [
+"-gen-clang-attr-parsed-attr-kinds",
+"-I",
+rebase_path("../..", root_out_dir),
+  ]
+  td_file = "../Basic/Attr.td"
+}
+
+clang_tablegen("AttrSpellingListIndex") {
+  args = [
+"-gen-clang-attr-spelling-index",
+"-I",
+rebase_path("../..", root_out_dir),
+  ]
+  td_file = "../Basic/Attr.td"
+}
+
+clang_tablegen("AttrParsedAttrImpl") {
+  args = [
+"-gen-clang-attr-parsed-attr-impl",
+"-I",
+rebase_path("../..", root_out_dir),
+  ]
+  td_file = "../Basic/Attr.td"
+}
Index: llvm/trunk/utils/gn/secondary/clang/lib/Sema/BUILD.gn
===
--- llvm/trunk/utils/gn/secondary/clang/lib/Sema/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/clang/lib/Sema/BUILD.gn
@@ -0,0 +1,66 @@
+static_library("Sema") {
+  output_name = "clangSema"
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang/include/clang/Sema:AttrParsedAttrImpl",
+"//clang/include/clang/Sema:AttrParsedAttrKinds",
+"//clang/include/clang/Sema:AttrParsedAttrList",
+"//clang/include/clang/Sema:AttrSpellingListIndex",
+"//clang/include/clang/Sema:AttrTemplateInstantiate",
+"//clang/lib/AST",
+"//clang/lib/Analysis",
+"//clang/lib/Basic",
+"//clang/lib/Edit",
+"//clang/lib/Lex",
+"//llvm/lib/Support",
+  ]
+  sources = [
+"AnalysisBasedWarnings.cpp",
+"CodeCompleteConsumer.cpp",
+"DeclSpec.cpp",
+"DelayedDiagnostic.cpp",
+"IdentifierResolver.cpp",
+"JumpDiagnostics.cpp",
+"MultiplexExternalSemaSource.cpp",
+"ParsedAttr.cpp",
+"Scope.cpp",
+"ScopeInfo.cpp",
+"Sema.cpp",
+"SemaAccess.cpp",
+"SemaAttr.cpp",
+"SemaCUDA.cpp",
+"SemaCXXScopeSpec.cpp",
+"SemaCast.cpp",
+"SemaChecking.cpp",
+"SemaCodeComplete.cpp",
+"SemaConsumer.cpp",
+"SemaCoroutine.cpp",
+"SemaDecl.cpp",
+"SemaDeclAttr.cpp",
+"SemaDeclCXX.cpp",
+"SemaDeclObjC.cpp",
+"SemaExceptionSpec.cpp",
+"SemaExpr.cpp",
+"SemaExprCXX.cpp",
+"SemaExprMember.cpp",
+"SemaExprObjC.cpp",
+"SemaFixItUtils.cpp",
+"SemaInit.cpp",
+"SemaLambda.cpp",
+"SemaLookup.cpp",
+"SemaObjCProperty.cpp",
+"SemaOpenMP.cpp",
+"SemaOverload.cpp",
+"SemaPseudoObject.cpp",
+"SemaStmt.cpp",
+"SemaStmtAsm.cpp",
+"SemaStmtAttr.cpp",
+"SemaTemplate.cpp",
+"SemaTemplateDeduction.cpp",
+"SemaTemplateInstantiate.cpp",
+"SemaTemplateInstantiateDecl.cpp",
+"SemaTemplateVariadic.cpp",
+"SemaType.cpp",
+"TypeLocBuilder.cpp",
+  ]
+}
Index: llvm/trunk/utils/gn/secondary/clang/lib/Edit/BUILD.gn
===
--- llvm/trunk/utils/gn/secondary/clang/lib/Edit/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/clang/lib/Edit/BUILD.gn
@@ -0,0 +1,15 @@
+static_library("Edit") {
+  output_name = "clangEdit"
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang/lib/AST",
+"//clang/lib/Basic",
+"//clang/lib/Lex",
+"//llvm/lib/Support",
+  ]
+  sources = [
+"Commit.cpp",
+"EditedSource.cpp",
+"RewriteObjCFoundationAPI.cpp",
+  ]
+}
Index: llvm/trunk/utils/gn/secondary/clang/lib/Analysis/BUILD.gn
===
--- llvm/trunk/utils/gn/secondary/clang/lib/Analysis/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/clang/lib/Analysis/BUILD.gn
@@ -0,0 +1,36 @@
+static_library("Analysis") {
+  outpu

[clang-tools-extra] r349758 - [clang-tidy] Use translationUnitDecl() instead of a custom matcher.

2018-12-20 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Thu Dec 20 05:50:04 2018
New Revision: 349758

URL: http://llvm.org/viewvc/llvm-project?rev=349758&view=rev
Log:
[clang-tidy] Use translationUnitDecl() instead of a custom matcher.

Modified:
clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.h

Modified: 
clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.cpp?rev=349758&r1=349757&r2=349758&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.cpp 
Thu Dec 20 05:50:04 2018
@@ -319,8 +319,6 @@ bool containsDiscardedTokens(const Match
 } // namespace
 
 class SimplifyBooleanExprCheck::Visitor : public RecursiveASTVisitor {
-  using Base = RecursiveASTVisitor;
-
  public:
   Visitor(SimplifyBooleanExprCheck *Check,
   const MatchFinder::MatchResult &Result)
@@ -507,16 +505,8 @@ void SimplifyBooleanExprCheck::storeOpti
 ChainedConditionalAssignment);
 }
 
-// This is a silly hack to let us run a RecursiveASTVisitor on the Context.
-// We want to match exactly one node in the AST, doesn't matter which.
-AST_MATCHER_P(Decl, matchOnce, bool *, Matched) {
-  if (*Matched)
-return false;
-  return *Matched = true;
-}
-
 void SimplifyBooleanExprCheck::registerMatchers(MatchFinder *Finder) {
-  Finder->addMatcher(matchOnce(&MatchedOnce), this);
+  Finder->addMatcher(translationUnitDecl().bind("top"), this);
 
   matchBoolCondition(Finder, true, ConditionThenStmtId);
   matchBoolCondition(Finder, false, ConditionElseStmtId);
@@ -535,8 +525,10 @@ void SimplifyBooleanExprCheck::registerM
 }
 
 void SimplifyBooleanExprCheck::check(const MatchFinder::MatchResult &Result) {
-  if (const CXXBoolLiteralExpr *TrueConditionRemoved =
-  getBoolLiteral(Result, ConditionThenStmtId))
+  if (const auto *TU = Result.Nodes.getNodeAs("top"))
+Visitor(this, Result).TraverseAST(*Result.Context);
+  else if (const CXXBoolLiteralExpr *TrueConditionRemoved =
+   getBoolLiteral(Result, ConditionThenStmtId))
 replaceWithThenStatement(Result, TrueConditionRemoved);
   else if (const CXXBoolLiteralExpr *FalseConditionRemoved =
getBoolLiteral(Result, ConditionElseStmtId))
@@ -564,10 +556,6 @@ void SimplifyBooleanExprCheck::check(con
   else if (const auto *Compound =
Result.Nodes.getNodeAs(CompoundNotBoolId))
 replaceCompoundReturnWithCondition(Result, Compound, true);
-  else { // MatchOnce matcher
-assert(MatchedOnce);
-Visitor(this, Result).TraverseAST(*Result.Context);
-  }
 }
 
 void SimplifyBooleanExprCheck::issueDiag(

Modified: 
clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.h?rev=349758&r1=349757&r2=349758&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.h 
(original)
+++ clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.h 
Thu Dec 20 05:50:04 2018
@@ -79,7 +79,6 @@ private:
  SourceLocation Loc, StringRef Description,
  SourceRange ReplacementRange, StringRef Replacement);
 
-  bool MatchedOnce = false;
   const bool ChainedConditionalReturn;
   const bool ChainedConditionalAssignment;
 };


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


[PATCH] D55924: [gn build] Add build files for clang-format and lib/{Format, Rewrite, Tooling/Core, Tooling/Inclusions}

2018-12-20 Thread Nico Weber via Phabricator via cfe-commits
thakis created this revision.
thakis added a reviewer: phosek.

https://reviews.llvm.org/D55924

Files:
  llvm/utils/gn/secondary/BUILD.gn
  llvm/utils/gn/secondary/clang/lib/Format/BUILD.gn
  llvm/utils/gn/secondary/clang/lib/Rewrite/BUILD.gn
  llvm/utils/gn/secondary/clang/lib/Tooling/Core/BUILD.gn
  llvm/utils/gn/secondary/clang/lib/Tooling/Inclusions/BUILD.gn
  llvm/utils/gn/secondary/clang/tools/clang-format/BUILD.gn

Index: llvm/utils/gn/secondary/clang/tools/clang-format/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/tools/clang-format/BUILD.gn
@@ -0,0 +1,13 @@
+executable("clang-format") {
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang/lib/Basic",
+"//clang/lib/Format",
+"//clang/lib/Rewrite",
+"//clang/lib/Tooling/Core",
+"//llvm/lib/Support",
+  ]
+  sources = [
+"ClangFormat.cpp",
+  ]
+}
Index: llvm/utils/gn/secondary/clang/lib/Tooling/Inclusions/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/lib/Tooling/Inclusions/BUILD.gn
@@ -0,0 +1,15 @@
+static_library("Inclusions") {
+  output_name = "clangToolingInclusions"
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang/lib/Basic",
+"//clang/lib/Lex",
+"//clang/lib/Rewrite",
+"//clang/lib/Tooling/Core",
+"//llvm/lib/Support",
+  ]
+  sources = [
+"HeaderIncludes.cpp",
+"IncludeStyle.cpp",
+  ]
+}
Index: llvm/utils/gn/secondary/clang/lib/Tooling/Core/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/lib/Tooling/Core/BUILD.gn
@@ -0,0 +1,16 @@
+static_library("Core") {
+  output_name = "clangToolingCore"
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang/lib/AST",
+"//clang/lib/Basic",
+"//clang/lib/Lex",
+"//clang/lib/Rewrite",
+"//llvm/lib/Support",
+  ]
+  sources = [
+"Diagnostic.cpp",
+"Lookup.cpp",
+"Replacement.cpp",
+  ]
+}
Index: llvm/utils/gn/secondary/clang/lib/Rewrite/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/lib/Rewrite/BUILD.gn
@@ -0,0 +1,16 @@
+static_library("Rewrite") {
+  output_name = "clangRewrite"
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang/lib/Basic",
+"//clang/lib/Lex",
+"//llvm/lib/Support",
+  ]
+  sources = [
+"DeltaTree.cpp",
+"HTMLRewrite.cpp",
+"RewriteRope.cpp",
+"Rewriter.cpp",
+"TokenRewriter.cpp",
+  ]
+}
Index: llvm/utils/gn/secondary/clang/lib/Format/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/lib/Format/BUILD.gn
@@ -0,0 +1,27 @@
+static_library("Format") {
+  output_name = "clangFormat"
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang/lib/Basic",
+"//clang/lib/Lex",
+"//clang/lib/Tooling/Core",
+"//clang/lib/Tooling/Inclusions",
+"//llvm/lib/Support",
+  ]
+  sources = [
+"AffectedRangeManager.cpp",
+"BreakableToken.cpp",
+"ContinuationIndenter.cpp",
+"Format.cpp",
+"FormatToken.cpp",
+"FormatTokenLexer.cpp",
+"NamespaceEndCommentsFixer.cpp",
+"SortJavaScriptImports.cpp",
+"TokenAnalyzer.cpp",
+"TokenAnnotator.cpp",
+"UnwrappedLineFormatter.cpp",
+"UnwrappedLineParser.cpp",
+"UsingDeclarationsSorter.cpp",
+"WhitespaceManager.cpp",
+  ]
+}
Index: llvm/utils/gn/secondary/BUILD.gn
===
--- llvm/utils/gn/secondary/BUILD.gn
+++ llvm/utils/gn/secondary/BUILD.gn
@@ -1,11 +1,6 @@
 group("default") {
   deps = [
-"//clang/lib/AST",
-"//clang/lib/Analysis",
-"//clang/lib/Basic",
-"//clang/lib/Edit",
-"//clang/lib/Lex",
-"//clang/lib/Sema",
+"//clang/tools/clang-format",
 "//lld/test",
 "//llvm/tools/llvm-undname",
   ]
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D55925: [gn build] Add build file for clang/lib/Parse

2018-12-20 Thread Nico Weber via Phabricator via cfe-commits
thakis created this revision.
thakis added a reviewer: phosek.

Nothing really interesting. One thing to consider is where the clang_tablegen() 
invocations that generate files that are private to a library should be. The 
CMake build puts them in clang/include/clang/Parse (in this case), but maybe 
putting them right in clang/lib/Parse/BUILD.gn makes mor sense. (For 
clang_tablegen() calls that generate .inc files used by the public headers, 
putting the call in the public BUILD file makes sense.)

For now, I've put the build file in the public header folder, since that 
matches CMake and what I did in the last 2 clang patches, but I'm not sure I 
like this.


https://reviews.llvm.org/D55925

Files:
  llvm/utils/gn/secondary/BUILD.gn
  llvm/utils/gn/secondary/clang/include/clang/Parse/BUILD.gn
  llvm/utils/gn/secondary/clang/lib/Parse/BUILD.gn


Index: llvm/utils/gn/secondary/clang/lib/Parse/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/lib/Parse/BUILD.gn
@@ -0,0 +1,32 @@
+static_library("Parse") {
+  output_name = "clangParse"
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang/include/clang/Parse:AttrParserStringSwitches",
+"//clang/include/clang/Parse:AttrSubMatchRulesParserStringSwitches",
+"//clang/lib/AST",
+"//clang/lib/Basic",
+"//clang/lib/Lex",
+"//clang/lib/Sema",
+"//llvm/lib/MC",
+"//llvm/lib/MC/MCParser",
+"//llvm/lib/Support",
+  ]
+  sources = [
+"ParseAST.cpp",
+"ParseCXXInlineMethods.cpp",
+"ParseDecl.cpp",
+"ParseDeclCXX.cpp",
+"ParseExpr.cpp",
+"ParseExprCXX.cpp",
+"ParseInit.cpp",
+"ParseObjc.cpp",
+"ParseOpenMP.cpp",
+"ParsePragma.cpp",
+"ParseStmt.cpp",
+"ParseStmtAsm.cpp",
+"ParseTemplate.cpp",
+"ParseTentative.cpp",
+"Parser.cpp",
+  ]
+}
Index: llvm/utils/gn/secondary/clang/include/clang/Parse/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/include/clang/Parse/BUILD.gn
@@ -0,0 +1,19 @@
+import("//clang/utils/TableGen/clang_tablegen.gni")
+
+clang_tablegen("AttrParserStringSwitches") {
+  args = [
+"-gen-clang-attr-parser-string-switches",
+"-I",
+rebase_path("../..", root_out_dir),
+  ]
+  td_file = "../Basic/Attr.td"
+}
+
+clang_tablegen("AttrSubMatchRulesParserStringSwitches") {
+  args = [
+"-gen-clang-attr-subject-match-rules-parser-string-switches",
+"-I",
+rebase_path("../..", root_out_dir),
+  ]
+  td_file = "../Basic/Attr.td"
+}
Index: llvm/utils/gn/secondary/BUILD.gn
===
--- llvm/utils/gn/secondary/BUILD.gn
+++ llvm/utils/gn/secondary/BUILD.gn
@@ -1,5 +1,6 @@
 group("default") {
   deps = [
+"//clang/lib/Parse",
 "//clang/tools/clang-format",
 "//lld/test",
 "//llvm/tools/llvm-undname",


Index: llvm/utils/gn/secondary/clang/lib/Parse/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/lib/Parse/BUILD.gn
@@ -0,0 +1,32 @@
+static_library("Parse") {
+  output_name = "clangParse"
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang/include/clang/Parse:AttrParserStringSwitches",
+"//clang/include/clang/Parse:AttrSubMatchRulesParserStringSwitches",
+"//clang/lib/AST",
+"//clang/lib/Basic",
+"//clang/lib/Lex",
+"//clang/lib/Sema",
+"//llvm/lib/MC",
+"//llvm/lib/MC/MCParser",
+"//llvm/lib/Support",
+  ]
+  sources = [
+"ParseAST.cpp",
+"ParseCXXInlineMethods.cpp",
+"ParseDecl.cpp",
+"ParseDeclCXX.cpp",
+"ParseExpr.cpp",
+"ParseExprCXX.cpp",
+"ParseInit.cpp",
+"ParseObjc.cpp",
+"ParseOpenMP.cpp",
+"ParsePragma.cpp",
+"ParseStmt.cpp",
+"ParseStmtAsm.cpp",
+"ParseTemplate.cpp",
+"ParseTentative.cpp",
+"Parser.cpp",
+  ]
+}
Index: llvm/utils/gn/secondary/clang/include/clang/Parse/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/include/clang/Parse/BUILD.gn
@@ -0,0 +1,19 @@
+import("//clang/utils/TableGen/clang_tablegen.gni")
+
+clang_tablegen("AttrParserStringSwitches") {
+  args = [
+"-gen-clang-attr-parser-string-switches",
+"-I",
+rebase_path("../..", root_out_dir),
+  ]
+  td_file = "../Basic/Attr.td"
+}
+
+clang_tablegen("AttrSubMatchRulesParserStringSwitches") {
+  args = [
+"-gen-clang-attr-subject-match-rules-parser-string-switches",
+"-I",
+rebase_path("../..", root_out_dir),
+  ]
+  td_file = "../Basic/Attr.td"
+}
Index: llvm/utils/gn/secondary/BUILD.gn
===
--- llvm/utils/gn/secondary/BUILD.gn
+++ llvm/utils/gn/secondary/BUILD.gn
@@ -1,5 +1,6 @@
 group("default") {
   deps = [
+"//clang/lib/Parse",
 "//clang/tools/clang-format",
 "//lld/tes

Re: r311958 - Revert "Revert r311552: [Bash-autocompletion] Add support for static analyzer flags"

2018-12-20 Thread Nico Weber via cfe-commits
Have you had a chance to look at making this change?

On Mon, Apr 9, 2018 at 9:08 AM Yuka Takahashi  wrote:

> Sounds good!
>
> 2018-04-09 15:03 GMT+02:00 Nico Weber :
>
>> Yes.
>>
>> On Mon, Apr 9, 2018 at 9:00 AM, Yuka Takahashi  wrote:
>>
>>> Hi Nico,
>>>
>>> Thanks for your comment!
>>>
>>> I do agree that this code is hacky. Do you mean to ask tablegen to
>>> generate Checkers.inc under Driver so that we can do like this? :
>>>   #define CHECKER(FULLNAME, CLASS, DESCFILE, HT, G, H)  FULLNAME ","
>>>   #include "clang/Driver/Checkers.inc"
>>>   #undef GET_CHECKERS
>>>
>>> Cheers,
>>> Yuka
>>>
>>> 2018-04-07 4:28 GMT+02:00 Nico Weber :
>>>
 Hi Yuka,

 sorry about the late review comment on this. I just happened to see
 that this lets Driver's Option.inc depend on StaticAnalyzer/Checker's
 Checker.inc. However, Driver does not depend on StaticAnalyzer/Checker. In
 practice, it works ok because of all tablegen targets being collected
 into clang-tablegen-targets and driver depending on that (
 http://llvm-cs.pcc.me.uk/tools/clang/CMakeLists.txt#442), but it still
 feels a bit hacky that Driver's tablegen output depends on code generated
 by StaticAnalyzer/Checker. Maybe we should move Checker.td into Driver now?

 Nico

 On Mon, Aug 28, 2017 at 8:09 PM, Yuka Takahashi via cfe-commits <
 cfe-commits@lists.llvm.org> wrote:

> Author: yamaguchi
> Date: Mon Aug 28 17:09:31 2017
> New Revision: 311958
>
> URL: http://llvm.org/viewvc/llvm-project?rev=311958&view=rev
> Log:
> Revert "Revert r311552: [Bash-autocompletion] Add support for static
> analyzer flags"
>
> This reverts commit 7c46b80c022e18d43c1fdafb117b0c409c5a6d1e.
>
> r311552 broke lld buildbot because I've changed OptionInfos type from
> ArrayRef to vector. However the bug is fixed, so I'll commit this
> again.
>
> Modified:
> cfe/trunk/include/clang/Driver/CC1Options.td
> cfe/trunk/lib/Driver/DriverOptions.cpp
> cfe/trunk/test/Driver/autocomplete.c
>
> Modified: cfe/trunk/include/clang/Driver/CC1Options.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=311958&r1=311957&r2=311958&view=diff
>
> ==
> --- cfe/trunk/include/clang/Driver/CC1Options.td (original)
> +++ cfe/trunk/include/clang/Driver/CC1Options.td Mon Aug 28 17:09:31
> 2017
> @@ -99,7 +99,19 @@ def analyzer_stats : Flag<["-"], "analyz
>HelpText<"Print internal analyzer statistics.">;
>
>  def analyzer_checker : Separate<["-"], "analyzer-checker">,
> -  HelpText<"Choose analyzer checkers to enable">;
> +  HelpText<"Choose analyzer checkers to enable">,
> +  ValuesCode<[{
> +const char *Values =
> +#define GET_CHECKERS
> +#define CHECKER(FULLNAME, CLASS, DESCFILE, HT, G, H)  FULLNAME ","
> +#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
> +#undef GET_CHECKERS
> +#define GET_PACKAGES
> +#define PACKAGE(FULLNAME, G, D)  FULLNAME ","
> +#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
> +#undef GET_PACKAGES
> +;
> +  }]>;
>  def analyzer_checker_EQ : Joined<["-"], "analyzer-checker=">,
>Alias;
>
>
> Modified: cfe/trunk/lib/Driver/DriverOptions.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/DriverOptions.cpp?rev=311958&r1=311957&r2=311958&view=diff
>
> ==
> --- cfe/trunk/lib/Driver/DriverOptions.cpp (original)
> +++ cfe/trunk/lib/Driver/DriverOptions.cpp Mon Aug 28 17:09:31 2017
> @@ -11,6 +11,7 @@
>  #include "llvm/ADT/STLExtras.h"
>  #include "llvm/Option/OptTable.h"
>  #include "llvm/Option/Option.h"
> +#include 
>
>  using namespace clang::driver;
>  using namespace clang::driver::options;
> @@ -40,5 +41,13 @@ public:
>  }
>
>  std::unique_ptr clang::driver::createDriverOptTable() {
> -  return llvm::make_unique();
> +  auto Result = llvm::make_unique();
> +  // Options.inc is included in DriverOptions.cpp, and calls
> OptTable's
> +  // addValues function.
> +  // Opt is a variable used in the code fragment in Options.inc.
> +  OptTable &Opt = *Result;
> +#define OPTTABLE_ARG_INIT
> +#include "clang/Driver/Options.inc"
> +#undef OPTTABLE_ARG_INIT
> +  return std::move(Result);
>  }
>
> Modified: cfe/trunk/test/Driver/autocomplete.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/autocomplete.c?rev=311958&r1=311957&r2=311958&view=diff
>
> ==
> --- cfe/trunk/test/Driver/autocomplete.c (original)
> +

[PATCH] D55927: [gn build] Add build file for clang/lib/Driver

2018-12-20 Thread Nico Weber via Phabricator via cfe-commits
thakis created this revision.
thakis added a reviewer: phosek.
Herald added subscribers: fedor.sergeev, aheejin, dschuff.

Mostly boring, except for the spurious dependency on StaticAnalyzer/Checkers -- 
see comments in the code.


https://reviews.llvm.org/D55927

Files:
  llvm/utils/gn/secondary/BUILD.gn
  llvm/utils/gn/secondary/clang/include/clang/Driver/BUILD.gn
  llvm/utils/gn/secondary/clang/include/clang/StaticAnalyzer/Checkers/BUILD.gn
  llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn

Index: llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn
@@ -0,0 +1,86 @@
+static_library("Driver") {
+  output_name = "clangDriver"
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  include_dirs = [ "." ]
+  deps = [
+"//clang/include/clang/Config",
+
+# Driver doesn't depend on StaticAnalyzer and the other way round, but
+# as of clang r311958 Driver does depend on StaticAnalyzer/Checkers's
+# tablegen'd Checkers.inc.  The CMake build runs all clang tablegen steps
+# before all lib compilations via the clang-tablegen-targets target; the
+# GN build has this dependency instead.
+# FIXME: Move Checkers.td somewhere else to clean up this layering mess.
+# See the review thread of r311958 for details.
+"//clang/include/clang/StaticAnalyzer/Checkers",
+"//clang/lib/Basic",
+"//llvm/include/llvm/Config:llvm-config",
+"//llvm/lib/BinaryFormat",
+"//llvm/lib/Option",
+"//llvm/lib/Support",
+  ]
+  public_deps = [
+# public_dep because public header Options.h includes generated Options.inc.
+"//clang/include/clang/Driver:Options",
+  ]
+  if (host_os == "win") {
+# MSVCToolChain.cpp uses version.dll.
+libs = [ "version.lib" ]
+  }
+  sources = [
+"Action.cpp",
+"Compilation.cpp",
+"Distro.cpp",
+"Driver.cpp",
+"DriverOptions.cpp",
+"Job.cpp",
+"Multilib.cpp",
+"Phases.cpp",
+"SanitizerArgs.cpp",
+"Tool.cpp",
+"ToolChain.cpp",
+"ToolChains/AMDGPU.cpp",
+"ToolChains/AVR.cpp",
+"ToolChains/Ananas.cpp",
+"ToolChains/Arch/AArch64.cpp",
+"ToolChains/Arch/ARM.cpp",
+"ToolChains/Arch/Mips.cpp",
+"ToolChains/Arch/PPC.cpp",
+"ToolChains/Arch/RISCV.cpp",
+"ToolChains/Arch/Sparc.cpp",
+"ToolChains/Arch/SystemZ.cpp",
+"ToolChains/Arch/X86.cpp",
+"ToolChains/BareMetal.cpp",
+"ToolChains/Clang.cpp",
+"ToolChains/CloudABI.cpp",
+"ToolChains/CommonArgs.cpp",
+"ToolChains/Contiki.cpp",
+"ToolChains/CrossWindows.cpp",
+"ToolChains/Cuda.cpp",
+"ToolChains/Darwin.cpp",
+"ToolChains/DragonFly.cpp",
+"ToolChains/FreeBSD.cpp",
+"ToolChains/Fuchsia.cpp",
+"ToolChains/Gnu.cpp",
+"ToolChains/HIP.cpp",
+"ToolChains/Haiku.cpp",
+"ToolChains/Hexagon.cpp",
+"ToolChains/Linux.cpp",
+"ToolChains/MSVC.cpp",
+"ToolChains/MinGW.cpp",
+"ToolChains/Minix.cpp",
+"ToolChains/MipsLinux.cpp",
+"ToolChains/Myriad.cpp",
+"ToolChains/NaCl.cpp",
+"ToolChains/NetBSD.cpp",
+"ToolChains/OpenBSD.cpp",
+"ToolChains/PS4CPU.cpp",
+"ToolChains/RISCVToolchain.cpp",
+"ToolChains/Solaris.cpp",
+"ToolChains/TCE.cpp",
+"ToolChains/WebAssembly.cpp",
+"ToolChains/XCore.cpp",
+"Types.cpp",
+"XRayArgs.cpp",
+  ]
+}
Index: llvm/utils/gn/secondary/clang/include/clang/StaticAnalyzer/Checkers/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/include/clang/StaticAnalyzer/Checkers/BUILD.gn
@@ -0,0 +1,5 @@
+import("//clang/utils/TableGen/clang_tablegen.gni")
+
+clang_tablegen("Checkers") {
+  args = [ "-gen-clang-sa-checkers" ]
+}
Index: llvm/utils/gn/secondary/clang/include/clang/Driver/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/include/clang/Driver/BUILD.gn
@@ -0,0 +1,5 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("Options") {
+  args = [ "-gen-opt-parser-defs" ]
+}
Index: llvm/utils/gn/secondary/BUILD.gn
===
--- llvm/utils/gn/secondary/BUILD.gn
+++ llvm/utils/gn/secondary/BUILD.gn
@@ -1,5 +1,6 @@
 group("default") {
   deps = [
+"//clang/lib/Driver",
 "//clang/lib/Parse",
 "//clang/tools/clang-format",
 "//lld/test",
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D55928: [OpenMP] Add flag for preventing the extension to 64 bits for the collapse loop counter

2018-12-20 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea created this revision.
gtbercea added reviewers: ABataev, caomhin.
Herald added subscribers: cfe-commits, guansong.

Introduce a compiler flag for cases when the user knows that the collapsed loop 
counter can be safely represented using at most 32 bits. This will prevent the 
emission of expensive mathematical operations (such as the div operation) on 
the iteration variable using 64 bits where 32 bit operations are sufficient.


Repository:
  rC Clang

https://reviews.llvm.org/D55928

Files:
  docs/OpenMPSupport.rst
  include/clang/Basic/LangOptions.def
  include/clang/Driver/Options.td
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Sema/SemaOpenMP.cpp
  test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp

Index: test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
===
--- test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
+++ test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
@@ -1,6 +1,7 @@
 // Test target codegen - host bc file has to be created first.
 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64 --check-prefix CHECK-DIV64
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -fopenmp-max-32bit-collapse-width -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-DIV32
 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc
 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32
 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -fexceptions -fcxx-exceptions -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32
@@ -9,11 +10,12 @@
 #define HEADER
 
 // Check that the execution mode of all 5 target regions on the gpu is set to SPMD Mode.
-// CHECK-DAG: {{@__omp_offloading_.+l32}}_exec_mode = weak constant i8 0
-// CHECK-DAG: {{@__omp_offloading_.+l38}}_exec_mode = weak constant i8 0
-// CHECK-DAG: {{@__omp_offloading_.+l43}}_exec_mode = weak constant i8 0
-// CHECK-DAG: {{@__omp_offloading_.+l48}}_exec_mode = weak constant i8 0
-// CHECK-DAG: {{@__omp_offloading_.+l56}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l34}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l40}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l45}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l50}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l58}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l65}}_exec_mode = weak constant i8 0
 
 #define N 1000
 #define M 10
@@ -80,7 +82,7 @@
 // CHECK-DAG: [[KERNEL_SIZE:@.+]] = internal unnamed_addr constant i{{64|32}} 4
 // CHECK-DAG: [[KERNEL_SHARED:@.+]] = internal unnamed_addr constant i16 1
 
-// CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+}}_l32(
+// CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+}}_l34(
 // CHECK-DAG: [[THREAD_LIMIT:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.ntid.x()
 // CHECK: call void @__kmpc_spmd_kernel_init(i32 [[THREAD_LIMIT]], i16 0, i16 0)
 // CHECK: call void @__kmpc_get_team_static_memory(i8* addrspacecast (i8 addrspace(3)* getelementptr inbounds ([[MEM_TY]], [[MEM_TY]] addrspace(3)* [[SHARED_GLOBAL_RD]], i32 0, i32 0, i32 0) to i8*), i{{64|32}} 4, i16 1, i8** addrspacecast (i8* addrspace(3)* [[KERNEL_PTR]] to i8**))
@@ -214,16 +216,19 @@
 // CHECK: call void @__kmpc_spmd_kernel_deinit_v2(i16 0)
 // CHECK: ret void
 
-// CHECK: define internal void [[OUTL4]](
+// CHECK-32: define internal void [[OUTL4]](
+// CHECK-64: define int

[PATCH] D55927: [gn build] Add build file for clang/lib/Driver

2018-12-20 Thread Nico Weber via Phabricator via cfe-commits
thakis updated this revision to Diff 179067.
thakis added a comment.

sync


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55927/new/

https://reviews.llvm.org/D55927

Files:
  llvm/utils/gn/secondary/BUILD.gn
  llvm/utils/gn/secondary/clang/include/clang/Driver/BUILD.gn
  llvm/utils/gn/secondary/clang/include/clang/StaticAnalyzer/Checkers/BUILD.gn
  llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn

Index: llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn
@@ -0,0 +1,88 @@
+static_library("Driver") {
+  output_name = "clangDriver"
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  include_dirs = [ "." ]
+  deps = [
+"//clang/include/clang/Config",
+
+# Driver doesn't depend on StaticAnalyzer and the other way round, but
+# as of clang r311958 Driver does depend on StaticAnalyzer/Checkers's
+# tablegen'd Checkers.inc.  The CMake build runs all clang tablegen steps
+# before all lib compilations via the clang-tablegen-targets target; the
+# GN build has this dependency instead.
+# FIXME: Move Checkers.td somewhere else to clean up this layering mess.
+# See the review thread of r311958 for details.
+"//clang/include/clang/StaticAnalyzer/Checkers",
+"//clang/lib/Basic",
+"//llvm/include/llvm/Config:llvm-config",
+"//llvm/lib/BinaryFormat",
+"//llvm/lib/Option",
+"//llvm/lib/Support",
+  ]
+  public_deps = [
+# public_dep because public header Options.h includes generated Options.inc.
+"//clang/include/clang/Driver:Options",
+  ]
+  if (host_os == "win") {
+# MSVCToolChain.cpp uses version.dll.
+libs = [ "version.lib" ]
+  }
+  sources = [
+"Action.cpp",
+"Compilation.cpp",
+"DarwinSDKInfo.cpp",
+"Distro.cpp",
+"Driver.cpp",
+"DriverOptions.cpp",
+"Job.cpp",
+"Multilib.cpp",
+"Phases.cpp",
+"SanitizerArgs.cpp",
+"Tool.cpp",
+"ToolChain.cpp",
+"ToolChains/AMDGPU.cpp",
+"ToolChains/AVR.cpp",
+"ToolChains/Ananas.cpp",
+"ToolChains/Arch/AArch64.cpp",
+"ToolChains/Arch/ARM.cpp",
+"ToolChains/Arch/Mips.cpp",
+"ToolChains/Arch/PPC.cpp",
+"ToolChains/Arch/RISCV.cpp",
+"ToolChains/Arch/Sparc.cpp",
+"ToolChains/Arch/SystemZ.cpp",
+"ToolChains/Arch/X86.cpp",
+"ToolChains/BareMetal.cpp",
+"ToolChains/Clang.cpp",
+"ToolChains/CloudABI.cpp",
+"ToolChains/CommonArgs.cpp",
+"ToolChains/Contiki.cpp",
+"ToolChains/CrossWindows.cpp",
+"ToolChains/Cuda.cpp",
+"ToolChains/Darwin.cpp",
+"ToolChains/DragonFly.cpp",
+"ToolChains/FreeBSD.cpp",
+"ToolChains/Fuchsia.cpp",
+"ToolChains/Gnu.cpp",
+"ToolChains/HIP.cpp",
+"ToolChains/Haiku.cpp",
+"ToolChains/Hexagon.cpp",
+"ToolChains/Hurd.cpp",
+"ToolChains/Linux.cpp",
+"ToolChains/MSVC.cpp",
+"ToolChains/MinGW.cpp",
+"ToolChains/Minix.cpp",
+"ToolChains/MipsLinux.cpp",
+"ToolChains/Myriad.cpp",
+"ToolChains/NaCl.cpp",
+"ToolChains/NetBSD.cpp",
+"ToolChains/OpenBSD.cpp",
+"ToolChains/PS4CPU.cpp",
+"ToolChains/RISCVToolchain.cpp",
+"ToolChains/Solaris.cpp",
+"ToolChains/TCE.cpp",
+"ToolChains/WebAssembly.cpp",
+"ToolChains/XCore.cpp",
+"Types.cpp",
+"XRayArgs.cpp",
+  ]
+}
Index: llvm/utils/gn/secondary/clang/include/clang/StaticAnalyzer/Checkers/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/include/clang/StaticAnalyzer/Checkers/BUILD.gn
@@ -0,0 +1,5 @@
+import("//clang/utils/TableGen/clang_tablegen.gni")
+
+clang_tablegen("Checkers") {
+  args = [ "-gen-clang-sa-checkers" ]
+}
Index: llvm/utils/gn/secondary/clang/include/clang/Driver/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/include/clang/Driver/BUILD.gn
@@ -0,0 +1,5 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("Options") {
+  args = [ "-gen-opt-parser-defs" ]
+}
Index: llvm/utils/gn/secondary/BUILD.gn
===
--- llvm/utils/gn/secondary/BUILD.gn
+++ llvm/utils/gn/secondary/BUILD.gn
@@ -1,5 +1,6 @@
 group("default") {
   deps = [
+"//clang/lib/Driver",
 "//clang/lib/Parse",
 "//clang/tools/clang-format",
 "//lld/test",
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r311958 - Revert "Revert r311552: [Bash-autocompletion] Add support for static analyzer flags"

2018-12-20 Thread Yuka Takahashi via cfe-commits
Sorry I totally forgot. Taking a look now, I will add you to a
reviewer when I have an alternative patch!

Thanks for the reminder.
On Thu, 20 Dec 2018 at 15:20, Nico Weber  wrote:
>
> Have you had a chance to look at making this change?
>
> On Mon, Apr 9, 2018 at 9:08 AM Yuka Takahashi  wrote:
>>
>> Sounds good!
>>
>> 2018-04-09 15:03 GMT+02:00 Nico Weber :
>>>
>>> Yes.
>>>
>>> On Mon, Apr 9, 2018 at 9:00 AM, Yuka Takahashi  wrote:

 Hi Nico,

 Thanks for your comment!

 I do agree that this code is hacky. Do you mean to ask tablegen to 
 generate Checkers.inc under Driver so that we can do like this? :
   #define CHECKER(FULLNAME, CLASS, DESCFILE, HT, G, H)  FULLNAME ","
   #include "clang/Driver/Checkers.inc"
   #undef GET_CHECKERS

 Cheers,
 Yuka

 2018-04-07 4:28 GMT+02:00 Nico Weber :
>
> Hi Yuka,
>
> sorry about the late review comment on this. I just happened to see that 
> this lets Driver's Option.inc depend on StaticAnalyzer/Checker's 
> Checker.inc. However, Driver does not depend on StaticAnalyzer/Checker. 
> In practice, it works ok because of all tablegen targets being collected 
> into clang-tablegen-targets and driver depending on that 
> (http://llvm-cs.pcc.me.uk/tools/clang/CMakeLists.txt#442), but it still 
> feels a bit hacky that Driver's tablegen output depends on code generated 
> by StaticAnalyzer/Checker. Maybe we should move Checker.td into Driver 
> now?
>
> Nico
>
> On Mon, Aug 28, 2017 at 8:09 PM, Yuka Takahashi via cfe-commits 
>  wrote:
>>
>> Author: yamaguchi
>> Date: Mon Aug 28 17:09:31 2017
>> New Revision: 311958
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=311958&view=rev
>> Log:
>> Revert "Revert r311552: [Bash-autocompletion] Add support for static 
>> analyzer flags"
>>
>> This reverts commit 7c46b80c022e18d43c1fdafb117b0c409c5a6d1e.
>>
>> r311552 broke lld buildbot because I've changed OptionInfos type from
>> ArrayRef to vector. However the bug is fixed, so I'll commit this again.
>>
>> Modified:
>> cfe/trunk/include/clang/Driver/CC1Options.td
>> cfe/trunk/lib/Driver/DriverOptions.cpp
>> cfe/trunk/test/Driver/autocomplete.c
>>
>> Modified: cfe/trunk/include/clang/Driver/CC1Options.td
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=311958&r1=311957&r2=311958&view=diff
>> ==
>> --- cfe/trunk/include/clang/Driver/CC1Options.td (original)
>> +++ cfe/trunk/include/clang/Driver/CC1Options.td Mon Aug 28 17:09:31 2017
>> @@ -99,7 +99,19 @@ def analyzer_stats : Flag<["-"], "analyz
>>HelpText<"Print internal analyzer statistics.">;
>>
>>  def analyzer_checker : Separate<["-"], "analyzer-checker">,
>> -  HelpText<"Choose analyzer checkers to enable">;
>> +  HelpText<"Choose analyzer checkers to enable">,
>> +  ValuesCode<[{
>> +const char *Values =
>> +#define GET_CHECKERS
>> +#define CHECKER(FULLNAME, CLASS, DESCFILE, HT, G, H)  FULLNAME ","
>> +#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
>> +#undef GET_CHECKERS
>> +#define GET_PACKAGES
>> +#define PACKAGE(FULLNAME, G, D)  FULLNAME ","
>> +#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
>> +#undef GET_PACKAGES
>> +;
>> +  }]>;
>>  def analyzer_checker_EQ : Joined<["-"], "analyzer-checker=">,
>>Alias;
>>
>>
>> Modified: cfe/trunk/lib/Driver/DriverOptions.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/DriverOptions.cpp?rev=311958&r1=311957&r2=311958&view=diff
>> ==
>> --- cfe/trunk/lib/Driver/DriverOptions.cpp (original)
>> +++ cfe/trunk/lib/Driver/DriverOptions.cpp Mon Aug 28 17:09:31 2017
>> @@ -11,6 +11,7 @@
>>  #include "llvm/ADT/STLExtras.h"
>>  #include "llvm/Option/OptTable.h"
>>  #include "llvm/Option/Option.h"
>> +#include 
>>
>>  using namespace clang::driver;
>>  using namespace clang::driver::options;
>> @@ -40,5 +41,13 @@ public:
>>  }
>>
>>  std::unique_ptr clang::driver::createDriverOptTable() {
>> -  return llvm::make_unique();
>> +  auto Result = llvm::make_unique();
>> +  // Options.inc is included in DriverOptions.cpp, and calls OptTable's
>> +  // addValues function.
>> +  // Opt is a variable used in the code fragment in Options.inc.
>> +  OptTable &Opt = *Result;
>> +#define OPTTABLE_ARG_INIT
>> +#include "clang/Driver/Options.inc"
>> +#undef OPTTABLE_ARG_INIT
>> +  return std::move(Result);
>>  }
>>
>> Modified: cfe/trunk/test/Driver/autocomplete.c
>> URL: 

[PATCH] D55928: [OpenMP] Add flag for preventing the extension to 64 bits for the collapse loop counter

2018-12-20 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: docs/OpenMPSupport.rst:119
+time. To prevent this conservative choice and use at most 32 bits,
+compile your program with the `-fopenmp-max-32bit-collapse-width`.
+

-fopenmp-optimistic-collapse



Comment at: include/clang/Basic/LangOptions.def:210
 LANGOPT(OpenMPCUDABlocksPerSM  , 32, 0, "Number of blocks per SM for CUDA 
devices.")
+LANGOPT(OpenMPMax32BitCollapseWidth  , 1, 0, "Use at most 32 bits to represent 
the collapsed loop nest counter.")
 LANGOPT(RenderScript  , 1, 0, "RenderScript")

Fix the description and the option in accordance with the option name



Comment at: include/clang/Driver/Options.td:1577
   Flags<[CC1Option, NoArgumentUnused, HelpHidden]>;
+def fopenmp_max_32bit_collapse_width : Flag<["-"], 
"fopenmp-max-32bit-collapse-width">, Group,
+  Flags<[CC1Option, NoArgumentUnused, HelpHidden]>;

Missed -fno... option



Comment at: lib/Driver/ToolChains/Clang.cpp:4429
   Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_cuda_blocks_per_sm_EQ);
+  Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_max_32bit_collapse_width);
 

You need to change the processing taking into account -fno... option.



Comment at: lib/Frontend/CompilerInvocation.cpp:2848
+  // OpenMP collapse clause.
+  Opts.OpenMPMax32BitCollapseWidth =
+  Args.hasArg(options::OPT_fopenmp_max_32bit_collapse_width) ? 1 : 0;

Also, need to check for -fno... option


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55928/new/

https://reviews.llvm.org/D55928



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


[PATCH] D55930: [gn build] Add build files for clang/lib/{Frontend, Frontend/Rewrite, Serialization}

2018-12-20 Thread Nico Weber via Phabricator via cfe-commits
thakis created this revision.
thakis added a reviewer: phosek.

https://reviews.llvm.org/D55930

Files:
  llvm/utils/gn/secondary/BUILD.gn
  llvm/utils/gn/secondary/clang/include/clang/Serialization/BUILD.gn
  llvm/utils/gn/secondary/clang/lib/Frontend/BUILD.gn
  llvm/utils/gn/secondary/clang/lib/Frontend/Rewrite/BUILD.gn
  llvm/utils/gn/secondary/clang/lib/Serialization/BUILD.gn

Index: llvm/utils/gn/secondary/clang/lib/Serialization/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/lib/Serialization/BUILD.gn
@@ -0,0 +1,31 @@
+static_library("Serialization") {
+  output_name = "clangSerialization"
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang/include/clang/Serialization:AttrPCHRead",
+"//clang/include/clang/Serialization:AttrPCHWrite",
+"//clang/lib/AST",
+"//clang/lib/Basic",
+"//clang/lib/Lex",
+"//clang/lib/Sema",
+"//llvm/lib/Bitcode/Reader",
+"//llvm/lib/Support",
+  ]
+  sources = [
+"ASTCommon.cpp",
+"ASTCommon.h",
+"ASTReader.cpp",
+"ASTReaderDecl.cpp",
+"ASTReaderInternals.h",
+"ASTReaderStmt.cpp",
+"ASTWriter.cpp",
+"ASTWriterDecl.cpp",
+"ASTWriterStmt.cpp",
+"GeneratePCH.cpp",
+"GlobalModuleIndex.cpp",
+"Module.cpp",
+"ModuleFileExtension.cpp",
+"ModuleManager.cpp",
+"PCHContainerOperations.cpp",
+  ]
+}
Index: llvm/utils/gn/secondary/clang/lib/Frontend/Rewrite/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/lib/Frontend/Rewrite/BUILD.gn
@@ -0,0 +1,24 @@
+static_library("Rewrite") {
+  output_name = "clangRewriteFrontend"
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang/lib/AST",
+"//clang/lib/Basic",
+"//clang/lib/Edit",
+"//clang/lib/Frontend",
+"//clang/lib/Lex",
+"//clang/lib/Rewrite",
+"//clang/lib/Serialization",
+"//llvm/lib/Support",
+  ]
+  sources = [
+"FixItRewriter.cpp",
+"FrontendActions.cpp",
+"HTMLPrint.cpp",
+"InclusionRewriter.cpp",
+"RewriteMacros.cpp",
+"RewriteModernObjC.cpp",
+"RewriteObjC.cpp",
+"RewriteTest.cpp",
+  ]
+}
Index: llvm/utils/gn/secondary/clang/lib/Frontend/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/lib/Frontend/BUILD.gn
@@ -0,0 +1,54 @@
+static_library("Frontend") {
+  output_name = "clangFrontend"
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang/include/clang/Config",
+"//clang/lib/AST",
+"//clang/lib/Basic",
+"//clang/lib/Driver",
+"//clang/lib/Edit",
+"//clang/lib/Lex",
+"//clang/lib/Parse",
+"//clang/lib/Sema",
+"//clang/lib/Serialization",
+"//llvm/include/llvm/Config:llvm-config",
+"//llvm/lib/Bitcode/Reader",
+"//llvm/lib/Option",
+"//llvm/lib/ProfileData",
+"//llvm/lib/Support",
+  ]
+  sources = [
+"ASTConsumers.cpp",
+"ASTMerge.cpp",
+"ASTUnit.cpp",
+"ChainedDiagnosticConsumer.cpp",
+"ChainedIncludesSource.cpp",
+"CompilerInstance.cpp",
+"CompilerInvocation.cpp",
+"CreateInvocationFromCommandLine.cpp",
+"DependencyFile.cpp",
+"DependencyGraph.cpp",
+"DiagnosticRenderer.cpp",
+"FrontendAction.cpp",
+"FrontendActions.cpp",
+"FrontendOptions.cpp",
+"FrontendTiming.cpp",
+"HeaderIncludeGen.cpp",
+"InitHeaderSearch.cpp",
+"InitPreprocessor.cpp",
+"LangStandards.cpp",
+"LayoutOverrideSource.cpp",
+"LogDiagnosticPrinter.cpp",
+"ModuleDependencyCollector.cpp",
+"MultiplexConsumer.cpp",
+"PrecompiledPreamble.cpp",
+"PrintPreprocessedOutput.cpp",
+"SerializedDiagnosticPrinter.cpp",
+"SerializedDiagnosticReader.cpp",
+"TestModuleFileExtension.cpp",
+"TextDiagnostic.cpp",
+"TextDiagnosticBuffer.cpp",
+"TextDiagnosticPrinter.cpp",
+"VerifyDiagnosticConsumer.cpp",
+  ]
+}
Index: llvm/utils/gn/secondary/clang/include/clang/Serialization/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/include/clang/Serialization/BUILD.gn
@@ -0,0 +1,19 @@
+import("//clang/utils/TableGen/clang_tablegen.gni")
+
+clang_tablegen("AttrPCHRead") {
+  args = [
+"-gen-clang-attr-pch-read",
+"-I",
+rebase_path("../..", root_out_dir),
+  ]
+  td_file = "../Basic/Attr.td"
+}
+
+clang_tablegen("AttrPCHWrite") {
+  args = [
+"-gen-clang-attr-pch-write",
+"-I",
+rebase_path("../..", root_out_dir),
+  ]
+  td_file = "../Basic/Attr.td"
+}
Index: llvm/utils/gn/secondary/BUILD.gn
===
--- llvm/utils/gn/secondary/BUILD.gn
+++ llvm/utils/gn/secondary/BUILD.gn
@@ -1,7 +1,10 @@
 group("default") {
   deps = [
 "//clang/lib/Driver",
+"//clang/lib/Frontend",
+"//clang/lib/Frontend/Rewrite",

[PATCH] D55928: [OpenMP] Add flag for preventing the extension to 64 bits for the collapse loop counter

2018-12-20 Thread Kelvin Li via Phabricator via cfe-commits
kkwli0 added inline comments.



Comment at: docs/OpenMPSupport.rst:119
+time. To prevent this conservative choice and use at most 32 bits,
+compile your program with the `-fopenmp-max-32bit-collapse-width`.
+

ABataev wrote:
> -fopenmp-optimistic-collapse
How about -fopenmp-use-32bit-collapse-parameter?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55928/new/

https://reviews.llvm.org/D55928



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


[PATCH] D55931: [gn build] Add build file for clang/lib/CodeGen and llvm/lib/ProfileData/Coverage

2018-12-20 Thread Nico Weber via Phabricator via cfe-commits
thakis created this revision.
thakis added a reviewer: phosek.
Herald added subscribers: jfb, hiraditya.

https://reviews.llvm.org/D55931

Files:
  llvm/utils/gn/secondary/BUILD.gn
  llvm/utils/gn/secondary/clang/lib/CodeGen/BUILD.gn
  llvm/utils/gn/secondary/llvm/lib/ProfileData/Coverage/BUILD.gn

Index: llvm/utils/gn/secondary/llvm/lib/ProfileData/Coverage/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/llvm/lib/ProfileData/Coverage/BUILD.gn
@@ -0,0 +1,14 @@
+static_library("Coverage") {
+  output_name = "LLVMCoverage"
+  deps = [
+"//llvm/lib/IR",
+"//llvm/lib/Object",
+"//llvm/lib/ProfileData",
+"//llvm/lib/Support",
+  ]
+  sources = [
+"CoverageMapping.cpp",
+"CoverageMappingReader.cpp",
+"CoverageMappingWriter.cpp",
+  ]
+}
Index: llvm/utils/gn/secondary/clang/lib/CodeGen/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/lib/CodeGen/BUILD.gn
@@ -0,0 +1,88 @@
+static_library("CodeGen") {
+  output_name = "clangCodeGen"
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang/lib/AST",
+"//clang/lib/Analysis",
+"//clang/lib/Basic",
+"//clang/lib/Frontend",
+"//clang/lib/Lex",
+"//llvm/lib/Analysis",
+"//llvm/lib/Bitcode/Reader",
+"//llvm/lib/IR",
+"//llvm/lib/IRReader",
+"//llvm/lib/LTO",
+"//llvm/lib/Linker",
+"//llvm/lib/MC",
+"//llvm/lib/Object",
+"//llvm/lib/Passes",
+"//llvm/lib/ProfileData",
+"//llvm/lib/ProfileData/Coverage",
+"//llvm/lib/Support",
+"//llvm/lib/Target",
+"//llvm/lib/Transforms/Coroutines",
+"//llvm/lib/Transforms/IPO",
+"//llvm/lib/Transforms/InstCombine",
+"//llvm/lib/Transforms/Instrumentation",
+"//llvm/lib/Transforms/ObjCARC",
+"//llvm/lib/Transforms/Scalar",
+"//llvm/lib/Transforms/Utils",
+  ]
+  sources = [
+"BackendUtil.cpp",
+"CGAtomic.cpp",
+"CGBlocks.cpp",
+"CGBuiltin.cpp",
+"CGCUDANV.cpp",
+"CGCUDARuntime.cpp",
+"CGCXX.cpp",
+"CGCXXABI.cpp",
+"CGCall.cpp",
+"CGClass.cpp",
+"CGCleanup.cpp",
+"CGCoroutine.cpp",
+"CGDebugInfo.cpp",
+"CGDecl.cpp",
+"CGDeclCXX.cpp",
+"CGException.cpp",
+"CGExpr.cpp",
+"CGExprAgg.cpp",
+"CGExprCXX.cpp",
+"CGExprComplex.cpp",
+"CGExprConstant.cpp",
+"CGExprScalar.cpp",
+"CGGPUBuiltin.cpp",
+"CGLoopInfo.cpp",
+"CGNonTrivialStruct.cpp",
+"CGObjC.cpp",
+"CGObjCGNU.cpp",
+"CGObjCMac.cpp",
+"CGObjCRuntime.cpp",
+"CGOpenCLRuntime.cpp",
+"CGOpenMPRuntime.cpp",
+"CGOpenMPRuntimeNVPTX.cpp",
+"CGRecordLayoutBuilder.cpp",
+"CGStmt.cpp",
+"CGStmtOpenMP.cpp",
+"CGVTT.cpp",
+"CGVTables.cpp",
+"CodeGenABITypes.cpp",
+"CodeGenAction.cpp",
+"CodeGenFunction.cpp",
+"CodeGenModule.cpp",
+"CodeGenPGO.cpp",
+"CodeGenTBAA.cpp",
+"CodeGenTypes.cpp",
+"ConstantInitBuilder.cpp",
+"CoverageMappingGen.cpp",
+"ItaniumCXXABI.cpp",
+"MacroPPCallbacks.cpp",
+"MicrosoftCXXABI.cpp",
+"ModuleBuilder.cpp",
+"ObjectFilePCHContainerOperations.cpp",
+"SanitizerMetadata.cpp",
+"SwiftCallingConv.cpp",
+"TargetInfo.cpp",
+"VarBypassDetector.cpp",
+  ]
+}
Index: llvm/utils/gn/secondary/BUILD.gn
===
--- llvm/utils/gn/secondary/BUILD.gn
+++ llvm/utils/gn/secondary/BUILD.gn
@@ -1,5 +1,6 @@
 group("default") {
   deps = [
+"//clang/lib/CodeGen",
 "//clang/lib/Driver",
 "//clang/lib/Frontend",
 "//clang/lib/Frontend/Rewrite",
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D55928: [OpenMP] Add flag for preventing the extension to 64 bits for the collapse loop counter

2018-12-20 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea updated this revision to Diff 179076.
gtbercea marked 4 inline comments as done.
gtbercea edited the summary of this revision.
gtbercea added a comment.

- Address comments.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55928/new/

https://reviews.llvm.org/D55928

Files:
  docs/OpenMPSupport.rst
  include/clang/Basic/LangOptions.def
  include/clang/Driver/Options.td
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Sema/SemaOpenMP.cpp
  test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp

Index: test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
===
--- test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
+++ test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
@@ -1,6 +1,7 @@
 // Test target codegen - host bc file has to be created first.
 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64 --check-prefix CHECK-DIV64
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -fopenmp-optimistic-collapse -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-DIV32
 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc
 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32
 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -fexceptions -fcxx-exceptions -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32
@@ -9,11 +10,12 @@
 #define HEADER
 
 // Check that the execution mode of all 5 target regions on the gpu is set to SPMD Mode.
-// CHECK-DAG: {{@__omp_offloading_.+l32}}_exec_mode = weak constant i8 0
-// CHECK-DAG: {{@__omp_offloading_.+l38}}_exec_mode = weak constant i8 0
-// CHECK-DAG: {{@__omp_offloading_.+l43}}_exec_mode = weak constant i8 0
-// CHECK-DAG: {{@__omp_offloading_.+l48}}_exec_mode = weak constant i8 0
-// CHECK-DAG: {{@__omp_offloading_.+l56}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l34}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l40}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l45}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l50}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l58}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l65}}_exec_mode = weak constant i8 0
 
 #define N 1000
 #define M 10
@@ -80,7 +82,7 @@
 // CHECK-DAG: [[KERNEL_SIZE:@.+]] = internal unnamed_addr constant i{{64|32}} 4
 // CHECK-DAG: [[KERNEL_SHARED:@.+]] = internal unnamed_addr constant i16 1
 
-// CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+}}_l32(
+// CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+}}_l34(
 // CHECK-DAG: [[THREAD_LIMIT:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.ntid.x()
 // CHECK: call void @__kmpc_spmd_kernel_init(i32 [[THREAD_LIMIT]], i16 0, i16 0)
 // CHECK: call void @__kmpc_get_team_static_memory(i8* addrspacecast (i8 addrspace(3)* getelementptr inbounds ([[MEM_TY]], [[MEM_TY]] addrspace(3)* [[SHARED_GLOBAL_RD]], i32 0, i32 0, i32 0) to i8*), i{{64|32}} 4, i16 1, i8** addrspacecast (i8* addrspace(3)* [[KERNEL_PTR]] to i8**))
@@ -214,16 +216,19 @@
 // CHECK: call void @__kmpc_spmd_kernel_deinit_v2(i16 0)
 // CHECK: ret void
 
-// CHECK: define internal void [[OUTL4]](
+// CHECK-32: define internal void [[OUTL4]](
+// CHECK-64: define internal void [[OUTL4]](
 // CHECK: call void @__kmpc_for_static_init_4({{.+}}, {{.+}}, {{.+}} 33,
 // CHECK: call void @__kmpc_for_static_fini(
 // CHECK: ret void
 
-// CHECK: define weak void @__omp

[PATCH] D55928: [OpenMP] Add flag for preventing the extension to 64 bits for the collapse loop counter

2018-12-20 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea added inline comments.



Comment at: include/clang/Basic/LangOptions.def:210
 LANGOPT(OpenMPCUDABlocksPerSM  , 32, 0, "Number of blocks per SM for CUDA 
devices.")
+LANGOPT(OpenMPMax32BitCollapseWidth  , 1, 0, "Use at most 32 bits to represent 
the collapsed loop nest counter.")
 LANGOPT(RenderScript  , 1, 0, "RenderScript")

ABataev wrote:
> Fix the description and the option in accordance with the option name
The description accurately describes what Sema is doing. We allow an extension 
to up to 32 bits but no further.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55928/new/

https://reviews.llvm.org/D55928



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


[PATCH] D55928: [OpenMP] Add flag for preventing the extension to 64 bits for the collapse loop counter

2018-12-20 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: lib/Driver/ToolChains/Clang.cpp:4429
   Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_cuda_blocks_per_sm_EQ);
+  Args.AddLastArg(CmdArgs, options::OPT_fopenmp_optimistic_collapse,
+  options::OPT_fno_openmp_optimistic_collapse);

fno_openmp_optimistic_collapse is not a frontend option. better to check for
```
if (Args.hasFlag(options::OPT_fopenmp_optimistic_collapse,
   options::OPT_fno_openmp_optimistic_collapse,
   /*Default=*/false))
  CmdArgs.push_back("-fopenmp-optimistic-collapse");
```
here rather than in the frontend. In the frontend, you can just check for the 
presence of the fopenmp_optimistic_collapse flag


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55928/new/

https://reviews.llvm.org/D55928



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


[PATCH] D55363: [clangd] Expose FileStatus in LSP.

2018-12-20 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55363/new/

https://reviews.llvm.org/D55363



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


[PATCH] D55932: [Sema] Simplfy static_assert diagnostic code.

2018-12-20 Thread Clement Courbet via Phabricator via cfe-commits
courbet created this revision.
courbet added reviewers: aaron.ballman, Quuxplusone.

We can now remove the specific handling of NestedNameQualifiers as
it's now handled by the type printer as of r349729.


Repository:
  rC Clang

https://reviews.llvm.org/D55932

Files:
  include/clang/AST/NestedNameSpecifier.h
  lib/AST/NestedNameSpecifier.cpp
  lib/Sema/SemaTemplate.cpp
  test/SemaCXX/static-assert.cpp

Index: test/SemaCXX/static-assert.cpp
===
--- test/SemaCXX/static-assert.cpp
+++ test/SemaCXX/static-assert.cpp
@@ -127,7 +127,7 @@
 static_assert(!(std::is_const()()), "message");
 // expected-error@-1{{static_assert failed due to requirement '!(std::is_const()())' "message"}}
 static_assert(std::is_same()), int>::value, "message");
-// expected-error@-1{{static_assert failed due to requirement 'std::is_same, int>::value' "message"}}
+// expected-error@-1{{static_assert failed due to requirement 'std::is_same, int>::value' "message"}}
 static_assert(std::is_const::value, "message");
 // expected-error@-1{{static_assert failed due to requirement 'std::is_const::value' "message"}}
 static_assert(std::is_const::value, "message");
Index: lib/Sema/SemaTemplate.cpp
===
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -3052,40 +3052,6 @@
   return Cond;
 }
 
-namespace {
-
-// A PrinterHelper that prints more helpful diagnostics for some sub-expressions
-// within failing boolean expression, such as substituting template parameters
-// for actual types.
-class FailedBooleanConditionPrinterHelper : public PrinterHelper {
-public:
-  explicit FailedBooleanConditionPrinterHelper(const PrintingPolicy &P)
-  : Policy(P) {}
-
-  bool handledStmt(Stmt *E, raw_ostream &OS) override {
-const auto *DR = dyn_cast(E);
-if (DR && DR->getQualifier()) {
-  // If this is a qualified name, expand the template arguments in nested
-  // qualifiers.
-  DR->getQualifier()->print(OS, Policy, true);
-  // Then print the decl itself.
-  const ValueDecl *VD = DR->getDecl();
-  OS << VD->getName();
-  if (const auto *IV = dyn_cast(VD)) {
-// This is a template variable, print the expanded template arguments.
-printTemplateArgumentList(OS, IV->getTemplateArgs().asArray(), Policy);
-  }
-  return true;
-}
-return false;
-  }
-
-private:
-  const PrintingPolicy Policy;
-};
-
-} // end anonymous namespace
-
 std::pair
 Sema::findFailedBooleanCondition(Expr *Cond) {
   Cond = lookThroughRangesV3Condition(PP, Cond);
@@ -3124,8 +3090,7 @@
 llvm::raw_string_ostream Out(Description);
 PrintingPolicy Policy = getPrintingPolicy();
 Policy.PrintCanonicalTypes = true;
-FailedBooleanConditionPrinterHelper Helper(Policy);
-FailedCond->printPretty(Out, &Helper, Policy, 0, "\n", nullptr);
+FailedCond->printPretty(Out, nullptr, Policy, 0, "\n", nullptr);
   }
   return { FailedCond, Description };
 }
Index: lib/AST/NestedNameSpecifier.cpp
===
--- lib/AST/NestedNameSpecifier.cpp
+++ lib/AST/NestedNameSpecifier.cpp
@@ -271,8 +271,7 @@
 
 /// Print this nested name specifier to the given output
 /// stream.
-void NestedNameSpecifier::print(raw_ostream &OS, const PrintingPolicy &Policy,
-bool ResolveTemplateArguments) const {
+void NestedNameSpecifier::print(raw_ostream &OS, const PrintingPolicy &Policy) const {
   if (getPrefix())
 getPrefix()->print(OS, Policy);
 
@@ -305,15 +304,6 @@
 LLVM_FALLTHROUGH;
 
   case TypeSpec: {
-const auto *Record =
-dyn_cast_or_null(getAsRecordDecl());
-if (ResolveTemplateArguments && Record) {
-// Print the type trait with resolved template parameters.
-Record->printName(OS);
-printTemplateArgumentList(OS, Record->getTemplateArgs().asArray(),
-  Policy);
-break;
-}
 const Type *T = getAsType();
 
 PrintingPolicy InnerPolicy(Policy);
Index: include/clang/AST/NestedNameSpecifier.h
===
--- include/clang/AST/NestedNameSpecifier.h
+++ include/clang/AST/NestedNameSpecifier.h
@@ -212,12 +212,8 @@
   /// parameter pack (for C++11 variadic templates).
   bool containsUnexpandedParameterPack() const;
 
-  /// Print this nested name specifier to the given output stream. If
-  /// `ResolveTemplateArguments` is true, we'll print actual types, e.g.
-  /// `ns::SomeTemplate` instead of
-  /// `ns::SomeTemplate`.
-  void print(raw_ostream &OS, const PrintingPolicy &Policy,
- bool ResolveTemplateArguments = false) const;
+  /// Print this nested name specifier to the given output stream.
+  void print(raw_ostream &OS, const PrintingPolicy &Policy) const;
 
   void Profile(llvm::FoldingSetNodeID &ID) const {
 ID.AddPointer(Prefix.getO

[PATCH] D55933: [Sema] Do not print default template parameters.

2018-12-20 Thread Clement Courbet via Phabricator via cfe-commits
courbet created this revision.
courbet added reviewers: aaron.ballman, Quuxplusone.

As a followup to D55270 .


Repository:
  rC Clang

https://reviews.llvm.org/D55933

Files:
  include/clang/AST/NestedNameSpecifier.h
  lib/AST/NestedNameSpecifier.cpp
  lib/AST/TypePrinter.cpp
  lib/Sema/SemaTemplate.cpp
  test/SemaCXX/static-assert-cxx17.cpp
  test/SemaCXX/static-assert.cpp

Index: test/SemaCXX/static-assert.cpp
===
--- test/SemaCXX/static-assert.cpp
+++ test/SemaCXX/static-assert.cpp
@@ -127,7 +127,7 @@
 static_assert(!(std::is_const()()), "message");
 // expected-error@-1{{static_assert failed due to requirement '!(std::is_const()())' "message"}}
 static_assert(std::is_same()), int>::value, "message");
-// expected-error@-1{{static_assert failed due to requirement 'std::is_same, int>::value' "message"}}
+// expected-error@-1{{static_assert failed due to requirement 'std::is_same, int>::value' "message"}}
 static_assert(std::is_const::value, "message");
 // expected-error@-1{{static_assert failed due to requirement 'std::is_const::value' "message"}}
 static_assert(std::is_const::value, "message");
Index: test/SemaCXX/static-assert-cxx17.cpp
===
--- test/SemaCXX/static-assert-cxx17.cpp
+++ test/SemaCXX/static-assert-cxx17.cpp
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++1z -triple=x86_64-linux-gnu
 
-template 
+template 
 struct S1 {
   static constexpr const bool value = false;
 };
@@ -14,7 +14,7 @@
   static inline constexpr bool var = global_inline_var;
 };
 
-template 
+template 
 inline constexpr bool constexpr_return_false() {
   return false;
 }
@@ -23,6 +23,8 @@
 void foo() {
   static_assert(S1::value);
   // expected-error@-1{{static_assert failed due to requirement 'S1::value'}}
+  static_assert(S1::value);
+  // expected-error@-1{{static_assert failed due to requirement 'S1::value'}}
 }
 template void foo();
 // expected-note@-1{{in instantiation of function template specialization 'foo' requested here}}
@@ -66,7 +68,7 @@
   using U = float;
 };
 
-template 
+template 
 struct X {
   int i = 0;
   int j = 0;
@@ -94,11 +96,41 @@
   static_assert(static_cast *>(nullptr));
   // expected-error@-1{{static_assert failed due to requirement 'static_cast *>(nullptr)'}}
   static_assert((const X[]){} == nullptr);
-  // expected-error@-1{{static_assert failed due to requirement '(X const[0]){} == nullptr'}}
+  // expected-error@-1{{static_assert failed due to requirement '(const X [0]){} == nullptr'}}
   static_assert(sizeof(X().X::~X())>) == 0);
   // expected-error@-1{{static_assert failed due to requirement 'sizeof(X) == 0'}}
-  static_assert(constexpr_return_false());
-  // expected-error@-1{{static_assert failed due to requirement 'constexpr_return_false()'}}
+  static_assert(constexpr_return_false());
+  // expected-error@-1{{static_assert failed due to requirement 'constexpr_return_false()'}}
 }
 template void foo6();
 // expected-note@-1{{in instantiation of function template specialization 'foo6' requested here}}
+
+template 
+void foo7() {
+  static_assert(X());
+  // expected-error@-1{{static_assert failed due to requirement 'X()'}}
+  static_assert(X{});
+  // expected-error@-1{{static_assert failed due to requirement 'X{}'}}
+  static_assert(X{1, 2});
+  // expected-error@-1{{static_assert failed due to requirement 'X{1, 2}'}}
+  static_assert(X({1, 2}));
+  // expected-error@-1{{static_assert failed due to requirement 'X({1, 2})'}}
+  static_assert(typename T::T{0});
+  // expected-error@-1{{static_assert failed due to requirement 'int{0}'}}
+  static_assert(typename T::T(0));
+  // expected-error@-1{{static_assert failed due to requirement 'int(0)'}}
+  static_assert(sizeof(X) == 0);
+  // expected-error@-1{{static_assert failed due to requirement 'sizeof(X) == 0'}}
+  static_assert((const X *)nullptr);
+  // expected-error@-1{{static_assert failed due to requirement '(const X *)nullptr'}}
+  static_assert(static_cast *>(nullptr));
+  // expected-error@-1{{static_assert failed due to requirement 'static_cast *>(nullptr)'}}
+  static_assert((const X[]){} == nullptr);
+  // expected-error@-1{{static_assert failed due to requirement '(const X [0]){} == nullptr'}}
+  static_assert(sizeof(X().X::~X()), float>) == 0);
+  // expected-error@-1{{static_assert failed due to requirement 'sizeof(X) == 0'}}
+  static_assert(constexpr_return_false());
+  // expected-error@-1{{static_assert failed due to requirement 'constexpr_return_false()'}}
+}
+template void foo7();
+// expected-note@-1{{in instantiation of function template specialization 'foo7' requested here}}
Index: lib/Sema/SemaTemplate.cpp
===
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -3052,40 +3052,6 @@
   return Cond;
 }
 
-namespace {
-
-// A PrinterHelper that prints more h

[PATCH] D55928: [OpenMP] Add flag for preventing the extension to 64 bits for the collapse loop counter

2018-12-20 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea updated this revision to Diff 179078.
gtbercea added a comment.

- Address comments.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55928/new/

https://reviews.llvm.org/D55928

Files:
  docs/OpenMPSupport.rst
  include/clang/Basic/LangOptions.def
  include/clang/Driver/Options.td
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Sema/SemaOpenMP.cpp
  test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp

Index: test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
===
--- test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
+++ test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
@@ -1,6 +1,7 @@
 // Test target codegen - host bc file has to be created first.
 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64 --check-prefix CHECK-DIV64
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -fopenmp-optimistic-collapse -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-DIV32
 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc
 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32
 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -fexceptions -fcxx-exceptions -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32
@@ -9,11 +10,12 @@
 #define HEADER
 
 // Check that the execution mode of all 5 target regions on the gpu is set to SPMD Mode.
-// CHECK-DAG: {{@__omp_offloading_.+l32}}_exec_mode = weak constant i8 0
-// CHECK-DAG: {{@__omp_offloading_.+l38}}_exec_mode = weak constant i8 0
-// CHECK-DAG: {{@__omp_offloading_.+l43}}_exec_mode = weak constant i8 0
-// CHECK-DAG: {{@__omp_offloading_.+l48}}_exec_mode = weak constant i8 0
-// CHECK-DAG: {{@__omp_offloading_.+l56}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l34}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l40}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l45}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l50}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l58}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l65}}_exec_mode = weak constant i8 0
 
 #define N 1000
 #define M 10
@@ -80,7 +82,7 @@
 // CHECK-DAG: [[KERNEL_SIZE:@.+]] = internal unnamed_addr constant i{{64|32}} 4
 // CHECK-DAG: [[KERNEL_SHARED:@.+]] = internal unnamed_addr constant i16 1
 
-// CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+}}_l32(
+// CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+}}_l34(
 // CHECK-DAG: [[THREAD_LIMIT:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.ntid.x()
 // CHECK: call void @__kmpc_spmd_kernel_init(i32 [[THREAD_LIMIT]], i16 0, i16 0)
 // CHECK: call void @__kmpc_get_team_static_memory(i8* addrspacecast (i8 addrspace(3)* getelementptr inbounds ([[MEM_TY]], [[MEM_TY]] addrspace(3)* [[SHARED_GLOBAL_RD]], i32 0, i32 0, i32 0) to i8*), i{{64|32}} 4, i16 1, i8** addrspacecast (i8* addrspace(3)* [[KERNEL_PTR]] to i8**))
@@ -214,16 +216,19 @@
 // CHECK: call void @__kmpc_spmd_kernel_deinit_v2(i16 0)
 // CHECK: ret void
 
-// CHECK: define internal void [[OUTL4]](
+// CHECK-32: define internal void [[OUTL4]](
+// CHECK-64: define internal void [[OUTL4]](
 // CHECK: call void @__kmpc_for_static_init_4({{.+}}, {{.+}}, {{.+}} 33,
 // CHECK: call void @__kmpc_for_static_fini(
 // CHECK: ret void
 
-// CHECK: define weak void @__omp_offloading_{{.*}}_l56(i[[SZ:64|32]] %{{[^,]+}}, [10 x [10 x i32]]* dereferenceable{{.*}}

[PATCH] D55928: [OpenMP] Add flag for preventing the extension to 64 bits for the collapse loop counter

2018-12-20 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

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55928/new/

https://reviews.llvm.org/D55928



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


[clang-tools-extra] r349768 - [clangd] Expose FileStatus to LSP.

2018-12-20 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Thu Dec 20 07:39:12 2018
New Revision: 349768

URL: http://llvm.org/viewvc/llvm-project?rev=349768&view=rev
Log:
[clangd] Expose FileStatus to LSP.

Summary:
Add an LSP extension "textDocument/clangd.fileStatus" to emit file-status 
information.

Reviewers: ilya-biryukov

Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, 
cfe-commits

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

Added:
clang-tools-extra/trunk/test/clangd/filestatus.test
Modified:
clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
clang-tools-extra/trunk/clangd/ClangdLSPServer.h
clang-tools-extra/trunk/clangd/Protocol.cpp
clang-tools-extra/trunk/clangd/Protocol.h
clang-tools-extra/trunk/clangd/TUScheduler.cpp
clang-tools-extra/trunk/clangd/TUScheduler.h

Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp?rev=349768&r1=349767&r2=349768&view=diff
==
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp Thu Dec 20 07:39:12 2018
@@ -294,7 +294,7 @@ void ClangdLSPServer::onInitialize(const
   SupportsCodeAction = Params.capabilities.CodeActionStructure;
   SupportsHierarchicalDocumentSymbol =
   Params.capabilities.HierarchicalDocumentSymbol;
-
+  SupportFileStatus = Params.initializationOptions.FileStatus;
   Reply(json::Object{
   {{"capabilities",
 json::Object{
@@ -802,6 +802,19 @@ void ClangdLSPServer::onDiagnosticsReady
  });
 }
 
+void ClangdLSPServer::onFileUpdated(PathRef File, const TUStatus &Status) {
+  if (!SupportFileStatus)
+return;
+  // FIXME: we don't emit "BuildingFile" and `RunningAction`, as these
+  // two statuses are running faster in practice, which leads the UI constantly
+  // changing, and doesn't provide much value. We may want to emit status at a
+  // reasonable time interval (e.g. 0.5s).
+  if (Status.Action.S == TUAction::BuildingFile ||
+  Status.Action.S == TUAction::RunningAction)
+return;
+  notify("textDocument/clangd.fileStatus", Status.render(File));
+}
+
 void ClangdLSPServer::reparseOpenedFiles() {
   for (const Path &FilePath : DraftMgr.getActiveFiles())
 Server->addDocument(FilePath, *DraftMgr.getDraft(FilePath),

Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.h?rev=349768&r1=349767&r2=349768&view=diff
==
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.h (original)
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.h Thu Dec 20 07:39:12 2018
@@ -52,6 +52,7 @@ public:
 private:
   // Implement DiagnosticsConsumer.
   void onDiagnosticsReady(PathRef File, std::vector Diagnostics) 
override;
+  void onFileUpdated(PathRef File, const TUStatus &Status) override;
 
   // LSP methods. Notifications have signature void(const Params&).
   // Calls have signature void(const Params&, Callback).
@@ -132,11 +133,12 @@ private:
   SymbolKindBitset SupportedSymbolKinds;
   /// The supported completion item kinds of the client.
   CompletionItemKindBitset SupportedCompletionItemKinds;
-  // Whether the client supports CodeAction response objects.
+  /// Whether the client supports CodeAction response objects.
   bool SupportsCodeAction = false;
   /// From capabilities of textDocument/documentSymbol.
   bool SupportsHierarchicalDocumentSymbol = false;
-
+  /// Whether the client supports showing file status.
+  bool SupportFileStatus = false;
   // Store of the current versions of the open documents.
   DraftStore DraftMgr;
 

Modified: clang-tools-extra/trunk/clangd/Protocol.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Protocol.cpp?rev=349768&r1=349767&r2=349768&view=diff
==
--- clang-tools-extra/trunk/clangd/Protocol.cpp (original)
+++ clang-tools-extra/trunk/clangd/Protocol.cpp Thu Dec 20 07:39:12 2018
@@ -716,6 +716,12 @@ json::Value toJSON(const DocumentHighlig
   };
 }
 
+llvm::json::Value toJSON(const FileStatus &FStatus) {
+  return json::Object{
+  {"uri", FStatus.uri}, {"state", FStatus.state},
+  };
+}
+
 raw_ostream &operator<<(raw_ostream &O, const DocumentHighlight &V) {
   O << V.range;
   if (V.kind == DocumentHighlightKind::Read)
@@ -752,6 +758,7 @@ bool fromJSON(const json::Value &Params,
   fromJSON(Params, Opts.ConfigSettings);
   O.map("compilationDatabasePath", Opts.compilationDatabasePath);
   O.map("fallbackFlags", Opts.fallbackFlags);
+  O.map("clangdFileStatus", Opts.FileStatus);
   return true;
 }
 

Modified: clang-tools-extra/trunk/clangd/Protocol.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Protocol.h?rev=349768

[PATCH] D55363: [clangd] Expose FileStatus in LSP.

2018-12-20 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE349768: [clangd] Expose FileStatus to LSP. (authored by 
hokein, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D55363?vs=179047&id=179080#toc

Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55363/new/

https://reviews.llvm.org/D55363

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/Protocol.cpp
  clangd/Protocol.h
  clangd/TUScheduler.cpp
  clangd/TUScheduler.h
  test/clangd/filestatus.test

Index: clangd/TUScheduler.cpp
===
--- clangd/TUScheduler.cpp
+++ clangd/TUScheduler.cpp
@@ -729,6 +729,33 @@
   return wait(Lock, RequestsCV, Timeout, [&] { return Requests.empty(); });
 }
 
+// Render a TUAction to a user-facing string representation.
+// TUAction represents clangd-internal states, we don't intend to expose them
+// to users (say C++ programmers) directly to avoid confusion, we use terms that
+// are familiar by C++ programmers.
+std::string renderTUAction(const TUAction &Action) {
+  std::string Result;
+  raw_string_ostream OS(Result);
+  switch (Action.S) {
+  case TUAction::Queued:
+OS << "file is queued";
+break;
+  case TUAction::RunningAction:
+OS << "running " << Action.Name;
+break;
+  case TUAction::BuildingPreamble:
+OS << "parsing includes";
+break;
+  case TUAction::BuildingFile:
+OS << "parsing main file";
+break;
+  case TUAction::Idle:
+OS << "idle";
+break;
+  }
+  return OS.str();
+}
+
 } // namespace
 
 unsigned getDefaultAsyncThreadsCount() {
@@ -741,6 +768,13 @@
   return HardwareConcurrency;
 }
 
+FileStatus TUStatus::render(PathRef File) const {
+  FileStatus FStatus;
+  FStatus.uri = URIForFile::canonicalize(File, /*TUPath=*/File);
+  FStatus.state = renderTUAction(Action);
+  return FStatus;
+}
+
 struct TUScheduler::FileData {
   /// Latest inputs, passed to TUScheduler::update().
   std::string Contents;
Index: clangd/TUScheduler.h
===
--- clangd/TUScheduler.h
+++ clangd/TUScheduler.h
@@ -77,6 +77,8 @@
 /// Indicates whether we reused the prebuilt AST.
 bool ReuseAST = false;
   };
+  /// Serialize this to an LSP file status item.
+  FileStatus render(PathRef File) const;
 
   TUAction Action;
   BuildDetails Details;
Index: clangd/ClangdLSPServer.h
===
--- clangd/ClangdLSPServer.h
+++ clangd/ClangdLSPServer.h
@@ -52,6 +52,7 @@
 private:
   // Implement DiagnosticsConsumer.
   void onDiagnosticsReady(PathRef File, std::vector Diagnostics) override;
+  void onFileUpdated(PathRef File, const TUStatus &Status) override;
 
   // LSP methods. Notifications have signature void(const Params&).
   // Calls have signature void(const Params&, Callback).
@@ -132,11 +133,12 @@
   SymbolKindBitset SupportedSymbolKinds;
   /// The supported completion item kinds of the client.
   CompletionItemKindBitset SupportedCompletionItemKinds;
-  // Whether the client supports CodeAction response objects.
+  /// Whether the client supports CodeAction response objects.
   bool SupportsCodeAction = false;
   /// From capabilities of textDocument/documentSymbol.
   bool SupportsHierarchicalDocumentSymbol = false;
-
+  /// Whether the client supports showing file status.
+  bool SupportFileStatus = false;
   // Store of the current versions of the open documents.
   DraftStore DraftMgr;
 
Index: clangd/Protocol.cpp
===
--- clangd/Protocol.cpp
+++ clangd/Protocol.cpp
@@ -716,6 +716,12 @@
   };
 }
 
+llvm::json::Value toJSON(const FileStatus &FStatus) {
+  return json::Object{
+  {"uri", FStatus.uri}, {"state", FStatus.state},
+  };
+}
+
 raw_ostream &operator<<(raw_ostream &O, const DocumentHighlight &V) {
   O << V.range;
   if (V.kind == DocumentHighlightKind::Read)
@@ -752,6 +758,7 @@
   fromJSON(Params, Opts.ConfigSettings);
   O.map("compilationDatabasePath", Opts.compilationDatabasePath);
   O.map("fallbackFlags", Opts.fallbackFlags);
+  O.map("clangdFileStatus", Opts.FileStatus);
   return true;
 }
 
Index: clangd/Protocol.h
===
--- clangd/Protocol.h
+++ clangd/Protocol.h
@@ -397,6 +397,9 @@
   // the compilation database doesn't describe an opened file.
   // The command used will be approximately `clang $FILE $fallbackFlags`.
   std::vector fallbackFlags;
+
+  /// Clients supports show file status for textDocument/clangd.fileStatus.
+  bool FileStatus = false;
 };
 bool fromJSON(const llvm::json::Value &, InitializationOptions &);
 
@@ -973,6 +976,18 @@
 };
 bool fromJSON(const llvm::json::Value &, ReferenceParams &);
 
+/// Clangd extension: indicates the current state of the file in clangd,
+/// sent from server via the `textDocument/clangd.fil

[PATCH] D55928: [OpenMP] Add flag for preventing the extension to 64 bits for the collapse loop counter

2018-12-20 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea added inline comments.



Comment at: docs/OpenMPSupport.rst:119
+time. To prevent this conservative choice and use at most 32 bits,
+compile your program with the `-fopenmp-max-32bit-collapse-width`.
+

kkwli0 wrote:
> ABataev wrote:
> > -fopenmp-optimistic-collapse
> How about -fopenmp-use-32bit-collapse-parameter?
Alexey suggested we have no numbers in the flag name so we tried to find 
something that avoids that. I'm happy to give it a different name than 
optimistic collapse.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55928/new/

https://reviews.llvm.org/D55928



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


[PATCH] D55374: [clangd] Show FileStatus in vscode-clangd.

2018-12-20 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 179082.
hokein added a comment.

Update the patch to reflect LSP file status latest change.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55374/new/

https://reviews.llvm.org/D55374

Files:
  clangd/clients/clangd-vscode/src/extension.ts


Index: clangd/clients/clangd-vscode/src/extension.ts
===
--- clangd/clients/clangd-vscode/src/extension.ts
+++ clangd/clients/clangd-vscode/src/extension.ts
@@ -18,6 +18,33 @@
  void, void>('textDocument/switchSourceHeader');
 }
 
+class FileStatus {
+private statuses = new Map();
+private readonly statusBarItem =
+vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 10);
+
+onFileUpdated(fileStatus: any) {
+const filePath = vscode.Uri.parse(fileStatus.uri);
+this.statuses.set(filePath.fsPath, fileStatus);
+this.updateStatus();
+}
+
+updateStatus() {
+const path = vscode.window.activeTextEditor.document.fileName;
+const status = this.statuses.get(path);
+if (!status) {
+  this.statusBarItem.hide();
+  return;
+}
+this.statusBarItem.text = `clangd: ` + status.state;
+this.statusBarItem.show();
+}
+
+dispose() {
+this.statusBarItem.dispose();
+}
+}
+
 /**
  *  this method is called when your extension is activate
  *  your extension is activated the very first time the command is executed
@@ -44,6 +71,7 @@
 synchronize: !syncFileEvents ? undefined : {
 fileEvents: vscode.workspace.createFileSystemWatcher(filePattern)
 },
+initializationOptions: { clangdFileStatus: true },
 // Resolve symlinks for all files provided by clangd.
 // This is a workaround for a bazel + clangd issue - bazel produces a 
symlink tree to build in,
 // and when navigating to the included file, clangd passes its path 
inside the symlink tree
@@ -80,4 +108,13 @@
 vscode.Uri.parse(sourceUri));
 vscode.window.showTextDocument(doc);
   }));
+const status = new FileStatus();
+context.subscriptions.push(vscode.window.onDidChangeActiveTextEditor(() => 
{
+status.updateStatus();
+}));
+clangdClient.onReady().then(() => {
+clangdClient.onNotification(
+'textDocument/clangd.fileStatus',
+(fileStatus) => { status.onFileUpdated(fileStatus); });
+})
 }


Index: clangd/clients/clangd-vscode/src/extension.ts
===
--- clangd/clients/clangd-vscode/src/extension.ts
+++ clangd/clients/clangd-vscode/src/extension.ts
@@ -18,6 +18,33 @@
  void, void>('textDocument/switchSourceHeader');
 }
 
+class FileStatus {
+private statuses = new Map();
+private readonly statusBarItem =
+vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 10);
+
+onFileUpdated(fileStatus: any) {
+const filePath = vscode.Uri.parse(fileStatus.uri);
+this.statuses.set(filePath.fsPath, fileStatus);
+this.updateStatus();
+}
+
+updateStatus() {
+const path = vscode.window.activeTextEditor.document.fileName;
+const status = this.statuses.get(path);
+if (!status) {
+  this.statusBarItem.hide();
+  return;
+}
+this.statusBarItem.text = `clangd: ` + status.state;
+this.statusBarItem.show();
+}
+
+dispose() {
+this.statusBarItem.dispose();
+}
+}
+
 /**
  *  this method is called when your extension is activate
  *  your extension is activated the very first time the command is executed
@@ -44,6 +71,7 @@
 synchronize: !syncFileEvents ? undefined : {
 fileEvents: vscode.workspace.createFileSystemWatcher(filePattern)
 },
+initializationOptions: { clangdFileStatus: true },
 // Resolve symlinks for all files provided by clangd.
 // This is a workaround for a bazel + clangd issue - bazel produces a symlink tree to build in,
 // and when navigating to the included file, clangd passes its path inside the symlink tree
@@ -80,4 +108,13 @@
 vscode.Uri.parse(sourceUri));
 vscode.window.showTextDocument(doc);
   }));
+const status = new FileStatus();
+context.subscriptions.push(vscode.window.onDidChangeActiveTextEditor(() => {
+status.updateStatus();
+}));
+clangdClient.onReady().then(() => {
+clangdClient.onNotification(
+'textDocument/clangd.fileStatus',
+(fileStatus) => { status.onFileUpdated(fileStatus); });
+})
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D55374: [clangd] Show FileStatus in vscode-clangd.

2018-12-20 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

The patch is ready for review now.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55374/new/

https://reviews.llvm.org/D55374



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


[PATCH] D55374: [clangd] Show FileStatus in vscode-clangd.

2018-12-20 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55374/new/

https://reviews.llvm.org/D55374



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


[PATCH] D55933: [Sema] Do not print default template parameters.

2018-12-20 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added inline comments.



Comment at: lib/AST/TypePrinter.cpp:173
+  // information about whether default template parameters were actually
+  // written.
+  switch (QT.getTypePtr()->getTypeClass()) {

FWIW, I don't understand this comment's terminology. "Whether default template 
parameters were actually written": should that say something like "whether a 
template parameter came from a default argument"?
And why are the `Pointer`, `VariableArray`, etc. cases here? What goes wrong if 
you remove them?



Comment at: test/SemaCXX/static-assert-cxx17.cpp:99
   static_assert((const X[]){} == nullptr);
-  // expected-error@-1{{static_assert failed due to requirement '(X 
const[0]){} == nullptr'}}
+  // expected-error@-1{{static_assert failed due to requirement '(const X 
[0]){} == nullptr'}}
   static_assert(sizeof(X().X::~X())>) 
== 0);

(1) This cosmetic change is produced by the `case IncompleteArray:` that I 
questioned above, right? I'm surprised that the pretty-printed type changes 
from "east const" to "west const." But that's fine.

(2) Sorry I didn't notice before: surely where the message currently says `[0]` 
it should say `[]` instead! That's an existing bug in the pretty-printer, going 
back super far: https://godbolt.org/z/y9KzEq  So I guess it's not your 
responsibility to fix. But I hope there's a bug open about it somewhere?



Comment at: test/SemaCXX/static-assert-cxx17.cpp:103
+  static_assert(constexpr_return_false());
+  // expected-error@-1{{static_assert failed due to requirement 
'constexpr_return_false()'}}
 }

Please keep the old test case 

static_assert(constexpr_return_false());
// expected-error@-1{{static_assert failed due to requirement 
'constexpr_return_false()'}}

and then //add// this new test case. My understanding is that the old test case 
should still pass, even after your change.



Comment at: test/SemaCXX/static-assert-cxx17.cpp:109
+template 
+void foo7() {
+  static_assert(X());

None of these new test cases actually involve the default template argument.

I'd like to see two test cases explicitly mimicking `vector`. (Warning: I 
didn't run this code!)
```
template struct A {};
template> struct V {};
template void testx() {
static_assert(std::is_same::value, "");
// expected-error@-1{{due to requirement 'std::is_same*, 
void>::value'}}
}
template testx>();
template struct PMRA {};
template using PMRV = V>;
template void test() {
static_assert(std::is_same::value, "");
// expected-error@-1{{due to requirement 'std::is_same>*, 
void>::value'}}
// expected-error@-2{{due to requirement 'std::is_same*, 
void>::value'}}
}
template testy>();
```
The `expected-error@-2` above is my fantasy world. I don't think it's possible 
to achieve in real life. :)



Comment at: test/SemaCXX/static-assert.cpp:130
 static_assert(std::is_same()), 
int>::value, "message");
-// expected-error@-1{{static_assert failed due to requirement 
'std::is_same, int>::value' "message"}}
+// expected-error@-1{{static_assert failed due to requirement 
'std::is_same, int>::value' "message"}}
 static_assert(std::is_const::value, "message");

Why did this output change?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55933/new/

https://reviews.llvm.org/D55933



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


[PATCH] D55710: add pragmas to control Software Pipelining optimisation

2018-12-20 Thread Alexey Lapshin via Phabricator via cfe-commits
alexey.lapshin marked an inline comment as done.
alexey.lapshin added inline comments.



Comment at: include/clang/Basic/AttrDocs.td:2677-2678
+`language extensions
+`_
+for further details, including limitations of the pipeline hints.
+  }];

aaron.ballman wrote:
> There is nothing in the linked documentation that describes pipeline 
> initiation intervals, so I'm still left wondering how to pick a value for the 
> attribute argument. I think the docs need a bit more detail for what that 
> value means and how it impacts the user's code.
How about this variant :

Software Pipelining optimization is a technique used to optimize loops by
utilizing instructions level parallelism. It reorders loop instructions to
overlap iterations. As the result new iteration started before previous
have finished. The Modulo Scheduling technique creates schedule for one
iteration such that when repeating at regular interval no inter-iteration
dependence violated. This constant interval(in cycles) between the start
of iterations called initiation interval. Cycles number of one iteration
of newly generated loop matches with Initiation Interval. For further
details see https://en.wikipedia.org/wiki/Software_pipelining and
"Swing Modulo Scheduling: A Lifetime-Sensitive Approach", by J. Llosa,
A. Gonzalez, E. Ayguade, and M. Valero.

``#pragma clang loop pipeline`` and `#pragma loop pipeline_initiation_interval``
could be used as hints for Software Pipelining optimization.

Using ``#pragma clang loop pipeline(disable)`` avoids software pipelining 
optimization. The disable state can only be specified:

.. code-block:: c++

  #pragma clang loop pipeline(disable)
  for (...) {
...
  }


Using ``#pragma loop pipeline_initiation_interval``
instructs the software pipeliner to check the specified initiation interval.
If schedule found the result loop iteration would have specified
cycle count:

.. code-block:: c++

 #pragma loop pipeline_initiation_interval(10)
 for (...) {
   ...
 }



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55710/new/

https://reviews.llvm.org/D55710



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


[PATCH] D55868: [Fixed Point Arithmetic] Fixed Point Addition Constant Expression Evaluation

2018-12-20 Thread Bevin Hansson via Phabricator via cfe-commits
ebevhan added inline comments.



Comment at: clang/include/clang/Basic/FixedPoint.h:98
  public:
+   APFixedPoint() = default;
APFixedPoint(const llvm::APInt &Val, const FixedPointSemantics &Sema)

rjmccall wrote:
> This should be documented to describe what it does.  Does it create a value 
> with impossible semantics?  Some reasonable default value in some reasonable 
> default semantics?
As it is, it doesn't seem to create anything useful; neither does the one for 
the `FixedPointSemantics`. It would be a zero-width, zero-scale value.



Comment at: clang/lib/AST/ExprConstant.cpp:1618
+/// Evaluate an integer or fixed point expression into an APFixedPoint.
+static bool EvaluateFixedPointOrInteger(const Expr *E, APFixedPoint &Result,
+EvalInfo &Info);

I think I would like to see both `EvaluateFixedPoint` and 
`EvaluateFixedPointOrInteger`, and use the former when you know it's supposed 
to be a fixed-point value (like in `FixedPointCast`).



Comment at: clang/lib/AST/ExprConstant.cpp:9955
+return Success(Result, E);
+  }
+  default:

rjmccall wrote:
> Do you not have a separate `CK_IntegralToFixedPoint`?  It's convenient here, 
> but still, it's curious.
> 
> You also need a `CK_FloatingToFixedPoint`, I think.  (Obviously you don't 
> need to implement that right now.)
Both of those should exist. I think that the `FixedPointCast` evaluation should 
only use `EvaluateFixedPoint`.



Comment at: clang/lib/AST/ExprConstant.cpp:9977
+APFixedPoint Result = LHSFX.add(RHSFX).convert(ResultFXSema);
+return Success(Result, E);
+  }

I understand the benefit of placing the actual operation implementation in the 
`APFixedPoint` class, but it means that any intermediate information is sort of 
lost. For example, if we want to warn the user about overflow (into the padding 
bit, or just in general) we can't, because that information was hidden.

I guess it could be done by checking if the result of the `add` is equal to the 
result of the `convert` for non-saturating `ResultFXSema`? The `APFixedPoint` 
comparison is value-based. Not sure how it would work with the padding bit in 
unsigned types, though.



Comment at: clang/lib/Basic/FixedPoint.cpp:42
 
-if (!DstSema.isSigned() && NewVal.isNegative())
+if (!DstSema.isSigned() && NewVal.isSigned() && NewVal.isNegative())
   NewVal = 0;

Maybe add a comment here to clarify what we are catching.



Comment at: clang/test/Frontend/fixed_point_add.c:5
+// Addition between different fixed point types
+short _Accum sa_const = 1.0hk + 2.0hk;  // CHECK-DAG: @sa_const  = 
{{.*}}global i16 384, align 2
+_Accum a_const = 1.0hk + 2.0k;  // CHECK-DAG: @a_const   = 
{{.*}}global i32 98304, align 4

The test doesn't have a triple so the alignment might be affected by what 
machine the test runs on.

Now that I think about it, so will the results of the calculations, and the 
emitted IR in the functions.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55868/new/

https://reviews.llvm.org/D55868



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


[PATCH] D55928: [OpenMP] Add flag for preventing the extension to 64 bits for the collapse loop counter

2018-12-20 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel added inline comments.



Comment at: docs/OpenMPSupport.rst:120
+compile your program with the `-fopenmp-optimistic-collapse`.
+
+

Can you please clarify here what happens when the loop induction variables are 
already 64 bits. If any of them are already 64 bits, then we still use 64 bits 
overall?



Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55928/new/

https://reviews.llvm.org/D55928



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


[clang-tools-extra] r349769 - [clangd] Try to workaround test failure by increasing the timeouts

2018-12-20 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Thu Dec 20 08:27:19 2018
New Revision: 349769

URL: http://llvm.org/viewvc/llvm-project?rev=349769&view=rev
Log:
[clangd] Try to workaround test failure by increasing the timeouts

Ideally we'd figure out a way to run this test without any sleeps, this
workaround is only there to avoid annoying people with test failures
around the holiday period when everyone is on vacation.

Modified:
clang-tools-extra/trunk/unittests/clangd/BackgroundIndexTests.cpp

Modified: clang-tools-extra/trunk/unittests/clangd/BackgroundIndexTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/BackgroundIndexTests.cpp?rev=349769&r1=349768&r2=349769&view=diff
==
--- clang-tools-extra/trunk/unittests/clangd/BackgroundIndexTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/BackgroundIndexTests.cpp Thu Dec 
20 08:27:19 2018
@@ -251,7 +251,7 @@ TEST_F(BackgroundIndexTest, PeriodicalIn
   OverlayCDB CDB(/*Base=*/nullptr);
   BackgroundIndex Idx(
   Context::empty(), "", FS, CDB, [&](llvm::StringRef) { return &MSS; },
-  /*BuildIndexPeriodMs=*/100);
+  /*BuildIndexPeriodMs=*/500);
 
   FS.Files[testPath("root/A.cc")] = "#include \"A.h\"";
 
@@ -263,7 +263,7 @@ TEST_F(BackgroundIndexTest, PeriodicalIn
 
   ASSERT_TRUE(Idx.blockUntilIdleForTest());
   EXPECT_THAT(runFuzzyFind(Idx, ""), ElementsAre());
-  std::this_thread::sleep_for(std::chrono::milliseconds(150));
+  std::this_thread::sleep_for(std::chrono::milliseconds(1000));
   EXPECT_THAT(runFuzzyFind(Idx, ""), ElementsAre(Named("X")));
 
   FS.Files[testPath("root/A.h")] = "class Y {};";
@@ -273,7 +273,7 @@ TEST_F(BackgroundIndexTest, PeriodicalIn
 
   ASSERT_TRUE(Idx.blockUntilIdleForTest());
   EXPECT_THAT(runFuzzyFind(Idx, ""), ElementsAre(Named("X")));
-  std::this_thread::sleep_for(std::chrono::milliseconds(150));
+  std::this_thread::sleep_for(std::chrono::milliseconds(1000));
   EXPECT_THAT(runFuzzyFind(Idx, ""), ElementsAre(Named("Y")));
 }
 


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


[PATCH] D55792: Allow direct navigation to static analysis checker documentation through SARIF exports

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

In D55792#1334886 , @Szelethus wrote:

> This is awesome. Please wait for either @NoQ or @george.karpenkov to have the 
> final say.
>
> Edit: Maybe couple days I guess. I've been digging through these files quite 
> a lot in the last 2 months, and I don't see anything wrong with this patch.


@dkrupp, @NoQ, @george.karpenkov -- any comments? I'll probably commit early 
tomorrow if there isn't further feedback (and I'm happy to deal with anything 
post-commit if it arises).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55792/new/

https://reviews.llvm.org/D55792



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


Re: r349752 - Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]

2018-12-20 Thread Joerg Sonnenberger via cfe-commits
On Thu, Dec 20, 2018 at 01:09:30PM -, Michal Gorny via cfe-commits wrote:
> Author: mgorny
> Date: Thu Dec 20 05:09:30 2018
> New Revision: 349752
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=349752&view=rev
> Log:
> Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]
> 
> Replace multiple comparisons of getOS() value with FreeBSD, NetBSD,
> OpenBSD and DragonFly with matching isOS*BSD() methods.  This should
> improve the consistency of coding style without changing the behavior.
> Direct getOS() comparisons were left whenever used in switch or switch-
> like context.

Personally, I consider this a step backwards and I hugely dislike the
pointless proliferation of isOS* methods.

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


[PATCH] D55869: Convert some ObjC retain/release msgSends to runtime calls

2018-12-20 Thread John McCall via Phabricator via cfe-commits
rjmccall added reviewers: theraven, js.
rjmccall added a comment.

Okay.  That's also presumably true for open-source runtimes that support ARC; 
tagging David Chisnall and Jonathan Schleifer to get their input.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55869/new/

https://reviews.llvm.org/D55869



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


[PATCH] D55869: Convert some ObjC retain/release msgSends to runtime calls

2018-12-20 Thread Jonathan Schleifer via Phabricator via cfe-commits
js added a comment.

Thanks for tagging me!

The ObjFW runtime itself does not contain anything about release, retain or 
autorelease - these are all part of ObjFW (as in the framework). As ObjFW also 
supports the Apple runtime, as well as mixing with Foundation code, it so far 
only provides objc_retain and objc_release when they are missing, to make ARC 
work. They just call into the corresponding methods on the object and do 
nothing else.

How will this change work from the Apple runtime? Will objc_retain/objc_release 
call the retain/release on the object if it implements its own? Should I drop 
my own retain/release implementation from my root object if I am compiling 
against the Apple runtime?

I'm mostly concerned about mixing ObjFW and Foundation code while using the 
Apple runtime here. ObjFW with the ObjFW runtime and no Foundation is easy to 
change.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55869/new/

https://reviews.llvm.org/D55869



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


[PATCH] D55869: Convert some ObjC retain/release msgSends to runtime calls

2018-12-20 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added a comment.

In D55869#1337692 , @rjmccall wrote:

> Okay.  That's also presumably true for open-source runtimes that support ARC; 
> tagging David Chisnall and Jonathan Schleifer to get their input.


`shouldUseARCFunctionsForRetainRelease()` returns `false` for the other 
runtimes.  This seems like the right thing to do until/unless they add support.

Would make sense for the driver to additionally imply 
`-fno-objc-convert-messages-to-runtime-calls` for other runtimes as a bigger 
hammer?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55869/new/

https://reviews.llvm.org/D55869



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


[PATCH] D55869: Convert some ObjC retain/release msgSends to runtime calls

2018-12-20 Thread Jonathan Schleifer via Phabricator via cfe-commits
js added a comment.

In D55869#1337707 , @dexonsmith wrote:

> In D55869#1337692 , @rjmccall wrote:
>
> > Okay.  That's also presumably true for open-source runtimes that support 
> > ARC; tagging David Chisnall and Jonathan Schleifer to get their input.
>
>
> `shouldUseARCFunctionsForRetainRelease()` returns `false` for the other 
> runtimes.  This seems like the right thing to do until/unless they add 
> support.
>
> Would make sense for the driver to additionally imply 
> `-fno-objc-convert-messages-to-runtime-calls` for other runtimes as a bigger 
> hammer?


We could make it true here (happy to implement it), but the question about how 
this works with multiple root objects with different retain/release 
implementations remains.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55869/new/

https://reviews.llvm.org/D55869



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


[PATCH] D55869: Convert some ObjC retain/release msgSends to runtime calls

2018-12-20 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added a comment.

In D55869#1337706 , @js wrote:

> The ObjFW runtime itself does not contain anything about release, retain or 
> autorelease - these are all part of ObjFW (as in the framework). As ObjFW 
> also supports the Apple runtime, as well as mixing with Foundation code, it 
> so far only provides objc_retain and objc_release when they are missing, to 
> make ARC work. They just call into the corresponding methods on the object 
> and do nothing else.
>
> How will this change work from the Apple runtime? Will 
> objc_retain/objc_release call the retain/release on the object if it 
> implements its own? Should I drop my own retain/release implementation from 
> my root object if I am compiling against the Apple runtime?


Yes, the idea is that the specialized runtime functions are fast paths for the 
common case, but they still fall back if the object has overridden them.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55869/new/

https://reviews.llvm.org/D55869



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


[PATCH] D55869: Convert some ObjC retain/release msgSends to runtime calls

2018-12-20 Thread Jonathan Schleifer via Phabricator via cfe-commits
js added a comment.

In D55869#1337711 , @dexonsmith wrote:

> In D55869#1337706 , @js wrote:
>
> > The ObjFW runtime itself does not contain anything about release, retain or 
> > autorelease - these are all part of ObjFW (as in the framework). As ObjFW 
> > also supports the Apple runtime, as well as mixing with Foundation code, it 
> > so far only provides objc_retain and objc_release when they are missing, to 
> > make ARC work. They just call into the corresponding methods on the object 
> > and do nothing else.
> >
> > How will this change work from the Apple runtime? Will 
> > objc_retain/objc_release call the retain/release on the object if it 
> > implements its own? Should I drop my own retain/release implementation from 
> > my root object if I am compiling against the Apple runtime?
>
>
> Yes, the idea is that the specialized runtime functions are fast paths for 
> the common case, but they still fall back if the object has overridden them.


I am guessing not just overridden, but also a root class providing one? IOW, 
the fast path is used when the class does not have the retain or release method 
at all? In that case, LGTM as is.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55869/new/

https://reviews.llvm.org/D55869



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


r349776 - Correct the diagnose_if attribute documentation. Fixes PR35845.

2018-12-20 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Thu Dec 20 09:28:32 2018
New Revision: 349776

URL: http://llvm.org/viewvc/llvm-project?rev=349776&view=rev
Log:
Correct the diagnose_if attribute documentation. Fixes PR35845.

Modified:
cfe/trunk/include/clang/Basic/AttrDocs.td

Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=349776&r1=349775&r2=349776&view=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Thu Dec 20 09:28:32 2018
@@ -554,9 +554,9 @@ certain user-defined criteria. For examp
 
 .. code-block:: c
 
-  void abs(int a)
+  int abs(int a)
 __attribute__((diagnose_if(a >= 0, "Redundant abs call", "warning")));
-  void must_abs(int a)
+  int must_abs(int a)
 __attribute__((diagnose_if(a >= 0, "Redundant abs call", "error")));
 
   int val = abs(1); // warning: Redundant abs call


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


[PATCH] D55869: Convert some ObjC retain/release msgSends to runtime calls

2018-12-20 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

In D55869#1337706 , @js wrote:

> Thanks for tagging me!
>
> The ObjFW runtime itself does not contain anything about release, retain or 
> autorelease - these are all part of ObjFW (as in the framework). As ObjFW 
> also supports the Apple runtime, as well as mixing with Foundation code, it 
> so far only provides objc_retain and objc_release when they are missing, to 
> make ARC work. They just call into the corresponding methods on the object 
> and do nothing else.
>
> How will this change work from the Apple runtime? Will 
> objc_retain/objc_release call the retain/release on the object if it 
> implements its own? Should I drop my own retain/release implementation from 
> my root object if I am compiling against the Apple runtime?


Nothing is fundamentally changing.  The Apple runtime has fast paths in 
`objc_retain` / `objc_release` for `NSObject`'s implementation of 
retain/release, and this patch allows us to take advantage of that in non-ARC 
files which explicitly call `-retain` and `-release`.  Of course, the runtime's 
own implementation of `objc_retain` and `objc_release` contains such calls, 
which would be miscompiled into recursive calls to `objc_retain` and 
`objc_release` without the command-line flag.

> I'm mostly concerned about mixing ObjFW and Foundation code while using the 
> Apple runtime here. ObjFW with the ObjFW runtime and no Foundation is easy to 
> change.

I assume you only define `objc_retain` and `objc_release` when compiling 
against your own runtime.  In that case, as Duncan reminded me, there's no risk 
of miscompiling as long as `shouldUseARCFunctionsForRetainRelease()` returns 
false for your runtime.  Since it sounds like your implementation doesn't try 
to avoid the message-send for common classes, there's no reason you would make 
that method return true; but if you ever want to, you'll need this compiler 
flag to avoid miscompiles.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55869/new/

https://reviews.llvm.org/D55869



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


[PATCH] D55869: Convert some ObjC retain/release msgSends to runtime calls

2018-12-20 Thread Pete Cooper via Phabricator via cfe-commits
pete added a comment.

In D55869#1337723 , @js wrote:

> In D55869#1337711 , @dexonsmith 
> wrote:
>
> > In D55869#1337706 , @js wrote:
> >
> > > The ObjFW runtime itself does not contain anything about release, retain 
> > > or autorelease - these are all part of ObjFW (as in the framework). As 
> > > ObjFW also supports the Apple runtime, as well as mixing with Foundation 
> > > code, it so far only provides objc_retain and objc_release when they are 
> > > missing, to make ARC work. They just call into the corresponding methods 
> > > on the object and do nothing else.
> > >
> > > How will this change work from the Apple runtime? Will 
> > > objc_retain/objc_release call the retain/release on the object if it 
> > > implements its own? Should I drop my own retain/release implementation 
> > > from my root object if I am compiling against the Apple runtime?
> >
> >
> > Yes, the idea is that the specialized runtime functions are fast paths for 
> > the common case, but they still fall back if the object has overridden them.
>
>
> I am guessing not just overridden, but also a root class providing one? IOW, 
> the fast path is used when the class does not have the retain or release 
> method at all? In that case, LGTM as is.


The Apple runtime is using a bit on each realized class to track the 
overriding.  The root class defaults to not having a custom RR, ie, it appears 
that its version of RR is considered equivalent to objc_retain.

Presumably that would apply to other root classes too, although i'm not 100% 
sure.  I did see some special handling of NSObject in there too so perhaps only 
its RR is equivalent to objc_retain/objc_release.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55869/new/

https://reviews.llvm.org/D55869



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


[PATCH] D55937: [X86] Auto upgrade XOP/AVX512 rotation intrinsics to generic funnel shift intrinsics (clang)

2018-12-20 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon created this revision.
RKSimon added reviewers: spatel, craig.topper.
Herald added a subscriber: llvm-commits.

This emits FSHL/FSHR generic intrinsics for the XOP VPROT and AVX512 
VPROL/VPROR rotation intrinsics.


Repository:
  rL LLVM

https://reviews.llvm.org/D55937

Files:
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/avx512f-builtins.c
  test/CodeGen/avx512vl-builtins.c
  test/CodeGen/xop-builtins.c

Index: test/CodeGen/xop-builtins.c
===
--- test/CodeGen/xop-builtins.c
+++ test/CodeGen/xop-builtins.c
@@ -194,49 +194,49 @@
 
 __m128i test_mm_rot_epi8(__m128i a, __m128i b) {
   // CHECK-LABEL: test_mm_rot_epi8
-  // CHECK: call <16 x i8> @llvm.x86.xop.vprotb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}})
+  // CHECK: call <16 x i8> @llvm.fshl.v16i8(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <16 x i8> %{{.*}})
   return _mm_rot_epi8(a, b);
 }
 
 __m128i test_mm_rot_epi16(__m128i a, __m128i b) {
   // CHECK-LABEL: test_mm_rot_epi16
-  // CHECK: call <8 x i16> @llvm.x86.xop.vprotw(<8 x i16> %{{.*}}, <8 x i16> %{{.*}})
+  // CHECK: call <8 x i16> @llvm.fshl.v8i16(<8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}})
   return _mm_rot_epi16(a, b);
 }
 
 __m128i test_mm_rot_epi32(__m128i a, __m128i b) {
   // CHECK-LABEL: test_mm_rot_epi32
-  // CHECK: call <4 x i32> @llvm.x86.xop.vprotd(<4 x i32> %{{.*}}, <4 x i32> %{{.*}})
+  // CHECK: call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}})
   return _mm_rot_epi32(a, b);
 }
 
 __m128i test_mm_rot_epi64(__m128i a, __m128i b) {
   // CHECK-LABEL: test_mm_rot_epi64
-  // CHECK: call <2 x i64> @llvm.x86.xop.vprotq(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
+  // CHECK: call <2 x i64> @llvm.fshl.v2i64(<2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}})
   return _mm_rot_epi64(a, b);
 }
 
 __m128i test_mm_roti_epi8(__m128i a) {
   // CHECK-LABEL: test_mm_roti_epi8
-  // CHECK: call <16 x i8> @llvm.x86.xop.vprotbi(<16 x i8> %{{.*}}, i8 1)
+  // CHECK: call <16 x i8> @llvm.fshl.v16i8(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <16 x i8> )
   return _mm_roti_epi8(a, 1);
 }
 
 __m128i test_mm_roti_epi16(__m128i a) {
   // CHECK-LABEL: test_mm_roti_epi16
-  // CHECK: call <8 x i16> @llvm.x86.xop.vprotwi(<8 x i16> %{{.*}}, i8 50)
+  // CHECK: call <8 x i16> @llvm.fshl.v8i16(<8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> )
   return _mm_roti_epi16(a, 50);
 }
 
 __m128i test_mm_roti_epi32(__m128i a) {
   // CHECK-LABEL: test_mm_roti_epi32
-  // CHECK: call <4 x i32> @llvm.x86.xop.vprotdi(<4 x i32> %{{.*}}, i8 -30)
+  // CHECK: call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> )
   return _mm_roti_epi32(a, -30);
 }
 
 __m128i test_mm_roti_epi64(__m128i a) {
   // CHECK-LABEL: test_mm_roti_epi64
-  // CHECK: call <2 x i64> @llvm.x86.xop.vprotqi(<2 x i64> %{{.*}}, i8 100)
+  // CHECK: call <2 x i64> @llvm.fshl.v2i64(<2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> )
   return _mm_roti_epi64(a, 100);
 }
 
Index: test/CodeGen/avx512vl-builtins.c
===
--- test/CodeGen/avx512vl-builtins.c
+++ test/CodeGen/avx512vl-builtins.c
@@ -5779,240 +5779,240 @@
 
 __m128i test_mm_rol_epi32(__m128i __A) {
   // CHECK-LABEL: @test_mm_rol_epi32
-  // CHECK: @llvm.x86.avx512.prol.d.128
+  // CHECK: @llvm.fshl.v4i32
   return _mm_rol_epi32(__A, 5); 
 }
 
 __m128i test_mm_mask_rol_epi32(__m128i __W, __mmask8 __U, __m128i __A) {
   // CHECK-LABEL: @test_mm_mask_rol_epi32
-  // CHECK: @llvm.x86.avx512.prol.d.128
+  // CHECK: @llvm.fshl.v4i32
   // CHECK: select <4 x i1> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}}
   return _mm_mask_rol_epi32(__W, __U, __A, 5); 
 }
 
 __m128i test_mm_maskz_rol_epi32(__mmask8 __U, __m128i __A) {
   // CHECK-LABEL: @test_mm_maskz_rol_epi32
-  // CHECK: @llvm.x86.avx512.prol.d.128
+  // CHECK: @llvm.fshl.v4i32
   // CHECK: select <4 x i1> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}}
   return _mm_maskz_rol_epi32(__U, __A, 5); 
 }
 
 __m256i test_mm256_rol_epi32(__m256i __A) {
   // CHECK-LABEL: @test_mm256_rol_epi32
-  // CHECK: @llvm.x86.avx512.prol.d.256
+  // CHECK: @llvm.fshl.v8i32
   return _mm256_rol_epi32(__A, 5); 
 }
 
 __m256i test_mm256_mask_rol_epi32(__m256i __W, __mmask8 __U, __m256i __A) {
   // CHECK-LABEL: @test_mm256_mask_rol_epi32
-  // CHECK: @llvm.x86.avx512.prol.d.256
+  // CHECK: @llvm.fshl.v8i32
   // CHECK: select <8 x i1> %{{.*}}, <8 x i32> %{{.*}}, <8 x i32> %{{.*}}
   return _mm256_mask_rol_epi32(__W, __U, __A, 5); 
 }
 
 __m256i test_mm256_maskz_rol_epi32(__mmask8 __U, __m256i __A) {
   // CHECK-LABEL: @test_mm256_maskz_rol_epi32
-  // CHECK: @llvm.x86.avx512.prol.d.256
+  // CHECK: @llvm.fshl.v8i32
   // CHECK: select <8 x i1> %{{.*}}, <8 x i32> %{{.*}}, <8 x i32> %{{.*}}
   return _mm256_maskz_rol_epi32(__U, __A, 5); 
 }
 
 __m128i test_mm_rol_epi64(__m128i __A) {
   // CHECK-LABEL: @test_mm_rol_epi64
-  // CHECK: @llvm.x86.avx512.prol.q.128
+  // CHECK: @ll

[PATCH] D55869: Convert some ObjC retain/release msgSends to runtime calls

2018-12-20 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

In D55869#1337733 , @pete wrote:

> In D55869#1337723 , @js wrote:
>
> > In D55869#1337711 , @dexonsmith 
> > wrote:
> >
> > > In D55869#1337706 , @js wrote:
> > >
> > > > The ObjFW runtime itself does not contain anything about release, 
> > > > retain or autorelease - these are all part of ObjFW (as in the 
> > > > framework). As ObjFW also supports the Apple runtime, as well as mixing 
> > > > with Foundation code, it so far only provides objc_retain and 
> > > > objc_release when they are missing, to make ARC work. They just call 
> > > > into the corresponding methods on the object and do nothing else.
> > > >
> > > > How will this change work from the Apple runtime? Will 
> > > > objc_retain/objc_release call the retain/release on the object if it 
> > > > implements its own? Should I drop my own retain/release implementation 
> > > > from my root object if I am compiling against the Apple runtime?
> > >
> > >
> > > Yes, the idea is that the specialized runtime functions are fast paths 
> > > for the common case, but they still fall back if the object has 
> > > overridden them.
> >
> >
> > I am guessing not just overridden, but also a root class providing one? 
> > IOW, the fast path is used when the class does not have the retain or 
> > release method at all? In that case, LGTM as is.
>
>
> The Apple runtime is using a bit on each realized class to track the 
> overriding.  The root class defaults to not having a custom RR, ie, it 
> appears that its version of RR is considered equivalent to objc_retain.
>
> Presumably that would apply to other root classes too, although i'm not 100% 
> sure.  I did see some special handling of NSObject in there too so perhaps 
> only its RR is equivalent to objc_retain/objc_release.


`objc_retain` and `objc_release` are always defined as being equivalent to 
doing a normal message send of the corresponding messages.  Apple's 
implementations detect when a class simply inherits `NSObject`'s 
implementations: if so, they just directly use the `NSObject` RR 
implementation, and if no, they do a normal message send.  That fast path is 
only triggered if the class's root class is `NSObject` and it doesn't override 
any of the RR methods.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55869/new/

https://reviews.llvm.org/D55869



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


r349782 - Use @llvm.objc.clang.arc.use intrinsic instead of clang.arc.use function.

2018-12-20 Thread Pete Cooper via cfe-commits
Author: pete
Date: Thu Dec 20 10:05:41 2018
New Revision: 349782

URL: http://llvm.org/viewvc/llvm-project?rev=349782&view=rev
Log:
Use @llvm.objc.clang.arc.use intrinsic instead of clang.arc.use function.

Calls to this function are deleted in the ARC optimizer.  However when the ARC
optimizer was updated to use intrinsics instead of functions (r349534), the 
corresponding
clang change (r349535) to use intrinsics missed this one so it wasn't being 
deleted.

Modified:
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/test/CodeGenObjC/arc-blocks.m
cfe/trunk/test/CodeGenObjC/arc-foreach.m
cfe/trunk/test/CodeGenObjC/arc-literals.m
cfe/trunk/test/CodeGenObjC/arc-ternary-op.m
cfe/trunk/test/CodeGenObjC/arc.m
cfe/trunk/test/CodeGenObjC/os_log.m
cfe/trunk/test/CodeGenObjCXX/arc.mm

Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=349782&r1=349781&r2=349782&view=diff
==
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Thu Dec 20 10:05:41 2018
@@ -1862,11 +1862,8 @@ llvm::Value *CodeGenFunction::EmitObjCEx
 /// being intrinsically used up until this point in the program.
 void CodeGenFunction::EmitARCIntrinsicUse(ArrayRef values) {
   llvm::Constant *&fn = CGM.getObjCEntrypoints().clang_arc_use;
-  if (!fn) {
-llvm::FunctionType *fnType =
-  llvm::FunctionType::get(CGM.VoidTy, None, true);
-fn = CGM.CreateRuntimeFunction(fnType, "clang.arc.use");
-  }
+  if (!fn)
+fn = CGM.getIntrinsic(llvm::Intrinsic::objc_clang_arc_use);
 
   // This isn't really a "runtime" function, but as an intrinsic it
   // doesn't really matter as long as we align things up.

Modified: cfe/trunk/test/CodeGenObjC/arc-blocks.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-blocks.m?rev=349782&r1=349781&r2=349782&view=diff
==
--- cfe/trunk/test/CodeGenObjC/arc-blocks.m (original)
+++ cfe/trunk/test/CodeGenObjC/arc-blocks.m Thu Dec 20 10:05:41 2018
@@ -96,7 +96,7 @@ void test3(void (^sink)(id*)) {
   // CHECK-NEXT: call void [[F1]](i8* [[BLOCK]], i8** [[TEMP]])
   // CHECK-NEXT: [[T0:%.*]] = load i8*, i8** [[TEMP]]
   // CHECK-NEXT: [[T1:%.*]] = call i8* @llvm.objc.retain(i8* [[T0]])
-  // CHECK-NEXT: call void (...) @clang.arc.use(i8* [[V]]) [[NUW]]
+  // CHECK-NEXT: call void (...) @llvm.objc.clang.arc.use(i8* [[V]]) [[NUW]]
   // CHECK-NEXT: [[T2:%.*]] = load i8*, i8** [[STRONG]]
   // CHECK-NEXT: store i8* [[T1]], i8** [[STRONG]]
   // CHECK-NEXT: call void @llvm.objc.release(i8* [[T2]])
@@ -303,7 +303,7 @@ void test7(void) {
 // CHECK-NEXT: bitcast [[BLOCK_T]]* [[BLOCK]] to
 // CHECK: call void @test8_helper(
 // CHECK-NEXT: [[T2:%.*]] = load [[TEST8]]*, [[TEST8]]** [[D0]]
-// CHECK-NEXT: call void (...) @clang.arc.use([[TEST8]]* [[T2]])
+// CHECK-NEXT: call void (...) @llvm.objc.clang.arc.use([[TEST8]]* [[T2]])
 // CHECK: ret void
 
   extern void test8_helper(void (^)(void));
@@ -712,7 +712,7 @@ void test19(void (^b)(void)) {
 // CHECK: [[CAPTURED:%.*]] = load i8*, i8** [[XADDR]]
 // CHECK: store i8* [[CAPTURED]], i8** [[BLOCKCAPTURED]]
 // CHECK: [[CAPTURE:%.*]] = load i8*, i8** [[CAPTUREFIELD]]
-// CHECK-NEXT: call void (...) @clang.arc.use(i8* [[CAPTURE]])
+// CHECK-NEXT: call void (...) @llvm.objc.clang.arc.use(i8* [[CAPTURE]])
 // CHECK-NEXT: [[X:%.*]] = load i8*, i8** [[XADDR]]
 // CHECK-NEXT: call void @llvm.objc.release(i8* [[X]])
 // CHECK-NEXT: ret void

Modified: cfe/trunk/test/CodeGenObjC/arc-foreach.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-foreach.m?rev=349782&r1=349781&r2=349782&view=diff
==
--- cfe/trunk/test/CodeGenObjC/arc-foreach.m (original)
+++ cfe/trunk/test/CodeGenObjC/arc-foreach.m Thu Dec 20 10:05:41 2018
@@ -73,11 +73,11 @@ void test0(NSArray *array) {
 // CHECK-LP64-NEXT: [[BLOCK1:%.*]] = bitcast [[BLOCK_T]]* [[BLOCK]]
 // CHECK-LP64-NEXT: call void @use_block(void ()* [[BLOCK1]])
 // CHECK-LP64-NEXT: call void @llvm.objc.storeStrong(i8** [[D0]], i8* null)
-// CHECK-LP64-NOT:  call void (...) @clang.arc.use(i8* [[CAPTURE]])
+// CHECK-LP64-NOT:  call void (...) @llvm.objc.clang.arc.use(i8* [[CAPTURE]])
 
 // CHECK-LP64-OPT: [[D0:%.*]] = getelementptr inbounds [[BLOCK_T]], 
[[BLOCK_T]]* [[BLOCK]], i64 0, i32 5
 // CHECK-LP64-OPT: [[CAPTURE:%.*]] = load i8*, i8** [[D0]]
-// CHECK-LP64-OPT: call void (...) @clang.arc.use(i8* [[CAPTURE]])
+// CHECK-LP64-OPT: call void (...) @llvm.objc.clang.arc.use(i8* [[CAPTURE]])
 
 // CHECK-LP64:  [[T0:%.*]] = load i8*, i8** @OBJC_SELECTOR_REFERENCES_
 // CHECK-LP64-NEXT: [[T1:%.*]] = bitcast [[ARRAY_T]]* [[SAVED_ARRAY]] to i8*
@@ -220,14 +220,14 @@ NSArray *array4;
 
 // CHECK-LP64: [[T5:%.*]] = bitcast [[TY]]** [[T0]] to i8**
 // CHECK

[PATCH] D55937: [X86] Auto upgrade XOP/AVX512 rotation intrinsics to generic funnel shift intrinsics (clang)

2018-12-20 Thread Craig Topper via Phabricator via cfe-commits
craig.topper accepted this revision.
craig.topper added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55937/new/

https://reviews.llvm.org/D55937



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


[PATCH] D55792: Allow direct navigation to static analysis checker documentation through SARIF exports

2018-12-20 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.

Looks great, no objections on my end!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55792/new/

https://reviews.llvm.org/D55792



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


r349796 - [X86] Auto upgrade XOP/AVX512 rotation intrinsics to generic funnel shift intrinsics (clang)

2018-12-20 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Thu Dec 20 11:01:13 2018
New Revision: 349796

URL: http://llvm.org/viewvc/llvm-project?rev=349796&view=rev
Log:
[X86] Auto upgrade XOP/AVX512 rotation intrinsics to generic funnel shift 
intrinsics (clang)

This emits FSHL/FSHR generic intrinsics for the XOP VPROT and AVX512 
VPROL/VPROR rotation intrinsics.

LLVM counterpart: https://reviews.llvm.org/D55938

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

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/avx512f-builtins.c
cfe/trunk/test/CodeGen/avx512vl-builtins.c
cfe/trunk/test/CodeGen/xop-builtins.c

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=349796&r1=349795&r2=349796&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Dec 20 11:01:13 2018
@@ -9168,6 +9168,24 @@ static Value *EmitX86MaskLogic(CodeGenFu
Ops[0]->getType());
 }
 
+static Value *EmitX86FunnelShift(CodeGenFunction &CGF, Value *Op0, Value *Op1,
+ Value *Amt, bool IsRight) {
+  llvm::Type *Ty = Op0->getType();
+
+  // Amount may be scalar immediate, in which case create a splat vector.
+  // Funnel shifts amounts are treated as modulo and types are all power-of-2 
so
+  // we only care about the lowest log2 bits anyway.
+  if (Amt->getType() != Ty) {
+unsigned NumElts = Ty->getVectorNumElements();
+Amt = CGF.Builder.CreateIntCast(Amt, Ty->getScalarType(), false);
+Amt = CGF.Builder.CreateVectorSplat(NumElts, Amt);
+  }
+
+  unsigned IID = IsRight ? Intrinsic::fshr : Intrinsic::fshl;
+  Value *F = CGF.CGM.getIntrinsic(IID, Ty);
+  return CGF.Builder.CreateCall(F, {Op0, Op1, Amt});
+}
+
 static Value *EmitX86Select(CodeGenFunction &CGF,
 Value *Mask, Value *Op0, Value *Op1) {
 
@@ -10575,7 +10593,41 @@ Value *CodeGenFunction::EmitX86BuiltinEx
 SI->setAlignment(1);
 return SI;
   }
-
+  // Rotate is a special case of funnel shift - 1st 2 args are the same.
+  case X86::BI__builtin_ia32_vprotb:
+  case X86::BI__builtin_ia32_vprotw:
+  case X86::BI__builtin_ia32_vprotd:
+  case X86::BI__builtin_ia32_vprotq:
+  case X86::BI__builtin_ia32_vprotbi:
+  case X86::BI__builtin_ia32_vprotwi:
+  case X86::BI__builtin_ia32_vprotdi:
+  case X86::BI__builtin_ia32_vprotqi:
+  case X86::BI__builtin_ia32_prold128:
+  case X86::BI__builtin_ia32_prold256:
+  case X86::BI__builtin_ia32_prold512:
+  case X86::BI__builtin_ia32_prolq128:
+  case X86::BI__builtin_ia32_prolq256:
+  case X86::BI__builtin_ia32_prolq512:
+  case X86::BI__builtin_ia32_prolvd128:
+  case X86::BI__builtin_ia32_prolvd256:
+  case X86::BI__builtin_ia32_prolvd512:
+  case X86::BI__builtin_ia32_prolvq128:
+  case X86::BI__builtin_ia32_prolvq256:
+  case X86::BI__builtin_ia32_prolvq512:
+return EmitX86FunnelShift(*this, Ops[0], Ops[0], Ops[1], false);
+  case X86::BI__builtin_ia32_prord128:
+  case X86::BI__builtin_ia32_prord256:
+  case X86::BI__builtin_ia32_prord512:
+  case X86::BI__builtin_ia32_prorq128:
+  case X86::BI__builtin_ia32_prorq256:
+  case X86::BI__builtin_ia32_prorq512:
+  case X86::BI__builtin_ia32_prorvd128:
+  case X86::BI__builtin_ia32_prorvd256:
+  case X86::BI__builtin_ia32_prorvd512:
+  case X86::BI__builtin_ia32_prorvq128:
+  case X86::BI__builtin_ia32_prorvq256:
+  case X86::BI__builtin_ia32_prorvq512:
+return EmitX86FunnelShift(*this, Ops[0], Ops[0], Ops[1], true);
   case X86::BI__builtin_ia32_selectb_128:
   case X86::BI__builtin_ia32_selectb_256:
   case X86::BI__builtin_ia32_selectb_512:

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=349796&r1=349795&r2=349796&view=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Thu Dec 20 11:01:13 2018
@@ -4036,120 +4036,120 @@ __m512i test_mm512_maskz_cvtepu16_epi64(
 
 __m512i test_mm512_rol_epi32(__m512i __A) {
   // CHECK-LABEL: @test_mm512_rol_epi32
-  // CHECK: @llvm.x86.avx512.prol.d.512
+  // CHECK: @llvm.fshl.v16i32
   return _mm512_rol_epi32(__A, 5); 
 }
 
 __m512i test_mm512_mask_rol_epi32(__m512i __W, __mmask16 __U, __m512i __A) {
   // CHECK-LABEL: @test_mm512_mask_rol_epi32
-  // CHECK: @llvm.x86.avx512.prol.d.512
+  // CHECK: @llvm.fshl.v16i32
   // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
   return _mm512_mask_rol_epi32(__W, __U, __A, 5); 
 }
 
 __m512i test_mm512_maskz_rol_epi32(__mmask16 __U, __m512i __A) {
   // CHECK-LABEL: @test_mm512_maskz_rol_epi32
-  // CHECK: @llvm.x86.avx512.prol.d.512
+  // CHECK: @llvm.fshl.v16i32
   // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
   re

[PATCH] D55937: [X86] Auto upgrade XOP/AVX512 rotation intrinsics to generic funnel shift intrinsics (clang)

2018-12-20 Thread Simon Pilgrim via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC349796: [X86] Auto upgrade XOP/AVX512 rotation intrinsics to 
generic funnel shift… (authored by RKSimon, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D55937?vs=179089&id=179105#toc

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55937/new/

https://reviews.llvm.org/D55937

Files:
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/avx512f-builtins.c
  test/CodeGen/avx512vl-builtins.c
  test/CodeGen/xop-builtins.c

Index: test/CodeGen/avx512f-builtins.c
===
--- test/CodeGen/avx512f-builtins.c
+++ test/CodeGen/avx512f-builtins.c
@@ -4036,120 +4036,120 @@
 
 __m512i test_mm512_rol_epi32(__m512i __A) {
   // CHECK-LABEL: @test_mm512_rol_epi32
-  // CHECK: @llvm.x86.avx512.prol.d.512
+  // CHECK: @llvm.fshl.v16i32
   return _mm512_rol_epi32(__A, 5); 
 }
 
 __m512i test_mm512_mask_rol_epi32(__m512i __W, __mmask16 __U, __m512i __A) {
   // CHECK-LABEL: @test_mm512_mask_rol_epi32
-  // CHECK: @llvm.x86.avx512.prol.d.512
+  // CHECK: @llvm.fshl.v16i32
   // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
   return _mm512_mask_rol_epi32(__W, __U, __A, 5); 
 }
 
 __m512i test_mm512_maskz_rol_epi32(__mmask16 __U, __m512i __A) {
   // CHECK-LABEL: @test_mm512_maskz_rol_epi32
-  // CHECK: @llvm.x86.avx512.prol.d.512
+  // CHECK: @llvm.fshl.v16i32
   // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
   return _mm512_maskz_rol_epi32(__U, __A, 5); 
 }
 
 __m512i test_mm512_rol_epi64(__m512i __A) {
   // CHECK-LABEL: @test_mm512_rol_epi64
-  // CHECK: @llvm.x86.avx512.prol.q.512
+  // CHECK: @llvm.fshl.v8i64
   return _mm512_rol_epi64(__A, 5); 
 }
 
 __m512i test_mm512_mask_rol_epi64(__m512i __W, __mmask8 __U, __m512i __A) {
   // CHECK-LABEL: @test_mm512_mask_rol_epi64
-  // CHECK: @llvm.x86.avx512.prol.q.512
+  // CHECK: @llvm.fshl.v8i64
   // CHECK: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
   return _mm512_mask_rol_epi64(__W, __U, __A, 5); 
 }
 
 __m512i test_mm512_maskz_rol_epi64(__mmask8 __U, __m512i __A) {
   // CHECK-LABEL: @test_mm512_maskz_rol_epi64
-  // CHECK: @llvm.x86.avx512.prol.q.512
+  // CHECK: @llvm.fshl.v8i64
   // CHECK: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
   return _mm512_maskz_rol_epi64(__U, __A, 5); 
 }
 
 __m512i test_mm512_rolv_epi32(__m512i __A, __m512i __B) {
   // CHECK-LABEL: @test_mm512_rolv_epi32
-  // CHECK: @llvm.x86.avx512.prolv.d.512
+  // CHECK: @llvm.fshl.v16i32
   return _mm512_rolv_epi32(__A, __B); 
 }
 
 __m512i test_mm512_mask_rolv_epi32(__m512i __W, __mmask16 __U, __m512i __A, __m512i __B) {
   // CHECK-LABEL: @test_mm512_mask_rolv_epi32
-  // CHECK: @llvm.x86.avx512.prolv.d.512
+  // CHECK: @llvm.fshl.v16i32
   // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
   return _mm512_mask_rolv_epi32(__W, __U, __A, __B); 
 }
 
 __m512i test_mm512_maskz_rolv_epi32(__mmask16 __U, __m512i __A, __m512i __B) {
   // CHECK-LABEL: @test_mm512_maskz_rolv_epi32
-  // CHECK: @llvm.x86.avx512.prolv.d.512
+  // CHECK: @llvm.fshl.v16i32
   // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
   return _mm512_maskz_rolv_epi32(__U, __A, __B); 
 }
 
 __m512i test_mm512_rolv_epi64(__m512i __A, __m512i __B) {
   // CHECK-LABEL: @test_mm512_rolv_epi64
-  // CHECK: @llvm.x86.avx512.prolv.q.512
+  // CHECK: @llvm.fshl.v8i64
   return _mm512_rolv_epi64(__A, __B); 
 }
 
 __m512i test_mm512_mask_rolv_epi64(__m512i __W, __mmask8 __U, __m512i __A, __m512i __B) {
   // CHECK-LABEL: @test_mm512_mask_rolv_epi64
-  // CHECK: @llvm.x86.avx512.prolv.q.512
+  // CHECK: @llvm.fshl.v8i64
   // CHECK: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
   return _mm512_mask_rolv_epi64(__W, __U, __A, __B); 
 }
 
 __m512i test_mm512_maskz_rolv_epi64(__mmask8 __U, __m512i __A, __m512i __B) {
   // CHECK-LABEL: @test_mm512_maskz_rolv_epi64
-  // CHECK: @llvm.x86.avx512.prolv.q.512
+  // CHECK: @llvm.fshl.v8i64
   // CHECK: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
   return _mm512_maskz_rolv_epi64(__U, __A, __B); 
 }
 
 __m512i test_mm512_ror_epi32(__m512i __A) {
   // CHECK-LABEL: @test_mm512_ror_epi32
-  // CHECK: @llvm.x86.avx512.pror.d.512
+  // CHECK: @llvm.fshr.v16i32
   return _mm512_ror_epi32(__A, 5); 
 }
 
 __m512i test_mm512_mask_ror_epi32(__m512i __W, __mmask16 __U, __m512i __A) {
   // CHECK-LABEL: @test_mm512_mask_ror_epi32
-  // CHECK: @llvm.x86.avx512.pror.d.512
+  // CHECK: @llvm.fshr.v16i32
   // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}}
   return _mm512_mask_ror_epi32(__W, __U, __A, 5); 
 }
 
 __m512i test_mm512_maskz_ror_epi32(__mmask16 __U, __m512i __A) {
   // CHECK-LABEL: @test_mm512_maskz_ror_epi32
-  // CHECK: @llvm.x86.avx512.pror.d.512
+  // CHECK: @llvm.fshr.v16i32
   // CHECK: select <16 x i1> %{{.*}},

[PATCH] D55792: Allow direct navigation to static analysis checker documentation through SARIF exports

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

This is amazing, huge thanks for doing this!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55792/new/

https://reviews.llvm.org/D55792



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


[PATCH] D55862: [Sema] Don't try to account for the size of an incomplete type in CheckArrayAccess

2018-12-20 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55862/new/

https://reviews.llvm.org/D55862



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


r349798 - Revert "[analyzer] pr38668: Do not attempt to cast loaded values..."

2018-12-20 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Thu Dec 20 11:36:06 2018
New Revision: 349798

URL: http://llvm.org/viewvc/llvm-project?rev=349798&view=rev
Log:
Revert "[analyzer] pr38668: Do not attempt to cast loaded values..."

This reverts commit r349701.

The patch was incorrect. The whole point of CastRetrievedVal()
is to handle the case in which the type from which the cast is made
(i.e., the "type" of value `V`) has nothing to do with the type of
the region it was loaded from (i.e., `R->getValueType()`).

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

rdar://problem/45062567

Modified:
cfe/trunk/lib/StaticAnalyzer/Core/Store.cpp
cfe/trunk/test/Analysis/casts.c
cfe/trunk/test/Analysis/pointer-to-member.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/Store.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/Store.cpp?rev=349798&r1=349797&r2=349798&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/Store.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/Store.cpp Thu Dec 20 11:36:06 2018
@@ -394,28 +394,14 @@ SVal StoreManager::attemptDownCast(SVal
   return UnknownVal();
 }
 
-static bool isScalarEnoughToAttemptACast(QualType T) {
-  return T->isIntegralOrEnumerationType() || T->isAnyPointerType() ||
- T->isReferenceType();
-}
-
 /// CastRetrievedVal - Used by subclasses of StoreManager to implement
 ///  implicit casts that arise from loads from regions that are reinterpreted
 ///  as another region.
 SVal StoreManager::CastRetrievedVal(SVal V, const TypedValueRegion *R,
-QualType CastTy) {
-  if (CastTy.isNull() || V.isUnknownOrUndef())
+QualType castTy) {
+  if (castTy.isNull() || V.isUnknownOrUndef())
 return V;
 
-  QualType OrigTy = R->getValueType();
-
-  if (!isScalarEnoughToAttemptACast(OrigTy) ||
-  !isScalarEnoughToAttemptACast(CastTy)) {
-if (OrigTy.getUnqualifiedType() == CastTy.getUnqualifiedType())
-  return V;
-return UnknownVal();
-  }
-
   // When retrieving symbolic pointer and expecting a non-void pointer,
   // wrap them into element regions of the expected type if necessary.
   // SValBuilder::dispatchCast() doesn't do that, but it is necessary to
@@ -424,13 +410,13 @@ SVal StoreManager::CastRetrievedVal(SVal
   // We might need to do that for non-void pointers as well.
   // FIXME: We really need a single good function to perform casts for us
   // correctly every time we need it.
-  if (CastTy->isPointerType() && !CastTy->isVoidPointerType())
+  if (castTy->isPointerType() && !castTy->isVoidPointerType())
 if (const auto *SR = dyn_cast_or_null(V.getAsRegion()))
   if (SR->getSymbol()->getType().getCanonicalType() !=
-  CastTy.getCanonicalType())
-return loc::MemRegionVal(castRegion(SR, CastTy));
+  castTy.getCanonicalType())
+return loc::MemRegionVal(castRegion(SR, castTy));
 
-  return svalBuilder.dispatchCast(V, CastTy);
+  return svalBuilder.dispatchCast(V, castTy);
 }
 
 SVal StoreManager::getLValueFieldOrIvar(const Decl *D, SVal Base) {

Modified: cfe/trunk/test/Analysis/casts.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/casts.c?rev=349798&r1=349797&r2=349798&view=diff
==
--- cfe/trunk/test/Analysis/casts.c (original)
+++ cfe/trunk/test/Analysis/casts.c Thu Dec 20 11:36:06 2018
@@ -213,14 +213,3 @@ void no_crash_on_symsym_cast_to_long() {
 }
 
 #endif
-
-char no_crash_SymbolCast_of_float_type_aux(int *p) {
-  *p += 1;
-  return *p;
-}
-
-void no_crash_SymbolCast_of_float_type() {
-  extern float x;
-  char (*f)() = no_crash_SymbolCast_of_float_type_aux;
-  f(&x);
-}

Modified: cfe/trunk/test/Analysis/pointer-to-member.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/pointer-to-member.cpp?rev=349798&r1=349797&r2=349798&view=diff
==
--- cfe/trunk/test/Analysis/pointer-to-member.cpp (original)
+++ cfe/trunk/test/Analysis/pointer-to-member.cpp Thu Dec 20 11:36:06 2018
@@ -253,10 +253,11 @@ void test() {
   clang_analyzer_eval(&A::y); // expected-warning{{TRUE}}
   clang_analyzer_eval(&A::z); // expected-warning{{TRUE}}
 
+  // FIXME: These should be true.
   int A::*l = &A::x, A::*m = &A::y, A::*n = &A::z;
-  clang_analyzer_eval(l); // expected-warning{{TRUE}}
-  clang_analyzer_eval(m); // expected-warning{{TRUE}}
-  clang_analyzer_eval(n); // expected-warning{{TRUE}}
+  clang_analyzer_eval(l); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(m); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(n); // expected-warning{{UNKNOWN}}
 
   // FIXME: These should be true as well.
   A a;


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

[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-20 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ reopened this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Revert!




Comment at: lib/StaticAnalyzer/Core/Store.cpp:410
 
+  QualType OrigTy = R->getValueType();
+

This is entirely incorrect. The whole point of this function is to handle the 
case when `R->getValueType()` has nothing to do with the original type of `V`.

Unfortunately, "type of an `SVal`" is not a thing, so it's going to be a bit 
more verbose.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55875/new/

https://reviews.llvm.org/D55875



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


[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-20 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ marked an inline comment as done.
NoQ added inline comments.



Comment at: lib/StaticAnalyzer/Core/Store.cpp:410
 
+  QualType OrigTy = R->getValueType();
+

NoQ wrote:
> This is entirely incorrect. The whole point of this function is to handle the 
> case when `R->getValueType()` has nothing to do with the original type of `V`.
> 
> Unfortunately, "type of an `SVal`" is not a thing, so it's going to be a bit 
> more verbose.
Relevant test case:
```
double no_crash_reinterpret_double_as_int(double a) {
  *(int *)&a = 1;
  return a * a;
}
```


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55875/new/

https://reviews.llvm.org/D55875



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


[PATCH] D55875: [analyzer] pr38668: RegionStore: Do not attempt to cast loaded values of non-scalar types.

2018-12-20 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ marked an inline comment as done.
NoQ added inline comments.



Comment at: lib/StaticAnalyzer/Core/Store.cpp:410
 
+  QualType OrigTy = R->getValueType();
+

NoQ wrote:
> NoQ wrote:
> > This is entirely incorrect. The whole point of this function is to handle 
> > the case when `R->getValueType()` has nothing to do with the original type 
> > of `V`.
> > 
> > Unfortunately, "type of an `SVal`" is not a thing, so it's going to be a 
> > bit more verbose.
> Relevant test case:
> ```
> double no_crash_reinterpret_double_as_int(double a) {
>   *(int *)&a = 1;
>   return a * a;
> }
> ```
...which crashes after this patch while trying to multiply 1 by 1 and return 
result as double.

(sry for the noise)


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55875/new/

https://reviews.llvm.org/D55875



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


r349811 - [Sema] Don't try to account for the size of an incomplete type in CheckArrayAccess

2018-12-20 Thread Bruno Ricci via cfe-commits
Author: brunoricci
Date: Thu Dec 20 12:05:11 2018
New Revision: 349811

URL: http://llvm.org/viewvc/llvm-project?rev=349811&view=rev
Log:
[Sema] Don't try to account for the size of an incomplete type in 
CheckArrayAccess

When checking that the array access is not out-of-bounds in CheckArrayAccess
it is possible that the type of the base expression after IgnoreParenCasts is
incomplete, even though the type of the base expression before IgnoreParenCasts
is complete. In this case we have no information about whether the array access
is out-of-bounds and we should just bail-out instead. This fixes PR39746 which
was caused by trying to obtain the size of an incomplete type.

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

Reviewed By: efriedma


Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/SemaCXX/array-bounds.cpp

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=349811&r1=349810&r2=349811&view=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Dec 20 12:05:11 2018
@@ -12379,10 +12379,19 @@ void Sema::CheckArrayAccess(const Expr *
   BaseExpr->getType()->getPointeeOrArrayElementType();
   BaseExpr = BaseExpr->IgnoreParenCasts();
   const ConstantArrayType *ArrayTy =
-Context.getAsConstantArrayType(BaseExpr->getType());
+  Context.getAsConstantArrayType(BaseExpr->getType());
+
   if (!ArrayTy)
 return;
 
+  const Type *BaseType = ArrayTy->getElementType().getTypePtr();
+  // It is possible that the type of the base expression after IgnoreParenCasts
+  // is incomplete, even though the type of the base expression before
+  // IgnoreParenCasts is complete (see PR39746 for an example). In this case we
+  // have no information about whether the array access is out-of-bounds.
+  if (BaseType->isIncompleteType())
+return;
+
   Expr::EvalResult Result;
   if (!IndexExpr->EvaluateAsInt(Result, Context, Expr::SE_AllowSideEffects))
 return;
@@ -12402,7 +12411,6 @@ void Sema::CheckArrayAccess(const Expr *
 if (!size.isStrictlyPositive())
   return;
 
-const Type *BaseType = BaseExpr->getType()->getPointeeOrArrayElementType();
 if (BaseType != EffectiveType) {
   // Make sure we're comparing apples to apples when comparing index to 
size
   uint64_t ptrarith_typesize = Context.getTypeSize(EffectiveType);

Modified: cfe/trunk/test/SemaCXX/array-bounds.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/array-bounds.cpp?rev=349811&r1=349810&r2=349811&view=diff
==
--- cfe/trunk/test/SemaCXX/array-bounds.cpp (original)
+++ cfe/trunk/test/SemaCXX/array-bounds.cpp Thu Dec 20 12:05:11 2018
@@ -284,3 +284,12 @@ struct multi_s multi2[4]; // expected-no
 int test_struct_multiarray() {
   return multi2[4].arr[0]; // expected-warning {{array index 4 is past the end 
of the array (which contains 4 elements)}}
 }
+
+namespace PR39746 {
+  struct S;
+  extern S xxx[2];
+  class C {};
+
+  C &f() { return reinterpret_cast(xxx)[1]; } // no-warning
+  C &g() { return reinterpret_cast(xxx)[2]; } // no-warning
+}


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


[PATCH] D55862: [Sema] Don't try to account for the size of an incomplete type in CheckArrayAccess

2018-12-20 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL349811: [Sema] Don't try to account for the size of an 
incomplete type in… (authored by brunoricci, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D55862?vs=179035&id=179117#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55862/new/

https://reviews.llvm.org/D55862

Files:
  cfe/trunk/lib/Sema/SemaChecking.cpp
  cfe/trunk/test/SemaCXX/array-bounds.cpp


Index: cfe/trunk/test/SemaCXX/array-bounds.cpp
===
--- cfe/trunk/test/SemaCXX/array-bounds.cpp
+++ cfe/trunk/test/SemaCXX/array-bounds.cpp
@@ -284,3 +284,12 @@
 int test_struct_multiarray() {
   return multi2[4].arr[0]; // expected-warning {{array index 4 is past the end 
of the array (which contains 4 elements)}}
 }
+
+namespace PR39746 {
+  struct S;
+  extern S xxx[2];
+  class C {};
+
+  C &f() { return reinterpret_cast(xxx)[1]; } // no-warning
+  C &g() { return reinterpret_cast(xxx)[2]; } // no-warning
+}
Index: cfe/trunk/lib/Sema/SemaChecking.cpp
===
--- cfe/trunk/lib/Sema/SemaChecking.cpp
+++ cfe/trunk/lib/Sema/SemaChecking.cpp
@@ -12379,10 +12379,19 @@
   BaseExpr->getType()->getPointeeOrArrayElementType();
   BaseExpr = BaseExpr->IgnoreParenCasts();
   const ConstantArrayType *ArrayTy =
-Context.getAsConstantArrayType(BaseExpr->getType());
+  Context.getAsConstantArrayType(BaseExpr->getType());
+
   if (!ArrayTy)
 return;
 
+  const Type *BaseType = ArrayTy->getElementType().getTypePtr();
+  // It is possible that the type of the base expression after IgnoreParenCasts
+  // is incomplete, even though the type of the base expression before
+  // IgnoreParenCasts is complete (see PR39746 for an example). In this case we
+  // have no information about whether the array access is out-of-bounds.
+  if (BaseType->isIncompleteType())
+return;
+
   Expr::EvalResult Result;
   if (!IndexExpr->EvaluateAsInt(Result, Context, Expr::SE_AllowSideEffects))
 return;
@@ -12402,7 +12411,6 @@
 if (!size.isStrictlyPositive())
   return;
 
-const Type *BaseType = BaseExpr->getType()->getPointeeOrArrayElementType();
 if (BaseType != EffectiveType) {
   // Make sure we're comparing apples to apples when comparing index to 
size
   uint64_t ptrarith_typesize = Context.getTypeSize(EffectiveType);


Index: cfe/trunk/test/SemaCXX/array-bounds.cpp
===
--- cfe/trunk/test/SemaCXX/array-bounds.cpp
+++ cfe/trunk/test/SemaCXX/array-bounds.cpp
@@ -284,3 +284,12 @@
 int test_struct_multiarray() {
   return multi2[4].arr[0]; // expected-warning {{array index 4 is past the end of the array (which contains 4 elements)}}
 }
+
+namespace PR39746 {
+  struct S;
+  extern S xxx[2];
+  class C {};
+
+  C &f() { return reinterpret_cast(xxx)[1]; } // no-warning
+  C &g() { return reinterpret_cast(xxx)[2]; } // no-warning
+}
Index: cfe/trunk/lib/Sema/SemaChecking.cpp
===
--- cfe/trunk/lib/Sema/SemaChecking.cpp
+++ cfe/trunk/lib/Sema/SemaChecking.cpp
@@ -12379,10 +12379,19 @@
   BaseExpr->getType()->getPointeeOrArrayElementType();
   BaseExpr = BaseExpr->IgnoreParenCasts();
   const ConstantArrayType *ArrayTy =
-Context.getAsConstantArrayType(BaseExpr->getType());
+  Context.getAsConstantArrayType(BaseExpr->getType());
+
   if (!ArrayTy)
 return;
 
+  const Type *BaseType = ArrayTy->getElementType().getTypePtr();
+  // It is possible that the type of the base expression after IgnoreParenCasts
+  // is incomplete, even though the type of the base expression before
+  // IgnoreParenCasts is complete (see PR39746 for an example). In this case we
+  // have no information about whether the array access is out-of-bounds.
+  if (BaseType->isIncompleteType())
+return;
+
   Expr::EvalResult Result;
   if (!IndexExpr->EvaluateAsInt(Result, Context, Expr::SE_AllowSideEffects))
 return;
@@ -12402,7 +12411,6 @@
 if (!size.isStrictlyPositive())
   return;
 
-const Type *BaseType = BaseExpr->getType()->getPointeeOrArrayElementType();
 if (BaseType != EffectiveType) {
   // Make sure we're comparing apples to apples when comparing index to size
   uint64_t ptrarith_typesize = Context.getTypeSize(EffectiveType);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D55924: [gn build] Add build files for clang-format and lib/{Format,Rewrite,Tooling/Core,Tooling/Inclusions}

2018-12-20 Thread Petr Hosek via Phabricator via cfe-commits
phosek accepted this revision.
phosek added a comment.
This revision is now accepted and ready to land.

LGTM


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55924/new/

https://reviews.llvm.org/D55924



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


[PATCH] D55925: [gn build] Add build file for clang/lib/Parse

2018-12-20 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

LGTM


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55925/new/

https://reviews.llvm.org/D55925



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


[PATCH] D55792: Allow direct navigation to static analysis checker documentation through SARIF exports

2018-12-20 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

Thanks for the reviews! I've commit in r349812.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55792/new/

https://reviews.llvm.org/D55792



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


[PATCH] D55927: [gn build] Add build file for clang/lib/Driver

2018-12-20 Thread Petr Hosek via Phabricator via cfe-commits
phosek accepted this revision.
phosek added a comment.
This revision is now accepted and ready to land.

LGTM


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55927/new/

https://reviews.llvm.org/D55927



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


[PATCH] D55948: Modify DeclaratorChuck::getFunction to use DeclSpec for qualifiers

2018-12-20 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia created this revision.
Anastasia added a reviewer: rjmccall.
Herald added a subscriber: jfb.

Rather than duplicating data fields, use DeclSpec directly to store qualifiers 
for the functions/methods.

This change is discussed in the following comment:
https://reviews.llvm.org/D55850#inline-495037


https://reviews.llvm.org/D55948

Files:
  include/clang/Sema/DeclSpec.h
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseDeclCXX.cpp
  lib/Parse/ParseExpr.cpp
  lib/Parse/ParseExprCXX.cpp
  lib/Sema/DeclSpec.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaLambda.cpp
  lib/Sema/SemaType.cpp

Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -724,12 +724,8 @@
   /*NumArgs=*/0,
   /*EllipsisLoc=*/NoLoc,
   /*RParenLoc=*/NoLoc,
-  /*TypeQuals=*/0,
   /*RefQualifierIsLvalueRef=*/true,
   /*RefQualifierLoc=*/NoLoc,
-  /*ConstQualifierLoc=*/NoLoc,
-  /*VolatileQualifierLoc=*/NoLoc,
-  /*RestrictQualifierLoc=*/NoLoc,
   /*MutableLoc=*/NoLoc, EST_None,
   /*ESpecRange=*/SourceRange(),
   /*Exceptions=*/nullptr,
@@ -4460,7 +4456,7 @@
   // does not have a K&R-style identifier list), then the arguments are part
   // of the type, otherwise the argument list is ().
   const DeclaratorChunk::FunctionTypeInfo &FTI = DeclType.Fun;
-  IsQualifiedFunction = FTI.TypeQuals || FTI.hasRefQualifier();
+  IsQualifiedFunction = (FTI.TypeDeclSpec && FTI.TypeDeclSpec->getTypeQualifiers()) || FTI.hasRefQualifier();
 
   // Check for auto functions and trailing return type and adjust the
   // return type accordingly.
@@ -4698,7 +4694,7 @@
 EPI.ExtInfo = EI;
 EPI.Variadic = FTI.isVariadic;
 EPI.HasTrailingReturn = FTI.hasTrailingReturnType();
-EPI.TypeQuals.addCVRUQualifiers(FTI.TypeQuals);
+EPI.TypeQuals.addCVRUQualifiers(FTI.TypeDeclSpec ? FTI.TypeDeclSpec->getTypeQualifiers() : 0);
 EPI.RefQualifier = !FTI.hasRefQualifier()? RQ_None
 : FTI.RefQualifierIsLValueRef? RQ_LValue
 : RQ_RValue;
@@ -5026,11 +5022,11 @@
 assert(Chunk.Kind == DeclaratorChunk::Function);
 if (Chunk.Fun.hasRefQualifier())
   RemovalLocs.push_back(Chunk.Fun.getRefQualifierLoc());
-if (Chunk.Fun.TypeQuals & Qualifiers::Const)
+if (Chunk.Fun.TypeDeclSpec->getTypeQualifiers() & Qualifiers::Const)
   RemovalLocs.push_back(Chunk.Fun.getConstQualifierLoc());
-if (Chunk.Fun.TypeQuals & Qualifiers::Volatile)
+if (Chunk.Fun.TypeDeclSpec->getTypeQualifiers() & Qualifiers::Volatile)
   RemovalLocs.push_back(Chunk.Fun.getVolatileQualifierLoc());
-if (Chunk.Fun.TypeQuals & Qualifiers::Restrict)
+if (Chunk.Fun.TypeDeclSpec->getTypeQualifiers() & Qualifiers::Restrict)
   RemovalLocs.push_back(Chunk.Fun.getRestrictQualifierLoc());
 if (!RemovalLocs.empty()) {
   llvm::sort(RemovalLocs,
Index: lib/Sema/SemaLambda.cpp
===
--- lib/Sema/SemaLambda.cpp
+++ lib/Sema/SemaLambda.cpp
@@ -884,8 +884,9 @@
 //   This function call operator is declared const (9.3.1) if and only if
 //   the lambda-expression's parameter-declaration-clause is not followed
 //   by mutable. It is neither virtual nor declared volatile. [...]
-if (!FTI.hasMutableQualifier())
-  FTI.TypeQuals |= DeclSpec::TQ_const;
+if (!FTI.hasMutableQualifier()) {
+  FTI.TypeDeclSpec->SetTypeQual(DeclSpec::TQ_const, SourceLocation());
+}
 
 MethodTyInfo = GetTypeForDeclarator(ParamInfo, CurScope);
 assert(MethodTyInfo && "no type from lambda-declarator");
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -8172,16 +8172,16 @@
   }
 
   DeclaratorChunk::FunctionTypeInfo &FTI = D.getFunctionTypeInfo();
-  if (FTI.TypeQuals != 0) {
-if (FTI.TypeQuals & Qualifiers::Const)
+  if (FTI.TypeDeclSpec->getTypeQualifiers() != 0) {
+if (FTI.TypeDeclSpec->getTypeQualifiers() & Qualifiers::Const)
   Diag(D.getIdentifierLoc(), diag::err_invalid_qualified_constructor)
-<< "const" << SourceRange(D.getIdentifierLoc());
-if (FTI.TypeQuals & Qualifiers::Volatile)
+  << "const" << SourceRange(D.getIdentifierLoc());
+if (FTI.TypeDeclSpec->getTypeQualifiers() & Qualifiers::Volatile)
   Diag(D.getIdentifierLoc(), diag::err_invalid_qualified_constructor)
-<< "volatile" << SourceRange(D.getIdentifierLoc());
-if (FTI.TypeQuals & Qualifiers::Restrict)
+  << "volatile" << SourceRange(D.getIdentifierLoc());
+if (FTI.TypeDeclSpec->getTypeQualifiers() & Qualifiers::Restrict)
   Diag(D.getIdentifierLoc(), diag::err_invalid_qualified_constructor)
-<< "restrict" << SourceRange(D.getI

[PATCH] D55869: Convert some ObjC retain/release msgSends to runtime calls

2018-12-20 Thread David Chisnall via Phabricator via cfe-commits
theraven added a comment.

This should be fine for the GNUstep runtime (the GCC runtime doesn't support 
ARC at all).  My main concern is that it will break already-released versions 
of the runtime built with a newer version of clang.  I can easily enable a new 
flag in the next release, but doing so for older ones is more problematic.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55869/new/

https://reviews.llvm.org/D55869



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


[PATCH] D51641: [VFS] Cache the current working directory for the real FS.

2018-12-20 Thread Pavel Labath via Phabricator via cfe-commits
labath added subscribers: JDevlieghere, labath.
labath added a comment.

Might I ask what was the motivation for this change? Performance optimalization?

I am asking this because this makes the RealFileSystem return bogus values for 
the CWD if it changes through means other than the 
VFS::setCurrentWorkingDirectory (which is something that, as a library, we can 
never rule out). We ran into problems with this in lldb where our tests use 
lldb as a library, and they are driven by a python scripts (which does some CWD 
changing as a part of test discovery).

If I understand the long scary comment in the `setCurrentWorkingDirectory` 
function correctly, the RealFileSystem wants to be independent of the OS notion 
of CWD. However, right now it's not doing either job very well (sharing the CWD 
with the OS nor being independent of it), because all other RFS functions will 
use the real OS CWD (as it is at the moment of the call), only 
`getCurrentWorkingDirectory` will return whatever was the last CWD set through 
the appropriate setter.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D51641/new/

https://reviews.llvm.org/D51641



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


r349815 - Fix build failures from r349812 due to a missing argument.

2018-12-20 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Thu Dec 20 12:32:59 2018
New Revision: 349815

URL: http://llvm.org/viewvc/llvm-project?rev=349815&view=rev
Log:
Fix build failures from r349812 due to a missing argument.

Modified:
cfe/trunk/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp

Modified: cfe/trunk/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp?rev=349815&r1=349814&r2=349815&view=diff
==
--- cfe/trunk/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp (original)
+++ cfe/trunk/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp Thu Dec 
20 12:32:59 2018
@@ -59,7 +59,8 @@ public:
 Compiler.getAnalyzerOpts()->CheckersControlList = {
 {"custom.CustomChecker", true}};
 AnalysisConsumer->AddCheckerRegistrationFn([](CheckerRegistry &Registry) {
-  Registry.addChecker("custom.CustomChecker", 
"Description");
+  Registry.addChecker("custom.CustomChecker", "Description",
+ "");
 });
 return std::move(AnalysisConsumer);
   }


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


  1   2   >