[PATCH] D63932: [GlobalDCE] Dead Virtual Function Elimination

2019-10-15 Thread Sylvestre Ledru via Phabricator via cfe-commits
sylvestre.ledru added a comment.

@ostannard  Maybe you could add that to the release notes? Thanks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63932



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


r374864 - [Format] Add machine-readable SPDX license ID to clang-format.el

2019-10-15 Thread Sam McCall via cfe-commits
Author: sammccall
Date: Tue Oct 15 00:25:18 2019
New Revision: 374864

URL: http://llvm.org/viewvc/llvm-project?rev=374864&view=rev
Log:
[Format] Add machine-readable SPDX license ID to clang-format.el

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

Modified: cfe/trunk/tools/clang-format/clang-format.el
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/clang-format.el?rev=374864&r1=374863&r2=374864&view=diff
==
--- cfe/trunk/tools/clang-format/clang-format.el (original)
+++ cfe/trunk/tools/clang-format/clang-format.el Tue Oct 15 00:25:18 2019
@@ -2,6 +2,7 @@
 
 ;; Keywords: tools, c
 ;; Package-Requires: ((cl-lib "0.3"))
+;; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
 ;;; Commentary:
 


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


[PATCH] D68914: [clang-format] Remove duplciate code from Invalid BOM detection

2019-10-15 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments.



Comment at: clang/include/clang/Basic/SourceManager.h:232
+// nullptr
+static const char *getInvalidBOM(StringRef BufStr);
   };

klimek wrote:
> owenpan wrote:
> > Can you make the parameter `const`?
> StringRef is inherently const though, right? I think the added const is 
> confusing.
Oops! I meant `const StringRef &`:

```
static const char *getInvalidBOM(const StringRef &BufStr);
```


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

https://reviews.llvm.org/D68914



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


[PATCH] D68914: [clang-format] Remove duplciate code from Invalid BOM detection

2019-10-15 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment.

Here are some `const StringRef &` examples 
.


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

https://reviews.llvm.org/D68914



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


[PATCH] D59516: [analyzer] Add custom filter functions for GenericTaintChecker

2019-10-15 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment.

I think this patch is ok.

Although there are remarks:

