[PATCH] D50132: [clang-format] Add some text proto functions to Google style

2018-08-01 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir created this revision.
krasimir added a reviewer: djasper.
Herald added subscribers: cfe-commits, acoomans.

Adds 2 functions taking a text proto argument.


Repository:
  rC Clang

https://reviews.llvm.org/D50132

Files:
  lib/Format/Format.cpp


Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -777,9 +777,11 @@
   {
   "EqualsProto",
   "EquivToProto",
+  "PARSE_PARTIAL_TEXT_PROTO",
   "PARSE_TEST_PROTO",
   "PARSE_TEXT_PROTO",
   "ParseTextOrDie",
+  "ParseTextProtoOrDie",
   },
   /*CanonicalDelimiter=*/"",
   /*BasedOnStyle=*/"google",


Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -777,9 +777,11 @@
   {
   "EqualsProto",
   "EquivToProto",
+  "PARSE_PARTIAL_TEXT_PROTO",
   "PARSE_TEST_PROTO",
   "PARSE_TEXT_PROTO",
   "ParseTextOrDie",
+  "ParseTextProtoOrDie",
   },
   /*CanonicalDelimiter=*/"",
   /*BasedOnStyle=*/"google",
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50068: [AArch64][ARM] Add Armv8.4-A tests

2018-08-01 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer added inline comments.



Comment at: test/Driver/aarch64-cpus.c:9
 // RUN: %clang -target aarch64_be -mlittle-endian -mcpu=generic -### -c %s 
2>&1 | FileCheck -check-prefix=GENERIC %s
 // GENERIC: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic"
 

ab wrote:
> Ideally, these should test `aarch64-{{.*}}`, no?
Agreed, good point. I will commit this first, and address this in a follow up 
as it looks like needs fixing in a few places here in this file. 


https://reviews.llvm.org/D50068



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


[PATCH] D32747: [Analyzer] Iterator Checker - Part 3: Invalidation check, first for (copy) assignments

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

Pre-statement check of `CXXOperatorCallExpr` merged into pre-call check.


https://reviews.llvm.org/D32747

Files:
  include/clang/StaticAnalyzer/Checkers/Checkers.td
  lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
  test/Analysis/Inputs/system-header-simulator-cxx.h
  test/Analysis/diagnostics/explicit-suppression.cpp
  test/Analysis/invalidated-iterator.cpp

Index: test/Analysis/invalidated-iterator.cpp
===
--- /dev/null
+++ test/Analysis/invalidated-iterator.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.InvalidatedIterator -analyzer-eagerly-assume -analyzer-config aggressive-relational-comparison-simplification=true -analyzer-config c++-container-inlining=false %s -verify
+// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.InvalidatedIterator -analyzer-eagerly-assume -analyzer-config aggressive-relational-comparison-simplification=true -analyzer-config c++-container-inlining=true -DINLINE=1 %s -verify
+
+#include "Inputs/system-header-simulator-cxx.h"
+
+void bad_copy_assign_operator_list1(std::list &L1,
+const std::list &L2) {
+  auto i0 = L1.cbegin();
+  L1 = L2;
+  *i0; // expected-warning{{Invalidated iterator accessed}}
+}
+
+void bad_copy_assign_operator_vector1(std::vector &V1,
+  const std::vector &V2) {
+  auto i0 = V1.cbegin();
+  V1 = V2;
+  *i0; // expected-warning{{Invalidated iterator accessed}}
+}
+
+void bad_copy_assign_operator_deque1(std::deque &D1,
+ const std::deque &D2) {
+  auto i0 = D1.cbegin();
+  D1 = D2;
+  *i0; // expected-warning{{Invalidated iterator accessed}}
+}
+
+void bad_copy_assign_operator_forward_list1(std::forward_list &FL1,
+const std::forward_list &FL2) {
+  auto i0 = FL1.cbegin();
+  FL1 = FL2;
+  *i0; // expected-warning{{Invalidated iterator accessed}}
+}
Index: test/Analysis/diagnostics/explicit-suppression.cpp
===
--- test/Analysis/diagnostics/explicit-suppression.cpp
+++ test/Analysis/diagnostics/explicit-suppression.cpp
@@ -19,6 +19,6 @@
 void testCopyNull(C *I, C *E) {
   std::copy(I, E, (C *)0);
 #ifndef SUPPRESSED
-  // expected-warning@../Inputs/system-header-simulator-cxx.h:514 {{Called C++ object pointer is null}}
+  // expected-warning@../Inputs/system-header-simulator-cxx.h:554 {{Called C++ object pointer is null}}
 #endif
 }
Index: test/Analysis/Inputs/system-header-simulator-cxx.h
===
--- test/Analysis/Inputs/system-header-simulator-cxx.h
+++ test/Analysis/Inputs/system-header-simulator-cxx.h
@@ -252,6 +252,15 @@
   return size_t(_finish - _start);
 }
 
+vector& operator=(const vector &other);
+vector& operator=(vector &&other);
+vector& operator=(std::initializer_list ilist);
+
+void assign(size_type count, const T &value);
+template 
+void assign(InputIterator first, InputIterator last);
+void assign(std::initializer_list ilist);
+
 void clear();
 
 void push_back(const T &value);
@@ -301,8 +310,21 @@
 list& operator=(list &&other);
 list& operator=(std::initializer_list ilist);
 
+void assign(size_type count, const T &value);
+template 
+void assign(InputIterator first, InputIterator last);
+void assign(std::initializer_list ilist);
+
 void clear();
 
+void push_back(const T &value);
+void push_back(T &&value);
+void pop_back();
+
+void push_front(const T &value);
+void push_front(T &&value);
+void pop_front();
+
 iterator begin() { return iterator(_start); }
 const_iterator begin() const { return const_iterator(_start); }
 const_iterator cbegin() const { return const_iterator(_start); }
@@ -338,6 +360,15 @@
   return size_t(_finish - _start);
 }
 
+deque& operator=(const deque &other);
+deque& operator=(deque &&other);
+deque& operator=(std::initializer_list ilist);
+
+void assign(size_type count, const T &value);
+template 
+void assign(InputIterator first, InputIterator last);
+void assign(std::initializer_list ilist);
+
 void clear();
 
 void push_back(const T &value);
@@ -351,11 +382,11 @@
 T &operator[](size_t n) {
   return _start[n];
 }
-
+
 const T &operator[](size_t n) const {
   return _start[n];
 }
-
+
 iterator begin() { return iterator(_start); }
 const_iterator begin() const { return const_iterator(_start); }
 const_iterator cbegin() const { return const_iterator(_start); }
@@ -367,7 +398,7 @@
 T& back() { return *(end() - 1); }
 const T& back() const { return *(end() - 1); }
   };
-  
+
   templa

[PATCH] D32747: [Analyzer] Iterator Checker - Part 3: Invalidation check, first for (copy) assignments

2018-08-01 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added inline comments.



