Re: [PATCH] D24179: [include-fixer] Fix some Clang-tidy modernize-use-override and Include What You Use warnings; other minor fixes

2016-09-02 Thread Haojian Wu via cfe-commits
hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks!


Repository:
  rL LLVM

https://reviews.llvm.org/D24179



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


Re: [PATCH] D24155: clang-format: [JS] merge requoting replacements.

2016-09-02 Thread Daniel Jasper via cfe-commits
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

Basically looks good.



Comment at: lib/Format/Format.cpp:806
@@ -805,2 +805,3 @@
   FormatTokenLexer &Tokens, tooling::Replacements &Result) override {
+tooling::Replacements RunResult;
 deriveLocalStyle(AnnotatedLines);

Call this "RequoteChanges".


Comment at: lib/Format/Format.cpp:831
@@ -830,1 +830,3 @@
+RunResult = RunResult.merge(Whitespaces.generateReplacements());
+return RunResult;
   }

Just

  return RequoteChanges.merge(Whitespaces.generateReplacements());


https://reviews.llvm.org/D24155



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


Re: [PATCH] D24178: [clang-rename] Fix some Clang-tidy modernize-use-override and Include What You Use warnings; other minor fixes

2016-09-02 Thread Kirill Bobyrev via cfe-commits
omtcyfz accepted this revision.
omtcyfz added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rL LLVM

https://reviews.llvm.org/D24178



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


Re: [PATCH] D24040: codechecker tool core

2016-09-02 Thread Gyorgy Orban via cfe-commits
o.gyorgy added a comment.

In https://reviews.llvm.org/D24040#530293, @rizsotto.mailinglist wrote:

> Gyorgy and the ericsson team, thanks for doing this. very good job! good 
> targeted functionality. i don't want to underestimate the complexity it 
> requires, but to me this is a giant code. i do miss the explanation of the 
> overall functional description what a module does and how it relates to other 
> modules. i found a gap between the high level overview and the code comments.


Would that help If update architecture.md documentation (which gives a high 
level overview) to be more in sync with the source code, with additional 
comments and descriptions in the modules?

> generally speaking i found this code under documented and a bit verbose. the 
> comments in the code is not really paint the picture that i need in order to 
> fix a bug, or implement a feature. and it might only be my personal taste, 
> but found that creating types (or classes this case) in a dynamically typed 
> script language, it makes the code very verbose while it does not implement 
> much.


We use classes to handle and setup environment, build, analyzer and other 
configurations. In the infrastructure this makes available to easily introduce 
new analyzers and handle the output of them. Multiple output handling is 
supported for each analyzer (print to stdout, store to database).

> was commented only on two random modules, but found the same patterns in many 
> other ones.

>  found that this code is not `pep8` conform. `pylint` found a lot of errors 
> and warnings, and a couple of duplicate codes.

>  i hope we can fix these findings and that would make this code more solid 
> and understood by others.


I will address these issues and update our code.

Thanks for the feedback.


https://reviews.llvm.org/D24040



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


Re: [PATCH] D24040: codechecker tool core

2016-09-02 Thread Gyorgy Orban via cfe-commits
o.gyorgy added a comment.

In https://reviews.llvm.org/D24040#530546, @mehdi_amini wrote:

> > This looks like a fairly large tool. Should it get its own "subproject 
> > level" directory in the SVN instead of being nested within clang?
>
>
> I'd add that the clang-tools-extra are more closely tied to clang than what 
> this seems to be. Is there a strong rev-lock with clang that I missed?


I've put it here because it is similar to scan-build/scan-build-py and on OSX 
it uses the intercept-build from scan-build-py. Right now there is an 
alternative logger on linux (not in this patch) but we plan to move to use only 
the intercept-build.
We process the output generated by clang and clang-tidy and we use the command 
line options for these tools which could change with newer revisions, in that 
case this tool needs to be updated too.

I will update the readme too.


https://reviews.llvm.org/D24040



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


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

2016-09-02 Thread Anton Korobeynikov via cfe-commits
asl added a comment.

I totally agree with Renato. What part of libc++abi requires exactly 
libunwind's unwind.h, what is the dependency?


https://reviews.llvm.org/D24084



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


Re: [PATCH] D24165: [clang-offload-bundler] Fix some Clang-tidy modernize-use-override and Include What You Use warnings; other minor fixes

2016-09-02 Thread Samuel Antao via cfe-commits
sfantao added a comment.

Hi Eugene,

The patch looks good to me. You may wait for someone that could okay the patch 
to take a look too.

Thanks,
Samuel


Repository:
  rL LLVM

https://reviews.llvm.org/D24165



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


Re: [PATCH] D24163: [scan-build-py] Increase precision of timestamp in report directory name

2016-09-02 Thread Laszlo Nagy via cfe-commits
rizsotto.mailinglist added a comment.

looks good to me. i like the test. :) but would keep the `pep8` cleanness.



Comment at: tools/scan-build-py/libscanbuild/report.py:38
@@ -36,3 +37,3 @@
 
-stamp = time.strftime('scan-build-%Y-%m-%d-%H%M%S-', time.localtime())
+stamp = 
datetime.datetime.now().strftime('scan-build-%Y-%m-%d-%H-%M-%S-%f-')
 

this line length's is 80, which breaks the `pep8` check. (would kill some of 
the `-`)


https://reviews.llvm.org/D24163



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


Re: [PATCH] D24165: [clang-offload-bundler] Fix some Clang-tidy modernize-use-override and Include What You Use warnings; other minor fixes

2016-09-02 Thread Samuel Antao via cfe-commits
sfantao added a comment.

Hi Eugene,

The patch looks good to me. You may wait for someone that could okay the patch 
to take a look too.

Thanks,
Samuel


Repository:
  rL LLVM

https://reviews.llvm.org/D24165



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


Re: [PATCH] D23651: [clang-rename] improve performance for rename-all

2016-09-02 Thread Kirill Bobyrev via cfe-commits
omtcyfz added a comment.

In https://reviews.llvm.org/D23651#531884, @vmiklos wrote:

> Kirill, are you waiting for me on this one? AFAICS the patch in its current 
> form applies on top of current trunk, but no longer builds.


Miklos, it is a bit more complicated :)

Bascially, I have another patch kind of complete, which is built on top of this 
patch, which kind of makes this one outdated. Pushing this will make things a 
bit more complicated. I'll write about it soon enough.


https://reviews.llvm.org/D23651



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


Re: [PATCH] D24040: codechecker tool core

2016-09-02 Thread Laszlo Nagy via cfe-commits
rizsotto.mailinglist added a comment.

In https://reviews.llvm.org/D24040#532718, @o.gyorgy wrote:

> In https://reviews.llvm.org/D24040#530293, @rizsotto.mailinglist wrote:
>
> > Gyorgy and the ericsson team, thanks for doing this. very good job! good 
> > targeted functionality. i don't want to underestimate the complexity it 
> > requires, but to me this is a giant code. i do miss the explanation of the 
> > overall functional description what a module does and how it relates to 
> > other modules. i found a gap between the high level overview and the code 
> > comments.
>
>
> Would that help If update architecture.md documentation (which gives a high 
> level overview) to be more in sync with the source code, with additional 
> comments and descriptions in the modules?


i prefer python docstrings instead of the markdown files. found that the 
`__init__.py` files are empty. those are good candidates for a higher overview 
of the package architecture. now module headers are one liners most of the 
places, which is a missed opportunity to document the connections between the 
modules. method docstrings are non descriptive enough. (echoing back the 
function names with spaces.) would read about the usage of the method, contract 
between the caller and the callee, or the implementation difficulties.

> > generally speaking i found this code under documented and a bit verbose. 
> > the comments in the code is not really paint the picture that i need in 
> > order to fix a bug, or implement a feature. and it might only be my 
> > personal taste, but found that creating types (or classes this case) in a 
> > dynamically typed script language, it makes the code very verbose while it 
> > does not implement much.

> 

> 

> We use classes to handle and setup environment, build, analyzer and other 
> configurations. In the infrastructure this makes available to easily 
> introduce new analyzers and handle the output of them. Multiple output 
> handling is supported for each analyzer (print to stdout, store to database).


yes, i got that you were using OO. and try to re-use code this way... my point 
is, this abstraction, in this language, ends up to have an abstract class with 
empty methods, a couple of implementations and the user of the abstract class, 
which enjoys the polymorphism. to understand a single implementation i have to 
read (at least) three different modules/files. it's very fragmented to me... my 
proposal would be, to write util methods. implement the different analyzer 
commands as a combination of the util methods. this abstraction fits better to 
a script language. it also make your code more dense, less verbose, easier to 
maintain, test or reason about... those was my two cents.


https://reviews.llvm.org/D24040



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


Re: [PATCH] D24159: Fix PR30202 - notify_all_at_thread_exit seg faults if run from a raw pthread context.

2016-09-02 Thread Ben Craig via cfe-commits
bcraig added inline comments.


Comment at: src/condition_variable.cpp:86
@@ +85,3 @@
+if (tl_ptr.get() == nullptr) {
+tl_ptr.set_pointer(new __thread_struct);
+}

The standard synopsis of notify_all_at_thread_exit in the standard doesn't have 
a "Throws:" clause.  I think that means that this is non-conformant.

There is some phrasing in 30.2.2 [thread.req.exception]:
   Failure to allocate storage shall be reported as described in 17.6.5.12 
[res.on.exception.handling].
But I don't see wording in that section that gives permission to throw from 
functions without Throws clauses.

From a user perspective, I generally expect my synchronization primitives to be 
no-throw.  I don't know if it is really possible to provide that guarantee with 
notify_all_at_thread_exit though, especially if we want it to work outside of a 
std::thread.


https://reviews.llvm.org/D24159



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


Re: [PATCH] D23973: clang-format: [JS] handle default bindings in imports.

2016-09-02 Thread Martin Probst via cfe-commits
mprobst added a comment.

Friendly ping.


https://reviews.llvm.org/D23973



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


Re: [PATCH] D23972: clang-format: [JS] Sort all JavaScript imports if any changed.

2016-09-02 Thread Martin Probst via cfe-commits
mprobst added a comment.

Friendly ping.


https://reviews.llvm.org/D23972



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


Re: [PATCH] D23972: clang-format: [JS] Sort all JavaScript imports if any changed.

2016-09-02 Thread Daniel Jasper via cfe-commits
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

Looks good.


https://reviews.llvm.org/D23972



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


Re: [PATCH] D23973: clang-format: [JS] handle default bindings in imports.

2016-09-02 Thread Daniel Jasper via cfe-commits
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

It would be helpful to have a before/after to review these patches.


https://reviews.llvm.org/D23973



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


Re: [PATCH] D24183: A clang tool for changing surrouding namespaces of class/function definitions.

2016-09-02 Thread Eric Liu via cfe-commits
ioeric updated this revision to Diff 70155.
ioeric added a comment.

- Minor cleanup.


https://reviews.llvm.org/D24183

Files:
  CMakeLists.txt
  change-namespace/CMakeLists.txt
  change-namespace/ChangeNamespace.cpp
  change-namespace/ChangeNamespace.h
  change-namespace/tool/CMakeLists.txt
  change-namespace/tool/ClangChangeNamespace.cpp
  clang-rename/tool/clang-rename.py
  test/CMakeLists.txt
  test/change-namespace/simple-move.cpp
  unittests/CMakeLists.txt
  unittests/change-namespace/CMakeLists.txt
  unittests/change-namespace/ChangeNamespaceTests.cpp