- I think the current implementation of the taint filtering functions does not 
follow the expected semantics. Now the modelling would remove taint before 
calling the function (//pre statement//). One might expect that the modelling 
would remove taint only on function return (//post statement//). This way we 
would not catch this:

  int myFilter(int* p) { // this function is stated as a filter function in the 
config file
int lookupTable[32] = {};
int value = lookupTable[*p]; // using a tainted value for indexing
escape(p);
return value;
  }

- I agree with @NoQ about the `testConfigurationFilter`, which now does not 
test the implementation but the behavior of the static analyzer if it 
conservatively invalidates in case of an unknown function call.
- I also think that we should have testcases for testing the filtering 
functionality of the config file. Eg. using the `myFilter1` could do the job 
here in the tests.

All in all, I still say that it seems to be a good patch.




Comment at: clang/test/Analysis/taint-generic.c:59
 
+#define bool int
+

Have you considered using `_Bool` instead?


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

https://reviews.llvm.org/D59516



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


[PATCH] D68914: [clang-format] Remove duplciate code from Invalid BOM detection

2019-10-15 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added a comment.

In D68914#1709002 , @owenpan wrote:

> Here are some `const StringRef &` examples 
> .


StringRef already is a const pointer type, so the idiomatic way is to pass it 
by value.


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

https://reviews.llvm.org/D68914



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


[PATCH] D68694: [clang-tidy] hicpp-signed-bitwise: Do not show "use of a signed integer operand with a binary bitwise operator" for positive integer operands

2019-10-15 Thread Vladimir Plyashkun via Phabricator via cfe-commits
vladimir.plyashkun updated this revision to Diff 224976.

Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D68694

Files:
  clang-tools-extra/clang-tidy/hicpp/SignedBitwiseCheck.cpp
  clang-tools-extra/clang-tidy/hicpp/SignedBitwiseCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/hicpp-signed-bitwise.rst
  clang-tools-extra/test/clang-tidy/hicpp-signed-bitwise-integer-literals.cpp

Index: clang-tools-extra/test/clang-tidy/hicpp-signed-bitwise-integer-literals.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/hicpp-signed-bitwise-integer-literals.cpp
@@ -0,0 +1,33 @@
+// RUN: %check_clang_tidy %s hicpp-signed-bitwise %t -- \
+// RUN:   -config="{CheckOptions: [{key: hicpp-signed-bitwise.IgnorePositiveIntegerLiterals, value: 1 }]}" \
+// RUN: -- -std=c++11
+
+void examples() {
+  unsigned UValue = 40u;
+  unsigned URes;
+  
+  URes = UValue & 1u; //Ok
+  URes = UValue & -1;
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: use of a signed integer operand with a binary bitwise operator
+  
+  unsigned URes2 = URes << 1; //Ok
+  
+  int IResult;
+  IResult = 10 & 2; //Ok
+  IResult = 3 << -1;
+  // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: use of a signed integer operand with a binary bitwise operator
+  
+  int Int = 30;
+  IResult = Int << 1;
+  // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: use of a signed integer operand with a binary bitwise operator
+  IResult = ~0; //Ok
+}
+
+enum EnumConstruction {
+  one = 1,
+  two = 2,
+  test1 = 1 << 12, //Ok
+  test2 = one << two,
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: use of a signed integer operand with a binary bitwise operator
+  test3 = 1u << 12, //Ok
+};
Index: clang-tools-extra/docs/clang-tidy/checks/hicpp-signed-bitwise.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/hicpp-signed-bitwise.rst
+++ clang-tools-extra/docs/clang-tidy/checks/hicpp-signed-bitwise.rst
@@ -7,3 +7,11 @@
 undefined or implementation defined behaviour.
 
 The according rule is defined in the `High Integrity C++ Standard, Section 5.6.1 `_.
+
+Options
+---
+
+.. option:: IgnorePositiveIntegerLiterals
+
+   If this option is set to `true`, the check will not warn on bitwise operations with positive integer literals, e.g. `~0`, `2 << 1`, etc. 
+   Default value is `false`.
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -169,6 +169,10 @@
   ` check.
 
   Rewrites function signatures to use a trailing return type.
+  
+- The :doc:`hicpp-signed-bitwise
+  ` now supports `IgnorePositiveIntegerLiterals`
+  option.
 
 Improvements to include-fixer
 -
Index: clang-tools-extra/clang-tidy/hicpp/SignedBitwiseCheck.h
===
--- clang-tools-extra/clang-tidy/hicpp/SignedBitwiseCheck.h
+++ clang-tools-extra/clang-tidy/hicpp/SignedBitwiseCheck.h
@@ -22,10 +22,13 @@
 /// http://clang.llvm.org/extra/clang-tidy/checks/hicpp-signed-bitwise.html
 class SignedBitwiseCheck : public ClangTidyCheck {
 public:
-  SignedBitwiseCheck(StringRef Name, ClangTidyContext *Context)
-  : ClangTidyCheck(Name, Context) {}
+  SignedBitwiseCheck(StringRef Name, ClangTidyContext *Context);
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+  void storeOptions(ClangTidyOptions::OptionMap &Options) override;
+
+private:
+  bool IgnorePositiveIntegerLiterals;
 };
 
 } // namespace hicpp
Index: clang-tools-extra/clang-tidy/hicpp/SignedBitwiseCheck.cpp
===
--- clang-tools-extra/clang-tidy/hicpp/SignedBitwiseCheck.cpp
+++ clang-tools-extra/clang-tidy/hicpp/SignedBitwiseCheck.cpp
@@ -17,9 +17,24 @@
 namespace tidy {
 namespace hicpp {
 
+SignedBitwiseCheck::SignedBitwiseCheck(StringRef Name,
+   ClangTidyContext *Context)
+: ClangTidyCheck(Name, Context),
+  IgnorePositiveIntegerLiterals(
+  Options.get("IgnorePositiveIntegerLiterals", false)) {}
+
+void SignedBitwiseCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
+  Options.store(Opts, "IgnorePositiveIntegerLiterals",
+IgnorePositiveIntegerLiterals);
+}
+
 void SignedBitwiseCheck::registerMatchers(MatchFinder *Finder) {
   const auto SignedIntegerOperand =
-  expr(ignoringImpCasts(hasType(isSignedInteger(.bind("signed-operand");
+  (IgnorePositiveIntegerLiterals
+   ? expr(ignoringImpCasts(hasType(isSignedInteger())),
+  unless(integerL

[PATCH] D68694: [clang-tidy] hicpp-signed-bitwise: Do not show "use of a signed integer operand with a binary bitwise operator" for positive integer operands

2019-10-15 Thread Vladimir Plyashkun via Phabricator via cfe-commits
vladimir.plyashkun added a comment.

In D68694#1706204 , @JonasToth wrote:

> > Do you know who is responsible for it? Because i haven't worked with 
> > documentation before and don't know what i need to do to update it.
>
> The files reside in `clang-tools-extra/docs/ReleaseNotes.rst` and 
> `clang-tools-extra/docs/clang-tidy/checks/hicpp-signed-bitwise.rst`.
>
> You can check other files for reference, e.g. `readability-magic-numbers.rst`.
>  In the Release Notes you can add one entry at the end of the clang-tidy 
> section.


Thanks! I've fixed documentation.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D68694



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


[PATCH] D68977: [clangd] Report declaration references in findExplicitReferences.

2019-10-15 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision.
hokein added a reviewer: ilya-biryukov.
Herald added subscribers: usaxena95, kadircet, arphaman, jkorous, MaskRay.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68977

Files:
  clang-tools-extra/clangd/FindTarget.cpp
  clang-tools-extra/clangd/FindTarget.h
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/unittests/FindTargetTests.cpp
  clang-tools-extra/clangd/unittests/XRefsTests.cpp

Index: clang-tools-extra/clangd/unittests/XRefsTests.cpp
===
--- clang-tools-extra/clangd/unittests/XRefsTests.cpp
+++ clang-tools-extra/clangd/unittests/XRefsTests.cpp
@@ -2277,7 +2277,8 @@
   if (const auto *ND = llvm::dyn_cast(D))
 Names.push_back(ND->getQualifiedNameAsString());
 }
-EXPECT_THAT(Names, UnorderedElementsAreArray(C.ExpectedDecls));
+EXPECT_THAT(Names, UnorderedElementsAreArray(C.ExpectedDecls))
+<< File.code();
   }
 }
 
Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -520,8 +520,28 @@
 findExplicitReferences(Func.getBody(), [&Refs](ReferenceLoc R) {
   Refs.push_back(std::move(R));
 });
+return dumpReferences(std::move(Refs), Code, AST.getSourceManager());
+  }
+
+  /// Similar to annotateReferencesInFoo, but finds all references in the main
+  /// AST.
+  AllRefs annotateReferencesInMainAST(llvm::StringRef Code) {
+TestTU TU;
+TU.Code = Code;
 
-auto &SM = AST.getSourceManager();
+auto AST = TU.build();
+std::vector Refs;
+for (const auto *ToplLevelDecl : AST.getLocalTopLevelDecls()) {
+  findExplicitReferences(ToplLevelDecl, [&Refs](ReferenceLoc R) {
+Refs.push_back(std::move(R));
+  });
+}
+return dumpReferences(std::move(Refs), Code, AST.getSourceManager());
+  }
+
+private:
+  AllRefs dumpReferences(std::vector Refs, llvm::StringRef Code,
+ const SourceManager &SM) {
 llvm::sort(Refs, [&](const ReferenceLoc &L, const ReferenceLoc &R) {
   return SM.isBeforeInTranslationUnit(L.NameLoc, R.NameLoc);
 });
@@ -590,8 +610,8 @@
 using namespace $1^alias;
   }
 )cpp",
-   "0: targets = {ns}\n"
-   "1: targets = {alias}\n"},
+   "0: targets = {ns}, decl ref\n"
+   "1: targets = {alias}, decl ref\n"},
   // Using declarations.
   {R"cpp(
   namespace ns { int global; }
@@ -600,59 +620,67 @@
   }
 )cpp",
"0: targets = {ns}\n"
-   "1: targets = {ns::global}, qualifier = 'ns::'\n"},
+   "1: targets = {ns::global}, qualifier = 'ns::', decl ref\n"},
   // Simple types.
   {R"cpp(
  struct Struct { int a; };
  using Typedef = int;
  void foo() {
-   $0^Struct x;
-   $1^Typedef y;
-   static_cast<$2^Struct*>(0);
+   $0^Struct $1^x;
+   $2^Typedef $3^y;
+   static_cast<$4^Struct*>(0);
  }
)cpp",
"0: targets = {Struct}\n"
-   "1: targets = {Typedef}\n"
-   "2: targets = {Struct}\n"},
+   "1: targets = {x}, decl ref\n"
+   "2: targets = {Typedef}\n"
+   "3: targets = {y}, decl ref\n"
+   "4: targets = {Struct}\n"},
   // Name qualifiers.
   {R"cpp(
  namespace a { namespace b { struct S { typedef int type; }; } }
  void foo() {
-   $0^a::$1^b::$2^S x;
-   using namespace $3^a::$4^b;
-   $5^S::$6^type y;
+   $0^a::$1^b::$2^S $3^x;
+   using namespace $4^a::$5^b;
+   $6^S::$7^type $8^y;
  }
 )cpp",
"0: targets = {a}\n"
"1: targets = {a::b}, qualifier = 'a::'\n"
"2: targets = {a::b::S}, qualifier = 'a::b::'\n"
-   "3: targets = {a}\n"
-   "4: targets = {a::b}, qualifier = 'a::'\n"
-   "5: targets = {a::b::S}\n"
-   "6: targets = {a::b::S::type}, qualifier = 'struct S::'\n"},
+   "3: targets = {x}, decl ref\n"
+   "4: targets = {a}\n"
+   "5: targets = {a::b}, qualifier = 'a::', decl ref\n"
+   "6: targets = {a::b::S}\n"
+   "7: targets = {a::b::S::type}, qualifier = 'struct S::'\n"
+   "8: targets = {y}, decl ref\n"},
   // Simple templates.
   {R"cpp(
   template  struct vector { using value_type = T; };
   template <> struct vector { using value_type = bool; };
   void foo() {
-$0^vector vi;
-$1^vector vb;
+$0^vector $1^vi;
+$2^vector $3^vb;
   }
 )cpp",
"0: targets = {vector}\n"
-   "1: targets = {vector}\n"},
+

[PATCH] D68720: Support -fstack-clash-protection for x86

2019-10-15 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

Some benchmarks, running the python performance suite from recompiled cpython 
build, one built with `-O2` (baseline) and one built with `-O2 
-fstack-clash-protection` (protection). Surprisingly enough, the stack 
protection makes the code faster in various scenario, but none of these changes 
present significant regression, according to me.

  baseline.json
  =
  
  Performance version: 0.9.1
  Report on Linux-3.10.0-891.el7.x86_64-x86_64-with-redhat-7.5-Maipo
  Number of logical CPUs: 8
  Start date: 2019-10-15 11:16:28.425344
  End date: 2019-10-15 11:37:55.064599
  
  protection.json
  ===
  
  Performance version: 0.9.1
  Report on Linux-3.10.0-891.el7.x86_64-x86_64-with-redhat-7.5-Maipo
  Number of logical CPUs: 8
  Start date: 2019-10-15 10:55:24.270166
  End date: 2019-10-15 11:16:27.195366
  
  
+-+---+-+--+---+
  | Benchmark   | baseline.json | protection.json | Change   | 
Significance  |
  
+=+===+=+==+===+
  | 2to3| 435 ms| 448 ms  | 1.03x slower | 
Significant (t=-4.26) |
  
+-+---+-+--+---+
  | chameleon   | 15.0 ms   | 14.7 ms | 1.02x faster | 
Significant (t=4.76)  |
  
+-+---+-+--+---+
  | chaos   | 176 ms| 174 ms  | 1.02x faster | 
Not significant   |
  
+-+---+-+--+---+
  | crypto_pyaes| 153 ms| 150 ms  | 1.02x faster | 
Not significant   |
  
+-+---+-+--+---+
  | deltablue   | 11.9 ms   | 11.9 ms | 1.00x slower | 
Not significant   |
  
+-+---+-+--+---+
  | django_template | 210 ms| 223 ms  | 1.06x slower | 
Significant (t=-3.84) |
  
+-+---+-+--+---+
  | dulwich_log | 96.1 ms   | 102 ms  | 1.06x slower | 
Significant (t=-8.42) |
  
+-+---+-+--+---+
  | fannkuch| 703 ms| 698 ms  | 1.01x faster | 
Not significant   |
  
+-+---+-+--+---+
  | float   | 161 ms| 160 ms  | 1.01x faster | 
Not significant   |
  
+-+---+-+--+---+
  | genshi_text | 45.5 ms   | 45.5 ms | 1.00x faster | 
Not significant   |
  
+-+---+-+--+---+
  | genshi_xml  | 95.3 ms   | 95.2 ms | 1.00x faster | 
Not significant   |
  
+-+---+-+--+---+
  | go  | 392 ms| 382 ms  | 1.03x faster | 
Significant (t=5.95)  |
  
+-+---+-+--+---+
  | hexiom  | 16.0 ms   | 15.9 ms | 1.01x faster | 
Not significant   |
  
+-+---+-+--+---+
  | html5lib| 137 ms| 135 ms  | 1.01x faster | 
Not significant   |
  
+-+---+-+--+---+
  | json_dumps  | 18.8 ms   | 17.9 ms | 1.05x faster | 
Significant (t=4.81)  |
  
+-+---+-+--+---+
  | json_loads  | 41.3 us   | 40.2 us | 1.03x faster | 
Significant (t=2.53)  |
  
+-+---+-+--+---+
  | logging_format  | 17.4 us   | 17.5 us | 1.00x slower | 
Not significant   |
  
+-+---+-+--+---+
  | logging_silent  | 509 ns| 500 ns  | 1.02x faster | 
Not significant   |
  
+-+---+-+--+---+
  | logging_simple  | 14.3 us   | 14.8 us | 1.04x

[PATCH] D68978: [clangd] Propagate main context into ClangdServer

2019-10-15 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet created this revision.
kadircet added a reviewer: sammccall.
Herald added subscribers: cfe-commits, usaxena95, arphaman, jkorous, MaskRay, 
ilya-biryukov.
Herald added a project: clang.

Currently clangd initializes the ClangdServer lazily during
onInitialize request, and it results in propagation of caller's context rather
than the main context created ClangdLSPServer.

This patch changes the logic to store main context that created ClangdLSPServer
and pass it onto to ClangdServer and other objects like CDBs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68978

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/ClangdLSPServer.h


Index: clang-tools-extra/clangd/ClangdLSPServer.h
===
--- clang-tools-extra/clangd/ClangdLSPServer.h
+++ clang-tools-extra/clangd/ClangdLSPServer.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDLSPSERVER_H
 
 #include "ClangdServer.h"
+#include "Context.h"
 #include "DraftStore.h"
 #include "Features.inc"
 #include "FindSymbols.h"
@@ -131,6 +132,11 @@
   void publishDiagnostics(const URIForFile &File,
   std::vector Diagnostics);
 
+  // Since initialization of CDBs and ClangdServer is done lazily, the 
following
+  // context captures the one used while creating ClangdLSPServer and passes it
+  // to above mentioned object instances to make sure they share the same 
state.
+  Context BackgroundContext;
+
   /// Used to indicate that the 'shutdown' request was received from the
   /// Language Server client.
   bool ShutdownRequestReceived = false;
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "ClangdLSPServer.h"
+#include "Context.h"
 #include "Diagnostics.h"
 #include "DraftStore.h"
 #include "FormattedString.h"
@@ -456,6 +457,11 @@
 
 void ClangdLSPServer::onInitialize(const InitializeParams &Params,
Callback Reply) {
+  // Switch caller's context with LSPServer's background context. Since we
+  // rather want to propagate information from LSPServer's context into the
+  // Server, CDB, etc.
+  llvm::Optional MainContext;
+  MainContext.emplace(BackgroundContext.clone());
   // Determine character encoding first as it affects constructed ClangdServer.
   if (Params.capabilities.offsetEncoding && !NegotiatedOffsetEncoding) {
 NegotiatedOffsetEncoding = OffsetEncoding::UTF16; // fallback
@@ -577,6 +583,8 @@
 ->insert(
 {"semanticHighlighting",
  llvm::json::Object{{"scopes", 
buildHighlightScopeLookupTable()}}});
+  // Restore caller's context.
+  MainContext.reset();
   Reply(std::move(Result));
 }
 
@@ -1184,9 +1192,9 @@
 llvm::Optional CompileCommandsDir, bool UseDirBasedCDB,
 llvm::Optional ForcedOffsetEncoding,
 const ClangdServer::Options &Opts)
-: Transp(Transp), MsgHandler(new MessageHandler(*this)),
-  FSProvider(FSProvider), CCOpts(CCOpts),
-  SupportedSymbolKinds(defaultSymbolKinds()),
+: BackgroundContext(Context::current().clone()), Transp(Transp),
+  MsgHandler(new MessageHandler(*this)), FSProvider(FSProvider),
+  CCOpts(CCOpts), SupportedSymbolKinds(defaultSymbolKinds()),
   SupportedCompletionItemKinds(defaultCompletionItemKinds()),
   UseDirBasedCDB(UseDirBasedCDB),
   CompileCommandsDir(std::move(CompileCommandsDir)), 
ClangdServerOpts(Opts),


Index: clang-tools-extra/clangd/ClangdLSPServer.h
===
--- clang-tools-extra/clangd/ClangdLSPServer.h
+++ clang-tools-extra/clangd/ClangdLSPServer.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDLSPSERVER_H
 
 #include "ClangdServer.h"
+#include "Context.h"
 #include "DraftStore.h"
 #include "Features.inc"
 #include "FindSymbols.h"
@@ -131,6 +132,11 @@
   void publishDiagnostics(const URIForFile &File,
   std::vector Diagnostics);
 
+  // Since initialization of CDBs and ClangdServer is done lazily, the following
+  // context captures the one used while creating ClangdLSPServer and passes it
+  // to above mentioned object instances to make sure they share the same state.
+  Context BackgroundContext;
+
   /// Used to indicate that the 'shutdown' request was received from the
   /// Language Server client.
   bool ShutdownRequestReceived = false;
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -7,6 +7,7 @@
 //===--===//
 

r374876 - Fix uninitialized variable warnings. NFCI.

2019-10-15 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Tue Oct 15 03:23:05 2019
New Revision: 374876

URL: http://llvm.org/viewvc/llvm-project?rev=374876&view=rev
Log:
Fix uninitialized variable warnings. NFCI.

Modified:
cfe/trunk/lib/AST/ASTImporter.cpp

Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=374876&r1=374875&r2=374876&view=diff
==
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Tue Oct 15 03:23:05 2019
@@ -2579,10 +2579,10 @@ ExpectedDecl ASTNodeImporter::VisitRecor
   }
 
   // Import the major distinguishing characteristics of this record.
-  DeclContext *DC, *LexicalDC;
+  DeclContext *DC = nullptr, *LexicalDC = nullptr;
   DeclarationName Name;
   SourceLocation Loc;
-  NamedDecl *ToD;
+  NamedDecl *ToD = nullptr;
   if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
 return std::move(Err);
   if (ToD)


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


[PATCH] D62686: [RISCV] Add support for save/restore of callee-saved registers via libcalls

2019-10-15 Thread Lewis Revill via Phabricator via cfe-commits
lewis-revill added a comment.

In D62686#1708792 , @apazos wrote:

> Yes Eli thanks for pointing out  there are more scenarios that can fail.
>  It looks like the best solution is to permit both flags on, but then bail 
> out from doing this transformation if there is any type of tail call already 
> in the function.
>  This way we avoid messing with reverting tail calls back to regular calls.


Is it worth trying to disallow tail call optimization completely if this flag 
is enabled? I'm not sure what GCC does exactly. but this seems to be the 
behaviour.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62686



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


[PATCH] D68978: [clangd] Propagate main context into ClangdServer

2019-10-15 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

  Bulid results are available at 
http://results.llvm-merge-guard.org/Phabricator-35

See http://jenkins.llvm-merge-guard.org/job/Phabricator/35/ for more details.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68978



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


[PATCH] D68977: [clangd] Report declaration references in findExplicitReferences.

2019-10-15 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

  Bulid results are available at 
http://results.llvm-merge-guard.org/Phabricator-36

See http://jenkins.llvm-merge-guard.org/job/Phabricator/36/ for more details.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68977



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


[PATCH] D68720: Support -fstack-clash-protection for x86

2019-10-15 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

> For maintenance reasons, I'd really prefer it if we could find a way to reuse 
> the existing code that calls an external stack probe function. What do you 
> think about taking a look at X86RetpolineThunks.cpp and doing something 
> similar to that? Basically, when the user sets -fstack-clash-protection, LLVM 
> will emit a small comdat+weak function into every object file that has the 
> same ABI as the existing stack probe mechanism. For other prior art, you can 
> also look at how __clang_call_terminate works.

@rnk I 100% understand the reasoning, and will have a look to the files you're 
pointing at. AFAIU the approach you're suggesting is incompatible with the « 
free probe » algorithm that moves instruction in between stack allocations, but 
let me confirm that first.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68720



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


[PATCH] D68407: [RISCV] Use compiler-rt if no GCC installation detected

2019-10-15 Thread Sam Elliott via Phabricator via cfe-commits
lenary requested changes to this revision.
lenary added a comment.
This revision now requires changes to proceed.

Please can you add a test for riscv32 and riscv64 without libgcc?

I also think you want to be smarter about detecting the need/request for 
libgcc. Look for `AddRunTimeLibs` in clang/lib/Driver/ToolChains/CommonArgs.cpp 
- I think that will get you quite far. I think you can override 
`getCompilerRTArgString` for your toolchain, and also 
`GetDefaultRuntimeLibType`. For the correct compiler-rt stuff, you want 
`ToolChain::getCompilerRT` I think. Using all these methods should make these 
path additions a lot more robust.


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

https://reviews.llvm.org/D68407



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


[PATCH] D63607: [clang][driver] Add basic --driver-mode=flang support for fortran

2019-10-15 Thread Peter Waller via Phabricator via cfe-commits
peterwaller-arm added a comment.

Friendly ping to everybody watching. I'd like to get this in soon if possible.

Hal - do you think this is close to being accepted? Note that I consider this 
"the beginning" rather than "the end", since there will be more functionality 
to add piecewise before this is fully functional. In the meantime, since it is 
new functionality, it should not break anything.


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

https://reviews.llvm.org/D63607



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


[PATCH] D68981: [clangd] Use our own relation kind.

2019-10-15 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision.
hokein added a reviewer: kadircet.
Herald added subscribers: usaxena95, arphaman, jkorous, MaskRay, ilya-biryukov.
Herald added a project: clang.

Move the RelationKind from Serialization.h to Relation.h. This patch doesn't
introduce any breaking changes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68981

Files:
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/index/Index.h
  clang-tools-extra/clangd/index/MemIndex.h
  clang-tools-extra/clangd/index/Relation.cpp
  clang-tools-extra/clangd/index/Relation.h
  clang-tools-extra/clangd/index/Serialization.cpp
  clang-tools-extra/clangd/index/Serialization.h
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/index/YAMLSerialization.cpp
  clang-tools-extra/clangd/index/dex/Dex.h
  clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp
  clang-tools-extra/clangd/unittests/DexTests.cpp
  clang-tools-extra/clangd/unittests/FileIndexTests.cpp
  clang-tools-extra/clangd/unittests/IndexTests.cpp
  clang-tools-extra/clangd/unittests/SerializationTests.cpp
  clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
  clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp

Index: clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
===
--- clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
+++ clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
@@ -482,7 +482,7 @@
   std::vector Result;
   RelationsRequest Req;
   Req.Subjects.insert(Subject);
-  Req.Predicate = index::SymbolRole::RelationBaseOf;
+  Req.Predicate = RelationKind::BaseOf;
   Index->relations(Req,
[&Result](const SymbolID &Subject, const Symbol &Object) {
  Result.push_back(Object.ID);
Index: clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
===
--- clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
+++ clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
@@ -673,8 +673,7 @@
   const Symbol &Base = findSymbol(Symbols, "Base");
   const Symbol &Derived = findSymbol(Symbols, "Derived");
   EXPECT_THAT(Relations,
-  Contains(Relation{Base.ID, index::SymbolRole::RelationBaseOf,
-Derived.ID}));
+  Contains(Relation{Base.ID, RelationKind::BaseOf, Derived.ID}));
 }
 
 TEST_F(SymbolCollectorTest, References) {
Index: clang-tools-extra/clangd/unittests/SerializationTests.cpp
===
--- clang-tools-extra/clangd/unittests/SerializationTests.cpp
+++ clang-tools-extra/clangd/unittests/SerializationTests.cpp
@@ -152,9 +152,9 @@
   SymbolID Base = cantFail(SymbolID::fromStr("6481EE7AF2841756"));
   SymbolID Derived = cantFail(SymbolID::fromStr("6512AEC512EA3A2D"));
   ASSERT_TRUE(bool(ParsedYAML->Relations));
-  EXPECT_THAT(*ParsedYAML->Relations,
-  UnorderedElementsAre(
-  Relation{Base, index::SymbolRole::RelationBaseOf, Derived}));
+  EXPECT_THAT(
+  *ParsedYAML->Relations,
+  UnorderedElementsAre(Relation{Base, RelationKind::BaseOf, Derived}));
 }
 
 std::vector YAMLFromSymbols(const SymbolSlab &Slab) {
Index: clang-tools-extra/clangd/unittests/IndexTests.cpp
===
--- clang-tools-extra/clangd/unittests/IndexTests.cpp
+++ clang-tools-extra/clangd/unittests/IndexTests.cpp
@@ -83,20 +83,15 @@
   SymbolID D{"D"};
 
   RelationSlab::Builder Builder;
-  Builder.insert(Relation{A, index::SymbolRole::RelationBaseOf, B});
-  Builder.insert(Relation{A, index::SymbolRole::RelationBaseOf, C});
-  Builder.insert(Relation{B, index::SymbolRole::RelationBaseOf, D});
-  Builder.insert(Relation{C, index::SymbolRole::RelationBaseOf, D});
-  Builder.insert(Relation{B, index::SymbolRole::RelationChildOf, A});
-  Builder.insert(Relation{C, index::SymbolRole::RelationChildOf, A});
-  Builder.insert(Relation{D, index::SymbolRole::RelationChildOf, B});
-  Builder.insert(Relation{D, index::SymbolRole::RelationChildOf, C});
+  Builder.insert(Relation{A, RelationKind::BaseOf, B});
+  Builder.insert(Relation{A, RelationKind::BaseOf, C});
+  Builder.insert(Relation{B, RelationKind::BaseOf, D});
+  Builder.insert(Relation{C, RelationKind::BaseOf, D});
 
   RelationSlab Slab = std::move(Builder).build();
-  EXPECT_THAT(
-  Slab.lookup(A, index::SymbolRole::RelationBaseOf),
-  UnorderedElementsAre(Relation{A, index::SymbolRole::RelationBaseOf, B},
-   Relation{A, index::SymbolRole::RelationBaseOf, C}));
+  EXPECT_THAT(Slab.lookup(A, RelationKind::BaseOf),
+  UnorderedElementsAre(Relation{A, RelationKind::BaseOf, B},
+   Relation{A, RelationKind::BaseOf, C}));
 }
 
 TEST(RelationSlab, Duplicates) {
@@ -105,14 +100,13 @@
   SymbolID C{"C"};
 
   Relati

[PATCH] D68981: [clangd] Use our own relation kind.

2019-10-15 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

  Bulid results are available at 
http://results.llvm-merge-guard.org/Phabricator-37

See http://jenkins.llvm-merge-guard.org/job/Phabricator/37/ for more details.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68981



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


[PATCH] D62686: [RISCV] Add support for save/restore of callee-saved registers via libcalls

2019-10-15 Thread Lewis Revill via Phabricator via cfe-commits
lewis-revill added inline comments.



Comment at: llvm/test/CodeGen/RISCV/saverestore.ll:348
+
+; Check that functions with varargs do not use save/restore code
+

luismarques wrote:
> Maybe for these tests just put a -NOT check that __riscv_save_ isn't called?
Thanks, I realise it makes much more sense to do this for all the other 
'non-save-restore' checks too, since they don't actually check any save/restore 
behaviour.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62686



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


[PATCH] D68554: [clang-format] Proposal for clang-format to give compiler style warnings

2019-10-15 Thread Sylvestre Ledru via Phabricator via cfe-commits
sylvestre.ledru added a comment.

@MyDeveloperDay I think it should be added to the release notes. it is a great 
new changes for clang format (it would have made my life at Mozilla much easier 
;)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68554



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


[PATCH] D68969: [clang-format] Remove the dependency on frontend

2019-10-15 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added a comment.

My intuitive solution would have been to get the char* for the start and 
end-location and then search forward and backwards for \n.


Repository:
  rC Clang

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

https://reviews.llvm.org/D68969



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


r374882 - [Concepts] Concept Specialization Expressions

2019-10-15 Thread Saar Raz via cfe-commits
Author: saar.raz
Date: Tue Oct 15 04:48:58 2019
New Revision: 374882

URL: http://llvm.org/viewvc/llvm-project?rev=374882&view=rev
Log:
[Concepts] Concept Specialization Expressions

Part of C++20 Concepts implementation effort. Added Concept Specialization 
Expressions that are created when a concept is referenced with arguments, and 
tests thereof.



Added:
cfe/trunk/lib/Sema/SemaConcept.cpp
cfe/trunk/test/CXX/expr/expr.prim/expr.prim.id/
cfe/trunk/test/CXX/expr/expr.prim/expr.prim.id/p3.cpp
cfe/trunk/test/CXX/temp/temp.constr/
cfe/trunk/test/CXX/temp/temp.constr/temp.constr.decl/
cfe/trunk/test/CXX/temp/temp.constr/temp.constr.decl/class-template-decl.cpp
cfe/trunk/test/PCH/cxx2a-concept-specialization-expr.cpp
Removed:
cfe/trunk/test/CXX/concepts-ts/
Modified:
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/StmtNodes.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/AST/ExprCXX.cpp
cfe/trunk/lib/AST/ExprClassification.cpp
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/Frontend/FrontendActions.cpp
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/lib/Sema/CMakeLists.txt
cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
cfe/trunk/test/Parser/cxx2a-concept-declaration.cpp
cfe/trunk/tools/libclang/CXCursor.cpp

Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=374882&r1=374881&r2=374882&view=diff
==
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Tue Oct 15 04:48:58 2019
@@ -17,6 +17,7 @@
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclBase.h"
 #include "clang/AST/DeclCXX.h"
+#include "clang/AST/DeclTemplate.h"
 #include "clang/AST/DeclarationName.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/NestedNameSpecifier.h"
@@ -56,6 +57,7 @@ class IdentifierInfo;
 class LambdaCapture;
 class NonTypeTemplateParmDecl;
 class TemplateParameterList;
+class Sema;
 
 //======//
 // C++ Expressions.
@@ -4750,6 +4752,125 @@ public:
   }
 };
 
+/// \brief Represents the specialization of a concept - evaluates to a prvalue
+/// of type bool.
+///
+/// According to C++2a [expr.prim.id]p3 an id-expression that denotes the
+/// specialization of a concept results in a prvalue of type bool.
+class ConceptSpecializationExpr final : public Expr,
+  private llvm::TrailingObjects {
+  friend class ASTStmtReader;
+  friend TrailingObjects;
+
+  // \brief The optional nested name specifier used when naming the concept.
+  NestedNameSpecifierLoc NestedNameSpec;
+
+  /// \brief The location of the template keyword, if specified when naming the
+  /// concept.
+  SourceLocation TemplateKWLoc;
+
+  /// \brief The location of the concept name in the expression.
+  SourceLocation ConceptNameLoc;
+
+  /// \brief The declaration found by name lookup when the expression was
+  /// created.
+  /// Can differ from NamedConcept when, for example, the concept was found
+  /// through a UsingShadowDecl.
+  NamedDecl *FoundDecl;
+
+  /// \brief The concept named, and whether or not the concept with the given
+  /// arguments was satisfied when the expression was created.
+  /// If any of the template arguments are dependent (this expr would then be
+  /// isValueDependent()), this bit is to be ignored.
+  llvm::PointerIntPair NamedConcept;
+
+  /// \brief The template argument list source info used to specialize the
+  /// concept.
+  const ASTTemplateArgumentListInfo *ArgsAsWritten = nullptr;
+
+  /// \brief The number of template arguments in the tail-allocated list of
+  /// converted template arguments.
+  unsigned NumTemplateArgs;
+
+  ConceptSpecializationExpr(ASTContext &C, NestedNameSpecifierLoc NNS,
+SourceLocation TemplateKWLoc,
+SourceLocation ConceptNameLoc, NamedDecl 
*FoundDecl,
+ConceptDecl *NamedConcept,
+const ASTTemplateArgumentListInfo *ArgsAsWritten,
+ArrayRef ConvertedArgs,
+Optional IsSatisfied);
+
+  ConceptSpecializationExpr(EmptyShell Empty, unsigned NumTempl

[PATCH] D68792: [Alignment] Migrate Attribute::getWith(Stack)Alignment

2019-10-15 Thread Clement Courbet via Phabricator via cfe-commits
courbet accepted this revision.
courbet added inline comments.
This revision is now accepted and ready to land.



Comment at: llvm/lib/IR/Core.cpp:2792
+  Attribute AlignAttr =
+  Attribute::getWithAlignment(Call->getContext(), llvm::Align(align));
   Call->addAttribute(index, AlignAttr);

`Align`



Comment at: llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp:4216
   unsigned ExplicitArgOffset = ST.getExplicitKernelArgOffset(MF.getFunction());
-  unsigned Alignment = ST.getAlignmentForImplicitArgPtr();
+  Align Alignment = ST.getAlignmentForImplicitArgPtr();
   uint64_t ArgOffset = alignTo(MFI->getExplicitKernArgSize(), Alignment) +

const



Comment at: llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp:78
 
-  unsigned MaxAlign;
+  llvm::Align MaxAlign;
   // FIXME: Alignment is broken broken with explicit arg offset.;

`Align`



Comment at: llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp:131
 int64_t OffsetDiff = EltOffset - AlignDownOffset;
-unsigned AdjustedAlign = MinAlign(DoShiftOpt ? AlignDownOffset : EltOffset,
-  KernArgBaseAlign);
+llvm::Align AdjustedAlign = commonAlignment(
+KernArgBaseAlign, DoShiftOpt ? AlignDownOffset : EltOffset);

ditto



Comment at: llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp:506
 
-unsigned Align = DL.getABITypeAlignment(ArgTy);
+Align Alignment = Align(DL.getABITypeAlignment(ArgTy));
 uint64_t AllocSize = DL.getTypeAllocSize(ArgTy);

const



Comment at: llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp:524
   if (ImplicitBytes != 0) {
-unsigned Alignment = getAlignmentForImplicitArgPtr();
+Align Alignment = getAlignmentForImplicitArgPtr();
 TotalSize = alignTo(ExplicitArgBytes, Alignment) + ImplicitBytes;

const


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68792



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


[PATCH] D68792: [Alignment] Migrate Attribute::getWith(Stack)Alignment

2019-10-15 Thread Guillaume Chatelet via Phabricator via cfe-commits
gchatelet updated this revision to Diff 225006.
gchatelet added a comment.

- Address comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68792

Files:
  clang/lib/CodeGen/CGCall.cpp
  llvm/include/llvm/IR/Attributes.h
  llvm/include/llvm/IR/IntrinsicInst.h
  llvm/lib/IR/Attributes.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/IRBuilder.cpp
  llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
  llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
  llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
  llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp
  llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
  llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h
  llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
  llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h
  llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
  llvm/lib/Transforms/IPO/Attributor.cpp
  llvm/test/CodeGen/MIR/AMDGPU/machine-function-info-no-ir.mir
  llvm/test/CodeGen/MIR/AMDGPU/machine-function-info.ll
  llvm/unittests/IR/AttributesTest.cpp

Index: llvm/unittests/IR/AttributesTest.cpp
===
--- llvm/unittests/IR/AttributesTest.cpp
+++ llvm/unittests/IR/AttributesTest.cpp
@@ -70,8 +70,8 @@
 TEST(Attributes, RemoveAlign) {
   LLVMContext C;
 
-  Attribute AlignAttr = Attribute::getWithAlignment(C, 8);
-  Attribute StackAlignAttr = Attribute::getWithStackAlignment(C, 32);
+  Attribute AlignAttr = Attribute::getWithAlignment(C, Align(8));
+  Attribute StackAlignAttr = Attribute::getWithStackAlignment(C, Align(32));
   AttrBuilder B_align_readonly;
   B_align_readonly.addAttribute(AlignAttr);
   B_align_readonly.addAttribute(Attribute::ReadOnly);
@@ -141,9 +141,9 @@
   LLVMContext C;
   AttributeList AL;
   AL = AL.addAttribute(C, AttributeList::FirstArgIndex,
-   Attribute::getWithAlignment(C, 8));
+   Attribute::getWithAlignment(C, Align(8)));
   AL = AL.addAttribute(C, AttributeList::FirstArgIndex + 1,
-   Attribute::getWithAlignment(C, 32));
+   Attribute::getWithAlignment(C, Align(32)));
   EXPECT_EQ(8U, AL.getParamAlignment(0));
   EXPECT_EQ(32U, AL.getParamAlignment(1));
 
Index: llvm/test/CodeGen/MIR/AMDGPU/machine-function-info.ll
===
--- llvm/test/CodeGen/MIR/AMDGPU/machine-function-info.ll
+++ llvm/test/CodeGen/MIR/AMDGPU/machine-function-info.ll
@@ -39,7 +39,7 @@
 ; CHECK-LABEL: {{^}}name: ps_shader
 ; CHECK: machineFunctionInfo:
 ; CHECK-NEXT: explicitKernArgSize: 0
-; CHECK-NEXT: maxKernArgAlign: 0
+; CHECK-NEXT: maxKernArgAlign: 1
 ; CHECK-NEXT: ldsSize: 0
 ; CHECK-NEXT: isEntryFunction: true
 ; CHECK-NEXT: noSignedZerosFPMath: false
@@ -64,7 +64,7 @@
 ; CHECK-LABEL: {{^}}name: function
 ; CHECK: machineFunctionInfo:
 ; CHECK-NEXT: explicitKernArgSize: 0
-; CHECK-NEXT: maxKernArgAlign: 0
+; CHECK-NEXT: maxKernArgAlign: 1
 ; CHECK-NEXT: ldsSize: 0
 ; CHECK-NEXT: isEntryFunction: false
 ; CHECK-NEXT: noSignedZerosFPMath: false
@@ -89,7 +89,7 @@
 ; CHECK-LABEL: {{^}}name: function_nsz
 ; CHECK: machineFunctionInfo:
 ; CHECK-NEXT: explicitKernArgSize: 0
-; CHECK-NEXT: maxKernArgAlign: 0
+; CHECK-NEXT: maxKernArgAlign: 1
 ; CHECK-NEXT: ldsSize: 0
 ; CHECK-NEXT: isEntryFunction: false
 ; CHECK-NEXT: noSignedZerosFPMath: true
Index: llvm/test/CodeGen/MIR/AMDGPU/machine-function-info-no-ir.mir
===
--- llvm/test/CodeGen/MIR/AMDGPU/machine-function-info-no-ir.mir
+++ llvm/test/CodeGen/MIR/AMDGPU/machine-function-info-no-ir.mir
@@ -76,7 +76,7 @@
 # ALL-LABEL: name: no_mfi
 # FULL: machineFunctionInfo:
 # FULL-NEXT: explicitKernArgSize: 0
-# FULL-NEXT: maxKernArgAlign: 0
+# FULL-NEXT: maxKernArgAlign: 1
 # FULL-NEXT: ldsSize: 0
 # FULL-NEXT: isEntryFunction: false
 # FULL-NEXT: noSignedZerosFPMath: false
@@ -96,6 +96,7 @@
 # FULL-NEXT: body:
 
 # SIMPLE: machineFunctionInfo:
+# SIMPLE-NEXT: maxKernArgAlign: 1
 # SIMPLE-NEXT: argumentInfo:
 # SIMPLE-NEXT: privateSegmentBuffer: { reg: '$sgpr0_sgpr1_sgpr2_sgpr3' }
 # SIMPLE-NEXT: privateSegmentWaveByteOffset: { reg: '$sgpr33' }
@@ -112,7 +113,7 @@
 # ALL-LABEL: name: empty_mfi
 # FULL: machineFunctionInfo:
 # FULL-NEXT: explicitKernArgSize: 0
-# FULL-NEXT: maxKernArgAlign: 0
+# FULL-NEXT: maxKernArgAlign: 1
 # FULL-NEXT: ldsSize: 0
 # FULL-NEXT: isEntryFunction: false
 # FULL-NEXT: noSignedZerosFPMath: false
@@ -132,6 +133,7 @@
 # FULL-NEXT: body:
 
 # SIMPLE: machineFunctionInfo:
+# SIMPLE-NEXT: maxKernArgAlign: 1
 # SIMPLE-NEXT: argumentInfo:
 # SIMPLE-NEXT: privateSegmentBuffer: { reg: '$sgpr0_sgpr1_sgpr2_sgpr3' }
 # SIMPLE-NEXT: privateSegmentWaveByteOffset: { reg: '$sgpr33' }
@@ -149,7 +151,7 @@
 # ALL-LABEL: name: empty_mfi_entry_func
 # FULL: machineFunctionInfo:
 # FULL-NEXT: explicitKernArgSize: 0
-# FULL-NEXT: maxKernArgAlign: 0
+# FULL-NEXT: maxKernArgAlign: 1
 # FULL-NEX

[PATCH] D68792: [Alignment] Migrate Attribute::getWith(Stack)Alignment

2019-10-15 Thread Guillaume Chatelet via Phabricator via cfe-commits
gchatelet updated this revision to Diff 225010.
gchatelet added a comment.

- Fix naming collision


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68792

Files:
  clang/lib/CodeGen/CGCall.cpp
  llvm/include/llvm/IR/Attributes.h
  llvm/include/llvm/IR/IntrinsicInst.h
  llvm/lib/IR/Attributes.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/IRBuilder.cpp
  llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
  llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
  llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
  llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp
  llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
  llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h
  llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
  llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h
  llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
  llvm/lib/Transforms/IPO/Attributor.cpp
  llvm/test/CodeGen/MIR/AMDGPU/machine-function-info-no-ir.mir
  llvm/test/CodeGen/MIR/AMDGPU/machine-function-info.ll
  llvm/unittests/IR/AttributesTest.cpp

Index: llvm/unittests/IR/AttributesTest.cpp
===
--- llvm/unittests/IR/AttributesTest.cpp
+++ llvm/unittests/IR/AttributesTest.cpp
@@ -70,8 +70,8 @@
 TEST(Attributes, RemoveAlign) {
   LLVMContext C;
 
-  Attribute AlignAttr = Attribute::getWithAlignment(C, 8);
-  Attribute StackAlignAttr = Attribute::getWithStackAlignment(C, 32);
+  Attribute AlignAttr = Attribute::getWithAlignment(C, Align(8));
+  Attribute StackAlignAttr = Attribute::getWithStackAlignment(C, Align(32));
   AttrBuilder B_align_readonly;
   B_align_readonly.addAttribute(AlignAttr);
   B_align_readonly.addAttribute(Attribute::ReadOnly);
@@ -141,9 +141,9 @@
   LLVMContext C;
   AttributeList AL;
   AL = AL.addAttribute(C, AttributeList::FirstArgIndex,
-   Attribute::getWithAlignment(C, 8));
+   Attribute::getWithAlignment(C, Align(8)));
   AL = AL.addAttribute(C, AttributeList::FirstArgIndex + 1,
-   Attribute::getWithAlignment(C, 32));
+   Attribute::getWithAlignment(C, Align(32)));
   EXPECT_EQ(8U, AL.getParamAlignment(0));
   EXPECT_EQ(32U, AL.getParamAlignment(1));
 
Index: llvm/test/CodeGen/MIR/AMDGPU/machine-function-info.ll
===
--- llvm/test/CodeGen/MIR/AMDGPU/machine-function-info.ll
+++ llvm/test/CodeGen/MIR/AMDGPU/machine-function-info.ll
@@ -39,7 +39,7 @@
 ; CHECK-LABEL: {{^}}name: ps_shader
 ; CHECK: machineFunctionInfo:
 ; CHECK-NEXT: explicitKernArgSize: 0
-; CHECK-NEXT: maxKernArgAlign: 0
+; CHECK-NEXT: maxKernArgAlign: 1
 ; CHECK-NEXT: ldsSize: 0
 ; CHECK-NEXT: isEntryFunction: true
 ; CHECK-NEXT: noSignedZerosFPMath: false
@@ -64,7 +64,7 @@
 ; CHECK-LABEL: {{^}}name: function
 ; CHECK: machineFunctionInfo:
 ; CHECK-NEXT: explicitKernArgSize: 0
-; CHECK-NEXT: maxKernArgAlign: 0
+; CHECK-NEXT: maxKernArgAlign: 1
 ; CHECK-NEXT: ldsSize: 0
 ; CHECK-NEXT: isEntryFunction: false
 ; CHECK-NEXT: noSignedZerosFPMath: false
@@ -89,7 +89,7 @@
 ; CHECK-LABEL: {{^}}name: function_nsz
 ; CHECK: machineFunctionInfo:
 ; CHECK-NEXT: explicitKernArgSize: 0
-; CHECK-NEXT: maxKernArgAlign: 0
+; CHECK-NEXT: maxKernArgAlign: 1
 ; CHECK-NEXT: ldsSize: 0
 ; CHECK-NEXT: isEntryFunction: false
 ; CHECK-NEXT: noSignedZerosFPMath: true
Index: llvm/test/CodeGen/MIR/AMDGPU/machine-function-info-no-ir.mir
===
--- llvm/test/CodeGen/MIR/AMDGPU/machine-function-info-no-ir.mir
+++ llvm/test/CodeGen/MIR/AMDGPU/machine-function-info-no-ir.mir
@@ -76,7 +76,7 @@
 # ALL-LABEL: name: no_mfi
 # FULL: machineFunctionInfo:
 # FULL-NEXT: explicitKernArgSize: 0
-# FULL-NEXT: maxKernArgAlign: 0
+# FULL-NEXT: maxKernArgAlign: 1
 # FULL-NEXT: ldsSize: 0
 # FULL-NEXT: isEntryFunction: false
 # FULL-NEXT: noSignedZerosFPMath: false
@@ -96,6 +96,7 @@
 # FULL-NEXT: body:
 
 # SIMPLE: machineFunctionInfo:
+# SIMPLE-NEXT: maxKernArgAlign: 1
 # SIMPLE-NEXT: argumentInfo:
 # SIMPLE-NEXT: privateSegmentBuffer: { reg: '$sgpr0_sgpr1_sgpr2_sgpr3' }
 # SIMPLE-NEXT: privateSegmentWaveByteOffset: { reg: '$sgpr33' }
@@ -112,7 +113,7 @@
 # ALL-LABEL: name: empty_mfi
 # FULL: machineFunctionInfo:
 # FULL-NEXT: explicitKernArgSize: 0
-# FULL-NEXT: maxKernArgAlign: 0
+# FULL-NEXT: maxKernArgAlign: 1
 # FULL-NEXT: ldsSize: 0
 # FULL-NEXT: isEntryFunction: false
 # FULL-NEXT: noSignedZerosFPMath: false
@@ -132,6 +133,7 @@
 # FULL-NEXT: body:
 
 # SIMPLE: machineFunctionInfo:
+# SIMPLE-NEXT: maxKernArgAlign: 1
 # SIMPLE-NEXT: argumentInfo:
 # SIMPLE-NEXT: privateSegmentBuffer: { reg: '$sgpr0_sgpr1_sgpr2_sgpr3' }
 # SIMPLE-NEXT: privateSegmentWaveByteOffset: { reg: '$sgpr33' }
@@ -149,7 +151,7 @@
 # ALL-LABEL: name: empty_mfi_entry_func
 # FULL: machineFunctionInfo:
 # FULL-NEXT: explicitKernArgSize: 0
-# FULL-NEXT: maxKernArgAlign: 0
+# FULL-NEXT: maxKernArgAlign: 1
 # FULL

r374884 - [Alignment] Migrate Attribute::getWith(Stack)Alignment

2019-10-15 Thread Guillaume Chatelet via cfe-commits
Author: gchatelet
Date: Tue Oct 15 05:56:24 2019
New Revision: 374884

URL: http://llvm.org/viewvc/llvm-project?rev=374884&view=rev
Log:
[Alignment] Migrate Attribute::getWith(Stack)Alignment

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: 
http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet, jdoerfert

Reviewed By: courbet

Subscribers: arsenm, jvesely, nhaehnle, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=374884&r1=374883&r2=374884&view=diff
==
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue Oct 15 05:56:24 2019
@@ -2126,8 +2126,8 @@ void CodeGenModule::ConstructAttributeLi
   if (!PTy->isIncompleteType() && PTy->isConstantSizeType()) {
 auto info = getContext().getTypeInfoInChars(PTy);
 Attrs.addDereferenceableAttr(info.first.getQuantity());
-Attrs.addAttribute(llvm::Attribute::getWithAlignment(getLLVMContext(),
- info.second.getQuantity()));
+Attrs.addAttribute(llvm::Attribute::getWithAlignment(
+getLLVMContext(), info.second.getAsAlign()));
   }
   break;
 }


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


[PATCH] D68720: Support -fstack-clash-protection for x86

2019-10-15 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

Another test run on an x264 encoder (source: 
https://openbenchmarking.org/test/pts/x264)

Compiled with -O2 and with or without -fstack-clash-protection; Run without 
threads (`x265 --pools 1 -F 1 ./Bosphorus_1920x1080_120fps_420_8bit_YUV.y4m 
/dev/null`)

**Clang**

  baseline:  318.60s 
  protection:  317.72s

So no performance impact beyond noise.

The compilation inserts 44 inline probes in 9 functions.

**gcc**

Out of comparison, with gcc 8.2 (yeah, it's a bit old), I get (same flags & 
setup)

  baseline : 417.53 sec
  protected : 412.6 sec 

The compilations inserts inline probes in 22 functions.
So gcc inserts more probes, the impact on performance is equally surprising. I 
need to gather more points to get some statistical informations there.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68720



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


[PATCH] D68792: [Alignment] Migrate Attribute::getWith(Stack)Alignment

2019-10-15 Thread Guillaume Chatelet via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb65fa483058f: [Alignment] Migrate 
Attribute::getWith(Stack)Alignment (authored by gchatelet).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68792

Files:
  clang/lib/CodeGen/CGCall.cpp
  llvm/include/llvm/IR/Attributes.h
  llvm/include/llvm/IR/IntrinsicInst.h
  llvm/lib/IR/Attributes.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/IRBuilder.cpp
  llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
  llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
  llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
  llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp
  llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
  llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h
  llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
  llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h
  llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
  llvm/lib/Transforms/IPO/Attributor.cpp
  llvm/test/CodeGen/MIR/AMDGPU/machine-function-info-no-ir.mir
  llvm/test/CodeGen/MIR/AMDGPU/machine-function-info.ll
  llvm/unittests/IR/AttributesTest.cpp

Index: llvm/unittests/IR/AttributesTest.cpp
===
--- llvm/unittests/IR/AttributesTest.cpp
+++ llvm/unittests/IR/AttributesTest.cpp
@@ -70,8 +70,8 @@
 TEST(Attributes, RemoveAlign) {
   LLVMContext C;
 
-  Attribute AlignAttr = Attribute::getWithAlignment(C, 8);
-  Attribute StackAlignAttr = Attribute::getWithStackAlignment(C, 32);
+  Attribute AlignAttr = Attribute::getWithAlignment(C, Align(8));
+  Attribute StackAlignAttr = Attribute::getWithStackAlignment(C, Align(32));
   AttrBuilder B_align_readonly;
   B_align_readonly.addAttribute(AlignAttr);
   B_align_readonly.addAttribute(Attribute::ReadOnly);
@@ -141,9 +141,9 @@
   LLVMContext C;
   AttributeList AL;
   AL = AL.addAttribute(C, AttributeList::FirstArgIndex,
-   Attribute::getWithAlignment(C, 8));
+   Attribute::getWithAlignment(C, Align(8)));
   AL = AL.addAttribute(C, AttributeList::FirstArgIndex + 1,
-   Attribute::getWithAlignment(C, 32));
+   Attribute::getWithAlignment(C, Align(32)));
   EXPECT_EQ(8U, AL.getParamAlignment(0));
   EXPECT_EQ(32U, AL.getParamAlignment(1));
 
Index: llvm/test/CodeGen/MIR/AMDGPU/machine-function-info.ll
===
--- llvm/test/CodeGen/MIR/AMDGPU/machine-function-info.ll
+++ llvm/test/CodeGen/MIR/AMDGPU/machine-function-info.ll
@@ -39,7 +39,7 @@
 ; CHECK-LABEL: {{^}}name: ps_shader
 ; CHECK: machineFunctionInfo:
 ; CHECK-NEXT: explicitKernArgSize: 0
-; CHECK-NEXT: maxKernArgAlign: 0
+; CHECK-NEXT: maxKernArgAlign: 1
 ; CHECK-NEXT: ldsSize: 0
 ; CHECK-NEXT: isEntryFunction: true
 ; CHECK-NEXT: noSignedZerosFPMath: false
@@ -64,7 +64,7 @@
 ; CHECK-LABEL: {{^}}name: function
 ; CHECK: machineFunctionInfo:
 ; CHECK-NEXT: explicitKernArgSize: 0
-; CHECK-NEXT: maxKernArgAlign: 0
+; CHECK-NEXT: maxKernArgAlign: 1
 ; CHECK-NEXT: ldsSize: 0
 ; CHECK-NEXT: isEntryFunction: false
 ; CHECK-NEXT: noSignedZerosFPMath: false
@@ -89,7 +89,7 @@
 ; CHECK-LABEL: {{^}}name: function_nsz
 ; CHECK: machineFunctionInfo:
 ; CHECK-NEXT: explicitKernArgSize: 0
-; CHECK-NEXT: maxKernArgAlign: 0
+; CHECK-NEXT: maxKernArgAlign: 1
 ; CHECK-NEXT: ldsSize: 0
 ; CHECK-NEXT: isEntryFunction: false
 ; CHECK-NEXT: noSignedZerosFPMath: true
Index: llvm/test/CodeGen/MIR/AMDGPU/machine-function-info-no-ir.mir
===
--- llvm/test/CodeGen/MIR/AMDGPU/machine-function-info-no-ir.mir
+++ llvm/test/CodeGen/MIR/AMDGPU/machine-function-info-no-ir.mir
@@ -76,7 +76,7 @@
 # ALL-LABEL: name: no_mfi
 # FULL: machineFunctionInfo:
 # FULL-NEXT: explicitKernArgSize: 0
-# FULL-NEXT: maxKernArgAlign: 0
+# FULL-NEXT: maxKernArgAlign: 1
 # FULL-NEXT: ldsSize: 0
 # FULL-NEXT: isEntryFunction: false
 # FULL-NEXT: noSignedZerosFPMath: false
@@ -96,6 +96,7 @@
 # FULL-NEXT: body:
 
 # SIMPLE: machineFunctionInfo:
+# SIMPLE-NEXT: maxKernArgAlign: 1
 # SIMPLE-NEXT: argumentInfo:
 # SIMPLE-NEXT: privateSegmentBuffer: { reg: '$sgpr0_sgpr1_sgpr2_sgpr3' }
 # SIMPLE-NEXT: privateSegmentWaveByteOffset: { reg: '$sgpr33' }
@@ -112,7 +113,7 @@
 # ALL-LABEL: name: empty_mfi
 # FULL: machineFunctionInfo:
 # FULL-NEXT: explicitKernArgSize: 0
-# FULL-NEXT: maxKernArgAlign: 0
+# FULL-NEXT: maxKernArgAlign: 1
 # FULL-NEXT: ldsSize: 0
 # FULL-NEXT: isEntryFunction: false
 # FULL-NEXT: noSignedZerosFPMath: false
@@ -132,6 +133,7 @@
 # FULL-NEXT: body:
 
 # SIMPLE: machineFunctionInfo:
+# SIMPLE-NEXT: maxKernArgAlign: 1
 # SIMPLE-NEXT: argumentInfo:
 # SIMPLE-NEXT: privateSegmentBuffer: { reg: '$sgpr0_sgpr1_sgpr2_sgpr3' }
 # SIMPLE-NEXT: privateSegmentWaveByteOffset: { reg: '$sgpr33' }
@@ -149,7 +151,7 @@
 # ALL-LABEL: name: empty_mfi_entry_func
 # FULL: machineFunctionInfo:
 # FULL-NEXT: explicit

[PATCH] D68818: [hip][cuda] Fix the extended lambda name mangling issue.

2019-10-15 Thread Michael Liao via Phabricator via cfe-commits
hliao added a comment.

PING for review


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68818



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


[clang-tools-extra] r374885 - [clang-tools-extra] Fix overzealous linking of dylib to clangTidy

2019-10-15 Thread Michal Gorny via cfe-commits
Author: mgorny
Date: Tue Oct 15 06:05:38 2019
New Revision: 374885

URL: http://llvm.org/viewvc/llvm-project?rev=374885&view=rev
Log:
[clang-tools-extra] Fix overzealous linking of dylib to clangTidy

Fix accidentally making clangTidy library link to dylib.  This causes
libclang.so to also link to dylib which results in duplicate symbols
from shared and static libraries, and effectively to registering
command-line options twice.

Thanks to Sylvestre Ledru for noticing this and tracking it down
to r373786.  Fixes PR#43589.

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

Modified:
clang-tools-extra/trunk/clang-tidy/CMakeLists.txt

Modified: clang-tools-extra/trunk/clang-tidy/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/CMakeLists.txt?rev=374885&r1=374884&r2=374885&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/CMakeLists.txt Tue Oct 15 06:05:38 2019
@@ -31,7 +31,7 @@ add_clang_library(clangTidy
   )
 
 if(CLANG_ENABLE_STATIC_ANALYZER)
-  clang_target_link_libraries(clangTidy PRIVATE
+  target_link_libraries(clangTidy PRIVATE
 clangStaticAnalyzerCore
 clangStaticAnalyzerFrontend
   )


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


[PATCH] D68927: [clang-tools-extra] Fix overzealous linking of dylib to clangTidy

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

Sure but what doc? The non-existing one of `clang_target_link_libraries`?


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

https://reviews.llvm.org/D68927



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


[PATCH] D68927: [clang-tools-extra] Fix overzealous linking of dylib to clangTidy

2019-10-15 Thread Michał Górny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9c9bd1657cbd: [clang-tools-extra] Fix overzealous linking of 
dylib to clangTidy (authored by mgorny).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68927

Files:
  clang-tools-extra/clang-tidy/CMakeLists.txt


Index: clang-tools-extra/clang-tidy/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -31,7 +31,7 @@
   )
 
 if(CLANG_ENABLE_STATIC_ANALYZER)
-  clang_target_link_libraries(clangTidy PRIVATE
+  target_link_libraries(clangTidy PRIVATE
 clangStaticAnalyzerCore
 clangStaticAnalyzerFrontend
   )


Index: clang-tools-extra/clang-tidy/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -31,7 +31,7 @@
   )
 
 if(CLANG_ENABLE_STATIC_ANALYZER)
-  clang_target_link_libraries(clangTidy PRIVATE
+  target_link_libraries(clangTidy PRIVATE
 clangStaticAnalyzerCore
 clangStaticAnalyzerFrontend
   )
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68927: [clang-tools-extra] Fix overzealous linking of dylib to clangTidy

2019-10-15 Thread Sylvestre Ledru via Phabricator via cfe-commits
sylvestre.ledru added a comment.

In that function 
https://github.com/llvm/llvm-project/blob/5fd467feb813eefe3558da434cb038213582/clang/cmake/modules/AddClang.cmake#L180


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68927



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


[PATCH] D68981: [clangd] Use our own relation kind.

2019-10-15 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 225017.
hokein added a comment.

update a style comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68981

Files:
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/index/Index.h
  clang-tools-extra/clangd/index/MemIndex.h
  clang-tools-extra/clangd/index/Relation.cpp
  clang-tools-extra/clangd/index/Relation.h
  clang-tools-extra/clangd/index/Serialization.cpp
  clang-tools-extra/clangd/index/Serialization.h
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/index/YAMLSerialization.cpp
  clang-tools-extra/clangd/index/dex/Dex.h
  clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp
  clang-tools-extra/clangd/unittests/DexTests.cpp
  clang-tools-extra/clangd/unittests/FileIndexTests.cpp
  clang-tools-extra/clangd/unittests/IndexTests.cpp
  clang-tools-extra/clangd/unittests/SerializationTests.cpp
  clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
  clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp

Index: clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
===
--- clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
+++ clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
@@ -482,7 +482,7 @@
   std::vector Result;
   RelationsRequest Req;
   Req.Subjects.insert(Subject);
-  Req.Predicate = index::SymbolRole::RelationBaseOf;
+  Req.Predicate = RelationKind::BaseOf;
   Index->relations(Req,
[&Result](const SymbolID &Subject, const Symbol &Object) {
  Result.push_back(Object.ID);
Index: clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
===
--- clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
+++ clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
@@ -673,8 +673,7 @@
   const Symbol &Base = findSymbol(Symbols, "Base");
   const Symbol &Derived = findSymbol(Symbols, "Derived");
   EXPECT_THAT(Relations,
-  Contains(Relation{Base.ID, index::SymbolRole::RelationBaseOf,
-Derived.ID}));
+  Contains(Relation{Base.ID, RelationKind::BaseOf, Derived.ID}));
 }
 
 TEST_F(SymbolCollectorTest, References) {
Index: clang-tools-extra/clangd/unittests/SerializationTests.cpp
===
--- clang-tools-extra/clangd/unittests/SerializationTests.cpp
+++ clang-tools-extra/clangd/unittests/SerializationTests.cpp
@@ -152,9 +152,9 @@
   SymbolID Base = cantFail(SymbolID::fromStr("6481EE7AF2841756"));
   SymbolID Derived = cantFail(SymbolID::fromStr("6512AEC512EA3A2D"));
   ASSERT_TRUE(bool(ParsedYAML->Relations));
-  EXPECT_THAT(*ParsedYAML->Relations,
-  UnorderedElementsAre(
-  Relation{Base, index::SymbolRole::RelationBaseOf, Derived}));
+  EXPECT_THAT(
+  *ParsedYAML->Relations,
+  UnorderedElementsAre(Relation{Base, RelationKind::BaseOf, Derived}));
 }
 
 std::vector YAMLFromSymbols(const SymbolSlab &Slab) {
Index: clang-tools-extra/clangd/unittests/IndexTests.cpp
===
--- clang-tools-extra/clangd/unittests/IndexTests.cpp
+++ clang-tools-extra/clangd/unittests/IndexTests.cpp
@@ -83,20 +83,15 @@
   SymbolID D{"D"};
 
   RelationSlab::Builder Builder;
-  Builder.insert(Relation{A, index::SymbolRole::RelationBaseOf, B});
-  Builder.insert(Relation{A, index::SymbolRole::RelationBaseOf, C});
-  Builder.insert(Relation{B, index::SymbolRole::RelationBaseOf, D});
-  Builder.insert(Relation{C, index::SymbolRole::RelationBaseOf, D});
-  Builder.insert(Relation{B, index::SymbolRole::RelationChildOf, A});
-  Builder.insert(Relation{C, index::SymbolRole::RelationChildOf, A});
-  Builder.insert(Relation{D, index::SymbolRole::RelationChildOf, B});
-  Builder.insert(Relation{D, index::SymbolRole::RelationChildOf, C});
+  Builder.insert(Relation{A, RelationKind::BaseOf, B});
+  Builder.insert(Relation{A, RelationKind::BaseOf, C});
+  Builder.insert(Relation{B, RelationKind::BaseOf, D});
+  Builder.insert(Relation{C, RelationKind::BaseOf, D});
 
   RelationSlab Slab = std::move(Builder).build();
-  EXPECT_THAT(
-  Slab.lookup(A, index::SymbolRole::RelationBaseOf),
-  UnorderedElementsAre(Relation{A, index::SymbolRole::RelationBaseOf, B},
-   Relation{A, index::SymbolRole::RelationBaseOf, C}));
+  EXPECT_THAT(Slab.lookup(A, RelationKind::BaseOf),
+  UnorderedElementsAre(Relation{A, RelationKind::BaseOf, B},
+   Relation{A, RelationKind::BaseOf, C}));
 }
 
 TEST(RelationSlab, Duplicates) {
@@ -105,14 +100,13 @@
   SymbolID C{"C"};
 
   RelationSlab::Builder Builder;
-  Builder.insert(Relation{A, index::SymbolRole::RelationBaseOf, B});
-  Builder.insert(Relation{A, i

[PATCH] D68927: [clang-tools-extra] Fix overzealous linking of dylib to clangTidy

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

In D68927#1709395 , @sylvestre.ledru 
wrote:

> In that function 
> https://github.com/llvm/llvm-project/blob/5fd467feb813eefe3558da434cb038213582/clang/cmake/modules/AddClang.cmake#L180


I'm not really sure what you mean me to say. That it links to clang-cpp? That's 
pretty much what the code says.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68927



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


[PATCH] D68981: [clangd] Use our own relation kind.

2019-10-15 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

  Bulid results are available at 
http://results.llvm-merge-guard.org/Phabricator-38

See http://jenkins.llvm-merge-guard.org/job/Phabricator/38/ for more details.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68981



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


[PATCH] D68862: [ARM] Allocatable Global Register Variables for ARM

2019-10-15 Thread Carey Williams via Phabricator via cfe-commits
carwil added a comment.

In D68862#1708132 , @chill wrote:

> In D68862#1708079 , @carwil wrote:
>
> > > IMHO, since reserved registes are per-function, this strongly suggests 
> > > implementation as function attribute(s), rather than subtarget features 
> > > (also for the pre-existing r9).
> >
> > What do you mean reserved registers are per-function? That sounds like 
> > you're describing local register variables, which I don't believe Clang has 
> > any support for (and there aren't a great deal of use-cases for anyway).
> >  We're specifically talking about global usage here.
>
>
> I mean that the set is dynamically computed and depends on the specific 
> function: cf. 
> https://github.com/llvm/llvm-project/blob/master/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp#L184
>  as opposed to, say, depend only on target/subtarget/abi.


Ah, I see. That's a fair comment. AArch64 also achieves it's -reserve-xN 
options via subtarget features (despite function context), I think that's where 
the inspiration/suggestion for doing it this way in the ARM backend came from.


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

https://reviews.llvm.org/D68862



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


[PATCH] D68981: [clangd] Use our own relation kind.

2019-10-15 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments.



Comment at: clang-tools-extra/clangd/index/MemIndex.h:72
   // A map from (subject, predicate) pair to objects.
-  llvm::DenseMap, std::vector>
+  llvm::DenseMap, std::vector>
   Relations;

can we rather use `uint8_t` in here instead of `RelationKind` to get rid of the 
`DenseMapInfo` specialization completely?



Comment at: clang-tools-extra/clangd/index/Relation.h:22
 
+enum class RelationKind : uint8_t {
+  BaseOf,

is this clang-formatted ?



Comment at: clang-tools-extra/clangd/index/Serialization.h:88
-enum class RelationKind : uint8_t { BaseOf };
-RelationKind symbolRoleToRelationKind(index::SymbolRole);
-index::SymbolRole relationKindToSymbolRole(RelationKind);

could you also delete definitions of these two functions?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68981



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


[PATCH] D68978: [clangd] Propagate main context into ClangdServer

2019-10-15 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

Otherwise LG


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68978



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


[PATCH] D68978: [clangd] Propagate main context into ClangdServer

2019-10-15 Thread Sam McCall via Phabricator via cfe-commits
sammccall added inline comments.



Comment at: clang-tools-extra/clangd/ClangdLSPServer.cpp:463
+  // Server, CDB, etc.
+  llvm::Optional MainContext;
+  MainContext.emplace(BackgroundContext.clone());

As discussed offline: I think it'd be clearer to put this in a small block 
around the construction of clangd server. (Then we can avoid some ofthe 
Optional bits too)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68978



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


[PATCH] D68978: [clangd] Propagate main context into ClangdServer

2019-10-15 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 225027.
kadircet marked an inline comment as done.
kadircet added a comment.

- Move context swapping next to server creation


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68978

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/ClangdLSPServer.h


Index: clang-tools-extra/clangd/ClangdLSPServer.h
===
--- clang-tools-extra/clangd/ClangdLSPServer.h
+++ clang-tools-extra/clangd/ClangdLSPServer.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDLSPSERVER_H
 
 #include "ClangdServer.h"
+#include "Context.h"
 #include "DraftStore.h"
 #include "Features.inc"
 #include "FindSymbols.h"
@@ -131,6 +132,11 @@
   void publishDiagnostics(const URIForFile &File,
   std::vector Diagnostics);
 
+  // Since initialization of CDBs and ClangdServer is done lazily, the 
following
+  // context captures the one used while creating ClangdLSPServer and passes it
+  // to above mentioned object instances to make sure they share the same 
state.
+  Context BackgroundContext;
+
   /// Used to indicate that the 'shutdown' request was received from the
   /// Language Server client.
   bool ShutdownRequestReceived = false;
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "ClangdLSPServer.h"
+#include "Context.h"
 #include "Diagnostics.h"
 #include "DraftStore.h"
 #include "FormattedString.h"
@@ -465,10 +466,6 @@
 break;
   }
   }
-  llvm::Optional WithOffsetEncoding;
-  if (NegotiatedOffsetEncoding)
-WithOffsetEncoding.emplace(kCurrentOffsetEncoding,
-   *NegotiatedOffsetEncoding);
 
   ClangdServerOpts.SemanticHighlighting =
   Params.capabilities.SemanticHighlighting;
@@ -490,8 +487,18 @@
   }
   CDB.emplace(BaseCDB.get(), Params.initializationOptions.fallbackFlags,
   ClangdServerOpts.ResourceDir);
-  Server.emplace(*CDB, FSProvider, static_cast(*this),
- ClangdServerOpts);
+  {
+// Switch caller's context with LSPServer's background context. Since we
+// rather want to propagate information from LSPServer's context into the
+// Server, CDB, etc.
+WithContext MainContext(BackgroundContext.clone());
+llvm::Optional WithOffsetEncoding;
+if (NegotiatedOffsetEncoding)
+  WithOffsetEncoding.emplace(kCurrentOffsetEncoding,
+ *NegotiatedOffsetEncoding);
+Server.emplace(*CDB, FSProvider, static_cast(*this),
+   ClangdServerOpts);
+  }
   applyConfiguration(Params.initializationOptions.ConfigSettings);
 
   CCOpts.EnableSnippets = Params.capabilities.CompletionSnippets;
@@ -1184,9 +1191,9 @@
 llvm::Optional CompileCommandsDir, bool UseDirBasedCDB,
 llvm::Optional ForcedOffsetEncoding,
 const ClangdServer::Options &Opts)
-: Transp(Transp), MsgHandler(new MessageHandler(*this)),
-  FSProvider(FSProvider), CCOpts(CCOpts),
-  SupportedSymbolKinds(defaultSymbolKinds()),
+: BackgroundContext(Context::current().clone()), Transp(Transp),
+  MsgHandler(new MessageHandler(*this)), FSProvider(FSProvider),
+  CCOpts(CCOpts), SupportedSymbolKinds(defaultSymbolKinds()),
   SupportedCompletionItemKinds(defaultCompletionItemKinds()),
   UseDirBasedCDB(UseDirBasedCDB),
   CompileCommandsDir(std::move(CompileCommandsDir)), 
ClangdServerOpts(Opts),


Index: clang-tools-extra/clangd/ClangdLSPServer.h
===
--- clang-tools-extra/clangd/ClangdLSPServer.h
+++ clang-tools-extra/clangd/ClangdLSPServer.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDLSPSERVER_H
 
 #include "ClangdServer.h"
+#include "Context.h"
 #include "DraftStore.h"
 #include "Features.inc"
 #include "FindSymbols.h"
@@ -131,6 +132,11 @@
   void publishDiagnostics(const URIForFile &File,
   std::vector Diagnostics);
 
+  // Since initialization of CDBs and ClangdServer is done lazily, the following
+  // context captures the one used while creating ClangdLSPServer and passes it
+  // to above mentioned object instances to make sure they share the same state.
+  Context BackgroundContext;
+
   /// Used to indicate that the 'shutdown' request was received from the
   /// Language Server client.
   bool ShutdownRequestReceived = false;
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -7,6 +7,7 @@
 //=

[clang-tools-extra] r374892 - [clangd] Propagate main context into ClangdServer

2019-10-15 Thread Kadir Cetinkaya via cfe-commits
Author: kadircet
Date: Tue Oct 15 07:20:52 2019
New Revision: 374892

URL: http://llvm.org/viewvc/llvm-project?rev=374892&view=rev
Log:
[clangd] Propagate main context into ClangdServer

Summary:
Currently clangd initializes the ClangdServer lazily during
onInitialize request, and it results in propagation of caller's context rather
than the main context created ClangdLSPServer.

This patch changes the logic to store main context that created ClangdLSPServer
and pass it onto to ClangdServer and other objects like CDBs.

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

Modified:
clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
clang-tools-extra/trunk/clangd/ClangdLSPServer.h

Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp?rev=374892&r1=374891&r2=374892&view=diff
==
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp Tue Oct 15 07:20:52 2019
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "ClangdLSPServer.h"
+#include "Context.h"
 #include "Diagnostics.h"
 #include "DraftStore.h"
 #include "FormattedString.h"
@@ -465,10 +466,6 @@ void ClangdLSPServer::onInitialize(const
 break;
   }
   }
-  llvm::Optional WithOffsetEncoding;
-  if (NegotiatedOffsetEncoding)
-WithOffsetEncoding.emplace(kCurrentOffsetEncoding,
-   *NegotiatedOffsetEncoding);
 
   ClangdServerOpts.SemanticHighlighting =
   Params.capabilities.SemanticHighlighting;
@@ -490,8 +487,18 @@ void ClangdLSPServer::onInitialize(const
   }
   CDB.emplace(BaseCDB.get(), Params.initializationOptions.fallbackFlags,
   ClangdServerOpts.ResourceDir);
-  Server.emplace(*CDB, FSProvider, static_cast(*this),
- ClangdServerOpts);
+  {
+// Switch caller's context with LSPServer's background context. Since we
+// rather want to propagate information from LSPServer's context into the
+// Server, CDB, etc.
+WithContext MainContext(BackgroundContext.clone());
+llvm::Optional WithOffsetEncoding;
+if (NegotiatedOffsetEncoding)
+  WithOffsetEncoding.emplace(kCurrentOffsetEncoding,
+ *NegotiatedOffsetEncoding);
+Server.emplace(*CDB, FSProvider, static_cast(*this),
+   ClangdServerOpts);
+  }
   applyConfiguration(Params.initializationOptions.ConfigSettings);
 
   CCOpts.EnableSnippets = Params.capabilities.CompletionSnippets;
@@ -1184,9 +1191,9 @@ ClangdLSPServer::ClangdLSPServer(
 llvm::Optional CompileCommandsDir, bool UseDirBasedCDB,
 llvm::Optional ForcedOffsetEncoding,
 const ClangdServer::Options &Opts)
-: Transp(Transp), MsgHandler(new MessageHandler(*this)),
-  FSProvider(FSProvider), CCOpts(CCOpts),
-  SupportedSymbolKinds(defaultSymbolKinds()),
+: BackgroundContext(Context::current().clone()), Transp(Transp),
+  MsgHandler(new MessageHandler(*this)), FSProvider(FSProvider),
+  CCOpts(CCOpts), SupportedSymbolKinds(defaultSymbolKinds()),
   SupportedCompletionItemKinds(defaultCompletionItemKinds()),
   UseDirBasedCDB(UseDirBasedCDB),
   CompileCommandsDir(std::move(CompileCommandsDir)), 
ClangdServerOpts(Opts),

Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.h?rev=374892&r1=374891&r2=374892&view=diff
==
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.h (original)
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.h Tue Oct 15 07:20:52 2019
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDLSPSERVER_H
 
 #include "ClangdServer.h"
+#include "Context.h"
 #include "DraftStore.h"
 #include "Features.inc"
 #include "FindSymbols.h"
@@ -131,6 +132,11 @@ private:
   void publishDiagnostics(const URIForFile &File,
   std::vector Diagnostics);
 
+  // Since initialization of CDBs and ClangdServer is done lazily, the 
following
+  // context captures the one used while creating ClangdLSPServer and passes it
+  // to above mentioned object instances to make sure they share the same 
state.
+  Context BackgroundContext;
+
   /// Used to indicate that the 'shutdown' request was received from the
   /// Language Server client.
   bool ShutdownRequestReceived = false;


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


r374893 - [AST] Remove unused Sema includes to fix a cyclic dependency from Sema to AST

2019-10-15 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Tue Oct 15 07:23:05 2019
New Revision: 374893

URL: http://llvm.org/viewvc/llvm-project?rev=374893&view=rev
Log:
[AST] Remove unused Sema includes to fix a cyclic dependency from Sema to AST

Modified:
cfe/trunk/lib/AST/ExprCXX.cpp

Modified: cfe/trunk/lib/AST/ExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprCXX.cpp?rev=374893&r1=374892&r2=374893&view=diff
==
--- cfe/trunk/lib/AST/ExprCXX.cpp (original)
+++ cfe/trunk/lib/AST/ExprCXX.cpp Tue Oct 15 07:23:05 2019
@@ -28,9 +28,6 @@
 #include "clang/Basic/OperatorKinds.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Specifiers.h"
-#include "clang/Sema/Template.h"
-#include "clang/Sema/SemaDiagnostic.h"
-#include "clang/Sema/Sema.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -1761,4 +1758,4 @@ ConceptSpecializationExpr::Create(ASTCon
   void *Buffer = C.Allocate(totalSizeToAlloc(
 NumTemplateArgs));
   return new (Buffer) ConceptSpecializationExpr(Empty, NumTemplateArgs);
-}
\ No newline at end of file
+}


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


[PATCH] D68362: [libunwind][RISCV] Add 64-bit RISC-V support

2019-10-15 Thread Sam Elliott via Phabricator via cfe-commits
lenary added a comment.

One query, but this patch is starting to look good.

I'm not a libunwind expert - it would be good to have one of the libunwind 
contributors look over this patch yet. Can you add one as a reviewer?




Comment at: libunwind/src/Registers.hpp:3677
+  case UNW_RISCV_X31:
+return "t6";
+  case UNW_RISCV_F0:

Good catch, thanks!



Comment at: libunwind/src/Registers.hpp:3756
+inline double Registers_riscv::getFloatRegister(int regNum) const {
+#ifdef __riscv_float_abi_double
+  assert(validFloatRegister(regNum));

Is this an ABI or an architecture issue? I'm not sure what other libunwind 
"backends" do for similar cases.

The difference is, if I compile libunwind with `-march=rv64g -mabi=lp64`, 
`__riscv_float_abi_double` is not defined (because you're using a soft-float 
ABI), but `__riscv_flen == 64` (because the machine does have hardware 
floating-point registers).

I'm not sure what the intended behaviour of libunwind is in this case.

`__riscv_float_abi_double` implies `__riscv_flen >= 64`.



Comment at: libunwind/src/UnwindCursor.hpp:999
+#if defined (_LIBUNWIND_TARGET_RISCV)
+  int stepWithCompactEncoding(Registers_riscv &) {
+return UNW_EINVAL;

mhorne wrote:
> lenary wrote:
> > Nit: This should be formatted like the version for `Registers_sparc` above.
> `Registers_sparc` is the outlier in this case, I've formatted it as all the 
> other architectures use. If you'd like I could fix the SPARC formatting in 
> this patch.
Ah, no worries then. Don't update the sparc formatting in this patch.


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

https://reviews.llvm.org/D68362



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


r374895 - Reapply: [Modules][PCH] Hash input files content

2019-10-15 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Tue Oct 15 07:23:55 2019
New Revision: 374895

URL: http://llvm.org/viewvc/llvm-project?rev=374895&view=rev
Log:
Reapply: [Modules][PCH] Hash input files content

Summary:
When files often get touched during builds, the mtime based validation
leads to different problems in implicit modules builds, even when the
content doesn't actually change:

- Modules only: module invalidation due to out of date files. Usually causing 
rebuild traffic.
- Modules + PCH: build failures because clang cannot rebuild a module if it 
comes from building a PCH.
- PCH: build failures because clang cannot rebuild a PCH in case one of the 
input headers has different mtime.

This patch proposes hashing the content of input files (headers and
module maps), which is performed during serialization time. When looking
at input files for validation, clang only computes the hash in case
there's a mtime mismatch.

I've tested a couple of different hash algorithms availble in LLVM in
face of building modules+pch for `#import `:
- `hash_code`: performace diff within the noise, total module cache increased 
by 0.07%.
- `SHA1`: 5% slowdown. Haven't done real size measurements, but it'd be 
BLOCK_ID+20 bytes per input file, instead of BLOCK_ID+8 bytes from `hash_code`.
- `MD5`: 3% slowdown. Like above, but BLOCK_ID+16 bytes per input file.

Given the numbers above, the patch uses `hash_code`. The patch also
improves invalidation error msgs to point out which type of problem the
user is facing: "mtime", "size" or "content".

rdar://problem/29320105

Reviewers: dexonsmith, arphaman, rsmith, aprantl

Subscribers: jkorous, cfe-commits, ributzka

Tags: #clang

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

llvm-svn: 374841

Added:
cfe/trunk/test/Modules/validate-file-content.m
cfe/trunk/test/PCH/validate-file-content.m
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Lex/HeaderSearchOptions.h
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInstance.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td?rev=374895&r1=374894&r2=374895&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td Tue Oct 15 
07:23:55 2019
@@ -18,13 +18,16 @@ def err_fe_pch_malformed : Error<
 def err_fe_pch_malformed_block : Error<
 "malformed block record in PCH file: '%0'">, DefaultFatal;
 def err_fe_pch_file_modified : Error<
-"file '%0' has been modified since the precompiled header '%1' was built">,
+"file '%0' has been modified since the precompiled header '%1' was built"
+": %select{size|mtime|content}2 changed">,
 DefaultFatal;
 def err_fe_module_file_modified : Error<
-"file '%0' has been modified since the module file '%1' was built">,
+"file '%0' has been modified since the module file '%1' was built"
+": %select{size|mtime|content}2 changed">,
 DefaultFatal;
 def err_fe_ast_file_modified : Error<
-"file '%0' has been modified since the AST file '%1' was built">,
+"file '%0' has been modified since the AST file '%1' was built"
+": %select{size|mtime|content}2 changed">,
 DefaultFatal;
 def err_fe_pch_file_overridden : Error<
 "file '%0' from the precompiled header has been overridden">;
@@ -399,6 +402,8 @@ def warn_module_uses_date_time : Warning
 def err_module_no_size_mtime_for_header : Error<
   "cannot emit module %0: %select{size|mtime}1 must be explicitly specified "
   "for missing header file \"%2\"">;
+def err_module_unable_to_hash_content : Error<
+  "failed to hash content for '%0' because memory buffer cannot be retrieved">;
 } // let CategoryName
 } // let Component
 

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=374895&r1=374894&r2=374895&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Oct 15 07:23:55 2019
@@ -1368,6 +1368,28 @@ def fmodules_validate_system_headers : F
   HelpText<"Validate the system headers that a module depends on when loading 