Comment at: lib/StaticAnalyzer/Checkers/IteratorChecker.cpp:605
+  if (Pos && !Pos->isValid()) {
+// If I do not put a tag here, some invalidation tests will fail
+static CheckerProgramPointTag Tag("InvalidatedIteratorChecker",

NoQ wrote:
> baloghadamsoftware wrote:
> > NoQ wrote:
> > > baloghadamsoftware wrote:
> > > > NoQ wrote:
> > > > > This needs investigation, because it may be nasty.
> > > > > 
> > > > > `generateNonFatalErrorNode()` returns null when the exact same 
> > > > > non-fatal error node, also produced by the iterator checker with the 
> > > > > exact same program state and exact same program point and exact same 
> > > > > tag on the program point already exists. As far as i understand, the 
> > > > > only difference your tag makes is that the tag is now different, so 
> > > > > it is not merged with the existing node. However, it is worth it to 
> > > > > try to find out why the node gets merged at all.
> > > > > 
> > > > > This may be caused by an accidental state split. For example, if you 
> > > > > are calling `generateNonFatalErrorNode()` twice in the same checker 
> > > > > callback without chaining them together (passing node returned by one 
> > > > > as an argument to another), this in fact splits states. I'm not 
> > > > > immediately seeing such places in the code - you seem to be aware of 
> > > > > this problem and avoiding it well. But still, looking at the topology 
> > > > > of the exploded graph in the failing test should help finding out 
> > > > > what is going on.
> > > > I made some more investigation this time. Unfortunately the case is not 
> > > > what you suggest. Only one non-fatal error node is produced. I tested 
> > > > it with a common tag (a global static so the tag is exactly the same at 
> > > > every `generateNonFatalErrorNode()`, but the tests still pass. I 
> > > > printed out the exploded graph and I found that there are indeed two 
> > > > nodes with the same state ID. The tag is the default tag automatically 
> > > > generated from the name of the checker. The first state is created in 
> > > > function `checkPreStatement()` for `CXXOperatorCallExpr` where I copy 
> > > > the state of the iterator from the formal to the actual `this` 
> > > > parameter. All the test fails happen at the dereference operator call 
> > > > (`*`) of another operator call (`++` or `--`). After this copy, when I 
> > > > call `generateNonFatalErrorNode()` I get `nullptr` because at some 
> > > > point under the hood (I debugged it when I created it originally) the 
> > > > error node is considered as "not new". If I use a custom tag here, the 
> > > > state ID remains, not the node ID changes.
> > > I think i see the problem. The checker subscribes to both `PreCall` and 
> > > `PreStmt` (to be exact, `CXXOperatorCallExpr`) and adds 
> > > transitions in both cases. It results with a predecessor node in 
> > > `CheckerContext` that's already tagged by the checker. Apparently this 
> > > never worked, but nobody tried that.
> > > 
> > > Ideally, we should make sure those callbacks use different program 
> > > points, eg. introduce `PreCall`/`PostCall` program point kinds and use 
> > > them.
> > > 
> > > Also i wonder why are you using pre- rather than post-statement callback. 
> > > You model all other operators in `PostCall`, why did those end up here? 
> > > Maybe merge them? It is generally better to model pre-conditions and look 
> > > for bugs in `PreStmt`/`PreCall` (before we don't care what happens within 
> > > the call), and model effects in `PostStmt`/`PostCall` (because effects 
> > > don't take effect until the call happens).
> > That is what I am trying to to: `Post*` for modelling and `Pre*` for 
> > checking. However, this `PreStmt()` is special since I 
> > have to move the arguments to the context of the called operator //before// 
> > the call.
> Ah, it's that thing, `PreCall` then?
Yes! It seems to be working. Thank you for your help!


https://reviews.llvm.org/D32747



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


[PATCH] D47849: [OpenMP][Clang][NVPTX] Enable math functions called in an OpenMP NVPTX target device region to be resolved as device-native function calls

2018-08-01 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

In https://reviews.llvm.org/D47849#1183150, @hfinkel wrote:

> Hrmm. Doesn't that make it so that whatever functions are implemented using 
> that inline assembly will not be callable from target code (or, perhaps 
> worse, will crash the backend if called)?


You are right :-(

However I'm getting worried about a more general case, not all inline assembly 
is guarded by `#ifdef`s that we could hope to get right. For example take 
`sys/io.h` which currently throws 18 errors when compiling with offloading to 
GPUs, even with `-O0`. The inline assembly is only guarded by `#if defined 
__GNUC__ && __GNUC__ >= 2` which should be defined by any modern compiler 
claiming compatibility with GCC. I'm not sure this particular header will ever 
end up in an OpenMP application, but others with inline assembly will. From a 
quick grep it looks like some headers dealing with atomic operations have 
inline assembly and even `eigen3/Eigen/src/Core/util/Memory.h` for finding the 
cpuid.

Coming back to the original problem: Maybe we need to undefine optimization 
macros as in your patch to get as many correct inline functions as possible AND 
ignore errors from inline assembly as in my patch to not break when including 
weird headers?


Repository:
  rC Clang

https://reviews.llvm.org/D47849



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


[PATCH] D50078: clang-format: support aligned nested conditionals formatting

2018-08-01 Thread Daniel Jasper via Phabricator via cfe-commits
djasper added a comment.

I don't have very strong opinions here and I agree that we will need to improve 
the conditional formatting, especially as this kind of ternary-chaining is 
becoming more popular because of constexpr.

My personal opinion(s):

- I think this is a no-brainer for BreakBeforeTernaryOperators=false
- I'd be ok with the suggestion for BreakBeforeTernaryOperators=true
- I don't think the alignment of "?" and ":" (in the WhitespaceManager) should 
be always on. I think we'd need a flag for that part

Manuel, Krasimir, WDYT?


Repository:
  rC Clang

https://reviews.llvm.org/D50078



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


[PATCH] D49758: [clangd] allow clients to pass in compilationDatabaseChanges in the 'workspace/didChangeConfiguration' request

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

Thanks! LGTM


https://reviews.llvm.org/D49758



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


[PATCH] D49833: [clangd] Receive compilationDatabasePath in 'initialize' request

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

LGTM with a small nit. Thanks for the change!




Comment at: clangd/ClangdLSPServer.cpp:419
+DidChangeConfigurationParams &Params) {
+  ClangdConfigurationParamsChange &Settings = Params.settings;
+  applyConfiguration(Settings);

NIT: replace with `applyConfiguration(Params.settings)` to get rid of the extra 
local var


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D49833



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


[PATCH] D50056: [NFC] Silence warning about ptr-to-func to ptr-to-obj cast in clang-fuzzer/handle-llvm/handle_llvm.cpp.

2018-08-01 Thread Andrei Elovikov via Phabricator via cfe-commits
a.elovikov updated this revision to Diff 158483.
a.elovikov added a comment.

- Address Erich's comment + clang-format.


https://reviews.llvm.org/D50056

Files:
  clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp


Index: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
===
--- clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
+++ clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
@@ -149,7 +149,23 @@
   EE->runStaticConstructorsDestructors(false);
 
   typedef void (*func)(int*, int*, int*, int);
-  func f = reinterpret_cast(EE->getPointerToFunction(EntryFunc)); 
+#if defined(__GNUC__) && !defined(__clang) &&  
\
+((__GNUC__ == 4) && (__GNUC_MINOR__ < 9))
+// Silence
+//
+//   warning: ISO C++ forbids casting between pointer-to-function and
+//   pointer-to-object [-Wpedantic]
+//
+// Since C++11 this casting is conditionally supported and GCC versions
+// starting from 4.9.0 don't warn about the cast.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+#endif
+  func f = reinterpret_cast(EE->getPointerToFunction(EntryFunc));
+#if defined(__GNUC__) && !defined(__clang) &&  
\
+((__GNUC__ == 4) && (__GNUC_MINOR__ < 9))
+#pragma GCC diagnostic pop
+#endif
 
   // Define some dummy arrays to use an input for now
   int a[] = {1};


Index: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
===
--- clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
+++ clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
@@ -149,7 +149,23 @@
   EE->runStaticConstructorsDestructors(false);
 
   typedef void (*func)(int*, int*, int*, int);
-  func f = reinterpret_cast(EE->getPointerToFunction(EntryFunc)); 
+#if defined(__GNUC__) && !defined(__clang) &&  \
+((__GNUC__ == 4) && (__GNUC_MINOR__ < 9))
+// Silence
+//
+//   warning: ISO C++ forbids casting between pointer-to-function and
+//   pointer-to-object [-Wpedantic]
+//
+// Since C++11 this casting is conditionally supported and GCC versions
+// starting from 4.9.0 don't warn about the cast.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+#endif
+  func f = reinterpret_cast(EE->getPointerToFunction(EntryFunc));
+#if defined(__GNUC__) && !defined(__clang) &&  \
+((__GNUC__ == 4) && (__GNUC_MINOR__ < 9))
+#pragma GCC diagnostic pop
+#endif
 
   // Define some dummy arrays to use an input for now
   int a[] = {1};
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D37813: clang-format: better handle namespace macros

2018-08-01 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment.

Ping!

This has been stale for a while now. Last comment indicate this is not the 
right approach, but some prototyping has been done a more generic approach, 
with no timeline.
I understand this, but in the meantime the problem is still there, with no 
solution at the moment...

Can we move this forward in the mean time, possibly marking the API as 'beta', 
'unstable' or another way of saying it is subject to change. It can be removed 
when there is a better solution.
Or maybe there is now a timeline for the better solution? or the prototype is 
available somewhere, with some documentation on limits/works to be done, so 
that work can continue from there?


Repository:
  rC Clang

https://reviews.llvm.org/D37813



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


r338502 - Fix "not all control paths return a value" MSVC warning.

2018-08-01 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Wed Aug  1 02:45:21 2018
New Revision: 338502

URL: http://llvm.org/viewvc/llvm-project?rev=338502&view=rev
Log:
Fix "not all control paths return a value" MSVC warning.

Modified:
cfe/trunk/include/clang/Analysis/ConstructionContext.h

Modified: cfe/trunk/include/clang/Analysis/ConstructionContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/ConstructionContext.h?rev=338502&r1=338501&r2=338502&view=diff
==
--- cfe/trunk/include/clang/Analysis/ConstructionContext.h (original)
+++ cfe/trunk/include/clang/Analysis/ConstructionContext.h Wed Aug  1 02:45:21 
2018
@@ -57,6 +57,7 @@ public:
   case ArgumentKind:return "construct into argument";
   case InitializerKind: return "construct into member variable";
 };
+llvm_unreachable("Unknown ItemKind");
   }
 
 private:


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


r338503 - [Modules] Do not emit relocation error when -fno-validate-pch is set

2018-08-01 Thread Yuka Takahashi via cfe-commits
Author: yamaguchi
Date: Wed Aug  1 02:50:02 2018
New Revision: 338503

URL: http://llvm.org/viewvc/llvm-project?rev=338503&view=rev
Log:
[Modules] Do not emit relocation error when -fno-validate-pch is set

Summary:
Clang emits error when implicit modules was relocated from the
first build directory. However this was biting our usecase where we copy
the contents of build directory to another directory in order to
distribute.

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

Modified:
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/test/Modules/resolution-change.m

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=338503&r1=338502&r2=338503&view=diff
==
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Wed Aug  1 02:50:02 2018
@@ -2632,7 +2632,9 @@ ASTReader::ReadControlBlock(ModuleFile &
   if (M && M->Directory) {
 // If we're implicitly loading a module, the base directory can't
 // change between the build and use.
-if (F.Kind != MK_ExplicitModule && F.Kind != MK_PrebuiltModule) {
+// Don't emit module relocation error if we have -fno-validate-pch
+if (!PP.getPreprocessorOpts().DisablePCHValidation &&
+F.Kind != MK_ExplicitModule && F.Kind != MK_PrebuiltModule) {
   const DirectoryEntry *BuildDir =
   PP.getFileManager().getDirectory(Blob);
   if (!BuildDir || BuildDir != M->Directory) {
@@ -3602,7 +3604,8 @@ ASTReader::ReadModuleMapFileBlock(Record
 Module *M = PP.getHeaderSearchInfo().lookupModule(F.ModuleName);
 auto &Map = PP.getHeaderSearchInfo().getModuleMap();
 const FileEntry *ModMap = M ? Map.getModuleMapFileForUniquing(M) : nullptr;
-if (!ModMap) {
+// Don't emit module relocation error if we have -fno-validate-pch
+if (!PP.getPreprocessorOpts().DisablePCHValidation && !ModMap) {
   assert(ImportedBy && "top-level import should be verified");
   if ((ClientLoadCapabilities & ARR_OutOfDate) == 0) {
 if (auto *ASTFE = M ? M->getASTFile() : nullptr) {
@@ -5039,7 +5042,9 @@ ASTReader::ReadSubmoduleBlock(ModuleFile
 
   if (!ParentModule) {
 if (const FileEntry *CurFile = CurrentModule->getASTFile()) {
-  if (CurFile != F.File) {
+  // Don't emit module relocation error if we have -fno-validate-pch
+  if (!PP.getPreprocessorOpts().DisablePCHValidation &&
+  CurFile != F.File) {
 if (!Diags.isDiagnosticInFlight()) {
   Diag(diag::err_module_file_conflict)
 << CurrentModule->getTopLevelModuleName()

Modified: cfe/trunk/test/Modules/resolution-change.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/resolution-change.m?rev=338503&r1=338502&r2=338503&view=diff
==
--- cfe/trunk/test/Modules/resolution-change.m (original)
+++ cfe/trunk/test/Modules/resolution-change.m Wed Aug  1 02:50:02 2018
@@ -21,6 +21,8 @@
 // RUN: not %clang_cc1 -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I 
%S/Inputs/modules-with-same-name/path2/A -include-pch %t-A.pch %s -fsyntax-only 
2>&1 | FileCheck -check-prefix=CHECK-WRONGA %s
 // CHECK-WRONGA: module 'A' was built in directory 
'{{.*Inputs.modules-with-same-name.path1.A}}' but now resides in directory 
'{{.*Inputs.modules-with-same-name.path2.A}}'
 
+// RUN: %clang_cc1 -fno-validate-pch -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I 
%S/Inputs/modules-with-same-name/path2/A -include-pch %t-A.pch %s -fsyntax-only
+
 #ifndef HEADER
 #define HEADER
 @import DependsOnA;


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


[PATCH] D49852: [Modules] Do not emit relocation error when -fno-validate-pch is set

2018-08-01 Thread Yuka Takahashi via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL338503: [Modules] Do not emit relocation error when 
-fno-validate-pch is set (authored by yamaguchi, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49852?vs=157479&id=158484#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49852

Files:
  cfe/trunk/lib/Serialization/ASTReader.cpp
  cfe/trunk/test/Modules/resolution-change.m


Index: cfe/trunk/test/Modules/resolution-change.m
===
--- cfe/trunk/test/Modules/resolution-change.m
+++ cfe/trunk/test/Modules/resolution-change.m
@@ -21,6 +21,8 @@
 // RUN: not %clang_cc1 -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I 
%S/Inputs/modules-with-same-name/path2/A -include-pch %t-A.pch %s -fsyntax-only 
2>&1 | FileCheck -check-prefix=CHECK-WRONGA %s
 // CHECK-WRONGA: module 'A' was built in directory 
'{{.*Inputs.modules-with-same-name.path1.A}}' but now resides in directory 
'{{.*Inputs.modules-with-same-name.path2.A}}'
 
+// RUN: %clang_cc1 -fno-validate-pch -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I 
%S/Inputs/modules-with-same-name/path2/A -include-pch %t-A.pch %s -fsyntax-only
+
 #ifndef HEADER
 #define HEADER
 @import DependsOnA;
Index: cfe/trunk/lib/Serialization/ASTReader.cpp
===
--- cfe/trunk/lib/Serialization/ASTReader.cpp
+++ cfe/trunk/lib/Serialization/ASTReader.cpp
@@ -2632,7 +2632,9 @@
   if (M && M->Directory) {
 // If we're implicitly loading a module, the base directory can't
 // change between the build and use.
-if (F.Kind != MK_ExplicitModule && F.Kind != MK_PrebuiltModule) {
+// Don't emit module relocation error if we have -fno-validate-pch
+if (!PP.getPreprocessorOpts().DisablePCHValidation &&
+F.Kind != MK_ExplicitModule && F.Kind != MK_PrebuiltModule) {
   const DirectoryEntry *BuildDir =
   PP.getFileManager().getDirectory(Blob);
   if (!BuildDir || BuildDir != M->Directory) {
@@ -3602,7 +3604,8 @@
 Module *M = PP.getHeaderSearchInfo().lookupModule(F.ModuleName);
 auto &Map = PP.getHeaderSearchInfo().getModuleMap();
 const FileEntry *ModMap = M ? Map.getModuleMapFileForUniquing(M) : nullptr;
-if (!ModMap) {
+// Don't emit module relocation error if we have -fno-validate-pch
+if (!PP.getPreprocessorOpts().DisablePCHValidation && !ModMap) {
   assert(ImportedBy && "top-level import should be verified");
   if ((ClientLoadCapabilities & ARR_OutOfDate) == 0) {
 if (auto *ASTFE = M ? M->getASTFile() : nullptr) {
@@ -5039,7 +5042,9 @@
 
   if (!ParentModule) {
 if (const FileEntry *CurFile = CurrentModule->getASTFile()) {
-  if (CurFile != F.File) {
+  // Don't emit module relocation error if we have -fno-validate-pch
+  if (!PP.getPreprocessorOpts().DisablePCHValidation &&
+  CurFile != F.File) {
 if (!Diags.isDiagnosticInFlight()) {
   Diag(diag::err_module_file_conflict)
 << CurrentModule->getTopLevelModuleName()


Index: cfe/trunk/test/Modules/resolution-change.m
===
--- cfe/trunk/test/Modules/resolution-change.m
+++ cfe/trunk/test/Modules/resolution-change.m
@@ -21,6 +21,8 @@
 // RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path2/A -include-pch %t-A.pch %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-WRONGA %s
 // CHECK-WRONGA: module 'A' was built in directory '{{.*Inputs.modules-with-same-name.path1.A}}' but now resides in directory '{{.*Inputs.modules-with-same-name.path2.A}}'
 
+// RUN: %clang_cc1 -fno-validate-pch -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path2/A -include-pch %t-A.pch %s -fsyntax-only
+
 #ifndef HEADER
 #define HEADER
 @import DependsOnA;
Index: cfe/trunk/lib/Serialization/ASTReader.cpp
===
--- cfe/trunk/lib/Serialization/ASTReader.cpp
+++ cfe/trunk/lib/Serialization/ASTReader.cpp
@@ -2632,7 +2632,9 @@
   if (M && M->Directory) {
 // If we're implicitly loading a module, the base directory can't
 // change between the build and use.
-if (F.Kind != MK_ExplicitModule && F.Kind != MK_PrebuiltModule) {
+// Don't emit module relocation error if we have -fno-validate-pch
+if (!PP.getPreprocessorOpts().DisablePCHValidation &&
+F.Kind != MK_ExplicitModule && F.Kind != MK_PrebuiltModule) {
   const DirectoryEntry 

[PATCH] D50078: clang-format: support aligned nested conditionals formatting

2018-08-01 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added a comment.

Yea, if we go down this route I'd go with this by default:

  some ? thing :
  else ? otherthing :
  unrelated ? but :
  finally;

Theoretically we could even use:

  some ? thing :
  else;

by default ;)


Repository:
  rC Clang

https://reviews.llvm.org/D50078



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


[PATCH] D37813: clang-format: better handle namespace macros

2018-08-01 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added a comment.

The problem here is that we have different opinions on how the formatting on 
namespace macros should behave in the first place- I think they should behave 
like namespaces, you want them to be formatted differently.
Given that you want full control over the formatting of those macros, and them 
not actually be formatted exactly like namespaces or classes, I think we need a 
more generic mechanism for you to express that.


Repository:
  rC Clang

https://reviews.llvm.org/D37813



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


[PATCH] D49725: [OpenCL] Forbid size dependent types used as kernel arguments

2018-08-01 Thread Alexey Sotkin via Phabricator via cfe-commits
AlexeySotkin added a comment.

In https://reviews.llvm.org/D49725#1183316, @aaron.ballman wrote:

> FYI: @asavonic, the email address you have associated with your commit id is 
> `AlexeySotkin@/etc/mailname` which is getting stuck in the moderation queue 
> as not being signed up to the mailing list. You may want to correct your svn 
> information as I am not certain what our list software will think of that 
> domain.


Hi Aaron. It seems that this issue has broken mirroring with github repo. How I 
can fix it? Thanks.


Repository:
  rL LLVM

https://reviews.llvm.org/D49725



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


r338508 - Replace 'FALL-THROUGH' comment with LLVM_FALLTHROUGH to silence warning. NFCI.

2018-08-01 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Wed Aug  1 03:26:04 2018
New Revision: 338508

URL: http://llvm.org/viewvc/llvm-project?rev=338508&view=rev
Log:
Replace 'FALL-THROUGH' comment with LLVM_FALLTHROUGH to silence warning. NFCI.

Modified:
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp?rev=338508&r1=338507&r2=338508&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp Wed Aug  1 03:26:04 2018
@@ -253,7 +253,7 @@ std::pair ExprEng
 State = PreElideState;
 CallOpts = PreElideCallOpts;
   }
-  // FALL-THROUGH
+  LLVM_FALLTHROUGH
 }
 case ConstructionContext::SimpleTemporaryObjectKind: {
   const auto *TCC = cast(CC);


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


r338510 - Add missing semicolon.

2018-08-01 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Wed Aug  1 03:34:13 2018
New Revision: 338510

URL: http://llvm.org/viewvc/llvm-project?rev=338510&view=rev
Log:
Add missing semicolon.

Modified:
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp?rev=338510&r1=338509&r2=338510&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp Wed Aug  1 03:34:13 2018
@@ -253,7 +253,7 @@ std::pair ExprEng
 State = PreElideState;
 CallOpts = PreElideCallOpts;
   }
-  LLVM_FALLTHROUGH
+  LLVM_FALLTHROUGH;
 }
 case ConstructionContext::SimpleTemporaryObjectKind: {
   const auto *TCC = cast(CC);


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


[PATCH] D31179: Objective-C categories should support attributes

2018-08-01 Thread Dmitry Lobanov via Phabricator via cfe-commits
lolgear added a comment.
Herald added subscribers: llvm-commits, dexonsmith.

Well, deprecated category only shows "Implementing deprecated category" message.
However, I would like to tell users that all methods of this category are 
deprecated.
For that I need to add deprecated attribute for each method in this category.


Repository:
  rL LLVM

https://reviews.llvm.org/D31179



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


[PATCH] D49793: [AArch64] - return address signing

2018-08-01 Thread Luke Cheeseman via Phabricator via cfe-commits
LukeCheeseman updated this revision to Diff 158491.
LukeCheeseman added a comment.

Move -msign-return-address argument handling into AArch64TargetArgs


https://reviews.llvm.org/D49793

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/TargetInfo.cpp
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/aarch64-sign-return-address.c

Index: test/CodeGen/aarch64-sign-return-address.c
===
--- /dev/null
+++ test/CodeGen/aarch64-sign-return-address.c
@@ -0,0 +1,14 @@
+// RUN: %clang -target aarch64-arm-none-eabi -S -emit-llvm -o - -msign-return-address=none  %s | FileCheck %s --check-prefix=CHECK-NONE
+// RUN: %clang -target aarch64-arm-none-eabi -S -emit-llvm -o - -msign-return-address=non-leaf %s | FileCheck %s --check-prefix=CHECK-PARTIAL
+// RUN: %clang -target aarch64-arm-none-eabi -S -emit-llvm -o - -msign-return-address=all %s | FileCheck %s --check-prefix=CHECK-ALL
+
+// CHECK-NONE: @foo() #[[ATTR:[0-9]*]]
+// CHECK-NONE-NOT: attributes #[[ATTR]] = { {{.*}} "sign-return-address"={{.*}} }}
+
+// CHECK-PARTIAL: @foo() #[[ATTR:[0-9]*]]
+// CHECK-PARTIAL: attributes #[[ATTR]] = { {{.*}} "sign-return-address"="non-leaf" {{.*}}}
+
+// CHECK-ALL: @foo() #[[ATTR:[0-9]*]]
+// CHECK-ALL: attributes #[[ATTR]] = { {{.*}} "sign-return-address"="all" {{.*}} }
+
+void foo() {}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -1125,6 +1125,20 @@
 
   Opts.Addrsig = Args.hasArg(OPT_faddrsig);
 
+  if (Arg *A = Args.getLastArg(OPT_msign_return_address)) {
+StringRef SignScope = A->getValue();
+if (SignScope.equals_lower("none"))
+  Opts.setSignReturnAddress(CodeGenOptions::SignReturnAddressScope::None);
+else if (SignScope.equals_lower("all"))
+  Opts.setSignReturnAddress(CodeGenOptions::SignReturnAddressScope::All);
+else if (SignScope.equals_lower("non-leaf"))
+  Opts.setSignReturnAddress(
+  CodeGenOptions::SignReturnAddressScope::NonLeaf);
+else
+  Diags.Report(diag::err_drv_invalid_value)
+  << A->getAsString(Args) << A->getValue();
+  }
+
   return Success;
 }
 
Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -1455,6 +1455,11 @@
 else
   CmdArgs.push_back("-aarch64-enable-global-merge=true");
   }
+
+  if (Arg *A = Args.getLastArg(options::OPT_msign_return_address)) {
+CmdArgs.push_back(
+Args.MakeArgString(Twine("-msign-return-address=") + A->getValue()));
+  }
 }
 
 void Clang::AddMIPSTargetArgs(const ArgList &Args,
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -4969,6 +4969,23 @@
   }
 
   bool doesReturnSlotInterfereWithArgs() const override { return false; }
+
+  void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV,
+   CodeGen::CodeGenModule &CGM) const override {
+const FunctionDecl *FD = dyn_cast_or_null(D);
+if (!FD)
+  return;
+llvm::Function *Fn = cast(GV);
+
+auto Kind = CGM.getCodeGenOpts().getSignReturnAddress();
+if (Kind == CodeGenOptions::SignReturnAddressScope::None)
+  return;
+
+Fn->addFnAttr("sign-return-address",
+  Kind == CodeGenOptions::SignReturnAddressScope::All
+  ? "all"
+  : "non-leaf");
+  }
 };
 
 class WindowsAArch64TargetCodeGenInfo : public AArch64TargetCodeGenInfo {
Index: include/clang/Frontend/CodeGenOptions.h
===
--- include/clang/Frontend/CodeGenOptions.h
+++ include/clang/Frontend/CodeGenOptions.h
@@ -108,6 +108,12 @@
 Embed_Marker// Embed a marker as a placeholder for bitcode.
   };
 
+  enum SignReturnAddressScope {
+None,// No signing for any function
+NonLeaf, // Sign the return address of functions that spill LR
+All  // Sign the return address of all functions
+  };
+
   /// The code model to use (-mcmodel).
   std::string CodeModel;
 
Index: include/clang/Frontend/CodeGenOptions.def
===
--- include/clang/Frontend/CodeGenOptions.def
+++ include/clang/Frontend/CodeGenOptions.def
@@ -339,6 +339,7 @@
 /// Whether to emit an address-significance table into the object file.
 CODEGENOPT(Addrsig, 1, 0)
 
+ENUM_CODEGENOPT(SignReturnAddress, SignReturnAddressScope, 2, None)
 
 #undef CODEGENOPT
 #undef ENUM_CODEGENOPT
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.t

[PATCH] D50135: [libunwind] [CMake] Allow building standalone without any llvm-config available

2018-08-01 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo created this revision.
mstorsjo added reviewers: phosek, beanz, compnerd, smeenai.
Herald added subscribers: chrib, mgorny.

This is the same as libcxxabi/libcxx do.


Repository:
  rUNW libunwind

https://reviews.llvm.org/D50135

Files:
  CMakeLists.txt


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -66,17 +66,18 @@
   set(LLVM_CMAKE_PATH 
"${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
 endif()
   else()
-message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not 
defined. "
-"Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
-"or -DLLVM_PATH=path/to/llvm-source-root.")
+message(WARNING "UNSUPPORTED LIBUNWIND CONFIGURATION DETECTED: "
+"llvm-config not found and LLVM_MAIN_SRC_DIR not defined. "
+"Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
+"or -DLLVM_PATH=path/to/llvm-source-root.")
   endif()
 
   if (EXISTS ${LLVM_CMAKE_PATH})
 list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
 include("${LLVM_CMAKE_PATH}/AddLLVM.cmake")
 include("${LLVM_CMAKE_PATH}/HandleLLVMOptions.cmake")
   else()
-message(FATAL_ERROR "Not found: ${LLVM_CMAKE_PATH}")
+message(WARNING "Not found: ${LLVM_CMAKE_PATH}")
   endif()
 
   set(PACKAGE_NAME libunwind)
@@ -359,4 +360,6 @@
   add_subdirectory(docs)
 endif()
 
-add_subdirectory(test)
+if (EXISTS ${LLVM_CMAKE_PATH})
+  add_subdirectory(test)
+endif()


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -66,17 +66,18 @@
   set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
 endif()
   else()
-message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. "
-"Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
-"or -DLLVM_PATH=path/to/llvm-source-root.")
+message(WARNING "UNSUPPORTED LIBUNWIND CONFIGURATION DETECTED: "
+"llvm-config not found and LLVM_MAIN_SRC_DIR not defined. "
+"Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
+"or -DLLVM_PATH=path/to/llvm-source-root.")
   endif()
 
   if (EXISTS ${LLVM_CMAKE_PATH})
 list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
 include("${LLVM_CMAKE_PATH}/AddLLVM.cmake")
 include("${LLVM_CMAKE_PATH}/HandleLLVMOptions.cmake")
   else()
-message(FATAL_ERROR "Not found: ${LLVM_CMAKE_PATH}")
+message(WARNING "Not found: ${LLVM_CMAKE_PATH}")
   endif()
 
   set(PACKAGE_NAME libunwind)
@@ -359,4 +360,6 @@
   add_subdirectory(docs)
 endif()
 
-add_subdirectory(test)
+if (EXISTS ${LLVM_CMAKE_PATH})
+  add_subdirectory(test)
+endif()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50102: [clang-tidy] Use ExprMutationAnalyzer in performance-unnecessary-value-param

2018-08-01 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

Mostly good. A few nits.




Comment at: clang-tidy/performance/UnnecessaryValueParamCheck.cpp:103
 
   // Do not trigger on non-const value parameters when they are not only used 
as
   // const.

This comment needs to be updated.



Comment at: clang-tidy/performance/UnnecessaryValueParamCheck.cpp:108
 return;
+  if (const auto *Ctor = dyn_cast(Function)) {
+for (const auto *Init : Ctor->inits()) {

Is this a new fix or  a special case not being caught by 
`ExprMutationAnalyzer`?  Do we have a test case covered it?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D50102



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


[PATCH] D50138: [clang-format] Add @private to the list of jsdoc annotations

2018-08-01 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir created this revision.
krasimir added a reviewer: mprobst.
Herald added subscribers: cfe-commits, acoomans.

Repository:
  rC Clang

https://reviews.llvm.org/D50138

Files:
  lib/Format/BreakableToken.cpp


Index: lib/Format/BreakableToken.cpp
===
--- lib/Format/BreakableToken.cpp
+++ lib/Format/BreakableToken.cpp
@@ -514,7 +514,7 @@
 const llvm::StringSet<>
 BreakableBlockComment::ContentIndentingJavadocAnnotations = {
 "@param", "@return", "@returns", "@throws",  "@type", "@template",
-"@see",   "@deprecated", "@define",  "@exports", "@mods",
+"@see",   "@deprecated", "@define",  "@exports", "@mods", "@private",
 };
 
 unsigned BreakableBlockComment::getContentIndent(unsigned LineIndex) const {


Index: lib/Format/BreakableToken.cpp
===
--- lib/Format/BreakableToken.cpp
+++ lib/Format/BreakableToken.cpp
@@ -514,7 +514,7 @@
 const llvm::StringSet<>
 BreakableBlockComment::ContentIndentingJavadocAnnotations = {
 "@param", "@return", "@returns", "@throws",  "@type", "@template",
-"@see",   "@deprecated", "@define",  "@exports", "@mods",
+"@see",   "@deprecated", "@define",  "@exports", "@mods", "@private",
 };
 
 unsigned BreakableBlockComment::getContentIndent(unsigned LineIndex) const {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49729: [AST][1/4] Move the bit-fields from TagDecl, EnumDecl and RecordDecl into DeclContext

2018-08-01 Thread Bruno Ricci via Phabricator via cfe-commits
bricci updated this revision to Diff 158498.
bricci added a comment.

rebased after the great whitespace trimming


Repository:
  rC Clang

https://reviews.llvm.org/D49729

Files:
  include/clang/AST/Decl.h
  include/clang/AST/DeclBase.h
  lib/AST/Decl.cpp
  lib/AST/DeclBase.cpp
  lib/AST/DeclCXX.cpp
  lib/AST/DeclTemplate.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriter.cpp
  lib/Serialization/ASTWriterDecl.cpp

Index: lib/Serialization/ASTWriterDecl.cpp
===
--- lib/Serialization/ASTWriterDecl.cpp
+++ lib/Serialization/ASTWriterDecl.cpp
@@ -1275,7 +1275,7 @@
 
   // Store (what we currently believe to be) the key function to avoid
   // deserializing every method so we can compute it.
-  if (D->IsCompleteDefinition)
+  if (D->isCompleteDefinition())
 Record.AddDeclRef(Context.getCurrentKeyFunction(D));
 
   Code = serialization::DECL_CXX_RECORD;
Index: lib/Serialization/ASTWriter.cpp
===
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -3960,7 +3960,8 @@
 
 bool ASTWriter::isLookupResultExternal(StoredDeclsList &Result,
DeclContext *DC) {
-  return Result.hasExternalDecls() && DC->NeedToReconcileExternalVisibleStorage;
+  return Result.hasExternalDecls() &&
+ DC->hasNeedToReconcileExternalVisibleStorage();
 }
 
 bool ASTWriter::isLookupResultEntirelyExternal(StoredDeclsList &Result,
@@ -3975,8 +3976,8 @@
 void
 ASTWriter::GenerateNameLookupTable(const DeclContext *ConstDC,
llvm::SmallVectorImpl &LookupTable) {
-  assert(!ConstDC->HasLazyLocalLexicalLookups &&
- !ConstDC->HasLazyExternalLexicalLookups &&
+  assert(!ConstDC->hasLazyLocalLexicalLookups() &&
+ !ConstDC->hasLazyExternalLexicalLookups() &&
  "must call buildLookups first");
 
   // FIXME: We need to build the lookups table, which is logically const.
Index: lib/Serialization/ASTReaderDecl.cpp
===
--- lib/Serialization/ASTReaderDecl.cpp
+++ lib/Serialization/ASTReaderDecl.cpp
@@ -742,16 +742,16 @@
   ED->setPromotionType(Record.readType());
   ED->setNumPositiveBits(Record.readInt());
   ED->setNumNegativeBits(Record.readInt());
-  ED->IsScoped = Record.readInt();
-  ED->IsScopedUsingClassTag = Record.readInt();
-  ED->IsFixed = Record.readInt();
+  ED->setScoped(Record.readInt());
+  ED->setScopedUsingClassTag(Record.readInt());
+  ED->setFixed(Record.readInt());
 
-  ED->HasODRHash = true;
+  ED->setHasODRHash(true);
   ED->ODRHash = Record.readInt();
 
   // If this is a definition subject to the ODR, and we already have a
   // definition, merge this one into it.
-  if (ED->IsCompleteDefinition &&
+  if (ED->isCompleteDefinition() &&
   Reader.getContext().getLangOpts().Modules &&
   Reader.getContext().getLangOpts().CPlusPlus) {
 EnumDecl *&OldDef = Reader.EnumDefinitions[ED->getCanonicalDecl()];
@@ -767,7 +767,7 @@
 }
 if (OldDef) {
   Reader.MergedDeclContexts.insert(std::make_pair(ED, OldDef));
-  ED->IsCompleteDefinition = false;
+  ED->setCompleteDefinition(false);
   Reader.mergeDefinitionVisibility(OldDef, ED);
   if (OldDef->getODRHash() != ED->getODRHash())
 Reader.PendingEnumOdrMergeFailures[OldDef].push_back(ED);
@@ -1744,7 +1744,7 @@
 Reader.MergedDeclContexts.insert(std::make_pair(MergeDD.Definition,
 DD.Definition));
 Reader.PendingDefinitions.erase(MergeDD.Definition);
-MergeDD.Definition->IsCompleteDefinition = false;
+MergeDD.Definition->setCompleteDefinition(false);
 Reader.mergeDefinitionVisibility(DD.Definition, MergeDD.Definition);
 assert(Reader.Lookups.find(MergeDD.Definition) == Reader.Lookups.end() &&
"already loaded pending lookups for merged definition");
@@ -1884,7 +1884,7 @@
   }
 
   // Mark this declaration as being a definition.
-  D->IsCompleteDefinition = true;
+  D->setCompleteDefinition(true);
 
   // If this is not the first declaration or is an update record, we can have
   // other redeclarations already. Make a note that we need to propagate the
@@ -1946,7 +1946,7 @@
   // compute it.
   if (WasDefinition) {
 DeclID KeyFn = ReadDeclID();
-if (KeyFn && D->IsCompleteDefinition)
+if (KeyFn && D->isCompleteDefinition())
   // FIXME: This is wrong for the ARM ABI, where some other module may have
   // made this function no longer be a key function. We need an update
   // record or similar for that case.
@@ -3076,7 +3076,7 @@
 // we load the update record.
 if (!DD) {
   DD = new (Reader.getContext()) struct CXXRecordDecl::DefinitionData(RD);
-  RD->IsCompleteDefinition = true;
+  RD->setCompleteDefinition(true);
   RD->DefinitionData = DD;
   RD->getCanonicalDecl()->Definiti

[PATCH] D49734: [AST][4/4] Move the bit-fields from ObjCMethodDecl and ObjCContainerDecl into DeclContext

2018-08-01 Thread Bruno Ricci via Phabricator via cfe-commits
bricci updated this revision to Diff 158499.
bricci added a comment.

rebased after the great whitespace trimming


Repository:
  rC Clang

https://reviews.llvm.org/D49734

Files:
  include/clang/AST/DeclObjC.h
  lib/AST/DeclObjC.cpp
  lib/Sema/SemaDeclObjC.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriterDecl.cpp

Index: lib/Serialization/ASTWriterDecl.cpp
===
--- lib/Serialization/ASTWriterDecl.cpp
+++ lib/Serialization/ASTWriterDecl.cpp
@@ -647,12 +647,12 @@
   Record.push_back(D->isVariadic());
   Record.push_back(D->isPropertyAccessor());
   Record.push_back(D->isDefined());
-  Record.push_back(D->IsOverriding);
-  Record.push_back(D->HasSkippedBody);
+  Record.push_back(D->isOverriding());
+  Record.push_back(D->hasSkippedBody());
 
-  Record.push_back(D->IsRedeclaration);
-  Record.push_back(D->HasRedeclaration);
-  if (D->HasRedeclaration) {
+  Record.push_back(D->isRedeclaration());
+  Record.push_back(D->hasRedeclaration());
+  if (D->hasRedeclaration()) {
 assert(Context.getObjCMethodRedeclaration(D));
 Record.AddDeclRef(Context.getObjCMethodRedeclaration(D));
   }
@@ -669,7 +669,7 @@
   for (const auto *P : D->parameters())
 Record.AddDeclRef(P);
 
-  Record.push_back(D->SelLocsKind);
+  Record.push_back(D->getSelLocsKind());
   unsigned NumStoredSelLocs = D->getNumStoredSelLocs();
   SourceLocation *SelLocs = D->getStoredSelLocs();
   Record.push_back(NumStoredSelLocs);
Index: lib/Serialization/ASTReaderDecl.cpp
===
--- lib/Serialization/ASTReaderDecl.cpp
+++ lib/Serialization/ASTReaderDecl.cpp
@@ -1007,18 +1007,18 @@
   MD->setVariadic(Record.readInt());
   MD->setPropertyAccessor(Record.readInt());
   MD->setDefined(Record.readInt());
-  MD->IsOverriding = Record.readInt();
-  MD->HasSkippedBody = Record.readInt();
+  MD->setOverriding(Record.readInt());
+  MD->setHasSkippedBody(Record.readInt());
 
-  MD->IsRedeclaration = Record.readInt();
-  MD->HasRedeclaration = Record.readInt();
-  if (MD->HasRedeclaration)
+  MD->setIsRedeclaration(Record.readInt());
+  MD->setHasRedeclaration(Record.readInt());
+  if (MD->hasRedeclaration())
 Reader.getContext().setObjCMethodRedeclaration(MD,
ReadDeclAs());
 
   MD->setDeclImplementation((ObjCMethodDecl::ImplementationControl)Record.readInt());
   MD->setObjCDeclQualifier((Decl::ObjCDeclQualifier)Record.readInt());
-  MD->SetRelatedResultType(Record.readInt());
+  MD->setRelatedResultType(Record.readInt());
   MD->setReturnType(Record.readType());
   MD->setReturnTypeSourceInfo(GetTypeSourceInfo());
   MD->DeclEndLoc = ReadSourceLocation();
@@ -1028,7 +1028,7 @@
   for (unsigned I = 0; I != NumParams; ++I)
 Params.push_back(ReadDeclAs());
 
-  MD->SelLocsKind = Record.readInt();
+  MD->setSelLocsKind((SelectorLocationsKind)Record.readInt());
   unsigned NumStoredSelLocs = Record.readInt();
   SmallVector SelLocs;
   SelLocs.reserve(NumStoredSelLocs);
Index: lib/Sema/SemaDeclObjC.cpp
===
--- lib/Sema/SemaDeclObjC.cpp
+++ lib/Sema/SemaDeclObjC.cpp
@@ -4351,7 +4351,7 @@
 
 // Propagate down the 'related result type' bit from overridden methods.
 if (RTC != Sema::RTC_Incompatible && overridden->hasRelatedResultType())
-  ObjCMethod->SetRelatedResultType();
+  ObjCMethod->setRelatedResultType();
 
 // Then merge the declarations.
 mergeObjCMethodDecls(ObjCMethod, overridden);
@@ -4746,7 +4746,7 @@
 
 if (InferRelatedResultType &&
 !ObjCMethod->getReturnType()->isObjCIndependentClassType())
-  ObjCMethod->SetRelatedResultType();
+  ObjCMethod->setRelatedResultType();
   }
 
   if (MethodDefinition &&
Index: lib/AST/DeclObjC.cpp
===
--- lib/AST/DeclObjC.cpp
+++ lib/AST/DeclObjC.cpp
@@ -65,6 +65,13 @@
 // ObjCInterfaceDecl
 //===--===//
 
+ObjCContainerDecl::ObjCContainerDecl(Kind DK, DeclContext *DC,
+ IdentifierInfo *Id, SourceLocation nameLoc,
+ SourceLocation atStartLoc)
+: NamedDecl(DK, DC, nameLoc, Id), DeclContext(DK) {
+  setAtStartLoc(atStartLoc);
+}
+
 void ObjCContainerDecl::anchor() {}
 
 /// getIvarDecl - This method looks up an ivar in this ContextDecl.
@@ -769,6 +776,44 @@
 // ObjCMethodDecl
 //===--===//
 
+ObjCMethodDecl::ObjCMethodDecl(SourceLocation beginLoc, SourceLocation endLoc,
+   Selector SelInfo, QualType T,
+   TypeSourceInfo *ReturnTInfo,
+   DeclContext *contextDecl, bool isInstance,
+   bool isVariadic, bool isPropertyAccessor,
+   

[PATCH] D49733: [AST][3/4] Move the bit-fields from BlockDecl, LinkageSpecDecl and OMPDeclareReductionDecl into DeclContext

2018-08-01 Thread Bruno Ricci via Phabricator via cfe-commits
bricci updated this revision to Diff 158500.
bricci added a comment.

rebased after the great whitespace trimming


Repository:
  rC Clang

https://reviews.llvm.org/D49733

Files:
  include/clang/AST/Decl.h
  include/clang/AST/DeclCXX.h
  include/clang/AST/DeclOpenMP.h
  lib/AST/Decl.cpp
  lib/AST/DeclCXX.cpp
  lib/AST/DeclOpenMP.cpp

Index: lib/AST/DeclOpenMP.cpp
===
--- lib/AST/DeclOpenMP.cpp
+++ lib/AST/DeclOpenMP.cpp
@@ -57,6 +57,14 @@
 // OMPDeclareReductionDecl Implementation.
 //===--===//
 
+OMPDeclareReductionDecl::OMPDeclareReductionDecl(
+Kind DK, DeclContext *DC, SourceLocation L, DeclarationName Name,
+QualType Ty, OMPDeclareReductionDecl *PrevDeclInScope)
+: ValueDecl(DK, DC, L, Name, Ty), DeclContext(DK), Combiner(nullptr),
+  PrevDeclInScope(PrevDeclInScope) {
+  setInitializer(nullptr, CallInit);
+}
+
 void OMPDeclareReductionDecl::anchor() {}
 
 OMPDeclareReductionDecl *OMPDeclareReductionDecl::Create(
Index: lib/AST/DeclCXX.cpp
===
--- lib/AST/DeclCXX.cpp
+++ lib/AST/DeclCXX.cpp
@@ -2466,6 +2466,15 @@
  getConversionType()->isBlockPointerType();
 }
 
+LinkageSpecDecl::LinkageSpecDecl(DeclContext *DC, SourceLocation ExternLoc,
+ SourceLocation LangLoc, LanguageIDs lang,
+ bool HasBraces)
+: Decl(LinkageSpec, DC, LangLoc), DeclContext(LinkageSpec),
+  ExternLoc(ExternLoc), RBraceLoc(SourceLocation()) {
+  setLanguage(lang);
+  LinkageSpecDeclBits.HasBraces = HasBraces;
+}
+
 void LinkageSpecDecl::anchor() {}
 
 LinkageSpecDecl *LinkageSpecDecl::Create(ASTContext &C,
Index: lib/AST/Decl.cpp
===
--- lib/AST/Decl.cpp
+++ lib/AST/Decl.cpp
@@ -4215,6 +4215,15 @@
 // BlockDecl Implementation
 //===--===//
 
+BlockDecl::BlockDecl(DeclContext *DC, SourceLocation CaretLoc)
+: Decl(Block, DC, CaretLoc), DeclContext(Block) {
+  setIsVariadic(false);
+  setCapturesCXXThis(false);
+  setBlockMissingReturnType(true);
+  setIsConversionFromLambda(false);
+  setDoesNotEscape(false);
+}
+
 void BlockDecl::setParams(ArrayRef NewParamInfo) {
   assert(!ParamInfo && "Already has param info!");
 
@@ -4228,7 +4237,7 @@
 
 void BlockDecl::setCaptures(ASTContext &Context, ArrayRef Captures,
 bool CapturesCXXThis) {
-  this->CapturesCXXThis = CapturesCXXThis;
+  this->setCapturesCXXThis(CapturesCXXThis);
   this->NumCaptures = Captures.size();
 
   if (Captures.empty()) {
Index: include/clang/AST/DeclOpenMP.h
===
--- include/clang/AST/DeclOpenMP.h
+++ include/clang/AST/DeclOpenMP.h
@@ -100,6 +100,8 @@
 ///
 /// Here 'omp_out += omp_in' is a combiner and 'omp_priv = 0' is an initializer.
 class OMPDeclareReductionDecl final : public ValueDecl, public DeclContext {
+  // This class stores some data in DeclContext::OMPDeclareReductionDeclBits
+  // to save some space. Use the provided accessors to access it.
 public:
   enum InitKind {
 CallInit,   // Initialized by function call.
@@ -113,8 +115,6 @@
   Expr *Combiner;
   /// Initializer for declare reduction construct.
   Expr *Initializer;
-  /// Kind of initializer - function call or omp_priv initializtion.
-  InitKind InitializerKind = CallInit;
 
   /// Reference to the previous declare reduction construct in the same
   /// scope with the same name. Required for proper templates instantiation if
@@ -125,10 +125,7 @@
 
   OMPDeclareReductionDecl(Kind DK, DeclContext *DC, SourceLocation L,
   DeclarationName Name, QualType Ty,
-  OMPDeclareReductionDecl *PrevDeclInScope)
-  : ValueDecl(DK, DC, L, Name, Ty), DeclContext(DK), Combiner(nullptr),
-Initializer(nullptr), InitializerKind(CallInit),
-PrevDeclInScope(PrevDeclInScope) {}
+  OMPDeclareReductionDecl *PrevDeclInScope);
 
   void setPrevDeclInScope(OMPDeclareReductionDecl *Prev) {
 PrevDeclInScope = Prev;
@@ -154,11 +151,13 @@
   Expr *getInitializer() { return Initializer; }
   const Expr *getInitializer() const { return Initializer; }
   /// Get initializer kind.
-  InitKind getInitializerKind() const { return InitializerKind; }
+  InitKind getInitializerKind() const {
+return static_cast(OMPDeclareReductionDeclBits.InitializerKind);
+  }
   /// Set initializer expression for the declare reduction construct.
   void setInitializer(Expr *E, InitKind IK) {
 Initializer = E;
-InitializerKind = IK;
+OMPDeclareReductionDeclBits.InitializerKind = IK;
   }
 
   /// Get reference to previous declare reduction construct in the same
Index: include/clang/AST/DeclCXX.h
===

[PATCH] D49657: [clangd] Make SymbolLocation => bool conversion explicitly.

2018-08-01 Thread Haojian Wu via Phabricator via cfe-commits
hokein marked an inline comment as done.
hokein added inline comments.



Comment at: clangd/index/Index.h:45
 
-  operator bool() const { return !FileURI.empty(); }
+  explicit operator bool() const { return !FileURI.empty(); }
+  bool operator==(const SymbolLocation& Loc) const {

ilya-biryukov wrote:
> Maybe we should go even further and replace this with an `isValid` method? 
> Conversion ops are confusing.
I think making the bool operator explicit is sufficient to avoid the scary 
implicit-conversion problem. 


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D49657



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


[clang-tools-extra] r338517 - [clangd] Make SymbolLocation => bool conversion explicitly.

2018-08-01 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Wed Aug  1 04:24:50 2018
New Revision: 338517

URL: http://llvm.org/viewvc/llvm-project?rev=338517&view=rev
Log:
[clangd] Make SymbolLocation => bool conversion explicitly.

Summary:
The implicit bool conversion could happen superisingly, e.g. when
checking `if (Loc1 == Loc2)`, the compiler will convert SymbolLocation to
bool before comparing (because we don't define operator `==` for 
SymbolLocation).

Reviewers: sammccall

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

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

Modified:
clang-tools-extra/trunk/clangd/index/Index.h

Modified: clang-tools-extra/trunk/clangd/index/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/Index.h?rev=338517&r1=338516&r2=338517&view=diff
==
--- clang-tools-extra/trunk/clangd/index/Index.h (original)
+++ clang-tools-extra/trunk/clangd/index/Index.h Wed Aug  1 04:24:50 2018
@@ -30,6 +30,9 @@ struct SymbolLocation {
 uint32_t Line = 0; // 0-based
 // Using UTF-16 code units.
 uint32_t Column = 0; // 0-based
+bool operator==(const Position& P) const {
+  return Line == P.Line && Column == P.Column;
+}
   };
 
   // The URI of the source file where a symbol occurs.
@@ -39,7 +42,11 @@ struct SymbolLocation {
   Position Start;
   Position End;
 
-  operator bool() const { return !FileURI.empty(); }
+  explicit operator bool() const { return !FileURI.empty(); }
+  bool operator==(const SymbolLocation& Loc) const {
+return std::tie(FileURI, Start, End) ==
+   std::tie(Loc.FileURI, Loc.Start, Loc.End);
+  }
 };
 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const SymbolLocation &);
 


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


[PATCH] D49657: [clangd] Make SymbolLocation => bool conversion explicitly.

2018-08-01 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
hokein marked an inline comment as done.
Closed by commit rCTE338517: [clangd] Make SymbolLocation => bool conversion 
explicitly. (authored by hokein, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D49657?vs=156723&id=158502#toc

Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D49657

Files:
  clangd/index/Index.h


Index: clangd/index/Index.h
===
--- clangd/index/Index.h
+++ clangd/index/Index.h
@@ -30,6 +30,9 @@
 uint32_t Line = 0; // 0-based
 // Using UTF-16 code units.
 uint32_t Column = 0; // 0-based
+bool operator==(const Position& P) const {
+  return Line == P.Line && Column == P.Column;
+}
   };
 
   // The URI of the source file where a symbol occurs.
@@ -39,7 +42,11 @@
   Position Start;
   Position End;
 
-  operator bool() const { return !FileURI.empty(); }
+  explicit operator bool() const { return !FileURI.empty(); }
+  bool operator==(const SymbolLocation& Loc) const {
+return std::tie(FileURI, Start, End) ==
+   std::tie(Loc.FileURI, Loc.Start, Loc.End);
+  }
 };
 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const SymbolLocation &);
 


Index: clangd/index/Index.h
===
--- clangd/index/Index.h
+++ clangd/index/Index.h
@@ -30,6 +30,9 @@
 uint32_t Line = 0; // 0-based
 // Using UTF-16 code units.
 uint32_t Column = 0; // 0-based
+bool operator==(const Position& P) const {
+  return Line == P.Line && Column == P.Column;
+}
   };
 
   // The URI of the source file where a symbol occurs.
@@ -39,7 +42,11 @@
   Position Start;
   Position End;
 
-  operator bool() const { return !FileURI.empty(); }
+  explicit operator bool() const { return !FileURI.empty(); }
+  bool operator==(const SymbolLocation& Loc) const {
+return std::tie(FileURI, Start, End) ==
+   std::tie(Loc.FileURI, Loc.Start, Loc.End);
+  }
 };
 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const SymbolLocation &);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49732: [AST][2/4] Move the bit-fields from FunctionDecl and CXXConstructorDecl into DeclContext

2018-08-01 Thread Bruno Ricci via Phabricator via cfe-commits
bricci updated this revision to Diff 158501.
bricci added a comment.

rebased after the great whitespace trimming


Repository:
  rC Clang

https://reviews.llvm.org/D49732

Files:
  include/clang/AST/Decl.h
  include/clang/AST/DeclCXX.h
  lib/AST/Decl.cpp
  lib/AST/DeclCXX.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriterDecl.cpp

Index: lib/Serialization/ASTWriterDecl.cpp
===
--- lib/Serialization/ASTWriterDecl.cpp
+++ lib/Serialization/ASTWriterDecl.cpp
@@ -529,26 +529,25 @@
 
   // FunctionDecl's body is handled last at ASTWriterDecl::Visit,
   // after everything else is written.
-
-  Record.push_back((int)D->SClass); // FIXME: stable encoding
-  Record.push_back(D->IsInline);
-  Record.push_back(D->IsInlineSpecified);
-  Record.push_back(D->IsExplicitSpecified);
-  Record.push_back(D->IsVirtualAsWritten);
-  Record.push_back(D->IsPure);
-  Record.push_back(D->HasInheritedPrototype);
-  Record.push_back(D->HasWrittenPrototype);
-  Record.push_back(D->IsDeleted);
-  Record.push_back(D->IsTrivial);
-  Record.push_back(D->IsTrivialForCall);
-  Record.push_back(D->IsDefaulted);
-  Record.push_back(D->IsExplicitlyDefaulted);
-  Record.push_back(D->HasImplicitReturnZero);
-  Record.push_back(D->IsConstexpr);
-  Record.push_back(D->UsesSEHTry);
-  Record.push_back(D->HasSkippedBody);
-  Record.push_back(D->IsMultiVersion);
-  Record.push_back(D->IsLateTemplateParsed);
+  Record.push_back(static_cast(D->getStorageClass())); // FIXME: stable encoding
+  Record.push_back(D->isInlineSpecified());
+  Record.push_back(D->isInlined());
+  Record.push_back(D->isExplicitSpecified());
+  Record.push_back(D->isVirtualAsWritten());
+  Record.push_back(D->isPure());
+  Record.push_back(D->hasInheritedPrototype());
+  Record.push_back(D->hasWrittenPrototype());
+  Record.push_back(D->isDeletedBit());
+  Record.push_back(D->isTrivial());
+  Record.push_back(D->isTrivialForCall());
+  Record.push_back(D->isDefaulted());
+  Record.push_back(D->isExplicitlyDefaulted());
+  Record.push_back(D->hasImplicitReturnZero());
+  Record.push_back(D->isConstexpr());
+  Record.push_back(D->usesSEHTry());
+  Record.push_back(D->hasSkippedBody());
+  Record.push_back(D->isMultiVersion());
+  Record.push_back(D->isLateTemplateParsed());
   Record.push_back(D->getLinkageInternal());
   Record.AddSourceLocation(D->getLocEnd());
 
@@ -628,7 +627,7 @@
 
 void ASTDeclWriter::VisitCXXDeductionGuideDecl(CXXDeductionGuideDecl *D) {
   VisitFunctionDecl(D);
-  Record.push_back(D->IsCopyDeductionCandidate);
+  Record.push_back(D->isCopyDeductionCandidate());
   Code = serialization::DECL_CXX_DEDUCTION_GUIDE;
 }
 
Index: lib/Serialization/ASTReaderDecl.cpp
===
--- lib/Serialization/ASTReaderDecl.cpp
+++ lib/Serialization/ASTReaderDecl.cpp
@@ -506,8 +506,8 @@
   if (Record.readInt())
 Reader.DefinitionSource[FD] = Loc.F->Kind == ModuleKind::MK_MainFile;
   if (auto *CD = dyn_cast(FD)) {
-CD->NumCtorInitializers = Record.readInt();
-if (CD->NumCtorInitializers)
+CD->setNumCtorInitializers(Record.readInt());
+if (CD->getNumCtorInitializers())
   CD->CtorInitializers = ReadGlobalOffset();
   }
   // Store the offset of the body so we can lazily load it later.
@@ -855,30 +855,31 @@
   // FunctionDecl's body is handled last at ASTDeclReader::Visit,
   // after everything else is read.
 
-  FD->SClass = (StorageClass)Record.readInt();
-  FD->IsInline = Record.readInt();
-  FD->IsInlineSpecified = Record.readInt();
-  FD->IsExplicitSpecified = Record.readInt();
-  FD->IsVirtualAsWritten = Record.readInt();
-  FD->IsPure = Record.readInt();
-  FD->HasInheritedPrototype = Record.readInt();
-  FD->HasWrittenPrototype = Record.readInt();
-  FD->IsDeleted = Record.readInt();
-  FD->IsTrivial = Record.readInt();
-  FD->IsTrivialForCall = Record.readInt();
-  FD->IsDefaulted = Record.readInt();
-  FD->IsExplicitlyDefaulted = Record.readInt();
-  FD->HasImplicitReturnZero = Record.readInt();
-  FD->IsConstexpr = Record.readInt();
-  FD->UsesSEHTry = Record.readInt();
-  FD->HasSkippedBody = Record.readInt();
-  FD->IsMultiVersion = Record.readInt();
-  FD->IsLateTemplateParsed = Record.readInt();
-  FD->setCachedLinkage(Linkage(Record.readInt()));
+  FD->setStorageClass(static_cast(Record.readInt()));
+  FD->setInlineSpecified(Record.readInt());
+  FD->setImplicitlyInline(Record.readInt());
+  FD->setExplicitSpecified(Record.readInt());
+  FD->setVirtualAsWritten(Record.readInt());
+  FD->setPure(Record.readInt());
+  FD->setHasInheritedPrototype(Record.readInt());
+  FD->setHasWrittenPrototype(Record.readInt());
+  FD->setDeletedAsWritten(Record.readInt());
+  FD->setTrivial(Record.readInt());
+  FD->setTrivialForCall(Record.readInt());
+  FD->setDefaulted(Record.readInt());
+  FD->setExplicitlyDefaulted(Record.readInt());
+  FD->setHasImplicitReturnZero(Record.readInt());
+  FD->setConstexpr(Re

[clang-tools-extra] r338518 - [clangd] Receive compilationDatabasePath in 'initialize' request

2018-08-01 Thread Simon Marchi via cfe-commits
Author: simark
Date: Wed Aug  1 04:28:49 2018
New Revision: 338518

URL: http://llvm.org/viewvc/llvm-project?rev=338518&view=rev
Log:
[clangd] Receive compilationDatabasePath in 'initialize' request

Summary:
That way, as soon as the "initialize" is received by the server, it can start
parsing/indexing with a valid compilation database and not have to wait for a
an initial 'didChangeConfiguration' that might or might not happen.
Then, when the user changes configuration, a didChangeConfiguration can be sent.

Signed-off-by: Marc-Andre Laperle 

Reviewers: malaperle

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

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

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

Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp?rev=338518&r1=338517&r2=338518&view=diff
==
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp Wed Aug  1 04:28:49 2018
@@ -72,6 +72,9 @@ SymbolKindBitset defaultSymbolKinds() {
 } // namespace
 
 void ClangdLSPServer::onInitialize(InitializeParams &Params) {
+  if (Params.initializationOptions)
+applyConfiguration(*Params.initializationOptions);
+
   if (Params.rootUri && *Params.rootUri)
 Server.setRootPath(Params.rootUri->file());
   else if (Params.rootPath && !Params.rootPath->empty())
@@ -398,11 +401,8 @@ void ClangdLSPServer::onHover(TextDocume
});
 }
 
-// FIXME: This function needs to be properly tested.
-void ClangdLSPServer::onChangeConfiguration(
-DidChangeConfigurationParams &Params) {
-  ClangdConfigurationParamsChange &Settings = Params.settings;
-
+void ClangdLSPServer::applyConfiguration(
+const ClangdConfigurationParamsChange &Settings) {
   // Compilation database change.
   if (Settings.compilationDatabasePath.hasValue()) {
 NonCachedCDB.setCompileCommandsDir(
@@ -413,6 +413,12 @@ void ClangdLSPServer::onChangeConfigurat
   }
 }
 
+// FIXME: This function needs to be properly tested.
+void ClangdLSPServer::onChangeConfiguration(
+DidChangeConfigurationParams &Params) {
+  applyConfiguration(Params.settings);
+}
+
 ClangdLSPServer::ClangdLSPServer(JSONOutput &Out,
  const clangd::CodeCompleteOptions &CCOpts,
  llvm::Optional CompileCommandsDir,

Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.h?rev=338518&r1=338517&r2=338518&view=diff
==
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.h (original)
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.h Wed Aug  1 04:28:49 2018
@@ -82,6 +82,7 @@ private:
   /// may be very expensive.  This method is normally called when the
   /// compilation database is changed.
   void reparseOpenedFiles();
+  void applyConfiguration(const ClangdConfigurationParamsChange &Settings);
 
   JSONOutput &Out;
   /// Used to indicate that the 'shutdown' request was received from the

Modified: clang-tools-extra/trunk/clangd/Protocol.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Protocol.cpp?rev=338518&r1=338517&r2=338518&view=diff
==
--- clang-tools-extra/trunk/clangd/Protocol.cpp (original)
+++ clang-tools-extra/trunk/clangd/Protocol.cpp Wed Aug  1 04:28:49 2018
@@ -263,7 +263,7 @@ bool fromJSON(const json::Value &Params,
   O.map("rootPath", R.rootPath);
   O.map("capabilities", R.capabilities);
   O.map("trace", R.trace);
-  // initializationOptions, capabilities unused
+  O.map("initializationOptions", R.initializationOptions);
   return true;
 }
 

Modified: clang-tools-extra/trunk/clangd/Protocol.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Protocol.h?rev=338518&r1=338517&r2=338518&view=diff
==
--- clang-tools-extra/trunk/clangd/Protocol.h (original)
+++ clang-tools-extra/trunk/clangd/Protocol.h Wed Aug  1 04:28:49 2018
@@ -322,6 +322,16 @@ struct ClientCapabilities {
 
 bool fromJSON(const llvm::json::Value &, ClientCapabilities &);
 
+/// Clangd extension to set clangd-specific "initializationOptions" in the
+/// "initialize" request and for the "workspace/didChangeConfiguration"
+/// notification since the data received is described as 'any' type in LSP.
+struct ClangdConfigurationParamsChange {
+  llvm::Optional compilationDatabasePath;
+};
+bool fromJSON(const llvm:

[PATCH] D49833: [clangd] Receive compilationDatabasePath in 'initialize' request

2018-08-01 Thread Simon Marchi via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL338518: [clangd] Receive compilationDatabasePath in 
'initialize' request (authored by simark, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49833?vs=158366&id=158503#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49833

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

Index: clang-tools-extra/trunk/clangd/ClangdLSPServer.h
===
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.h
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.h
@@ -82,6 +82,7 @@
   /// may be very expensive.  This method is normally called when the
   /// compilation database is changed.
   void reparseOpenedFiles();
+  void applyConfiguration(const ClangdConfigurationParamsChange &Settings);
 
   JSONOutput &Out;
   /// Used to indicate that the 'shutdown' request was received from the
Index: clang-tools-extra/trunk/clangd/Protocol.cpp
===
--- clang-tools-extra/trunk/clangd/Protocol.cpp
+++ clang-tools-extra/trunk/clangd/Protocol.cpp
@@ -263,7 +263,7 @@
   O.map("rootPath", R.rootPath);
   O.map("capabilities", R.capabilities);
   O.map("trace", R.trace);
-  // initializationOptions, capabilities unused
+  O.map("initializationOptions", R.initializationOptions);
   return true;
 }
 
Index: clang-tools-extra/trunk/clangd/Protocol.h
===
--- clang-tools-extra/trunk/clangd/Protocol.h
+++ clang-tools-extra/trunk/clangd/Protocol.h
@@ -322,6 +322,16 @@
 
 bool fromJSON(const llvm::json::Value &, ClientCapabilities &);
 
+/// Clangd extension to set clangd-specific "initializationOptions" in the
+/// "initialize" request and for the "workspace/didChangeConfiguration"
+/// notification since the data received is described as 'any' type in LSP.
+struct ClangdConfigurationParamsChange {
+  llvm::Optional compilationDatabasePath;
+};
+bool fromJSON(const llvm::json::Value &, ClangdConfigurationParamsChange &);
+
+struct ClangdInitializationOptions : public ClangdConfigurationParamsChange {};
+
 struct InitializeParams {
   /// The process Id of the parent process that started
   /// the server. Is null if the process has not been started by another
@@ -348,6 +358,10 @@
 
   /// The initial trace setting. If omitted trace is disabled ('off').
   llvm::Optional trace;
+
+  // We use this predefined struct because it is easier to use
+  // than the protocol specified type of 'any'.
+  llvm::Optional initializationOptions;
 };
 bool fromJSON(const llvm::json::Value &, InitializeParams &);
 
@@ -419,13 +433,6 @@
 };
 bool fromJSON(const llvm::json::Value &, DidChangeWatchedFilesParams &);
 
-/// Clangd extension to manage a workspace/didChangeConfiguration notification
-/// since the data received is described as 'any' type in LSP.
-struct ClangdConfigurationParamsChange {
-  llvm::Optional compilationDatabasePath;
-};
-bool fromJSON(const llvm::json::Value &, ClangdConfigurationParamsChange &);
-
 struct DidChangeConfigurationParams {
   // We use this predefined struct because it is easier to use
   // than the protocol specified type of 'any'.
Index: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
@@ -72,6 +72,9 @@
 } // namespace
 
 void ClangdLSPServer::onInitialize(InitializeParams &Params) {
+  if (Params.initializationOptions)
+applyConfiguration(*Params.initializationOptions);
+
   if (Params.rootUri && *Params.rootUri)
 Server.setRootPath(Params.rootUri->file());
   else if (Params.rootPath && !Params.rootPath->empty())
@@ -398,11 +401,8 @@
});
 }
 
-// FIXME: This function needs to be properly tested.
-void ClangdLSPServer::onChangeConfiguration(
-DidChangeConfigurationParams &Params) {
-  ClangdConfigurationParamsChange &Settings = Params.settings;
-
+void ClangdLSPServer::applyConfiguration(
+const ClangdConfigurationParamsChange &Settings) {
   // Compilation database change.
   if (Settings.compilationDatabasePath.hasValue()) {
 NonCachedCDB.setCompileCommandsDir(
@@ -413,6 +413,12 @@
   }
 }
 
+// FIXME: This function needs to be properly tested.
+void ClangdLSPServer::onChangeConfiguration(
+DidChangeConfigurationParams &Params) {
+  applyConfiguration(Params.settings);
+}
+
 ClangdLSPServer::ClangdLSPServer(JSONOutput &Out,
  const clangd::CodeCompleteOptions &CCOpts,
  llvm::Optional CompileCommandsDir,
__

[PATCH] D49833: [clangd] Receive compilationDatabasePath in 'initialize' request

2018-08-01 Thread Simon Marchi via Phabricator via cfe-commits
simark marked 2 inline comments as done.
simark added a comment.

Thanks, done.


Repository:
  rL LLVM

https://reviews.llvm.org/D49833



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


[PATCH] D49997: [libcxx] Fix _LIBCPP_NO_EXCEPTIONS redefined warning

2018-08-01 Thread Jason Lovett via Phabricator via cfe-commits
jasonl220 added a comment.

Can you commit this for me, I don't have access. Thanks


Repository:
  rCXX libc++

https://reviews.llvm.org/D49997



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


[PATCH] D50078: clang-format: support aligned nested conditionals formatting

2018-08-01 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added a comment.

Could you clarify how each piece is supposed to be aligned in these examples?
This is what makes me happy:

  // column  limit V
  int a = condition1 ? result1
: conditio2 ? result2
: loocondition 
  ? result2
  : dition3 ? resul3
: resul4;



  // column  limit V
  int a = condition1 
  ? loresult1
  : conditio2 ? result2
  : result4;

When BreakBeforeTernaryOperators is false:

  int a = condition1 ? result1 :
  conditio2 ? result2 :
  ditino3 ? resul3 :
result4;


Repository:
  rC Clang

https://reviews.llvm.org/D50078



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


r338519 - [clang-format] Add @private to the list of jsdoc annotations

2018-08-01 Thread Krasimir Georgiev via cfe-commits
Author: krasimir
Date: Wed Aug  1 04:48:04 2018
New Revision: 338519

URL: http://llvm.org/viewvc/llvm-project?rev=338519&view=rev
Log:
[clang-format] Add @private to the list of jsdoc annotations

Reviewers: mprobst

Reviewed By: mprobst

Subscribers: acoomans, cfe-commits

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

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

Modified: cfe/trunk/lib/Format/BreakableToken.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/BreakableToken.cpp?rev=338519&r1=338518&r2=338519&view=diff
==
--- cfe/trunk/lib/Format/BreakableToken.cpp (original)
+++ cfe/trunk/lib/Format/BreakableToken.cpp Wed Aug  1 04:48:04 2018
@@ -514,7 +514,7 @@ unsigned BreakableBlockComment::getConte
 const llvm::StringSet<>
 BreakableBlockComment::ContentIndentingJavadocAnnotations = {
 "@param", "@return", "@returns", "@throws",  "@type", "@template",
-"@see",   "@deprecated", "@define",  "@exports", "@mods",
+"@see",   "@deprecated", "@define",  "@exports", "@mods", "@private",
 };
 
 unsigned BreakableBlockComment::getContentIndent(unsigned LineIndex) const {


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


[PATCH] D50138: [clang-format] Add @private to the list of jsdoc annotations

2018-08-01 Thread Krasimir Georgiev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL338519: [clang-format] Add @private to the list of jsdoc 
annotations (authored by krasimir, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D50138

Files:
  cfe/trunk/lib/Format/BreakableToken.cpp


Index: cfe/trunk/lib/Format/BreakableToken.cpp
===
--- cfe/trunk/lib/Format/BreakableToken.cpp
+++ cfe/trunk/lib/Format/BreakableToken.cpp
@@ -514,7 +514,7 @@
 const llvm::StringSet<>
 BreakableBlockComment::ContentIndentingJavadocAnnotations = {
 "@param", "@return", "@returns", "@throws",  "@type", "@template",
-"@see",   "@deprecated", "@define",  "@exports", "@mods",
+"@see",   "@deprecated", "@define",  "@exports", "@mods", "@private",
 };
 
 unsigned BreakableBlockComment::getContentIndent(unsigned LineIndex) const {


Index: cfe/trunk/lib/Format/BreakableToken.cpp
===
--- cfe/trunk/lib/Format/BreakableToken.cpp
+++ cfe/trunk/lib/Format/BreakableToken.cpp
@@ -514,7 +514,7 @@
 const llvm::StringSet<>
 BreakableBlockComment::ContentIndentingJavadocAnnotations = {
 "@param", "@return", "@returns", "@throws",  "@type", "@template",
-"@see",   "@deprecated", "@define",  "@exports", "@mods",
+"@see",   "@deprecated", "@define",  "@exports", "@mods", "@private",
 };
 
 unsigned BreakableBlockComment::getContentIndent(unsigned LineIndex) const {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27651: [clang-format] Even with AlignConsecutiveDeclarations, PointerAlignment: Right should keep *s and &s to the right

2018-08-01 Thread Ken-Patrick Lehrmann via Phabricator via cfe-commits
KP added inline comments.



Comment at: unittests/Format/FormatTest.cpp:7878
+"  int const i   = 1;\n"
+"  int **j   = 2, ***k;\n"
+"  int  &k   = i;\n"

djasper wrote:
> This looks wrong to me. Wouldn't you want to align on the */& then? I.e.:
> 
>   int const i   = 1;
>   int   **j = 2, ***k;
>   int   &k  = i;
Sorry for the very late reply.
I believe no. In my mind (and how my organization wanted it) was to align on 
the variable names, and 'just' put the */& just before to it, without any space 
in between.

An other way of saying it would be: "PAS_Right means the */& stick with the 
variable name".
AlignConsecutiveDeclaration aligns the variable names, which give the results 
we have here.
We believe it is fine.

What you suggest breaks the alignment on the variable names, it looks wrong 
too...  Probably, there's not a perfect answer here.

I'd say it's better to have the variable names aligned. Wdyt ?




https://reviews.llvm.org/D27651



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


r338520 - wrap to 80 cols, no behavior change

2018-08-01 Thread Nico Weber via cfe-commits
Author: nico
Date: Wed Aug  1 04:56:20 2018
New Revision: 338520

URL: http://llvm.org/viewvc/llvm-project?rev=338520&view=rev
Log:
wrap to 80 cols, no behavior change

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

Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=338520&r1=338519&r2=338520&view=diff
==
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Wed Aug  1 04:56:20 2018
@@ -1373,13 +1373,14 @@ void MicrosoftCXXNameMangler::mangleTemp
   case TemplateArgument::Declaration: {
 const NamedDecl *ND = TA.getAsDecl();
 if (isa(ND) || isa(ND)) {
-  mangleMemberDataPointer(
-  
cast(ND->getDeclContext())->getMostRecentNonInjectedDecl(),
-  cast(ND));
+  mangleMemberDataPointer(cast(ND->getDeclContext())
+  ->getMostRecentNonInjectedDecl(),
+  cast(ND));
 } else if (const FunctionDecl *FD = dyn_cast(ND)) {
   const CXXMethodDecl *MD = dyn_cast(FD);
   if (MD && MD->isInstance()) {
-
mangleMemberFunctionPointer(MD->getParent()->getMostRecentNonInjectedDecl(), 
MD);
+mangleMemberFunctionPointer(
+MD->getParent()->getMostRecentNonInjectedDecl(), MD);
   } else {
 Out << "$1?";
 mangleName(FD);
@@ -2285,7 +2286,8 @@ void MicrosoftCXXNameMangler::mangleType
 
 // If you add a call to this, consider updating isArtificialTagType() too.
 void MicrosoftCXXNameMangler::mangleArtificalTagType(
-TagTypeKind TK, StringRef UnqualifiedName, ArrayRef 
NestedNames) {
+TagTypeKind TK, StringRef UnqualifiedName,
+ArrayRef NestedNames) {
   //  ::=  {[]+ | []}? @
   mangleTagTypeKind(TK);
 
@@ -2372,8 +2374,8 @@ void MicrosoftCXXNameMangler::mangleArra
 //::= 
 //  ::=  
 //   
-void MicrosoftCXXNameMangler::mangleType(const MemberPointerType *T, 
Qualifiers Quals,
- SourceRange Range) {
+void MicrosoftCXXNameMangler::mangleType(const MemberPointerType *T,
+ Qualifiers Quals, SourceRange Range) {
   QualType PointeeType = T->getPointeeType();
   manglePointerCVQualifiers(Quals);
   manglePointerExtQualifiers(Quals, PointeeType);


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


[PATCH] D49658: [clangd] Index Interfaces for Xrefs

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

Scope the patch to interfaces only.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D49658

Files:
  clangd/index/FileIndex.cpp
  clangd/index/FileIndex.h
  clangd/index/Index.h
  clangd/index/MemIndex.cpp
  clangd/index/MemIndex.h
  clangd/index/Merge.cpp
  unittests/clangd/CodeCompleteTests.cpp

Index: unittests/clangd/CodeCompleteTests.cpp
===
--- unittests/clangd/CodeCompleteTests.cpp
+++ unittests/clangd/CodeCompleteTests.cpp
@@ -893,6 +893,10 @@
   void lookup(const LookupRequest &,
   llvm::function_ref) const override {}
 
+  void findOccurrences(const OccurrencesRequest &Req,
+   llvm::function_ref
+   Callback) const override {}
+
   const std::vector allRequests() const { return Requests; }
 
 private:
Index: clangd/index/Merge.cpp
===
--- clangd/index/Merge.cpp
+++ clangd/index/Merge.cpp
@@ -7,6 +7,7 @@
 //
 //===-===//
 #include "Merge.h"
+#include "../Logger.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/raw_ostream.h"
 namespace clang {
@@ -74,6 +75,12 @@
 Callback(*Sym);
   }
 
+  void findOccurrences(const OccurrencesRequest &Req,
+   llvm::function_ref
+   Callback) const override {
+log("findOccurrences is not implemented.");
+  }
+
 private:
   const SymbolIndex *Dynamic, *Static;
 };
Index: clangd/index/MemIndex.h
===
--- clangd/index/MemIndex.h
+++ clangd/index/MemIndex.h
@@ -31,10 +31,14 @@
   fuzzyFind(const FuzzyFindRequest &Req,
 llvm::function_ref Callback) const override;
 
-  virtual void
+  void
   lookup(const LookupRequest &Req,
  llvm::function_ref Callback) const override;
 
+  void findOccurrences(const OccurrencesRequest &Req,
+   llvm::function_ref
+   Callback) const override;
+
 private:
   std::shared_ptr> Symbols;
   // Index is a set of symbols that are deduplicated by symbol IDs.
Index: clangd/index/MemIndex.cpp
===
--- clangd/index/MemIndex.cpp
+++ clangd/index/MemIndex.cpp
@@ -87,5 +87,11 @@
   return std::move(MemIdx);
 }
 
+void MemIndex::findOccurrences(
+const OccurrencesRequest &Req,
+llvm::function_ref Callback) const {
+  log("findOccurrences is not implemented.");
+}
+
 } // namespace clangd
 } // namespace clang
Index: clangd/index/Index.h
===
--- clangd/index/Index.h
+++ clangd/index/Index.h
@@ -280,6 +280,40 @@
   std::vector Symbols;  // Sorted by SymbolID to allow lookup.
 };
 
+// Describes the kind of a symbol occurrence.
+//
+// This is a bitfield which can be combined from different kinds.
+enum class SymbolOccurrenceKind : uint8_t {
+  Unknown = 0,
+  Declaration = static_cast(index::SymbolRole::Declaration),
+  Definition = static_cast(index::SymbolRole::Definition),
+  Reference = static_cast(index::SymbolRole::Reference),
+};
+inline SymbolOccurrenceKind operator|(SymbolOccurrenceKind L,
+  SymbolOccurrenceKind R) {
+  return static_cast(static_cast(L) |
+   static_cast(R));
+}
+inline SymbolOccurrenceKind &operator|=(SymbolOccurrenceKind &L,
+SymbolOccurrenceKind R) {
+  return L = L | R;
+}
+inline SymbolOccurrenceKind operator&(SymbolOccurrenceKind A,
+  SymbolOccurrenceKind B) {
+  return static_cast(static_cast(A) &
+   static_cast(B));
+}
+
+// Represents a symbol occurrence in the source file. It could be a
+// declaration/definition/reference occurrence.
+//
+// WARNING: Location does not own the underlying data - Copies are shallow.
+struct SymbolOccurrence {
+  // The location of the occurrence.
+  SymbolLocation Location;
+  SymbolOccurrenceKind Kind;
+};
+
 struct FuzzyFindRequest {
   /// \brief A query string for the fuzzy find. This is matched against symbols'
   /// un-qualified identifiers and should not contain qualifiers like "::".
@@ -305,6 +339,11 @@
   llvm::DenseSet IDs;
 };
 
+struct OccurrencesRequest {
+  llvm::DenseSet IDs;
+  SymbolOccurrenceKind Filter;
+};
+
 /// \brief Interface for symbol indexes that can be used for searching or
 /// matching symbols among a set of symbols based on names or unique IDs.
 class SymbolIndex {
@@ -327,8 +366,15 @@
   lookup(const LookupRequest &Req,
  llvm::function_ref Callback) const = 0;
 
-  // FIXME: add interfaces for more index use cases:
-  //  - getAllOccurrences(SymbolID);
+

[PATCH] D49658: [clangd] Index Interfaces for Xrefs

2018-08-01 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

In https://reviews.llvm.org/D49658#1171410, @sammccall wrote:

> Mostly LG.
>
> I think we can simplify in a couple of places, and you should decide if this 
> patch is *implementing* the new index operation or not. (Currently it 
> implements it for 1/3 implementations, which doesn't seem that useful).


Implementing all index operations in the patch would be end up with a large 
patch, I intend to split the patch as small as possible. Let's scope this patch 
to interface only.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D49658



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


[PATCH] D50132: [clang-format] Add some text proto functions to Google style

2018-08-01 Thread Daniel Jasper via Phabricator via cfe-commits
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

Looks good.


Repository:
  rC Clang

https://reviews.llvm.org/D50132



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


[PATCH] D50132: [clang-format] Add some text proto functions to Google style

2018-08-01 Thread Krasimir Georgiev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL338524: [clang-format] Add some text proto functions to 
Google style (authored by krasimir, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D50132

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


Index: cfe/trunk/lib/Format/Format.cpp
===
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -777,9 +777,11 @@
   {
   "EqualsProto",
   "EquivToProto",
+  "PARSE_PARTIAL_TEXT_PROTO",
   "PARSE_TEST_PROTO",
   "PARSE_TEXT_PROTO",
   "ParseTextOrDie",
+  "ParseTextProtoOrDie",
   },
   /*CanonicalDelimiter=*/"",
   /*BasedOnStyle=*/"google",


Index: cfe/trunk/lib/Format/Format.cpp
===
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -777,9 +777,11 @@
   {
   "EqualsProto",
   "EquivToProto",
+  "PARSE_PARTIAL_TEXT_PROTO",
   "PARSE_TEST_PROTO",
   "PARSE_TEXT_PROTO",
   "ParseTextOrDie",
+  "ParseTextProtoOrDie",
   },
   /*CanonicalDelimiter=*/"",
   /*BasedOnStyle=*/"google",
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r338524 - [clang-format] Add some text proto functions to Google style

2018-08-01 Thread Krasimir Georgiev via cfe-commits
Author: krasimir
Date: Wed Aug  1 05:35:23 2018
New Revision: 338524

URL: http://llvm.org/viewvc/llvm-project?rev=338524&view=rev
Log:
[clang-format] Add some text proto functions to Google style

Summary: Adds 2 functions taking a text proto argument.

Reviewers: djasper, klimek

Reviewed By: djasper

Subscribers: acoomans, cfe-commits

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

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

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=338524&r1=338523&r2=338524&view=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Wed Aug  1 05:35:23 2018
@@ -777,9 +777,11 @@ FormatStyle getGoogleStyle(FormatStyle::
   {
   "EqualsProto",
   "EquivToProto",
+  "PARSE_PARTIAL_TEXT_PROTO",
   "PARSE_TEST_PROTO",
   "PARSE_TEXT_PROTO",
   "ParseTextOrDie",
+  "ParseTextProtoOrDie",
   },
   /*CanonicalDelimiter=*/"",
   /*BasedOnStyle=*/"google",


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


r338525 - [AArch64][ARM] Add Armv8.4-A tests

2018-08-01 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Wed Aug  1 05:41:10 2018
New Revision: 338525

URL: http://llvm.org/viewvc/llvm-project?rev=338525&view=rev
Log:
[AArch64][ARM] Add Armv8.4-A tests

This adds tests for Armv8.4-A, and also some v8.2 and v8.3 tests that were
missing.

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

Modified:
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/test/Driver/aarch64-cpus.c
cfe/trunk/test/Driver/arm-cortex-cpus.c

Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=338525&r1=338524&r2=338525&view=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp Wed Aug  1 05:41:10 2018
@@ -185,6 +185,10 @@ StringRef ARMTargetInfo::getCPUAttr() co
 return "8_1A";
   case llvm::ARM::ArchKind::ARMV8_2A:
 return "8_2A";
+  case llvm::ARM::ArchKind::ARMV8_3A:
+return "8_3A";
+  case llvm::ARM::ArchKind::ARMV8_4A:
+return "8_4A";
   case llvm::ARM::ArchKind::ARMV8MBaseline:
 return "8M_BASE";
   case llvm::ARM::ArchKind::ARMV8MMainline:

Modified: cfe/trunk/test/Driver/aarch64-cpus.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/aarch64-cpus.c?rev=338525&r1=338524&r2=338525&view=diff
==
--- cfe/trunk/test/Driver/aarch64-cpus.c (original)
+++ cfe/trunk/test/Driver/aarch64-cpus.c Wed Aug  1 05:41:10 2018
@@ -388,6 +388,14 @@
 // RUN: %clang -target aarch64_be -mlittle-endian -march=armv8.2-a -### -c %s 
2>&1 | FileCheck -check-prefix=GENERICV82A %s
 // GENERICV82A: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" 
"-target-feature" "+neon" "-target-feature" "+v8.2a"
 
+// RUN: %clang -target aarch64_be -march=armv8.2a -### -c %s 2>&1 | FileCheck 
-check-prefix=GENERICV82A-BE %s
+// RUN: %clang -target aarch64_be -march=armv8.2-a -### -c %s 2>&1 | FileCheck 
-check-prefix=GENERICV82A-BE %s
+// RUN: %clang -target aarch64 -mbig-endian -march=armv8.2a -### -c %s 2>&1 | 
FileCheck -check-prefix=GENERICV82A-BE %s
+// RUN: %clang -target aarch64 -mbig-endian -march=armv8.2-a -### -c %s 2>&1 | 
FileCheck -check-prefix=GENERICV82A-BE %s
+// RUN: %clang -target aarch64_be -mbig-endian -march=armv8.2a -### -c %s 2>&1 
| FileCheck -check-prefix=GENERICV82A-BE %s
+// RUN: %clang -target aarch64_be -mbig-endian -march=armv8.2-a -### -c %s 
2>&1 | FileCheck -check-prefix=GENERICV82A-BE %s
+// GENERICV82A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" 
"generic" "-target-feature" "+neon" "-target-feature" "+v8.2a"
+
 // RUN: %clang -target aarch64 -march=armv8.2-a+fp16 -### -c %s 2>&1 | 
FileCheck -check-prefix=GENERICV82A-FP16 %s
 // GENERICV82A-FP16: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" 
"generic" "-target-feature" "+neon" "-target-feature" "+v8.2a" 
"-target-feature" "+fullfp16"
 
@@ -397,6 +405,71 @@
 // RUN: %clang -target aarch64 -march=armv8.2-a+fp16+profile -### -c %s 2>&1 | 
FileCheck -check-prefix=GENERICV82A-FP16-SPE %s
 // GENERICV82A-FP16-SPE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" 
"generic" "-target-feature" "+neon" "-target-feature" "+v8.2a" 
"-target-feature" "+fullfp16" "-target-feature" "+spe"
 
+// RUN: %clang -target aarch64 -march=armv8.3a -### -c %s 2>&1 | FileCheck 
-check-prefix=GENERICV83A %s
+// RUN: %clang -target aarch64 -march=armv8.3-a -### -c %s 2>&1 | FileCheck 
-check-prefix=GENERICV83A %s
+// RUN: %clang -target aarch64 -mlittle-endian -march=armv8.3a -### -c %s 2>&1 
| FileCheck -check-prefix=GENERICV83A %s
+// RUN: %clang -target aarch64 -mlittle-endian -march=armv8.3-a -### -c %s 
2>&1 | FileCheck -check-prefix=GENERICV83A %s
+// RUN: %clang -target aarch64_be -mlittle-endian -march=armv8.3a -### -c %s 
2>&1 | FileCheck -check-prefix=GENERICV83A %s
+// RUN: %clang -target aarch64_be -mlittle-endian -march=armv8.3-a -### -c %s 
2>&1 | FileCheck -check-prefix=GENERICV83A %s
+// GENERICV83A: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" 
"-target-feature" "+neon" "-target-feature" "+v8.3a"
+
+// RUN: %clang -target aarch64_be -march=armv8.3a -### -c %s 2>&1 | FileCheck 
-check-prefix=GENERICV83A-BE %s
+// RUN: %clang -target aarch64_be -march=armv8.3-a -### -c %s 2>&1 | FileCheck 
-check-prefix=GENERICV83A-BE %s
+// RUN: %clang -target aarch64 -mbig-endian -march=armv8.3a -### -c %s 2>&1 | 
FileCheck -check-prefix=GENERICV83A-BE %s
+// RUN: %clang -target aarch64 -mbig-endian -march=armv8.3-a -### -c %s 2>&1 | 
FileCheck -check-prefix=GENERICV83A-BE %s
+// RUN: %clang -target aarch64_be -mbig-endian -march=armv8.3a -### -c %s 2>&1 
| FileCheck -check-prefix=GENERICV83A-BE %s
+// RUN: %clang -target aarch64_be -mbig-endian -march=armv8.3-a -### -c %s 
2>&1 | FileCheck -check-prefix=GENERICV83A-BE %s
+// GENERICV83A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" 
"generic" "-target-f

[PATCH] D50068: [AArch64][ARM] Add Armv8.4-A tests

2018-08-01 Thread Sjoerd Meijer via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC338525: [AArch64][ARM] Add Armv8.4-A tests (authored by 
SjoerdMeijer, committed by ).

Repository:
  rC Clang

https://reviews.llvm.org/D50068

Files:
  lib/Basic/Targets/ARM.cpp
  test/Driver/aarch64-cpus.c
  test/Driver/arm-cortex-cpus.c

Index: lib/Basic/Targets/ARM.cpp
===
--- lib/Basic/Targets/ARM.cpp
+++ lib/Basic/Targets/ARM.cpp
@@ -185,6 +185,10 @@
 return "8_1A";
   case llvm::ARM::ArchKind::ARMV8_2A:
 return "8_2A";
+  case llvm::ARM::ArchKind::ARMV8_3A:
+return "8_3A";
+  case llvm::ARM::ArchKind::ARMV8_4A:
+return "8_4A";
   case llvm::ARM::ArchKind::ARMV8MBaseline:
 return "8M_BASE";
   case llvm::ARM::ArchKind::ARMV8MMainline:
Index: test/Driver/aarch64-cpus.c
===
--- test/Driver/aarch64-cpus.c
+++ test/Driver/aarch64-cpus.c
@@ -388,6 +388,14 @@
 // RUN: %clang -target aarch64_be -mlittle-endian -march=armv8.2-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A %s
 // GENERICV82A: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.2a"
 
+// RUN: %clang -target aarch64_be -march=armv8.2a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A-BE %s
+// RUN: %clang -target aarch64_be -march=armv8.2-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A-BE %s
+// RUN: %clang -target aarch64 -mbig-endian -march=armv8.2a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A-BE %s
+// RUN: %clang -target aarch64 -mbig-endian -march=armv8.2-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A-BE %s
+// RUN: %clang -target aarch64_be -mbig-endian -march=armv8.2a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A-BE %s
+// RUN: %clang -target aarch64_be -mbig-endian -march=armv8.2-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A-BE %s
+// GENERICV82A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.2a"
+
 // RUN: %clang -target aarch64 -march=armv8.2-a+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A-FP16 %s
 // GENERICV82A-FP16: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.2a" "-target-feature" "+fullfp16"
 
@@ -397,6 +405,71 @@
 // RUN: %clang -target aarch64 -march=armv8.2-a+fp16+profile -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A-FP16-SPE %s
 // GENERICV82A-FP16-SPE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.2a" "-target-feature" "+fullfp16" "-target-feature" "+spe"
 
+// RUN: %clang -target aarch64 -march=armv8.3a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV83A %s
+// RUN: %clang -target aarch64 -march=armv8.3-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV83A %s
+// RUN: %clang -target aarch64 -mlittle-endian -march=armv8.3a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV83A %s
+// RUN: %clang -target aarch64 -mlittle-endian -march=armv8.3-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV83A %s
+// RUN: %clang -target aarch64_be -mlittle-endian -march=armv8.3a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV83A %s
+// RUN: %clang -target aarch64_be -mlittle-endian -march=armv8.3-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV83A %s
+// GENERICV83A: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.3a"
+
+// RUN: %clang -target aarch64_be -march=armv8.3a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV83A-BE %s
+// RUN: %clang -target aarch64_be -march=armv8.3-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV83A-BE %s
+// RUN: %clang -target aarch64 -mbig-endian -march=armv8.3a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV83A-BE %s
+// RUN: %clang -target aarch64 -mbig-endian -march=armv8.3-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV83A-BE %s
+// RUN: %clang -target aarch64_be -mbig-endian -march=armv8.3a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV83A-BE %s
+// RUN: %clang -target aarch64_be -mbig-endian -march=armv8.3-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV83A-BE %s
+// GENERICV83A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.3a"
+
+// RUN: %clang -target aarch64 -march=armv8.3-a+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV83A-FP16 %s
+// GENERICV83A-FP16: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.3a" "-target-feature" "+fullfp16"
+
+// RUN: %clang -target aarch64 -march=armv8.4a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV84A %s
+// RUN: %clang -target aarch64 -march=armv8.4-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV84A %s
+// RUN: %clang -target aarch64 -mlittle-endia

[clang-tools-extra] r338526 - [clangd] Correct the namespace of ParsedAST forward declaration, NFC.

2018-08-01 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Wed Aug  1 05:50:44 2018
New Revision: 338526

URL: http://llvm.org/viewvc/llvm-project?rev=338526&view=rev
Log:
[clangd] Correct the namespace of ParsedAST forward declaration, NFC.

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

Modified: clang-tools-extra/trunk/clangd/FindSymbols.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/FindSymbols.h?rev=338526&r1=338525&r2=338526&view=diff
==
--- clang-tools-extra/trunk/clangd/FindSymbols.h (original)
+++ clang-tools-extra/trunk/clangd/FindSymbols.h Wed Aug  1 05:50:44 2018
@@ -17,8 +17,8 @@
 #include "llvm/ADT/StringRef.h"
 
 namespace clang {
-class ParsedAST;
 namespace clangd {
+class ParsedAST;
 class SymbolIndex;
 
 /// Searches for the symbols matching \p Query. The syntax of \p Query can be


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


r338528 - UserManual: Update with the latest clang-cl flags

2018-08-01 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug  1 05:58:57 2018
New Revision: 338528

URL: http://llvm.org/viewvc/llvm-project?rev=338528&view=rev
Log:
UserManual: Update with the latest clang-cl flags

Modified:
cfe/trunk/docs/UsersManual.rst

Modified: cfe/trunk/docs/UsersManual.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=338528&r1=338527&r2=338528&view=diff
==
--- cfe/trunk/docs/UsersManual.rst (original)
+++ cfe/trunk/docs/UsersManual.rst Wed Aug  1 05:58:57 2018
@@ -2778,6 +2778,7 @@ Execute ``clang-cl /?`` to see a list of
   /Brepro Emit an object file which can be reproduced over 
time
   /C  Don't discard comments when preprocessing
   /c  Compile only
+  /d1PP   Retain macro definitions in /E mode
   /d1reportAllClassLayout Dump record layout information
   /diagnostics:caret  Enable caret and column diagnostics (on by 
default)
   /diagnostics:classicDisable column and caret diagnostics
@@ -2811,6 +2812,7 @@ Execute ``clang-cl /?`` to see a list of
   /GS-Disable buffer security check
   /GS Enable buffer security check
   /Gs  Set stack probe size
+  /guard:  Enable Control Flow Guard with /guard:cf
   /Gv Set __vectorcall as a default calling convention
   /Gw-Don't put each data item in its own section
   /Gw Put each data item in its own section
@@ -2866,6 +2868,7 @@ Execute ``clang-cl /?`` to see a list of
   /WX-Do not treat warnings as errors
   /WX Treat warnings as errors
   /w  Disable all warnings
+  /X  Don't add %INCLUDE% to the include search path
   /Y- Disable precompiled headers, overrides /Yc and 
/Yu
   /Yc   Generate a pch file for all code up to and 
including 
   /Yu   Load a pch file and use it instead of all code 
up to and including 
@@ -2889,8 +2892,15 @@ Execute ``clang-cl /?`` to see a list of
 OPTIONS:
   -###Print (but do not run) the commands to run for 
this compilation
   --analyze   Run the static analyzer
+  -faddrsig   Emit an address-significance table
   -fansi-escape-codes Use ANSI escape codes for diagnostics
+  -fblocksEnable the 'blocks' language feature
+  -fcf-protection= Instrument control-flow architecture protection. 
Options: return, branch, full, none.
+  -fcf-protection Enable cf-protection in 'full' mode
   -fcolor-diagnostics Use colors in diagnostics
+  -fcomplete-member-pointers
+  Require member pointer base types to be complete 
if they would be significant under the Microsoft ABI
+  -fcoverage-mapping  Generate coverage mapping to enable code 
coverage analysis
   -fdebug-macro   Emit macro debug information
   -fdelayed-template-parsing
   Parse templated function definitions at the end 
of the translation unit
@@ -2900,6 +2910,7 @@ Execute ``clang-cl /?`` to see a list of
   Print fix-its in machine parseable form
   -flto=   Set LTO mode to either 'full' or 'thin'
   -flto   Enable LTO in 'full' mode
+  -fmerge-all-constants   Allow merging of constants
   -fms-compatibility-version=
   Dot-separated value representing the Microsoft 
compiler version
   number to report in _MSC_VER (0 = don't define 
it (default))
@@ -2907,9 +2918,17 @@ Execute ``clang-cl /?`` to see a list of
   -fms-extensions Accept some non-standard constructs supported by 
the Microsoft compiler
   -fmsc-version=   Microsoft compiler version number to report in 
_MSC_VER
   (0 = don't define it (default))
+  -fno-addrsigDon't emit an address-significance table
+  -fno-builtin-Disable implicit builtin knowledge of a specific 
function
+  -fno-builtinDisable implicit builtin knowledge of functions
+  -fno-complete-member-pointers
+  Do not require member pointer base types to be 
complete if they would be significant under the Microsoft ABI
+  -fno-coverage-mapping   Disable code coverage analysis
   -fno-debug-macroDo not emit macro debug information
   -fno-delayed-template-parsing
   Disable delayed template parsing
+  -fno-sanitize-address-poison-class-member-array-new-cookie
+  Disable poisoning array cookies when using class 
member operator new[] in AddressSanitizer

[PATCH] D50056: [NFC] Silence warning about ptr-to-func to ptr-to-obj cast in clang-fuzzer/handle-llvm/handle_llvm.cpp.

2018-08-01 Thread Erich Keane via Phabricator via cfe-commits
erichkeane accepted this revision.
erichkeane added a comment.

LMK if you need someone to commit this for you.


https://reviews.llvm.org/D50056



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


[libcxx] r338531 - [libc++] Fix GCC 7.2.0 macro redefinition warning

2018-08-01 Thread Louis Dionne via cfe-commits
Author: ldionne
Date: Wed Aug  1 06:13:14 2018
New Revision: 338531

URL: http://llvm.org/viewvc/llvm-project?rev=338531&view=rev
Log:
[libc++] Fix GCC 7.2.0 macro redefinition warning

The warning happens when LIBCXX_ENABLE_EXCEPTIONS cmake option is not set,
and it fires every time __config is included, 33 in total.

Patch by Jason Lovett
Reviewed as https://reviews.llvm.org/D49997

Modified:
libcxx/trunk/include/__config

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=338531&r1=338530&r2=338531&view=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Wed Aug  1 06:13:14 2018
@@ -510,7 +510,7 @@ namespace std {
 #define _LIBCPP_HAS_IS_BASE_OF
 #endif
 
-#if !__EXCEPTIONS
+#if !__EXCEPTIONS && !defined(_LIBCPP_NO_EXCEPTIONS)
 #define _LIBCPP_NO_EXCEPTIONS
 #endif
 


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


[PATCH] D49997: [libcxx] Fix _LIBCPP_NO_EXCEPTIONS redefined warning

2018-08-01 Thread Louis Dionne via Phabricator via cfe-commits
ldionne closed this revision.
ldionne added a comment.

Committed as r32f108a0736


Repository:
  rCXX libc++

https://reviews.llvm.org/D49997



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


r338534 - Make test/Frontend/clang-abi-compat.cpp pass when the version goes to 8

2018-08-01 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug  1 06:19:14 2018
New Revision: 338534

URL: http://llvm.org/viewvc/llvm-project?rev=338534&view=rev
Log:
Make test/Frontend/clang-abi-compat.cpp pass when the version goes to 8

Modified:
cfe/trunk/test/Frontend/clang-abi-compat.cpp

Modified: cfe/trunk/test/Frontend/clang-abi-compat.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/clang-abi-compat.cpp?rev=338534&r1=338533&r2=338534&view=diff
==
--- cfe/trunk/test/Frontend/clang-abi-compat.cpp (original)
+++ cfe/trunk/test/Frontend/clang-abi-compat.cpp Wed Aug  1 06:19:14 2018
@@ -1,6 +1,6 @@
 // RUN: not %clang_cc1 -fclang-abi-compat=banana %s -fsyntax-only 2>&1 | 
FileCheck --check-prefix=INVALID %s
 // RUN: not %clang_cc1 -fclang-abi-compat=2.9 %s -fsyntax-only 2>&1 | 
FileCheck --check-prefix=INVALID %s
-// RUN: not %clang_cc1 -fclang-abi-compat=8 %s -fsyntax-only 2>&1 | FileCheck 
--check-prefix=INVALID %s
+// RUN: not %clang_cc1 -fclang-abi-compat=42 %s -fsyntax-only 2>&1 | FileCheck 
--check-prefix=INVALID %s
 // RUN: not %clang_cc1 -fclang-abi-compat=3.10 %s -fsyntax-only 2>&1 | 
FileCheck --check-prefix=INVALID %s
 // RUN: not %clang_cc1 -fclang-abi-compat=4.1 %s -fsyntax-only 2>&1 | 
FileCheck --check-prefix=INVALID %s
 // RUN: not %clang_cc1 -fclang-abi-compat=04 %s -fsyntax-only 2>&1 | FileCheck 
--check-prefix=INVALID %s


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


[libcxx] r338542 - Creating release_70 branch off revision 338536

2018-08-01 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug  1 06:30:36 2018
New Revision: 338542

URL: http://llvm.org/viewvc/llvm-project?rev=338542&view=rev
Log:
Creating release_70 branch off revision 338536

Added:
libcxx/branches/release_70/   (props changed)
  - copied from r338536, libcxx/trunk/

Propchange: libcxx/branches/release_70/
--
svn:mergeinfo = /libcxx/branches/apple:136569-137939


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


[libcxxabi] r338543 - Creating release_70 branch off revision 338536

2018-08-01 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug  1 06:30:41 2018
New Revision: 338543

URL: http://llvm.org/viewvc/llvm-project?rev=338543&view=rev
Log:
Creating release_70 branch off revision 338536

Added:
libcxxabi/branches/release_70/
  - copied from r338536, libcxxabi/trunk/

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


[libunwind] r338549 - Creating release_70 branch off revision 338536

2018-08-01 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug  1 06:31:22 2018
New Revision: 338549

URL: http://llvm.org/viewvc/llvm-project?rev=338549&view=rev
Log:
Creating release_70 branch off revision 338536

Added:
libunwind/branches/release_70/
  - copied from r338536, libunwind/trunk/

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


r338551 - [NFC] Silence warning about ptr-to-func to ptr-to-obj cast in clang-fuzzer/handle-llvm/handle_llvm.cpp.

2018-08-01 Thread Andrei Elovikov via cfe-commits
Author: a.elovikov
Date: Wed Aug  1 06:34:18 2018
New Revision: 338551

URL: http://llvm.org/viewvc/llvm-project?rev=338551&view=rev
Log:
[NFC] Silence warning about ptr-to-func to ptr-to-obj cast in 
clang-fuzzer/handle-llvm/handle_llvm.cpp.

Summary:
I don't have the whole list of GCC binaries available so I determined the exact
version where the warning disappeared via:

https://github.com/gcc-mirror/gcc/blob/gcc-4_9_0-release/gcc/cp/typeck.c#L6863
https://github.com/gcc-mirror/gcc/blob/gcc-4_8_5-release/gcc/cp/typeck.c#L6652

Reviewers: emmettneyman, erichkeane

Reviewed By: emmettneyman, erichkeane

Subscribers: cfe-commits

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

Modified:
cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp

Modified: cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp?rev=338551&r1=338550&r2=338551&view=diff
==
--- cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp (original)
+++ cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp Wed Aug  1 
06:34:18 2018
@@ -149,7 +149,23 @@ void CreateAndRunJITFun(const std::strin
   EE->runStaticConstructorsDestructors(false);
 
   typedef void (*func)(int*, int*, int*, int);
-  func f = reinterpret_cast(EE->getPointerToFunction(EntryFunc)); 
+#if defined(__GNUC__) && !defined(__clang) &&  
\
+((__GNUC__ == 4) && (__GNUC_MINOR__ < 9))
+// Silence
+//
+//   warning: ISO C++ forbids casting between pointer-to-function and
+//   pointer-to-object [-Wpedantic]
+//
+// Since C++11 this casting is conditionally supported and GCC versions
+// starting from 4.9.0 don't warn about the cast.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+#endif
+  func f = reinterpret_cast(EE->getPointerToFunction(EntryFunc));
+#if defined(__GNUC__) && !defined(__clang) &&  
\
+((__GNUC__ == 4) && (__GNUC_MINOR__ < 9))
+#pragma GCC diagnostic pop
+#endif
 
   // Define some dummy arrays to use an input for now
   int a[] = {1};


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


r338552 - Add REQUIRES: native to a test that assumes it

2018-08-01 Thread Filipe Cabecinhas via cfe-commits
Author: filcab
Date: Wed Aug  1 06:41:11 2018
New Revision: 338552

URL: http://llvm.org/viewvc/llvm-project?rev=338552&view=rev
Log:
Add REQUIRES: native to a test that assumes it

Modified:
cfe/trunk/test/Driver/darwin-infer-simulator-sdkroot.c

Modified: cfe/trunk/test/Driver/darwin-infer-simulator-sdkroot.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-infer-simulator-sdkroot.c?rev=338552&r1=338551&r2=338552&view=diff
==
--- cfe/trunk/test/Driver/darwin-infer-simulator-sdkroot.c (original)
+++ cfe/trunk/test/Driver/darwin-infer-simulator-sdkroot.c Wed Aug  1 06:41:11 
2018
@@ -1,6 +1,6 @@
 // Check that SDKROOT does not infer simulator on when it points to a regular
 // SDK.
-// REQUIRES: system-darwin
+// REQUIRES: system-darwin && native
 //
 // RUN: rm -rf %t/SDKs/iPhoneOS8.0.0.sdk
 // RUN: mkdir -p %t/SDKs/iPhoneOS8.0.0.sdk


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


r338553 - Use a dummy target so the test passes when default target is for a toolchain implements useIntegratedAs() -> true

2018-08-01 Thread Filipe Cabecinhas via cfe-commits
Author: filcab
Date: Wed Aug  1 06:41:42 2018
New Revision: 338553

URL: http://llvm.org/viewvc/llvm-project?rev=338553&view=rev
Log:
Use a dummy target so the test passes when default target is for a toolchain 
implements useIntegratedAs() -> true

Modified:
cfe/trunk/test/Driver/integrated-as.c

Modified: cfe/trunk/test/Driver/integrated-as.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/integrated-as.c?rev=338553&r1=338552&r2=338553&view=diff
==
--- cfe/trunk/test/Driver/integrated-as.c (original)
+++ cfe/trunk/test/Driver/integrated-as.c Wed Aug  1 06:41:42 2018
@@ -7,7 +7,7 @@
 
 // FIAS: cc1as
 
-// RUN: %clang -### -fno-integrated-as -S %s 2>&1 \
+// RUN: %clang -target none -### -fno-integrated-as -S %s 2>&1 \
 // RUN: | FileCheck %s -check-prefix NOFIAS
 
 // NOFIAS-NOT: cc1as


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


[PATCH] D50056: [NFC] Silence warning about ptr-to-func to ptr-to-obj cast in clang-fuzzer/handle-llvm/handle_llvm.cpp.

2018-08-01 Thread Andrei Elovikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC338551: [NFC] Silence warning about ptr-to-func to 
ptr-to-obj cast in clang… (authored by a.elovikov, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D50056?vs=158483&id=158527#toc

Repository:
  rC Clang

https://reviews.llvm.org/D50056

Files:
  tools/clang-fuzzer/handle-llvm/handle_llvm.cpp


Index: tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
===
--- tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
+++ tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
@@ -149,7 +149,23 @@
   EE->runStaticConstructorsDestructors(false);
 
   typedef void (*func)(int*, int*, int*, int);
-  func f = reinterpret_cast(EE->getPointerToFunction(EntryFunc)); 
+#if defined(__GNUC__) && !defined(__clang) &&  
\
+((__GNUC__ == 4) && (__GNUC_MINOR__ < 9))
+// Silence
+//
+//   warning: ISO C++ forbids casting between pointer-to-function and
+//   pointer-to-object [-Wpedantic]
+//
+// Since C++11 this casting is conditionally supported and GCC versions
+// starting from 4.9.0 don't warn about the cast.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+#endif
+  func f = reinterpret_cast(EE->getPointerToFunction(EntryFunc));
+#if defined(__GNUC__) && !defined(__clang) &&  
\
+((__GNUC__ == 4) && (__GNUC_MINOR__ < 9))
+#pragma GCC diagnostic pop
+#endif
 
   // Define some dummy arrays to use an input for now
   int a[] = {1};


Index: tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
===
--- tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
+++ tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
@@ -149,7 +149,23 @@
   EE->runStaticConstructorsDestructors(false);
 
   typedef void (*func)(int*, int*, int*, int);
-  func f = reinterpret_cast(EE->getPointerToFunction(EntryFunc)); 
+#if defined(__GNUC__) && !defined(__clang) &&  \
+((__GNUC__ == 4) && (__GNUC_MINOR__ < 9))
+// Silence
+//
+//   warning: ISO C++ forbids casting between pointer-to-function and
+//   pointer-to-object [-Wpedantic]
+//
+// Since C++11 this casting is conditionally supported and GCC versions
+// starting from 4.9.0 don't warn about the cast.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+#endif
+  func f = reinterpret_cast(EE->getPointerToFunction(EntryFunc));
+#if defined(__GNUC__) && !defined(__clang) &&  \
+((__GNUC__ == 4) && (__GNUC_MINOR__ < 9))
+#pragma GCC diagnostic pop
+#endif
 
   // Define some dummy arrays to use an input for now
   int a[] = {1};
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r338555 - Update version to 8.0.0svn: cmake, includes files and docs

2018-08-01 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug  1 06:54:28 2018
New Revision: 338555

URL: http://llvm.org/viewvc/llvm-project?rev=338555&view=rev
Log:
Update version to 8.0.0svn: cmake, includes files and docs

Modified:
libcxx/trunk/CMakeLists.txt
libcxx/trunk/docs/conf.py
libcxx/trunk/include/__config
libcxx/trunk/include/__libcpp_version

Modified: libcxx/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=338555&r1=338554&r2=338555&view=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Wed Aug  1 06:54:28 2018
@@ -27,7 +27,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   project(libcxx CXX C)
 
   set(PACKAGE_NAME libcxx)
-  set(PACKAGE_VERSION 7.0.0svn)
+  set(PACKAGE_VERSION 8.0.0svn)
   set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
   set(PACKAGE_BUGREPORT "llvm-b...@lists.llvm.org")
 

Modified: libcxx/trunk/docs/conf.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/conf.py?rev=338555&r1=338554&r2=338555&view=diff
==
--- libcxx/trunk/docs/conf.py (original)
+++ libcxx/trunk/docs/conf.py Wed Aug  1 06:54:28 2018
@@ -40,16 +40,16 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'libc++'
-copyright = u'2011-2017, LLVM Project'
+copyright = u'2011-2018, LLVM Project'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
 # built documents.
 #
 # The short X.Y version.
-version = '7.0'
+version = '8.0'
 # The full version, including alpha/beta/rc tags.
-release = '7.0'
+release = '8.0'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=338555&r1=338554&r2=338555&view=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Wed Aug  1 06:54:28 2018
@@ -33,7 +33,7 @@
 #  define _GNUC_VER_NEW 0
 #endif
 
-#define _LIBCPP_VERSION 7000
+#define _LIBCPP_VERSION 8000
 
 #ifndef _LIBCPP_ABI_VERSION
 #  ifdef __Fuchsia__

Modified: libcxx/trunk/include/__libcpp_version
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__libcpp_version?rev=338555&r1=338554&r2=338555&view=diff
==
--- libcxx/trunk/include/__libcpp_version (original)
+++ libcxx/trunk/include/__libcpp_version Wed Aug  1 06:54:28 2018
@@ -1 +1 @@
-7000
+8000


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


[PATCH] D50099: [DebugInfo][OpenCL] Address post-commit review of D49930

2018-08-01 Thread Scott Linder via Phabricator via cfe-commits
scott.linder updated this revision to Diff 158532.
scott.linder added a comment.

Add comments to explain OpenCL case


https://reviews.llvm.org/D50099

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  test/CodeGenOpenCL/blocks.cl

Index: test/CodeGenOpenCL/blocks.cl
===
--- test/CodeGenOpenCL/blocks.cl
+++ test/CodeGenOpenCL/blocks.cl
@@ -1,5 +1,7 @@
-// RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -o - -O0 -debug-info-kind=limited -triple spir-unknown-unknown | FileCheck -check-prefixes=COMMON,SPIR %s
-// RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -o - -O0 -debug-info-kind=limited -triple amdgcn-amd-amdhsa | FileCheck -check-prefixes=COMMON,AMDGCN %s
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -o - -O0 -triple spir-unknown-unknown | FileCheck -check-prefixes=COMMON,SPIR %s
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -o - -O0 -triple amdgcn-amd-amdhsa | FileCheck -check-prefixes=COMMON,AMDGCN %s
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -o - -O0 -debug-info-kind=limited -triple spir-unknown-unknown | FileCheck -check-prefixes=CHECK-DEBUG %s
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -o - -O0 -debug-info-kind=limited -triple amdgcn-amd-amdhsa | FileCheck -check-prefixes=CHECK-DEBUG %s
 
 // COMMON: @__block_literal_global = internal addrspace(1) constant { i32, i32 } { i32 8, i32 4 }
 // COMMON-NOT: .str
@@ -61,10 +63,10 @@
 
 // COMMON-NOT: define{{.*}}@__foo_block_invoke_kernel
 
-// COMMON: !DIDerivedType(tag: DW_TAG_member, name: "__size"
-// COMMON: !DIDerivedType(tag: DW_TAG_member, name: "__align"
+// CHECK-DEBUG: !DIDerivedType(tag: DW_TAG_member, name: "__size"
+// CHECK-DEBUG: !DIDerivedType(tag: DW_TAG_member, name: "__align"
 
-// COMMON-NOT: !DIDerivedType(tag: DW_TAG_member, name: "__isa"
-// COMMON-NOT: !DIDerivedType(tag: DW_TAG_member, name: "__flags"
-// COMMON-NOT: !DIDerivedType(tag: DW_TAG_member, name: "__reserved"
-// COMMON-NOT: !DIDerivedType(tag: DW_TAG_member, name: "__FuncPtr"
+// CHECK-DEBUG-NOT: !DIDerivedType(tag: DW_TAG_member, name: "__isa"
+// CHECK-DEBUG-NOT: !DIDerivedType(tag: DW_TAG_member, name: "__flags"
+// CHECK-DEBUG-NOT: !DIDerivedType(tag: DW_TAG_member, name: "__reserved"
+// CHECK-DEBUG-NOT: !DIDerivedType(tag: DW_TAG_member, name: "__FuncPtr"
Index: lib/CodeGen/CGDebugInfo.h
===
--- lib/CodeGen/CGDebugInfo.h
+++ lib/CodeGen/CGDebugInfo.h
@@ -311,6 +311,22 @@
   void AppendAddressSpaceXDeref(unsigned AddressSpace,
 SmallVectorImpl &Expr) const;
 
+  /// A helper function to collect debug info for the default elements of a
+  /// block.
+  ///
+  /// \returns The next available field offset after the default elements.
+  uint64_t collectDefaultElementTypesForBlockPointer(
+  const BlockPointerType *Ty, llvm::DIFile *Unit,
+  llvm::DIDerivedType *DescTy, unsigned LineNo,
+  SmallVectorImpl &EltTys);
+
+  /// A helper function to collect debug info for the default fields of a
+  /// block.
+  void collectDefaultFieldsForBlockLiteralDeclare(
+  const CGBlockInfo &Block, const ASTContext &Context, SourceLocation Loc,
+  const llvm::StructLayout &BlockLayout, llvm::DIFile *Unit,
+  SmallVectorImpl &Fields);
+
 public:
   CGDebugInfo(CodeGenModule &CGM);
   ~CGDebugInfo();
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -942,12 +942,47 @@
   return Cache;
 }
 
+uint64_t CGDebugInfo::collectDefaultElementTypesForBlockPointer(
+const BlockPointerType *Ty, llvm::DIFile *Unit, llvm::DIDerivedType *DescTy,
+unsigned LineNo, SmallVectorImpl &EltTys) {
+  QualType FType;
+
+  // Advanced by calls to CreateMemberType in increments of FType, then
+  // returned as the overall size of the default elements.
+  uint64_t FieldOffset = 0;
+
+  // Blocks in OpenCL have unique constraints which make the standard fields
+  // redundant while requiring size and align fields for enqueue_kernel. See
+  // initializeForBlockHeader in CGBlocks.cpp
+  if (CGM.getLangOpts().OpenCL) {
+FType = CGM.getContext().IntTy;
+EltTys.push_back(CreateMemberType(Unit, FType, "__size", &FieldOffset));
+EltTys.push_back(CreateMemberType(Unit, FType, "__align", &FieldOffset));
+  } else {
+FType = CGM.getContext().getPointerType(CGM.getContext().VoidTy);
+EltTys.push_back(CreateMemberType(Unit, FType, "__isa", &FieldOffset));
+FType = CGM.getContext().IntTy;
+EltTys.push_back(CreateMemberType(Unit, FType, "__flags", &FieldOffset));
+EltTys.push_back(CreateMemberType(Unit, FType, "__reserved", &FieldOffset));
+FType = CGM.getContext().getPointerType(Ty->getPointeeType());
+EltTys.push_back(CreateMemberType(Unit, FType, "__FuncPtr", &FieldOffset));
+FType = CGM.getContext().getPointerType(CGM.getContext().VoidTy);
+

[PATCH] D50078: clang-format: support aligned nested conditionals formatting

2018-08-01 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment.

In https://reviews.llvm.org/D50078#1184015, @djasper wrote:

> - I'd be ok with the suggestion for BreakBeforeTernaryOperators=true


Just to be clear, which suggestion would you be ok with?

  int fooo =  ? 0
   :  ? 1
  : ;

or:

  int fooo =    ? 0
 :  ? 1
: ;



> - I don't think the alignment of "?" and ":" (in the WhitespaceManager) 
> should be always on. I think we'd need a flag for that part

No problem, I'll add the option.


Repository:
  rC Clang

https://reviews.llvm.org/D50078



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


[PATCH] D49658: [clangd] Index Interfaces for Xrefs

2018-08-01 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment.

Picking it up since @sammccall is OOO.

> Implementing all index operations in the patch would be end up with a large 
> patch, I intend to split the patch as small as possible. Let's scope this 
> patch to interface only.

LG as interface-only patch. just a few nits




Comment at: clangd/index/Index.h:288
+  Unknown = 0,
+  Declaration = static_cast(index::SymbolRole::Declaration),
+  Definition = static_cast(index::SymbolRole::Definition),

Any strong reason to keep the values in sync with `SymbolRole`?
It intention is to have tricky conversions (i.e. apply a bit mask and cast to 
the other type)?



Comment at: clangd/index/Merge.cpp:81
+   Callback) const override {
+log("findOccurrences is not implemented.");
+  }

It's not intended to be called, right?
If that's the case let's `assert(false)` here. Having those statements does not 
seem too useful.



Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D49658



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


r338557 - Update docs version and clear release notes after 8.0.0 version bump

2018-08-01 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug  1 07:01:27 2018
New Revision: 338557

URL: http://llvm.org/viewvc/llvm-project?rev=338557&view=rev
Log:
Update docs version and clear release notes after 8.0.0 version bump

Modified:
cfe/trunk/docs/ReleaseNotes.rst
cfe/trunk/docs/conf.py

Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=338557&r1=338556&r2=338557&view=diff
==
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Wed Aug  1 07:01:27 2018
@@ -1,5 +1,5 @@
 ===
-Clang 7.0.0 (In-Progress) Release Notes
+Clang 8.0.0 (In-Progress) Release Notes
 ===
 
 .. contents::
@@ -10,7 +10,7 @@ Written by the `LLVM Team `_.
 
@@ -18,7 +18,7 @@ Introduction
 
 
 This document contains the release notes for the Clang C/C++/Objective-C
-frontend, part of the LLVM Compiler Infrastructure, release 7.0.0. Here we
+frontend, part of the LLVM Compiler Infrastructure, release 8.0.0. Here we
 describe the status of Clang in some detail, including major
 improvements from the previous release and new feature work. For the
 general LLVM release notes, see `the LLVM
@@ -35,7 +35,7 @@ main Clang web page, this document appli
 the current one. To see the release notes for a specific release, please
 see the `releases page `_.
 
-What's New in Clang 7.0.0?
+What's New in Clang 8.0.0?
 ==
 
 Some of the major new features and improvements to Clang are listed
@@ -46,87 +46,19 @@ sections with improvements to Clang's su
 Major New Features
 --
 
-- A new Implicit Conversion Sanitizer (``-fsanitize=implicit-conversion``) 
group
-  was added. Please refer to the :ref:`release-notes-ubsan` section of the
-  release notes for the details.
 
 Improvements to Clang's diagnostics
 ^^^
 
-- ``-Wc++98-compat-extra-semi`` is a new flag, which was previously inseparable
-  from ``-Wc++98-compat-pedantic``. The latter still controls the new flag.
-
-- ``-Wextra-semi`` now also controls ``-Wc++98-compat-extra-semi``.
-  Please do note that if you pass ``-Wno-c++98-compat-pedantic``, it implies
-  ``-Wno-c++98-compat-extra-semi``, so if you want that diagnostic, you need
-  to explicitly re-enable it (e.g. by appending ``-Wextra-semi``).
-
-- ``-Wself-assign`` and ``-Wself-assign-field`` were extended to diagnose
-  self-assignment operations using overloaded operators (i.e. classes).
-  If you are doing such an assignment intentionally, e.g. in a unit test for
-  a data structure, the first warning can be disabled by passing
-  ``-Wno-self-assign-overloaded``, also the warning can be suppressed by adding
-  ``*&`` to the right-hand side or casting it to the appropriate reference 
type.
 
 Non-comprehensive list of changes in this release
 -
 
-- Clang binary and libraries have been renamed from 7.0 to 7.
-  For example, the ``clang`` binary will be called ``clang-7``
-  instead of ``clang-7.0``.
-
-- Clang implements a collection of recent fixes to the C++ standard's 
definition
-  of "standard-layout". In particular, a class is only considered to be
-  standard-layout if all base classes and the first data member (or bit-field)
-  can be laid out at offset zero.
-
-- Clang's handling of the GCC ``packed`` class attribute in C++ has been fixed
-  to apply only to non-static data members and not to base classes. This fixes
-  an ABI difference between Clang and GCC, but creates an ABI difference 
between
-  Clang 7 and earlier versions. The old behavior can be restored by setting
-  ``-fclang-abi-compat`` to ``6`` or earlier.
-
-- Clang implements the proposed resolution of LWG issue 2358, along with the
-  `corresponding change to the Itanium C++ ABI
-  `_, which make classes
-  containing only unnamed non-zero-length bit-fields be considered non-empty.
-  This is an ABI break compared to prior Clang releases, but makes Clang
-  generate code that is ABI-compatible with other compilers. The old
-  behavior can be restored by setting ``-fclang-abi-compat`` to ``6`` or
-  lower.
-
-- An existing tool named ``diagtool`` has been added to the release. As the
-  name suggests, it helps with dealing with diagnostics in ``clang``, such as
-  finding out the warning hierarchy, and which of them are enabled by default
-  or for a particular compiler invocation.
-
-- By default, Clang emits an address-significance table into
-  every

[clang-tools-extra] r338559 - Update docs version and clear release notes after 8.0.0 version bump

2018-08-01 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug  1 07:09:00 2018
New Revision: 338559

URL: http://llvm.org/viewvc/llvm-project?rev=338559&view=rev
Log:
Update docs version and clear release notes after 8.0.0 version bump

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

Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ReleaseNotes.rst?rev=338559&r1=338558&r2=338559&view=diff
==
--- clang-tools-extra/trunk/docs/ReleaseNotes.rst (original)
+++ clang-tools-extra/trunk/docs/ReleaseNotes.rst Wed Aug  1 07:09:00 2018
@@ -1,5 +1,5 @@
 ===
-Extra Clang Tools 7.0.0 (In-Progress) Release Notes
+Extra Clang Tools 8.0.0 (In-Progress) Release Notes
 ===
 
 .. contents::
@@ -10,7 +10,7 @@ Written by the `LLVM Team `_.
 
@@ -18,7 +18,7 @@ Introduction
 
 
 This document contains the release notes for the Extra Clang Tools, part of the
-Clang release 7.0.0. Here we describe the status of the Extra Clang Tools in
+Clang release 8.0.0. Here we describe the status of the Extra Clang Tools in
 some detail, including major improvements from the previous release and new
 feature work. All LLVM releases may be downloaded from the `LLVM releases web
 site `_.
@@ -32,7 +32,7 @@ main Clang web page, this document appli
 the current one. To see the release notes for a specific release, please
 see the `releases page `_.
 
-What's New in Extra Clang Tools 7.0.0?
+What's New in Extra Clang Tools 8.0.0?
 ==
 
 Some of the major new features and improvements to Extra Clang Tools are listed
@@ -57,217 +57,7 @@ The improvements are...
 Improvements to clang-tidy
 --
 
-- The checks profiling info can now be stored as JSON files for futher
-  post-processing and analysis.
-
-- New module `abseil` for checks related to the `Abseil `_
-  library.
-
-- New module ``portability``.
-
-- New module ``zircon`` for checks related to Fuchsia's Zircon kernel.
-
-- New :doc:`abseil-string-find-startswith
-  ` check.
-
-  Checks whether a ``std::string::find()`` result is compared with 0, and
-  suggests replacing with ``absl::StartsWith()``.
-
-- New :doc:`android-comparison-in-temp-failure-retry
-  ` check.
-
-  Diagnoses comparisons that appear to be incorrectly placed in the argument to
-  the ``TEMP_FAILURE_RETRY`` macro.
-
-- New :doc:`bugprone-exception-escape
-  ` check
-
-  Finds functions which may throw an exception directly or indirectly, but they
-  should not.
-
-- New :doc:`bugprone-parent-virtual-call
-  ` check.
-
-  Detects and fixes calls to grand-...parent virtual methods instead of calls
-  to overridden parent's virtual methods.
-
-- New :doc:`bugprone-terminating-continue
-  ` check
-
-  Checks if a ``continue`` statement terminates the loop.
-
-- New :doc:`bugprone-throw-keyword-missing
-  ` check.
-
-  Diagnoses when a temporary object that appears to be an exception is
-  constructed but not thrown.
-
-- New :doc:`bugprone-unused-return-value
-  ` check.
-
-  Warns on unused function return values.
-
-- New :doc:`cert-msc32-c
-  ` check
-
-  Detects inappropriate seeding of ``srand()`` function.
-
-- New :doc:`cert-msc51-cpp
-  ` check
-
-  Detects inappropriate seeding of C++ random generators and C ``srand()`` 
function.
-  
-- New :doc:`cppcoreguidelines-avoid-goto
-  ` check.
-
-  The usage of ``goto`` for control flow is error prone and should be replaced
-  with looping constructs. Every backward jump is rejected. Forward jumps are
-  only allowed in nested loops.
-
-- New :doc:`cppcoreguidelines-narrowing-conversions
-  ` check
-
-  Checks for narrowing conversions, e. g. ``int i = 0; i += 0.1;``.
-
-- New :doc:`fuchsia-multiple-inheritance
-  ` check.
-
-  Warns if a class inherits from multiple classes that are not pure virtual.
-
-- New `fuchsia-restrict-system-includes
-  
`_
 check
-
-  Checks for allowed system includes and suggests removal of any others.
-
-- New `fuchsia-statically-constructed-objects
-  
`_
 check
-
-  Warns if global, non-trivial objects with static storage are constructed,
-  unless the object is statically initialized with a ``constexpr`` constructor
-  or has no explicit constructor.
-
-- New :d

[libunwind] r338561 - Update docs version and clear release notes after 8.0.0 version bump

2018-08-01 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug  1 07:14:09 2018
New Revision: 338561

URL: http://llvm.org/viewvc/llvm-project?rev=338561&view=rev
Log:
Update docs version and clear release notes after 8.0.0 version bump

Modified:
libunwind/trunk/docs/conf.py

Modified: libunwind/trunk/docs/conf.py
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/docs/conf.py?rev=338561&r1=338560&r2=338561&view=diff
==
--- libunwind/trunk/docs/conf.py (original)
+++ libunwind/trunk/docs/conf.py Wed Aug  1 07:14:09 2018
@@ -11,6 +11,7 @@
 # serve to show the default.
 
 import sys, os
+from datetime import date
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
@@ -40,16 +41,16 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'libunwind'
-copyright = u'2011-2017, LLVM Project'
+copyright = u'2011-%d, LLVM Project' % date.today().year
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
 # built documents.
 #
 # The short X.Y version.
-version = '7.0'
+version = '8.0'
 # The full version, including alpha/beta/rc tags.
-release = '7.0'
+release = '8.0'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.


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


[PATCH] D45045: [DebugInfo] Generate debug information for labels.

2018-08-01 Thread Edd Barrett via Phabricator via cfe-commits
vext01 added a comment.

Looks like this was backed out (reverted) yesterday.

I'm really interested in inserting DILabels from LLVM in my research project, 
so I hope it can be recovered.


Repository:
  rL LLVM

https://reviews.llvm.org/D45045



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


[PATCH] D50078: clang-format: support aligned nested conditionals formatting

2018-08-01 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment.

In https://reviews.llvm.org/D50078#1184159, @krasimir wrote:

> Could you clarify how each piece is supposed to be aligned in these examples?
>  This is what makes me happy:
>
>   // column  limit V
>   int a = condition1 ? result1
> : conditio2 ? result2
> : loocondition 
>   ? result2
>   : dition3 ? resul3
> : resul4;
>
>
>
>
>   // column  limit V
>   int a = condition1 
>   ? loresult1
>   : conditio2 ? result2
>   : result4;
>


It gives the following:

  // column  limit V
  int a = condition1 ? result1
: conditio2 ? result2
: loocondition
? result2
: dition3 ? resul3
  : resul4;
  
  // column  limit V
  int a = condition1
? loresult1
: conditio2 ? result2
: result4;

i.e. the long result is wrapped and gets an extra indentation.
I have tried quite a bit to "fall back" to the old behavior when there is this 
kind of wrapping, but this always created other situations which got brocken 
because of this: so finally I choose to stay consistent, and apply the same 
behavior whenever there are chained conditionals.

> When BreakBeforeTernaryOperators is false:
> 
>   int a = condition1 ? result1 :
>   conditio2 ? result2 :
>   ditino3 ? resul3 :
> result4;

This ones is indeed aligned like this.


Repository:
  rC Clang

https://reviews.llvm.org/D50078



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


[libcxxabi] r338564 - Update version to 8.0.0svn

2018-08-01 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug  1 07:25:03 2018
New Revision: 338564

URL: http://llvm.org/viewvc/llvm-project?rev=338564&view=rev
Log:
Update version to 8.0.0svn

Modified:
libcxxabi/trunk/CMakeLists.txt

Modified: libcxxabi/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=338564&r1=338563&r2=338564&view=diff
==
--- libcxxabi/trunk/CMakeLists.txt (original)
+++ libcxxabi/trunk/CMakeLists.txt Wed Aug  1 07:25:03 2018
@@ -21,7 +21,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   project(libcxxabi CXX C)
 
   set(PACKAGE_NAME libcxxabi)
-  set(PACKAGE_VERSION 7.0.0svn)
+  set(PACKAGE_VERSION 8.0.0svn)
   set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
   set(PACKAGE_BUGREPORT "llvm-b...@lists.llvm.org")
 


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


[PATCH] D49223: [AST] Check described template at structural equivalence check.

2018-08-01 Thread Aleksei Sidorin via Phabricator via cfe-commits
a_sidorin added inline comments.



Comment at: lib/AST/ASTStructuralEquivalence.cpp:958
 
+  if (D1->isTemplated() != D2->isTemplated())
+return false;

I think we can move the changes for both RecordDecl and FunctionDecl into 
`Finish()` and use `Decl::getDescribedTemplate()`. This will both simplify the 
patch and give us the support for templated VarDecls and TypeAliasDecls for 
free. What do you think?


Repository:
  rC Clang

https://reviews.llvm.org/D49223



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


[PATCH] D50122: Complex Variable defined in InitCapture Crash fix

2018-08-01 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added inline comments.



Comment at: test/SemaCXX/lambda-init-capture-vardefine.cpp:3
+// RUN: %clang_cc1 -std=c++17  -fsyntax-only -verify %s
+// expected-no-diagnostics
+

These kinds of tests that don't check for any output are a bit dangerous, 
because they will also succeed if clang is symlinked to `/bin/true`.


Repository:
  rC Clang

https://reviews.llvm.org/D50122



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


r338566 - [UnrollAndJam] Add unroll_and_jam pragma handling

2018-08-01 Thread David Green via cfe-commits
Author: dmgreen
Date: Wed Aug  1 07:36:12 2018
New Revision: 338566

URL: http://llvm.org/viewvc/llvm-project?rev=338566&view=rev
Log:
[UnrollAndJam] Add unroll_and_jam pragma handling

This adds support for the unroll_and_jam pragma, to go with the recently
added unroll and jam pass. The name of the pragma is the same as is used
in the Intel compiler, and most of the code works the same as for unroll.

#pragma clang loop unroll_and_jam has been separated into a different
patch. This part adds #pragma unroll_and_jam with an optional count, and
#pragma no_unroll_and_jam to disable the transform.

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


Added:
cfe/trunk/test/CodeGenCXX/pragma-unroll-and-jam.cpp
cfe/trunk/test/Parser/pragma-unroll-and-jam.cpp
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
cfe/trunk/lib/CodeGen/CGLoopInfo.h
cfe/trunk/lib/Parse/ParsePragma.cpp
cfe/trunk/lib/Sema/SemaStmtAttr.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=338566&r1=338565&r2=338566&view=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Wed Aug  1 07:36:12 2018
@@ -2748,6 +2748,8 @@ def LoopHint : Attr {
   /// interleave_count: interleaves 'Value' loop iterations.
   /// unroll: fully unroll loop if State == Enable.
   /// unroll_count: unrolls loop 'Value' times.
+  /// unroll_and_jam: attempt to unroll and jam loop if State == Enable.
+  /// unroll_and_jam_count: unroll and jams loop 'Value' times.
   /// distribute: attempt to distribute loop if State == Enable
 
   /// #pragma unroll  directive
@@ -2756,14 +2758,17 @@ def LoopHint : Attr {
   /// expression: unrolls loop 'Value' times.
 
   let Spellings = [Pragma<"clang", "loop">, Pragma<"", "unroll">,
-   Pragma<"", "nounroll">];
+   Pragma<"", "nounroll">, Pragma<"", "unroll_and_jam">,
+   Pragma<"", "nounroll_and_jam">];
 
   /// State of the loop optimization specified by the spelling.
   let Args = [EnumArgument<"Option", "OptionType",
   ["vectorize", "vectorize_width", "interleave", 
"interleave_count",
-   "unroll", "unroll_count", "distribute"],
+   "unroll", "unroll_count", "unroll_and_jam", 
"unroll_and_jam_count",
+   "distribute"],
   ["Vectorize", "VectorizeWidth", "Interleave", 
"InterleaveCount",
-   "Unroll", "UnrollCount", "Distribute"]>,
+   "Unroll", "UnrollCount", "UnrollAndJam", 
"UnrollAndJamCount",
+   "Distribute"]>,
   EnumArgument<"State", "LoopHintState",
["enable", "disable", "numeric", "assume_safety", 
"full"],
["Enable", "Disable", "Numeric", "AssumeSafety", 
"Full"]>,
@@ -2778,6 +2783,8 @@ def LoopHint : Attr {
 case InterleaveCount: return "interleave_count";
 case Unroll: return "unroll";
 case UnrollCount: return "unroll_count";
+case UnrollAndJam: return "unroll_and_jam";
+case UnrollAndJamCount: return "unroll_and_jam_count";
 case Distribute: return "distribute";
 }
 llvm_unreachable("Unhandled LoopHint option.");
@@ -2787,9 +2794,9 @@ def LoopHint : Attr {
 unsigned SpellingIndex = getSpellingListIndex();
 // For "#pragma unroll" and "#pragma nounroll" the string "unroll" or
 // "nounroll" is already emitted as the pragma name.
-if (SpellingIndex == Pragma_nounroll)
+if (SpellingIndex == Pragma_nounroll || SpellingIndex == 
Pragma_nounroll_and_jam)
   return;
-else if (SpellingIndex == Pragma_unroll) {
+else if (SpellingIndex == Pragma_unroll || SpellingIndex == 
Pragma_unroll_and_jam) {
   OS << ' ' << getValueString(Policy);
   return;
 }
@@ -2825,6 +2832,11 @@ def LoopHint : Attr {
   return "#pragma nounroll";
 else if (SpellingIndex == Pragma_unroll)
   return "#pragma unroll" + (option == UnrollCount ? 
getValueString(Policy) : "");
+else if (SpellingIndex == Pragma_nounroll_and_jam)
+  return "#pragma nounroll_and_jam";
+else if (SpellingIndex == Pragma_unroll_and_jam)
+  return "#pragma unroll_and_jam" +
+(option == UnrollAndJamCount ? getValueString(Policy) : "");
 
 assert(SpellingIndex == Pragma_clang_loop && "Unexpected spelling");
 return getOptionName(option) + getValueString(Policy);

Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=338566&r1=338565&r2=338566&view=diff
==
--- cfe/trunk/include/clang/Pars

[PATCH] D47267: [UnrollAndJam] Add unroll_and_jam pragma handling

2018-08-01 Thread Dave Green via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC338566: [UnrollAndJam] Add unroll_and_jam pragma handling 
(authored by dmgreen, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D47267?vs=158219&id=158537#toc

Repository:
  rC Clang

https://reviews.llvm.org/D47267

Files:
  include/clang/Basic/Attr.td
  include/clang/Parse/Parser.h
  lib/CodeGen/CGLoopInfo.cpp
  lib/CodeGen/CGLoopInfo.h
  lib/Parse/ParsePragma.cpp
  lib/Sema/SemaStmtAttr.cpp
  test/CodeGenCXX/pragma-unroll-and-jam.cpp
  test/Parser/pragma-unroll-and-jam.cpp

Index: include/clang/Basic/Attr.td
===
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -2748,22 +2748,27 @@
   /// interleave_count: interleaves 'Value' loop iterations.
   /// unroll: fully unroll loop if State == Enable.
   /// unroll_count: unrolls loop 'Value' times.
+  /// unroll_and_jam: attempt to unroll and jam loop if State == Enable.
+  /// unroll_and_jam_count: unroll and jams loop 'Value' times.
   /// distribute: attempt to distribute loop if State == Enable
 
   /// #pragma unroll  directive
   /// : fully unrolls loop.
   /// boolean: fully unrolls loop if State == Enable.
   /// expression: unrolls loop 'Value' times.
 
   let Spellings = [Pragma<"clang", "loop">, Pragma<"", "unroll">,
-   Pragma<"", "nounroll">];
+   Pragma<"", "nounroll">, Pragma<"", "unroll_and_jam">,
+   Pragma<"", "nounroll_and_jam">];
 
   /// State of the loop optimization specified by the spelling.
   let Args = [EnumArgument<"Option", "OptionType",
   ["vectorize", "vectorize_width", "interleave", "interleave_count",
-   "unroll", "unroll_count", "distribute"],
+   "unroll", "unroll_count", "unroll_and_jam", "unroll_and_jam_count",
+   "distribute"],
   ["Vectorize", "VectorizeWidth", "Interleave", "InterleaveCount",
-   "Unroll", "UnrollCount", "Distribute"]>,
+   "Unroll", "UnrollCount", "UnrollAndJam", "UnrollAndJamCount",
+   "Distribute"]>,
   EnumArgument<"State", "LoopHintState",
["enable", "disable", "numeric", "assume_safety", "full"],
["Enable", "Disable", "Numeric", "AssumeSafety", "Full"]>,
@@ -2778,6 +2783,8 @@
 case InterleaveCount: return "interleave_count";
 case Unroll: return "unroll";
 case UnrollCount: return "unroll_count";
+case UnrollAndJam: return "unroll_and_jam";
+case UnrollAndJamCount: return "unroll_and_jam_count";
 case Distribute: return "distribute";
 }
 llvm_unreachable("Unhandled LoopHint option.");
@@ -2787,9 +2794,9 @@
 unsigned SpellingIndex = getSpellingListIndex();
 // For "#pragma unroll" and "#pragma nounroll" the string "unroll" or
 // "nounroll" is already emitted as the pragma name.
-if (SpellingIndex == Pragma_nounroll)
+if (SpellingIndex == Pragma_nounroll || SpellingIndex == Pragma_nounroll_and_jam)
   return;
-else if (SpellingIndex == Pragma_unroll) {
+else if (SpellingIndex == Pragma_unroll || SpellingIndex == Pragma_unroll_and_jam) {
   OS << ' ' << getValueString(Policy);
   return;
 }
@@ -2825,6 +2832,11 @@
   return "#pragma nounroll";
 else if (SpellingIndex == Pragma_unroll)
   return "#pragma unroll" + (option == UnrollCount ? getValueString(Policy) : "");
+else if (SpellingIndex == Pragma_nounroll_and_jam)
+  return "#pragma nounroll_and_jam";
+else if (SpellingIndex == Pragma_unroll_and_jam)
+  return "#pragma unroll_and_jam" +
+(option == UnrollAndJamCount ? getValueString(Policy) : "");
 
 assert(SpellingIndex == Pragma_clang_loop && "Unexpected spelling");
 return getOptionName(option) + getValueString(Policy);
Index: include/clang/Parse/Parser.h
===
--- include/clang/Parse/Parser.h
+++ include/clang/Parse/Parser.h
@@ -185,6 +185,8 @@
   std::unique_ptr LoopHintHandler;
   std::unique_ptr UnrollHintHandler;
   std::unique_ptr NoUnrollHintHandler;
+  std::unique_ptr UnrollAndJamHintHandler;
+  std::unique_ptr NoUnrollAndJamHintHandler;
   std::unique_ptr FPHandler;
   std::unique_ptr STDCFENVHandler;
   std::unique_ptr STDCCXLIMITHandler;
Index: test/Parser/pragma-unroll-and-jam.cpp
===
--- test/Parser/pragma-unroll-and-jam.cpp
+++ test/Parser/pragma-unroll-and-jam.cpp
@@ -0,0 +1,78 @@
+// RUN: %clang_cc1 -std=c++11 -verify %s
+
+// Note that this puts the expected lines before the directives to work around
+// limitations in the -verify mode.
+
+void test(int *List, int Length, int Value) {
+  int i = 0;
+
+#pragma unroll_and_jam
+  for (int 

[PATCH] D47267: [UnrollAndJam] Add unroll_and_jam pragma handling

2018-08-01 Thread Dave Green via Phabricator via cfe-commits
dmgreen added a comment.

Thanks.


Repository:
  rC Clang

https://reviews.llvm.org/D47267



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


[PATCH] D49792: [ASTmporter] SourceRange-free function parameter checking for declarations

2018-08-01 Thread Aleksei Sidorin via Phabricator via cfe-commits
a_sidorin accepted this revision.
a_sidorin added a comment.
This revision is now accepted and ready to land.

LGTM. Thank you!


Repository:
  rC Clang

https://reviews.llvm.org/D49792



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


[PATCH] D49223: [AST] Check described template at structural equivalence check.

2018-08-01 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added inline comments.



Comment at: lib/AST/ASTStructuralEquivalence.cpp:958
 
+  if (D1->isTemplated() != D2->isTemplated())
+return false;

a_sidorin wrote:
> I think we can move the changes for both RecordDecl and FunctionDecl into 
> `Finish()` and use `Decl::getDescribedTemplate()`. This will both simplify 
> the patch and give us the support for templated VarDecls and TypeAliasDecls 
> for free. What do you think?
Yes it can be good to check with `getDescribedClassTemplate` in `Finish`. 
(Similarly, there can be more things that are common to check with all `Decl` 
or `NamedDecl` objects in `Finish`, specifically the name is checked. Or in 
some cases the name does not matter, but in others yes?)


Repository:
  rC Clang

https://reviews.llvm.org/D49223



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


[PATCH] D45719: [clang-Format] Fix indentation of member call after block

2018-08-01 Thread Anders Karlsson via Phabricator via cfe-commits
ank added a comment.
Herald added a subscriber: acoomans.

Ping!

it would be awesome to get some help getting this merged since I do not have 
merge rights


Repository:
  rC Clang

https://reviews.llvm.org/D45719



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


[PATCH] D45045: [DebugInfo] Generate debug information for labels.

2018-08-01 Thread Hsiangkai Wang via Phabricator via cfe-commits
HsiangKai added a comment.

In https://reviews.llvm.org/D45045#1184313, @vext01 wrote:

> Looks like this was backed out (reverted) yesterday.
>
> I'm really interested in inserting DILabels from LLVM in my research project, 
> so I hope it can be recovered.


You could apply it locally. In most cases, it works fine.

Currently, I still work on some problems when you use label in goto expression 
and you do some calculation on it under optimization.
Following is the test case I try to resolve the problem.

  int tab[9];
  
  void execute(unsigned short *oip, unsigned short *ip)
  {
int x = 0;
int *xp = tab;
  base:
x++;
if (x == 4)
  {
*xp = 0;
return;
  }
*xp++ = ip - oip;
goto *(&&base + *ip++);
  }
  
  int main()
  {
unsigned short ip[10];
int i;
for (i = 0; i < 10; i++)
  ip[i] = 0;
execute(ip, ip);
  
return 0;
  }

If you do not use label in such complex way, I think you could apply it 
temporarily.


Repository:
  rL LLVM

https://reviews.llvm.org/D45045



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


[PATCH] D47196: [Time-report ](2): Recursive timers in Clang

2018-08-01 Thread Andrew V. Tischenko via Phabricator via cfe-commits
avt77 updated this revision to Diff 158542.
avt77 added a comment.

efriedma, I removed redundant RAII objects but I still have the following:

1.0800 (271) _ZSt7declvalv (*)
 1.0840 (273) _ZSt7declvalv (*)
 1.0880 (269) _ZSt7declvalv (*)
 1.1000 (276) _ZSt7declvalv (*)
 1.1200 (282) _ZSt7declvalv (*)
 1.1360 (279) _ZSt7declvalv (*)
 1.1440 (286) _ZSt7declvalv (*)
 1.1760 (292) _ZSt7declvalv (*)
 1.1760 (295) _ZSt7declvalv (*)
 1.1800 (294) _ZSt7declvalv (*)
 1.1880 (298) _ZSt7declvalv (*)
 1.5960 (397) _ZSt7declvalv (*)

Every line corresponds to one unit and the number in parenthesis means the 
number of times we're dealing with the given function during the compilation of 
one unit. You say it's impossible but one time invocation of this function 
costs 0.0040 and 397 times invocations cost 1.588 (very close to the above 
number).

Do you have any ideas how to deal with all this stuff? Should I add/remove 
RAIIs somewhere?


https://reviews.llvm.org/D47196

Files:
  include/clang/Driver/CC1Options.td
  include/clang/Frontend/CodeGenOptions.h
  include/clang/Frontend/Utils.h
  lib/Analysis/AnalysisDeclContext.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CodeGenAction.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/FrontendTiming.cpp
  lib/Parse/CMakeLists.txt
  lib/Parse/ParseCXXInlineMethods.cpp
  lib/Parse/ParseTemplate.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaLambda.cpp
  lib/Sema/SemaOverload.cpp
  lib/Sema/SemaTemplateDeduction.cpp
  lib/Sema/SemaTemplateInstantiate.cpp
  lib/Sema/TreeTransform.h
  test/Frontend/ftime-report-template-decl.cpp
  test/Headers/opencl-c-header.cl

Index: test/Headers/opencl-c-header.cl
===
--- test/Headers/opencl-c-header.cl
+++ test/Headers/opencl-c-header.cl
@@ -71,4 +71,5 @@
 }
 #endif //__OPENCL_C_VERSION__
 
-// CHECK-MOD: Reading modules
+// CHECK-DAG-MOD: Clang Timers: CodeGen Functions
+// CHECK-DAG-MOD: Reading modules
Index: test/Frontend/ftime-report-template-decl.cpp
===
--- test/Frontend/ftime-report-template-decl.cpp
+++ test/Frontend/ftime-report-template-decl.cpp
@@ -3,9 +3,15 @@
 
 // Template function declarations
 template 
-void foo();
+T foo(T bar) {
+  T Result = bar * bar + bar / 1.2 + bar;
+  return Result;
+};
 template 
-void foo();
+T foo(T bar, U bar2) {
+  T Result = bar2 * bar + bar / 1.2 + bar2;
+  return Result;
+};
 
 // Template function definitions.
 template 
@@ -130,9 +136,15 @@
 template 
 oneT L<0>::O::Fun(U) { return one; }
 
-void Instantiate() {
+double Instantiate() {
   sassert(sizeof(L<0>::O::Fun(0)) == sizeof(one));
   sassert(sizeof(L<0>::O::Fun(0)) == sizeof(one));
+  int R1 = foo(123) + foo(177.2) - foo(331.442);
+  char R2 = foo('d', 1234) * foo(1.26);
+  int R3 = foo(1.2) + foo(11.22) / foo(66.77);
+  double R4 = foo(34.56, 1234);
+  double R5 = R1 + R2 * R3 - R4 + one[0] * foo(15.52) - two[1] / foo(51.25);
+  return R5 * R1 + R4 / R3 + R2;
 }
 }
 
@@ -150,7 +162,10 @@
 };
 _Wrap_alloc::rebind w;
 
-// CHECK: Miscellaneous Ungrouped Timers
+// FIXME:  We need more complex test to increase the compilation time;
+// otherwise we see the foolowing message from time to time only.
+// VIOLATILE-CHECK: Clang Timers: CodeGen Functions
+// CHECK-DAG: Miscellaneous Ungrouped Timers
 // CHECK-DAG: LLVM IR Generation Time
 // CHECK-DAG: Code Generation Time
 // CHECK: Total
Index: lib/Sema/TreeTransform.h
===
--- lib/Sema/TreeTransform.h
+++ lib/Sema/TreeTransform.h
@@ -27,6 +27,7 @@
 #include "clang/AST/StmtCXX.h"
 #include "clang/AST/StmtObjC.h"
 #include "clang/AST/StmtOpenMP.h"
+#include "clang/Frontend/Utils.h"
 #include "clang/Sema/Designator.h"
 #include "clang/Sema/Lookup.h"
 #include "clang/Sema/Ownership.h"
@@ -11002,6 +11003,18 @@
 
   LSI->CallOperator = NewCallOperator;
 
+  FrontendTimeRAII FTRAII(
+  FrontendTimesIsEnabled,
+  getFrontendFunctionTimeCtx(), {NewCallOperator, 0.0});
+
+//  if (FrontendTimesIsEnabled) {
+//// At this point we're sure we're dealing with some function that's why
+//// we're starting the corresponding time slice. We'll stop it in
+//// Sema::ActOnFinishFunctionBody.
+//getFrontendFunctionTimeCtx()->startFrontendTimer(
+//{NewCallOperator, 0.0});
+//  }
+
   for (unsigned I = 0, NumParams = NewCallOperator->getNumParams();
I != NumParams; ++I) {
 auto *P = NewCallOperator->getParamDecl(I);
Index: lib/Sema/SemaTemplateInstantiate.cpp
===
--- lib/Sema/SemaTemplateInstantiate.cpp
+++ lib/Sema/SemaTemplateInstantiate.cpp
@@ -128,6 +128,9 @@
 }
 // Add template arguments from a function template specialization.
 else if (FunctionDecl *Function = dyn_cast(Ctx)) {
+  FrontendTimeRAII FTRAII(
+  FrontendTi

[PATCH] D45045: [DebugInfo] Generate debug information for labels.

2018-08-01 Thread Edd Barrett via Phabricator via cfe-commits
vext01 added a comment.

Hi HsiangKai,

Thanks for the response.

Indeed, I've just rolled back to just before the revert for now to experiment, 
but I do hope this change hits LLVM-7.

Wishing you the best of luck with getting it merged!


Repository:
  rL LLVM

https://reviews.llvm.org/D45045



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


[libunwind] r338570 - Bump version number to 8.0.0svn

2018-08-01 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug  1 08:22:27 2018
New Revision: 338570

URL: http://llvm.org/viewvc/llvm-project?rev=338570&view=rev
Log:
Bump version number to 8.0.0svn

Modified:
libunwind/trunk/CMakeLists.txt

Modified: libunwind/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=338570&r1=338569&r2=338570&view=diff
==
--- libunwind/trunk/CMakeLists.txt (original)
+++ libunwind/trunk/CMakeLists.txt Wed Aug  1 08:22:27 2018
@@ -80,7 +80,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   endif()
 
   set(PACKAGE_NAME libunwind)
-  set(PACKAGE_VERSION 7.0.0svn)
+  set(PACKAGE_VERSION 8.0.0svn)
   set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
   set(PACKAGE_BUGREPORT "llvm-b...@lists.llvm.org")
 


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


[libcxx] r338571 - Drop 'svn' suffix from the version number.

2018-08-01 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug  1 08:23:47 2018
New Revision: 338571

URL: http://llvm.org/viewvc/llvm-project?rev=338571&view=rev
Log:
Drop 'svn' suffix from the version number.

Modified:
libcxx/branches/release_70/CMakeLists.txt

Modified: libcxx/branches/release_70/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_70/CMakeLists.txt?rev=338571&r1=338570&r2=338571&view=diff
==
--- libcxx/branches/release_70/CMakeLists.txt (original)
+++ libcxx/branches/release_70/CMakeLists.txt Wed Aug  1 08:23:47 2018
@@ -27,7 +27,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   project(libcxx CXX C)
 
   set(PACKAGE_NAME libcxx)
-  set(PACKAGE_VERSION 7.0.0svn)
+  set(PACKAGE_VERSION 7.0.0)
   set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
   set(PACKAGE_BUGREPORT "llvm-b...@lists.llvm.org")
 


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


[libunwind] r338572 - Drop 'svn' suffix from the version number.

2018-08-01 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug  1 08:24:06 2018
New Revision: 338572

URL: http://llvm.org/viewvc/llvm-project?rev=338572&view=rev
Log:
Drop 'svn' suffix from the version number.

Modified:
libunwind/branches/release_70/CMakeLists.txt

Modified: libunwind/branches/release_70/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/branches/release_70/CMakeLists.txt?rev=338572&r1=338571&r2=338572&view=diff
==
--- libunwind/branches/release_70/CMakeLists.txt (original)
+++ libunwind/branches/release_70/CMakeLists.txt Wed Aug  1 08:24:06 2018
@@ -80,7 +80,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   endif()
 
   set(PACKAGE_NAME libunwind)
-  set(PACKAGE_VERSION 7.0.0svn)
+  set(PACKAGE_VERSION 7.0.0)
   set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
   set(PACKAGE_BUGREPORT "llvm-b...@lists.llvm.org")
 


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


Re: r338455 - [constexpr] Support for constant evaluation of __builtin_memcpy and

2018-08-01 Thread Benjamin Kramer via cfe-commits
It's pretty easy to make this crash

$ cat memcpy.c
void foo() {
  int a[1], b;
  memcpy((char*)a, (const char*)&b, (unsigned long)4);
}

$ clang memcpy.c
llvm/include/llvm/ADT/SmallVector.h:178: const_reference
llvm::SmallVectorTemplateCommon::back() const [T = clang::APValue::LValue
PathEntry]: Assertion `!empty()' failed.

On Wed, Aug 1, 2018 at 1:35 AM Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rsmith
> Date: Tue Jul 31 16:35:09 2018
> New Revision: 338455
>
> URL: http://llvm.org/viewvc/llvm-project?rev=338455&view=rev
> Log:
> [constexpr] Support for constant evaluation of __builtin_memcpy and
> __builtin_memmove (in non-type-punning cases).
>
> This is intended to permit libc++ to make std::copy etc constexpr
> without sacrificing the optimization that uses memcpy on
> trivially-copyable types.
>
> __builtin_strcpy and __builtin_wcscpy are not handled by this change.
> They'd be straightforward to add, but we haven't encountered a need for
> them just yet.
>
> Modified:
> cfe/trunk/include/clang/Basic/Builtins.def
> cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td
> cfe/trunk/lib/AST/ExprConstant.cpp
> cfe/trunk/test/CodeGen/builtin-memfns.c
> cfe/trunk/test/SemaCXX/constexpr-string.cpp
>
> Modified: cfe/trunk/include/clang/Basic/Builtins.def
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=338455&r1=338454&r2=338455&view=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/Builtins.def (original)
> +++ cfe/trunk/include/clang/Basic/Builtins.def Tue Jul 31 16:35:09 2018
> @@ -471,6 +471,8 @@ BUILTIN(__builtin_wcslen, "zwC*", "nF")
>  BUILTIN(__builtin_wcsncmp, "iwC*wC*z", "nF")
>  BUILTIN(__builtin_wmemchr, "w*wC*wz", "nF")
>  BUILTIN(__builtin_wmemcmp, "iwC*wC*z", "nF")
> +BUILTIN(__builtin_wmemcpy, "w*w*wC*z", "nF")
> +BUILTIN(__builtin_wmemmove, "w*w*wC*z", "nF")
>  BUILTIN(__builtin_return_address, "v*IUi", "n")
>  BUILTIN(__builtin_extract_return_addr, "v*v*", "n")
>  BUILTIN(__builtin_frame_address, "v*IUi", "n")
> @@ -908,6 +910,8 @@ LIBBUILTIN(wcslen,  "zwC*", "f", "wc
>  LIBBUILTIN(wcsncmp, "iwC*wC*z", "f", "wchar.h", ALL_LANGUAGES)
>  LIBBUILTIN(wmemchr, "w*wC*wz",  "f", "wchar.h", ALL_LANGUAGES)
>  LIBBUILTIN(wmemcmp, "iwC*wC*z", "f", "wchar.h", ALL_LANGUAGES)
> +LIBBUILTIN(wmemcpy, "w*w*wC*z", "f", "wchar.h", ALL_LANGUAGES)
> +LIBBUILTIN(wmemmove,"w*w*wC*z", "f", "wchar.h", ALL_LANGUAGES)
>
>  // C99
>  // In some systems setjmp is a macro that expands to _setjmp. We undefine
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td?rev=338455&r1=338454&r2=338455&view=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td Tue Jul 31
> 16:35:09 2018
> @@ -163,6 +163,20 @@ def note_constexpr_unsupported_unsized_a
>  def note_constexpr_unsized_array_indexed : Note<
>"indexing of array without known bound is not allowed "
>"in a constant expression">;
> +def note_constexpr_memcpy_type_pun : Note<
> +  "cannot constant evaluate '%select{memcpy|memmove}0' from object of "
> +  "type %1 to object of type %2">;
> +def note_constexpr_memcpy_nontrivial : Note<
> +  "cannot constant evaluate '%select{memcpy|memmove}0' between objects of
> "
> +  "non-trivially-copyable type %1">;
> +def note_constexpr_memcpy_overlap : Note<
> +  "'%select{memcpy|wmemcpy}0' between overlapping memory regions">;
> +def note_constexpr_memcpy_unsupported : Note<
> +  "'%select{%select{memcpy|wmemcpy}1|%select{memmove|wmemmove}1}0' "
> +  "not supported: %select{"
> +  "size to copy (%4) is not a multiple of size of element type %3 (%5)|"
> +  "source is not a contiguous array of at least %4 elements of type %3|"
> +  "destination is not a contiguous array of at least %4 elements of type
> %3}2">;
>
>  def warn_integer_constant_overflow : Warning<
>"overflow in expression; result is %0 with type %1">,
>
> Modified: cfe/trunk/lib/AST/ExprConstant.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=338455&r1=338454&r2=338455&view=diff
>
> ==
> --- cfe/trunk/lib/AST/ExprConstant.cpp (original)
> +++ cfe/trunk/lib/AST/ExprConstant.cpp Tue Jul 31 16:35:09 2018
> @@ -319,6 +319,25 @@ namespace {
>return false;
>  }
>
> +/// Get the range of valid index adjustments in the form
> +///   {maximum value that can be subtracted from this pointer,
> +///maximum value that can be added to this pointer}
> +std::pair validIndexAdjustments() {
> +  if (Invalid || isMostDerivedAnUnsizedArray())
> +return {0, 0};
> +
> +  // [expr.add]p4

[PATCH] D50104: [OpenCL] Always emit alloca in entry block for enqueue_kernel builtin

2018-08-01 Thread Scott Linder via Phabricator via cfe-commits
scott.linder updated this revision to Diff 158545.
scott.linder added a comment.

Address feedback; I hope I understood correctly what debug info to check for.

I don't see where in CreateMemTemp and friends EmitLifetimeStart gets called, 
and I don't see any lifetime intrinsics in the IR even at -O1.


https://reviews.llvm.org/D50104

Files:
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGenOpenCL/enqueue-kernel-non-entry-block.cl


Index: test/CodeGenOpenCL/enqueue-kernel-non-entry-block.cl
===
--- /dev/null
+++ test/CodeGenOpenCL/enqueue-kernel-non-entry-block.cl
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -emit-llvm -o - -triple amdgcn < %s | 
FileCheck %s --check-prefixes=COMMON,AMDGPU
+// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -emit-llvm -o - -triple 
"spir-unknown-unknown" < %s | FileCheck %s --check-prefixes=COMMON,SPIR32
+// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -emit-llvm -o - -triple 
"spir64-unknown-unknown" < %s | FileCheck %s --check-prefixes=COMMON,SPIR64
+// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -debug-info-kind=limited -emit-llvm -o - 
-triple amdgcn < %s | FileCheck %s --check-prefixes=CHECK-DEBUG
+
+// Check that the enqueue_kernel array temporary is in the entry block to avoid
+// a dynamic alloca
+
+typedef struct {int a;} ndrange_t;
+
+kernel void test(int i) {
+// COMMON-LABEL: define {{.*}} void @test
+// COMMON-LABEL: entry:
+// AMDGPU: %block_sizes = alloca [1 x i64]
+// SPIR32: %block_sizes = alloca [1 x i32]
+// SPIR64: %block_sizes = alloca [1 x i64]
+// COMMON-LABEL: if.then:
+// COMMON-NOT: alloca
+// CHECK-DEBUG: getelementptr {{.*}} %block_sizes, {{.*}} !dbg !34
+// COMMON-LABEL: if.end
+  queue_t default_queue;
+  unsigned flags = 0;
+  ndrange_t ndrange;
+  if (i)
+enqueue_kernel(default_queue, flags, ndrange, ^(local void *a) { }, 32);
+}
+
+// Check that the temporary is scoped to the `if`
+
+// CHECK-DEBUG: !32 = distinct !DILexicalBlock(scope: !7, file: !1, line: 24)
+// CHECK-DEBUG: !34 = !DILocation(line: 25, scope: !32)
Index: lib/CodeGen/CGBuiltin.cpp
===
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -3338,15 +3338,18 @@
 // Create a temporary array to hold the sizes of local pointer arguments
 // for the block. \p First is the position of the first size argument.
 auto CreateArrayForSizeVar = [=](unsigned First) {
-  auto *AT = llvm::ArrayType::get(SizeTy, NumArgs - First);
-  auto *Arr = Builder.CreateAlloca(AT);
+  llvm::APInt ArraySize(32, NumArgs - First);
+  QualType SizeArrayTy = getContext().getConstantArrayType(
+  getContext().getSizeType(), ArraySize, ArrayType::Normal,
+  /*IndexTypeQuals=*/0);
+  auto Tmp = CreateMemTemp(SizeArrayTy, "block_sizes");
   llvm::Value *Ptr;
   // Each of the following arguments specifies the size of the 
corresponding
   // argument passed to the enqueued block.
   auto *Zero = llvm::ConstantInt::get(IntTy, 0);
   for (unsigned I = First; I < NumArgs; ++I) {
 auto *Index = llvm::ConstantInt::get(IntTy, I - First);
-auto *GEP = Builder.CreateGEP(Arr, {Zero, Index});
+auto *GEP = Builder.CreateGEP(Tmp.getPointer(), {Zero, Index});
 if (I == First)
   Ptr = GEP;
 auto *V =


Index: test/CodeGenOpenCL/enqueue-kernel-non-entry-block.cl
===
--- /dev/null
+++ test/CodeGenOpenCL/enqueue-kernel-non-entry-block.cl
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -emit-llvm -o - -triple amdgcn < %s | FileCheck %s --check-prefixes=COMMON,AMDGPU
+// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -emit-llvm -o - -triple "spir-unknown-unknown" < %s | FileCheck %s --check-prefixes=COMMON,SPIR32
+// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -emit-llvm -o - -triple "spir64-unknown-unknown" < %s | FileCheck %s --check-prefixes=COMMON,SPIR64
+// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -debug-info-kind=limited -emit-llvm -o - -triple amdgcn < %s | FileCheck %s --check-prefixes=CHECK-DEBUG
+
+// Check that the enqueue_kernel array temporary is in the entry block to avoid
+// a dynamic alloca
+
+typedef struct {int a;} ndrange_t;
+
+kernel void test(int i) {
+// COMMON-LABEL: define {{.*}} void @test
+// COMMON-LABEL: entry:
+// AMDGPU: %block_sizes = alloca [1 x i64]
+// SPIR32: %block_sizes = alloca [1 x i32]
+// SPIR64: %block_sizes = alloca [1 x i64]
+// COMMON-LABEL: if.then:
+// COMMON-NOT: alloca
+// CHECK-DEBUG: getelementptr {{.*}} %block_sizes, {{.*}} !dbg !34
+// COMMON-LABEL: if.end
+  queue_t default_queue;
+  unsigned flags = 0;
+  ndrange_t ndrange;
+  if (i)
+enqueue_kernel(default_queue, flags, ndrange, ^(local void *a) { }, 32);
+}
+
+// Check that the temporary is scoped to the `if`
+
+// CHECK-DEBUG: !32 = distinct !DILexicalBlock(scope: !7, file: !1, line: 24)
+// CHECK-DEBUG: !34 = !DILocation(line: 25, scope: !32)
Index: lib/

[PATCH] D47849: [OpenMP][Clang][NVPTX] Enable math functions called in an OpenMP NVPTX target device region to be resolved as device-native function calls

2018-08-01 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel added a comment.

In https://reviews.llvm.org/D47849#1183996, @Hahnfeld wrote:

> In https://reviews.llvm.org/D47849#1183150, @hfinkel wrote:
>
> > Hrmm. Doesn't that make it so that whatever functions are implemented using 
> > that inline assembly will not be callable from target code (or, perhaps 
> > worse, will crash the backend if called)?
>
>
> You are right :-(
>
> However I'm getting worried about a more general case, not all inline 
> assembly is guarded by `#ifdef`s that we could hope to get right. For example 
> take `sys/io.h` which currently throws 18 errors when compiling with 
> offloading to GPUs, even with `-O0`. The inline assembly is only guarded by 
> `#if defined __GNUC__ && __GNUC__ >= 2` which should be defined by any modern 
> compiler claiming compatibility with GCC. I'm not sure this particular header 
> will ever end up in an OpenMP application, but others with inline assembly 
> will. From a quick grep it looks like some headers dealing with atomic 
> operations have inline assembly and even 
> `eigen3/Eigen/src/Core/util/Memory.h` for finding the cpuid.
>
> Coming back to the original problem: Maybe we need to undefine optimization 
> macros as in your patch to get as many correct inline functions as possible 
> AND ignore errors from inline assembly as in my patch to not break when 
> including weird headers?


The problem is that the inline assembly might actually be for the target, 
instead of the host, because we also have target preprocessor macros defined, 
and it's going to be hard to tell. I'm not sure that there's a great solution 
here, and I agree that having something more general than undefining some 
specific things that happen to matter for math.h would be better. As you point 
out, this is not just a system-header problem. We might indeed want to undefine 
all of the target-feature-related macros (although that won't always be 
sufficient, because we need basic arch macros for the system headers to work at 
all, and those are generally enough to guard some inline asm).

Maybe the following makes sense: Only define the host macros, minus 
target-feature ones, when compiling for the target in the context of the system 
headers. That makes the system headers work while providing a "clean" 
preprocessor environment for the rest of the code (and, thus, retains our 
ability to complain about bad inline asm).


Repository:
  rC Clang

https://reviews.llvm.org/D47849



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


r338578 - [Format] Fix for bug 35641

2018-08-01 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Wed Aug  1 08:32:56 2018
New Revision: 338578

URL: http://llvm.org/viewvc/llvm-project?rev=338578&view=rev
Log:
[Format] Fix for bug 35641

Summary:
Bug was caused due to comments at the start of scope. For a code like:
```
int func() { //
  int b;
  int c;
}
```
the comment at the first line gets IndentAndNestingLevel (1,1) whereas
the following declarations get only (0,1) which prevents them from insertion
of a new scope. So, I changed the AlignTokenSequence to look at previous
*non-comment* token when deciding whether to introduce a new scope into
stack or not.

Patch by Kadir Cetinkaya!

Reviewers: rsmith, djasper

Reviewed By: djasper

Subscribers: lebedev.ri, cfe-commits, klimek

Tags: #clang

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

Modified:
cfe/trunk/lib/Format/WhitespaceManager.cpp
cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/lib/Format/WhitespaceManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/WhitespaceManager.cpp?rev=338578&r1=338577&r2=338578&view=diff
==
--- cfe/trunk/lib/Format/WhitespaceManager.cpp (original)
+++ cfe/trunk/lib/Format/WhitespaceManager.cpp Wed Aug  1 08:32:56 2018
@@ -255,8 +255,14 @@ AlignTokenSequence(unsigned Start, unsig
 Changes[ScopeStack.back()].indentAndNestingLevel())
   ScopeStack.pop_back();
 
+// Compare current token to previous non-comment token to ensure whether
+// it is in a deeper scope or not.
+unsigned PreviousNonComment = i - 1;
+while (PreviousNonComment > Start &&
+   Changes[PreviousNonComment].Tok->is(tok::comment))
+  PreviousNonComment--;
 if (i != Start && Changes[i].indentAndNestingLevel() >
-  Changes[i - 1].indentAndNestingLevel())
+  Changes[PreviousNonComment].indentAndNestingLevel())
   ScopeStack.push_back(i);
 
 bool InsideNestedScope = ScopeStack.size() != 0;

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=338578&r1=338577&r2=338578&view=diff
==
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Wed Aug  1 08:32:56 2018
@@ -9804,6 +9804,14 @@ TEST_F(FormatTest, AlignConsecutiveDecla
   "});\n",
   Alignment);
   Alignment.PointerAlignment = FormatStyle::PAS_Right;
+
+  // See llvm.org/PR35641
+  Alignment.AlignConsecutiveDeclarations = true;
+  verifyFormat("int func() { //\n"
+   "  int  b;\n"
+   "  unsigned c;\n"
+   "}",
+   Alignment);
 }
 
 TEST_F(FormatTest, LinuxBraceBreaking) {


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


[PATCH] D43303: [Format] Fix for bug 35641

2018-08-01 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL338578: [Format] Fix for bug 35641 (authored by ibiryukov, 
committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D43303?vs=134830&id=158546#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D43303

Files:
  cfe/trunk/lib/Format/WhitespaceManager.cpp
  cfe/trunk/unittests/Format/FormatTest.cpp


Index: cfe/trunk/unittests/Format/FormatTest.cpp
===
--- cfe/trunk/unittests/Format/FormatTest.cpp
+++ cfe/trunk/unittests/Format/FormatTest.cpp
@@ -9804,6 +9804,14 @@
   "});\n",
   Alignment);
   Alignment.PointerAlignment = FormatStyle::PAS_Right;
+
+  // See llvm.org/PR35641
+  Alignment.AlignConsecutiveDeclarations = true;
+  verifyFormat("int func() { //\n"
+   "  int  b;\n"
+   "  unsigned c;\n"
+   "}",
+   Alignment);
 }
 
 TEST_F(FormatTest, LinuxBraceBreaking) {
Index: cfe/trunk/lib/Format/WhitespaceManager.cpp
===
--- cfe/trunk/lib/Format/WhitespaceManager.cpp
+++ cfe/trunk/lib/Format/WhitespaceManager.cpp
@@ -255,8 +255,14 @@
 Changes[ScopeStack.back()].indentAndNestingLevel())
   ScopeStack.pop_back();
 
+// Compare current token to previous non-comment token to ensure whether
+// it is in a deeper scope or not.
+unsigned PreviousNonComment = i - 1;
+while (PreviousNonComment > Start &&
+   Changes[PreviousNonComment].Tok->is(tok::comment))
+  PreviousNonComment--;
 if (i != Start && Changes[i].indentAndNestingLevel() >
-  Changes[i - 1].indentAndNestingLevel())
+  Changes[PreviousNonComment].indentAndNestingLevel())
   ScopeStack.push_back(i);
 
 bool InsideNestedScope = ScopeStack.size() != 0;


Index: cfe/trunk/unittests/Format/FormatTest.cpp
===
--- cfe/trunk/unittests/Format/FormatTest.cpp
+++ cfe/trunk/unittests/Format/FormatTest.cpp
@@ -9804,6 +9804,14 @@
   "});\n",
   Alignment);
   Alignment.PointerAlignment = FormatStyle::PAS_Right;
+
+  // See llvm.org/PR35641
+  Alignment.AlignConsecutiveDeclarations = true;
+  verifyFormat("int func() { //\n"
+   "  int  b;\n"
+   "  unsigned c;\n"
+   "}",
+   Alignment);
 }
 
 TEST_F(FormatTest, LinuxBraceBreaking) {
Index: cfe/trunk/lib/Format/WhitespaceManager.cpp
===
--- cfe/trunk/lib/Format/WhitespaceManager.cpp
+++ cfe/trunk/lib/Format/WhitespaceManager.cpp
@@ -255,8 +255,14 @@
 Changes[ScopeStack.back()].indentAndNestingLevel())
   ScopeStack.pop_back();
 
+// Compare current token to previous non-comment token to ensure whether
+// it is in a deeper scope or not.
+unsigned PreviousNonComment = i - 1;
+while (PreviousNonComment > Start &&
+   Changes[PreviousNonComment].Tok->is(tok::comment))
+  PreviousNonComment--;
 if (i != Start && Changes[i].indentAndNestingLevel() >
-  Changes[i - 1].indentAndNestingLevel())
+  Changes[PreviousNonComment].indentAndNestingLevel())
   ScopeStack.push_back(i);
 
 bool InsideNestedScope = ScopeStack.size() != 0;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45719: [clang-Format] Fix indentation of member call after block

2018-08-01 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added a comment.

Sorry that I lost track of that, but feel free to ping once / week - 
unfortunately the patch doesn't apply cleanly, can you rebase?


Repository:
  rC Clang

https://reviews.llvm.org/D45719



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


[PATCH] D47849: [OpenMP][Clang][NVPTX] Enable math functions called in an OpenMP NVPTX target device region to be resolved as device-native function calls

2018-08-01 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

In https://reviews.llvm.org/D47849#1184367, @hfinkel wrote:

> The problem is that the inline assembly might actually be for the target, 
> instead of the host, because we also have target preprocessor macros defined, 
> and it's going to be hard to tell. I'm not sure that there's a great solution 
> here, and I agree that having something more general than undefining some 
> specific things that happen to matter for math.h would be better. As you 
> point out, this is not just a system-header problem. We might indeed want to 
> undefine all of the target-feature-related macros (although that won't always 
> be sufficient, because we need basic arch macros for the system headers to 
> work at all, and those are generally enough to guard some inline asm).


I think there was a reason for pulling in the host defines. I'd have to look at 
the commit message though...

> Maybe the following makes sense: Only define the host macros, minus 
> target-feature ones, when compiling for the target in the context of the 
> system headers. That makes the system headers work while providing a "clean" 
> preprocessor environment for the rest of the code (and, thus, retains our 
> ability to complain about bad inline asm).

I'm not sure how that's going to help with Eigen: Just including `Eigen/Core` 
will pull in the other header file I mentioned with inline assembly. That's 
completely independent of preprocessor macros, I think it's enough the 
library's build system detected the host architecture during install.


Repository:
  rC Clang

https://reviews.llvm.org/D47849



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


[PATCH] D45719: [clang-Format] Fix indentation of member call after block

2018-08-01 Thread Danila Malyutin via Phabricator via cfe-commits
danilaml added inline comments.



Comment at: lib/Format/FormatToken.h:323
+  bool closesScopeAfterBlock() const {
+if(BlockKind == BK_Block)
+  return true;

Looks like all other `if`s in this file have space before `(`.


Repository:
  rC Clang

https://reviews.llvm.org/D45719



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


[PATCH] D50144: Add Windows support for the GNUstep Objective-C ABI V2.

2018-08-01 Thread David Chisnall via Phabricator via cfe-commits
theraven created this revision.
theraven added reviewers: rjmccall, DHowett-MSFT.
Herald added a subscriber: cfe-commits.

Introduces funclet-based unwinding for Objective-C and fixes an issue
where global blocks can't have their isa pointers initialised on
Windows.

After discussion with Dustin, this changes the name mangling of
Objective-C types to prevent a C++ catch statement of type struct X*
from catching an Objective-C object of type X*.


Repository:
  rC Clang

https://reviews.llvm.org/D50144

Files:
  include/clang/Driver/Options.td
  lib/AST/MicrosoftMangle.cpp
  lib/CodeGen/CGBlocks.cpp
  lib/CodeGen/CGException.cpp
  lib/CodeGen/CGObjCGNU.cpp
  lib/CodeGen/CGObjCRuntime.cpp
  lib/CodeGen/CGObjCRuntime.h
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/EHScopeStack.h
  lib/Driver/ToolChains/Clang.cpp
  test/CodeGenObjC/gnu-init.m
  test/CodeGenObjCXX/arc-marker-funclet.mm
  test/CodeGenObjCXX/microsoft-abi-arc-param-order.mm
  test/CodeGenObjCXX/msabi-objc-extensions.mm
  test/CodeGenObjCXX/msabi-objc-types.mm

Index: test/CodeGenObjCXX/msabi-objc-types.mm
===
--- test/CodeGenObjCXX/msabi-objc-types.mm
+++ test/CodeGenObjCXX/msabi-objc-types.mm
@@ -3,166 +3,166 @@
 @class I;
 
 id kid;
-// CHECK: @"?kid@@3PAUobjc_object@@A" =  dso_local global
+// CHECK: @"?kid@@3PAU.objc_object@@A" =  dso_local global
 
 Class klass;
-// CHECK: @"?klass@@3PAUobjc_class@@A" = dso_local global
+// CHECK: @"?klass@@3PAU.objc_class@@A" = dso_local global
 
 I *kI;
-// CHECK: @"?kI@@3PAUI@@A" = dso_local global
+// CHECK: @"?kI@@3PAU.objc_cls_I@@A" = dso_local global
 
 void f(I *) {}
-// CHECK-LABEL: "?f@@YAXPAUI@@@Z"
+// CHECK-LABEL: "?f@@YAXPAU.objc_cls_I@@@Z"
 
 void f(const I *) {}
-// CHECK-LABEL: "?f@@YAXPBUI@@@Z"
+// CHECK-LABEL: "?f@@YAXPBU.objc_cls_I@@@Z"
 
 void f(I &) {}
-// CHECK-LABEL: "?f@@YAXAAUI@@@Z"
+// CHECK-LABEL: "?f@@YAXAAU.objc_cls_I@@@Z"
 
 void f(const I &) {}
-// CHECK-LABEL: "?f@@YAXABUI@@@Z"
+// CHECK-LABEL: "?f@@YAXABU.objc_cls_I@@@Z"
 
 void f(const I &&) {}
-// CHECK-LABEL: "?f@@YAX$$QBUI@@@Z"
+// CHECK-LABEL: "?f@@YAX$$QBU.objc_cls_I@@@Z"
 
 void g(id) {}
-// CHECK-LABEL: "?g@@YAXPAUobjc_object@@@Z"
+// CHECK-LABEL: "?g@@YAXPAU.objc_object@@@Z"
 
 void g(id &) {}
-// CHECK-LABEL: "?g@@YAXAAPAUobjc_object@@@Z"
+// CHECK-LABEL: "?g@@YAXAAPAU.objc_object@@@Z"
 
 void g(const id &) {}
-// CHECK-LABEL: "?g@@YAXABQAUobjc_object@@@Z"
+// CHECK-LABEL: "?g@@YAXABQAU.objc_object@@@Z"
 
 void g(id &&) {}
-// CHECK-LABEL: "?g@@YAX$$QAPAUobjc_object@@@Z"
+// CHECK-LABEL: "?g@@YAX$$QAPAU.objc_object@@@Z"
 
 void h(Class) {}
-// CHECK-LABEL: "?h@@YAXPAUobjc_class@@@Z"
+// CHECK-LABEL: "?h@@YAXPAU.objc_class@@@Z"
 
 void h(Class &) {}
-// CHECK-LABEL: "?h@@YAXAAPAUobjc_class@@@Z"
+// CHECK-LABEL: "?h@@YAXAAPAU.objc_class@@@Z"
 
 void h(const Class &) {}
-// CHECK-LABEL: "?h@@YAXABQAUobjc_class@@@Z"
+// CHECK-LABEL: "?h@@YAXABQAU.objc_class@@@Z"
 
 void h(Class &&) {}
-// CHECK-LABEL: "?h@@YAX$$QAPAUobjc_class@@@Z"
+// CHECK-LABEL: "?h@@YAX$$QAPAU.objc_class@@@Z"
 
 I *i() { return nullptr; }
-// CHECK-LABEL: "?i@@YAPAUI@@XZ"
+// CHECK-LABEL: "?i@@YAPAU.objc_cls_I@@XZ"
 
 const I *j() { return nullptr; }
-// CHECK-LABEL: "?j@@YAPBUI@@XZ"
+// CHECK-LABEL: "?j@@YAPBU.objc_cls_I@@XZ"
 
 I &k() { return *kI; }
-// CHECK-LABEL: "?k@@YAAAUI@@XZ"
+// CHECK-LABEL: "?k@@YAAAU.objc_cls_I@@XZ"
 
 const I &l() { return *kI; }
-// CHECK-LABEL: "?l@@YAABUI@@XZ"
+// CHECK-LABEL: "?l@@YAABU.objc_cls_I@@XZ"
 
 void m(const id) {}
-// CHECK-LABEL: "?m@@YAXQAUobjc_object@@@Z"
+// CHECK-LABEL: "?m@@YAXQAU.objc_object@@@Z"
 
 void m(const I *) {}
-// CHECK-LABEL: "?m@@YAXPBUI@@@Z"
+// CHECK-LABEL: "?m@@YAXPBU.objc_cls_I@@@Z"
 
 void n(SEL) {}
-// CHECK-LABEL: "?n@@YAXPAUobjc_selector@@@Z"
+// CHECK-LABEL: "?n@@YAXPAU.objc_selector@@@Z"
 
 void n(SEL *) {}
-// CHECK-LABEL: "?n@@YAXPAPAUobjc_selector@@@Z"
+// CHECK-LABEL: "?n@@YAXPAPAU.objc_selector@@@Z"
 
 void n(const SEL *) {}
-// CHECK-LABEL: "?n@@YAXPBQAUobjc_selector@@@Z"
+// CHECK-LABEL: "?n@@YAXPBQAU.objc_selector@@@Z"
 
 void n(SEL &) {}
-// CHECK-LABEL: "?n@@YAXAAPAUobjc_selector@@@Z"
+// CHECK-LABEL: "?n@@YAXAAPAU.objc_selector@@@Z"
 
 void n(const SEL &) {}
-// CHECK-LABEL: "?n@@YAXABQAUobjc_selector@@@Z"
+// CHECK-LABEL: "?n@@YAXABQAU.objc_selector@@@Z"
 
 void n(SEL &&) {}
-// CHECK-LABEL: "?n@@YAX$$QAPAUobjc_selector@@@Z"
+// CHECK-LABEL: "?n@@YAX$$QAPAU.objc_selector@@@Z"
 
 struct __declspec(dllexport) s {
   struct s &operator=(const struct s &) = delete;
 
   void m(I *) {}
-  // CHECK-LABEL: "?m@s@@QAAXPAUI@@@Z"
+  // CHECK-LABEL: "?m@s@@QAAXPAU.objc_cls_I@@@Z"
 
   void m(const I *) {}
-  // CHECK-LABEL: "?m@s@@QAAXPBUI@@@Z"
+  // CHECK-LABEL: "?m@s@@QAAXPBU.objc_cls_I@@@Z"
 
   void m(I &) {}
-  // CHECK-LABEL: "?m@s@@QAAXAAUI@@@Z"
+  // CHECK-LABEL: "?m@s@@QAAXAAU.objc_cls_I@@@Z"
 
   void m(const I &) {}
-  // CHECK-LABEL: "?m@s@@QAAXABUI@@@Z"
+  // CHECK-LABEL: "?m@s@@QAAXABU.objc_cls_I@@

[PATCH] D47849: [OpenMP][Clang][NVPTX] Enable math functions called in an OpenMP NVPTX target device region to be resolved as device-native function calls

2018-08-01 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel added a comment.

In https://reviews.llvm.org/D47849#1184388, @Hahnfeld wrote:

> In https://reviews.llvm.org/D47849#1184367, @hfinkel wrote:
>
> > The problem is that the inline assembly might actually be for the target, 
> > instead of the host, because we also have target preprocessor macros 
> > defined, and it's going to be hard to tell. I'm not sure that there's a 
> > great solution here, and I agree that having something more general than 
> > undefining some specific things that happen to matter for math.h would be 
> > better. As you point out, this is not just a system-header problem. We 
> > might indeed want to undefine all of the target-feature-related macros 
> > (although that won't always be sufficient, because we need basic arch 
> > macros for the system headers to work at all, and those are generally 
> > enough to guard some inline asm).
>
>
> I think there was a reason for pulling in the host defines. I'd have to look 
> at the commit message though...


As I recall, it's mostly to make glibc's bits/wordsize.h work.

> 
> 
>> Maybe the following makes sense: Only define the host macros, minus 
>> target-feature ones, when compiling for the target in the context of the 
>> system headers. That makes the system headers work while providing a "clean" 
>> preprocessor environment for the rest of the code (and, thus, retains our 
>> ability to complain about bad inline asm).
> 
> I'm not sure how that's going to help with Eigen: Just including `Eigen/Core` 
> will pull in the other header file I mentioned with inline assembly. That's 
> completely independent of preprocessor macros, I think it's enough the 
> library's build system detected the host architecture during install.

I don't see any good way to satisfy Eigen in that form. I think that we'll need 
to update it to understand not to use host inline as when compiling for a 
target.


Repository:
  rC Clang

https://reviews.llvm.org/D47849



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


[PATCH] D49396: [WebAssembly] Support for atomic.wait / atomic.wake builtins

2018-08-01 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin updated this revision to Diff 158555.
aheejin added a comment.

- wake -> notify


Repository:
  rC Clang

https://reviews.llvm.org/D49396

Files:
  include/clang/Basic/BuiltinsWebAssembly.def
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/builtins-wasm.c


Index: test/CodeGen/builtins-wasm.c
===
--- test/CodeGen/builtins-wasm.c
+++ test/CodeGen/builtins-wasm.c
@@ -50,3 +50,21 @@
 // WEBASSEMBLY32: call void @llvm.wasm.rethrow()
 // WEBASSEMBLY64: call void @llvm.wasm.rethrow()
 }
+
+int f8(int *addr, int expected, long long timeout) {
+  return __builtin_wasm_atomic_wait_i32(addr, expected, timeout);
+// WEBASSEMBLY32: call i32 @llvm.wasm.atomic.wait.i32(i32* %{{.*}}, i32 
%{{.*}}, i64 %{{.*}})
+// WEBASSEMBLY64: call i32 @llvm.wasm.atomic.wait.i32(i32* %{{.*}}, i32 
%{{.*}}, i64 %{{.*}})
+}
+
+int f9(long long *addr, long long expected, long long timeout) {
+  return __builtin_wasm_atomic_wait_i64(addr, expected, timeout);
+// WEBASSEMBLY32: call i32 @llvm.wasm.atomic.wait.i64(i64* %{{.*}}, i64 
%{{.*}}, i64 %{{.*}})
+// WEBASSEMBLY64: call i32 @llvm.wasm.atomic.wait.i64(i64* %{{.*}}, i64 
%{{.*}}, i64 %{{.*}})
+}
+
+unsigned long long f10(int *addr, long long count) {
+  return __builtin_wasm_atomic_notify(addr, count);
+// WEBASSEMBLY32: call i64 @llvm.wasm.atomic.notify(i32* %{{.*}}, i64 %{{.*}})
+// WEBASSEMBLY64: call i64 @llvm.wasm.atomic.notify(i32* %{{.*}}, i64 %{{.*}})
+}
Index: lib/CodeGen/CGBuiltin.cpp
===
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -12081,6 +12081,26 @@
 Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_rethrow);
 return Builder.CreateCall(Callee);
   }
+  case WebAssembly::BI__builtin_wasm_atomic_wait_i32: {
+Value *Addr = EmitScalarExpr(E->getArg(0));
+Value *Expected = EmitScalarExpr(E->getArg(1));
+Value *Timeout = EmitScalarExpr(E->getArg(2));
+Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_atomic_wait_i32);
+return Builder.CreateCall(Callee, {Addr, Expected, Timeout});
+  }
+  case WebAssembly::BI__builtin_wasm_atomic_wait_i64: {
+Value *Addr = EmitScalarExpr(E->getArg(0));
+Value *Expected = EmitScalarExpr(E->getArg(1));
+Value *Timeout = EmitScalarExpr(E->getArg(2));
+Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_atomic_wait_i64);
+return Builder.CreateCall(Callee, {Addr, Expected, Timeout});
+  }
+  case WebAssembly::BI__builtin_wasm_atomic_notify: {
+Value *Addr = EmitScalarExpr(E->getArg(0));
+Value *Count = EmitScalarExpr(E->getArg(1));
+Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_atomic_notify);
+return Builder.CreateCall(Callee, {Addr, Count});
+  }
 
   default:
 return nullptr;
Index: include/clang/Basic/BuiltinsWebAssembly.def
===
--- include/clang/Basic/BuiltinsWebAssembly.def
+++ include/clang/Basic/BuiltinsWebAssembly.def
@@ -34,4 +34,9 @@
 BUILTIN(__builtin_wasm_throw, "vUiv*", "r")
 BUILTIN(__builtin_wasm_rethrow, "v", "r")
 
+// Atomic wait and notify.
+BUILTIN(__builtin_wasm_atomic_wait_i32, "ii*iLLi", "n")
+BUILTIN(__builtin_wasm_atomic_wait_i64, "iLLi*LLiLLi", "n")
+BUILTIN(__builtin_wasm_atomic_notify, "ULLii*LLi", "n")
+
 #undef BUILTIN


Index: test/CodeGen/builtins-wasm.c
===
--- test/CodeGen/builtins-wasm.c
+++ test/CodeGen/builtins-wasm.c
@@ -50,3 +50,21 @@
 // WEBASSEMBLY32: call void @llvm.wasm.rethrow()
 // WEBASSEMBLY64: call void @llvm.wasm.rethrow()
 }
+
+int f8(int *addr, int expected, long long timeout) {
+  return __builtin_wasm_atomic_wait_i32(addr, expected, timeout);
+// WEBASSEMBLY32: call i32 @llvm.wasm.atomic.wait.i32(i32* %{{.*}}, i32 %{{.*}}, i64 %{{.*}})
+// WEBASSEMBLY64: call i32 @llvm.wasm.atomic.wait.i32(i32* %{{.*}}, i32 %{{.*}}, i64 %{{.*}})
+}
+
+int f9(long long *addr, long long expected, long long timeout) {
+  return __builtin_wasm_atomic_wait_i64(addr, expected, timeout);
+// WEBASSEMBLY32: call i32 @llvm.wasm.atomic.wait.i64(i64* %{{.*}}, i64 %{{.*}}, i64 %{{.*}})
+// WEBASSEMBLY64: call i32 @llvm.wasm.atomic.wait.i64(i64* %{{.*}}, i64 %{{.*}}, i64 %{{.*}})
+}
+
+unsigned long long f10(int *addr, long long count) {
+  return __builtin_wasm_atomic_notify(addr, count);
+// WEBASSEMBLY32: call i64 @llvm.wasm.atomic.notify(i32* %{{.*}}, i64 %{{.*}})
+// WEBASSEMBLY64: call i64 @llvm.wasm.atomic.notify(i32* %{{.*}}, i64 %{{.*}})
+}
Index: lib/CodeGen/CGBuiltin.cpp
===
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -12081,6 +12081,26 @@
 Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_rethrow);
 return Builder.CreateCall(Callee);
   }
+  case WebAssembly::BI__builtin_wasm_atomic_wait_i32: {
+Value *Addr = EmitScalarExpr(E->getArg(0));
+Value *Expected = EmitScalarExpr(E->getAr

[PATCH] D50147: clang-format: support external styles

2018-08-01 Thread Francois Ferrand via Phabricator via cfe-commits
Typz created this revision.
Typz added reviewers: krasimir, djasper, klimek.
Herald added a subscriber: acoomans.

This patch allows defining external styles, which can be used exactly
like the embedded styles (llvm, google, mozilla...).

These styles are clang-format files installed either systemwide in
/usr/local/share/clang-format, or per-user in ~/.local/share/clang-
format. These can be specified by simply using the name of the file,
and clang-format will search the directories for the style:

  clang-format -style=foo-1.0

The patch also allows loading specifying a file name directly, either
relative or absolute:

  clang-format -style=/home/clang-format-styles/foo-1.0
  clang-format -style=styles/foo-1.0

This works also in `BaseOnStyle` field, which allows defining compagny-
wide (and possibly versionned) clang-format styles, without having to
maintain many copies in each repository: each repository will simply
need to store a short .clang-format, which simply references the
compagny-wide style.

The drawback is that these style need to be installed on each computer,
but this may be automated through an OS package. In any case, the error
cannot be ignored, as the user will be presented with an error message
if he does not have the style.

NOTE: this may be further improved by also allowing URL (http://,
git://...) in this field, which would allow clang-format to automatically
download the missing styles.


Repository:
  rC Clang

https://reviews.llvm.org/D50147

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

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -12113,6 +12113,61 @@
   ASSERT_EQ(*Style1, getGoogleStyle());
 }
 
+TEST(FormatStyle, GetExternalStyle) {
+  vfs::InMemoryFileSystem FS;
+  // Test 1: format file in /usr/local/share/clang-format/
+  ASSERT_TRUE(
+  FS.addFile("/usr/local/share/clang-format/style1", 0,
+ llvm::MemoryBuffer::getMemBuffer("BasedOnStyle: Google")));
+  auto Style1 = getStyle("style1", "", "LLVM", "", &FS);
+  ASSERT_TRUE((bool)Style1);
+  ASSERT_EQ(*Style1, getGoogleStyle());
+
+  // Test 2: format file in ~/.local/share/clang-format/
+  ASSERT_TRUE(
+  FS.addFile("~/.local/share/clang-format/style2", 0,
+ llvm::MemoryBuffer::getMemBuffer("BasedOnStyle: Google")));
+  auto Style2 = getStyle("style2", "", "LLVM", "", &FS);
+  ASSERT_TRUE((bool)Style2);
+  ASSERT_EQ(*Style2, getGoogleStyle());
+
+  // Test 3: format file in absolute path
+  ASSERT_TRUE(
+  FS.addFile("/clang-format-styles/style3", 0,
+ llvm::MemoryBuffer::getMemBuffer("BasedOnStyle: Google")));
+  auto Style3 = getStyle("/clang-format-styles/style3", "", "LLVM", "", &FS);
+  ASSERT_TRUE((bool)Style3);
+  ASSERT_EQ(*Style3, getGoogleStyle());
+
+  // Test 4: format file in relative path
+  ASSERT_TRUE(
+  FS.addFile("/home/clang-format-styles/style4", 0,
+ llvm::MemoryBuffer::getMemBuffer("BasedOnStyle: Google")));
+  FS.setCurrentWorkingDirectory("/home/clang-format-styles");
+  auto Style4 = getStyle("style4", "", "LLVM", "", &FS);
+  ASSERT_TRUE((bool)Style4);
+  ASSERT_EQ(*Style4, getGoogleStyle());
+
+  // Test 5: file does not exist
+  auto Style5 = getStyle("style5", "", "LLVM", "", &FS);
+  ASSERT_FALSE((bool)Style5);
+  llvm::consumeError(Style5.takeError());
+
+  // Test 6: absolute file does not exist
+  auto Style6 = getStyle("/style6", "", "LLVM", "", &FS);
+  ASSERT_FALSE((bool)Style6);
+  llvm::consumeError(Style6.takeError());
+
+  // Test 7: file is not a format style
+  ASSERT_TRUE(
+  FS.addFile("/usr/local/share/clang-format/nostyle", 0,
+ llvm::MemoryBuffer::getMemBuffer("This is not a style...")));
+  FS.setCurrentWorkingDirectory("/home/clang-format-styles");
+  auto Style7 = getStyle("nostyle", "", "LLVM", "", &FS);
+  ASSERT_FALSE((bool)Style7);
+  llvm::consumeError(Style7.takeError());
+}
+
 TEST(FormatStyle, GetStyleOfFile) {
   vfs::InMemoryFileSystem FS;
   // Test 1: format file in the same directory.
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -928,8 +928,42 @@
   return NoStyle;
 }
 
+// Try loading config file from path, in argument to -style and BasedOnStyle.
+bool loadSystemStyle(StringRef Name, FormatStyle *Style,
+ vfs::FileSystem *FS = nullptr) {
+  if (!FS) {
+FS = vfs::getRealFileSystem().get();
+  }
+  const llvm::SmallVector paths = {
+{"/usr/local/share/clang-format/", Name},
+{"~/.local/share/clang-format/", Name},
+Name
+  };
+  for (Twine Path: paths) {
+llvm::SmallVector RealPath;
+Twine ConfigFile{!FS->getRealPath(Path, RealPath) ? RealPath : Path};
+if (FS->exists(ConfigFile)) {
+  l

[PATCH] D50119: Compiler support for P1144R0 "__is_trivially_relocatable(T)"

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

- There's a bug in your implementation:

  struct X {
X &operator=(X &&);
  };
  static_assert(__is_trivially_relocatable(X)); // oops, fires!

`X` has a move constructor and a destructor, so it is trivially relocatable.

- Please run your code through clang-format.

- Might be useful to add a note explaining why the type isn't trivially 
relocatable isn't of the general "because it is not destructible".




Comment at: include/clang/Sema/Sema.h:4304
 
+  bool IsTriviallyRelocatableType(QualType QT) const;
+

Any reason why this is a free function? Should be a member function of 
`QualType`.



Comment at: lib/AST/DeclCXX.cpp:283
+if (Base->isVirtual() || !BaseClassDecl->isTriviallyRelocatable()) {
+  //puts("because 283");
+  setIsNotNaturallyTriviallyRelocatable();

Lingering debug message? :) There are many of them.

For a single expression, drop the braces of the if statement.



Comment at: lib/Sema/SemaDeclCXX.cpp:6066
+if (M->hasAttr() || Record->hasAttr()) {
+  // Consider removing this case to simplify the Standard wording.
+} else {

This should be a `// TODO: ...`. Is this comment really appropriate? The 
intended audience isn't compiler writers I think.



Comment at: lib/Sema/SemaDeclCXX.cpp:6157
+
+  if (getLangOpts().CPlusPlus11 &&
+  !Record->hasAttr() &&

This really just checks whether the type has defaulted copy constructor. If 
there was a move constructor, it would have been handled above. If the 
copy/move constructor is implicitly deleted, it would have been handled also 
above. Please simplify this accordingly.



Comment at: lib/Sema/SemaDeclCXX.cpp:6158
+  if (getLangOpts().CPlusPlus11 &&
+  !Record->hasAttr() &&
+  Record->isTriviallyRelocatable()) {

Why do you need to check whether the attribute is present or not? This is 
supposed to be whether the type is naturally trivially relocatable, so the 
presence of the attribute is not important.



Comment at: lib/Sema/SemaDeclCXX.cpp:6656
   SetDeclDeleted(MD, MD->getLocation());
+  if (CSM == CXXMoveConstructor || CSM == CXXDestructor) {
+//puts("because 6646");

You don't actually need those three lines. This is already handled in 
`CheckCompletedCXXClass`.



Comment at: test/SemaCXX/trivially-relocatable.cpp:42
+struct A6;
+struct [[trivially_relocatable]] A6 {};
+// expected-error@-1{{type A6 declared 'trivially_relocatable' after its first 
declaration}}

Why does this restriction exist? None of the existing attributes have it and I 
don't see why it would make sense to disallow this.



Comment at: test/SemaCXX/trivially-relocatable.cpp:471
+struct Incomplete; // expected-note {{forward declaration of 'Incomplete'}}
+struct Regression1 {
+  Incomplete i; // expected-error {{field has incomplete type 'Incomplete'}}

This is the right place for regression tests. Add them to 
test/Parser/cxx-class.cpp.


Repository:
  rC Clang

https://reviews.llvm.org/D50119



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


[PATCH] D50104: [OpenCL] Always emit alloca in entry block for enqueue_kernel builtin

2018-08-01 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh added a comment.

You'll probably also need to update 
`test/CodeGenOpenCL/cl20-device-side-enqueue.cl`; please verify with make/ninja 
`check-clang`.


https://reviews.llvm.org/D50104



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


[PATCH] D49771: CodeGen: use non-zero memset when possible for automatic variables

2018-08-01 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment.

There are two different considerations here:
(1) Create less target code
(2) Create less IR

If this code can significantly reduce the amount of IR, it can be useful in 
general. That's why the existing memset logic is helpful.


Repository:
  rL LLVM

https://reviews.llvm.org/D49771



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


Re: [clang-tools-extra] r338518 - [clangd] Receive compilationDatabasePath in 'initialize' request

2018-08-01 Thread Alex L via cfe-commits
Is there a particular reason why this commit didn't have a corresponding
test included?
Cheers,
Alex

On 1 August 2018 at 04:28, Simon Marchi via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: simark
> Date: Wed Aug  1 04:28:49 2018
> New Revision: 338518
>
> URL: http://llvm.org/viewvc/llvm-project?rev=338518&view=rev
> Log:
> [clangd] Receive compilationDatabasePath in 'initialize' request
>
> Summary:
> That way, as soon as the "initialize" is received by the server, it can
> start
> parsing/indexing with a valid compilation database and not have to wait
> for a
> an initial 'didChangeConfiguration' that might or might not happen.
> Then, when the user changes configuration, a didChangeConfiguration can be
> sent.
>
> Signed-off-by: Marc-Andre Laperle 
>
> Reviewers: malaperle
>
> Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
>
> Differential Revision: https://reviews.llvm.org/D49833
>
> Modified:
> clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
> clang-tools-extra/trunk/clangd/ClangdLSPServer.h
> clang-tools-extra/trunk/clangd/Protocol.cpp
> clang-tools-extra/trunk/clangd/Protocol.h
>
> Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
> URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/
> trunk/clangd/ClangdLSPServer.cpp?rev=338518&r1=338517&r2=338518&view=diff
> 
> ==
> --- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp (original)
> +++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp Wed Aug  1
> 04:28:49 2018
> @@ -72,6 +72,9 @@ SymbolKindBitset defaultSymbolKinds() {
>  } // namespace
>
>  void ClangdLSPServer::onInitialize(InitializeParams &Params) {
> +  if (Params.initializationOptions)
> +applyConfiguration(*Params.initializationOptions);
> +
>if (Params.rootUri && *Params.rootUri)
>  Server.setRootPath(Params.rootUri->file());
>else if (Params.rootPath && !Params.rootPath->empty())
> @@ -398,11 +401,8 @@ void ClangdLSPServer::onHover(TextDocume
> });
>  }
>
> -// FIXME: This function needs to be properly tested.
> -void ClangdLSPServer::onChangeConfiguration(
> -DidChangeConfigurationParams &Params) {
> -  ClangdConfigurationParamsChange &Settings = Params.settings;
> -
> +void ClangdLSPServer::applyConfiguration(
> +const ClangdConfigurationParamsChange &Settings) {
>// Compilation database change.
>if (Settings.compilationDatabasePath.hasValue()) {
>  NonCachedCDB.setCompileCommandsDir(
> @@ -413,6 +413,12 @@ void ClangdLSPServer::onChangeConfigurat
>}
>  }
>
> +// FIXME: This function needs to be properly tested.
> +void ClangdLSPServer::onChangeConfiguration(
> +DidChangeConfigurationParams &Params) {
> +  applyConfiguration(Params.settings);
> +}
> +
>  ClangdLSPServer::ClangdLSPServer(JSONOutput &Out,
>   const clangd::CodeCompleteOptions
> &CCOpts,
>   llvm::Optional CompileCommandsDir,
>
> Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.h
> URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/
> trunk/clangd/ClangdLSPServer.h?rev=338518&r1=338517&r2=338518&view=diff
> 
> ==
> --- clang-tools-extra/trunk/clangd/ClangdLSPServer.h (original)
> +++ clang-tools-extra/trunk/clangd/ClangdLSPServer.h Wed Aug  1 04:28:49
> 2018
> @@ -82,6 +82,7 @@ private:
>/// may be very expensive.  This method is normally called when the
>/// compilation database is changed.
>void reparseOpenedFiles();
> +  void applyConfiguration(const ClangdConfigurationParamsChange
> &Settings);
>
>JSONOutput &Out;
>/// Used to indicate that the 'shutdown' request was received from the
>
> Modified: clang-tools-extra/trunk/clangd/Protocol.cpp
> URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/
> trunk/clangd/Protocol.cpp?rev=338518&r1=338517&r2=338518&view=diff
> 
> ==
> --- clang-tools-extra/trunk/clangd/Protocol.cpp (original)
> +++ clang-tools-extra/trunk/clangd/Protocol.cpp Wed Aug  1 04:28:49 2018
> @@ -263,7 +263,7 @@ bool fromJSON(const json::Value &Params,
>O.map("rootPath", R.rootPath);
>O.map("capabilities", R.capabilities);
>O.map("trace", R.trace);
> -  // initializationOptions, capabilities unused
> +  O.map("initializationOptions", R.initializationOptions);
>return true;
>  }
>
>
> Modified: clang-tools-extra/trunk/clangd/Protocol.h
> URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/
> trunk/clangd/Protocol.h?rev=338518&r1=338517&r2=338518&view=diff
> 
> ==
> --- clang-tools-extra/trunk/clangd/Protocol.h (original)
> +++ clang-tools-extra/trunk/clangd/Protocol.h Wed Aug  1 04:28:49 2018
> @@ -322,6 +322,16 @@ struct ClientCapa

Re: r338489 - [AST] CastExpr: BasePathSize is not large enough.

2018-08-01 Thread Richard Smith via cfe-commits
On Tue, 31 Jul 2018, 23:06 Roman Lebedev via cfe-commits, <
cfe-commits@lists.llvm.org> wrote:

> Author: lebedevri
> Date: Tue Jul 31 23:06:16 2018
> New Revision: 338489
>
> URL: http://llvm.org/viewvc/llvm-project?rev=338489&view=rev
> Log:
> [AST] CastExpr: BasePathSize is not large enough.
>
> Summary:
> rC337815 / D49508 had to cannibalize one bit of
> `CastExprBitfields::BasePathSize` in order to squeeze `PartOfExplicitCast`
> boolean.
> That reduced the maximal value of `PartOfExplicitCast` from 9 bits (~512)
> down to 8 bits (~256).
> Apparently, that mattered. Too bad there weren't any tests.
> It caused [[ https://bugs.llvm.org/show_bug.cgi?id=38356 | PR38356 ]].
>
> So we need to increase `PartOfExplicitCast` back at least to 9 bits, or a
> bit more.
> For obvious reasons, we can't do that in `CastExprBitfields` - that would
> blow up the size of every `Expr`.
> So we need to either just add a variable into the `CastExpr` (as done
> here),
> or use `llvm::TrailingObjects`. The latter does not seem to be
> straight-forward.
> Perhaps, that needs to be done not for the `CastExpr` itself, but for all
> of it's `final` children.
>
> Reviewers: rjmccall, rsmith, erichkeane
>
> Reviewed By: rjmccall
>
> Subscribers: bricci, hans, cfe-commits, waddlesplash
>
> Differential Revision: https://reviews.llvm.org/D50050
>
> Added:
> cfe/trunk/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp
> Modified:
> cfe/trunk/include/clang/AST/Expr.h
> cfe/trunk/include/clang/AST/ExprCXX.h
> cfe/trunk/include/clang/AST/ExprObjC.h
> cfe/trunk/include/clang/AST/Stmt.h
> cfe/trunk/lib/AST/Expr.cpp
> cfe/trunk/lib/AST/ExprCXX.cpp
>
> Modified: cfe/trunk/include/clang/AST/Expr.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=338489&r1=338488&r2=338489&view=diff
>
> ==
> --- cfe/trunk/include/clang/AST/Expr.h (original)
> +++ cfe/trunk/include/clang/AST/Expr.h Tue Jul 31 23:06:16 2018
> @@ -2787,20 +2787,26 @@ public:
>  /// representation in the source code (ExplicitCastExpr's derived
>  /// classes).
>  class CastExpr : public Expr {
> +public:
> +  using BasePathSizeTy = unsigned int;
> +  static_assert(std::numeric_limits::max() >= 16384,
> +"[implimits] Direct and indirect base classes [16384].");
> +
>  private:
>Stmt *Op;
>
>bool CastConsistency() const;
>
> +  BasePathSizeTy *BasePathSize();
> +
>const CXXBaseSpecifier * const *path_buffer() const {
>  return const_cast(this)->path_buffer();
>}
>CXXBaseSpecifier **path_buffer();
>
> -  void setBasePathSize(unsigned basePathSize) {
> -CastExprBits.BasePathSize = basePathSize;
> -assert(CastExprBits.BasePathSize == basePathSize &&
> -   "basePathSize doesn't fit in bits of
> CastExprBits.BasePathSize!");
> +  void setBasePathSize(BasePathSizeTy basePathSize) {
> +assert(!path_empty() && basePathSize != 0);
> +*(BasePathSize()) = basePathSize;
>}
>
>  protected:
> @@ -2823,7 +2829,9 @@ protected:
>  Op(op) {
>  CastExprBits.Kind = kind;
>  CastExprBits.PartOfExplicitCast = false;
> -setBasePathSize(BasePathSize);
> +CastExprBits.BasePathIsEmpty = BasePathSize == 0;
> +if (!path_empty())
> +  setBasePathSize(BasePathSize);
>  assert(CastConsistency());
>}
>
> @@ -2831,7 +2839,9 @@ protected:
>CastExpr(StmtClass SC, EmptyShell Empty, unsigned BasePathSize)
>  : Expr(SC, Empty) {
>  CastExprBits.PartOfExplicitCast = false;
> -setBasePathSize(BasePathSize);
> +CastExprBits.BasePathIsEmpty = BasePathSize == 0;
> +if (!path_empty())
> +  setBasePathSize(BasePathSize);
>}
>
>  public:
> @@ -2859,8 +2869,12 @@ public:
>
>typedef CXXBaseSpecifier **path_iterator;
>typedef const CXXBaseSpecifier * const *path_const_iterator;
> -  bool path_empty() const { return CastExprBits.BasePathSize == 0; }
> -  unsigned path_size() const { return CastExprBits.BasePathSize; }
> +  bool path_empty() const { return CastExprBits.BasePathIsEmpty; }
> +  unsigned path_size() const {
> +if (path_empty())
> +  return 0U;
> +return *(const_cast(this)->BasePathSize());
> +  }
>path_iterator path_begin() { return path_buffer(); }
>path_iterator path_end() { return path_buffer() + path_size(); }
>path_const_iterator path_begin() const { return path_buffer(); }
> @@ -2908,7 +2922,12 @@ public:
>  /// @endcode
>  class ImplicitCastExpr final
>  : public CastExpr,
> -  private llvm::TrailingObjects
> {
> +  private llvm::TrailingObjects CastExpr::BasePathSizeTy,
> +CXXBaseSpecifier *> {
> +  size_t numTrailingObjects(OverloadToken)
> const {
> +return path_empty() ? 0 : 1;
> +  }
> +
>  private:
>ImplicitCastExpr(QualType ty, CastKind kind, Expr *op,
> unsigned BasePathLength, ExprValueKind VK)
> @@ -3013,7 +3032,8 @@ pu

  1   2   >