Index: unittests/change-namespace/ChangeNamespaceTests.cpp
===
--- /dev/null
+++ unittests/change-namespace/ChangeNamespaceTests.cpp
@@ -0,0 +1,234 @@
+//===-- ChangeNamespaceTests.cpp - Change namespace unit tests ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "ChangeNamespace.h"
+#include "unittests/Tooling/RewriterTestContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Basic/FileManager.h"
+#include "clang/Basic/FileSystemOptions.h"
+#include "clang/Basic/VirtualFileSystem.h"
+#include "clang/Format/Format.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Frontend/PCHContainerOperations.h"
+#include "clang/Tooling/Refactoring.h"
+#include "clang/Tooling/Tooling.h"
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include "gtest/gtest.h"
+#include 
+#include 
+#include 
+
+namespace clang {
+namespace change_namespace {
+namespace {
+
+class ChangeNamespaceTest : public ::testing::Test {
+public:
+  std::string runChangeNamespaceOnCode(llvm::StringRef Code) {
+clang::RewriterTestContext Context;
+clang::FileID ID = Context.createInMemoryFile(FileName, Code);
+
+std::map FileToReplacements;
+change_namespace::ChangeNamespaceTool NamespaceTool(
+OldNamespace, NewNamespace, FilePattern, &FileToReplacements);
+ast_matchers::MatchFinder Finder;
+NamespaceTool.registerMatchers(&Finder);
+std::unique_ptr Factory =
+tooling::newFrontendActionFactory(&Finder);
+tooling::runToolOnCodeWithArgs(Factory->create(), Code, {"-std=c++11"},
+   FileName);
+formatAndApplyAllReplacements(FileToReplacements, Context.Rewrite);
+return format(Context.getRewrittenText(ID));
+  }
+
+  std::string format(llvm::StringRef Code) {
+tooling::Replacements Replaces = format::reformat(
+format::getLLVMStyle(), Code, {tooling::Range(0, Code.size())});
+auto ChangedCode = tooling::applyAllReplacements(Code, Replaces);
+EXPECT_TRUE(static_cast(ChangedCode));
+if (!ChangedCode) {
+  llvm::errs() << llvm::toString(ChangedCode.takeError());
+  return "";
+}
+return *ChangedCode;
+  }
+
+protected:
+  std::string FileName = "input.cc";
+  std::string OldNamespace = "na::nb";
+  std::string NewNamespace = "x::y";
+  std::string FilePattern = "input.cc";
+};
+
+TEST_F(ChangeNamespaceTest, NoMatchingNamespace) {
+  std::string Code = "namespace na {\n"
+ "namespace nx {\n"
+ "class A {};\n"
+ "} // namespace nx\n"
+ "} // namespace na\n";
+  std::string Expected = "namespace na {\n"
+ "namespace nx {\n"
+ "class A {};\n"
+ "} // namespace nx\n"
+ "} // namespace na\n";
+  EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
+}
+
+TEST_F(ChangeNamespaceTest, SimpleMoveWithoutTypeRefs) {
+  std::string Code = "namespace na {\n"
+ "namespace nb {\n"
+ "class A {};\n"
+ "} // namespace nb\n"
+ "} // namespace na\n";
+  std::string Expected = "\n\n"
+ "namespace x {\n"
+ "namespace y {\n"
+ "class A {};\n"
+ "} // namespace y\n"
+ "} // namespace x\n";
+  EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
+}
+
+TEST_F(ChangeNamespaceTest, SimpleMoveIntoAnotherNestedNamespace) {
+  NewNamespace = "na::nc";
+  std::string Code = "namespace na {\n"
+ "namespace nb {\n"
+ "class A {};\n"
+ "} // namespace nb\n"
+ "} // namespace na\n";
+  std::string Expected = "namespace na {\n"
+ "\n"
+ "namespace nc {\n"
+ "class A {};\n"
+ "} // namespace nc\n"
+ "} // namespace na\n";
+  EX

r280483 - Allow a C11 generic selection expression to select a function with the overloadable attribute as the result expression without crashing. This fixes PR30201.

2016-09-02 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Fri Sep  2 08:45:40 2016
New Revision: 280483

URL: http://llvm.org/viewvc/llvm-project?rev=280483&view=rev
Log:
Allow a C11 generic selection expression to select a function with the 
overloadable attribute as the result expression without crashing. This fixes 
PR30201.

Modified:
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/Sema/generic-selection.c

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=280483&r1=280482&r2=280483&view=diff
==
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Fri Sep  2 08:45:40 2016
@@ -4447,11 +4447,19 @@ public:
 return cast(SubExprs[END_EXPR+i]);
   }
   Expr *getAssocExpr(unsigned i) { return cast(SubExprs[END_EXPR+i]); }
-
+  ArrayRef getAssocExprs() const {
+return NumAssocs
+   ? llvm::makeArrayRef(
+ &reinterpret_cast(SubExprs)[END_EXPR], NumAssocs)
+   : None;
+  }
   const TypeSourceInfo *getAssocTypeSourceInfo(unsigned i) const {
 return AssocTypes[i];
   }
   TypeSourceInfo *getAssocTypeSourceInfo(unsigned i) { return AssocTypes[i]; }
+  ArrayRef getAssocTypeSourceInfos() const {
+return NumAssocs ? llvm::makeArrayRef(&AssocTypes[0], NumAssocs) : None;
+  }
 
   QualType getAssocType(unsigned i) const {
 if (const TypeSourceInfo *TS = getAssocTypeSourceInfo(i))

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=280483&r1=280482&r2=280483&view=diff
==
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Sep  2 08:45:40 2016
@@ -12984,6 +12984,31 @@ Expr *Sema::FixOverloadedFunctionReferen
 ICE->getValueKind());
   }
 
+  if (auto *GSE = dyn_cast(E)) {
+if (!GSE->isResultDependent()) {
+  Expr *SubExpr =
+  FixOverloadedFunctionReference(GSE->getResultExpr(), Found, Fn);
+  if (SubExpr == GSE->getResultExpr())
+return GSE;
+
+  // Replace the resulting type information before rebuilding the generic
+  // selection expression.
+  SmallVector AssocExprs(GSE->getAssocExprs().begin(),
+GSE->getAssocExprs().end());
+  unsigned ResultIdx = GSE->getResultIndex();
+  AssocExprs[ResultIdx] = SubExpr;
+
+  return new (Context) GenericSelectionExpr(
+  Context, GSE->getGenericLoc(), GSE->getControllingExpr(),
+  GSE->getAssocTypeSourceInfos(), AssocExprs, GSE->getDefaultLoc(),
+  GSE->getRParenLoc(), GSE->containsUnexpandedParameterPack(),
+  ResultIdx);
+}
+// Rather than fall through to the unreachable, return the original generic
+// selection expression.
+return GSE;
+  }
+
   if (UnaryOperator *UnOp = dyn_cast(E)) {
 assert(UnOp->getOpcode() == UO_AddrOf &&
"Can only take the address of an overloaded function");

Modified: cfe/trunk/test/Sema/generic-selection.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/generic-selection.c?rev=280483&r1=280482&r2=280483&view=diff
==
--- cfe/trunk/test/Sema/generic-selection.c (original)
+++ cfe/trunk/test/Sema/generic-selection.c Fri Sep  2 08:45:40 2016
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c1x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c11 -fsyntax-only -verify %s
 
 void g(void);
 
@@ -36,3 +36,11 @@ void foo(int n) {
   // expression is not evaluated.
   (void)_Generic(*(int *)0, int: 1);
 }
+
+int __attribute__((overloadable)) test (int);
+double __attribute__((overloadable)) test (double);
+char testc(char);
+
+void PR30201(void) {
+  _Generic(4, char:testc, default:test)(4);
+}


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


Re: [PATCH] D24152: Support the overloadable attribute with _Generic expressions

2016-09-02 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

Richard accepted, so claiming this as accepted so I can close it.


https://reviews.llvm.org/D24152



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


Re: [PATCH] D24152: Support the overloadable attribute with _Generic expressions

2016-09-02 Thread Aaron Ballman via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

Commit in r280483.


https://reviews.llvm.org/D24152



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


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

2016-09-02 Thread Logan Chien via cfe-commits
logan added a comment.

In https://reviews.llvm.org/D24084#532724, @asl wrote:

> I totally agree with Renato. What part of libc++abi requires exactly 
> libunwind's unwind.h, what is the dependency?


To be specific, we need:

- Structure Definition: `_Unwind_Control_Block` (missing from `` 
bundled with clang)
- Function Declarations: `_Unwind_GetLanguageSpecificData()`, 
`_Unwind_GetRegionStart()`,  `_Unwind_{Get,Set}{IP,GR}()`, 
`_Unwind_{Get,Set}_VRS()`, `_Unwind_RaiseException()`

This is the status quo after `libunwind` was spun off (or splitted) last year.


https://reviews.llvm.org/D24084



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


[libcxxabi] r280484 - [lit] Replace print with lit_config.note().

2016-09-02 Thread Logan Chien via cfe-commits
Author: logan
Date: Fri Sep  2 08:56:05 2016
New Revision: 280484

URL: http://llvm.org/viewvc/llvm-project?rev=280484&view=rev
Log:
[lit] Replace print with lit_config.note().

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

Modified:
libcxxabi/trunk/test/lit.cfg

Modified: libcxxabi/trunk/test/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/lit.cfg?rev=280484&r1=280483&r2=280484&view=diff
==
--- libcxxabi/trunk/test/lit.cfg (original)
+++ libcxxabi/trunk/test/lit.cfg Fri Sep  2 08:56:05 2016
@@ -55,7 +55,7 @@ config.test_exec_root = os.path.join(obj
 
 cfg_variant = getattr(config, 'configuration_variant', 'libcxxabi')
 if cfg_variant:
-print 'Using configuration variant: %s' % cfg_variant
+lit_config.note('Using configuration variant: %s' % cfg_variant)
 
 # Load the Configuration class from the module name .test.config.
 config_module_name = '.'.join([cfg_variant, 'test', 'config'])


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


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

2016-09-02 Thread Logan Chien via cfe-commits
logan added a comment.

Thanks.  Committed as https://reviews.llvm.org/rL280484.


https://reviews.llvm.org/D24080



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


r280485 - clang-format: [JS] Sort all JavaScript imports if any changed.

2016-09-02 Thread Martin Probst via cfe-commits
Author: mprobst
Date: Fri Sep  2 09:01:17 2016
New Revision: 280485

URL: http://llvm.org/viewvc/llvm-project?rev=280485&view=rev
Log:
clang-format: [JS] Sort all JavaScript imports if any changed.

Summary:
User feedback is that they expect *all* imports to be sorted if any import was
affected by a change, not just imports up to the first non-affected line, as
clang-format currently does.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

Modified:
cfe/trunk/lib/Format/SortJavaScriptImports.cpp
cfe/trunk/unittests/Format/SortImportsTestJS.cpp

Modified: cfe/trunk/lib/Format/SortJavaScriptImports.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/SortJavaScriptImports.cpp?rev=280485&r1=280484&r2=280485&view=diff
==
--- cfe/trunk/lib/Format/SortJavaScriptImports.cpp (original)
+++ cfe/trunk/lib/Format/SortJavaScriptImports.cpp Fri Sep  2 09:01:17 2016
@@ -284,14 +284,8 @@ private:
 SourceLocation Start;
 bool FoundLines = false;
 AnnotatedLine *FirstNonImportLine = nullptr;
+bool AnyImportAffected = false;
 for (auto Line : AnnotatedLines) {
-  if (!Line->Affected) {
-// Only sort the first contiguous block of affected lines.
-if (FoundLines)
-  break;
-else
-  continue;
-  }
   Current = Line->First;
   LineEnd = Line->Last;
   skipComments();
@@ -309,6 +303,7 @@ private:
 FirstNonImportLine = Line;
 break;
   }
+  AnyImportAffected = AnyImportAffected || Line->Affected;
   Reference.Range.setEnd(LineEnd->Tok.getEndLoc());
   DEBUG({
 llvm::dbgs() << "JsModuleReference: {"
@@ -325,6 +320,9 @@ private:
   References.push_back(Reference);
   Start = SourceLocation();
 }
+// Sort imports if any import line was affected.
+if (!AnyImportAffected)
+  References.clear();
 return std::make_pair(References, FirstNonImportLine);
   }
 

Modified: cfe/trunk/unittests/Format/SortImportsTestJS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/SortImportsTestJS.cpp?rev=280485&r1=280484&r2=280485&view=diff
==
--- cfe/trunk/unittests/Format/SortImportsTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/SortImportsTestJS.cpp Fri Sep  2 09:01:17 2016
@@ -190,40 +190,29 @@ TEST_F(SortImportsTestJS, SideEffectImpo
 }
 
 TEST_F(SortImportsTestJS, AffectedRange) {
-  // Sort excluding a suffix.
-  verifySort("import {sym} from 'b';\n"
+  // Affected range inside of import statements.
+  verifySort("import {sym} from 'a';\n"
+ "import {sym} from 'b';\n"
  "import {sym} from 'c';\n"
- "import {sym} from 'a';\n"
+ "\n"
  "let x = 1;",
  "import {sym} from 'c';\n"
  "import {sym} from 'b';\n"
  "import {sym} from 'a';\n"
  "let x = 1;",
  0, 30);
-  // Sort excluding a prefix.
+  // Affected range outside of import statements.
   verifySort("import {sym} from 'c';\n"
- "import {sym} from 'a';\n"
- "import {sym} from 'b';\n"
- "\n"
- "let x = 1;",
- "import {sym} from 'c';\n"
  "import {sym} from 'b';\n"
  "import {sym} from 'a';\n"
  "\n"
  "let x = 1;",
- 30, 0);
-  // Sort a range within imports.
-  verifySort("import {sym} from 'c';\n"
- "import {sym} from 'a';\n"
- "import {sym} from 'b';\n"
- "import {sym} from 'c';\n"
- "let x = 1;",
  "import {sym} from 'c';\n"
  "import {sym} from 'b';\n"
  "import {sym} from 'a';\n"
- "import {sym} from 'c';\n"
+ "\n"
  "let x = 1;",
- 24, 30);
+ 70, 1);
 }
 
 TEST_F(SortImportsTestJS, SortingCanShrink) {


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


Re: [PATCH] D23972: clang-format: [JS] Sort all JavaScript imports if any changed.

2016-09-02 Thread Martin Probst via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL280485: clang-format: [JS] Sort all JavaScript imports if 
any changed. (authored by mprobst).

Changed prior to commit:
  https://reviews.llvm.org/D23972?vs=69511&id=70158#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23972

Files:
  cfe/trunk/lib/Format/SortJavaScriptImports.cpp
  cfe/trunk/unittests/Format/SortImportsTestJS.cpp

Index: cfe/trunk/lib/Format/SortJavaScriptImports.cpp
===
--- cfe/trunk/lib/Format/SortJavaScriptImports.cpp
+++ cfe/trunk/lib/Format/SortJavaScriptImports.cpp
@@ -284,14 +284,8 @@
 SourceLocation Start;
 bool FoundLines = false;
 AnnotatedLine *FirstNonImportLine = nullptr;
+bool AnyImportAffected = false;
 for (auto Line : AnnotatedLines) {
-  if (!Line->Affected) {
-// Only sort the first contiguous block of affected lines.
-if (FoundLines)
-  break;
-else
-  continue;
-  }
   Current = Line->First;
   LineEnd = Line->Last;
   skipComments();
@@ -309,6 +303,7 @@
 FirstNonImportLine = Line;
 break;
   }
+  AnyImportAffected = AnyImportAffected || Line->Affected;
   Reference.Range.setEnd(LineEnd->Tok.getEndLoc());
   DEBUG({
 llvm::dbgs() << "JsModuleReference: {"
@@ -325,6 +320,9 @@
   References.push_back(Reference);
   Start = SourceLocation();
 }
+// Sort imports if any import line was affected.
+if (!AnyImportAffected)
+  References.clear();
 return std::make_pair(References, FirstNonImportLine);
   }
 
Index: cfe/trunk/unittests/Format/SortImportsTestJS.cpp
===
--- cfe/trunk/unittests/Format/SortImportsTestJS.cpp
+++ cfe/trunk/unittests/Format/SortImportsTestJS.cpp
@@ -190,40 +190,29 @@
 }
 
 TEST_F(SortImportsTestJS, AffectedRange) {
-  // Sort excluding a suffix.
-  verifySort("import {sym} from 'b';\n"
+  // Affected range inside of import statements.
+  verifySort("import {sym} from 'a';\n"
+ "import {sym} from 'b';\n"
  "import {sym} from 'c';\n"
- "import {sym} from 'a';\n"
+ "\n"
  "let x = 1;",
  "import {sym} from 'c';\n"
  "import {sym} from 'b';\n"
  "import {sym} from 'a';\n"
  "let x = 1;",
  0, 30);
-  // Sort excluding a prefix.
+  // Affected range outside of import statements.
   verifySort("import {sym} from 'c';\n"
- "import {sym} from 'a';\n"
- "import {sym} from 'b';\n"
- "\n"
- "let x = 1;",
- "import {sym} from 'c';\n"
  "import {sym} from 'b';\n"
  "import {sym} from 'a';\n"
  "\n"
  "let x = 1;",
- 30, 0);
-  // Sort a range within imports.
-  verifySort("import {sym} from 'c';\n"
- "import {sym} from 'a';\n"
- "import {sym} from 'b';\n"
- "import {sym} from 'c';\n"
- "let x = 1;",
  "import {sym} from 'c';\n"
  "import {sym} from 'b';\n"
  "import {sym} from 'a';\n"
- "import {sym} from 'c';\n"
+ "\n"
  "let x = 1;",
- 24, 30);
+ 70, 1);
 }
 
 TEST_F(SortImportsTestJS, SortingCanShrink) {


Index: cfe/trunk/lib/Format/SortJavaScriptImports.cpp
===
--- cfe/trunk/lib/Format/SortJavaScriptImports.cpp
+++ cfe/trunk/lib/Format/SortJavaScriptImports.cpp
@@ -284,14 +284,8 @@
 SourceLocation Start;
 bool FoundLines = false;
 AnnotatedLine *FirstNonImportLine = nullptr;
+bool AnyImportAffected = false;
 for (auto Line : AnnotatedLines) {
-  if (!Line->Affected) {
-// Only sort the first contiguous block of affected lines.
-if (FoundLines)
-  break;
-else
-  continue;
-  }
   Current = Line->First;
   LineEnd = Line->Last;
   skipComments();
@@ -309,6 +303,7 @@
 FirstNonImportLine = Line;
 break;
   }
+  AnyImportAffected = AnyImportAffected || Line->Affected;
   Reference.Range.setEnd(LineEnd->Tok.getEndLoc());
   DEBUG({
 llvm::dbgs() << "JsModuleReference: {"
@@ -325,6 +320,9 @@
   References.push_back(Reference);
   Start = SourceLocation();
 }
+// Sort imports if any import line was affected.
+if (!AnyImportAffected)
+  References.clear();
 return std::make_pair(References, FirstNonImportLine);
   }
 
Index: cfe/trunk/unittests/Format/SortImportsTestJS.cpp
===
--- cfe/trunk/unittests/Format/SortImportsTestJS.cpp
+++ cfe/trunk/unittests/Format/SortImportsTestJS.cpp
@@ -190,40 +190,29 @@
 }
 
 TEST_F(SortImportsTestJS, AffectedRange) {

Re: [PATCH] D23973: clang-format: [JS] handle default bindings in imports.

2016-09-02 Thread Martin Probst via cfe-commits
mprobst added a comment.

In https://reviews.llvm.org/D23973#532801, @djasper wrote:

> It would be helpful to have a before/after to review these patches.


I assumed the test case was clear enough. Before, we couldn't parse default 
bindings at all, after, we do, and thus sort the imports in the test case.


https://reviews.llvm.org/D23973



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


r280486 - clang-format: [JS] handle default bindings in imports.

2016-09-02 Thread Martin Probst via cfe-commits
Author: mprobst
Date: Fri Sep  2 09:06:32 2016
New Revision: 280486

URL: http://llvm.org/viewvc/llvm-project?rev=280486&view=rev
Log:
clang-format: [JS] handle default bindings in imports.

Summary:
Default imports appear outside of named bindings in curly braces:

  import A from 'a';
  import A, {symbol} from 'a';

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

Modified:
cfe/trunk/lib/Format/SortJavaScriptImports.cpp
cfe/trunk/unittests/Format/SortImportsTestJS.cpp

Modified: cfe/trunk/lib/Format/SortJavaScriptImports.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/SortJavaScriptImports.cpp?rev=280486&r1=280485&r2=280486&view=diff
==
--- cfe/trunk/lib/Format/SortJavaScriptImports.cpp (original)
+++ cfe/trunk/lib/Format/SortJavaScriptImports.cpp Fri Sep  2 09:06:32 2016
@@ -346,7 +346,6 @@ private:
 
 if (!parseModuleBindings(Keywords, Reference))
   return false;
-nextToken();
 
 if (Current->is(Keywords.kw_from)) {
   // imports have a 'from' clause, exports might not.
@@ -389,19 +388,28 @@ private:
 if (Current->isNot(tok::identifier))
   return false;
 Reference.Prefix = Current->TokenText;
+nextToken();
 return true;
   }
 
   bool parseNamedBindings(const AdditionalKeywords &Keywords,
   JsModuleReference &Reference) {
+if (Current->is(tok::identifier)) {
+  nextToken();
+  if (Current->is(Keywords.kw_from))
+return true;
+  if (Current->isNot(tok::comma))
+return false;
+  nextToken(); // eat comma.
+}
 if (Current->isNot(tok::l_brace))
   return false;
 
 // {sym as alias, sym2 as ...} from '...';
-nextToken();
-while (true) {
+while (Current->isNot(tok::r_brace)) {
+  nextToken();
   if (Current->is(tok::r_brace))
-return true;
+break;
   if (Current->isNot(tok::identifier))
 return false;
 
@@ -422,12 +430,11 @@ private:
   Symbol.Range.setEnd(Current->Tok.getLocation());
   Reference.Symbols.push_back(Symbol);
 
-  if (Current->is(tok::r_brace))
-return true;
-  if (Current->isNot(tok::comma))
+  if (!Current->isOneOf(tok::r_brace, tok::comma))
 return false;
-  nextToken();
 }
+nextToken(); // consume r_brace
+return true;
   }
 };
 

Modified: cfe/trunk/unittests/Format/SortImportsTestJS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/SortImportsTestJS.cpp?rev=280486&r1=280485&r2=280486&view=diff
==
--- cfe/trunk/unittests/Format/SortImportsTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/SortImportsTestJS.cpp Fri Sep  2 09:06:32 2016
@@ -70,6 +70,26 @@ TEST_F(SortImportsTestJS, BasicSorting)
  "let x = 1;");
 }
 
+TEST_F(SortImportsTestJS, DefaultBinding) {
+  verifySort("import A from 'a';\n"
+ "import B from 'b';\n"
+ "\n"
+ "let x = 1;",
+ "import B from 'b';\n"
+ "import A from 'a';\n"
+ "let x = 1;");
+}
+
+TEST_F(SortImportsTestJS, DefaultAndNamedBinding) {
+  verifySort("import A, {a} from 'a';\n"
+ "import B, {b} from 'b';\n"
+ "\n"
+ "let x = 1;",
+ "import B, {b} from 'b';\n"
+ "import A, {a} from 'a';\n"
+ "let x = 1;");
+}
+
 TEST_F(SortImportsTestJS, WrappedImportStatements) {
   verifySort("import {sym1, sym2} from 'a';\n"
  "import {sym} from 'b';\n"


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


Re: [PATCH] D24183: A clang tool for changing surrouding namespaces of class/function definitions.

2016-09-02 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

Looks like clang-refactor idea should finally go live.


Repository:
  rL LLVM

https://reviews.llvm.org/D24183



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


Re: [PATCH] D23973: clang-format: [JS] handle default bindings in imports.

2016-09-02 Thread Martin Probst via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL280486: clang-format: [JS] handle default bindings in 
imports. (authored by mprobst).

Changed prior to commit:
  https://reviews.llvm.org/D23973?vs=69514&id=70159#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23973

Files:
  cfe/trunk/lib/Format/SortJavaScriptImports.cpp
  cfe/trunk/unittests/Format/SortImportsTestJS.cpp

Index: cfe/trunk/lib/Format/SortJavaScriptImports.cpp
===
--- cfe/trunk/lib/Format/SortJavaScriptImports.cpp
+++ cfe/trunk/lib/Format/SortJavaScriptImports.cpp
@@ -346,7 +346,6 @@
 
 if (!parseModuleBindings(Keywords, Reference))
   return false;
-nextToken();
 
 if (Current->is(Keywords.kw_from)) {
   // imports have a 'from' clause, exports might not.
@@ -389,19 +388,28 @@
 if (Current->isNot(tok::identifier))
   return false;
 Reference.Prefix = Current->TokenText;
+nextToken();
 return true;
   }
 
   bool parseNamedBindings(const AdditionalKeywords &Keywords,
   JsModuleReference &Reference) {
+if (Current->is(tok::identifier)) {
+  nextToken();
+  if (Current->is(Keywords.kw_from))
+return true;
+  if (Current->isNot(tok::comma))
+return false;
+  nextToken(); // eat comma.
+}
 if (Current->isNot(tok::l_brace))
   return false;
 
 // {sym as alias, sym2 as ...} from '...';
-nextToken();
-while (true) {
+while (Current->isNot(tok::r_brace)) {
+  nextToken();
   if (Current->is(tok::r_brace))
-return true;
+break;
   if (Current->isNot(tok::identifier))
 return false;
 
@@ -422,12 +430,11 @@
   Symbol.Range.setEnd(Current->Tok.getLocation());
   Reference.Symbols.push_back(Symbol);
 
-  if (Current->is(tok::r_brace))
-return true;
-  if (Current->isNot(tok::comma))
+  if (!Current->isOneOf(tok::r_brace, tok::comma))
 return false;
-  nextToken();
 }
+nextToken(); // consume r_brace
+return true;
   }
 };
 
Index: cfe/trunk/unittests/Format/SortImportsTestJS.cpp
===
--- cfe/trunk/unittests/Format/SortImportsTestJS.cpp
+++ cfe/trunk/unittests/Format/SortImportsTestJS.cpp
@@ -70,6 +70,26 @@
  "let x = 1;");
 }
 
+TEST_F(SortImportsTestJS, DefaultBinding) {
+  verifySort("import A from 'a';\n"
+ "import B from 'b';\n"
+ "\n"
+ "let x = 1;",
+ "import B from 'b';\n"
+ "import A from 'a';\n"
+ "let x = 1;");
+}
+
+TEST_F(SortImportsTestJS, DefaultAndNamedBinding) {
+  verifySort("import A, {a} from 'a';\n"
+ "import B, {b} from 'b';\n"
+ "\n"
+ "let x = 1;",
+ "import B, {b} from 'b';\n"
+ "import A, {a} from 'a';\n"
+ "let x = 1;");
+}
+
 TEST_F(SortImportsTestJS, WrappedImportStatements) {
   verifySort("import {sym1, sym2} from 'a';\n"
  "import {sym} from 'b';\n"


Index: cfe/trunk/lib/Format/SortJavaScriptImports.cpp
===
--- cfe/trunk/lib/Format/SortJavaScriptImports.cpp
+++ cfe/trunk/lib/Format/SortJavaScriptImports.cpp
@@ -346,7 +346,6 @@
 
 if (!parseModuleBindings(Keywords, Reference))
   return false;
-nextToken();
 
 if (Current->is(Keywords.kw_from)) {
   // imports have a 'from' clause, exports might not.
@@ -389,19 +388,28 @@
 if (Current->isNot(tok::identifier))
   return false;
 Reference.Prefix = Current->TokenText;
+nextToken();
 return true;
   }
 
   bool parseNamedBindings(const AdditionalKeywords &Keywords,
   JsModuleReference &Reference) {
+if (Current->is(tok::identifier)) {
+  nextToken();
+  if (Current->is(Keywords.kw_from))
+return true;
+  if (Current->isNot(tok::comma))
+return false;
+  nextToken(); // eat comma.
+}
 if (Current->isNot(tok::l_brace))
   return false;
 
 // {sym as alias, sym2 as ...} from '...';
-nextToken();
-while (true) {
+while (Current->isNot(tok::r_brace)) {
+  nextToken();
   if (Current->is(tok::r_brace))
-return true;
+break;
   if (Current->isNot(tok::identifier))
 return false;
 
@@ -422,12 +430,11 @@
   Symbol.Range.setEnd(Current->Tok.getLocation());
   Reference.Symbols.push_back(Symbol);
 
-  if (Current->is(tok::r_brace))
-return true;
-  if (Current->isNot(tok::comma))
+  if (!Current->isOneOf(tok::r_brace, tok::comma))
 return false;
-  nextToken();
 }
+nextToken(); // consume r_brace
+return true;
   }
 };
 
Index: cfe/trunk/unittests/Format/SortImportsTestJS.cpp
===
--- cfe/trunk/un

[PATCH] D24192: [clang-refactor] introducing clang-refactor

2016-09-02 Thread Kirill Bobyrev via cfe-commits
omtcyfz created this revision.
omtcyfz added reviewers: alexfh, klimek, ioeric, bkramer.
omtcyfz added a subscriber: cfe-commits.

This patch basically creates `clang-refactor` binary and merges both 
`clang-rename rename-at` and `clang-rename rename-at` a.k.a. `clang-rename` 
into `clang-refactor rename` subcommand.

All USR processing routine is moved to `USREngine`, which should be reused by 
future potential submodules.

`clang-refactor` (as opposed to `clang-rename`) now uses LLVM policy about 
brackets around single line statements in `if`/`while`/...

Editor integrations are moved with minor changes, i.e. they are just named 
differently now.

Docs are updated.

The tool itself doesn't have to be perfect in the first iteration, so I would 
be really happy to push this one early enough so that everyone could start 
building modules on top of it. As soon as this one is landed more refactoring 
and cleanup patches are welcome. This also isn't about "the one true way how 
clang-refactor has to be designed". Thus said, consider this version of 
clang-refactor to be highly experimental.

https://reviews.llvm.org/D24192

Files:
  CMakeLists.txt
  TemplatedClassFunction.cpp
  clang-refactor/CMakeLists.txt
  clang-refactor/USREngine/CMakeLists.txt
  clang-refactor/USREngine/USRFinder.cpp
  clang-refactor/USREngine/USRFinder.h
  clang-refactor/USREngine/USRFindingAction.cpp
  clang-refactor/USREngine/USRFindingAction.h
  clang-refactor/USREngine/USRLocFinder.cpp
  clang-refactor/USREngine/USRLocFinder.h
  clang-refactor/driver/CMakeLists.txt
  clang-refactor/driver/ClangRefactorOptions.h
  clang-refactor/driver/Driver.cpp
  clang-refactor/driver/Rename.h
  clang-refactor/editor-integrations/CMakeLists.txt
  clang-refactor/editor-integrations/clang-refactor-rename.el
  clang-refactor/editor-integrations/clang-refactor-rename.py
  clang-refactor/modules/CMakeLists.txt
  clang-refactor/modules/rename/CMakeLists.txt
  clang-refactor/modules/rename/RenamingAction.cpp
  clang-refactor/modules/rename/RenamingAction.h
  clang-rename/CMakeLists.txt
  clang-rename/RenamingAction.cpp
  clang-rename/RenamingAction.h
  clang-rename/USRFinder.cpp
  clang-rename/USRFinder.h
  clang-rename/USRFindingAction.cpp
  clang-rename/USRFindingAction.h
  clang-rename/USRLocFinder.cpp
  clang-rename/USRLocFinder.h
  clang-rename/tool/CMakeLists.txt
  clang-rename/tool/ClangRename.cpp
  clang-rename/tool/clang-rename.el
  clang-rename/tool/clang-rename.py
  docs/clang-refactor/index.rst
  docs/clang-refactor/rename.rst
  docs/clang-rename.rst
  docs/index.rst
  test/CMakeLists.txt
  test/clang-refactor/rename/ClassAsTemplateArgument.cpp
  test/clang-refactor/rename/ClassFindByName.cpp
  test/clang-refactor/rename/ClassReplacements.cpp
  test/clang-refactor/rename/ClassSimpleRenaming.cpp
  test/clang-refactor/rename/ClassTestMulti.cpp
  test/clang-refactor/rename/ClassTestMultiByName.cpp
  test/clang-refactor/rename/ClassTestMultiByNameYAML.cpp
  test/clang-refactor/rename/ComplexFunctionOverride.cpp
  test/clang-refactor/rename/ComplicatedClassType.cpp
  test/clang-refactor/rename/Ctor.cpp
  test/clang-refactor/rename/CtorInitializer.cpp
  test/clang-refactor/rename/DeclRefExpr.cpp
  test/clang-refactor/rename/Field.cpp
  test/clang-refactor/rename/FunctionMacro.cpp
  test/clang-refactor/rename/FunctionOverride.cpp
  test/clang-refactor/rename/FunctionWithClassFindByName.cpp
  test/clang-refactor/rename/Inputs/ClassTestMultiByNameYAMLRenameAll.yaml
  test/clang-refactor/rename/Inputs/ClassTestMultiByNameYAMLRenameAt.yaml
  test/clang-refactor/rename/InvalidNewName.cpp
  test/clang-refactor/rename/MemberExprMacro.cpp
  test/clang-refactor/rename/Namespace.cpp
  test/clang-refactor/rename/NoNewName.cpp
  test/clang-refactor/rename/QualifiedNameNotFound.cpp
  test/clang-refactor/rename/TemplateClassInstantiation.cpp
  test/clang-refactor/rename/TemplateTypename.cpp
  test/clang-refactor/rename/UserDefinedConversion.cpp
  test/clang-refactor/rename/Variable.cpp
  test/clang-refactor/rename/VariableMacro.cpp
  test/clang-rename/ClassAsTemplateArgument.cpp
  test/clang-rename/ClassFindByName.cpp
  test/clang-rename/ClassReplacements.cpp
  test/clang-rename/ClassSimpleRenaming.cpp
  test/clang-rename/ClassTestMulti.cpp
  test/clang-rename/ClassTestMultiByName.cpp
  test/clang-rename/ClassTestMultiByNameYAML.cpp
  test/clang-rename/ComplexFunctionOverride.cpp
  test/clang-rename/ComplicatedClassType.cpp
  test/clang-rename/Ctor.cpp
  test/clang-rename/CtorInitializer.cpp
  test/clang-rename/DeclRefExpr.cpp
  test/clang-rename/Field.cpp
  test/clang-rename/FunctionMacro.cpp
  test/clang-rename/FunctionOverride.cpp
  test/clang-rename/FunctionWithClassFindByName.cpp
  test/clang-rename/Inputs/ClassTestMultiByNameYAMLRenameAll.yaml
  test/clang-rename/Inputs/ClassTestMultiByNameYAMLRenameAt.yaml
  test/clang-rename/InvalidNewName.cpp
  test/clang-rename/InvalidOldName.cpp
  test/clang-rename/MemberExprMacro.cpp
  test/clang-rename/Namespace.cpp
 

Re: [PATCH] D24183: A clang tool for changing surrouding namespaces of class/function definitions.

2016-09-02 Thread Kirill Bobyrev via cfe-commits
omtcyfz added a comment.

In https://reviews.llvm.org/D24183#532876, @Eugene.Zelenko wrote:

> Looks like clang-refactor idea should finally go live.


https://reviews.llvm.org/D24192 up for review.


Repository:
  rL LLVM

https://reviews.llvm.org/D24183



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


Re: [PATCH] D24155: clang-format: [JS] merge requoting replacements.

2016-09-02 Thread Martin Probst via cfe-commits
mprobst marked an inline comment as done.


Comment at: lib/Format/Format.cpp:806
@@ -805,2 +805,3 @@
   FormatTokenLexer &Tokens, tooling::Replacements &Result) override {
+tooling::Replacements RunResult;
 deriveLocalStyle(AnnotatedLines);

djasper wrote:
> Call this "RequoteChanges".
Done, went with `RequoteReplaces` (which is what we use in other places for the 
`tooling::Replacements` variable).


Comment at: lib/Format/Format.cpp:831
@@ -830,1 +830,3 @@
+RunResult = RunResult.merge(Whitespaces.generateReplacements());
+return RunResult;
   }

djasper wrote:
> Just
> 
>   return RequoteChanges.merge(Whitespaces.generateReplacements());
Done.

Somewhat related, this API was very surprising – it passes down a Replacements 
object, but then the caller takes every item of the returned result and adds it 
back into the object, causing conflicts. So the only way to correctly use the 
API is to ignore the parameter, or return an empty dummy object. I've changed 
the API to not pass down the parameter to make this a bit less misleading.


https://reviews.llvm.org/D24155



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


r280487 - clang-format: [JS] merge requoting replacements.

2016-09-02 Thread Martin Probst via cfe-commits
Author: mprobst
Date: Fri Sep  2 09:29:48 2016
New Revision: 280487

URL: http://llvm.org/viewvc/llvm-project?rev=280487&view=rev
Log:
clang-format: [JS] merge requoting replacements.

Summary:
When formatting source code that needs both requoting and reindentation,
merge the replacements to avoid erroring out for conflicting replacements.

Also removes the misleading Replacements parameter from the
TokenAnalyzer API.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

Modified:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/lib/Format/SortJavaScriptImports.cpp
cfe/trunk/lib/Format/TokenAnalyzer.cpp
cfe/trunk/lib/Format/TokenAnalyzer.h
cfe/trunk/unittests/Format/FormatTestJS.cpp

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=280487&r1=280486&r2=280487&view=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Fri Sep  2 09:29:48 2016
@@ -801,14 +801,15 @@ public:
   tooling::Replacements
   analyze(TokenAnnotator &Annotator,
   SmallVectorImpl &AnnotatedLines,
-  FormatTokenLexer &Tokens, tooling::Replacements &Result) override {
+  FormatTokenLexer &Tokens) override {
+tooling::Replacements RequoteReplaces;
 deriveLocalStyle(AnnotatedLines);
 AffectedRangeMgr.computeAffectedLines(AnnotatedLines.begin(),
   AnnotatedLines.end());
 
 if (Style.Language == FormatStyle::LK_JavaScript &&
 Style.JavaScriptQuotes != FormatStyle::JSQS_Leave)
-  requoteJSStringLiteral(AnnotatedLines, Result);
+  requoteJSStringLiteral(AnnotatedLines, RequoteReplaces);
 
 for (unsigned i = 0, e = AnnotatedLines.size(); i != e; ++i) {
   Annotator.calculateFormattingInformation(*AnnotatedLines[i]);
@@ -825,7 +826,7 @@ public:
 UnwrappedLineFormatter(&Indenter, &Whitespaces, Style, 
Tokens.getKeywords(),
IncompleteFormat)
 .format(AnnotatedLines);
-return Whitespaces.generateReplacements();
+return RequoteReplaces.merge(Whitespaces.generateReplacements());
   }
 
 private:
@@ -997,7 +998,7 @@ public:
   tooling::Replacements
   analyze(TokenAnnotator &Annotator,
   SmallVectorImpl &AnnotatedLines,
-  FormatTokenLexer &Tokens, tooling::Replacements &Result) override {
+  FormatTokenLexer &Tokens) override {
 // FIXME: in the current implementation the granularity of affected range
 // is an annotated line. However, this is not sufficient. Furthermore,
 // redundant code introduced by replacements does not necessarily

Modified: cfe/trunk/lib/Format/SortJavaScriptImports.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/SortJavaScriptImports.cpp?rev=280487&r1=280486&r2=280487&view=diff
==
--- cfe/trunk/lib/Format/SortJavaScriptImports.cpp (original)
+++ cfe/trunk/lib/Format/SortJavaScriptImports.cpp Fri Sep  2 09:29:48 2016
@@ -127,7 +127,7 @@ public:
   tooling::Replacements
   analyze(TokenAnnotator &Annotator,
   SmallVectorImpl &AnnotatedLines,
-  FormatTokenLexer &Tokens, tooling::Replacements &) override {
+  FormatTokenLexer &Tokens) override {
 tooling::Replacements Result;
 AffectedRangeMgr.computeAffectedLines(AnnotatedLines.begin(),
   AnnotatedLines.end());
@@ -282,7 +282,6 @@ private:
 SmallVectorImpl &AnnotatedLines) {
 SmallVector References;
 SourceLocation Start;
-bool FoundLines = false;
 AnnotatedLine *FirstNonImportLine = nullptr;
 bool AnyImportAffected = false;
 for (auto Line : AnnotatedLines) {
@@ -296,7 +295,6 @@ private:
 Start = Line->First->Tok.getLocation();
   if (!Current)
 continue; // Only comments on this line.
-  FoundLines = true;
   JsModuleReference Reference;
   Reference.Range.setBegin(Start);
   if (!parseModuleReference(Keywords, Reference)) {

Modified: cfe/trunk/lib/Format/TokenAnalyzer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnalyzer.cpp?rev=280487&r1=280486&r2=280487&view=diff
==
--- cfe/trunk/lib/Format/TokenAnalyzer.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnalyzer.cpp Fri Sep  2 09:29:48 2016
@@ -107,7 +107,7 @@ tooling::Replacements TokenAnalyzer::pro
 }
 
 tooling::Replacements RunResult =
-analyze(Annotator, AnnotatedLines, Tokens, Result);
+analyze(Annotator, AnnotatedLines, Tokens);
 
 DEBUG({
   llvm::dbgs() << "Replacements for run " << Run << ":\n";

Modified: cfe/trunk/lib/Format/TokenAnalyzer.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Fo

Re: [PATCH] D24155: clang-format: [JS] merge requoting replacements.

2016-09-02 Thread Martin Probst via cfe-commits
This revision was automatically updated to reflect the committed changes.
mprobst marked an inline comment as done.
Closed by commit rL280487: clang-format: [JS] merge requoting replacements. 
(authored by mprobst).

Changed prior to commit:
  https://reviews.llvm.org/D24155?vs=70066&id=70164#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24155

Files:
  cfe/trunk/lib/Format/Format.cpp
  cfe/trunk/lib/Format/SortJavaScriptImports.cpp
  cfe/trunk/lib/Format/TokenAnalyzer.cpp
  cfe/trunk/lib/Format/TokenAnalyzer.h
  cfe/trunk/unittests/Format/FormatTestJS.cpp

Index: cfe/trunk/lib/Format/SortJavaScriptImports.cpp
===
--- cfe/trunk/lib/Format/SortJavaScriptImports.cpp
+++ cfe/trunk/lib/Format/SortJavaScriptImports.cpp
@@ -127,7 +127,7 @@
   tooling::Replacements
   analyze(TokenAnnotator &Annotator,
   SmallVectorImpl &AnnotatedLines,
-  FormatTokenLexer &Tokens, tooling::Replacements &) override {
+  FormatTokenLexer &Tokens) override {
 tooling::Replacements Result;
 AffectedRangeMgr.computeAffectedLines(AnnotatedLines.begin(),
   AnnotatedLines.end());
@@ -282,7 +282,6 @@
 SmallVectorImpl &AnnotatedLines) {
 SmallVector References;
 SourceLocation Start;
-bool FoundLines = false;
 AnnotatedLine *FirstNonImportLine = nullptr;
 bool AnyImportAffected = false;
 for (auto Line : AnnotatedLines) {
@@ -296,7 +295,6 @@
 Start = Line->First->Tok.getLocation();
   if (!Current)
 continue; // Only comments on this line.
-  FoundLines = true;
   JsModuleReference Reference;
   Reference.Range.setBegin(Start);
   if (!parseModuleReference(Keywords, Reference)) {
Index: cfe/trunk/lib/Format/TokenAnalyzer.h
===
--- cfe/trunk/lib/Format/TokenAnalyzer.h
+++ cfe/trunk/lib/Format/TokenAnalyzer.h
@@ -87,7 +87,7 @@
   virtual tooling::Replacements
   analyze(TokenAnnotator &Annotator,
   SmallVectorImpl &AnnotatedLines,
-  FormatTokenLexer &Tokens, tooling::Replacements &Result) = 0;
+  FormatTokenLexer &Tokens) = 0;
 
   void consumeUnwrappedLine(const UnwrappedLine &TheLine) override;
 
Index: cfe/trunk/lib/Format/Format.cpp
===
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -801,14 +801,15 @@
   tooling::Replacements
   analyze(TokenAnnotator &Annotator,
   SmallVectorImpl &AnnotatedLines,
-  FormatTokenLexer &Tokens, tooling::Replacements &Result) override {
+  FormatTokenLexer &Tokens) override {
+tooling::Replacements RequoteReplaces;
 deriveLocalStyle(AnnotatedLines);
 AffectedRangeMgr.computeAffectedLines(AnnotatedLines.begin(),
   AnnotatedLines.end());
 
 if (Style.Language == FormatStyle::LK_JavaScript &&
 Style.JavaScriptQuotes != FormatStyle::JSQS_Leave)
-  requoteJSStringLiteral(AnnotatedLines, Result);
+  requoteJSStringLiteral(AnnotatedLines, RequoteReplaces);
 
 for (unsigned i = 0, e = AnnotatedLines.size(); i != e; ++i) {
   Annotator.calculateFormattingInformation(*AnnotatedLines[i]);
@@ -825,7 +826,7 @@
 UnwrappedLineFormatter(&Indenter, &Whitespaces, Style, Tokens.getKeywords(),
IncompleteFormat)
 .format(AnnotatedLines);
-return Whitespaces.generateReplacements();
+return RequoteReplaces.merge(Whitespaces.generateReplacements());
   }
 
 private:
@@ -997,7 +998,7 @@
   tooling::Replacements
   analyze(TokenAnnotator &Annotator,
   SmallVectorImpl &AnnotatedLines,
-  FormatTokenLexer &Tokens, tooling::Replacements &Result) override {
+  FormatTokenLexer &Tokens) override {
 // FIXME: in the current implementation the granularity of affected range
 // is an annotated line. However, this is not sufficient. Furthermore,
 // redundant code introduced by replacements does not necessarily
Index: cfe/trunk/lib/Format/TokenAnalyzer.cpp
===
--- cfe/trunk/lib/Format/TokenAnalyzer.cpp
+++ cfe/trunk/lib/Format/TokenAnalyzer.cpp
@@ -107,7 +107,7 @@
 }
 
 tooling::Replacements RunResult =
-analyze(Annotator, AnnotatedLines, Tokens, Result);
+analyze(Annotator, AnnotatedLines, Tokens);
 
 DEBUG({
   llvm::dbgs() << "Replacements for run " << Run << ":\n";
Index: cfe/trunk/unittests/Format/FormatTestJS.cpp
===
--- cfe/trunk/unittests/Format/FormatTestJS.cpp
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp
@@ -1334,6 +1334,13 @@
"let x = \"single\";\n");
 }
 
+TEST_F(FormatTestJS, RequoteAndIndent) {
+  verifyFormat("let x = someVeryLongFunctionThatGoesOnAndOn(\n"
+

[PATCH] D24193: Allow variables with asm labels in naked functions

2016-09-02 Thread Nikola Smiljanić via cfe-commits
nikola created this revision.
nikola added reviewers: hans, rnk, compnerd.
nikola added a subscriber: cfe-commits.
Herald added a subscriber: aemerson.

I think the current mode is too restrictive, it will emit error for any 
statement inside a naked function. Code I'm trying to compile for ARM declares 
registers as variables to improve readability and passes them as input operands 
to inline assembly.

register uint32_t Something asm("rax");


https://reviews.llvm.org/D24193

Files:
  lib/Sema/SemaDecl.cpp
  test/Sema/attr-naked.c

Index: test/Sema/attr-naked.c
===
--- test/Sema/attr-naked.c
+++ test/Sema/attr-naked.c
@@ -48,3 +48,12 @@
"r"(z) // expected-error{{parameter references not allowed in 
naked functions}}
);
 }
+
+__attribute__((naked)) void t10() {  // expected-note{{attribute is here}}
+  int x; // expected-error{{non-ASM statement in naked function is not 
supported}}
+}
+
+__attribute__((naked)) void t11() {
+  register int x asm("eax");
+}
+
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -11792,6 +11792,14 @@
 
 if (FD && FD->hasAttr()) {
   for (const Stmt *S : Body->children()) {
+if (auto *DS = dyn_cast(S)) {
+  if (DS->isSingleDecl()) {
+if (auto *Var = dyn_cast_or_null(DS->getSingleDecl())) {
+  if (Var->hasAttr())
+continue;
+}
+  }
+}
 if (!isa(S) && !isa(S)) {
   Diag(S->getLocStart(), diag::err_non_asm_stmt_in_naked_function);
   Diag(FD->getAttr()->getLocation(), diag::note_attribute);


Index: test/Sema/attr-naked.c
===
--- test/Sema/attr-naked.c
+++ test/Sema/attr-naked.c
@@ -48,3 +48,12 @@
"r"(z) // expected-error{{parameter references not allowed in naked functions}}
);
 }
+
+__attribute__((naked)) void t10() {  // expected-note{{attribute is here}}
+  int x; // expected-error{{non-ASM statement in naked function is not supported}}
+}
+
+__attribute__((naked)) void t11() {
+  register int x asm("eax");
+}
+
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -11792,6 +11792,14 @@
 
 if (FD && FD->hasAttr()) {
   for (const Stmt *S : Body->children()) {
+if (auto *DS = dyn_cast(S)) {
+  if (DS->isSingleDecl()) {
+if (auto *Var = dyn_cast_or_null(DS->getSingleDecl())) {
+  if (Var->hasAttr())
+continue;
+}
+  }
+}
 if (!isa(S) && !isa(S)) {
   Diag(S->getLocStart(), diag::err_non_asm_stmt_in_naked_function);
   Diag(FD->getAttr()->getLocation(), diag::note_attribute);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24152: Support the overloadable attribute with _Generic expressions

2016-09-02 Thread David Blaikie via cfe-commits
dblaikie added inline comments.


Comment at: lib/Sema/SemaOverload.cpp:12996
@@ +12995,3 @@
+  // selection expression.
+  std::vector AssocExprs(GSE->getAssocExprs().vec());
+  unsigned ResultIdx = GSE->getResultIndex();

george.burgess.iv wrote:
> Is there a reason this isn't a `SmallVector` instead?
Another note on this - we should generally prefer copy init over direct init 
(less power, less responsibility/easier to read):

  std::vector AssocExprs = GSE->getAssocExprs().vec();

(& as for George's question: since ArrayRef::vec returns std::vector, it's 
cheaper to store in a std::vector (by move) than to make a copy into a 
SmallVector)


https://reviews.llvm.org/D24152



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


Re: [PATCH] D24183: A clang tool for changing surrouding namespaces of class/function definitions.

2016-09-02 Thread Kirill Bobyrev via cfe-commits
omtcyfz added inline comments.


Comment at: change-namespace/ChangeNamespace.cpp:21
@@ +20,3 @@
+inline std::string formatNamespace(llvm::StringRef NS) {
+  (void)NS.ltrim(':');
+  return NS.str();

is `(void)` intended here?


Comment at: change-namespace/ChangeNamespace.h:41
@@ +40,3 @@
+//   }  // x
+// TODO(ioeric): support moving typedef, enums across namespaces.
+class ChangeNamespaceTool : ast_matchers::MatchFinder::MatchCallback {

`FIXME`?


Repository:
  rL LLVM

https://reviews.llvm.org/D24183



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


Re: [PATCH] D24152: Support the overloadable attribute with _Generic expressions

2016-09-02 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: lib/Sema/SemaOverload.cpp:12996
@@ +12995,3 @@
+  // selection expression.
+  std::vector AssocExprs(GSE->getAssocExprs().vec());
+  unsigned ResultIdx = GSE->getResultIndex();

dblaikie wrote:
> george.burgess.iv wrote:
> > Is there a reason this isn't a `SmallVector` instead?
> Another note on this - we should generally prefer copy init over direct init 
> (less power, less responsibility/easier to read):
> 
>   std::vector AssocExprs = GSE->getAssocExprs().vec();
> 
> (& as for George's question: since ArrayRef::vec returns std::vector, it's 
> cheaper to store in a std::vector (by move) than to make a copy into a 
> SmallVector)
Yeah, I originally used std::vector<> because of ArrayRef's interface. I am 
happy to go either route, depending on preference, as I doubt this will wind up 
on the hot path with any regularity.


https://reviews.llvm.org/D24152



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


Re: [PATCH] D23651: [clang-rename] improve performance for rename-all

2016-09-02 Thread Miklos Vajna via cfe-commits
vmiklos added a comment.

Ah, if you mean you squashed this into https://reviews.llvm.org/D24192, then I 
see what you mean, ignore me. :-)


https://reviews.llvm.org/D23651



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


Re: [PATCH] trivial documentation fix regarding Obj-C ARC objc_arc_weak_reference_unavailable

2016-09-02 Thread Sean McBride via cfe-commits
Friendly ping... this is a very trivial documentation patch...


On Wed, 10 Aug 2016 13:57:07 -0400, Sean McBride via cfe-commits said:

>Fixed incorrect docs that referred to:
> objc_arc_weak_unavailable
>when it should be:
> objc_arc_weak_reference_unavailable
>
>Cheers,
>
>Sean
>___
>cfe-commits mailing list
>cfe-commits@lists.llvm.org
>http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


objc_arc_weak_unavailable-typo.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24192: [clang-refactor] introducing clang-refactor

2016-09-02 Thread Eric Liu via cfe-commits
ioeric added a comment.

- You mentioned a design doc in the summary; maybe also include a link to it?
- It would make the review easier if you could separate the migration of 
clang-rename into another patch...I think clang-refactor is really the 
interesting part here. And maybe also add a small dummy sub-module as an 
example demonstrating how to add a new sub-module, which I believe will be 
helpful for future developers. (See also tool-template 
 
which exists for the same purpose.)



Comment at: TemplatedClassFunction.cpp:1
@@ +1,2 @@
+template 
+class A {

What is this file for?


https://reviews.llvm.org/D24192



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


Re: [PATCH] D24183: A clang tool for changing surrouding namespaces of class/function definitions.

2016-09-02 Thread Eric Liu via cfe-commits
ioeric updated this revision to Diff 70173.
ioeric added a comment.

- removed unintended changes.


https://reviews.llvm.org/D24183

Files:
  CMakeLists.txt
  change-namespace/CMakeLists.txt
  change-namespace/ChangeNamespace.cpp
  change-namespace/ChangeNamespace.h
  change-namespace/tool/CMakeLists.txt
  change-namespace/tool/ClangChangeNamespace.cpp
  test/CMakeLists.txt
  test/change-namespace/simple-move.cpp
  unittests/CMakeLists.txt
  unittests/change-namespace/CMakeLists.txt
  unittests/change-namespace/ChangeNamespaceTests.cpp

Index: unittests/change-namespace/ChangeNamespaceTests.cpp
===
--- /dev/null
+++ unittests/change-namespace/ChangeNamespaceTests.cpp
@@ -0,0 +1,234 @@
+//===-- ChangeNamespaceTests.cpp - Change namespace unit tests ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "ChangeNamespace.h"
+#include "unittests/Tooling/RewriterTestContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Basic/FileManager.h"
+#include "clang/Basic/FileSystemOptions.h"
+#include "clang/Basic/VirtualFileSystem.h"
+#include "clang/Format/Format.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Frontend/PCHContainerOperations.h"
+#include "clang/Tooling/Refactoring.h"
+#include "clang/Tooling/Tooling.h"
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include "gtest/gtest.h"
+#include 
+#include 
+#include 
+
+namespace clang {
+namespace change_namespace {
+namespace {
+
+class ChangeNamespaceTest : public ::testing::Test {
+public:
+  std::string runChangeNamespaceOnCode(llvm::StringRef Code) {
+clang::RewriterTestContext Context;
+clang::FileID ID = Context.createInMemoryFile(FileName, Code);
+
+std::map FileToReplacements;
+change_namespace::ChangeNamespaceTool NamespaceTool(
+OldNamespace, NewNamespace, FilePattern, &FileToReplacements);
+ast_matchers::MatchFinder Finder;
+NamespaceTool.registerMatchers(&Finder);
+std::unique_ptr Factory =
+tooling::newFrontendActionFactory(&Finder);
+tooling::runToolOnCodeWithArgs(Factory->create(), Code, {"-std=c++11"},
+   FileName);
+formatAndApplyAllReplacements(FileToReplacements, Context.Rewrite);
+return format(Context.getRewrittenText(ID));
+  }
+
+  std::string format(llvm::StringRef Code) {
+tooling::Replacements Replaces = format::reformat(
+format::getLLVMStyle(), Code, {tooling::Range(0, Code.size())});
+auto ChangedCode = tooling::applyAllReplacements(Code, Replaces);
+EXPECT_TRUE(static_cast(ChangedCode));
+if (!ChangedCode) {
+  llvm::errs() << llvm::toString(ChangedCode.takeError());
+  return "";
+}
+return *ChangedCode;
+  }
+
+protected:
+  std::string FileName = "input.cc";
+  std::string OldNamespace = "na::nb";
+  std::string NewNamespace = "x::y";
+  std::string FilePattern = "input.cc";
+};
+
+TEST_F(ChangeNamespaceTest, NoMatchingNamespace) {
+  std::string Code = "namespace na {\n"
+ "namespace nx {\n"
+ "class A {};\n"
+ "} // namespace nx\n"
+ "} // namespace na\n";
+  std::string Expected = "namespace na {\n"
+ "namespace nx {\n"
+ "class A {};\n"
+ "} // namespace nx\n"
+ "} // namespace na\n";
+  EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
+}
+
+TEST_F(ChangeNamespaceTest, SimpleMoveWithoutTypeRefs) {
+  std::string Code = "namespace na {\n"
+ "namespace nb {\n"
+ "class A {};\n"
+ "} // namespace nb\n"
+ "} // namespace na\n";
+  std::string Expected = "\n\n"
+ "namespace x {\n"
+ "namespace y {\n"
+ "class A {};\n"
+ "} // namespace y\n"
+ "} // namespace x\n";
+  EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
+}
+
+TEST_F(ChangeNamespaceTest, SimpleMoveIntoAnotherNestedNamespace) {
+  NewNamespace = "na::nc";
+  std::string Code = "namespace na {\n"
+ "namespace nb {\n"
+ "class A {};\n"
+ "} // namespace nb\n"
+ "} // namespace na\n";
+  std::string Expected = "namespace na {\n"
+ "\n"
+ "namespace nc {\n"
+ "class A {};\n"
+ "} // namespace nc\n"
+ "} // namespace na\n";
+  EXPECT_EQ(format(Expected

Re: [PATCH] trivial documentation fix regarding Obj-C ARC objc_arc_weak_reference_unavailable

2016-09-02 Thread Jonathan Roelofs via cfe-commits



On 9/2/16 9:26 AM, Sean McBride via cfe-commits wrote:

Friendly ping... this is a very trivial documentation patch...


LGTM




On Wed, 10 Aug 2016 13:57:07 -0400, Sean McBride via cfe-commits said:


Fixed incorrect docs that referred to:
objc_arc_weak_unavailable
when it should be:
objc_arc_weak_reference_unavailable

Cheers,

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


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


--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24054: Do not validate pch when -fno-validate-pch is set

2016-09-02 Thread Yaxun Liu via cfe-commits
yaxunl added a comment.

The bug is due to PCHValidator is added as Listener, which causes pch is 
validated even though DisableValidation is true (when -fno-validate-pch is on). 
The fix is not add PCHValidator as listener when DisableValidation is true.

The bug is annoying for using pch. When pch is generated with default 
optimization, the generated pch cannot be used to compile program with -O0.

Tom/Alexey, can you help review the code? Thanks.


https://reviews.llvm.org/D24054



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


Re: [PATCH] D24193: Allow variables with asm labels in naked functions

2016-09-02 Thread Hans Wennborg via cfe-commits
hans added a comment.

I think this is reasonable. Just a few comments:



Comment at: lib/Sema/SemaDecl.cpp:11796
@@ +11795,3 @@
+if (auto *DS = dyn_cast(S)) {
+  if (DS->isSingleDecl()) {
+if (auto *Var = dyn_cast_or_null(DS->getSingleDecl())) {

I think we'll need to check for multiple declarators here:

```
register int x asm("eax"), y asm("ebx");
```

And do we need to check for an initializer? For example, the following should 
not be allowed:

```
register int x asm("eax") = g();
```

It would also be nice to have a comment explaining why these are Ok but not 
other declarations.


https://reviews.llvm.org/D24193



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


Re: [PATCH] D24193: Allow variables with asm labels in naked functions

2016-09-02 Thread Reid Kleckner via cfe-commits
rnk added a comment.

Won't the mid-level optimizer turn these register variables into undefs, and 
we'll end up with this kind of IR?

  void f() {
int register var asm ("eax") ;
asm volatile ("add %%eax, %0\n\tret" : : "r"(var));
  }
  ->
  define void @"\01?f@@YAXXZ"() local_unnamed_addr #0 {
  entry:
tail call void asm sideeffect "add %eax, $0\0A\09ret", 
"{eax},~{dirflag},~{fpsr},~{flags}"(i32 undef) #1, !srcloc !2
ret void
  }

I guess it's OK so long as we don't codegen undef to anything, but it could go 
badly.


https://reviews.llvm.org/D24193



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


LLVM buildmaster will be updated and restarted tonight

2016-09-02 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be updated and restarted after 6 PM Pacific time
today.

Thanks

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


Re: [PATCH] D24192: [clang-refactor] introducing clang-refactor

2016-09-02 Thread Kirill Bobyrev via cfe-commits
omtcyfz added a comment.

In https://reviews.llvm.org/D24192#532981, @ioeric wrote:

> - You mentioned a design doc in the summary; maybe also include a link to it?


Done.

> - It would make the review easier if you could separate the migration of 
> clang-rename into another patch...I think clang-refactor is really the 
> interesting part here. And maybe also add a small dummy sub-module as an 
> example demonstrating how to add a new sub-module, which I believe will be 
> helpful for future developers. (See also tool-template 
>  
> which exists for the same purpose.)


I am not against it, but I do not think that an empty tool, which just 
introduces the binary without any code would be reasonable. This is basically 
why I wanted it to be all-in-place.

The whole changelist doesn't introduce anything really new, so I assume it 
might be fine. But if you are not okay with it I can split.



Comment at: TemplatedClassFunction.cpp:1
@@ +1,2 @@
+template 
+class A {

ioeric wrote:
> What is this file for?
This is a test. It is the reason clang-refactor rename fails :)


https://reviews.llvm.org/D24192



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


Re: [PATCH] D24152: Support the overloadable attribute with _Generic expressions

2016-09-02 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: lib/Sema/SemaOverload.cpp:12996
@@ +12995,3 @@
+  // selection expression.
+  std::vector AssocExprs(GSE->getAssocExprs().vec());
+  unsigned ResultIdx = GSE->getResultIndex();

george.burgess.iv wrote:
> aaron.ballman wrote:
> > dblaikie wrote:
> > > george.burgess.iv wrote:
> > > > Is there a reason this isn't a `SmallVector` instead?
> > > Another note on this - we should generally prefer copy init over direct 
> > > init (less power, less responsibility/easier to read):
> > > 
> > >   std::vector AssocExprs = GSE->getAssocExprs().vec();
> > > 
> > > (& as for George's question: since ArrayRef::vec returns std::vector, 
> > > it's cheaper to store in a std::vector (by move) than to make a copy into 
> > > a SmallVector)
> > Yeah, I originally used std::vector<> because of ArrayRef's interface. I am 
> > happy to go either route, depending on preference, as I doubt this will 
> > wind up on the hot path with any regularity.
> > as for George's question: since ArrayRef::vec returns std::vector, it's 
> > cheaper to store in a std::vector (by move) than to make a copy into a 
> > SmallVector 
> 
> I was thinking that we would end up using the `SmallVector(begin(), end())` 
> ctor instead, so the vector temp wouldn't be needed. :)
> 
> Regardless, it was just a nit, so I'm perfectly happy if it stays a `vector`.
> 
> > I doubt this will wind up on the hot path with any regularity
> 
> Agreed.
> I was thinking that we would end up using the SmallVector(begin(), end()) 
> ctor instead, so the vector temp wouldn't be needed. :)

I went that route, but didn't like requiring a local `ArrayRef` to 
prevent calling `GSE->getAssocExprs()` twice. There really is no convenient way 
to get a SmallVector from an ArrayRef, so perhaps another option would be to 
have a SmallVector constructor that accepts an ArrayRef, or have a way to get 
all of the elements as an `llvm::iterator_range` directly from an ArrayRef.


https://reviews.llvm.org/D24152



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


Re: [PATCH] D24152: Support the overloadable attribute with _Generic expressions

2016-09-02 Thread George Burgess IV via cfe-commits
george.burgess.iv added inline comments.


Comment at: lib/Sema/SemaOverload.cpp:12996
@@ +12995,3 @@
+  // selection expression.
+  std::vector AssocExprs(GSE->getAssocExprs().vec());
+  unsigned ResultIdx = GSE->getResultIndex();

aaron.ballman wrote:
> dblaikie wrote:
> > george.burgess.iv wrote:
> > > Is there a reason this isn't a `SmallVector` instead?
> > Another note on this - we should generally prefer copy init over direct 
> > init (less power, less responsibility/easier to read):
> > 
> >   std::vector AssocExprs = GSE->getAssocExprs().vec();
> > 
> > (& as for George's question: since ArrayRef::vec returns std::vector, it's 
> > cheaper to store in a std::vector (by move) than to make a copy into a 
> > SmallVector)
> Yeah, I originally used std::vector<> because of ArrayRef's interface. I am 
> happy to go either route, depending on preference, as I doubt this will wind 
> up on the hot path with any regularity.
> as for George's question: since ArrayRef::vec returns std::vector, it's 
> cheaper to store in a std::vector (by move) than to make a copy into a 
> SmallVector 

I was thinking that we would end up using the `SmallVector(begin(), end())` 
ctor instead, so the vector temp wouldn't be needed. :)

Regardless, it was just a nit, so I'm perfectly happy if it stays a `vector`.

> I doubt this will wind up on the hot path with any regularity

Agreed.


https://reviews.llvm.org/D24152



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


Re: [PATCH] D24192: [clang-refactor] introducing clang-refactor

2016-09-02 Thread Kirill Bobyrev via cfe-commits
omtcyfz updated this revision to Diff 70194.
omtcyfz added a comment.

Revert diff, as the last one "deletes and creates" files instead of "moving and 
changing them" in the filesystem.


https://reviews.llvm.org/D24192

Files:
  CMakeLists.txt
  TemplatedClassFunction.cpp
  clang-refactor/CMakeLists.txt
  clang-refactor/USREngine/CMakeLists.txt
  clang-refactor/USREngine/USRFinder.cpp
  clang-refactor/USREngine/USRFinder.h
  clang-refactor/USREngine/USRFindingAction.cpp
  clang-refactor/USREngine/USRFindingAction.h
  clang-refactor/USREngine/USRLocFinder.cpp
  clang-refactor/USREngine/USRLocFinder.h
  clang-refactor/driver/CMakeLists.txt
  clang-refactor/driver/ClangRefactorOptions.h
  clang-refactor/driver/Driver.cpp
  clang-refactor/driver/Rename.h
  clang-refactor/editor-integrations/CMakeLists.txt
  clang-refactor/editor-integrations/clang-refactor-rename.el
  clang-refactor/editor-integrations/clang-refactor-rename.py
  clang-refactor/modules/CMakeLists.txt
  clang-refactor/modules/rename/CMakeLists.txt
  clang-refactor/modules/rename/RenamingAction.cpp
  clang-refactor/modules/rename/RenamingAction.h
  clang-rename/USRFindingAction.h
  clang-rename/tool/CMakeLists.txt
  clang-rename/tool/ClangRename.cpp
  docs/clang-refactor/index.rst
  docs/clang-refactor/rename.rst
  docs/clang-rename.rst
  docs/index.rst
  test/CMakeLists.txt
  test/clang-refactor/rename/ClassAsTemplateArgument.cpp
  test/clang-refactor/rename/ClassFindByName.cpp
  test/clang-refactor/rename/ClassReplacements.cpp
  test/clang-refactor/rename/ClassSimpleRenaming.cpp
  test/clang-refactor/rename/ClassTestMulti.cpp
  test/clang-refactor/rename/ClassTestMultiByName.cpp
  test/clang-refactor/rename/ClassTestMultiByNameYAML.cpp
  test/clang-refactor/rename/ComplexFunctionOverride.cpp
  test/clang-refactor/rename/ComplicatedClassType.cpp
  test/clang-refactor/rename/Ctor.cpp
  test/clang-refactor/rename/CtorInitializer.cpp
  test/clang-refactor/rename/DeclRefExpr.cpp
  test/clang-refactor/rename/Field.cpp
  test/clang-refactor/rename/FunctionMacro.cpp
  test/clang-refactor/rename/FunctionOverride.cpp
  test/clang-refactor/rename/FunctionWithClassFindByName.cpp
  test/clang-refactor/rename/InvalidNewName.cpp
  test/clang-refactor/rename/MemberExprMacro.cpp
  test/clang-refactor/rename/Namespace.cpp
  test/clang-refactor/rename/NoNewName.cpp
  test/clang-refactor/rename/QualifiedNameNotFound.cpp
  test/clang-refactor/rename/TemplateClassInstantiation.cpp
  test/clang-refactor/rename/TemplateTypename.cpp
  test/clang-refactor/rename/UserDefinedConversion.cpp
  test/clang-refactor/rename/Variable.cpp
  test/clang-refactor/rename/VariableMacro.cpp
  test/clang-rename/ClassTestMultiByName.cpp
  test/clang-rename/ClassTestMultiByNameYAML.cpp
  test/clang-rename/InvalidNewName.cpp
  test/clang-rename/InvalidOldName.cpp
  test/clang-rename/NoNewName.cpp
  unittests/CMakeLists.txt
  unittests/clang-rename/CMakeLists.txt
  unittests/clang-rename/USRLocFindingTest.cpp

Index: unittests/clang-rename/USRLocFindingTest.cpp
===
--- unittests/clang-rename/USRLocFindingTest.cpp
+++ unittests/clang-rename/USRLocFindingTest.cpp
@@ -1,83 +0,0 @@
-#include "USRFindingAction.h"
-#include "clang/Tooling/Tooling.h"
-#include "gtest/gtest.h"
-#include 
-#include 
-#include 
-
-namespace clang {
-namespace rename {
-namespace test {
-
-// Determines if the symbol group invariants hold. To recap, those invariants
-// are:
-//  (1) All symbols in the same symbol group share the same USR.
-//  (2) Two symbols from two different groups do not share the same USR.
-static void testOffsetGroups(const char *Code,
- const std::vector> Groups) {
-  std::set AllUSRs, CurrUSR;
-
-  for (const auto &Group : Groups) {
-// Groups the invariants do not hold then the value of USR is also invalid,
-// but at that point the test has already failed and USR ceases to be
-// useful.
-std::string USR;
-for (const auto &Offset : Group) {
-  USRFindingAction Action(Offset, std::string());
-  auto Factory = tooling::newFrontendActionFactory(&Action);
-  EXPECT_TRUE(tooling::runToolOnCode(Factory->create(), Code));
-  const auto &USRs = Action.getUSRs();
-  EXPECT_EQ(1u, USRs.size());
-  USR = USRs[0];
-  CurrUSR.insert(USR);
-}
-EXPECT_EQ(1u, CurrUSR.size());
-CurrUSR.clear();
-AllUSRs.insert(USR);
-  }
-
-  EXPECT_EQ(Groups.size(), AllUSRs.size());
-}
-
-
-TEST(USRLocFinding, FindsVarUSR) {
-  const char VarTest[] = "\n\
-namespace A {\n\
-int foo;\n\
-}\n\
-int foo;\n\
-int bar = foo;\n\
-int baz = A::foo;\n\
-void fun1() {\n\
-  struct {\n\
-int foo;\n\
-  } b = { 100 };\n\
-  int foo = 100;\n\
-  baz = foo;\n\
-  {\n\
-extern int foo;\n\
-baz = foo;\n\
-foo = A::foo + baz;\n\
-A::foo = b.foo;\n\
-  }\n\
- foo = b.foo;\n\
-}\n";
-  std::vector> VarTestOffsets(3);
-  VarTestOffsets[0].push_back(19);
-  VarTestOffs

Re: [PATCH] D24152: Support the overloadable attribute with _Generic expressions

2016-09-02 Thread David Blaikie via cfe-commits
On Fri, Sep 2, 2016 at 10:57 AM Aaron Ballman 
wrote:

> aaron.ballman added inline comments.
>
> 
> Comment at: lib/Sema/SemaOverload.cpp:12996
> @@ +12995,3 @@
> +  // selection expression.
> +  std::vector AssocExprs(GSE->getAssocExprs().vec());
> +  unsigned ResultIdx = GSE->getResultIndex();
> 
> george.burgess.iv wrote:
> > aaron.ballman wrote:
> > > dblaikie wrote:
> > > > george.burgess.iv wrote:
> > > > > Is there a reason this isn't a `SmallVector` instead?
> > > > Another note on this - we should generally prefer copy init over
> direct init (less power, less responsibility/easier to read):
> > > >
> > > >   std::vector AssocExprs = GSE->getAssocExprs().vec();
> > > >
> > > > (& as for George's question: since ArrayRef::vec returns
> std::vector, it's cheaper to store in a std::vector (by move) than to make
> a copy into a SmallVector)
> > > Yeah, I originally used std::vector<> because of ArrayRef's interface.
> I am happy to go either route, depending on preference, as I doubt this
> will wind up on the hot path with any regularity.
> > > as for George's question: since ArrayRef::vec returns std::vector,
> it's cheaper to store in a std::vector (by move) than to make a copy into a
> SmallVector
> >
> > I was thinking that we would end up using the `SmallVector(begin(),
> end())` ctor instead, so the vector temp wouldn't be needed. :)
> >
> > Regardless, it was just a nit, so I'm perfectly happy if it stays a
> `vector`.
> >
> > > I doubt this will wind up on the hot path with any regularity
> >
> > Agreed.
> > I was thinking that we would end up using the SmallVector(begin(),
> end()) ctor instead, so the vector temp wouldn't be needed. :)
>
> I went that route, but didn't like requiring a local `ArrayRef` to
> prevent calling `GSE->getAssocExprs()` twice. There really is no convenient
> way to get a SmallVector from an ArrayRef, so perhaps another option would
> be to have a SmallVector constructor that accepts an ArrayRef, or have a
> way to get all of the elements as an `llvm::iterator_range` directly from
> an ArrayRef.
>

Yeah, we really should (if possible) change this ctor:
http://llvm.org/docs/doxygen/html/classllvm_1_1SmallVector.html#a12de5fa9d857aa18e9edac9db6a79838
-
to take an opaque range, any range, not just an iterator_range. Then you
could construct a SmallVector from an ArrayRef.

(would have to SFINAE on the existence of ADL-available begin/end free
functions and an element type implicitly convertible to the SmallVector's
element type probably, to make sure the ctor wasn't firing on any/all
arguments)

- Dave


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


Re: [PATCH] D23651: [clang-rename] improve performance for rename-all

2016-09-02 Thread Kirill Bobyrev via cfe-commits
omtcyfz updated this revision to Diff 70193.
omtcyfz added a comment.

Revert diff, as the last one "deletes and creates" files instead of "moving and 
changing them" in the filesystem.


https://reviews.llvm.org/D23651

Files:
  CMakeLists.txt
  TemplatedClassFunction.cpp
  clang-refactor/CMakeLists.txt
  clang-refactor/USREngine/CMakeLists.txt
  clang-refactor/USREngine/USRFinder.cpp
  clang-refactor/USREngine/USRFinder.h
  clang-refactor/USREngine/USRFindingAction.cpp
  clang-refactor/USREngine/USRFindingAction.h
  clang-refactor/USREngine/USRLocFinder.cpp
  clang-refactor/USREngine/USRLocFinder.h
  clang-refactor/driver/CMakeLists.txt
  clang-refactor/driver/ClangRefactorOptions.h
  clang-refactor/driver/Driver.cpp
  clang-refactor/driver/Rename.h
  clang-refactor/editor-integrations/CMakeLists.txt
  clang-refactor/editor-integrations/clang-refactor-rename.el
  clang-refactor/editor-integrations/clang-refactor-rename.py
  clang-refactor/modules/CMakeLists.txt
  clang-refactor/modules/rename/CMakeLists.txt
  clang-refactor/modules/rename/RenamingAction.cpp
  clang-refactor/modules/rename/RenamingAction.h
  clang-rename/USRFindingAction.h
  clang-rename/tool/CMakeLists.txt
  clang-rename/tool/ClangRename.cpp
  docs/clang-refactor/index.rst
  docs/clang-refactor/rename.rst
  docs/clang-rename.rst
  docs/index.rst
  test/CMakeLists.txt
  test/clang-refactor/rename/ClassAsTemplateArgument.cpp
  test/clang-refactor/rename/ClassFindByName.cpp
  test/clang-refactor/rename/ClassReplacements.cpp
  test/clang-refactor/rename/ClassSimpleRenaming.cpp
  test/clang-refactor/rename/ClassTestMulti.cpp
  test/clang-refactor/rename/ClassTestMultiByName.cpp
  test/clang-refactor/rename/ClassTestMultiByNameYAML.cpp
  test/clang-refactor/rename/ComplexFunctionOverride.cpp
  test/clang-refactor/rename/ComplicatedClassType.cpp
  test/clang-refactor/rename/Ctor.cpp
  test/clang-refactor/rename/CtorInitializer.cpp
  test/clang-refactor/rename/DeclRefExpr.cpp
  test/clang-refactor/rename/Field.cpp
  test/clang-refactor/rename/FunctionMacro.cpp
  test/clang-refactor/rename/FunctionOverride.cpp
  test/clang-refactor/rename/FunctionWithClassFindByName.cpp
  test/clang-refactor/rename/InvalidNewName.cpp
  test/clang-refactor/rename/MemberExprMacro.cpp
  test/clang-refactor/rename/Namespace.cpp
  test/clang-refactor/rename/NoNewName.cpp
  test/clang-refactor/rename/QualifiedNameNotFound.cpp
  test/clang-refactor/rename/TemplateClassInstantiation.cpp
  test/clang-refactor/rename/TemplateTypename.cpp
  test/clang-refactor/rename/UserDefinedConversion.cpp
  test/clang-refactor/rename/Variable.cpp
  test/clang-refactor/rename/VariableMacro.cpp
  test/clang-rename/ClassTestMultiByName.cpp
  test/clang-rename/ClassTestMultiByNameYAML.cpp
  test/clang-rename/InvalidNewName.cpp
  test/clang-rename/InvalidOldName.cpp
  test/clang-rename/NoNewName.cpp
  unittests/CMakeLists.txt
  unittests/clang-rename/CMakeLists.txt
  unittests/clang-rename/USRLocFindingTest.cpp

Index: unittests/clang-rename/USRLocFindingTest.cpp
===
--- unittests/clang-rename/USRLocFindingTest.cpp
+++ unittests/clang-rename/USRLocFindingTest.cpp
@@ -1,83 +0,0 @@
-#include "USRFindingAction.h"
-#include "clang/Tooling/Tooling.h"
-#include "gtest/gtest.h"
-#include 
-#include 
-#include 
-
-namespace clang {
-namespace rename {
-namespace test {
-
-// Determines if the symbol group invariants hold. To recap, those invariants
-// are:
-//  (1) All symbols in the same symbol group share the same USR.
-//  (2) Two symbols from two different groups do not share the same USR.
-static void testOffsetGroups(const char *Code,
- const std::vector> Groups) {
-  std::set AllUSRs, CurrUSR;
-
-  for (const auto &Group : Groups) {
-// Groups the invariants do not hold then the value of USR is also invalid,
-// but at that point the test has already failed and USR ceases to be
-// useful.
-std::string USR;
-for (const auto &Offset : Group) {
-  USRFindingAction Action(Offset, std::string());
-  auto Factory = tooling::newFrontendActionFactory(&Action);
-  EXPECT_TRUE(tooling::runToolOnCode(Factory->create(), Code));
-  const auto &USRs = Action.getUSRs();
-  EXPECT_EQ(1u, USRs.size());
-  USR = USRs[0];
-  CurrUSR.insert(USR);
-}
-EXPECT_EQ(1u, CurrUSR.size());
-CurrUSR.clear();
-AllUSRs.insert(USR);
-  }
-
-  EXPECT_EQ(Groups.size(), AllUSRs.size());
-}
-
-
-TEST(USRLocFinding, FindsVarUSR) {
-  const char VarTest[] = "\n\
-namespace A {\n\
-int foo;\n\
-}\n\
-int foo;\n\
-int bar = foo;\n\
-int baz = A::foo;\n\
-void fun1() {\n\
-  struct {\n\
-int foo;\n\
-  } b = { 100 };\n\
-  int foo = 100;\n\
-  baz = foo;\n\
-  {\n\
-extern int foo;\n\
-baz = foo;\n\
-foo = A::foo + baz;\n\
-A::foo = b.foo;\n\
-  }\n\
- foo = b.foo;\n\
-}\n";
-  std::vector> VarTestOffsets(3);
-  VarTestOffsets[0].push_back(19);
-  VarTestOffs

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

2016-09-02 Thread Tavian Barnes via cfe-commits
tavianator added a comment.

In https://reviews.llvm.org/D21803#532309, @EricWF wrote:

> `__thread`
>
> What do you think of this idea?


Makes sense to me, I'll integrate it into the next revision.



Comment at: src/cxa_thread_atexit.cpp:42
@@ +41,3 @@
+  // - thread_local destructors on other threads run on the first iteration
+  //   through the pthread_key destructors.  std::notify_all_at_thread_exit()
+  //   and similar functions must be careful to wait until the second iteration

EricWF wrote:
> Can you clarify what you mean by "other threads"?
> 
> How is libc++ supposed to detect and handle this problem? 
I meant "non-main threads" ("other" is in relation to the bullet point above), 
but I can clarify this, sure.

libc++ could be patched to do something like this:

```
pthread_key_t key1, key2;

void destructor1(void* ptr) {
  pthread_setspecific(key2, ptr);
}

void destructor2(void* ptr) {
  // Runs in the second iteration through pthread_key destructors,
  // therefore after thread_local destructors
}

pthread_key_create(&key1, destructor1);
pthread_key_create(&key2, destructor2);

pthread_setspecific(key1, ptr);
```

(Or it could use a counter/flag and a single pthread_key.)

libstdc++ has the same bug when __cxa_thread_atexit_impl() isn't available, so 
I'm not sure that change would really be necessary.  If it is, I can write up 
the libc++ patch.


https://reviews.llvm.org/D21803



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


Re: [PATCH] D24192: [clang-refactor] introducing clang-refactor

2016-09-02 Thread Kirill Bobyrev via cfe-commits
omtcyfz added a comment.

In https://reviews.llvm.org/D24192#532981, @ioeric wrote:

> - It would make the review easier if you could separate the migration of 
> clang-rename into another patch...


Another point is that if I try to separate the migration - what do I do about 
USREngine? USREngine is basically the core of clang-refactor at the moment and 
I can't detach it from clang-rename at the same time.


https://reviews.llvm.org/D24192



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


Re: [PATCH] D23651: [clang-rename] improve performance for rename-all

2016-09-02 Thread Kirill Bobyrev via cfe-commits
omtcyfz abandoned this revision.
omtcyfz added a comment.

Oops, wrong patch... Abandoning this one anyway.


https://reviews.llvm.org/D23651



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


Re: [PATCH] D23895: [ms] Add support for parsing uuid as a MS attribute

2016-09-02 Thread Nico Weber via cfe-commits
thakis updated this revision to Diff 70197.
thakis added a comment.

Require '('.


https://reviews.llvm.org/D23895

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/Attributes.h
  include/clang/Parse/Parser.h
  include/clang/Sema/AttributeList.h
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseDeclCXX.cpp
  lib/Parse/ParseObjc.cpp
  lib/Parse/ParseOpenMP.cpp
  lib/Parse/Parser.cpp
  test/CodeGenCXX/microsoft-uuidof.cpp
  test/Parser/MicrosoftExtensions.cpp
  test/Parser/ms-square-bracket-attributes.mm
  test/Sema/MicrosoftExtensions.c
  utils/TableGen/ClangAttrEmitter.cpp

Index: utils/TableGen/ClangAttrEmitter.cpp
===
--- utils/TableGen/ClangAttrEmitter.cpp
+++ utils/TableGen/ClangAttrEmitter.cpp
@@ -1312,6 +1312,9 @@
 } else if (Variety == "Declspec") {
   Prefix = " __declspec(";
   Suffix = ")";
+} else if (Variety == "Microsoft") {
+  Prefix = "[";
+  Suffix = "]";
 } else if (Variety == "Keyword") {
   Prefix = " ";
   Suffix = "";
@@ -2295,7 +2298,7 @@
   // Separate all of the attributes out into four group: generic, C++11, GNU,
   // and declspecs. Then generate a big switch statement for each of them.
   std::vector Attrs = Records.getAllDerivedDefinitions("Attr");
-  std::vector Declspec, GNU, Pragma;
+  std::vector Declspec, Microsoft, GNU, Pragma;
   std::map> CXX;
 
   // Walk over the list of all attributes, and split them out based on the
@@ -2308,6 +2311,8 @@
 GNU.push_back(R);
   else if (Variety == "Declspec")
 Declspec.push_back(R);
+  else if (Variety == "Microsoft")
+Microsoft.push_back(R);
   else if (Variety == "CXX11")
 CXX[SI.nameSpace()].push_back(R);
   else if (Variety == "Pragma")
@@ -2323,6 +2328,9 @@
   OS << "case AttrSyntax::Declspec:\n";
   OS << "  return llvm::StringSwitch(Name)\n";
   GenerateHasAttrSpellingStringSwitch(Declspec, OS, "Declspec");
+  OS << "case AttrSyntax::Microsoft:\n";
+  OS << "  return llvm::StringSwitch(Name)\n";
+  GenerateHasAttrSpellingStringSwitch(Microsoft, OS, "Microsoft");
   OS << "case AttrSyntax::Pragma:\n";
   OS << "  return llvm::StringSwitch(Name)\n";
   GenerateHasAttrSpellingStringSwitch(Pragma, OS, "Pragma");
@@ -2361,8 +2369,9 @@
 .Case("GNU", 0)
 .Case("CXX11", 1)
 .Case("Declspec", 2)
-.Case("Keyword", 3)
-.Case("Pragma", 4)
+.Case("Microsoft", 3)
+.Case("Keyword", 4)
+.Case("Pragma", 5)
 .Default(0)
  << " && Scope == \"" << Spellings[I].nameSpace() << "\")\n"
  << "return " << I << ";\n";
@@ -2982,7 +2991,8 @@
   emitSourceFileHeader("Attribute name matcher", OS);
 
   std::vector Attrs = Records.getAllDerivedDefinitions("Attr");
-  std::vector GNU, Declspec, CXX11, Keywords, Pragma;
+  std::vector GNU, Declspec, Microsoft, CXX11,
+  Keywords, Pragma;
   std::set Seen;
   for (const auto *A : Attrs) {
 const Record &Attr = *A;
@@ -3024,6 +3034,8 @@
   Matches = &GNU;
 else if (Variety == "Declspec")
   Matches = &Declspec;
+else if (Variety == "Microsoft")
+  Matches = &Microsoft;
 else if (Variety == "Keyword")
   Matches = &Keywords;
 else if (Variety == "Pragma")
@@ -3048,6 +3060,8 @@
   StringMatcher("Name", GNU, OS).Emit();
   OS << "  } else if (AttributeList::AS_Declspec == Syntax) {\n";
   StringMatcher("Name", Declspec, OS).Emit();
+  OS << "  } else if (AttributeList::AS_Microsoft == Syntax) {\n";
+  StringMatcher("Name", Microsoft, OS).Emit();
   OS << "  } else if (AttributeList::AS_CXX11 == Syntax) {\n";
   StringMatcher("Name", CXX11, OS).Emit();
   OS << "  } else if (AttributeList::AS_Keyword == Syntax || ";
@@ -3131,8 +3145,9 @@
   GNU = 1 << 0,
   CXX11 = 1 << 1,
   Declspec = 1 << 2,
-  Keyword = 1 << 3,
-  Pragma = 1 << 4
+  Microsoft = 1 << 3,
+  Keyword = 1 << 4,
+  Pragma = 1 << 5
 };
 
 static void WriteDocumentation(const DocumentationData &Doc,
@@ -3180,6 +3195,7 @@
 .Case("GNU", GNU)
 .Case("CXX11", CXX11)
 .Case("Declspec", Declspec)
+.Case("Microsoft", Microsoft)
 .Case("Keyword", Keyword)
 .Case("Pragma", Pragma);
 
Index: test/Sema/MicrosoftExtensions.c
===
--- test/Sema/MicrosoftExtensions.c
+++ test/Sema/MicrosoftExtensions.c
@@ -28,6 +28,8 @@
 
 struct __declspec(uuid("---C000-0046")) IUnknown {}; /* expected-error {{'uuid' attribute is not supported in C}} */
 
+[uuid("---C000-0046")] struct IUnknown2 {}; /* expected-error {{'uuid' attribute is not supported in C}} */
+
 typedef struct notnested {
   long bad1;
   long bad2;
Index:

Re: [PATCH] D23895: [ms] Add support for parsing uuid as a MS attribute

2016-09-02 Thread Nico Weber via cfe-commits
thakis marked an inline comment as done.


Comment at: lib/Parse/ParseDeclCXX.cpp:4037
@@ -3945,1 +4036,3 @@
+}
+
 T.consumeClose();

Aha, I had forgotten that SkipUntil() handles paren nesting intelligently, so I 
think just requiring a '(' after 'uuid' with the current code should work 
fairly well. Done, and added a test.


https://reviews.llvm.org/D23895



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


Re: [PATCH] D24192: [clang-refactor] introducing clang-refactor

2016-09-02 Thread Eric Liu via cfe-commits
ioeric added a comment.

In https://reviews.llvm.org/D24192#533174, @omtcyfz wrote:

> In https://reviews.llvm.org/D24192#532981, @ioeric wrote:
>
> > - It would make the review easier if you could separate the migration of 
> > clang-rename into another patch...
>
>
> Another point is that if I try to separate the migration - what do I do about 
> USREngine? USREngine is basically the core of clang-refactor at the moment 
> and I can't detach it from clang-rename at the same time.


I'm not sure why USREngine is the core of clang-refactor. It seems to me that 
USREngine is more closely tied to clang-rename than to clang-refactor. At least 
USREngine is not essential to all refactor tools, and it is more like a library 
that sub-modules can use.


https://reviews.llvm.org/D24192



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


Re: [PATCH] D24192: [clang-refactor] introducing clang-refactor

2016-09-02 Thread Kirill Bobyrev via cfe-commits
omtcyfz added a comment.

In https://reviews.llvm.org/D24192#533198, @ioeric wrote:

> In https://reviews.llvm.org/D24192#533174, @omtcyfz wrote:
>
> > In https://reviews.llvm.org/D24192#532981, @ioeric wrote:
> >
> > > - It would make the review easier if you could separate the migration of 
> > > clang-rename into another patch...
> >
> >
> > Another point is that if I try to separate the migration - what do I do 
> > about USREngine? USREngine is basically the core of clang-refactor at the 
> > moment and I can't detach it from clang-rename at the same time.
>
>
> I'm not sure why USREngine is the core of clang-refactor. It seems to me that 
> USREngine is more closely tied to clang-rename than to clang-refactor. At 
> least USREngine is not essential to all refactor tools, and it is more like a 
> library that sub-modules can use.


It is essential to all of the tools I wrote about in design doc.

Well, are you proposing to create an "empty" `clang-refactor` binary in one 
patch and adding meaningful code in the other? I am not sure if just creating 
`clang-refactor/driver/Driver.cpp` with `main`, which doesn't do anything is a 
good idea, but if you think it is - I'll do that.


https://reviews.llvm.org/D24192



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


r280516 - Implement __attribute__((require_constant_initialization)) for safe static initialization.

2016-09-02 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Sep  2 13:25:29 2016
New Revision: 280516

URL: http://llvm.org/viewvc/llvm-project?rev=280516&view=rev
Log:
Implement __attribute__((require_constant_initialization)) for safe static 
initialization.

Summary:
This attribute specifies expectations about the initialization of static and
thread local variables. Specifically that the variable has a
[constant 
initializer](http://en.cppreference.com/w/cpp/language/constant_initialization)
according to the rules of [basic.start.static]. Failure to meet this expectation
will result in an error.

Static objects with constant initializers avoid hard-to-find bugs caused by
the indeterminate order of dynamic initialization. They can also be safely
used by other static constructors across translation units.

This attribute acts as a compile time assertion that the requirements
for constant initialization have been met. Since these requirements change
between dialects and have subtle pitfalls it's important to fail fast instead
of silently falling back on dynamic initialization.

```c++
  // -std=c++14
  #define SAFE_STATIC __attribute__((require_constant_initialization)) static
  struct T {
constexpr T(int) {}
~T();
  };
  SAFE_STATIC T x = {42}; // OK.
  SAFE_STATIC T y = 42; // error: variable does not have a constant initializer
  // copy initialization is not a constant expression on a non-literal type.
```
This attribute can only be applied to objects with static or thread-local 
storage
duration.

Reviewers: majnemer, rsmith, aaron.ballman

Subscribers: jroelofs, cfe-commits

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

Added:
cfe/trunk/test/SemaCXX/attr-require-constant-initialization.cpp
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/AttrDocs.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/AttributeList.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=280516&r1=280515&r2=280516&view=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Fri Sep  2 13:25:29 2016
@@ -241,6 +241,7 @@ def MicrosoftExt : LangOpt<"MicrosoftExt
 def Borland : LangOpt<"Borland">;
 def CUDA : LangOpt<"CUDA">;
 def COnly : LangOpt<"CPlusPlus", 1>;
+def CPlusPlus : LangOpt<"CPlusPlus">;
 def OpenCL : LangOpt<"OpenCL">;
 def RenderScript : LangOpt<"RenderScript">;
 
@@ -1380,6 +1381,15 @@ def ReqdWorkGroupSize : InheritableAttr
   let Documentation = [Undocumented];
 }
 
+def RequireConstantInit : InheritableAttr {
+  let Spellings = [GNU<"require_constant_initialization">,
+   CXX11<"clang", "require_constant_initialization">];
+  let Subjects = SubjectList<[GlobalVar], ErrorDiag,
+  "ExpectedStaticOrTLSVar">;
+  let Documentation = [RequireConstantInitDocs];
+  let LangOpts = [CPlusPlus];
+}
+
 def WorkGroupSizeHint :  InheritableAttr {
   let Spellings = [GNU<"work_group_size_hint">];
   let Args = [UnsignedArgument<"XDim">, 

Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=280516&r1=280515&r2=280516&view=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Fri Sep  2 13:25:29 2016
@@ -829,6 +829,43 @@ When one method overrides another, the o
   }];
 }
 
+
+def RequireConstantInitDocs : Documentation {
+  let Category = DocCatVariable;
+  let Content = [{
+This attribute specifies that the variable to which it is attached is intended
+to have a `constant initializer 
`_
+according to the rules of [basic.start.static]. The variable is required to
+have static or thread storage duration. If the initialization of the variable
+is not a constant initializer, an error will be produced. This attribute may
+only be used in C++.
+
+Note that in C++03 strict constant expression checking is not done. Instead
+the attribute reports if Clang can emit the the variable as a constant, even
+if it's not technically a 'constant initializer'. This behavior is 
non-portable.
+
+Static storage duration variables with constant initializers avoid hard-to-find
+bugs caused by the indeterminate order of dynamic initialization. They can also
+be safely used during dynamic initialization across translation units.
+
+This attribute acts as a compile time assertion that the requirements
+for constant initialization have been met. Since these requirements change
+between dialects and have subtle pitfalls it's important to 

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

2016-09-02 Thread Eric Fiselier via cfe-commits
EricWF added inline comments.


Comment at: src/cxa_thread_atexit.cpp:42
@@ +41,3 @@
+  // - thread_local destructors on other threads run on the first iteration
+  //   through the pthread_key destructors.  std::notify_all_at_thread_exit()
+  //   and similar functions must be careful to wait until the second iteration

tavianator wrote:
> EricWF wrote:
> > Can you clarify what you mean by "other threads"?
> > 
> > How is libc++ supposed to detect and handle this problem? 
> I meant "non-main threads" ("other" is in relation to the bullet point 
> above), but I can clarify this, sure.
> 
> libc++ could be patched to do something like this:
> 
> ```
> pthread_key_t key1, key2;
> 
> void destructor1(void* ptr) {
>   pthread_setspecific(key2, ptr);
> }
> 
> void destructor2(void* ptr) {
>   // Runs in the second iteration through pthread_key destructors,
>   // therefore after thread_local destructors
> }
> 
> pthread_key_create(&key1, destructor1);
> pthread_key_create(&key2, destructor2);
> 
> pthread_setspecific(key1, ptr);
> ```
> 
> (Or it could use a counter/flag and a single pthread_key.)
> 
> libstdc++ has the same bug when __cxa_thread_atexit_impl() isn't available, 
> so I'm not sure that change would really be necessary.  If it is, I can write 
> up the libc++ patch.
I don't think we need to patch this in libc++. Especially because it would be 
incorrect in the vast majority of cases.


https://reviews.llvm.org/D21803



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


r280520 - Based on post-commit feedback over IRC with dblaikie, ideally, we should have a SmallVector constructor that accepts anything which can supply a range via ADL begin()/end() calls so that we

2016-09-02 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Fri Sep  2 13:31:31 2016
New Revision: 280520

URL: http://llvm.org/viewvc/llvm-project?rev=280520&view=rev
Log:
Based on post-commit feedback over IRC with dblaikie, ideally, we should have a 
SmallVector constructor that accepts anything which can supply a range via ADL 
begin()/end() calls so that we can construct the SmallVector directly from 
anything range-like.

Since that doesn't exist right now, use a local variable instead of calling 
getAssocExprs() twice; NFC.


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

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=280520&r1=280519&r2=280520&view=diff
==
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Sep  2 13:31:31 2016
@@ -12993,8 +12993,8 @@ Expr *Sema::FixOverloadedFunctionReferen
 
   // Replace the resulting type information before rebuilding the generic
   // selection expression.
-  SmallVector AssocExprs(GSE->getAssocExprs().begin(),
-GSE->getAssocExprs().end());
+  ArrayRef A = GSE->getAssocExprs();
+  SmallVector AssocExprs(A.begin(), A.end());
   unsigned ResultIdx = GSE->getResultIndex();
   AssocExprs[ResultIdx] = SubExpr;
 


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


SVN mirror in the LLVM Lab is behind the master SVN

2016-09-02 Thread Galina Kistanova via cfe-commits
SVN mirror in the LLVM Lab is behind the master SVN. This affects the build
bots.
I'm looking in to this.


Thanks

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


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

2016-09-02 Thread Evgeniy Stepanov via cfe-commits
eugenis added a comment.

I would also expect -nodefaultlibs and -nostdlib to remove all standard 
libraries from the link command line, including the sanitizer ones.

I like the idea of -flink-sanitizer-runtime=address, but may be without 
"address" - the set of sanitizer runtime libraries can be found from 
-fsanitize=* flags.

Alternatively, we could extend (or add something like) -print-libgcc-name to 
report the set of sanitizer link flags (there may be multiple libraries and 
possible other flags).


https://reviews.llvm.org/D24048



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


Re: [PATCH] D24192: [clang-refactor] introducing clang-refactor

2016-09-02 Thread Eric Liu via cfe-commits
ioeric added a comment.

In https://reviews.llvm.org/D24192#533082, @omtcyfz wrote:

> In https://reviews.llvm.org/D24192#532981, @ioeric wrote:
>
> > - You mentioned a design doc in the summary; maybe also include a link to 
> > it?
>
>
> Done.
>
> > - It would make the review easier if you could separate the migration of 
> > clang-rename into another patch...I think clang-refactor is really the 
> > interesting part here. And maybe also add a small dummy sub-module as an 
> > example demonstrating how to add a new sub-module, which I believe will be 
> > helpful for future developers. (See also tool-template 
> > 
> >  which exists for the same purpose.)
>
>
> I am not against it, but I do not think that an empty tool, which just 
> introduces the binary without any code would be reasonable. This is basically 
> why I wanted it to be all-in-place.
>
> The whole changelist doesn't introduce anything really new, so I assume it 
> might be fine. But if you are not okay with it I can split.


Don't worry about a patch being small. Reviewers like small patches :)

The reason that I suggested a dummy sub-tool is to lower the bar for 
developers, especially those who have never developed a clang tool, so that 
they can easily figure out how to set up a clang-refactor sub-tool.

For a "swiss-army knife" tool like clang-refactor, I would worry more about the 
extendibility of the infrastructure instead of functionality at this stage. At 
least, I would expect it to be much easier to create a refactor tool under 
clang-refactor than creating a standalone clang tool. For example, it would be 
really nice if there is a tool base that a sub-module can derive from so that I 
don't have to go through the whole process of creating a clang tool and setting 
up unit/lit test environment :)


https://reviews.llvm.org/D24192



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


r280521 - Revert r280516 since it contained accidental changes.

2016-09-02 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Sep  2 13:43:25 2016
New Revision: 280521

URL: http://llvm.org/viewvc/llvm-project?rev=280521&view=rev
Log:
Revert r280516 since it contained accidental changes.


Removed:
cfe/trunk/test/SemaCXX/attr-require-constant-initialization.cpp
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/AttrDocs.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/AttributeList.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=280521&r1=280520&r2=280521&view=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Fri Sep  2 13:43:25 2016
@@ -241,7 +241,6 @@ def MicrosoftExt : LangOpt<"MicrosoftExt
 def Borland : LangOpt<"Borland">;
 def CUDA : LangOpt<"CUDA">;
 def COnly : LangOpt<"CPlusPlus", 1>;
-def CPlusPlus : LangOpt<"CPlusPlus">;
 def OpenCL : LangOpt<"OpenCL">;
 def RenderScript : LangOpt<"RenderScript">;
 
@@ -1381,15 +1380,6 @@ def ReqdWorkGroupSize : InheritableAttr
   let Documentation = [Undocumented];
 }
 
-def RequireConstantInit : InheritableAttr {
-  let Spellings = [GNU<"require_constant_initialization">,
-   CXX11<"clang", "require_constant_initialization">];
-  let Subjects = SubjectList<[GlobalVar], ErrorDiag,
-  "ExpectedStaticOrTLSVar">;
-  let Documentation = [RequireConstantInitDocs];
-  let LangOpts = [CPlusPlus];
-}
-
 def WorkGroupSizeHint :  InheritableAttr {
   let Spellings = [GNU<"work_group_size_hint">];
   let Args = [UnsignedArgument<"XDim">, 

Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=280521&r1=280520&r2=280521&view=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Fri Sep  2 13:43:25 2016
@@ -829,43 +829,6 @@ When one method overrides another, the o
   }];
 }
 
-
-def RequireConstantInitDocs : Documentation {
-  let Category = DocCatVariable;
-  let Content = [{
-This attribute specifies that the variable to which it is attached is intended
-to have a `constant initializer 
`_
-according to the rules of [basic.start.static]. The variable is required to
-have static or thread storage duration. If the initialization of the variable
-is not a constant initializer, an error will be produced. This attribute may
-only be used in C++.
-
-Note that in C++03 strict constant expression checking is not done. Instead
-the attribute reports if Clang can emit the the variable as a constant, even
-if it's not technically a 'constant initializer'. This behavior is 
non-portable.
-
-Static storage duration variables with constant initializers avoid hard-to-find
-bugs caused by the indeterminate order of dynamic initialization. They can also
-be safely used during dynamic initialization across translation units.
-
-This attribute acts as a compile time assertion that the requirements
-for constant initialization have been met. Since these requirements change
-between dialects and have subtle pitfalls it's important to fail fast instead
-of silently falling back on dynamic initialization.
-
-.. code-block:: c++
-  // -std=c++14
-  #define SAFE_STATIC __attribute__((require_constant_initialization)) static
-  struct T {
-constexpr T(int) {}
-~T(); // non-trivial
-  };
-  SAFE_STATIC T x = {42}; // Initialization OK. Doesn't check destructor.
-  SAFE_STATIC T y = 42; // error: variable does not have a constant initializer
-  // copy initialization is not a constant expression on a non-literal type.
-  }];
-}
-
 def WarnMaybeUnusedDocs : Documentation {
   let Category = DocCatVariable;
   let Heading = "maybe_unused, unused, gnu::unused";
@@ -882,12 +845,12 @@ variable, a function or method, a functi
 enumerator, a non-static data member, or a label.
 
 .. code-block: c++
-  #include 
-
-  [[maybe_unused]] void f([[maybe_unused]] bool thing1,
-  [[maybe_unused]] bool thing2) {
-[[maybe_unused]] bool b = thing1 && thing2;
-assert(b);
+  #include 
+
+  [[maybe_unused]] void f([[maybe_unused]] bool thing1,
+  [[maybe_unused]] bool thing2) {
+[[maybe_unused]] bool b = thing1 && thing2;
+assert(b);
   }
   }];
 }
@@ -904,15 +867,15 @@ potentially-evaluated discarded-value ex
 `void`.
 
 .. code-block: c++
-  struct [[nodiscard]] error_info { /*...*/ };
-  error_info enable_missile_safety_mode();
-
-  void launch_missiles();
-  void test_missiles() {
-enable_missile_saf

Re: [PATCH] D23385: Implement __attribute__((require_constant_initialization)) for safe static initialization.

2016-09-02 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 70200.
EricWF added a comment.

Updating against recent ToT.


https://reviews.llvm.org/D23385

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/AttributeList.h
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/SemaCXX/attr-require-constant-initialization.cpp
  utils/TableGen/ClangAttrEmitter.cpp

Index: utils/TableGen/ClangAttrEmitter.cpp
===
--- utils/TableGen/ClangAttrEmitter.cpp
+++ utils/TableGen/ClangAttrEmitter.cpp
@@ -2790,8 +2790,10 @@
   std::string FnName = "check", Test;
   for (auto I = LangOpts.begin(), E = LangOpts.end(); I != E; ++I) {
 std::string Part = (*I)->getValueAsString("Name");
-if ((*I)->getValueAsBit("Negated"))
+if ((*I)->getValueAsBit("Negated")) {
+  FnName += "Not";
   Test += "!";
+}
 Test += "S.LangOpts." + Part;
 if (I + 1 != E)
   Test += " || ";
Index: test/SemaCXX/attr-require-constant-initialization.cpp
===
--- /dev/null
+++ test/SemaCXX/attr-require-constant-initialization.cpp
@@ -0,0 +1,282 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -DTEST_ONE -std=c++03 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -DTEST_ONE -std=c++11 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -DTEST_ONE -std=c++14 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -DTEST_TWO \
+// RUN: -Wglobal-constructors -std=c++14 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -DTEST_THREE -xc %s
+
+#define ATTR __attribute__((require_constant_initialization)) // expected-note 0+ {{expanded from macro}}
+
+int ReturnInt();
+
+struct PODType {
+  int value;
+  int value2;
+};
+
+#if defined(__cplusplus)
+
+#if __cplusplus >= 201103L
+struct LitType {
+  constexpr LitType() : value(0) {}
+  constexpr LitType(int x) : value(x) {}
+  LitType(void *) : value(-1) {}
+  int value;
+};
+#endif
+
+struct NonLit {
+#if __cplusplus >= 201402L
+  constexpr NonLit() : value(0) {}
+  constexpr NonLit(int x) : value(x) {}
+#else
+  NonLit() : value(0) {}
+  NonLit(int x) : value(x) {}
+#endif
+  NonLit(void *) : value(-1) {}
+  ~NonLit() {}
+  int value;
+};
+
+struct StoresNonLit {
+#if __cplusplus >= 201402L
+  constexpr StoresNonLit() : obj() {}
+  constexpr StoresNonLit(int x) : obj(x) {}
+#else
+  StoresNonLit() : obj() {}
+  StoresNonLit(int x) : obj(x) {}
+#endif
+  StoresNonLit(void *p) : obj(p) {}
+  NonLit obj;
+};
+
+#endif // __cplusplus
+
+
+#if defined(TEST_ONE) // Test semantics of attribute
+
+// Test diagnostics when attribute is applied to non-static declarations.
+void test_func_local(ATTR int param) { // expected-error {{only applies to variables with static or thread}}
+  ATTR int x = 42; // expected-error {{only applies to variables with static or thread}}
+  ATTR extern int y;
+}
+struct ATTR class_mem { // expected-error {{only applies to variables with static or thread}}
+  ATTR int x;   // expected-error {{only applies to variables with static or thread}}
+};
+
+// [basic.start.static]p2.1
+// if each full-expression (including implicit conversions) that appears in
+// the initializer of a reference with static or thread storage duration is
+// a constant expression (5.20) and the reference is bound to a glvalue
+// designating an object with static storage duration, to a temporary object
+// (see 12.2) or subobject thereof, or to a function;
+
+// Test binding to a static glvalue
+const int glvalue_int = 42;
+const int glvalue_int2 = ReturnInt();
+ATTR const int &glvalue_ref ATTR = glvalue_int;
+ATTR const int &glvalue_ref2 ATTR = glvalue_int2;
+ATTR __thread const int &glvalue_ref_tl = glvalue_int;
+
+void test_basic_start_static_2_1() {
+  const int non_global = 42;
+  ATTR static const int &local_init = non_global; // expected-error {{variable does not have a constant initializer}}
+  // expected-note@-1 {{required by 'require_constant_initializer' attribute here}}
+  ATTR static const int &global_init = glvalue_int;
+  ATTR static const int &temp_init = 42;
+}
+
+ATTR const int &temp_ref = 42;
+ATTR const int &temp_ref2 = ReturnInt(); // expected-error {{variable does not have a constant initializer}}
+// expected-note@-1 {{required by 'require_constant_initializer' attribute here}}
+ATTR const NonLit &nl_temp_ref = 42; // expected-error {{variable does not have a constant initializer}}
+// expected-note@-1 {{required by 'require_constant_initializer' attribute here}}
+
+#if __cplusplus >= 201103L
+ATTR const LitType &lit_temp_ref = 42;
+ATTR const int &subobj_ref = LitType{}.value;
+#endif
+
+ATTR const int &nl_subobj_ref = NonLit().value; // expected-error {{variable does not have a constant initializer}}
+// expected-note@-1 {{required by 'require_constant_initializer' attribute here}}
+
+struct TT1 {
+  ATTR static const int &no_init;
+  ATTR static const int &glvalue_init;

Re: [PATCH] D24192: [clang-refactor] introducing clang-refactor

2016-09-02 Thread Eric Liu via cfe-commits
ioeric added a comment.

In https://reviews.llvm.org/D24192#533200, @omtcyfz wrote:

> In https://reviews.llvm.org/D24192#533198, @ioeric wrote:
>
> > In https://reviews.llvm.org/D24192#533174, @omtcyfz wrote:
> >
> > > In https://reviews.llvm.org/D24192#532981, @ioeric wrote:
> > >
> > > > - It would make the review easier if you could separate the migration 
> > > > of clang-rename into another patch...
> > >
> > >
> > > Another point is that if I try to separate the migration - what do I do 
> > > about USREngine? USREngine is basically the core of clang-refactor at the 
> > > moment and I can't detach it from clang-rename at the same time.
> >
> >
> > I'm not sure why USREngine is the core of clang-refactor. It seems to me 
> > that USREngine is more closely tied to clang-rename than to clang-refactor. 
> > At least USREngine is not essential to all refactor tools, and it is more 
> > like a library that sub-modules can use.
>
>
> It is essential to all of the tools I wrote about in design doc.
>
> Well, are you proposing to create an "empty" `clang-refactor` binary in one 
> patch and adding meaningful code in the other? I am not sure if just creating 
> `clang-refactor/driver/Driver.cpp` with `main`, which doesn't do anything is 
> a good idea, but if you think it is - I'll do that.


It was not trivial to me why USREngine is so important to those tools. You 
might want to address that in the design doc as well. And given the weight 
USREngine carries in clang-refactor as you suggested, I think it deserves an 
more detailed introduction in the design doc.


https://reviews.llvm.org/D24192



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


Re: [PATCH] D23745: cmake: Adjust llvm-lit search to match the one in LLVM

2016-09-02 Thread Michał Górny via cfe-commits
mgorny planned changes to this revision.
mgorny added a comment.

Let's wait for the reply on https://reviews.llvm.org/D23743.


https://reviews.llvm.org/D23745



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


r280525 - Implement __attribute__((require_constant_initialization)) for safe static initialization.

2016-09-02 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Sep  2 13:53:31 2016
New Revision: 280525

URL: http://llvm.org/viewvc/llvm-project?rev=280525&view=rev
Log:
Implement __attribute__((require_constant_initialization)) for safe static 
initialization.

Summary:
This attribute specifies expectations about the initialization of static and
thread local variables. Specifically that the variable has a
[constant 
initializer](http://en.cppreference.com/w/cpp/language/constant_initialization)
according to the rules of [basic.start.static]. Failure to meet this expectation
will result in an error.

Static objects with constant initializers avoid hard-to-find bugs caused by
the indeterminate order of dynamic initialization. They can also be safely
used by other static constructors across translation units.

This attribute acts as a compile time assertion that the requirements
for constant initialization have been met. Since these requirements change
between dialects and have subtle pitfalls it's important to fail fast instead
of silently falling back on dynamic initialization.

```c++
  // -std=c++14
  #define SAFE_STATIC __attribute__((require_constant_initialization)) static
  struct T {
constexpr T(int) {}
~T();
  };
  SAFE_STATIC T x = {42}; // OK.
  SAFE_STATIC T y = 42; // error: variable does not have a constant initializer
  // copy initialization is not a constant expression on a non-literal type.
```
This attribute can only be applied to objects with static or thread-local 
storage
duration.

Reviewers: majnemer, rsmith, aaron.ballman

Subscribers: jroelofs, cfe-commits

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

Added:
cfe/trunk/test/SemaCXX/attr-require-constant-initialization.cpp
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/AttrDocs.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/AttributeList.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=280525&r1=280524&r2=280525&view=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Fri Sep  2 13:53:31 2016
@@ -241,6 +241,7 @@ def MicrosoftExt : LangOpt<"MicrosoftExt
 def Borland : LangOpt<"Borland">;
 def CUDA : LangOpt<"CUDA">;
 def COnly : LangOpt<"CPlusPlus", 1>;
+def CPlusPlus : LangOpt<"CPlusPlus">;
 def OpenCL : LangOpt<"OpenCL">;
 def RenderScript : LangOpt<"RenderScript">;
 
@@ -1380,6 +1381,15 @@ def ReqdWorkGroupSize : InheritableAttr
   let Documentation = [Undocumented];
 }
 
+def RequireConstantInit : InheritableAttr {
+  let Spellings = [GNU<"require_constant_initialization">,
+   CXX11<"clang", "require_constant_initialization">];
+  let Subjects = SubjectList<[GlobalVar], ErrorDiag,
+  "ExpectedStaticOrTLSVar">;
+  let Documentation = [RequireConstantInitDocs];
+  let LangOpts = [CPlusPlus];
+}
+
 def WorkGroupSizeHint :  InheritableAttr {
   let Spellings = [GNU<"work_group_size_hint">];
   let Args = [UnsignedArgument<"XDim">, 

Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=280525&r1=280524&r2=280525&view=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Fri Sep  2 13:53:31 2016
@@ -829,6 +829,43 @@ When one method overrides another, the o
   }];
 }
 
+
+def RequireConstantInitDocs : Documentation {
+  let Category = DocCatVariable;
+  let Content = [{
+This attribute specifies that the variable to which it is attached is intended
+to have a `constant initializer 
`_
+according to the rules of [basic.start.static]. The variable is required to
+have static or thread storage duration. If the initialization of the variable
+is not a constant initializer, an error will be produced. This attribute may
+only be used in C++.
+
+Note that in C++03 strict constant expression checking is not done. Instead
+the attribute reports if Clang can emit the the variable as a constant, even
+if it's not technically a 'constant initializer'. This behavior is 
non-portable.
+
+Static storage duration variables with constant initializers avoid hard-to-find
+bugs caused by the indeterminate order of dynamic initialization. They can also
+be safely used during dynamic initialization across translation units.
+
+This attribute acts as a compile time assertion that the requirements
+for constant initialization have been met. Since these requirements change
+between dialects and have subtle pitfalls it's important to 

[PATCH] D24201: [Clang-tools-extra] Fix links in release notes

2016-09-02 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko created this revision.
Eugene.Zelenko added reviewers: alexfh, hokein.
Eugene.Zelenko added a subscriber: cfe-commits.
Eugene.Zelenko set the repository for this revision to rL LLVM.

Repository:
  rL LLVM

https://reviews.llvm.org/D24201

Files:
  docs/ReleaseNotes.rst

Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -10,18 +10,18 @@
 
 .. warning::
 
-   These are in-progress notes for the upcoming Clang 4.0.0 release. You may
-   prefer the `Clang 3.8 Release Notes
-   `_.
+   These are in-progress notes for the upcoming Extra Clang Tools 4.0 release.
+   You may prefer the `Extra Clang Tools 3.9 Release Notes
+   
`_.
 
 Introduction
 
 
 This document contains the release notes for the Extra Clang Tools, part of the
-Clang release 4.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. For the general Clang release notes, see `the Clang documentation
-`_.  All 
LLVM
+Clang release 4.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. For the general Clang release notes, see `the Clang documentation
+`_. All LLVM
 releases may be downloaded from the `LLVM releases web
 site `_.
 


Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -10,18 +10,18 @@
 
 .. warning::
 
-   These are in-progress notes for the upcoming Clang 4.0.0 release. You may
-   prefer the `Clang 3.8 Release Notes
-   `_.
+   These are in-progress notes for the upcoming Extra Clang Tools 4.0 release.
+   You may prefer the `Extra Clang Tools 3.9 Release Notes
+   `_.
 
 Introduction
 
 
 This document contains the release notes for the Extra Clang Tools, part of the
-Clang release 4.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. For the general Clang release notes, see `the Clang documentation
-`_.  All LLVM
+Clang release 4.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. For the general Clang release notes, see `the Clang documentation
+`_. All LLVM
 releases may be downloaded from the `LLVM releases web
 site `_.
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23895: [ms] Add support for parsing uuid as a MS attribute

2016-09-02 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM with one small test case nit.



Comment at: test/Parser/ms-square-bracket-attributes.mm:43
@@ +42,3 @@
+// expected-error@+1 {{expected '('}}
+[uuid{"00A0---C000-0049"}] struct T {};
+

For giggles, can you also add:
```
// expected-error@+1 {{expected ')'}}
[uuid("00A0---C000-0049"}] struct T {};
```


https://reviews.llvm.org/D23895



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


Re: [PATCH] D22507: Clang-tidy - Enum misuse check

2016-09-02 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: test/clang-tidy/misc-enum-misuse.cpp:3
@@ +2,3 @@
+
+enum Empty {
+};

szepet wrote:
> Could you specify which part of the file seems off? I have run the clang 
> format with the same options on testfiles as on the others.
```
enum A { A = 1,
 B = 2,
 C = 4,
 D = 8,
 E = 16,
 F = 32,
 G = 63
};
```
should be:
```
enum A {
  A = 1,
  B = 2,
  C = 4,
  D = 8,
  E = 16,
  F = 32,
  G = 63
};
```
is what I was thinking was incorrect, but perhaps clang-format allows such 
constructs?


Comment at: test/clang-tidy/misc-enum-misuse.cpp:66
@@ +65,3 @@
+int k = T | Q;
+  return 0;
+  Empty EmptyVal;

Do you intend to have the `return 0;` here?


https://reviews.llvm.org/D22507



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


Re: [PATCH] D24159: Fix PR30202 - notify_all_at_thread_exit seg faults if run from a raw pthread context.

2016-09-02 Thread Eric Fiselier via cfe-commits
EricWF added inline comments.


Comment at: src/condition_variable.cpp:86
@@ +85,3 @@
+if (tl_ptr.get() == nullptr) {
+tl_ptr.set_pointer(new __thread_struct);
+}

bcraig wrote:
> The standard synopsis of notify_all_at_thread_exit in the standard doesn't 
> have a "Throws:" clause.  I think that means that this is non-conformant.
> 
> There is some phrasing in 30.2.2 [thread.req.exception]:
>Failure to allocate storage shall be reported as described in 17.6.5.12 
> [res.on.exception.handling].
> But I don't see wording in that section that gives permission to throw from 
> functions without Throws clauses.
> 
> From a user perspective, I generally expect my synchronization primitives to 
> be no-throw.  I don't know if it is really possible to provide that guarantee 
> with notify_all_at_thread_exit though, especially if we want it to work 
> outside of a std::thread.
[res.on.exception.handling]/p4
> 
> Destructor operations defined in the C ++ standard library shall not throw 
> exceptions. Every destructor
> in the C ++ standard library shall behave as if it had a non-throwing 
> exception specification. Any other
> functions defined in the C ++ standard library that do not have an 
> exception-specification may throw
> implementation-defined exceptions unless otherwise specified. [188] An 
> implementation may strengthen this
> implicit exception-specification by adding an explicit one.

And the relevant note:

> 188) In particular, they can report a failure to allocate storage by throwing 
> an exception of type bad_alloc, or a class derived
> from bad_alloc (18.6.3.1). Library implementations should report errors by 
> throwing exceptions of or derived from the standard
> exception classes (18.6.3.1, 18.8, 19.2).

So throwing `std::bad_alloc` is allowed, as it is almost everywhere in the STL. 
Also the function already [allocates memory to store the new 
entry](https://github.com/llvm-mirror/libcxx/blob/master/src/thread.cpp#L202).










https://reviews.llvm.org/D24159



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


Re: [PATCH] D24159: Fix PR30202 - notify_all_at_thread_exit seg faults if run from a raw pthread context.

2016-09-02 Thread Ben Craig via cfe-commits
bcraig added a comment.

LGTM



Comment at: src/condition_variable.cpp:86
@@ +85,3 @@
+if (tl_ptr.get() == nullptr) {
+tl_ptr.set_pointer(new __thread_struct);
+}

EricWF wrote:
> bcraig wrote:
> > The standard synopsis of notify_all_at_thread_exit in the standard doesn't 
> > have a "Throws:" clause.  I think that means that this is non-conformant.
> > 
> > There is some phrasing in 30.2.2 [thread.req.exception]:
> >Failure to allocate storage shall be reported as described in 17.6.5.12 
> > [res.on.exception.handling].
> > But I don't see wording in that section that gives permission to throw from 
> > functions without Throws clauses.
> > 
> > From a user perspective, I generally expect my synchronization primitives 
> > to be no-throw.  I don't know if it is really possible to provide that 
> > guarantee with notify_all_at_thread_exit though, especially if we want it 
> > to work outside of a std::thread.
> [res.on.exception.handling]/p4
> > 
> > Destructor operations defined in the C ++ standard library shall not throw 
> > exceptions. Every destructor
> > in the C ++ standard library shall behave as if it had a non-throwing 
> > exception specification. Any other
> > functions defined in the C ++ standard library that do not have an 
> > exception-specification may throw
> > implementation-defined exceptions unless otherwise specified. [188] An 
> > implementation may strengthen this
> > implicit exception-specification by adding an explicit one.
> 
> And the relevant note:
> 
> > 188) In particular, they can report a failure to allocate storage by 
> > throwing an exception of type bad_alloc, or a class derived
> > from bad_alloc (18.6.3.1). Library implementations should report errors by 
> > throwing exceptions of or derived from the standard
> > exception classes (18.6.3.1, 18.8, 19.2).
> 
> So throwing `std::bad_alloc` is allowed, as it is almost everywhere in the 
> STL. Also the function already [allocates memory to store the new 
> entry](https://github.com/llvm-mirror/libcxx/blob/master/src/thread.cpp#L202).
> 
> 
> 
> 
> 
> 
> 
> 
Yet again, I find that reading comprehension with regards to the standard isn't 
my strong suit :).  I got to "Destructor operations" in p4 and stopped reading.

I will still wish for a noexcept version of this function, but it's a pretty 
impractical wish.  The implementation you have here is fine.


https://reviews.llvm.org/D24159



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


[clang-tools-extra] r280539 - Remove link to clang's release notes; keeping it up-to-date is hard

2016-09-02 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Fri Sep  2 15:39:46 2016
New Revision: 280539

URL: http://llvm.org/viewvc/llvm-project?rev=280539&view=rev
Log:
Remove link to clang's release notes; keeping it up-to-date is hard

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

Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ReleaseNotes.rst?rev=280539&r1=280538&r2=280539&view=diff
==
--- clang-tools-extra/trunk/docs/ReleaseNotes.rst (original)
+++ clang-tools-extra/trunk/docs/ReleaseNotes.rst Fri Sep  2 15:39:46 2016
@@ -20,9 +20,7 @@ Introduction
 This document contains the release notes for the Extra Clang Tools, part of the
 Clang release 4.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. For the general Clang release notes, see `the Clang documentation
-`_.  All 
LLVM
-releases may be downloaded from the `LLVM releases web
+work.  All LLVM releases may be downloaded from the `LLVM releases web
 site `_.
 
 For more information about Clang or LLVM, including information about


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


Re: [PATCH] D23960: Avoid narrowing warnings in __bitset constructor

2016-09-02 Thread Dimitry Andric via cfe-commits
dim added a comment.

@mclow.lists, I tested code generation (on i386-freebsd) with this small sample 
program:

  #include 
  
  void f(const std::bitset<53>&);
  
  void g(void)
  {
std::bitset<53> bs(0x1234567890abcdef);
f(bs);
  }

The assembly doesn't change at all after this fix:

  g():  # @g()
  .cfi_startproc
  # BB#0: # %entry
  pushl   %ebp
  .Ltmp0:
  .cfi_def_cfa_offset 8
  .Ltmp1:
  .cfi_offset %ebp, -8
  movl%esp, %ebp
  .Ltmp2:
  .cfi_def_cfa_register %ebp
  andl$-8, %esp
  subl$16, %esp
  movl$-1867788817, 8(%esp)   # imm = 0x90ABCDEF
  movl$305419896, 12(%esp)# imm = 0x12345678
  leal8(%esp), %eax
  movl%eax, (%esp)
  calll   f(std::__1::bitset<53u> const&)
  movl%ebp, %esp
  popl%ebp
  retl


https://reviews.llvm.org/D23960



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


Re: [PATCH] D24201: [Clang-tools-extra] Fix links in release notes

2016-09-02 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko updated this revision to Diff 70229.
Eugene.Zelenko added a comment.

Update to trunk.


Repository:
  rL LLVM

https://reviews.llvm.org/D24201

Files:
  docs/ReleaseNotes.rst

Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -10,17 +10,17 @@
 
 .. warning::
 
-   These are in-progress notes for the upcoming Clang 4.0.0 release. You may
-   prefer the `Clang 3.8 Release Notes
-   `_.
+   These are in-progress notes for the upcoming Extra Clang Tools 4.0 release.
+   You may prefer the `Extra Clang Tools 3.9 Release Notes
+   
`_.
 
 Introduction
 
 
 This document contains the release notes for the Extra Clang Tools, part of the
-Clang release 4.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
+Clang release 4.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 `_.
 
 For more information about Clang or LLVM, including information about


Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -10,17 +10,17 @@
 
 .. warning::
 
-   These are in-progress notes for the upcoming Clang 4.0.0 release. You may
-   prefer the `Clang 3.8 Release Notes
-   `_.
+   These are in-progress notes for the upcoming Extra Clang Tools 4.0 release.
+   You may prefer the `Extra Clang Tools 3.9 Release Notes
+   `_.
 
 Introduction
 
 
 This document contains the release notes for the Extra Clang Tools, part of the
-Clang release 4.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
+Clang release 4.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 `_.
 
 For more information about Clang or LLVM, including information about
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r280543 - Avoid narrowing warnings in __bitset constructor

2016-09-02 Thread Dimitry Andric via cfe-commits
Author: dim
Date: Fri Sep  2 16:02:11 2016
New Revision: 280543

URL: http://llvm.org/viewvc/llvm-project?rev=280543&view=rev
Log:
Avoid narrowing warnings in __bitset constructor

When  is compiled with warnings enabled, on a platform where
size_t is 4 bytes, it results in errors similar to:

bitset:265:16: error: non-constant-expression cannot be narrowed
from type 'unsigned long long' to '__storage_type' (aka 'unsigned
int') in initializer list [-Wc++11-narrowing]
: __first_{__v, __v >> __bits_per_word}
   ^~~
bitset:676:52: note: in instantiation of member function
'std::__1::__bitset<2, 53>::__bitset' requested here
bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
   ^

Fix these by casting the initializer list elements to __storage_type.

Reviewers: mclow.lists, EricWF
Differential Revision: https://reviews.llvm.org/D23960

Modified:
libcxx/trunk/include/bitset

Modified: libcxx/trunk/include/bitset
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/bitset?rev=280543&r1=280542&r2=280543&view=diff
==
--- libcxx/trunk/include/bitset (original)
+++ libcxx/trunk/include/bitset Fri Sep  2 16:02:11 2016
@@ -259,7 +259,7 @@ __bitset<_N_words, _Size>::__bitset(unsi
 #if __SIZEOF_SIZE_T__ == 8
 : __first_{__v}
 #elif __SIZEOF_SIZE_T__ == 4
-: __first_{__v, __v >> __bits_per_word}
+: __first_{static_cast<__storage_type>(__v), 
static_cast<__storage_type>(__v >> __bits_per_word)}
 #else
 #error This constructor has not been ported to this platform
 #endif


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


Re: [PATCH] D23960: Avoid narrowing warnings in __bitset constructor

2016-09-02 Thread Dimitry Andric via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL280543: Avoid narrowing warnings in __bitset constructor 
(authored by dim).

Changed prior to commit:
  https://reviews.llvm.org/D23960?vs=69489&id=70231#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23960

Files:
  libcxx/trunk/include/bitset

Index: libcxx/trunk/include/bitset
===
--- libcxx/trunk/include/bitset
+++ libcxx/trunk/include/bitset
@@ -259,7 +259,7 @@
 #if __SIZEOF_SIZE_T__ == 8
 : __first_{__v}
 #elif __SIZEOF_SIZE_T__ == 4
-: __first_{__v, __v >> __bits_per_word}
+: __first_{static_cast<__storage_type>(__v), 
static_cast<__storage_type>(__v >> __bits_per_word)}
 #else
 #error This constructor has not been ported to this platform
 #endif


Index: libcxx/trunk/include/bitset
===
--- libcxx/trunk/include/bitset
+++ libcxx/trunk/include/bitset
@@ -259,7 +259,7 @@
 #if __SIZEOF_SIZE_T__ == 8
 : __first_{__v}
 #elif __SIZEOF_SIZE_T__ == 4
-: __first_{__v, __v >> __bits_per_word}
+: __first_{static_cast<__storage_type>(__v), static_cast<__storage_type>(__v >> __bits_per_word)}
 #else
 #error This constructor has not been ported to this platform
 #endif
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23895: [ms] Add support for parsing uuid as a MS attribute

2016-09-02 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
rsmith added a comment.

For submit, can you separate the changes to generally support `[]` attribute 
syntax and the changes to parse `[uuid(...)]` into distinct commits? (I'm OK 
with the `Microsoft` attribute support piece landing with no tests since the 
`uuid` patch adds the relevant testing -- and I believe that piece by itself is 
NFC.)



Comment at: test/Parser/ms-square-bracket-attributes.mm:129-131
@@ +128,5 @@
+  int uuid = 42;
+  [uuid]() {
+useit(uuid);
+  }();
+}

Please also test cases like

  [uuid(----)] { return uuid; }
  [uuid("----")] (int n) { return uuid[n]; }

(which are lambda *init-capture*s in C++14 onwards).


https://reviews.llvm.org/D23895



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


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

2016-09-02 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
This revision is now accepted and ready to land.


Comment at: lib/Sema/SemaOverload.cpp:1813-1815
@@ -1795,5 +1812,5 @@
   // and we don't know what conversions it may overlap with.
-  SCS.First = ICK_C_Only_Conversion;
-  SCS.Second = ICK_C_Only_Conversion;
-  SCS.Third = ICK_C_Only_Conversion;
+  SCS.First = ImplicitConv;
+  SCS.Second = ImplicitConv;
+  SCS.Third = ImplicitConv;
   return true;

Yuck, this violates our invariants: `First` should only ever be some kind of 
lvalue conversion (it should in this case be an `ICK_Array_To_Pointer` or 
`ICK_Function_To_Pointer` if the argument was an array or function, 
respectively, and otherwise `ICK_Identity`). `Third` should only ever be 
`ICK_Identity` or `ICK_Qualification`. It seems fine to always set `Third` to 
`ICK_Identity` and model the qualification change as part of the second 
"standard" conversion; this should still compare worse than any other sequence 
by the rank test.

Now I've noticed this, I'd like to see it fixed, but since this is pre-existing 
I don't mind whether we fix this as part of this change or separately.


Comment at: lib/Sema/SemaOverload.cpp:5931
@@ +5930,3 @@
+  (ConversionState.isStandard() &&
+   ConversionState.Standard.First ==
+   ICK_Incompatible_Pointer_Conversion)) {

You should check `Second` here rather than `First`.


https://reviews.llvm.org/D24113



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


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

2016-09-02 Thread George Burgess IV via cfe-commits
george.burgess.iv marked 2 inline comments as done.


Comment at: lib/Sema/SemaOverload.cpp:1813-1815
@@ -1795,5 +1812,5 @@
   // and we don't know what conversions it may overlap with.
-  SCS.First = ICK_C_Only_Conversion;
-  SCS.Second = ICK_C_Only_Conversion;
-  SCS.Third = ICK_C_Only_Conversion;
+  SCS.First = ImplicitConv;
+  SCS.Second = ImplicitConv;
+  SCS.Third = ImplicitConv;
   return true;

rsmith wrote:
> Yuck, this violates our invariants: `First` should only ever be some kind of 
> lvalue conversion (it should in this case be an `ICK_Array_To_Pointer` or 
> `ICK_Function_To_Pointer` if the argument was an array or function, 
> respectively, and otherwise `ICK_Identity`). `Third` should only ever be 
> `ICK_Identity` or `ICK_Qualification`. It seems fine to always set `Third` to 
> `ICK_Identity` and model the qualification change as part of the second 
> "standard" conversion; this should still compare worse than any other 
> sequence by the rank test.
> 
> Now I've noticed this, I'd like to see it fixed, but since this is 
> pre-existing I don't mind whether we fix this as part of this change or 
> separately.
I'll fix this in a follow-up commit; thanks for pointing it out!


https://reviews.llvm.org/D24113



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


r280553 - [Sema] Relax overloading restrictions in C.

2016-09-02 Thread George Burgess IV via cfe-commits
Author: gbiv
Date: Fri Sep  2 17:59:57 2016
New Revision: 280553

URL: http://llvm.org/viewvc/llvm-project?rev=280553&view=rev
Log:
[Sema] Relax overloading restrictions in C.

This patch allows us to perform incompatible pointer conversions when
resolving overloads in C. So, the following code will no longer fail to
compile (though it will still emit warnings, assuming the user hasn't
opted out of them):

```
void foo(char *) __attribute__((overloadable));
void foo(int) __attribute__((overloadable));

void callFoo() {
  unsigned char bar[128];
  foo(bar); // selects the char* overload.
}
```

These conversions are ranked below all others, so:

  A. Any other viable conversion will win out
  B. If we had another incompatible pointer conversion in the example
 above (e.g. `void foo(int *)`), we would complain about
 an ambiguity.

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

Modified:
cfe/trunk/include/clang/Basic/AttrDocs.td
cfe/trunk/include/clang/Sema/Overload.h
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/CodeGen/builtins-systemz-zvector-error.c
cfe/trunk/test/CodeGen/overloadable.c
cfe/trunk/test/Sema/overloadable.c
cfe/trunk/test/Sema/pass-object-size.c
cfe/trunk/test/SemaOpenCL/event_t_overload.cl

Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=280553&r1=280552&r2=280553&view=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Fri Sep  2 17:59:57 2016
@@ -470,6 +470,11 @@ semantics:
 * A conversion from type ``T`` to a value of type ``U`` is permitted if ``T``
   and ``U`` are compatible types.  This conversion is given "conversion" rank.
 
+* A conversion from a pointer of type ``T*`` to a pointer of type ``U*``, where
+  ``T`` and ``U`` are incompatible, is allowed, but is ranked below all other
+  types of conversions. Please note: ``U`` lacking qualifiers that are present
+  on ``T`` is sufficient for ``T`` and ``U`` to be incompatible.
+
 The declaration of ``overloadable`` functions is restricted to function
 declarations and definitions.  Most importantly, if any function with a given
 name is given the ``overloadable`` attribute, then all function declarations

Modified: cfe/trunk/include/clang/Sema/Overload.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Overload.h?rev=280553&r1=280552&r2=280553&view=diff
==
--- cfe/trunk/include/clang/Sema/Overload.h (original)
+++ cfe/trunk/include/clang/Sema/Overload.h Fri Sep  2 17:59:57 2016
@@ -84,6 +84,8 @@ namespace clang {
 ICK_Writeback_Conversion,  ///< Objective-C ARC writeback conversion
 ICK_Zero_Event_Conversion, ///< Zero constant to event (OpenCL1.2 6.12.10)
 ICK_C_Only_Conversion, ///< Conversions allowed in C, but not C++
+ICK_Incompatible_Pointer_Conversion, ///< C-only conversion between 
pointers
+ ///  with incompatible types
 ICK_Num_Conversion_Kinds,  ///< The number of conversion kinds
   };
 
@@ -97,8 +99,10 @@ namespace clang {
 ICR_Conversion,  ///< Conversion
 ICR_Complex_Real_Conversion, ///< Complex <-> Real conversion
 ICR_Writeback_Conversion,///< ObjC ARC writeback conversion
-ICR_C_Conversion ///< Conversion only allowed in the C 
standard.
+ICR_C_Conversion,///< Conversion only allowed in the C 
standard.
  ///  (e.g. void* to char*)
+ICR_C_Conversion_Extension   ///< Conversion not allowed by the C standard,
+ ///  but that we accept as an extension 
anyway.
   };
 
   ImplicitConversionRank GetConversionRank(ImplicitConversionKind Kind);

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=280553&r1=280552&r2=280553&view=diff
==
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Fri Sep  2 17:59:57 2016
@@ -3705,6 +3705,7 @@ Sema::PerformImplicitConversion(Expr *Fr
   case ICK_Qualification:
   case ICK_Num_Conversion_Kinds:
   case ICK_C_Only_Conversion:
+  case ICK_Incompatible_Pointer_Conversion:
 llvm_unreachable("Improper second standard conversion");
   }
 

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=280553&r1=280552&r2=280553&view=diff
==
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Sep  2 17:59:57 2016
@@ -136,7

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

2016-09-02 Thread George Burgess IV via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL280553: [Sema] Relax overloading restrictions in C. 
(authored by gbiv).

Changed prior to commit:
  https://reviews.llvm.org/D24113?vs=69922&id=70251#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24113

Files:
  cfe/trunk/include/clang/Basic/AttrDocs.td
  cfe/trunk/include/clang/Sema/Overload.h
  cfe/trunk/lib/Sema/SemaExprCXX.cpp
  cfe/trunk/lib/Sema/SemaOverload.cpp
  cfe/trunk/test/CodeGen/builtins-systemz-zvector-error.c
  cfe/trunk/test/CodeGen/overloadable.c
  cfe/trunk/test/Sema/overloadable.c
  cfe/trunk/test/Sema/pass-object-size.c
  cfe/trunk/test/SemaOpenCL/event_t_overload.cl

Index: cfe/trunk/lib/Sema/SemaOverload.cpp
===
--- cfe/trunk/lib/Sema/SemaOverload.cpp
+++ cfe/trunk/lib/Sema/SemaOverload.cpp
@@ -136,7 +136,8 @@
 ICR_Exact_Match, // NOTE(gbiv): This may not be completely right --
  // it was omitted by the patch that added
  // ICK_Zero_Event_Conversion
-ICR_C_Conversion
+ICR_C_Conversion,
+ICR_C_Conversion_Extension
   };
   return Rank[(int)Kind];
 }
@@ -170,7 +171,8 @@
 "Transparent Union Conversion",
 "Writeback conversion",
 "OpenCL Zero Event Conversion",
-"C specific type conversion"
+"C specific type conversion",
+"Incompatible pointer conversion"
   };
   return Name[Kind];
 }
@@ -1783,22 +1785,37 @@
 return false;
 
   ExprResult ER = ExprResult{From};
-  auto Conv = S.CheckSingleAssignmentConstraints(ToType, ER,
- /*Diagnose=*/false,
- /*DiagnoseCFAudited=*/false,
- /*ConvertRHS=*/false);
-  if (Conv != Sema::Compatible)
+  Sema::AssignConvertType Conv =
+  S.CheckSingleAssignmentConstraints(ToType, ER,
+ /*Diagnose=*/false,
+ /*DiagnoseCFAudited=*/false,
+ /*ConvertRHS=*/false);
+  ImplicitConversionKind ImplicitConv;
+  switch (Conv) {
+  case Sema::Compatible:
+ImplicitConv = ICK_C_Only_Conversion;
+break;
+  // For our purposes, discarding qualifiers is just as bad as using an
+  // incompatible pointer. Note that an IncompatiblePointer conversion can drop
+  // qualifiers, as well.
+  case Sema::CompatiblePointerDiscardsQualifiers:
+  case Sema::IncompatiblePointer:
+  case Sema::IncompatiblePointerSign:
+ImplicitConv = ICK_Incompatible_Pointer_Conversion;
+break;
+  default:
 return false;
+  }
 
   SCS.setAllToTypes(ToType);
   // We need to set all three because we want this conversion to rank terribly,
   // and we don't know what conversions it may overlap with.
-  SCS.First = ICK_C_Only_Conversion;
-  SCS.Second = ICK_C_Only_Conversion;
-  SCS.Third = ICK_C_Only_Conversion;
+  SCS.First = ImplicitConv;
+  SCS.Second = ImplicitConv;
+  SCS.Third = ImplicitConv;
   return true;
 }
-  
+
 static bool
 IsTransparentUnionStandardConversion(Sema &S, Expr* From, 
  QualType &ToType,
@@ -5105,6 +5122,7 @@
   case ICK_Writeback_Conversion:
   case ICK_Zero_Event_Conversion:
   case ICK_C_Only_Conversion:
+  case ICK_Incompatible_Pointer_Conversion:
 return false;
 
   case ICK_Lvalue_To_Rvalue:
@@ -5906,10 +5924,15 @@
 /*AllowObjCWritebackConversion=*/
 getLangOpts().ObjCAutoRefCount,
 /*AllowExplicit*/false);
-if (ConversionState.isBad()) {
-  Match = false;
-  break;
-}
+  // This function looks for a reasonably-exact match, so we consider
+  // incompatible pointer conversions to be a failure here.
+  if (ConversionState.isBad() ||
+  (ConversionState.isStandard() &&
+   ConversionState.Standard.Second ==
+   ICK_Incompatible_Pointer_Conversion)) {
+Match = false;
+break;
+  }
 }
 // Promote additional arguments to variadic methods.
 if (Match && Method->isVariadic()) {
Index: cfe/trunk/lib/Sema/SemaExprCXX.cpp
===
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp
@@ -3705,6 +3705,7 @@
   case ICK_Qualification:
   case ICK_Num_Conversion_Kinds:
   case ICK_C_Only_Conversion:
+  case ICK_Incompatible_Pointer_Conversion:
 llvm_unreachable("Improper second standard conversion");
   }
 
Index: cfe/trunk/include/clang/Sema/Overload.h
===
--- cfe/trunk/include/clang/Sema/Overload.h
+++ cfe/trunk/include/clang/Sema/Overload.h
@@ -84,6 +84,8 @@
 ICK_Writeback_Conversion,  ///< Objective-C ARC writeback conversion
 ICK_Zero_Event_Conversion, ///< Zer

r280556 - (clang part) Implement MASM-flavor intel syntax behavior for inline MS asm block.

2016-09-02 Thread Yunzhong Gao via cfe-commits
Author: ygao
Date: Fri Sep  2 18:16:06 2016
New Revision: 280556

URL: http://llvm.org/viewvc/llvm-project?rev=280556&view=rev
Log:
(clang part) Implement MASM-flavor intel syntax behavior for inline MS asm 
block.
Clang tests for verifying the following syntaxes:
1. 0xNN and NNh are accepted as valid hexadecimal numbers, but 0xNNh is not.
 
   0xNN and NNh may come with optional U or L suffix.   
 
2. NNb is accepted as a valid binary (base-2) number, but 0bNN is not.  
 
   NNb may come with optional U or L suffix.
 

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


Modified:
cfe/trunk/test/CodeGen/ms-inline-asm.c
cfe/trunk/test/CodeGenCXX/ms-inline-asm-return.cpp
cfe/trunk/test/Parser/ms-inline-asm.c

Modified: cfe/trunk/test/CodeGen/ms-inline-asm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-inline-asm.c?rev=280556&r1=280555&r2=280556&view=diff
==
--- cfe/trunk/test/CodeGen/ms-inline-asm.c (original)
+++ cfe/trunk/test/CodeGen/ms-inline-asm.c Fri Sep  2 18:16:06 2016
@@ -47,7 +47,7 @@ void t6(void) {
 
 void t7() {
   __asm {
-int 0x2c ; } asm comments are fun! }{
+int 0x2cU ; } asm comments are fun! }{
   }
   __asm {
 {
@@ -56,7 +56,7 @@ void t7() {
   }
   __asm {}
 // CHECK: t7
-// CHECK: call void asm sideeffect inteldialect "int $$0x2c", 
"~{dirflag},~{fpsr},~{flags}"()
+// CHECK: call void asm sideeffect inteldialect "int $$0x2cU", 
"~{dirflag},~{fpsr},~{flags}"()
 // CHECK: call void asm sideeffect inteldialect "", 
"~{dirflag},~{fpsr},~{flags}"()
 }
 
@@ -171,8 +171,8 @@ void t17() {
 // CHECK: t17
   __asm _emit 0x4A
 // CHECK: .byte 0x4A
-  __asm _emit 0x43
-// CHECK: .byte 0x43
+  __asm _emit 0x43L
+// CHECK: .byte 0x43L
   __asm _emit 0x4B
 // CHECK: .byte 0x4B
   __asm _EMIT 0x4B
@@ -219,11 +219,11 @@ void t20() {
 void t21() {
   __asm {
 __asm push ebx
-__asm mov ebx, 0x07
+__asm mov ebx, 07H
 __asm pop ebx
   }
 // CHECK: t21
-// CHECK: call void asm sideeffect inteldialect "push ebx\0A\09mov ebx, 
$$0x07\0A\09pop ebx", "~{ebx},~{esp},~{dirflag},~{fpsr},~{flags}"()
+// CHECK: call void asm sideeffect inteldialect "push ebx\0A\09mov ebx, 
$$07H\0A\09pop ebx", "~{ebx},~{esp},~{dirflag},~{fpsr},~{flags}"()
 }
 
 extern void t22_helper(int x);
@@ -262,15 +262,15 @@ void t24() {
 void t25() {
 // CHECK: t25
   __asm mov eax, 0h
-// CHECK: mov eax, $$4294967295
-  __asm mov eax, 0fh
+// CHECK: mov eax, $$0h
+  __asm mov eax, 0fhU
 // CHECK: mov eax, $$15
   __asm mov eax, 0a2h
+// CHECK: mov eax, $$0a2h
+  __asm mov eax, 10100010b
+// CHECK: mov eax, $$10100010b
+  __asm mov eax, 10100010BU
 // CHECK: mov eax, $$162
-  __asm mov eax, 0xa2h
-// CHECK: mov eax, $$0xa2h
-  __asm mov eax, 0xa2
-// CHECK: mov eax, $$0xa2
 // CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
 }
 

Modified: cfe/trunk/test/CodeGenCXX/ms-inline-asm-return.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/ms-inline-asm-return.cpp?rev=280556&r1=280555&r2=280556&view=diff
==
--- cfe/trunk/test/CodeGenCXX/ms-inline-asm-return.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/ms-inline-asm-return.cpp Fri Sep  2 18:16:06 2016
@@ -50,8 +50,8 @@ char f_i8() {
 
 bool f_i1() {
   __asm {
-mov eax, 1
-mov edx, 1
+mov eax, 1L
+mov edx, 1U
   }
 }
 // CHECK-LABEL: define zeroext i1 @f_i1()
@@ -80,12 +80,12 @@ struct EightChars {
 };
 EightChars f_s8() {
   __asm {
-mov eax, 0x01010101
-mov edx, 0x01010101
+mov eax, 01010101h
+mov edx, 01010101b
   }
 }
 // CHECK-LABEL: define i64 @f_s8()
-// CHECK: %[[r:[^ ]*]] = call i64 asm sideeffect inteldialect "mov eax, 
$$0x01010101\0A\09mov edx, $$0x01010101", "=A,~{eax},{{.*}}"
+// CHECK: %[[r:[^ ]*]] = call i64 asm sideeffect inteldialect "mov eax, 
$$01010101h\0A\09mov edx, $$01010101b", "=A,~{eax},{{.*}}"
 // CHECK: store i64 %[[r]], i64* %{{.*}}
 // CHECK: %[[r_i64:[^ ]*]] = load i64, i64* %{{.*}}
 // CHECK: ret i64 %[[r_i64]]

Modified: cfe/trunk/test/Parser/ms-inline-asm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/ms-inline-asm.c?rev=280556&r1=280555&r2=280556&view=diff
==
--- cfe/trunk/test/Parser/ms-inline-asm.c (original)
+++ cfe/trunk/test/Parser/ms-inline-asm.c Fri Sep  2 18:16:06 2016
@@ -7,9 +7,9 @@
 #define M2 int
 
 void t1(void) { M }
-void t2(void) { __asm int 0x2c }
-void t3(void) { __asm M2 0x2c }
-void t4(void) { __asm mov eax, fs:[0x10] }
+void t2(void) { __asm int 2ch }
+void t3(void) { __asm M2 2ch }
+void t4(void) { __asm mov eax, fs:[10h] }
 void t5() {
   __asm {
 int 0x2c ; } asm comments are fun! }{
@@ -26,7 +26,7 @@ int t6() {

LLVM master is back to work

2016-09-02 Thread Galina Kistanova via cfe-commits
Hello everyone,

The issue with the SVN mirror in the Lab has been resolved.

Please let me know if anything seems wrong with the builders.
Thank you for understanding.

Thanks

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


[libcxx] r280561 - Define _LIBCPP_SAFE_STATIC __attribute__((require_constant_initialization)), and apply it to memory_resource

2016-09-02 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Sep  2 19:11:33 2016
New Revision: 280561

URL: http://llvm.org/viewvc/llvm-project?rev=280561&view=rev
Log:
Define _LIBCPP_SAFE_STATIC  __attribute__((require_constant_initialization)), 
and apply it to memory_resource

Modified:
libcxx/trunk/include/__config
libcxx/trunk/src/experimental/memory_resource.cpp

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=280561&r1=280560&r2=280561&view=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Fri Sep  2 19:11:33 2016
@@ -907,6 +907,12 @@ extern "C" void __sanitizer_annotate_con
 #define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
 #endif
 
+#if __has_attribute(require_constant_initialization)
+#define _LIBCPP_SAFE_STATIC 
__attribute__((__require_constant_initialization__))
+#else
+#define _LIBCPP_SAFE_STATIC
+#endif
+
 #endif // __cplusplus
 
 #endif // _LIBCPP_CONFIG

Modified: libcxx/trunk/src/experimental/memory_resource.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/memory_resource.cpp?rev=280561&r1=280560&r2=280561&view=diff
==
--- libcxx/trunk/src/experimental/memory_resource.cpp (original)
+++ libcxx/trunk/src/experimental/memory_resource.cpp Fri Sep  2 19:11:33 2016
@@ -70,7 +70,12 @@ union ResourceInitHelper {
 };
 // When compiled in C++14 this initialization should be a constant expression.
 // Only in C++11 is "init_priority" needed to ensure initialization order.
-ResourceInitHelper res_init __attribute__((init_priority (101)));
+#if _LIBCPP_STD_VER > 11
+_LIBCPP_SAFE_STATIC
+#else
+ __attribute__((init_priority (101)))
+#endif
+ResourceInitHelper res_init;
 
 } // end namespace
 
@@ -89,7 +94,7 @@ static memory_resource *
 __default_memory_resource(bool set = false, memory_resource * new_res = 
nullptr) _NOEXCEPT
 {
 #ifndef _LIBCPP_HAS_NO_ATOMIC_HEADER
-static atomic __res =
+_LIBCPP_SAFE_STATIC static atomic __res =
 ATOMIC_VAR_INIT(&res_init.resources.new_delete_res);
 if (set) {
 new_res = new_res ? new_res : new_delete_resource();
@@ -102,7 +107,7 @@ __default_memory_resource(bool set = fal
 &__res, memory_order::memory_order_acquire);
 }
 #elif !defined(_LIBCPP_HAS_NO_THREADS)
-static memory_resource * res = &res_init.resources.new_delete_res;
+_LIBCPP_SAFE_STATIC static memory_resource * res = 
&res_init.resources.new_delete_res;
 static mutex res_lock;
 if (set) {
 new_res = new_res ? new_res : new_delete_resource();
@@ -115,7 +120,7 @@ __default_memory_resource(bool set = fal
 return res;
 }
 #else
-static memory_resource* res = &res_init.resources.new_delete_res;
+_LIBCPP_SAFE_STATIC static memory_resource* res = 
&res_init.resources.new_delete_res;
 if (set) {
 new_res = new_res ? new_res : new_delete_resource();
 memory_resource * old_res = res;


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


r280562 - [Sema] Fix how we set implicit conversion kinds.

2016-09-02 Thread George Burgess IV via cfe-commits
Author: gbiv
Date: Fri Sep  2 19:28:25 2016
New Revision: 280562

URL: http://llvm.org/viewvc/llvm-project?rev=280562&view=rev
Log:
[Sema] Fix how we set implicit conversion kinds.

We have invariants we like to guarantee for the
`ImplicitConversionKind`s in a `StandardConversionSequence`. These
weren't being upheld in code that r280553 touched, so Richard suggested
that we should fix that. See D24113.

I'm not entirely sure how to go about testing this, so no test case is
included. Suggestions welcome.

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

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=280562&r1=280561&r2=280562&view=diff
==
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Sep  2 19:28:25 2016
@@ -1790,10 +1790,10 @@ static bool IsStandardConversion(Sema &S
  /*Diagnose=*/false,
  /*DiagnoseCFAudited=*/false,
  /*ConvertRHS=*/false);
-  ImplicitConversionKind ImplicitConv;
+  ImplicitConversionKind SecondConv;
   switch (Conv) {
   case Sema::Compatible:
-ImplicitConv = ICK_C_Only_Conversion;
+SecondConv = ICK_C_Only_Conversion;
 break;
   // For our purposes, discarding qualifiers is just as bad as using an
   // incompatible pointer. Note that an IncompatiblePointer conversion can drop
@@ -1801,18 +1801,24 @@ static bool IsStandardConversion(Sema &S
   case Sema::CompatiblePointerDiscardsQualifiers:
   case Sema::IncompatiblePointer:
   case Sema::IncompatiblePointerSign:
-ImplicitConv = ICK_Incompatible_Pointer_Conversion;
+SecondConv = ICK_Incompatible_Pointer_Conversion;
 break;
   default:
 return false;
   }
 
-  SCS.setAllToTypes(ToType);
-  // We need to set all three because we want this conversion to rank terribly,
-  // and we don't know what conversions it may overlap with.
-  SCS.First = ImplicitConv;
-  SCS.Second = ImplicitConv;
-  SCS.Third = ImplicitConv;
+  // First can only be an lvalue conversion, so we pretend that this was the
+  // second conversion. First should already be valid from earlier in the
+  // function.
+  SCS.Second = SecondConv;
+  SCS.setToType(1, ToType);
+
+  // Third is Identity, because Second should rank us worse than any other
+  // conversion. This could also be ICK_Qualification, but it's simpler to just
+  // lump everything in with the second conversion, and we don't gain anything
+  // from making this ICK_Qualification.
+  SCS.Third = ICK_Identity;
+  SCS.setToType(2, ToType);
   return true;
 }
 


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


Re: [PATCH] D23957: Replace the Radeon GCN GPU family names by more descriptive ones

2016-09-02 Thread Tom Stellard via cfe-commits
tstellarAMD accepted this revision.
tstellarAMD added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks for doing this.


https://reviews.llvm.org/D23957



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


r280572 - Remove function name from comment.

2016-09-02 Thread Nico Weber via cfe-commits
Author: nico
Date: Fri Sep  2 21:41:17 2016
New Revision: 280572

URL: http://llvm.org/viewvc/llvm-project?rev=280572&view=rev
Log:
Remove function name from comment.

The comment starting with "ParseDeclarationOrFunctionDefinition -" is above
a function called ParseDeclOrFunctionDefInternal.  Fix the comment by not
mentioning a function name, like the style guide requests nowadays.  No behavior
change.

Modified:
cfe/trunk/lib/Parse/Parser.cpp

Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=280572&r1=280571&r2=280572&view=diff
==
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Fri Sep  2 21:41:17 2016
@@ -892,11 +892,10 @@ bool Parser::isStartOfFunctionDefinition
  Tok.is(tok::kw_try);  // X() try { ... }
 }
 
-/// ParseDeclarationOrFunctionDefinition - Parse either a function-definition 
or
-/// a declaration.  We can't tell which we have until we read up to the
-/// compound-statement in function-definition. TemplateParams, if
-/// non-NULL, provides the template parameters when we're parsing a
-/// C++ template-declaration.
+/// Parse either a function-definition or a declaration.  We can't tell which
+/// we have until we read up to the compound-statement in function-definition.
+/// TemplateParams, if non-NULL, provides the template parameters when we're
+/// parsing a C++ template-declaration.
 ///
 ///   function-definition: [C99 6.9.1]
 /// decl-specs  declarator declaration-list[opt] compound-statement
@@ -991,7 +990,7 @@ Parser::ParseDeclarationOrFunctionDefini
 // parsing c constructs and re-enter objc container scope
 // afterwards.
 ObjCDeclContextSwitch ObjCDC(*this);
-  
+
 return ParseDeclOrFunctionDefInternal(attrs, PDS, AS);
   }
 }


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


r280574 - Move calls of MaybeParseMicrosoftAttributes() before ParseExternalDeclaration()

2016-09-02 Thread Nico Weber via cfe-commits
Author: nico
Date: Fri Sep  2 21:48:03 2016
New Revision: 280574

URL: http://llvm.org/viewvc/llvm-project?rev=280574&view=rev
Log:
Move calls of MaybeParseMicrosoftAttributes() before ParseExternalDeclaration()
into ParseDeclOrFunctionDefInternal() (which is called by
MaybeParseMicrosoftAttributes()), so that the attributes can be stored in
the DeclSpec.  No behavior change yet, part of https://reviews.llvm.org/D23895

Modified:
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/lib/Parse/ParseOpenMP.cpp
cfe/trunk/lib/Parse/Parser.cpp

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=280574&r1=280573&r2=280574&view=diff
==
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Fri Sep  2 21:48:03 2016
@@ -217,7 +217,6 @@ void Parser::ParseInnerNamespace(std::ve
Tok.isNot(tok::eof)) {
   ParsedAttributesWithRange attrs(AttrFactory);
   MaybeParseCXX11Attributes(attrs);
-  MaybeParseMicrosoftAttributes(attrs);
   ParseExternalDeclaration(attrs);
 }
 
@@ -310,7 +309,6 @@ Decl *Parser::ParseLinkage(ParsingDeclSp
 
   ParsedAttributesWithRange attrs(AttrFactory);
   MaybeParseCXX11Attributes(attrs);
-  MaybeParseMicrosoftAttributes(attrs);
 
   if (Tok.isNot(tok::l_brace)) {
 // Reset the source range in DS, as the leading "extern"
@@ -361,7 +359,6 @@ Decl *Parser::ParseLinkage(ParsingDeclSp
 default:
   ParsedAttributesWithRange attrs(AttrFactory);
   MaybeParseCXX11Attributes(attrs);
-  MaybeParseMicrosoftAttributes(attrs);
   ParseExternalDeclaration(attrs);
   continue;
 }

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=280574&r1=280573&r2=280574&view=diff
==
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Fri Sep  2 21:48:03 2016
@@ -2238,7 +2238,6 @@ Parser::ParseObjCAtImplementationDeclara
 while (!ObjCImplParsing.isFinished() && !isEofOrEom()) {
   ParsedAttributesWithRange attrs(AttrFactory);
   MaybeParseCXX11Attributes(attrs);
-  MaybeParseMicrosoftAttributes(attrs);
   if (DeclGroupPtrTy DGP = ParseExternalDeclaration(attrs)) {
 DeclGroupRef DG = DGP.get();
 DeclsInGroup.append(DG.begin(), DG.end());

Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=280574&r1=280573&r2=280574&view=diff
==
--- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original)
+++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Fri Sep  2 21:48:03 2016
@@ -610,7 +610,6 @@ Parser::DeclGroupPtrTy Parser::ParseOpen
   if (AS == AS_none) {
 assert(TagType == DeclSpec::TST_unspecified);
 MaybeParseCXX11Attributes(Attrs);
-MaybeParseMicrosoftAttributes(Attrs);
 ParsingDeclSpec PDS(*this);
 Ptr = ParseExternalDeclaration(Attrs, &PDS);
   } else {
@@ -672,7 +671,6 @@ Parser::DeclGroupPtrTy Parser::ParseOpen
Tok.isNot(tok::eof) && Tok.isNot(tok::r_brace)) {
   ParsedAttributesWithRange attrs(AttrFactory);
   MaybeParseCXX11Attributes(attrs);
-  MaybeParseMicrosoftAttributes(attrs);
   ParseExternalDeclaration(attrs);
   if (Tok.isAnnotation() && Tok.is(tok::annot_pragma_openmp)) {
 TentativeParsingAction TPA(*this);

Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=280574&r1=280573&r2=280574&view=diff
==
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Fri Sep  2 21:48:03 2016
@@ -624,7 +624,6 @@ bool Parser::ParseTopLevelDecl(DeclGroup
 
   ParsedAttributesWithRange attrs(AttrFactory);
   MaybeParseCXX11Attributes(attrs);
-  MaybeParseMicrosoftAttributes(attrs);
 
   Result = ParseExternalDeclaration(attrs);
   return false;
@@ -911,6 +910,7 @@ Parser::DeclGroupPtrTy
 Parser::ParseDeclOrFunctionDefInternal(ParsedAttributesWithRange &attrs,
ParsingDeclSpec &DS,
AccessSpecifier AS) {
+  MaybeParseMicrosoftAttributes(DS.getAttributes());
   // Parse the common declaration-specifiers piece.
   ParseDeclarationSpecifiers(DS, ParsedTemplateInfo(), AS, DSC_top_level);
 
@@ -2026,7 +2026,6 @@ void Parser::ParseMicrosoftIfExistsExter
   while (Tok.isNot(tok::r_brace) && !isEofOrEom()) {
 ParsedAttributesWithRange attrs(AttrFactory);
 MaybeParseCXX11Attributes(attrs);
-MaybeParseMicrosoftAttributes(attrs);
 DeclGroupPtrTy Result = ParseE

r280575 - Add plumbing for new attribute type "Microsoft".

2016-09-02 Thread Nico Weber via cfe-commits
Author: nico
Date: Fri Sep  2 21:55:10 2016
New Revision: 280575

URL: http://llvm.org/viewvc/llvm-project?rev=280575&view=rev
Log:
Add plumbing for new attribute type "Microsoft".

This is for attributes in []-delimited lists preceding a class, like e.g.
`[uuid("...")] class Foo {};`  Not used by anything yet, so no behavior change.
Part of https://reviews.llvm.org/D23895

Modified:
cfe/trunk/include/clang/Basic/Attributes.h
cfe/trunk/include/clang/Sema/AttributeList.h
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/include/clang/Basic/Attributes.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attributes.h?rev=280575&r1=280574&r2=280575&view=diff
==
--- cfe/trunk/include/clang/Basic/Attributes.h (original)
+++ cfe/trunk/include/clang/Basic/Attributes.h Fri Sep  2 21:55:10 2016
@@ -22,6 +22,8 @@ enum class AttrSyntax {
   GNU,
   /// Is the identifier known as a __declspec-style attribute?
   Declspec,
+  /// Is the identifier known as a [] Microsoft-style attribute?
+  Microsoft,
   // Is the identifier known as a C++-style attribute?
   CXX,
   // Is the identifier known as a pragma attribute?

Modified: cfe/trunk/include/clang/Sema/AttributeList.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/AttributeList.h?rev=280575&r1=280574&r2=280575&view=diff
==
--- cfe/trunk/include/clang/Sema/AttributeList.h (original)
+++ cfe/trunk/include/clang/Sema/AttributeList.h Fri Sep  2 21:55:10 2016
@@ -101,12 +101,14 @@ public:
 AS_CXX11,
 /// __declspec(...)
 AS_Declspec,
+/// [uuid("...")] class Foo
+AS_Microsoft,
 /// __ptr16, alignas(...), etc.
 AS_Keyword,
 /// Context-sensitive version of a keyword attribute.
 AS_ContextSensitiveKeyword,
 /// #pragma ...
-AS_Pragma
+AS_Pragma,
   };
 
 private:
@@ -369,6 +371,7 @@ public:
   }
 
   bool isDeclspecAttribute() const { return SyntaxUsed == AS_Declspec; }
+  bool isMicrosoftAttribute() const { return SyntaxUsed == AS_Microsoft; }
   bool isCXX11Attribute() const {
 return SyntaxUsed == AS_CXX11 || isAlignasAttribute();
   }

Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=280575&r1=280574&r2=280575&view=diff
==
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Fri Sep  2 21:55:10 2016
@@ -1312,6 +1312,9 @@ writePrettyPrintFunction(Record &R,
 } else if (Variety == "Declspec") {
   Prefix = " __declspec(";
   Suffix = ")";
+} else if (Variety == "Microsoft") {
+  Prefix = "[";
+  Suffix = "]";
 } else if (Variety == "Keyword") {
   Prefix = " ";
   Suffix = "";
@@ -2295,7 +2298,7 @@ void EmitClangAttrHasAttrImpl(RecordKeep
   // Separate all of the attributes out into four group: generic, C++11, GNU,
   // and declspecs. Then generate a big switch statement for each of them.
   std::vector Attrs = Records.getAllDerivedDefinitions("Attr");
-  std::vector Declspec, GNU, Pragma;
+  std::vector Declspec, Microsoft, GNU, Pragma;
   std::map> CXX;
 
   // Walk over the list of all attributes, and split them out based on the
@@ -2308,6 +2311,8 @@ void EmitClangAttrHasAttrImpl(RecordKeep
 GNU.push_back(R);
   else if (Variety == "Declspec")
 Declspec.push_back(R);
+  else if (Variety == "Microsoft")
+Microsoft.push_back(R);
   else if (Variety == "CXX11")
 CXX[SI.nameSpace()].push_back(R);
   else if (Variety == "Pragma")
@@ -2323,6 +2328,9 @@ void EmitClangAttrHasAttrImpl(RecordKeep
   OS << "case AttrSyntax::Declspec:\n";
   OS << "  return llvm::StringSwitch(Name)\n";
   GenerateHasAttrSpellingStringSwitch(Declspec, OS, "Declspec");
+  OS << "case AttrSyntax::Microsoft:\n";
+  OS << "  return llvm::StringSwitch(Name)\n";
+  GenerateHasAttrSpellingStringSwitch(Microsoft, OS, "Microsoft");
   OS << "case AttrSyntax::Pragma:\n";
   OS << "  return llvm::StringSwitch(Name)\n";
   GenerateHasAttrSpellingStringSwitch(Pragma, OS, "Pragma");
@@ -2361,8 +2369,9 @@ void EmitClangAttrSpellingListIndex(Reco
 .Case("GNU", 0)
 .Case("CXX11", 1)
 .Case("Declspec", 2)
-.Case("Keyword", 3)
-.Case("Pragma", 4)
+.Case("Microsoft", 3)
+.Case("Keyword", 4)
+.Case("Pragma", 5)
 .Default(0)
  << " && Scope == \"" << Spellings[I].nameSpace() << "\")\n"
  << "return " << I << ";\n";
@@ -2984,7 +2993,8 @@ void EmitClangAttrParsedAttrKinds(Record
   emitSourceFileHeader("Attribute name matcher", OS);
 
   std::vector Attrs = Records.getAll

r280576 - Let Microsoft attributes apply to the type, not the variable.

2016-09-02 Thread Nico Weber via cfe-commits
Author: nico
Date: Fri Sep  2 22:01:32 2016
New Revision: 280576

URL: http://llvm.org/viewvc/llvm-project?rev=280576&view=rev
Log:
Let Microsoft attributes apply to the type, not the variable.

There was already a function that moved attributes off the declspec into
an attribute list for attributes applying to the type, teach that function to
also move Microsoft attributes around and rename it to match its new broader
role.

Nothing uses Microsoft attributes yet, so no behavior change.

Part of https://reviews.llvm.org/D23895

Modified:
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseDeclCXX.cpp

Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=280576&r1=280575&r2=280576&view=diff
==
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Fri Sep  2 22:01:32 2016
@@ -2106,8 +2106,8 @@ private:
   void DiagnoseMisplacedCXX11Attribute(ParsedAttributesWithRange &Attrs,
SourceLocation CorrectLocation);
 
-  void handleDeclspecAlignBeforeClassKey(ParsedAttributesWithRange &Attrs,
- DeclSpec &DS, Sema::TagUseKind TUK);
+  void stripTypeAttributesOffDeclSpec(ParsedAttributesWithRange &Attrs,
+  DeclSpec &DS, Sema::TagUseKind TUK);
 
   void ProhibitAttributes(ParsedAttributesWithRange &attrs) {
 if (!attrs.Range.isValid()) return;

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=280576&r1=280575&r2=280576&view=diff
==
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Fri Sep  2 22:01:32 2016
@@ -1423,11 +1423,16 @@ void Parser::ProhibitCXX11Attributes(Par
   }
 }
 
+// Usually, `__attribute__((attrib)) class Foo {} var` means that attribute
+// applies to var, not the type Foo.
 // As an exception to the rule, __declspec(align(...)) before the
 // class-key affects the type instead of the variable.
-void Parser::handleDeclspecAlignBeforeClassKey(ParsedAttributesWithRange 
&Attrs,
-   DeclSpec &DS,
-   Sema::TagUseKind TUK) {
+// Also, Microsoft-style [attributes] seem to affect the type instead of the
+// variable.
+// This function moves attributes that should apply to the type off DS to 
Attrs.
+void Parser::stripTypeAttributesOffDeclSpec(ParsedAttributesWithRange &Attrs,
+DeclSpec &DS,
+Sema::TagUseKind TUK) {
   if (TUK == Sema::TUK_Reference)
 return;
 
@@ -1437,10 +1442,9 @@ void Parser::handleDeclspecAlignBeforeCl
   while (AL) {
 AttributeList *Next = AL->getNext();
 
-// We only consider attributes using the appropriate '__declspec' spelling.
-// This behavior doesn't extend to any other spellings.
-if (AL->getKind() == AttributeList::AT_Aligned &&
-AL->isDeclspecAttribute()) {
+if ((AL->getKind() == AttributeList::AT_Aligned &&
+ AL->isDeclspecAttribute()) ||
+AL->isMicrosoftAttribute()) {
   // Stitch the attribute into the tag's attribute list.
   AL->setNext(nullptr);
   Attrs.add(AL);
@@ -4071,7 +4075,7 @@ void Parser::ParseEnumSpecifier(SourceLo
 return;
   }
 
-  handleDeclspecAlignBeforeClassKey(attrs, DS, TUK);
+  stripTypeAttributesOffDeclSpec(attrs, DS, TUK);
 
   Sema::SkipBodyInfo SkipBody;
   if (!Name && TUK == Sema::TUK_Definition && Tok.is(tok::l_brace) &&

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=280576&r1=280575&r2=280576&view=diff
==
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Fri Sep  2 22:01:32 2016
@@ -1739,7 +1739,7 @@ void Parser::ParseClassSpecifier(tok::To
   TParams =
 MultiTemplateParamsArg(&(*TemplateParams)[0], TemplateParams->size());
 
-handleDeclspecAlignBeforeClassKey(attrs, DS, TUK);
+stripTypeAttributesOffDeclSpec(attrs, DS, TUK);
 
 // Declaration or definition of a class type
 TagOrTempResult = Actions.ActOnTag(getCurScope(), TagType, TUK, StartLoc,


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


r280578 - [ms] Add support for parsing uuid as a Microsoft attribute.

2016-09-02 Thread Nico Weber via cfe-commits
Author: nico
Date: Fri Sep  2 22:25:22 2016
New Revision: 280578

URL: http://llvm.org/viewvc/llvm-project?rev=280578&view=rev
Log:
[ms] Add support for parsing uuid as a Microsoft attribute.

Some Windows SDK classes, for example
Windows::Storage::Streams::IBufferByteAccess, use the ATL way of spelling
attributes:

  [uuid("")] class IBufferByteAccess {};

To be able to use __uuidof() to grab the uuid off these types, clang needs to
support uuid as a Microsoft attribute. There was already code to skip Microsoft
attributes, extend that to look for uuid and parse it.  Use the new "Microsoft"
attribute type added in r280575 (and r280574, r280576) for this.

Final part of https://reviews.llvm.org/D23895

Added:
cfe/trunk/test/Parser/ms-square-bracket-attributes.mm
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/test/CodeGenCXX/microsoft-uuidof.cpp
cfe/trunk/test/Parser/MicrosoftExtensions.cpp
cfe/trunk/test/Sema/MicrosoftExtensions.c

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=280578&r1=280577&r2=280578&view=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Fri Sep  2 22:25:22 2016
@@ -198,6 +198,7 @@ class Spelling : Spelling;
 class Declspec : Spelling;
+class Microsoft : Spelling;
 class CXX11
 : Spelling {
   string Namespace = namespace;
@@ -1584,7 +1585,7 @@ def Used : InheritableAttr {
 }
 
 def Uuid : InheritableAttr {
-  let Spellings = [Declspec<"uuid">];
+  let Spellings = [Declspec<"uuid">, Microsoft<"uuid">];
   let Args = [StringArgument<"Guid">];
 //  let Subjects = SubjectList<[CXXRecord]>;
   let LangOpts = [MicrosoftExt, Borland];

Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=280578&r1=280577&r2=280578&view=diff
==
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Fri Sep  2 22:25:22 2016
@@ -2212,6 +2212,7 @@ private:
 if (getLangOpts().MicrosoftExt && Tok.is(tok::l_square))
   ParseMicrosoftAttributes(attrs, endLoc);
   }
+  void ParseMicrosoftUuidAttributeArgs(ParsedAttributes &Attrs);
   void ParseMicrosoftAttributes(ParsedAttributes &attrs,
 SourceLocation *endLoc = nullptr);
   void MaybeParseMicrosoftDeclSpecs(ParsedAttributes &Attrs,

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=280578&r1=280577&r2=280578&view=diff
==
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Fri Sep  2 22:25:22 2016
@@ -3922,6 +3922,93 @@ SourceLocation Parser::SkipCXX11Attribut
   return EndLoc;
 }
 
+/// Parse uuid() attribute when it appears in a [] Microsoft attribute.
+void Parser::ParseMicrosoftUuidAttributeArgs(ParsedAttributes &Attrs) {
+  assert(Tok.is(tok::identifier) && "Not a Microsoft attribute list");
+  IdentifierInfo *UuidIdent = Tok.getIdentifierInfo();
+  assert(UuidIdent->getName() == "uuid" && "Not a Microsoft attribute list");
+
+  SourceLocation UuidLoc = Tok.getLocation();
+  ConsumeToken();
+
+  // Ignore the left paren location for now.
+  BalancedDelimiterTracker T(*this, tok::l_paren);
+  if (T.consumeOpen()) {
+Diag(Tok, diag::err_expected) << tok::l_paren;
+return;
+  }
+
+  ArgsVector ArgExprs;
+  if (Tok.is(tok::string_literal)) {
+// Easy case: uuid("...") -- quoted string.
+ExprResult StringResult = ParseStringLiteralExpression();
+if (StringResult.isInvalid())
+  return;
+ArgExprs.push_back(StringResult.get());
+  } else {
+// something like uuid({00A0---C000-0049}) -- no
+// quotes in the parens. Just append the spelling of all tokens encountered
+// until the closing paren.
+
+SmallString<42> StrBuffer; // 2 "", 36 bytes UUID, 2 optional {}, 1 nul
+StrBuffer += "\"";
+
+// Since none of C++'s keywords match [a-f]+, accepting just tok::l_brace,
+// tok::r_brace, tok::minus, tok::identifier (think C000) and
+// tok::numeric_constant () should be enough. But the spelling of the
+// uuid argument is checked later anyways, so there's no harm in accepting
+// almost anything here.
+// cl is very strict about whitespace in this form and errors out if any
+// is present, so check the space flags on the tokens.
+SourceLocation StartLoc = Tok.getLocation();
+while (Tok.isNot(tok::r_paren)) {
+  if (Tok.hasLeadingSpace() || Tok.isAtStartOfLine()) {
+Diag(Tok, diag::err_attribute_uuid_m

Re: [PATCH] D23895: [ms] Add support for parsing uuid as a MS attribute

2016-09-02 Thread Nico Weber via cfe-commits
thakis closed this revision.
thakis marked an inline comment as done.
thakis added a comment.

Thanks! Landed in r280574 r280575 r280576 280578.


https://reviews.llvm.org/D23895



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


r280580 - Add a test Aaron asked for that I forgot to add before landing r280578.

2016-09-02 Thread Nico Weber via cfe-commits
Author: nico
Date: Fri Sep  2 23:27:14 2016
New Revision: 280580

URL: http://llvm.org/viewvc/llvm-project?rev=280580&view=rev
Log:
Add a test Aaron asked for that I forgot to add before landing r280578.

Modified:
cfe/trunk/test/Parser/ms-square-bracket-attributes.mm

Modified: cfe/trunk/test/Parser/ms-square-bracket-attributes.mm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/ms-square-bracket-attributes.mm?rev=280580&r1=280579&r2=280580&view=diff
==
--- cfe/trunk/test/Parser/ms-square-bracket-attributes.mm (original)
+++ cfe/trunk/test/Parser/ms-square-bracket-attributes.mm Fri Sep  2 23:27:14 
2016
@@ -41,6 +41,8 @@ namespace {
 [uuid("{00A0---C000-0049}", "1")] struct S {};
 // expected-error@+1 {{expected '('}}
 [uuid{"00A0---C000-0049"}] struct T {};
+// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
+[uuid("00A0---C000-0049"}] struct U {};
 
 
 // In addition to uuids in string literals, cl also allows uuids that are not


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


Re: [PATCH] D24201: [Clang-tools-extra] Fix links in release notes

2016-09-02 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

LG. Thank you!


Repository:
  rL LLVM

https://reviews.llvm.org/D24201



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