the module">;
 def fno_modules_validate_system_headers : Flag<["-"], 
"fno-modules-validate-system-headers">,
   Group, Flags<[DriverOption]>;
+
+def fvalidate_ast_input_files_content:
+  Flag <["-"],

[PATCH] D68978: [clangd] Propagate main context into ClangdServer

2019-10-15 Thread Kadir Cetinkaya via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9d66247e9b78: [clangd] Propagate main context into 
ClangdServer (authored by kadircet).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68978

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/ClangdLSPServer.h


Index: clang-tools-extra/clangd/ClangdLSPServer.h
===
--- clang-tools-extra/clangd/ClangdLSPServer.h
+++ clang-tools-extra/clangd/ClangdLSPServer.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDLSPSERVER_H
 
 #include "ClangdServer.h"
+#include "Context.h"
 #include "DraftStore.h"
 #include "Features.inc"
 #include "FindSymbols.h"
@@ -131,6 +132,11 @@
   void publishDiagnostics(const URIForFile &File,
   std::vector Diagnostics);
 
+  // Since initialization of CDBs and ClangdServer is done lazily, the 
following
+  // context captures the one used while creating ClangdLSPServer and passes it
+  // to above mentioned object instances to make sure they share the same 
state.
+  Context BackgroundContext;
+
   /// Used to indicate that the 'shutdown' request was received from the
   /// Language Server client.
   bool ShutdownRequestReceived = false;
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "ClangdLSPServer.h"
+#include "Context.h"
 #include "Diagnostics.h"
 #include "DraftStore.h"
 #include "FormattedString.h"
@@ -465,10 +466,6 @@
 break;
   }
   }
-  llvm::Optional WithOffsetEncoding;
-  if (NegotiatedOffsetEncoding)
-WithOffsetEncoding.emplace(kCurrentOffsetEncoding,
-   *NegotiatedOffsetEncoding);
 
   ClangdServerOpts.SemanticHighlighting =
   Params.capabilities.SemanticHighlighting;
@@ -490,8 +487,18 @@
   }
   CDB.emplace(BaseCDB.get(), Params.initializationOptions.fallbackFlags,
   ClangdServerOpts.ResourceDir);
-  Server.emplace(*CDB, FSProvider, static_cast(*this),
- ClangdServerOpts);
+  {
+// Switch caller's context with LSPServer's background context. Since we
+// rather want to propagate information from LSPServer's context into the
+// Server, CDB, etc.
+WithContext MainContext(BackgroundContext.clone());
+llvm::Optional WithOffsetEncoding;
+if (NegotiatedOffsetEncoding)
+  WithOffsetEncoding.emplace(kCurrentOffsetEncoding,
+ *NegotiatedOffsetEncoding);
+Server.emplace(*CDB, FSProvider, static_cast(*this),
+   ClangdServerOpts);
+  }
   applyConfiguration(Params.initializationOptions.ConfigSettings);
 
   CCOpts.EnableSnippets = Params.capabilities.CompletionSnippets;
@@ -1184,9 +1191,9 @@
 llvm::Optional CompileCommandsDir, bool UseDirBasedCDB,
 llvm::Optional ForcedOffsetEncoding,
 const ClangdServer::Options &Opts)
-: Transp(Transp), MsgHandler(new MessageHandler(*this)),
-  FSProvider(FSProvider), CCOpts(CCOpts),
-  SupportedSymbolKinds(defaultSymbolKinds()),
+: BackgroundContext(Context::current().clone()), Transp(Transp),
+  MsgHandler(new MessageHandler(*this)), FSProvider(FSProvider),
+  CCOpts(CCOpts), SupportedSymbolKinds(defaultSymbolKinds()),
   SupportedCompletionItemKinds(defaultCompletionItemKinds()),
   UseDirBasedCDB(UseDirBasedCDB),
   CompileCommandsDir(std::move(CompileCommandsDir)), 
ClangdServerOpts(Opts),


Index: clang-tools-extra/clangd/ClangdLSPServer.h
===
--- clang-tools-extra/clangd/ClangdLSPServer.h
+++ clang-tools-extra/clangd/ClangdLSPServer.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDLSPSERVER_H
 
 #include "ClangdServer.h"
+#include "Context.h"
 #include "DraftStore.h"
 #include "Features.inc"
 #include "FindSymbols.h"
@@ -131,6 +132,11 @@
   void publishDiagnostics(const URIForFile &File,
   std::vector Diagnostics);
 
+  // Since initialization of CDBs and ClangdServer is done lazily, the following
+  // context captures the one used while creating ClangdLSPServer and passes it
+  // to above mentioned object instances to make sure they share the same state.
+  Context BackgroundContext;
+
   /// Used to indicate that the 'shutdown' request was received from the
   /// Language Server client.
   bool ShutdownRequestReceived = false;
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -

[PATCH] D68981: [clangd] Use our own relation kind.

2019-10-15 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 225034.
hokein marked 4 inline comments as done.
hokein added a comment.
Herald added subscribers: llvm-commits, dexonsmith.
Herald added a project: LLVM.

address comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68981

Files:
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/index/Index.h
  clang-tools-extra/clangd/index/MemIndex.cpp
  clang-tools-extra/clangd/index/MemIndex.h
  clang-tools-extra/clangd/index/Relation.cpp
  clang-tools-extra/clangd/index/Relation.h
  clang-tools-extra/clangd/index/Serialization.cpp
  clang-tools-extra/clangd/index/Serialization.h
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/index/YAMLSerialization.cpp
  clang-tools-extra/clangd/index/dex/Dex.cpp
  clang-tools-extra/clangd/index/dex/Dex.h
  clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp
  clang-tools-extra/clangd/unittests/DexTests.cpp
  clang-tools-extra/clangd/unittests/FileIndexTests.cpp
  clang-tools-extra/clangd/unittests/IndexTests.cpp
  clang-tools-extra/clangd/unittests/SerializationTests.cpp
  clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
  clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
  llvm/include/llvm/ADT/DenseMapInfo.h

Index: llvm/include/llvm/ADT/DenseMapInfo.h
===
--- llvm/include/llvm/ADT/DenseMapInfo.h
+++ llvm/include/llvm/ADT/DenseMapInfo.h
@@ -67,6 +67,15 @@
   }
 };
 
+// Provide DenseMapInfo for unsign chars.
+template <> struct DenseMapInfo {
+  static inline unsigned char getEmptyKey() { return ~0; }
+  static inline unsigned char getTombstoneKey() { return ~0 - 1; }
+  static unsigned getHashValue(const char &Val) { return Val * 37U; }
+
+  static bool isEqual(const char &LHS, const char &RHS) { return LHS == RHS; }
+};
+
 // Provide DenseMapInfo for unsigned shorts.
 template <> struct DenseMapInfo {
   static inline unsigned short getEmptyKey() { return 0x; }
Index: clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
===
--- clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
+++ clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
@@ -482,7 +482,7 @@
   std::vector Result;
   RelationsRequest Req;
   Req.Subjects.insert(Subject);
-  Req.Predicate = index::SymbolRole::RelationBaseOf;
+  Req.Predicate = RelationKind::BaseOf;
   Index->relations(Req,
[&Result](const SymbolID &Subject, const Symbol &Object) {
  Result.push_back(Object.ID);
Index: clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
===
--- clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
+++ clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
@@ -673,8 +673,7 @@
   const Symbol &Base = findSymbol(Symbols, "Base");
   const Symbol &Derived = findSymbol(Symbols, "Derived");
   EXPECT_THAT(Relations,
-  Contains(Relation{Base.ID, index::SymbolRole::RelationBaseOf,
-Derived.ID}));
+  Contains(Relation{Base.ID, RelationKind::BaseOf, Derived.ID}));
 }
 
 TEST_F(SymbolCollectorTest, References) {
Index: clang-tools-extra/clangd/unittests/SerializationTests.cpp
===
--- clang-tools-extra/clangd/unittests/SerializationTests.cpp
+++ clang-tools-extra/clangd/unittests/SerializationTests.cpp
@@ -152,9 +152,9 @@
   SymbolID Base = cantFail(SymbolID::fromStr("6481EE7AF2841756"));
   SymbolID Derived = cantFail(SymbolID::fromStr("6512AEC512EA3A2D"));
   ASSERT_TRUE(bool(ParsedYAML->Relations));
-  EXPECT_THAT(*ParsedYAML->Relations,
-  UnorderedElementsAre(
-  Relation{Base, index::SymbolRole::RelationBaseOf, Derived}));
+  EXPECT_THAT(
+  *ParsedYAML->Relations,
+  UnorderedElementsAre(Relation{Base, RelationKind::BaseOf, Derived}));
 }
 
 std::vector YAMLFromSymbols(const SymbolSlab &Slab) {
Index: clang-tools-extra/clangd/unittests/IndexTests.cpp
===
--- clang-tools-extra/clangd/unittests/IndexTests.cpp
+++ clang-tools-extra/clangd/unittests/IndexTests.cpp
@@ -83,20 +83,15 @@
   SymbolID D{"D"};
 
   RelationSlab::Builder Builder;
-  Builder.insert(Relation{A, index::SymbolRole::RelationBaseOf, B});
-  Builder.insert(Relation{A, index::SymbolRole::RelationBaseOf, C});
-  Builder.insert(Relation{B, index::SymbolRole::RelationBaseOf, D});
-  Builder.insert(Relation{C, index::SymbolRole::RelationBaseOf, D});
-  Builder.insert(Relation{B, index::SymbolRole::RelationChildOf, A});
-  Builder.insert(Relation{C, index::SymbolRole::RelationChildOf, A});
-  Builder.insert(Relation{D, index::SymbolRole::RelationChildOf, B});
-  Builder.insert(Relatio

[PATCH] D68981: [clangd] Use our own relation kind.

2019-10-15 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments.



Comment at: clang-tools-extra/clangd/index/MemIndex.h:72
   // A map from (subject, predicate) pair to objects.
-  llvm::DenseMap, std::vector>
+  llvm::DenseMap, std::vector>
   Relations;

kadircet wrote:
> can we rather use `uint8_t` in here instead of `RelationKind` to get rid of 
> the `DenseMapInfo` specialization completely?
Yes, done.



Comment at: clang-tools-extra/clangd/index/Relation.h:22
 
+enum class RelationKind : uint8_t {
+  BaseOf,

kadircet wrote:
> is this clang-formatted ?
yes, note that I'm leaving a trailing "," on purpose, to prevent clang-format 
the whole structure into one-line.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68981



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


[PATCH] D68978: [clangd] Propagate main context into ClangdServer

2019-10-15 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

  Bulid results are available at 
http://results.llvm-merge-guard.org/Phabricator-39

See http://jenkins.llvm-merge-guard.org/job/Phabricator/39/ for more details.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68978



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


[PATCH] D67763: [Clang FE] Recognize -mnop-mcount CL option

2019-10-15 Thread Jonas Paulsson via Phabricator via cfe-commits
jonpa added a reviewer: bkramer.
jonpa added a comment.

@Benjamin: I see that you removed the option that I am now putting back, so 
perhaps you could take a look and see if this patch looks ok? Thanks. /Jonas


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

https://reviews.llvm.org/D67763



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


[PATCH] D68981: [clangd] Use our own relation kind.

2019-10-15 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments.



Comment at: clang-tools-extra/clangd/index/MemIndex.cpp:95
 LookupRequest LookupReq;
-auto It = Relations.find(std::make_pair(Subject, Req.Predicate));
+auto It = Relations.find(std::make_pair(Subject, (uint8_t)Req.Predicate));
 if (It != Relations.end()) {

`static_cast<>`



Comment at: clang-tools-extra/clangd/index/MemIndex.h:75
+  static_assert(sizeof(RelationKind) == sizeof(uint8_t),
+"use a mismatch type of RelationKind");
+  llvm::DenseMap, std::vector> 
Relations;

"RelationKind should be of same size as a uint8_t"



Comment at: llvm/include/llvm/ADT/DenseMapInfo.h:70
 
+// Provide DenseMapInfo for unsign chars.
+template <> struct DenseMapInfo {

s/unsign/unsigned/



Comment at: llvm/include/llvm/ADT/DenseMapInfo.h:74
+  static inline unsigned char getTombstoneKey() { return ~0 - 1; }
+  static unsigned getHashValue(const char &Val) { return Val * 37U; }
+

s/unsigned/unsigned char/
s/char/unsigned char/



Comment at: llvm/include/llvm/ADT/DenseMapInfo.h:76
+
+  static bool isEqual(const char &LHS, const char &RHS) { return LHS == RHS; }
+};

s/char/unsigned char/


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68981



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


r374899 - Revert 374882 "[Concepts] Concept Specialization Expressions"

2019-10-15 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue Oct 15 07:46:39 2019
New Revision: 374899

URL: http://llvm.org/viewvc/llvm-project?rev=374899&view=rev
Log:
Revert 374882 "[Concepts] Concept Specialization Expressions"

This reverts commit ec87b003823d63f3342cf648f55a134c1522e612.
The test fails on Windows, see e.g.
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/11533/steps/stage%201%20check/logs/stdio

Also revert follow-up r374893.

Added:
cfe/trunk/test/CXX/concepts-ts/
cfe/trunk/test/CXX/concepts-ts/dcl.dcl/
cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/
cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/
cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp
cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p2.cpp
cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp
cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p6.cpp
cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p7.cpp
cfe/trunk/test/CXX/concepts-ts/dcl.dcl/lit.cfg.py
cfe/trunk/test/CXX/concepts-ts/expr/
cfe/trunk/test/CXX/concepts-ts/expr/expr.prim/
cfe/trunk/test/CXX/concepts-ts/expr/expr.prim/expr.prim.id/
cfe/trunk/test/CXX/concepts-ts/expr/expr.prim/expr.prim.id/p3.cpp
cfe/trunk/test/CXX/concepts-ts/temp/
cfe/trunk/test/CXX/concepts-ts/temp/temp.constr/
cfe/trunk/test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/

cfe/trunk/test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/class-template-decl.cpp
Removed:
cfe/trunk/lib/Sema/SemaConcept.cpp
cfe/trunk/test/CXX/expr/expr.prim/expr.prim.id/
cfe/trunk/test/CXX/temp/temp.constr/
cfe/trunk/test/PCH/cxx2a-concept-specialization-expr.cpp
Modified:
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/StmtNodes.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/AST/ExprCXX.cpp
cfe/trunk/lib/AST/ExprClassification.cpp
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/Frontend/FrontendActions.cpp
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/lib/Sema/CMakeLists.txt
cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
cfe/trunk/test/Parser/cxx2a-concept-declaration.cpp
cfe/trunk/tools/libclang/CXCursor.cpp

Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=374899&r1=374898&r2=374899&view=diff
==
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Tue Oct 15 07:46:39 2019
@@ -17,7 +17,6 @@
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclBase.h"
 #include "clang/AST/DeclCXX.h"
-#include "clang/AST/DeclTemplate.h"
 #include "clang/AST/DeclarationName.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/NestedNameSpecifier.h"
@@ -57,7 +56,6 @@ class IdentifierInfo;
 class LambdaCapture;
 class NonTypeTemplateParmDecl;
 class TemplateParameterList;
-class Sema;
 
 //======//
 // C++ Expressions.
@@ -4752,125 +4750,6 @@ public:
   }
 };
 
-/// \brief Represents the specialization of a concept - evaluates to a prvalue
-/// of type bool.
-///
-/// According to C++2a [expr.prim.id]p3 an id-expression that denotes the
-/// specialization of a concept results in a prvalue of type bool.
-class ConceptSpecializationExpr final : public Expr,
-  private llvm::TrailingObjects {
-  friend class ASTStmtReader;
-  friend TrailingObjects;
-
-  // \brief The optional nested name specifier used when naming the concept.
-  NestedNameSpecifierLoc NestedNameSpec;
-
-  /// \brief The location of the template keyword, if specified when naming the
-  /// concept.
-  SourceLocation TemplateKWLoc;
-
-  /// \brief The location of the concept name in the expression.
-  SourceLocation ConceptNameLoc;
-
-  /// \brief The declaration found by name lookup when the expression was
-  /// created.
-  /// Can differ from NamedConcept when, for example, the concept was found
-  /// through a UsingShadowDecl.
-  NamedDecl *FoundDecl;
-
-  /// \brief The concept named, and whether or not the concept with the given
-  /// arguments was satisfied when the expression was created.
-  /// If any of the template arg

[PATCH] D68981: [clangd] Use our own relation kind.

2019-10-15 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 225037.
hokein marked 5 inline comments as done.
hokein added a comment.

address comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68981

Files:
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/index/Index.h
  clang-tools-extra/clangd/index/MemIndex.cpp
  clang-tools-extra/clangd/index/MemIndex.h
  clang-tools-extra/clangd/index/Relation.cpp
  clang-tools-extra/clangd/index/Relation.h
  clang-tools-extra/clangd/index/Serialization.cpp
  clang-tools-extra/clangd/index/Serialization.h
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/index/YAMLSerialization.cpp
  clang-tools-extra/clangd/index/dex/Dex.cpp
  clang-tools-extra/clangd/index/dex/Dex.h
  clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp
  clang-tools-extra/clangd/unittests/DexTests.cpp
  clang-tools-extra/clangd/unittests/FileIndexTests.cpp
  clang-tools-extra/clangd/unittests/IndexTests.cpp
  clang-tools-extra/clangd/unittests/SerializationTests.cpp
  clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
  clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
  llvm/include/llvm/ADT/DenseMapInfo.h

Index: llvm/include/llvm/ADT/DenseMapInfo.h
===
--- llvm/include/llvm/ADT/DenseMapInfo.h
+++ llvm/include/llvm/ADT/DenseMapInfo.h
@@ -67,6 +67,17 @@
   }
 };
 
+// Provide DenseMapInfo for unsigned chars.
+template <> struct DenseMapInfo {
+  static inline unsigned char getEmptyKey() { return ~0; }
+  static inline unsigned char getTombstoneKey() { return ~0 - 1; }
+  static unsigned getHashValue(const unsigned char &Val) { return Val * 37U; }
+
+  static bool isEqual(const unsigned char &LHS, const unsigned char &RHS) {
+return LHS == RHS;
+  }
+};
+
 // Provide DenseMapInfo for unsigned shorts.
 template <> struct DenseMapInfo {
   static inline unsigned short getEmptyKey() { return 0x; }
Index: clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
===
--- clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
+++ clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
@@ -482,7 +482,7 @@
   std::vector Result;
   RelationsRequest Req;
   Req.Subjects.insert(Subject);
-  Req.Predicate = index::SymbolRole::RelationBaseOf;
+  Req.Predicate = RelationKind::BaseOf;
   Index->relations(Req,
[&Result](const SymbolID &Subject, const Symbol &Object) {
  Result.push_back(Object.ID);
Index: clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
===
--- clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
+++ clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
@@ -673,8 +673,7 @@
   const Symbol &Base = findSymbol(Symbols, "Base");
   const Symbol &Derived = findSymbol(Symbols, "Derived");
   EXPECT_THAT(Relations,
-  Contains(Relation{Base.ID, index::SymbolRole::RelationBaseOf,
-Derived.ID}));
+  Contains(Relation{Base.ID, RelationKind::BaseOf, Derived.ID}));
 }
 
 TEST_F(SymbolCollectorTest, References) {
Index: clang-tools-extra/clangd/unittests/SerializationTests.cpp
===
--- clang-tools-extra/clangd/unittests/SerializationTests.cpp
+++ clang-tools-extra/clangd/unittests/SerializationTests.cpp
@@ -152,9 +152,9 @@
   SymbolID Base = cantFail(SymbolID::fromStr("6481EE7AF2841756"));
   SymbolID Derived = cantFail(SymbolID::fromStr("6512AEC512EA3A2D"));
   ASSERT_TRUE(bool(ParsedYAML->Relations));
-  EXPECT_THAT(*ParsedYAML->Relations,
-  UnorderedElementsAre(
-  Relation{Base, index::SymbolRole::RelationBaseOf, Derived}));
+  EXPECT_THAT(
+  *ParsedYAML->Relations,
+  UnorderedElementsAre(Relation{Base, RelationKind::BaseOf, Derived}));
 }
 
 std::vector YAMLFromSymbols(const SymbolSlab &Slab) {
Index: clang-tools-extra/clangd/unittests/IndexTests.cpp
===
--- clang-tools-extra/clangd/unittests/IndexTests.cpp
+++ clang-tools-extra/clangd/unittests/IndexTests.cpp
@@ -83,20 +83,15 @@
   SymbolID D{"D"};
 
   RelationSlab::Builder Builder;
-  Builder.insert(Relation{A, index::SymbolRole::RelationBaseOf, B});
-  Builder.insert(Relation{A, index::SymbolRole::RelationBaseOf, C});
-  Builder.insert(Relation{B, index::SymbolRole::RelationBaseOf, D});
-  Builder.insert(Relation{C, index::SymbolRole::RelationBaseOf, D});
-  Builder.insert(Relation{B, index::SymbolRole::RelationChildOf, A});
-  Builder.insert(Relation{C, index::SymbolRole::RelationChildOf, A});
-  Builder.insert(Relation{D, index::SymbolRole::RelationChildOf, B});
-  Builder.insert(Relation{D, index::SymbolRole::RelationChildOf, C});

[PATCH] D68978: [clangd] Propagate main context into ClangdServer

2019-10-15 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments.



Comment at: clang-tools-extra/clangd/ClangdLSPServer.h:135
 
+  // Since initialization of CDBs and ClangdServer is done lazily, the 
following
+  // context captures the one used while creating ClangdLSPServer and passes it

NIT: Use tripple slash comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68978



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


[PATCH] D68117: [DWARF-5] Support for C++11 defaulted, deleted member functions.

2019-10-15 Thread Sourabh Singh Tomar via Phabricator via cfe-commits
SouraVX added a comment.

In D68117#1708115 , @dblaikie wrote:

> In D68117#1708114 , @SouraVX wrote:
>
> > In D68117#1707680 , @dblaikie 
> > wrote:
> >
> > > In D68117#1707578 , @SouraVX 
> > > wrote:
> > >
> > > > In D68117#1702595 , @probinson 
> > > > wrote:
> > > >
> > > > > We really do want to pack the four mutually exclusive cases into two 
> > > > > bits.  I have tried to give more explicit comments inline to explain 
> > > > > how you would do this.  It really should work fine, recognizing that 
> > > > > the "not defaulted" case is not explicitly represented in the textual 
> > > > > IR because it uses a zero value in the defaulted/deleted subfield of 
> > > > > SPFlags.
> > > >
> > > >
> > > > Thanks Paul, for suggesting this. Your approach works fine. But as I 
> > > > was working on some lvm-dwarfdump test cases. We seems to miss one 
> > > > corner case --
> > > >  Consider this test case;
> > > >  class foo{
> > > >
> > > >   foo() = default;
> > > >   ~foo() = default;
> > > >void not_special() {}
> > > >
> > > > };
> > > >  void not_a_member_of_foo(){}
> > > >
> > > > Now I'm getting DW_AT_defaulted getting emitted with value 
> > > > DW_DEFAULTED_no, for functions "not_special" and "not_a_member_of_foo". 
> > > > This behavior is undesirable since, DW_AT_defaulted attributes is only 
> > > > valid for C++ special member functions{Constructors/Destructors, ...}.
> > > >
> > > > Please correct me if I'm wrong -- Now This attributes to- implicitly 
> > > > defined "0" NotDefaulted bit.  which is getting checked{that's fine as 
> > > > long as we have a dedicated bits for distinguishing} and true for every 
> > > > subprogram or function in a CU.
> > > >  void DwarfUnit::applySubprogramAttributes( ...
> > > >  ...
> > > >  else if (SP->isNotDefaulted())
> > > >
> > > >   addUInt(SPDie, dwarf::DW_AT_defaulted, dwarf::DW_FORM_data1,
> > > >   dwarf::DW_DEFAULTED_no);
> > > >
> > > > ...
> > >
> > >
> > > Perhaps we should only emit DEFAULTED_yes, and assume anything that's not 
> > > DEFAULTED_yes, is... not defaulted?
> > >
> > > Also: What features is anyone planning to build with this information? 
> > > I'm sort of inclined not to implement features without some use-case in 
> > > mind/planned.
> >
> >
> > Hi David, thanks for your suggestion. But, if we do that way, we may not be 
> > able to capture it's location and, whether that function was defaulted in 
> > or out of class.
>
>
> Not sure I follow - for an out-of-class defaulting, I'd expect the 
> non-defining (declaration) DW_TAG_subprogram inside the class to not have the 
> DW_AT_defaulted attribute - and then the out of line definition would have 
> DW_AT_defaulted = DEFAULTED_yes. For an inline defaulted definition, the 
> non-defining DW_TAG_subprogram would have DW_AT_defaulted= DEFAULTED_yes, and 
> the defining DW_TAG_subprogram would have no DW_AT_defaulted, it would 
> inherit it from the declaration via DW_AT_specification.
>
> > Regarding the intent behind doing this, we have an initial internal 
> > requirement for 100% compliance towards DWARF-5 from producer{Clang} side.
>
> I'd like to discuss that requirement a bit further - obviously I'm not your 
> management/customers/etc, so I may not be able to sway you, but I don't 
> believe absence of DW_AT_defaulted would classify as DWARFv5 non-conformance 
> to me.
>
> Producing, say, debug_ranges instead of debug_rnglists (both in terms of teh 
> section used, and the format of the bytes in that section) would be 
> non-conformant. But DWARF only suggests what some forms/attributes/etc might 
> be useful for, it doesn't require them by any means.
>
> Any idea what the particular motivation for compliance is? So you/we could 
> evaluate whether this feature is meeting a need or not?


Hi David, 
I did some digging about DW_AT_defaulted and stuff, not much of a success but. 
Here's what I found -- http://dwarfstd.org/Issues.php?type=closed4  -- here 
it;s still marked as open, not sure what that means. Abbreviations on this page 
doesn't describe what "open" meant. But since, it's already in DWARF5 Spec -- 
it must be accepted.

Their's not much information available behind the suggestion or intention for 
adding this feature to Spec. http://dwarfstd.org/ShowIssue.php?issue=141215.3  
-- I think Paul can better provide remarks on this one.

GCC and GDB side of things-- I've checked GCC-9.2.0 implements this feature, 
but didn't noticed any use of this feature from GDB side{GDB.8.3}. It's merely 
declaration of the forms available. GCC's implementation  doesn't emit 
DW_DEFAULTED_no -- skipping DW_AT_defaulted attribute for that function. 
Current  GCC implementation addresses in_class, out_of_class attributes and 
of_course DW_AT_deleted.

Regarding my patch

[PATCH] D68981: [clangd] Use our own relation kind.

2019-10-15 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 225039.
hokein added a comment.

fix a missing static_cast.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68981

Files:
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/index/Index.h
  clang-tools-extra/clangd/index/MemIndex.cpp
  clang-tools-extra/clangd/index/MemIndex.h
  clang-tools-extra/clangd/index/Relation.cpp
  clang-tools-extra/clangd/index/Relation.h
  clang-tools-extra/clangd/index/Serialization.cpp
  clang-tools-extra/clangd/index/Serialization.h
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/index/YAMLSerialization.cpp
  clang-tools-extra/clangd/index/dex/Dex.cpp
  clang-tools-extra/clangd/index/dex/Dex.h
  clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp
  clang-tools-extra/clangd/unittests/DexTests.cpp
  clang-tools-extra/clangd/unittests/FileIndexTests.cpp
  clang-tools-extra/clangd/unittests/IndexTests.cpp
  clang-tools-extra/clangd/unittests/SerializationTests.cpp
  clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
  clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
  llvm/include/llvm/ADT/DenseMapInfo.h

Index: llvm/include/llvm/ADT/DenseMapInfo.h
===
--- llvm/include/llvm/ADT/DenseMapInfo.h
+++ llvm/include/llvm/ADT/DenseMapInfo.h
@@ -67,6 +67,17 @@
   }
 };
 
+// Provide DenseMapInfo for unsigned chars.
+template <> struct DenseMapInfo {
+  static inline unsigned char getEmptyKey() { return ~0; }
+  static inline unsigned char getTombstoneKey() { return ~0 - 1; }
+  static unsigned getHashValue(const unsigned char &Val) { return Val * 37U; }
+
+  static bool isEqual(const unsigned char &LHS, const unsigned char &RHS) {
+return LHS == RHS;
+  }
+};
+
 // Provide DenseMapInfo for unsigned shorts.
 template <> struct DenseMapInfo {
   static inline unsigned short getEmptyKey() { return 0x; }
Index: clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
===
--- clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
+++ clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
@@ -482,7 +482,7 @@
   std::vector Result;
   RelationsRequest Req;
   Req.Subjects.insert(Subject);
-  Req.Predicate = index::SymbolRole::RelationBaseOf;
+  Req.Predicate = RelationKind::BaseOf;
   Index->relations(Req,
[&Result](const SymbolID &Subject, const Symbol &Object) {
  Result.push_back(Object.ID);
Index: clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
===
--- clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
+++ clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
@@ -673,8 +673,7 @@
   const Symbol &Base = findSymbol(Symbols, "Base");
   const Symbol &Derived = findSymbol(Symbols, "Derived");
   EXPECT_THAT(Relations,
-  Contains(Relation{Base.ID, index::SymbolRole::RelationBaseOf,
-Derived.ID}));
+  Contains(Relation{Base.ID, RelationKind::BaseOf, Derived.ID}));
 }
 
 TEST_F(SymbolCollectorTest, References) {
Index: clang-tools-extra/clangd/unittests/SerializationTests.cpp
===
--- clang-tools-extra/clangd/unittests/SerializationTests.cpp
+++ clang-tools-extra/clangd/unittests/SerializationTests.cpp
@@ -152,9 +152,9 @@
   SymbolID Base = cantFail(SymbolID::fromStr("6481EE7AF2841756"));
   SymbolID Derived = cantFail(SymbolID::fromStr("6512AEC512EA3A2D"));
   ASSERT_TRUE(bool(ParsedYAML->Relations));
-  EXPECT_THAT(*ParsedYAML->Relations,
-  UnorderedElementsAre(
-  Relation{Base, index::SymbolRole::RelationBaseOf, Derived}));
+  EXPECT_THAT(
+  *ParsedYAML->Relations,
+  UnorderedElementsAre(Relation{Base, RelationKind::BaseOf, Derived}));
 }
 
 std::vector YAMLFromSymbols(const SymbolSlab &Slab) {
Index: clang-tools-extra/clangd/unittests/IndexTests.cpp
===
--- clang-tools-extra/clangd/unittests/IndexTests.cpp
+++ clang-tools-extra/clangd/unittests/IndexTests.cpp
@@ -83,20 +83,15 @@
   SymbolID D{"D"};
 
   RelationSlab::Builder Builder;
-  Builder.insert(Relation{A, index::SymbolRole::RelationBaseOf, B});
-  Builder.insert(Relation{A, index::SymbolRole::RelationBaseOf, C});
-  Builder.insert(Relation{B, index::SymbolRole::RelationBaseOf, D});
-  Builder.insert(Relation{C, index::SymbolRole::RelationBaseOf, D});
-  Builder.insert(Relation{B, index::SymbolRole::RelationChildOf, A});
-  Builder.insert(Relation{C, index::SymbolRole::RelationChildOf, A});
-  Builder.insert(Relation{D, index::SymbolRole::RelationChildOf, B});
-  Builder.insert(Relation{D, index::SymbolRole::RelationChildOf, C});
+  Builder.insert(Relation{A, R

[clang-tools-extra] r374901 - [clangd][NFC] Update comments to use triple-slashes

2019-10-15 Thread Kadir Cetinkaya via cfe-commits
Author: kadircet
Date: Tue Oct 15 07:59:08 2019
New Revision: 374901

URL: http://llvm.org/viewvc/llvm-project?rev=374901&view=rev
Log:
[clangd][NFC] Update comments to use triple-slashes

Modified:
clang-tools-extra/trunk/clangd/ClangdLSPServer.h

Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.h?rev=374901&r1=374900&r2=374901&view=diff
==
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.h (original)
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.h Tue Oct 15 07:59:08 2019
@@ -132,9 +132,10 @@ private:
   void publishDiagnostics(const URIForFile &File,
   std::vector Diagnostics);
 
-  // Since initialization of CDBs and ClangdServer is done lazily, the 
following
-  // context captures the one used while creating ClangdLSPServer and passes it
-  // to above mentioned object instances to make sure they share the same 
state.
+  /// Since initialization of CDBs and ClangdServer is done lazily, the
+  /// following context captures the one used while creating ClangdLSPServer 
and
+  /// passes it to above mentioned object instances to make sure they share the
+  /// same state.
   Context BackgroundContext;
 
   /// Used to indicate that the 'shutdown' request was received from the


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


[PATCH] D68981: [clangd] Use our own relation kind.

2019-10-15 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

  Bulid results are available at 
http://results.llvm-merge-guard.org/Phabricator-40

See http://jenkins.llvm-merge-guard.org/job/Phabricator/40/ for more details.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68981



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


[PATCH] D68981: [clangd] Use our own relation kind.

2019-10-15 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 225041.
hokein added a comment.

more static_cast


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68981

Files:
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/index/Index.h
  clang-tools-extra/clangd/index/MemIndex.cpp
  clang-tools-extra/clangd/index/MemIndex.h
  clang-tools-extra/clangd/index/Relation.cpp
  clang-tools-extra/clangd/index/Relation.h
  clang-tools-extra/clangd/index/Serialization.cpp
  clang-tools-extra/clangd/index/Serialization.h
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/index/YAMLSerialization.cpp
  clang-tools-extra/clangd/index/dex/Dex.cpp
  clang-tools-extra/clangd/index/dex/Dex.h
  clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp
  clang-tools-extra/clangd/unittests/DexTests.cpp
  clang-tools-extra/clangd/unittests/FileIndexTests.cpp
  clang-tools-extra/clangd/unittests/IndexTests.cpp
  clang-tools-extra/clangd/unittests/SerializationTests.cpp
  clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
  clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
  llvm/include/llvm/ADT/DenseMapInfo.h

Index: llvm/include/llvm/ADT/DenseMapInfo.h
===
--- llvm/include/llvm/ADT/DenseMapInfo.h
+++ llvm/include/llvm/ADT/DenseMapInfo.h
@@ -67,6 +67,17 @@
   }
 };
 
+// Provide DenseMapInfo for unsigned chars.
+template <> struct DenseMapInfo {
+  static inline unsigned char getEmptyKey() { return ~0; }
+  static inline unsigned char getTombstoneKey() { return ~0 - 1; }
+  static unsigned getHashValue(const unsigned char &Val) { return Val * 37U; }
+
+  static bool isEqual(const unsigned char &LHS, const unsigned char &RHS) {
+return LHS == RHS;
+  }
+};
+
 // Provide DenseMapInfo for unsigned shorts.
 template <> struct DenseMapInfo {
   static inline unsigned short getEmptyKey() { return 0x; }
Index: clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
===
--- clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
+++ clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp
@@ -482,7 +482,7 @@
   std::vector Result;
   RelationsRequest Req;
   Req.Subjects.insert(Subject);
-  Req.Predicate = index::SymbolRole::RelationBaseOf;
+  Req.Predicate = RelationKind::BaseOf;
   Index->relations(Req,
[&Result](const SymbolID &Subject, const Symbol &Object) {
  Result.push_back(Object.ID);
Index: clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
===
--- clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
+++ clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
@@ -673,8 +673,7 @@
   const Symbol &Base = findSymbol(Symbols, "Base");
   const Symbol &Derived = findSymbol(Symbols, "Derived");
   EXPECT_THAT(Relations,
-  Contains(Relation{Base.ID, index::SymbolRole::RelationBaseOf,
-Derived.ID}));
+  Contains(Relation{Base.ID, RelationKind::BaseOf, Derived.ID}));
 }
 
 TEST_F(SymbolCollectorTest, References) {
Index: clang-tools-extra/clangd/unittests/SerializationTests.cpp
===
--- clang-tools-extra/clangd/unittests/SerializationTests.cpp
+++ clang-tools-extra/clangd/unittests/SerializationTests.cpp
@@ -152,9 +152,9 @@
   SymbolID Base = cantFail(SymbolID::fromStr("6481EE7AF2841756"));
   SymbolID Derived = cantFail(SymbolID::fromStr("6512AEC512EA3A2D"));
   ASSERT_TRUE(bool(ParsedYAML->Relations));
-  EXPECT_THAT(*ParsedYAML->Relations,
-  UnorderedElementsAre(
-  Relation{Base, index::SymbolRole::RelationBaseOf, Derived}));
+  EXPECT_THAT(
+  *ParsedYAML->Relations,
+  UnorderedElementsAre(Relation{Base, RelationKind::BaseOf, Derived}));
 }
 
 std::vector YAMLFromSymbols(const SymbolSlab &Slab) {
Index: clang-tools-extra/clangd/unittests/IndexTests.cpp
===
--- clang-tools-extra/clangd/unittests/IndexTests.cpp
+++ clang-tools-extra/clangd/unittests/IndexTests.cpp
@@ -83,20 +83,15 @@
   SymbolID D{"D"};
 
   RelationSlab::Builder Builder;
-  Builder.insert(Relation{A, index::SymbolRole::RelationBaseOf, B});
-  Builder.insert(Relation{A, index::SymbolRole::RelationBaseOf, C});
-  Builder.insert(Relation{B, index::SymbolRole::RelationBaseOf, D});
-  Builder.insert(Relation{C, index::SymbolRole::RelationBaseOf, D});
-  Builder.insert(Relation{B, index::SymbolRole::RelationChildOf, A});
-  Builder.insert(Relation{C, index::SymbolRole::RelationChildOf, A});
-  Builder.insert(Relation{D, index::SymbolRole::RelationChildOf, B});
-  Builder.insert(Relation{D, index::SymbolRole::RelationChildOf, C});
+  Builder.insert(Relation{A, RelationKin

[PATCH] D68981: [clangd] Use our own relation kind.

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

Thanks, LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68981



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


[PATCH] D67159: [clang] New __attribute__((__clang_arm_mve_alias)).

2019-10-15 Thread Simon Tatham via Phabricator via cfe-commits
simon_tatham added a comment.

Thanks for the review!

(I expect to leave this uncommitted until I have enough other patches approved 
to make it actually useful, and then commit them all together.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67159



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


[PATCH] D68981: [clangd] Use our own relation kind.

2019-10-15 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

  Bulid results are available at 
http://results.llvm-merge-guard.org/Phabricator-41

See http://jenkins.llvm-merge-guard.org/job/Phabricator/41/ for more details.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68981



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


r374903 - [Concepts] Concept Specialization Expressions

2019-10-15 Thread Saar Raz via cfe-commits
Author: saar.raz
Date: Tue Oct 15 08:24:26 2019
New Revision: 374903

URL: http://llvm.org/viewvc/llvm-project?rev=374903&view=rev
Log:
[Concepts] Concept Specialization Expressions

Part of C++20 Concepts implementation effort. Added Concept Specialization 
Expressions that are created when a concept is refe$

D41217 on Phabricator.

(recommit after fixing failing Parser test on windows)


Added:
cfe/trunk/lib/Sema/SemaConcept.cpp
cfe/trunk/test/CXX/expr/expr.prim/expr.prim.id/
cfe/trunk/test/CXX/expr/expr.prim/expr.prim.id/p3.cpp
cfe/trunk/test/CXX/temp/temp.constr/
cfe/trunk/test/CXX/temp/temp.constr/temp.constr.decl/
cfe/trunk/test/CXX/temp/temp.constr/temp.constr.decl/class-template-decl.cpp
cfe/trunk/test/PCH/cxx2a-concept-specialization-expr.cpp
Removed:
cfe/trunk/test/CXX/concepts-ts/
Modified:
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/StmtNodes.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/AST/ExprCXX.cpp
cfe/trunk/lib/AST/ExprClassification.cpp
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/Frontend/FrontendActions.cpp
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/lib/Sema/CMakeLists.txt
cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
cfe/trunk/test/Parser/cxx2a-concept-declaration.cpp
cfe/trunk/tools/libclang/CXCursor.cpp

Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=374903&r1=374902&r2=374903&view=diff
==
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Tue Oct 15 08:24:26 2019
@@ -17,6 +17,7 @@
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclBase.h"
 #include "clang/AST/DeclCXX.h"
+#include "clang/AST/DeclTemplate.h"
 #include "clang/AST/DeclarationName.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/NestedNameSpecifier.h"
@@ -56,6 +57,7 @@ class IdentifierInfo;
 class LambdaCapture;
 class NonTypeTemplateParmDecl;
 class TemplateParameterList;
+class Sema;
 
 //======//
 // C++ Expressions.
@@ -4750,6 +4752,125 @@ public:
   }
 };
 
+/// \brief Represents the specialization of a concept - evaluates to a prvalue
+/// of type bool.
+///
+/// According to C++2a [expr.prim.id]p3 an id-expression that denotes the
+/// specialization of a concept results in a prvalue of type bool.
+class ConceptSpecializationExpr final : public Expr,
+  private llvm::TrailingObjects {
+  friend class ASTStmtReader;
+  friend TrailingObjects;
+
+  // \brief The optional nested name specifier used when naming the concept.
+  NestedNameSpecifierLoc NestedNameSpec;
+
+  /// \brief The location of the template keyword, if specified when naming the
+  /// concept.
+  SourceLocation TemplateKWLoc;
+
+  /// \brief The location of the concept name in the expression.
+  SourceLocation ConceptNameLoc;
+
+  /// \brief The declaration found by name lookup when the expression was
+  /// created.
+  /// Can differ from NamedConcept when, for example, the concept was found
+  /// through a UsingShadowDecl.
+  NamedDecl *FoundDecl;
+
+  /// \brief The concept named, and whether or not the concept with the given
+  /// arguments was satisfied when the expression was created.
+  /// If any of the template arguments are dependent (this expr would then be
+  /// isValueDependent()), this bit is to be ignored.
+  llvm::PointerIntPair NamedConcept;
+
+  /// \brief The template argument list source info used to specialize the
+  /// concept.
+  const ASTTemplateArgumentListInfo *ArgsAsWritten = nullptr;
+
+  /// \brief The number of template arguments in the tail-allocated list of
+  /// converted template arguments.
+  unsigned NumTemplateArgs;
+
+  ConceptSpecializationExpr(ASTContext &C, NestedNameSpecifierLoc NNS,
+SourceLocation TemplateKWLoc,
+SourceLocation ConceptNameLoc, NamedDecl 
*FoundDecl,
+ConceptDecl *NamedConcept,
+const ASTTemplateArgumentListInfo *ArgsAsWritten,
+ArrayRef ConvertedArgs,
+Optional IsSatisfied);
+
+  ConceptSpecializationEx

[PATCH] D68981: [clangd] Use our own relation kind.

2019-10-15 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

  Bulid results are available at 
http://results.llvm-merge-guard.org/Phabricator-43

See http://jenkins.llvm-merge-guard.org/job/Phabricator/43/ for more details.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68981



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


[PATCH] D68697: [DWARF5] Added support for DW_AT_noreturn attribute to be emitted for C++ class member functions.

2019-10-15 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

LGTM with updated testcase, thanks!




Comment at: llvm/test/DebugInfo/X86/noreturn_cpp11.ll:59
 
-attributes #0 = { noreturn }
+attributes #0 = { noinline noreturn optnone uwtable 
"correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" 
"frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" 
"no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" 
"no-signed-zeros-fp-math"="false" "no-trapping-math"="false" 
"stack-protector-buffer-size"="8" "target-cpu"="x86-64" 
"target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" 
"use-soft-float"="false" }
+attributes #1 = { noinline nounwind optnone uwtable 
"correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" 
"frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" 
"no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" 
"no-signed-zeros-fp-math"="false" "no-trapping-math"="false" 
"stack-protector-buffer-size"="8" "target-cpu"="x86-64" 
"target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" 
"use-soft-float"="false" }

Please remove all stringified attributes that aren't strictly necessary for the 
test.


Repository:
  rC Clang

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

https://reviews.llvm.org/D68697



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


[PATCH] D68981: [clangd] Use our own relation kind.

2019-10-15 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

  Bulid results are available at 
http://results.llvm-merge-guard.org/Phabricator-42

See http://jenkins.llvm-merge-guard.org/job/Phabricator/42/ for more details.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68981



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


[PATCH] D68720: Support -fstack-clash-protection for x86

2019-10-15 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 225049.
serge-sans-paille added a comment.

Get rid of static mapping + update test cases


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68720

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/DiagnosticFrontendKinds.td
  clang/include/clang/Basic/TargetInfo.h
  clang/include/clang/Driver/CC1Options.td
  clang/include/clang/Driver/Options.td
  clang/lib/Basic/Targets/X86.h
  clang/lib/CodeGen/CGStmt.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/stack-clash-protection.c
  clang/test/Driver/stack-clash-protection.c
  llvm/docs/ReleaseNotes.rst
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/lib/Target/X86/X86CallFrameOptimization.cpp
  llvm/lib/Target/X86/X86FrameLowering.cpp
  llvm/lib/Target/X86/X86FrameLowering.h
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86ISelLowering.h
  llvm/lib/Target/X86/X86InstrCompiler.td
  llvm/lib/Target/X86/X86InstrInfo.td
  llvm/test/CodeGen/X86/stack-clash-dynamic-alloca.ll
  llvm/test/CodeGen/X86/stack-clash-medium-natural-probes.ll
  llvm/test/CodeGen/X86/stack-clash-medium.ll
  llvm/test/CodeGen/X86/stack-clash-no-free-probe.ll
  llvm/test/CodeGen/X86/stack-clash-small.ll

Index: llvm/test/CodeGen/X86/stack-clash-small.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/stack-clash-small.ll
@@ -0,0 +1,25 @@
+; RUN: llc < %s | FileCheck %s
+
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32 @foo() local_unnamed_addr #0 {
+; CHECK-LABEL: foo:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:  subq	$280, %rsp # imm = 0x118
+; CHECK-NEXT:  .cfi_def_cfa_offset 288
+; CHECK-NEXT:  movl	$1, 264(%rsp)
+; CHECK-NEXT:  movl	-128(%rsp), %eax
+; CHECK-NEXT:  addq	$280, %rsp # imm = 0x118
+; CHECK-NEXT:  .cfi_def_cfa_offset 8
+; CHECK-NEXT:  retq
+
+  %a = alloca i32, i64 100, align 16
+  %b = getelementptr inbounds i32, i32* %a, i64 98
+  store volatile i32 1, i32* %b
+  %c = load volatile i32, i32* %a
+  ret i32 %c
+}
+
+attributes #0 =  {"probe-stack"="inline-asm"}
Index: llvm/test/CodeGen/X86/stack-clash-no-free-probe.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/stack-clash-no-free-probe.ll
@@ -0,0 +1,27 @@
+; RUN: llc < %s | FileCheck %s
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32 @foo(i64 %i) local_unnamed_addr #0 {
+; CHECK-LABEL: foo:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:  subq	$4096, %rsp # imm = 0x1000
+; CHECK-NEXT:  movq	$0, (%rsp)
+; CHECK-NEXT:  subq	$3784, %rsp # imm = 0xEC8
+; CHECK-NEXT:  .cfi_def_cfa_offset 7888
+; CHECK-NEXT:  movl	$1, -128(%rsp,%rdi,4)
+; CHECK-NEXT:  movl	-128(%rsp), %eax
+; CHECK-NEXT:  addq	$7880, %rsp # imm = 0x1EC8
+; CHECK-NEXT:  .cfi_def_cfa_offset 8
+; CHECK-NEXT:  retq
+
+  %a = alloca i32, i32 2000, align 16
+  %b = getelementptr inbounds i32, i32* %a, i64 %i
+  store volatile i32 1, i32* %b
+  %c = load volatile i32, i32* %a
+  ret i32 %c
+}
+
+attributes #0 =  {"probe-stack"="inline-asm"}
+
Index: llvm/test/CodeGen/X86/stack-clash-medium.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/stack-clash-medium.ll
@@ -0,0 +1,28 @@
+; RUN: llc < %s | FileCheck %s
+
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32 @foo() local_unnamed_addr #0 {
+
+; CHECK-LABEL: foo:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:  subq	$4096, %rsp # imm = 0x1000
+; CHECK-NEXT:  .cfi_def_cfa_offset 7888
+; CHECK-NEXT:  movl	$1, 880(%rsp)
+; CHECK-NEXT:  subq	$3784, %rsp # imm = 0xEC8
+; CHECK-NEXT:  movq	$0, (%rsp)
+; CHECK-NEXT:  movl	-128(%rsp), %eax
+; CHECK-NEXT:  addq	$7880, %rsp # imm = 0x1EC8
+; CHECK-NEXT:  .cfi_def_cfa_offset 8
+; CHECK-NEXT:  retq
+
+  %a = alloca i32, i64 2000, align 16
+  %b = getelementptr inbounds i32, i32* %a, i64 1198
+  store volatile i32 1, i32* %b
+  %c = load volatile i32, i32* %a
+  ret i32 %c
+}
+
+attributes #0 =  {"probe-stack"="inline-asm"}
Index: llvm/test/CodeGen/X86/stack-clash-medium-natural-probes.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/stack-clash-medium-natural-probes.ll
@@ -0,0 +1,31 @@
+; RUN: llc < %s | FileCheck %s
+
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32 @foo() local_unnamed_addr #0 {
+
+; CHECK-LABEL: foo:
+; CHECK: # %bb.0:
+; CHECK-NEXT: 	 subq	$4096, %rsp # imm = 0x1000
+; CHECK-NEXT: 	 .cfi_def_cfa_offset 7888
+; CHECK-NEXT: 	 movl	$1, 264(%rsp)

r374907 - [Concepts] Remove unused and illegal Sema includes from ExprCXX.cpp

2019-10-15 Thread Saar Raz via cfe-commits
Author: saar.raz
Date: Tue Oct 15 08:49:29 2019
New Revision: 374907

URL: http://llvm.org/viewvc/llvm-project?rev=374907&view=rev
Log:
[Concepts] Remove unused and illegal Sema includes from ExprCXX.cpp

Fixing accidental includes introduced in 374903

Modified:
cfe/trunk/lib/AST/ExprCXX.cpp

Modified: cfe/trunk/lib/AST/ExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprCXX.cpp?rev=374907&r1=374906&r2=374907&view=diff
==
--- cfe/trunk/lib/AST/ExprCXX.cpp (original)
+++ cfe/trunk/lib/AST/ExprCXX.cpp Tue Oct 15 08:49:29 2019
@@ -28,9 +28,6 @@
 #include "clang/Basic/OperatorKinds.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Specifiers.h"
-#include "clang/Sema/Template.h"
-#include "clang/Sema/SemaDiagnostic.h"
-#include "clang/Sema/Sema.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -1761,4 +1758,4 @@ ConceptSpecializationExpr::Create(ASTCon
   void *Buffer = C.Allocate(totalSizeToAlloc(
 NumTemplateArgs));
   return new (Buffer) ConceptSpecializationExpr(Empty, NumTemplateArgs);
-}
\ No newline at end of file
+}


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


[PATCH] D68697: [DWARF5] Added support for DW_AT_noreturn attribute to be emitted for C++ class member functions.

2019-10-15 Thread Sourabh Singh Tomar via Phabricator via cfe-commits
SouraVX updated this revision to Diff 225052.
SouraVX added a comment.

Thanks Adrian for review!
Addressing your review comments.


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

https://reviews.llvm.org/D68697

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  llvm/test/DebugInfo/X86/noreturn_cpp11.ll

Index: llvm/test/DebugInfo/X86/noreturn_cpp11.ll
===
--- llvm/test/DebugInfo/X86/noreturn_cpp11.ll
+++ llvm/test/DebugInfo/X86/noreturn_cpp11.ll
@@ -2,56 +2,88 @@
 ; REQUIRES: object-emission
 
 ; Generated by clang++ -S -c -std=c++11 --emit-llvm -g from the following C++11 source:
-; [[ noreturn ]] void f() {
-;   throw 1;
-; }
+;class foo {
+;[[noreturn]] void foo_member(){throw 1;}
+;};
+;
+;[[ noreturn ]] void f() {
+;throw 1;
+;}
+;
+;void func(){
+;foo object;
+;}
 
 ; CHECK: DW_TAG_subprogram
 ; CHECK-NOT: DW_TAG
 ; CHECK: DW_AT_name{{.*}}"f"
 ; CHECK-NOT: DW_TAG
 ; CHECK: DW_AT_noreturn
-
+; CHECK: DW_TAG_class_type
+; CHECK: DW_TAG_subprogram
+; CHECK: DW_AT_name{{.*}}"foo_member"
+; CHECK: DW_AT_noreturn
 ; ModuleID = 'test.cpp'
-source_filename = "test.cpp"
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+source_filename = "noreturn1.cpp"
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
-@_ZTIi = external constant i8*
+%class.foo = type { i8 }
 
-; Function Attrs: noreturn
-define void @_Z1fv() #0 !dbg !6 {
-entry:
-  %exception = call i8* @__cxa_allocate_exception(i64 4) #1, !dbg !9
-  %0 = bitcast i8* %exception to i32*, !dbg !9
-  store i32 1, i32* %0, align 16, !dbg !9
-  call void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) #2, !dbg !10
-  unreachable, !dbg !9
+@_ZTIi = external dso_local constant i8*
 
-return:   ; No predecessors!
-  ret void, !dbg !12
+; Function Attrs: noinline noreturn optnone uwtable
+define dso_local void @_Z1fv() #0 !dbg !7 {
+  %1 = call i8* @__cxa_allocate_exception(i64 4) #3, !dbg !10
+  %2 = bitcast i8* %1 to i32*, !dbg !10
+  store i32 1, i32* %2, align 16, !dbg !10
+  call void @__cxa_throw(i8* %1, i8* bitcast (i8** @_ZTIi to i8*), i8* null) #4, !dbg !10
+  unreachable, !dbg !10
 }
 
-declare i8* @__cxa_allocate_exception(i64)
+declare dso_local i8* @__cxa_allocate_exception(i64)
+
+declare dso_local void @__cxa_throw(i8*, i8*, i8*)
+
+; Function Attrs: noinline nounwind optnone uwtable
+define dso_local void @_Z4funcv() #1 !dbg !11 {
+  %1 = alloca %class.foo, align 1
+  call void @llvm.dbg.declare(metadata %class.foo* %1, metadata !12, metadata !DIExpression()), !dbg !19
+  ret void, !dbg !20
+}
 
-declare void @__cxa_throw(i8*, i8*, i8*)
+; Function Attrs: nounwind readnone speculatable willreturn
+declare void @llvm.dbg.declare(metadata, metadata, metadata) #2
 
-attributes #0 = { noreturn }
+attributes #0 = { noinline noreturn optnone uwtable }
+attributes #1 = { noinline nounwind optnone uwtable }
+attributes #2 = { nounwind readnone speculatable willreturn }
+attributes #3 = { nounwind }
+attributes #4 = { noreturn }
 
 !llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4}
-!llvm.ident = !{!5}
+!llvm.module.flags = !{!3, !4, !5}
+!llvm.ident = !{!6}
 
-!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 4.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
-!1 = !DIFile(filename: "test.cpp", directory: "/home/del/test")
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_11, file: !1, producer: "clang version 10.0.0 (https://github.com/llvm/llvm-project.git 3fcdd25ad5566114ac3322dcbf71d3c38bfec1ed)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
+!1 = !DIFile(filename: "test.cpp", directory: "/home/sourabh/work/dwarf/c_c++/c++11")
 !2 = !{}
 !3 = !{i32 2, !"Dwarf Version", i32 4}
 !4 = !{i32 2, !"Debug Info Version", i32 3}
-!5 = !{!"clang version 4.0.0"}
-!6 = distinct !DISubprogram(name: "f", linkageName: "_Z1fv", scope: !1, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped | DIFlagNoReturn, isOptimized: false, unit: !0, retainedNodes: !2)
-!7 = !DISubroutineType(types: !8)
-!8 = !{null}
-!9 = !DILocation(line: 2, column: 5, scope: !6)
-!10 = !DILocation(line: 2, column: 5, scope: !11)
-!11 = !DILexicalBlockFile(scope: !6, file: !1, discriminator: 1)
-!12 = !DILocation(line: 3, column: 1, scope: !6)
+!5 = !{i32 1, !"wchar_size", i32 4}
+!6 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git 3fcdd25ad5566114ac3322dcbf71d3c38bfec1ed)"}
+!7 = distinct !DISubprogram(name: "f", linkageName: "_Z1fv", scope: !1, file: !1, line: 5, type: !8, scopeLine: 5, flags: DIFlagPrototyped | DIFlagNoReturn, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
+!8 = !DISubroutineType(types: !9)
+!9 = !{null}
+!10 =

[PATCH] D68697: [DWARF5] Added support for DW_AT_noreturn attribute to be emitted for C++ class member functions.

2019-10-15 Thread Sourabh Singh Tomar via Phabricator via cfe-commits
SouraVX marked 2 inline comments as done.
SouraVX added inline comments.



Comment at: llvm/test/DebugInfo/X86/noreturn_cpp11.ll:59
 
-attributes #0 = { noreturn }
+attributes #0 = { noinline noreturn optnone uwtable 
"correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" 
"frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" 
"no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" 
"no-signed-zeros-fp-math"="false" "no-trapping-math"="false" 
"stack-protector-buffer-size"="8" "target-cpu"="x86-64" 
"target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" 
"use-soft-float"="false" }
+attributes #1 = { noinline nounwind optnone uwtable 
"correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" 
"frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" 
"no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" 
"no-signed-zeros-fp-math"="false" "no-trapping-math"="false" 
"stack-protector-buffer-size"="8" "target-cpu"="x86-64" 
"target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" 
"use-soft-float"="false" }

aprantl wrote:
> Please remove all stringified attributes that aren't strictly necessary for 
> the test.
Done!


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

https://reviews.llvm.org/D68697



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


[PATCH] D68697: [DWARF5] Added support for DW_AT_noreturn attribute to be emitted for C++ class member functions.

2019-10-15 Thread Sourabh Singh Tomar via Phabricator via cfe-commits
SouraVX marked an inline comment as done.
SouraVX added a comment.

In D68697#1709680 , @SouraVX wrote:

> Thanks Adrian for review!
>  Addressing your review comments.


Could you please commit these changes for me, Thanks!


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

https://reviews.llvm.org/D68697



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


[PATCH] D68391: [RISCV] Improve sysroot computation if no GCC install detected

2019-10-15 Thread Sam Elliott via Phabricator via cfe-commits
lenary added a comment.

In D68391#1694622 , @edward-jones 
wrote:

> Rebased and added tests
>
> I've made this use the Triple from the driver rather than the parsed LLVM 
> triple, this means the Triple doesn't get normalized which seems like more 
> desirable behavior.


Yeah, using the user-provided triple seems the correct choice, as the user will 
expect it to match the directory name. Would be useful to add a comment saying 
something along the same lines where you do that.

> I've added to the riscv{32,64}-toolchain.c test files, however the added 
> tests cannot be run without a shell so I've had to disable those tests on 
> Windows. If necessary I can split these new tests out into separate files.

I think splitting the tests might be sensible, so that we can run as many as 
possible on platforms without a shell/windows.

> I realize that there don't appear to be any tests for the case where no GCC 
> install is found and no sysroot is provided to the driver. At the moment this 
> will result in a generic linker command using the system linker, such as:
> 
> /usr/bin/ld crt0.o crtbegin.o ... -lgcc crtend.o
> 
> Is this the desired behaviour? And if so should a test be added for this too?

I think defaulting to root if no sysroot/gcc install is found is better than 
erroring. In all likelihood a compile/link task will fail anyway because it 
cannot link the results together. In the case where the compile/link does work, 
then there's no issue. It would be useful to have a test for this.

In D68391#1707652 , @luismarques wrote:

> This is indeed an issue that would be nice to fix, I've often been annoyed by 
> clang just defaulting to the root when some misconfiguration occurs. I have 
> to wonder though, this patch only changes the clang RISC-V toolchain driver, 
> but the problem isn't specific to RISC-V. Couldn't this tweak be generalized 
> and made to apply to multiple/all target drivers?


I think that for baremetal risc-v, we can change this default without asking 
the wider community. For other targets, someone should email cfe-dev first with 
the proposal. I agree it makes sense, but I also imagine it could break a lot 
of builds unexpectedly.


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

https://reviews.llvm.org/D68391



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


[PATCH] D68818: [hip][cuda] Fix the extended lambda name mangling issue.

2019-10-15 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

@rsmith Richard, could you take a look, please? Lambdas, mangling, ODR rules & 
ABI scare me. :-)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68818



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


[PATCH] D68818: [hip][cuda] Fix the extended lambda name mangling issue.

2019-10-15 Thread Michael Liao via Phabricator via cfe-commits
hliao added a comment.

In D68818#1709688 , @tra wrote:

> @rsmith Richard, could you take a look, please? Lambdas, mangling, ODR rules 
> & ABI scare me. :-)


@tra thanks for promoting the review. This patch is quite critical to support 
extended lambda in clang. We have several workloads that have this mangle 
numbering issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68818



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


[PATCH] D68554: [clang-format] Proposal for clang-format to give compiler style warnings

2019-10-15 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

In D68554#1709316 , @sylvestre.ledru 
wrote:

> @MyDeveloperDay I think it should be added to the release notes. it is a 
> great new changes for clang format (it would have made my life at Mozilla 
> much easier ;)


I agree, to be honest, I like the way clang-tidy does their release notes, that 
new items are announced, I think it would be useful here to just say a few 
sentences about new features.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68554



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


[PATCH] D68969: [clang-format] Remove the dependency on frontend

2019-10-15 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

In D68969#1709321 , @klimek wrote:

> My intuitive solution would have been to get the char* for the start and 
> end-location and then search forward and backwards for \n.


I may need to, it feels slow for large files which I suspect is in the 
splitting, which will be mostly unnecessary.


Repository:
  rC Clang

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

https://reviews.llvm.org/D68969



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


[PATCH] D67985: CFI: wrong type passed to llvm.type.test with multiple inheritance devirtualization

2019-10-15 Thread Dmitry Mikulin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG034badb312be: CFI: wrong type passed to llvm.type.test with 
multiple inheritance… (authored by dmikulin).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67985

Files:
  clang/lib/CodeGen/CGExprCXX.cpp
  clang/test/CodeGenCXX/cfi-multiple-inheritance.cpp
  compiler-rt/test/cfi/multiple-inheritance2.cpp


Index: compiler-rt/test/cfi/multiple-inheritance2.cpp
===
--- /dev/null
+++ compiler-rt/test/cfi/multiple-inheritance2.cpp
@@ -0,0 +1,38 @@
+// Test that virtual functions of the derived class can be called through
+// pointers of both base classes without CFI errors.
+// Related to Bugzilla 43390.
+
+// RUN: %clangxx_cfi -o %t1 %s
+// RUN: %run %t1 2>&1 | FileCheck --check-prefix=CFI %s
+
+// CFI: In f1
+// CFI: In f2
+// CFI-NOT: control flow integrity check
+
+// REQUIRES: cxxabi
+
+#include 
+
+class A1 {
+public:
+virtual void f1() = 0;
+};
+
+class A2 {
+public:
+virtual void f2() = 0;
+};
+
+
+class B : public A1, public A2 {
+public:
+void f2() final { fprintf(stderr, "In f2\n"); }
+void f1() final { fprintf(stderr, "In f1\n"); }
+};
+
+int main() {
+B b;
+
+static_cast(&b)->f1();
+static_cast(&b)->f2();
+}
Index: clang/test/CodeGenCXX/cfi-multiple-inheritance.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/cfi-multiple-inheritance.cpp
@@ -0,0 +1,31 @@
+// Test that correct vtable ptr and type metadata are passed to llvm.type.test
+// Related to Bugzilla 43390.
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -fvisibility hidden -std=c++11 
-fsanitize=cfi-nvcall -emit-llvm -o - %s | FileCheck %s
+
+class A1 {
+public:
+virtual int f1() = 0;
+};
+
+class A2 {
+public:
+virtual int f2() = 0;
+};
+
+
+class B : public A1, public A2 {
+public:
+int f2() final { return 1; }
+int f1() final { return 2; }
+};
+
+// CHECK-LABEL: define hidden i32 @_Z3foov
+int foo() {
+B b;
+return static_cast(&b)->f2();
+// CHECK: [[P:%[^ ]*]] = bitcast %class.B* %b to i8**
+// CHECK: [[V:%[^ ]*]] = load i8*, i8** [[P]], align 8
+// CHECK: call i1 @llvm.type.test(i8* [[V]], metadata !"_ZTS1B")
+// CHECK: call i1 @llvm.type.test(i8* [[V]], metadata !"all-vtables")
+}
Index: clang/lib/CodeGen/CGExprCXX.cpp
===
--- clang/lib/CodeGen/CGExprCXX.cpp
+++ clang/lib/CodeGen/CGExprCXX.cpp
@@ -382,7 +382,7 @@
   const CXXRecordDecl *RD;
   std::tie(VTable, RD) =
   CGM.getCXXABI().LoadVTablePtr(*this, This.getAddress(),
-MD->getParent());
+CalleeDecl->getParent());
   EmitVTablePtrCheckForCall(RD, VTable, CFITCK_NVCall, CE->getBeginLoc());
 }
 


Index: compiler-rt/test/cfi/multiple-inheritance2.cpp
===
--- /dev/null
+++ compiler-rt/test/cfi/multiple-inheritance2.cpp
@@ -0,0 +1,38 @@
+// Test that virtual functions of the derived class can be called through
+// pointers of both base classes without CFI errors.
+// Related to Bugzilla 43390.
+
+// RUN: %clangxx_cfi -o %t1 %s
+// RUN: %run %t1 2>&1 | FileCheck --check-prefix=CFI %s
+
+// CFI: In f1
+// CFI: In f2
+// CFI-NOT: control flow integrity check
+
+// REQUIRES: cxxabi
+
+#include 
+
+class A1 {
+public:
+virtual void f1() = 0;
+};
+
+class A2 {
+public:
+virtual void f2() = 0;
+};
+
+
+class B : public A1, public A2 {
+public:
+void f2() final { fprintf(stderr, "In f2\n"); }
+void f1() final { fprintf(stderr, "In f1\n"); }
+};
+
+int main() {
+B b;
+
+static_cast(&b)->f1();
+static_cast(&b)->f2();
+}
Index: clang/test/CodeGenCXX/cfi-multiple-inheritance.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/cfi-multiple-inheritance.cpp
@@ -0,0 +1,31 @@
+// Test that correct vtable ptr and type metadata are passed to llvm.type.test
+// Related to Bugzilla 43390.
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -fvisibility hidden -std=c++11 -fsanitize=cfi-nvcall -emit-llvm -o - %s | FileCheck %s
+
+class A1 {
+public:
+virtual int f1() = 0;
+};
+
+class A2 {
+public:
+virtual int f2() = 0;
+};
+
+
+class B : public A1, public A2 {
+public:
+int f2() final { return 1; }
+int f1() final { return 2; }
+};
+
+// CHECK-LABEL: define hidden i32 @_Z3foov
+int foo() {
+B b;
+return static_cast(&b)->f2();
+// CHECK: [[P:%[^ ]*]] = bitcast %class.B* %b to i8**
+// CHECK: [[V:%[^ ]*]] = load i8*, i8** [[P]], align 8
+// CHECK: call i1 @llvm.type.test(i8* [[V]], metadata !"_ZTS1B")
+// CHECK: call i1 @llvm.type.test(i8* [[V]], metadata !"all-vtables")
+}
Index: clang/

r374909 - CFI: wrong type passed to llvm.type.test with multiple inheritance devirtualization.

2019-10-15 Thread Dmitry Mikulin via cfe-commits
Author: dmikulin
Date: Tue Oct 15 09:32:50 2019
New Revision: 374909

URL: http://llvm.org/viewvc/llvm-project?rev=374909&view=rev
Log:
CFI: wrong type passed to llvm.type.test with multiple inheritance 
devirtualization.

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

Added:
cfe/trunk/test/CodeGenCXX/cfi-multiple-inheritance.cpp
Modified:
cfe/trunk/lib/CodeGen/CGExprCXX.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=374909&r1=374908&r2=374909&view=diff
==
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Tue Oct 15 09:32:50 2019
@@ -382,7 +382,7 @@ RValue CodeGenFunction::EmitCXXMemberOrO
   const CXXRecordDecl *RD;
   std::tie(VTable, RD) =
   CGM.getCXXABI().LoadVTablePtr(*this, This.getAddress(),
-MD->getParent());
+CalleeDecl->getParent());
   EmitVTablePtrCheckForCall(RD, VTable, CFITCK_NVCall, CE->getBeginLoc());
 }
 

Added: cfe/trunk/test/CodeGenCXX/cfi-multiple-inheritance.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/cfi-multiple-inheritance.cpp?rev=374909&view=auto
==
--- cfe/trunk/test/CodeGenCXX/cfi-multiple-inheritance.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/cfi-multiple-inheritance.cpp Tue Oct 15 09:32:50 
2019
@@ -0,0 +1,31 @@
+// Test that correct vtable ptr and type metadata are passed to llvm.type.test
+// Related to Bugzilla 43390.
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -fvisibility hidden -std=c++11 
-fsanitize=cfi-nvcall -emit-llvm -o - %s | FileCheck %s
+
+class A1 {
+public:
+virtual int f1() = 0;
+};
+
+class A2 {
+public:
+virtual int f2() = 0;
+};
+
+
+class B : public A1, public A2 {
+public:
+int f2() final { return 1; }
+int f1() final { return 2; }
+};
+
+// CHECK-LABEL: define hidden i32 @_Z3foov
+int foo() {
+B b;
+return static_cast(&b)->f2();
+// CHECK: [[P:%[^ ]*]] = bitcast %class.B* %b to i8**
+// CHECK: [[V:%[^ ]*]] = load i8*, i8** [[P]], align 8
+// CHECK: call i1 @llvm.type.test(i8* [[V]], metadata !"_ZTS1B")
+// CHECK: call i1 @llvm.type.test(i8* [[V]], metadata !"all-vtables")
+}


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


[PATCH] D68117: [DWARF-5] Support for C++11 defaulted, deleted member functions.

2019-10-15 Thread Paul Robinson via Phabricator via cfe-commits
probinson added a comment.

In D68117#1709557 , @SouraVX wrote:

> Hi David, 
>  I did some digging about DW_AT_defaulted and stuff, not much of a success 
> but. Here's what I found -- http://dwarfstd.org/Issues.php?type=closed4  -- 
> here it;s still marked as open, not sure what that means. Abbreviations on 
> this page doesn't describe what "open" meant. But since, it's already in 
> DWARF5 Spec -- it must be accepted.


"open" here means the web page wasn't updated correctly. :-)  Yes, it was 
accepted and incorporated into DWARF 5, see 
http://dwarfstd.org/ShowIssue.php?issue=141215.3 (notes at the bottom).

> Their's not much information available behind the suggestion or intention for 
> adding this feature to Spec. http://dwarfstd.org/ShowIssue.php?issue=141215.3 
>  -- I think Paul can better provide remarks on this one.

"It affects overload resolution" according to my record of the DWARF meeting 
where we discussed this.  Although "overload" resolution might not be the 
technically correct term.  Deleted is different from omitted, when trying to 
determine what to do with a particular source-language expression.

> GCC and GDB side of things-- I've checked GCC-9.2.0 implements this feature, 
> but didn't noticed any use of this feature from GDB side{GDB.8.3}. It's 
> merely declaration of the forms available. GCC's implementation  doesn't emit 
> DW_DEFAULTED_no -- skipping DW_AT_defaulted attribute for that function. 
> Current  GCC implementation addresses in_class, out_of_class attributes and 
> of_course DW_AT_deleted.
> 
> Regarding my patch and whether we should add this in clang/llvm--
>  Please correct me, in case I'm mistaken. David are you suggesting that, may 
> be just "DW_DEFAULTED_yes"  can suffice our needs instead of using the Spec 
> {in_class, out_of_class, DEFAULTED_no}. We could do that, that would incur 
> mostly adding a custom "DW_DEFAULTED_yes" {non-conflicting to Spec} opcode in 
> LLVM, Not sure about this to addition to LLVM ??. 
>  Or we can choose same approach as GCC.
>  Please share your thoughts on this. which direction should we choose ?? Or 
> you guys have altogether something different in mind.

I don't see any problem with omitting the attribute instead of explicitly 
saying DEFAULTED_no.  There is no DW_DEFAULTED_yes, if we provide the attribute 
at all it would have to distinguish in-class vs out-of-class in order to 
conform.  I know the compiler does treat them a little differently depending on 
in-class vs out-of-class; if nothing else, in-class is inlined more 
aggressively and might not have an out-of-line instance at all.  This might 
matter to a debugger trying to support source-language expression evaluation.


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

https://reviews.llvm.org/D68117



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


[PATCH] D68997 [Modules] Allow searching for prebuilt implicit modules

2019-10-15 Thread Alexandre Rames via cfe-commits
Hello,

This is a proposal to allow searching for "implicit modules" in the prebuilt 
module cache paths.

https://reviews.llvm.org/D68997 

The current command-line options for prebuilt modules do not allow to easily
maintain and use multiple versions of modules. Both the producer and users of
prebuilt modules are required to know the relationships between compilation
options and module file paths. Using a particular version of a prebuilt module
requires passing a particular option on the command line (e.g.
-fmodule-file=[=] or -fprebuilt-module-path=).

However the compiler already knows how to distinguish and automatically locate
implicit modules. Hence this proposal to introduce the
-fprebuilt-implicit-modules option. When set, it enables searching for
implicit modules in the prebuilt module paths (specified via
-fprebuilt-module-path). To not modify existing behavior, this search takes
place after the standard search for prebuilt modules. If not

Here is a workflow illustrating how both the producer and consumer of prebuilt
modules would need to know what versions of prebuilt modules are available and
where they are located.

clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo 
-fmodules-cache-path=prebuilt_modules_v1 
clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo 
-fmodules-cache-path=prebuilt_modules_v2 
clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo 
-fmodules-cache-path=prebuilt_modules_v3 

clang -cc1 -x c use.c -fmodules fmodule-map-file=modulemap 
-fprebuilt-module-path=prebuilt_modules_v1 
clang -cc1 -x c use.c -fmodules fmodule-map-file=modulemap 
With prebuilt implicit modules, the producer can generate prebuilt modules as
usual, all in the same output directory. The same mechanisms as for implicit
modules take care of incorporating hashes in the path to distinguish between
module versions.

Note that we do not specify the output module filename, so -o implicit modules 
are generated in the cache path prebuilt_modules.

clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo 
-fmodules-cache-path=prebuilt_modules 
clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo 
-fmodules-cache-path=prebuilt_modules 
clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo 
-fmodules-cache-path=prebuilt_modules 
The user can now simply enable prebuilt implicit modules and point to the
prebuilt modules cache. No need to "parse" command-line options to decide
what prebuilt modules (paths) to use.

clang -cc1 -x c use.c -fmodules fmodule-map-file=modulemap 
-fprebuilt-module-path=prebuilt_modules -fprebuilt-implicit-modules 
clang -cc1 -x c use.c -fmodules fmodule-map-file=modulemap 
-fprebuilt-module-path=prebuilt_modules -fprebuilt-implicit-modules 

This is for example particularly useful in a use-case where compilation is
expensive, and the configurations expected to be used are predictable, but not
controlled by the producer of prebuilt modules. Modules for the set of
predictable configurations can be prebuilt, and using them does not require
"parsing" the configuration (command-line options).

Regards,

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


[PATCH] D68997: Allow searching for prebuilt implicit modules.

2019-10-15 Thread Alexandre Rames via Phabricator via cfe-commits
arames created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
arames edited the summary of this revision.
arames added reviewers: bruno, rsmith.
Herald added a subscriber: dexonsmith.

The behavior is controlled by the `-fprebuilt-implicit-modules` option, and
allows searching for implicit modules in the prebuilt module cache paths.

The current command-line options for prebuilt modules do not allow to easily
maintain and use multiple versions of modules. Both the producer and users of
prebuilt modules are required to know the relationships between compilation
options and module file paths. Using a particular version of a prebuilt module
requires passing a particular option on the command line (e.g.
`-fmodule-file=[=]` or `-fprebuilt-module-path=`).

However the compiler already knows how to distinguish and automatically locate
implicit modules. Hence this proposal to introduce the
`-fprebuilt-implicit-modules` option. When set, it enables searching for
implicit modules in the prebuilt module paths (specified via
`-fprebuilt-module-path`). To not modify existing behavior, this search takes
place after the standard search for prebuilt modules. If not

Here is a workflow illustrating how both the producer and consumer of prebuilt
modules would need to know what versions of prebuilt modules are available and
where they are located.

  clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo 
-fmodules-cache-path=prebuilt_modules_v1 
  clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo 
-fmodules-cache-path=prebuilt_modules_v2 
  clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo 
-fmodules-cache-path=prebuilt_modules_v3 
  
  clang -cc1 -x c use.c -fmodules fmodule-map-file=modulemap 
-fprebuilt-module-path=prebuilt_modules_v1 
  clang -cc1 -x c use.c -fmodules fmodule-map-file=modulemap 

With prebuilt implicit modules, the producer can generate prebuilt modules as
usual, all in the same output directory. The same mechanisms as for implicit
modules take care of incorporating hashes in the path to distinguish between
module versions.

Note that we do not specify the output module filename, so `-o` implicit 
modules are generated in the cache path `prebuilt_modules`.

  clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo 
-fmodules-cache-path=prebuilt_modules 
  clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo 
-fmodules-cache-path=prebuilt_modules 
  clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo 
-fmodules-cache-path=prebuilt_modules 

The user can now simply enable prebuilt implicit modules and point to the
prebuilt modules cache. No need to "parse" command-line options to decide
what prebuilt modules (paths) to use.

  clang -cc1 -x c use.c -fmodules fmodule-map-file=modulemap 
-fprebuilt-module-path=prebuilt_modules -fprebuilt-implicit-modules 
  clang -cc1 -x c use.c -fmodules fmodule-map-file=modulemap 
-fprebuilt-module-path=prebuilt_modules -fprebuilt-implicit-modules 


This is for example particularly useful in a use-case where compilation is
expensive, and the configurations expected to be used are predictable, but not
controlled by the producer of prebuilt modules. Modules for the set of
predictable configurations can be prebuilt, and using them does not require
"parsing" the configuration (command-line options).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68997

Files:
  clang/docs/Modules.rst
  clang/include/clang/Driver/Options.td
  clang/include/clang/Lex/HeaderSearch.h
  clang/include/clang/Lex/HeaderSearchOptions.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInstance.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Lex/HeaderSearch.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/Modules/Inputs/prebuilt-implicit-module/a.h
  clang/test/Modules/Inputs/prebuilt-implicit-module/module.modulemap
  clang/test/Modules/prebuilt-implicit-modules.m

Index: clang/test/Modules/prebuilt-implicit-modules.m
===
--- /dev/null
+++ clang/test/Modules/prebuilt-implicit-modules.m
@@ -0,0 +1,27 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -x objective-c -fmodules %S/Inputs/prebuilt-implicit-module/module.modulemap -emit-module -fmodule-name=module_a -fmodules-cache-path=%t
+// RUN: find %t -name "module_a*.pcm" | grep module_a
+//
+// Check we use a prebuilt module when available, and do not build an implicit module.
+// RUN: rm -rf %t1
+// RUN: mkdir -p %t1
+// RUN: %clang_cc1 -x objective-c %s -I%S/Inputs/prebuilt-implicit-module -fmodules -fmodule-map-file=%S/Inputs/prebuilt-implicit-module/module.modulemap -fprebuilt-implicit-modules -fprebuilt-module-path=%t -fmodules-cache-path=%t1
+// RUN: find %t1 -name "module_a*.pcm" | not grep module_e
+//
+// Check that we correctly fall back to implicit modules if the 

[PATCH] D67508: [RISCV] support mutilib in baremetal environment

2019-10-15 Thread Kuan Hsu Chen via Phabricator via cfe-commits
khchen marked 2 inline comments as done.
khchen added inline comments.



Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:1521
+  {"rv32i", "ilp32"},{"rv32im", "ilp32"}, {"rv32iac", "ilp32"},
+  {"rv32imac", "ilp32"}, {"rv32imafc", "ilp32f"}, {"rv64i", "lp64"},
+  {"rv64imac", "lp64"},  {"rv64imafdc", "lp64d"}};

lenary wrote:
> I cannot see `march=rv64i/mabi=lp64` in [[ 
> https://github.com/riscv/riscv-gcc/blob/ed3f6ec/gcc/config/riscv/t-elf-multilib
>  | riscv-gcc t-elf-multilib ]] (the given sha is pulled from `.gitmodules` in 
> riscv-gcc-toolchain. 
fixed! thanks!


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

https://reviews.llvm.org/D67508



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


[PATCH] D67508: [RISCV] support mutilib in baremetal environment

2019-10-15 Thread Kuan Hsu Chen via Phabricator via cfe-commits
khchen updated this revision to Diff 225068.
khchen edited the summary of this revision.
khchen added a comment.

@lenary  Sorry, I don't have the plan to support `MULTILIB_REUSE` now. 
But if it's necessary to support it, I can do it later.


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

https://reviews.llvm.org/D67508

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/RISCVToolchain.cpp
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/crtbegin.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/crtend.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32i/ilp32/crtbegin.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32i/ilp32/crtend.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32iac/ilp32/crtbegin.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32iac/ilp32/crtend.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32im/ilp32/crtbegin.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32im/ilp32/crtend.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32imac/ilp32/crtbegin.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32imac/ilp32/crtend.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32imafc/ilp32f/crtbegin.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv32imafc/ilp32f/crtend.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv64imac/lp64/crtbegin.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv64imac/lp64/crtend.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv64imafdc/lp64d/crtbegin.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv64imafdc/lp64d/crtend.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk/riscv64-unknown-elf/bin/ld
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk/riscv64-unknown-elf/lib/crt0.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/riscv64-unknown-elf/lib/rv32i/ilp32/crt0.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/riscv64-unknown-elf/lib/rv32iac/ilp32/crt0.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/riscv64-unknown-elf/lib/rv32im/ilp32/crt0.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/riscv64-unknown-elf/lib/rv32imac/ilp32/crt0.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/riscv64-unknown-elf/lib/rv32imafc/ilp32f/crt0.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/riscv64-unknown-elf/lib/rv64imac/lp64/crt0.o
  
clang/test/Driver/Inputs/multilib_riscv_elf_sdk/riscv64-unknown-elf/lib/rv64imafdc/lp64d/crt0.o
  clang/test/Driver/riscv32-toolchain.c
  clang/test/Driver/riscv64-toolchain.c

Index: clang/test/Driver/riscv64-toolchain.c
===
--- clang/test/Driver/riscv64-toolchain.c
+++ clang/test/Driver/riscv64-toolchain.c
@@ -14,8 +14,8 @@
 // C-RV64-BAREMETAL-LP64: "--sysroot={{.*}}/Inputs/basic_riscv64_tree/riscv64-unknown-elf"
 // C-RV64-BAREMETAL-LP64: "{{.*}}/Inputs/basic_riscv64_tree/riscv64-unknown-elf/lib{{/|}}crt0.o"
 // C-RV64-BAREMETAL-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1{{/|}}crtbegin.o"
-// C-RV64-BAREMETAL-LP64: "-L{{.*}}/Inputs/basic_riscv64_tree/riscv64-unknown-elf/lib"
 // C-RV64-BAREMETAL-LP64: "-L{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1"
+// C-RV64-BAREMETAL-LP64: "-L{{.*}}/Inputs/basic_riscv64_tree/riscv64-unknown-elf/lib"
 // C-RV64-BAREMETAL-LP64: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc"
 // C-RV64-BAREMETAL-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1{{/|}}crtend.o"
 
@@ -29,8 +29,8 @@
 // C-RV64-BAREMETAL-NOSYSROOT-LP64: "{{.*}}Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1/../../../../bin{{/|}}riscv64-unknown-elf-ld"
 // C-RV64-BAREMETAL-NOSYSROOT-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1/../../../../riscv64-unknown-elf/lib{{/|}}crt0.o"
 // C-RV64-BAREMETAL-NOSYSROOT-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1{{/|}}crtbegin.o"
-// C-RV64-BAREMETAL-NOSYSROOT-LP64: "-L{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1/../../../../riscv64-unknown-elf{{/|}}lib"
 // C-RV64-BAREMETAL-NOSYSROOT-LP64: "-L{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1"
+// C-RV64-BAREMETAL-NOSYSROOT-LP64: "-L{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1/../../../../riscv64-unknown-elf{{/|}}lib"
 // C-RV64-BAREMETAL-NOSYSROOT-LP64: "--start-group" "-lc"

[PATCH] D69000: [clang-tidy] new check: modernize-deprecated-iterator-base

2019-10-15 Thread Nikita Kniazev via Phabricator via cfe-commits
nick created this revision.
nick added a reviewer: alexfh.
nick added a project: clang-tools-extra.
Herald added subscribers: cfe-commits, kristof.beyls, xazax.hun, mgorny.
Herald added a project: clang.

Finds deprecated in C++17 inheritance from `std::iterator` and replaces it with 
type aliases. The check itself is not marked as C++17 because it could be 
applied to any project with no harm.

---

Because of need to catch `CXXBaseSpecifier` I extended 
`clang::ast_type_traits`, but locally and in a hacky way. I would be glad if 
someone who knows `ASTMatcher` internals do add a proper `CXXBaseSpecifier` 
support.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69000

Files:
  clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
  clang-tools-extra/clang-tidy/modernize/DeprecatedIteratorBaseCheck.cpp
  clang-tools-extra/clang-tidy/modernize/DeprecatedIteratorBaseCheck.h
  clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  
clang-tools-extra/docs/clang-tidy/checks/modernize-deprecated-iterator-base.rst
  
clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-iterator-base.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-iterator-base.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-iterator-base.cpp
@@ -0,0 +1,321 @@
+// RUN: %check_clang_tidy %s modernize-deprecated-iterator-base %t 
+
+namespace std {
+using ptrdiff_t = int;
+struct input_iterator_tag;
+template 
+struct iterator {
+  using iterator_category = C;
+  using value_type= T;
+  using difference_type   = D;
+  using pointer   = P;
+  using reference = R;
+};
+}
+
+
+using iterator_alias = std::iterator;
+typedef std::iterator iterator_typedef;
+
+
+// Sugar
+
+// CHECK-FIXES: struct from_alias {
+// CHECK-MESSAGES: warning: inheriting from 'std::iterator' is deprecated [modernize-deprecated-iterator-base]
+struct from_alias: iterator_alias {};
+
+// CHECK-FIXES: struct from_typedef {
+// CHECK-MESSAGES: warning: inheriting from 'std::iterator' is deprecated [modernize-deprecated-iterator-base]
+struct from_typedef: iterator_typedef {};
+
+
+// False-positive
+
+// CHECK-FIXES: struct indirect_base: from_alias {};
+// CHECK-MESSAGES-NOT: warning: inheriting from 'std::iterator' is deprecated [modernize-deprecated-iterator-base]
+struct indirect_base: from_alias {};
+
+
+// Unsupported
+
+// CHECK-FIXES: class skipif_non_public_inheritance: iterator_alias {};
+// CHECK-MESSAGES: warning: inheriting from 'std::iterator' is deprecated [modernize-deprecated-iterator-base]
+class skipif_non_public_inheritance: iterator_alias {};
+
+
+// Base removal
+
+struct A {};
+struct B {};
+
+struct collection {
+  template 
+  struct iterator;
+};
+
+// CHECK-FIXES: template <> struct collection::iterator<> {
+// CHECK-MESSAGES: :[[@LINE+1]]:45: warning: inheriting from 'std::iterator' is deprecated [modernize-deprecated-iterator-base]
+template <> struct collection::iterator<> : iterator_alias {};
+// CHECK-FIXES: template <> struct collection::iterator : A {
+// CHECK-MESSAGES: :[[@LINE+1]]:49: warning: inheriting from 'std::iterator' is deprecated [modernize-deprecated-iterator-base]
+template <> struct collection::iterator : A, iterator_alias {};
+// CHECK-FIXES: template <> struct collection::iterator : B {
+// CHECK-MESSAGES: :[[@LINE+1]]:46: warning: inheriting from 'std::iterator' is deprecated [modernize-deprecated-iterator-base]
+template <> struct collection::iterator : iterator_alias, B {};
+// CHECK-FIXES: template <> struct collection::iterator : A, B {
+// CHECK-MESSAGES: :[[@LINE+1]]:52: warning: inheriting from 'std::iterator' is deprecated [modernize-deprecated-iterator-base]
+template <> struct collection::iterator : A, iterator_alias, B {};
+
+// CHECK-FIXES: struct do_not_strip_final final {
+// CHECK-MESSAGES: warning: inheriting from 'std::iterator' is deprecated [modernize-deprecated-iterator-base]
+struct do_not_strip_final final : iterator_alias {};
+
+// CHECK-FIXES: struct iteratorZ // iterator_alias
+// CHECK-FIXES: {
+// CHECK-MESSAGES: :[[@LINE+2]]:5: warning: inheriting from 'std::iterator' is deprecated [modernize-deprecated-iterator-base]
+struct iteratorZ   // iteratorZ
+  : iterator_alias // iterator_alias
+{};
+// CHECK-FIXES: struct iteratorA   // iteratorA
+// CHECK-FIXES:   : A // iterator_alias
+// CHECK-FIXES: {
+// CHECK-MESSAGES: :[[@LINE+3]]:5: warning: inheriting from 'std::iterator' is deprecated [modernize-deprecated-iterator-base]
+struct iteratorA   // iteratorA
+  : A  // A
+  , iterator_alias // iterator_alias
+{};
+// CHECK-FIXES: struct iteratorB   // iteratorB
+// CHECK-FIXES:   : B  // B
+// CHECK-FIXES: {
+// CHECK-MESSAGES: :[[@LINE+2]]:5: warning: inheriting from 'std::iterator' is deprec

[PATCH] D55125: [clang-tidy] Fix a false positive in misc-redundant-expression check

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

In D55125#1704397 , @dkrupp wrote:

> @aaron.ballman could you please commit? 
>  I don't have commit access. Thx.


I'm happy to do so, but the patch does not apply cleanly to trunk. Can you 
rebase? (Sorry for the delayed on applying the patch, I was traveling last week 
and didn't have access to the repo.)


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

https://reviews.llvm.org/D55125



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


r374926 - Reland [Driver] Fix -working-directory issues

2019-10-15 Thread Jan Korous via cfe-commits
Author: jkorous
Date: Tue Oct 15 10:51:59 2019
New Revision: 374926

URL: http://llvm.org/viewvc/llvm-project?rev=374926&view=rev
Log:
Reland [Driver] Fix -working-directory issues

Don't change the default VFS in Driver, update tests & reland.

This reverts commit 999f8a7416f8edc54ef92e715fd23c532bcc74d4.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/test/Driver/gen-cdb-fragment.c
cfe/trunk/test/Driver/working-directory.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=374926&r1=374925&r2=374926&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Tue Oct 15 10:51:59 
2019
@@ -91,6 +91,8 @@ def err_no_external_assembler : Error<
   "there is no external assembler that can be used on this platform">;
 def err_drv_unable_to_remove_file : Error<
   "unable to remove file: %0">;
+def err_drv_unable_to_set_working_directory : Error <
+  "unable to set working directory: %0">;
 def err_drv_command_failure : Error<
   "unable to execute command: %0">;
 def err_drv_invalid_darwin_version : Error<

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=374926&r1=374925&r2=374926&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Oct 15 10:51:59 2019
@@ -1012,6 +1012,11 @@ Compilation *Driver::BuildCompilation(Ar
 }
   }
 
+  // Check for working directory option before accessing any files
+  if (Arg *WD = Args.getLastArg(options::OPT_working_directory))
+if (VFS->setCurrentWorkingDirectory(WD->getValue()))
+  Diag(diag::err_drv_unable_to_set_working_directory) << WD->getValue();
+
   // FIXME: This stuff needs to go into the Compilation, not the driver.
   bool CCCPrintPhases;
 
@@ -1993,20 +1998,11 @@ bool Driver::DiagnoseInputExistence(cons
   if (Value == "-")
 return true;
 
-  SmallString<64> Path(Value);
-  if (Arg *WorkDir = Args.getLastArg(options::OPT_working_directory)) {
-if (!llvm::sys::path::is_absolute(Path)) {
-  SmallString<64> Directory(WorkDir->getValue());
-  llvm::sys::path::append(Directory, Value);
-  Path.assign(Directory);
-}
-  }
-
-  if (getVFS().exists(Path))
+  if (getVFS().exists(Value))
 return true;
 
   if (IsCLMode()) {
-if (!llvm::sys::path::is_absolute(Twine(Path)) &&
+if (!llvm::sys::path::is_absolute(Twine(Value)) &&
 llvm::sys::Process::FindInEnvPath("LIB", Value))
   return true;
 
@@ -2032,12 +2028,12 @@ bool Driver::DiagnoseInputExistence(cons
 if (getOpts().findNearest(Value, Nearest, IncludedFlagsBitmask,
   ExcludedFlagsBitmask) <= 1) {
   Diag(clang::diag::err_drv_no_such_file_with_suggestion)
-  << Path << Nearest;
+  << Value << Nearest;
   return false;
 }
   }
 
-  Diag(clang::diag::err_drv_no_such_file) << Path;
+  Diag(clang::diag::err_drv_no_such_file) << Value;
   return false;
 }
 

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=374926&r1=374925&r2=374926&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Tue Oct 15 10:51:59 2019
@@ -519,16 +519,15 @@ getFramePointerKind(const ArgList &Args,
 }
 
 /// Add a CC1 option to specify the debug compilation directory.
-static void addDebugCompDirArg(const ArgList &Args, ArgStringList &CmdArgs) {
+static void addDebugCompDirArg(const ArgList &Args, ArgStringList &CmdArgs,
+   const llvm::vfs::FileSystem &VFS) {
   if (Arg *A = Args.getLastArg(options::OPT_fdebug_compilation_dir)) {
 CmdArgs.push_back("-fdebug-compilation-dir");
 CmdArgs.push_back(A->getValue());
-  } else {
-SmallString<128> cwd;
-if (!llvm::sys::fs::current_path(cwd)) {
-  CmdArgs.push_back("-fdebug-compilation-dir");
-  CmdArgs.push_back(Args.MakeArgString(cwd));
-}
+  } else if (llvm::ErrorOr CWD =
+ VFS.getCurrentWorkingDirectory()) {
+CmdArgs.push_back("-fdebug-compilation-dir");
+CmdArgs.push_back(Args.MakeArgString(*CWD));
   }
 }
 
@@ -808,13 +807,8 @@ static void addPGOAndCoverageFlags(const
 else
   OutputFilename = llvm::sys::path::filename(Output.getBaseInput());
 SmallString<128> CoverageFilename = OutputFilename;
-if (llvm::sys::path::is_relative(CoverageFilename)) {
-  SmallString<128> Pwd;
-  if (!llv

r374929 - Fix Driver/working-directory.c test

2019-10-15 Thread Jan Korous via cfe-commits
Author: jkorous
Date: Tue Oct 15 11:04:18 2019
New Revision: 374929

URL: http://llvm.org/viewvc/llvm-project?rev=374929&view=rev
Log:
Fix Driver/working-directory.c test

Accidentally committed debug print.

Modified:
cfe/trunk/test/Driver/working-directory.c

Modified: cfe/trunk/test/Driver/working-directory.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/working-directory.c?rev=374929&r1=374928&r2=374929&view=diff
==
--- cfe/trunk/test/Driver/working-directory.c (original)
+++ cfe/trunk/test/Driver/working-directory.c Tue Oct 15 11:04:18 2019
@@ -1,7 +1,6 @@
 // RUN: %clang -### -coverage -working-directory /no/such/dir/ input 2>&1 | 
FileCheck %s
 // RUN: %clang -### -coverage -working-directory %p/Inputs no_such_file.cpp -c 
2>&1 | FileCheck %s --check-prefix=CHECK_NO_FILE
 // RUN: %clang -### -coverage -working-directory %p/Inputs pchfile.cpp -c 2>&1 
| FileCheck %s --check-prefix=CHECK_WORKS
-// RUN: fail please
 
 // CHECK: unable to set working directory: /no/such/dir/
 


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


r374932 - [clang] refactor -Wa,-W test cases.

2019-10-15 Thread Jian Cai via cfe-commits
Author: jcai19
Date: Tue Oct 15 11:17:08 2019
New Revision: 374932

URL: http://llvm.org/viewvc/llvm-project?rev=374932&view=rev
Log:
[clang] refactor -Wa,-W test cases.

Remove REQUIRES and only keep the clang driver tests, since the
assembler are already tested with -Wa,--no-warn. This way we could run
the test on non-linux platforms and catch breaks on them.

Modified:
cfe/trunk/test/Driver/as-w-option.c

Modified: cfe/trunk/test/Driver/as-w-option.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/as-w-option.c?rev=374932&r1=374931&r2=374932&view=diff
==
--- cfe/trunk/test/Driver/as-w-option.c (original)
+++ cfe/trunk/test/Driver/as-w-option.c Tue Oct 15 11:17:08 2019
@@ -1,17 +1,7 @@
 // RUN: %clang -### %s -c -o tmp.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck 
-check-prefix=CHECK-NOIAS %s
 // RUN: %clang -### %s -c -o tmp.o -integrated-as -Wa,-W 2>&1 | FileCheck 
-check-prefix=CHECK-IAS %s
-// RUN: %clang %s -c -o %t.o -integrated-as -Wa,-W 2>&1 | FileCheck 
-allow-empty --check-prefix=CHECK-AS-NOWARN %s
-// RUN: %clang %s -c -o %t.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck 
-allow-empty --check-prefix=CHECK-AS-NOWARN %s
-// RUN: not %clang %s -c -o %t.o -integrated-as -Wa,--fatal-warnings 2>&1 | 
FileCheck --check-prefix=CHECK-AS-FATAL %s
-// RUN: not %clang %s -c -o %t.o -fno-integrated-as -Wa,--fatal-warnings 2>&1 
| FileCheck --check-prefix=CHECK-AS-FATAL %s
-
-// REQUIRES: clang-driver
-// REQUIRES: linux
 
 // CHECK-IAS: "-cc1" {{.*}} "-massembler-no-warn"
 // CHECK-NOIAS: "-W"
-// CHECK-AS-NOWARN-NOT: warning:
-// CHECK-AS-FATAL-NOT: warning:
-// CHECK-AS-FATAL: error
 
 __asm(".warning");


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


r374934 - Added support for "#pragma clang section relro="

2019-10-15 Thread Dmitry Mikulin via cfe-commits
Author: dmikulin
Date: Tue Oct 15 11:31:10 2019
New Revision: 374934

URL: http://llvm.org/viewvc/llvm-project?rev=374934&view=rev
Log:
Added support for "#pragma clang section relro="

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

Modified:
cfe/trunk/docs/LanguageExtensions.rst
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/Parse/ParsePragma.cpp
cfe/trunk/lib/Sema/SemaAttr.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/CodeGenCXX/clang-sections.cpp
cfe/trunk/test/Sema/pragma-clang-section.c

Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=374934&r1=374933&r2=374934&view=diff
==
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Tue Oct 15 11:31:10 2019
@@ -3445,14 +3445,14 @@ The section names can be specified as:
 
 .. code-block:: c++
 
-  #pragma clang section bss="myBSS" data="myData" rodata="myRodata" 
text="myText"
+  #pragma clang section bss="myBSS" data="myData" rodata="myRodata" 
relro="myRelro" text="myText"
 
 The section names can be reverted back to default name by supplying an empty
 string to the section kind, for example:
 
 .. code-block:: c++
 
-  #pragma clang section bss="" data="" text="" rodata=""
+  #pragma clang section bss="" data="" text="" rodata="" relro=""
 
 The ``#pragma clang section`` directive obeys the following rules:
 

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=374934&r1=374933&r2=374934&view=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Tue Oct 15 11:31:10 2019
@@ -2020,6 +2020,14 @@ def PragmaClangRodataSection : Inheritab
   let Documentation = [Undocumented];
 }
 
+def PragmaClangRelroSection : InheritableAttr {
+  // This attribute has no spellings as it is only ever created implicitly.
+  let Spellings = [];
+  let Args = [StringArgument<"Name">];
+  let Subjects = SubjectList<[GlobalVar], ErrorDiag>;
+  let Documentation = [Undocumented];
+}
+
 def PragmaClangTextSection : InheritableAttr {
   // This attribute has no spellings as it is only ever created implicitly.
   let Spellings = [];

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=374934&r1=374933&r2=374934&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Tue Oct 15 11:31:10 
2019
@@ -976,9 +976,9 @@ def err_pragma_misplaced_in_decl : Error
 
 // '#pragma clang section' related errors
 def err_pragma_expected_clang_section_name : Error<
-  "expected one of [bss|data|rodata|text] section kind in '#pragma %0'">;
+  "expected one of [bss|data|rodata|text|relro] section kind in '#pragma %0'">;
 def err_pragma_clang_section_expected_equal : Error<
-  "expected '=' following '#pragma clang section 
%select{invalid|bss|data|rodata|text}0'">;
+  "expected '=' following '#pragma clang section 
%select{invalid|bss|data|rodata|text|relro}0'">;
 def warn_pragma_expected_section_name : Warning<
   "expected a string literal for the section name in '#pragma %0' - ignored">,
   InGroup;

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=374934&r1=374933&r2=374934&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Tue Oct 15 11:31:10 2019
@@ -418,7 +418,8 @@ public:
 PCSK_BSS  = 1,
 PCSK_Data = 2,
 PCSK_Rodata   = 3,
-PCSK_Text = 4
+PCSK_Text = 4,
+PCSK_Relro= 5
};
 
   enum PragmaClangSectionAction {
@@ -439,6 +440,7 @@ public:
PragmaClangSection PragmaClangBSSSection;
PragmaClangSection PragmaClangDataSection;
PragmaClangSection PragmaClangRodataSection;
+   PragmaClangSection PragmaClangRelroSection;
PragmaClangSection PragmaClangTextSection;
 
   enum PragmaMsStackAction {

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=374934&r1=374933&r2=374934&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Tue Oct 15 11:31:10

[PATCH] D62686: [RISCV] Add support for save/restore of callee-saved registers via libcalls

2019-10-15 Thread Ana Pazos via Phabricator via cfe-commits
apazos added a comment.



> Is it worth trying to disallow tail call optimization completely if this flag 
> is enabled? I'm not sure what GCC does exactly. but this seems to be the 
> behaviour.

I had reported above that I have already run that test:  with 
"-fno-optimize-sibling-calls -msave-restore", i.e., disabling tail calls when 
m-save-restore is enabled.

But it seems a better solution is to optimistically apply -msave-restore when 
there are no tail calls of any type in a function,  instead of disabling tail 
calls completed. Let tail call optimization prevail over msave-restore. No LLVM 
target is disabling tail calls.

So you can update the patch according to this solution plan.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62686



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


[PATCH] D68806: Relro is missing from the original "#pragma clang section" implementation.

2019-10-15 Thread Dmitry Mikulin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf14642f2f185: Added support for "#pragma clang section 
relro=" (authored by dmikulin).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68806

Files:
  clang/docs/LanguageExtensions.rst
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/CodeGen/CGDecl.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Parse/ParsePragma.cpp
  clang/lib/Sema/SemaAttr.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/test/CodeGenCXX/clang-sections.cpp
  clang/test/Sema/pragma-clang-section.c
  llvm/include/llvm/IR/GlobalVariable.h
  llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  llvm/lib/Target/TargetLoweringObjectFile.cpp
  llvm/test/MC/ELF/section-relro.ll

Index: llvm/test/MC/ELF/section-relro.ll
===
--- /dev/null
+++ llvm/test/MC/ELF/section-relro.ll
@@ -0,0 +1,65 @@
+; Tests that data and relro are correctly placed in sections
+; specified by "#pragma clang section"
+; RUN: llc -filetype=obj -mtriple x86_64-unknown-linux %s -o - | llvm-readobj -S -t | FileCheck %s
+
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux"
+
+@funcs_relro = hidden constant [2 x i32 ()*] [i32 ()* bitcast (i32 (...)* @func1 to i32 ()*), i32 ()* bitcast (i32 (...)* @func2 to i32 ()*)], align 16 #0
+@var_data = hidden global i32 33, align 4 #0
+
+declare i32 @func1(...)
+declare i32 @func2(...)
+
+; Function Attrs: noinline nounwind optnone sspstrong uwtable
+define hidden i32 @foo(i32 %i) {
+entry:
+  %i.addr = alloca i32, align 4
+  store i32 %i, i32* %i.addr, align 4
+  %0 = load i32, i32* %i.addr, align 4
+  %idxprom = sext i32 %0 to i64
+  %arrayidx = getelementptr inbounds [2 x i32 ()*], [2 x i32 ()*]* @funcs_relro, i64 0, i64 %idxprom
+  %1 = load i32 ()*, i32 ()** %arrayidx, align 8
+  %call = call i32 %1()
+  %2 = load i32, i32* @var_data, align 4
+  %add = add nsw i32 %call, %2
+  ret i32 %add
+}
+
+attributes #0 = { "data-section"=".my_data" "relro-section"=".my_relro" "rodata-section"=".my_rodata" }
+
+; CHECK:  Section {
+; CHECK:Index:
+; CHECK:Name: .my_rodata
+; CHECK:Type: SHT_PROGBITS (0x1)
+; CHECK:Flags [ (0x2)
+; CHECK:  SHF_ALLOC (0x2)
+; CHECK:]
+; CHECK:Size: 16
+; CHECK:  }
+; CHECK:  Section {
+; CHECK:Index:
+; CHECK:Name: .my_data
+; CHECK:Type: SHT_PROGBITS (0x1)
+; CHECK:Flags [ (0x3)
+; CHECK:  SHF_ALLOC (0x2)
+; CHECK:  SHF_WRITE (0x1)
+; CHECK:]
+; CHECK:Size: 4
+; CHECK:  }
+; CHECK:   Symbol {
+; CHECK:Name: funcs_relro
+; CHECK:Value: 0x0
+; CHECK:Size: 16
+; CHECK:Binding: Global (0x1)
+; CHECK:Type: Object (0x1)
+; CHECK:Section: .my_rodata
+; CHECK:  }
+; CHECK:  Symbol {
+; CHECK:Name: var_data
+; CHECK:Value: 0x0
+; CHECK:Size: 4
+; CHECK:Binding: Global (0x1)
+; CHECK:Type: Object (0x1)
+; CHECK:Section: .my_data
+; CHECK:  }
Index: llvm/lib/Target/TargetLoweringObjectFile.cpp
===
--- llvm/lib/Target/TargetLoweringObjectFile.cpp
+++ llvm/lib/Target/TargetLoweringObjectFile.cpp
@@ -253,6 +253,7 @@
 auto Attrs = GVar->getAttributes();
 if ((Attrs.hasAttribute("bss-section") && Kind.isBSS()) ||
 (Attrs.hasAttribute("data-section") && Kind.isData()) ||
+(Attrs.hasAttribute("relro-section") && Kind.isReadOnlyWithRel()) ||
 (Attrs.hasAttribute("rodata-section") && Kind.isReadOnly()))  {
return getExplicitSectionGlobal(GO, Kind, TM);
 }
Index: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
===
--- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -568,6 +568,8 @@
   SectionName = Attrs.getAttribute("bss-section").getValueAsString();
 } else if (Attrs.hasAttribute("rodata-section") && Kind.isReadOnly()) {
   SectionName = Attrs.getAttribute("rodata-section").getValueAsString();
+} else if (Attrs.hasAttribute("relro-section") && Kind.isReadOnlyWithRel()) {
+  SectionName = Attrs.getAttribute("relro-section").getValueAsString();
 } else if (Attrs.hasAttribute("data-section") && Kind.isData()) {
   SectionName = Attrs.getAttribute("data-section").getValueAsString();
 }
Index: llvm/include/llvm/IR/GlobalVariable.h
===
--- llvm/include/llvm/IR/GlobalVariable.h
+++ llvm/include/llvm/IR/GlobalVariable.h
@@ -243,6 +243,7 @@
   bool hasImplicitSection() const {
 return getAttributes().hasAttribute("bss-section") ||
  

r374936 - Fix as-w-option.c on Windows where no assembler exists

2019-10-15 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Tue Oct 15 11:39:41 2019
New Revision: 374936

URL: http://llvm.org/viewvc/llvm-project?rev=374936&view=rev
Log:
Fix as-w-option.c on Windows where no assembler exists

Modified:
cfe/trunk/test/Driver/as-w-option.c

Modified: cfe/trunk/test/Driver/as-w-option.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/as-w-option.c?rev=374936&r1=374935&r2=374936&view=diff
==
--- cfe/trunk/test/Driver/as-w-option.c (original)
+++ cfe/trunk/test/Driver/as-w-option.c Tue Oct 15 11:39:41 2019
@@ -1,4 +1,4 @@
-// RUN: %clang -### %s -c -o tmp.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck 
-check-prefix=CHECK-NOIAS %s
+// RUN: %clang -### %s -c -o tmp.o -fno-integrated-as 
--target=x86_64-linux-gnu -Wa,-W 2>&1 | FileCheck -check-prefix=CHECK-NOIAS %s
 // RUN: %clang -### %s -c -o tmp.o -integrated-as -Wa,-W 2>&1 | FileCheck 
-check-prefix=CHECK-IAS %s
 
 // CHECK-IAS: "-cc1" {{.*}} "-massembler-no-warn"


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


r374938 - [Concept] Associated Constraints Infrastructure

2019-10-15 Thread Saar Raz via cfe-commits
Author: saar.raz
Date: Tue Oct 15 11:44:06 2019
New Revision: 374938

URL: http://llvm.org/viewvc/llvm-project?rev=374938&view=rev
Log:
[Concept] Associated Constraints Infrastructure

Add code to correctly calculate the associated constraints of a template (no 
enforcement yet).
D41284 on Phabricator.


Added:
cfe/trunk/test/CXX/temp/concept/p4.cpp
cfe/trunk/test/CXX/temp/temp.constr/temp.constr.decl/func-template-decl.cpp
cfe/trunk/test/CXX/temp/temp.constr/temp.constr.decl/var-template-decl.cpp
Modified:
cfe/trunk/include/clang/AST/ASTNodeTraverser.h
cfe/trunk/include/clang/AST/DeclTemplate.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/DeclTemplate.cpp
cfe/trunk/lib/Sema/SemaConcept.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
cfe/trunk/test/CXX/temp/temp.constr/temp.constr.decl/class-template-decl.cpp

Modified: cfe/trunk/include/clang/AST/ASTNodeTraverser.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTNodeTraverser.h?rev=374938&r1=374937&r2=374938&view=diff
==
--- cfe/trunk/include/clang/AST/ASTNodeTraverser.h (original)
+++ cfe/trunk/include/clang/AST/ASTNodeTraverser.h Tue Oct 15 11:44:06 2019
@@ -237,6 +237,9 @@ public:
 
 for (const auto &TP : *TPL)
   Visit(TP);
+
+if (const Expr *RC = TPL->getRequiresClause())
+  Visit(RC);
   }
 
   void

Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=374938&r1=374937&r2=374938&view=diff
==
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Tue Oct 15 11:44:06 2019
@@ -168,6 +168,16 @@ public:
 return HasRequiresClause ? *getTrailingObjects() : nullptr;
   }
 
+  /// \brief All associated constraints derived from this template parameter
+  /// list, including the requires clause and any constraints derived from
+  /// constrained-parameters.
+  ///
+  /// The constraints in the resulting list are to be treated as if in a
+  /// conjunction ("and").
+  void getAssociatedConstraints(llvm::SmallVectorImpl &AC) const;
+
+  bool hasAssociatedConstraints() const;
+
   SourceLocation getTemplateLoc() const { return TemplateLoc; }
   SourceLocation getLAngleLoc() const { return LAngleLoc; }
   SourceLocation getRAngleLoc() const { return RAngleLoc; }
@@ -369,33 +379,7 @@ public:
 // Kinds of Templates
 
//===--===//
 
-/// Stores the template parameter list and associated constraints for
-/// \c TemplateDecl objects that track associated constraints.
-class ConstrainedTemplateDeclInfo {
-  friend TemplateDecl;
-
-public:
-  ConstrainedTemplateDeclInfo() = default;
-
-  TemplateParameterList *getTemplateParameters() const {
-return TemplateParams;
-  }
-
-  Expr *getAssociatedConstraints() const { return AssociatedConstraints; }
-
-protected:
-  void setTemplateParameters(TemplateParameterList *TParams) {
-TemplateParams = TParams;
-  }
-
-  void setAssociatedConstraints(Expr *AC) { AssociatedConstraints = AC; }
-
-  TemplateParameterList *TemplateParams = nullptr;
-  Expr *AssociatedConstraints = nullptr;
-};
-
-
-/// The base class of all kinds of template declarations (e.g.,
+/// \brief The base class of all kinds of template declarations (e.g.,
 /// class, function, etc.).
 ///
 /// The TemplateDecl class stores the list of template parameters and a
@@ -404,55 +388,33 @@ class TemplateDecl : public NamedDecl {
   void anchor() override;
 
 protected:
+  // Construct a template decl with name, parameters, and templated element.
+  TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName 
Name,
+   TemplateParameterList *Params, NamedDecl *Decl);
+
   // Construct a template decl with the given name and parameters.
   // Used when there is no templated element (e.g., for tt-params).
-  TemplateDecl(ConstrainedTemplateDeclInfo *CTDI, Kind DK, DeclContext *DC,
-   SourceLocation L, DeclarationName Name,
-   TemplateParameterList *Params)
-  : NamedDecl(DK, DC, L, Name), TemplatedDecl(nullptr),
-TemplateParams(CTDI) {
-this->setTemplateParameters(Params);
-  }
-
   TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName 
Name,
TemplateParameterList *Params)
-  : TemplateDecl(nullptr, DK, DC, L, Name, Params) {}
-
-  // 

[PATCH] D66733: [analyzer] Add a checker option to detect nested dead stores

2019-10-15 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment.

Thank you guys the responses. I cannot agree more. The sole reason why this 
option exists is that if you scroll back in the git blame of that line, you 
would find a commit, which removed this warning for this exact scenario.
Possibly due to some seemingly false positives.
I've added the author of that patch to the reviewers of this change, but did 
not respond.

If you interested to dig deeper, you could start here:
rC123394  same on github: 
https://github.com/steakhal/llvm-project/commit/f224820b45c6847b91071da8d7ade59f373b96f3

And again, thank you that mentioned it in the release notes and for the kind 
responses as well.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66733



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


[PATCH] D68346: [clang-format] Add new option to add spaces around conditions

2019-10-15 Thread Mitchell via Phabricator via cfe-commits
mitchell-stellar requested changes to this revision.
mitchell-stellar added inline comments.
This revision now requires changes to proceed.



Comment at: clang/include/clang/Format/Format.h:1955
+  /// \endcode
+  bool SpacesInConditionalStatement;
+

Nitpick: this option is still not in alphabetical order. Please re-order it. 
Otherwise, this looks good to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68346



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


[PATCH] D69000: [clang-tidy] new check: modernize-deprecated-iterator-base

2019-10-15 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added inline comments.



Comment at: 
clang-tools-extra/clang-tidy/modernize/DeprecatedIteratorBaseCheck.cpp:93
+// TODO: Is there a way to get the location without lexer gymnastics?
+auto Colon = findPreviousTokenKind(R.getBegin(), SM, LangOpts, tok::colon);
+Token Tok = getPreviousToken(Colon, SM, LangOpts, /*SkipComments=*/true);

Please don't use auto when type is not spelled in same statement or iterator.



Comment at: 
clang-tools-extra/clang-tidy/modernize/DeprecatedIteratorBaseCheck.cpp:100
+//   ^^
+auto Loc = (RD.bases_end() - 2)->getEndLoc();
+R.setBegin(Lexer::getLocForEndOfToken(Loc, 0, SM, LangOpts));

Please don't use auto when type is not spelled in same statement or iterator.



Comment at: 
clang-tools-extra/clang-tidy/modernize/DeprecatedIteratorBaseCheck.cpp:115
+static SourceLocation getInsertLoc(const CXXRecordDecl &RD) {
+  const auto *TopAS = getTopAccSpecDecl(RD);
+  if (TopAS && TopAS->getAccessUnsafe() == AS_public) {

Please don't use auto when type is not spelled in same statement or iterator.



Comment at: 
clang-tools-extra/clang-tidy/modernize/DeprecatedIteratorBaseCheck.cpp:129
+static bool isOpeningRequired(const CXXRecordDecl &RD) {
+  const auto *TopAS = getTopAccSpecDecl(RD);
+  if (TopAS && TopAS->getAccessUnsafe() == AS_public) {

Please don't use auto when type is not spelled in same statement or iterator.



Comment at: 
clang-tools-extra/clang-tidy/modernize/DeprecatedIteratorBaseCheck.cpp:218
+  // Requires C++.
+  if (!getLangOpts().CPlusPlus)
+return;

Should it check for C++17 or newer?



Comment at: 
clang-tools-extra/clang-tidy/modernize/DeprecatedIteratorBaseCheck.cpp:253
+  StringRef IndentAccSpec;
+  if (const auto *ASD = getAnyAccSpecDecl(Subj))
+IndentAccSpec = Lexer::getIndentationForLine(ASD->getLocation(), SM);

Please don't use auto when type is not spelled in same statement or iterator.



Comment at: 
clang-tools-extra/clang-tidy/modernize/DeprecatedIteratorBaseCheck.cpp:259
+  StringRef Indent;
+  if (const auto *D = getAnyNonAccSpecDecl(Subj))
+Indent = Lexer::getIndentationForLine(D->getLocation(), SM);

Please don't use auto when type is not spelled in same statement or iterator.



Comment at: 
clang-tools-extra/clang-tidy/modernize/DeprecatedIteratorBaseCheck.cpp:280
+ Subj, Context))) {
+  auto Range = GetRealRange(ND->getSourceRange()).getAsRange();
+  Range.setEnd(findNextTerminator(Range.getEnd(), SM, getLangOpts())

Please don't use auto when type is not spelled in same statement or iterator.



Comment at: clang-tools-extra/docs/ReleaseNotes.rst:133
 
+- New :doc:`modernize-deprecated-iterator-base
+  ` check.

Please put in new checks list in alphabetical order.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69000



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


r374942 - [OPENMP]Allow final clause in combined task-based directives.

2019-10-15 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Tue Oct 15 12:37:05 2019
New Revision: 374942

URL: http://llvm.org/viewvc/llvm-project?rev=374942&view=rev
Log:
[OPENMP]Allow final clause in combined task-based directives.
The condition of the final clause must be captured in the combined
task-based directives, like 'parallel master taskloop' directive.

Modified:
cfe/trunk/include/clang/AST/OpenMPClause.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/lib/AST/OpenMPClause.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/test/OpenMP/parallel_master_taskloop_ast_print.cpp
cfe/trunk/test/OpenMP/parallel_master_taskloop_codegen.cpp

Modified: cfe/trunk/include/clang/AST/OpenMPClause.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=374942&r1=374941&r2=374942&view=diff
==
--- cfe/trunk/include/clang/AST/OpenMPClause.h (original)
+++ cfe/trunk/include/clang/AST/OpenMPClause.h Tue Oct 15 12:37:05 2019
@@ -519,7 +519,7 @@ public:
 /// \endcode
 /// In this example directive '#pragma omp task' has simple 'final'
 /// clause with condition 'a > 5'.
-class OMPFinalClause : public OMPClause {
+class OMPFinalClause : public OMPClause, public OMPClauseWithPreInit {
   friend class OMPClauseReader;
 
   /// Location of '('.
@@ -534,18 +534,26 @@ class OMPFinalClause : public OMPClause
 public:
   /// Build 'final' clause with condition \a Cond.
   ///
+  /// \param Cond final condition.
+  /// \param HelperCond Helper condition for the construct.
+  /// \param CaptureRegion Innermost OpenMP region where expressions in this
+  /// clause must be captured.
   /// \param StartLoc Starting location of the clause.
   /// \param LParenLoc Location of '('.
   /// \param Cond Condition of the clause.
   /// \param EndLoc Ending location of the clause.
-  OMPFinalClause(Expr *Cond, SourceLocation StartLoc, SourceLocation LParenLoc,
- SourceLocation EndLoc)
-  : OMPClause(OMPC_final, StartLoc, EndLoc), LParenLoc(LParenLoc),
-Condition(Cond) {}
+  OMPFinalClause(Expr *Cond, Stmt *HelperSize,
+ OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
+ SourceLocation LParenLoc, SourceLocation EndLoc)
+  : OMPClause(OMPC_final, StartLoc, EndLoc), OMPClauseWithPreInit(this),
+LParenLoc(LParenLoc), Condition(Cond) {
+setPreInitStmt(HelperSize, CaptureRegion);
+  }
 
   /// Build an empty clause.
   OMPFinalClause()
-  : OMPClause(OMPC_final, SourceLocation(), SourceLocation()) {}
+  : OMPClause(OMPC_final, SourceLocation(), SourceLocation()),
+OMPClauseWithPreInit(this) {}
 
   /// Sets the location of '('.
   void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
@@ -562,11 +570,10 @@ public:
 return const_child_range(&Condition, &Condition + 1);
   }
 
-  child_range used_children() {
-return child_range(child_iterator(), child_iterator());
-  }
+  child_range used_children();
   const_child_range used_children() const {
-return const_child_range(const_child_iterator(), const_child_iterator());
+auto Children = const_cast(this)->used_children();
+return const_child_range(Children.begin(), Children.end());
   }
 
   static bool classof(const OMPClause *T) {

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=374942&r1=374941&r2=374942&view=diff
==
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Oct 15 12:37:05 2019
@@ -2906,6 +2906,7 @@ bool RecursiveASTVisitor::Visit
 
 template 
 bool RecursiveASTVisitor::VisitOMPFinalClause(OMPFinalClause *C) {
+  TRY_TO(VisitOMPClauseWithPreInit(C));
   TRY_TO(TraverseStmt(C->getCondition()));
   return true;
 }

Modified: cfe/trunk/lib/AST/OpenMPClause.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/OpenMPClause.cpp?rev=374942&r1=374941&r2=374942&view=diff
==
--- cfe/trunk/lib/AST/OpenMPClause.cpp (original)
+++ cfe/trunk/lib/AST/OpenMPClause.cpp Tue Oct 15 12:37:05 2019
@@ -88,9 +88,10 @@ const OMPClauseWithPreInit *OMPClauseWit
 return static_cast(C);
   case OMPC_num_tasks:
 return static_cast(C);
+  case OMPC_final:
+return static_cast(C);
   case OMPC_default:
   case OMPC_proc_bind:
-  case OMPC_final:
   case OMPC_safelen:
   case OMPC_simdlen:
   case OMPC_allocator:
@@ -248,6 +249,12 @@ OMPClause::child_range OMPNumTasksClause
   return child_range(&NumTasks, &NumTasks + 1);
 }
 
+OMPClause::child_range OMPFinalClause::used_children() {
+  if (Stmt **C = getAddrOfE

r374943 - [OPENMP]Fix comments/params, NFC.

2019-10-15 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Tue Oct 15 12:51:30 2019
New Revision: 374943

URL: http://llvm.org/viewvc/llvm-project?rev=374943&view=rev
Log:
[OPENMP]Fix comments/params, NFC.

Modified:
cfe/trunk/include/clang/AST/OpenMPClause.h

Modified: cfe/trunk/include/clang/AST/OpenMPClause.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=374943&r1=374942&r2=374943&view=diff
==
--- cfe/trunk/include/clang/AST/OpenMPClause.h (original)
+++ cfe/trunk/include/clang/AST/OpenMPClause.h Tue Oct 15 12:51:30 2019
@@ -534,20 +534,19 @@ class OMPFinalClause : public OMPClause,
 public:
   /// Build 'final' clause with condition \a Cond.
   ///
-  /// \param Cond final condition.
+  /// \param Cond Condition of the clause.
   /// \param HelperCond Helper condition for the construct.
   /// \param CaptureRegion Innermost OpenMP region where expressions in this
   /// clause must be captured.
   /// \param StartLoc Starting location of the clause.
   /// \param LParenLoc Location of '('.
-  /// \param Cond Condition of the clause.
   /// \param EndLoc Ending location of the clause.
-  OMPFinalClause(Expr *Cond, Stmt *HelperSize,
+  OMPFinalClause(Expr *Cond, Stmt *HelperCond,
  OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
  SourceLocation LParenLoc, SourceLocation EndLoc)
   : OMPClause(OMPC_final, StartLoc, EndLoc), OMPClauseWithPreInit(this),
 LParenLoc(LParenLoc), Condition(Cond) {
-setPreInitStmt(HelperSize, CaptureRegion);
+setPreInitStmt(HelperCond, CaptureRegion);
   }
 
   /// Build an empty clause.


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


  1   2   >