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

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

In D68554#1697857 , @mitchell-stellar 
wrote:

> I don't care for the command line switches that try to emulate compiler 
> flags. I am also of the opinion that external scripts should be used for this 
> functionality. git for Windows gives you a full set of bash utilities to 
> utilize, so doing stuff like this on Windows is much easier now.


For me, this is about easy integration into IDEs and build systems of a variety 
of flavours (make,cmake,msbuild,VS,etc..) so clang-format can be run as a 
pre/post build step.

It's not that it can't be done without using a series of scripts and additional 
processes like find/python/grep etc.. its just its a right pain! I often find I 
have to jump through hoops to get Visual Studio's build steps to work calling 
external scripts, (often calling a .bat file, which runs a bash file etc...) 
pulling some of that functionality into clang-format prevents the need to jump 
through those hoops. (I see this as no different to grep having a -r option? 
why do that when you could use find?)

The ironic thing is I run this on my local build for clang-format itself and it 
catches when people ask me to land their patches but they haven't remembered to 
git clang-format, and that is the point of the proposal, people either can't or 
don't run arc lint, they forget to run git clang-format and code creeps back in 
(even into clang-format) that is unformatted.

This is why it needs to be part of the build step and it needs to present 
itself in a way people are expecting from a compiler, especially so the 
buildbot picks this output up and presents it as a warning, and ultimately so 
we can stop saying in code review "please clang format".

The compiler like switches -Werror, and -ferror-limit=1 allow you to either 
stop your build or get a single warning per file giving you fine control about 
how invasive this is for your build output.

Having the output emulate the compiler output also has the added advantage of 
allowing a user to double click on the error/warning in visual studio and be 
taken to the exact format violation, (this has been especially useful as I 
inspect the C# in .NET core, whilst I try to work out what rules I'm missing 
for formatting C#), I could see the same would be useful for someone adopting 
clang-format and trying to determine which options to use and exactly how much 
code will change. (again this is something I use on clang-format myself when we 
make a code change, I quickly run this over a known formatted source tree to 
see what files are going to change if any, this lets me assess the change 
beyond what the unit tests are testing)

In case others are interested, I've landed this behaviour in my own 
experimental fork and made a release if people would like to try.  
https://github.com/mydeveloperday/clang-experimental

I take your points, but I think its worth it, given how simple the change is.


Repository:
  rC Clang

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

https://reviews.llvm.org/D68554



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


[PATCH] D68539: [clang-tidy] fix for readability-identifier-naming incorrectly fixes variables which become keywords

2019-10-08 Thread Daniel via Phabricator via cfe-commits
Daniel599 added a comment.

In D68539#1696864 , @MyDeveloperDay 
wrote:

> I logged the original bug and I like it!
>
> I think the warning is better than mutating with a prefix, Thank you.
>
> I'll let the code owners approve it, but you have my vote!


glad to hear it :)
I saw this issue when I submitted mine 
(https://bugs.llvm.org/show_bug.cgi?id=43306) which for now seems to be a 
harder fix, still looking for solution there.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68539



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


[PATCH] D67536: [WIP] [clangd] Add support for an inactive regions notification

2019-10-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment.

In D67536#1697825 , @sammccall wrote:

> So I don't think clients will/should prefer that - for best rendering they 
> should know this is a line highlight.


I have actually seen clients that just make the text gray and it looks pretty 
nice (ReSharper for Visual Studio and IntelliJ IDEA definitely do that).
It also lets them consistently highlight part of the line (e.g. dead 
expressions or statements can be marked in gray even if they are on the same 
line).

So I wouldn't be so sure, at least some clients might prefer to do exclusively 
range (as opposed to line-based) highlightings.

PS Sorry if this was discussed before and I'm just missing context.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67536



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


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

2019-10-08 Thread Jonas Paulsson via Phabricator via cfe-commits
jonpa added a comment.

ping!


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

https://reviews.llvm.org/D67763



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


[PATCH] D68028: [clang] Add no_builtin attribute

2019-10-08 Thread Guillaume Chatelet via Phabricator via cfe-commits
gchatelet marked 2 inline comments as done.
gchatelet added inline comments.



Comment at: clang/lib/Sema/SemaDeclAttr.cpp:1098-1099
+
+  if (D->hasAttr())
+D->dropAttr();
+

aaron.ballman wrote:
> gchatelet wrote:
> > gchatelet wrote:
> > > aaron.ballman wrote:
> > > > Just making sure I understand the semantics you want: redeclarations do 
> > > > not have to have matching lists of builtins, but instead the definition 
> > > > will use a merged list? e.g.,
> > > > ```
> > > > [[clang::no_builtin("memset")]] void whatever();
> > > > [[clang::no_builtin("memcpy")]] void whatever();
> > > > 
> > > > [[clang::no_builtin("memmove")]] void whatever() {
> > > >  // Will not use memset, memcpy, or memmove builtins.
> > > > }
> > > > ```
> > > > That seems a bit strange, to me. In fact, being able to apply this 
> > > > attribute to a declaration seems a bit like a mistake -- this only 
> > > > impacts the definition of the function, and I can't imagine good things 
> > > > coming from hypothetical code like:
> > > > ```
> > > > [[clang::no_builtin("memset")]] void whatever();
> > > > #include "whatever.h" // Provides a library declaration of whatever() 
> > > > with no restrictions on it
> > > > ```
> > > > WDYT about restricting this attribute to only appear on definitions?
> > > That's a very good point. Thx for noticing.
> > > Indeed I think it only makes sense to have the attribute on the function 
> > > definition.
> > > 
> > > I've tried to to use `FunctionDecl->hasBody()` during attribute handling 
> > > in the Sema phase but it seems like the `FunctionDecl` is not complete at 
> > > this point.
> > > All calls to `hasBody()` return `false`, if I repeat the operation in 
> > > `CGCall` then `hasBody` returns `true` and I can see the 
> > > `CompoundStatement`.
> > > 
> > > Do you have any recommendations on where to perform the check?
> > So after some investigations it turns out that 
> > `FunctionDecl::isThisDeclarationADefinition` is buggy (returns always 
> > `false`) when called from `ProcessDeclAttribute`.
> > I believe it's because the `CompoundStatement` is not parsed at this point.
> > 
> > As a matter of fact all code using this function in `ProcessDeclAttribute` 
> > is dead code (see D68379 which disables the dead code, tests are still 
> > passing)
> > 
> > 
> > I'm unsure of how to fix this, it may be possible of using 
> > `FunctionDecl::setWillHaveBody`in [[ 
> > https://github.com/llvm/llvm-project/blob/0577a0cedbc5be4cd4c20ba53d3dbdac6bff9a0a/clang/lib/Sema/SemaDecl.cpp#L8820
> >  | this switch ]].
> > So after some investigations it turns out that 
> > FunctionDecl::isThisDeclarationADefinition is buggy (returns always false) 
> > when called from ProcessDeclAttribute.
> 
> That is a bit odd to me; we call it in a half dozen places in 
> SemaDeclAttr.cpp, all of which get called from `ProcessDeclAttribute`. Are 
> ALL of those uses broken currently?!
> 
> > As a matter of fact all code using this function in ProcessDeclAttribute is 
> > dead code (see D68379 which disables the dead code, tests are still passing)
> 
> You got four of the six. What about the use in 
> `handleObjCSuppresProtocolAttr()` and the second use in `handleAliasAttr()`?
> 
> > I'm unsure of how to fix this, it may be possible of using 
> > FunctionDecl::setWillHaveBodyin this switch.
> 
> I'm also unsure of a good way forward. @rsmith may have ideas too.
> That is a bit odd to me; we call it in a half dozen places in 
> SemaDeclAttr.cpp, all of which get called from ProcessDeclAttribute. Are ALL 
> of those uses broken currently?!
> You got four of the six. What about the use in 
> handleObjCSuppresProtocolAttr() and the second use in handleAliasAttr()?

It really is `FunctionDecl::isThisDeclarationADefinition` that is buggy, the 
other places where we call `isThisDeclarationADefinition` in `SemaDeclAttr.cpp` 
are ok, i.e. `VarDecl::isThisDeclarationADefinition` and 
`ObjCProtocolDecl::isThisDeclarationADefinition`

I tried to use `FunctionDecl::setWillHaveBody`but it broke many tests so it 
seems inappropriate.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68028



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


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

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

@steakhal Thanks for this patch. I tried it on Firefox and it found a bunch of 
stuff we improved.
Some examples:
https://hg.mozilla.org/integration/autoland/rev/db24db8f5f549ff446d1c3c69799187bcc2409e2
https://hg.mozilla.org/integration/autoland/rev/5de53dab979a401d9ba1405974f691927e53c9bd
(and more to come)

I think it should be added to the release notes!


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66733



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


r374032 - Remove an useless allocation (from by clang-analyzer/scan-build)

2019-10-08 Thread Sylvestre Ledru via cfe-commits
Author: sylvestre
Date: Tue Oct  8 02:17:46 2019
New Revision: 374032

URL: http://llvm.org/viewvc/llvm-project?rev=374032&view=rev
Log:
Remove an useless allocation (from by clang-analyzer/scan-build)
https://llvm.org/reports/scan-build/report-TargetInfo.cpp-detectFPCCEligibleStruct-9-1.html#EndPath


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

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=374032&r1=374031&r2=374032&view=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Tue Oct  8 02:17:46 2019
@@ -9438,7 +9438,7 @@ bool RISCVABIInfo::detectFPCCEligibleStr
   Ty, CharUnits::Zero(), Field1Ty, Field1Off, Field2Ty, Field2Off);
   // Not really a candidate if we have a single int but no float.
   if (Field1Ty && !Field2Ty && !Field1Ty->isFloatingPointTy())
-return IsCandidate = false;
+return false;
   if (!IsCandidate)
 return false;
   if (Field1Ty && Field1Ty->isFloatingPointTy())


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


[PATCH] D68539: [clang-tidy] fix for readability-identifier-naming incorrectly fixes variables which become keywords

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



> I saw this issue when I submitted mine 
> (https://bugs.llvm.org/show_bug.cgi?id=43306) which for now seems to be a 
> harder fix, still looking for a solution there.

oh boy!...are you gonna have to look at every variable/macro in scope and 
compare?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68539



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


[PATCH] D33029: [clang-format] add option for dangling parenthesis

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

I'd like to assess where we are at with this revision, despite our concerns 
over additional complexity of clang-format, I don't think this is adding too 
much (I've seen far worse patches)

It appears to me that these changes are mainly in mustBreak,canBreak etc... 
however if you haven't added any unit tests I'm pretty sure things are going to 
go wrong when we run the other tests.

I'm not sure if you ever rebased with @mprobst changes or if those changes help 
you in any way

Given the level of likes of this feature, I think its worth at least looking at 
again, the quickness of your response yesterday suggests this might still be on 
your radar somewhere? it might be worth rebasing just to ensure it would go in 
cleanly, I could help by adding some unit tests if this is still of interest


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

https://reviews.llvm.org/D33029



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


[PATCH] D68630: [clangd] Disable expand auto on decltype(auto)

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

Applying it produces incorrect code at the moment.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68630

Files:
  clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
  clang-tools-extra/clangd/unittests/TweakTests.cpp


Index: clang-tools-extra/clangd/unittests/TweakTests.cpp
===
--- clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -528,6 +528,8 @@
   // replace array types
   EXPECT_EQ(apply(R"cpp(au^to x = "test")cpp"),
 R"cpp(const char * x = "test")cpp");
+
+  EXPECT_UNAVAILABLE("dec^ltype(au^to) x = 10;");
 }
 
 TWEAK_TEST(ExtractFunction);
Index: clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
===
--- clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
@@ -61,7 +61,9 @@
   if (auto *Node = Inputs.ASTSelection.commonAncestor()) {
 if (auto *TypeNode = Node->ASTNode.get()) {
   if (const AutoTypeLoc Result = TypeNode->getAs()) {
-CachedLocation = Result;
+// Code in apply() does handle 'decltype(auto)' yet.
+if (!Result.getTypePtr()->isDecltypeAuto())
+  CachedLocation = Result;
   }
 }
   }


Index: clang-tools-extra/clangd/unittests/TweakTests.cpp
===
--- clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -528,6 +528,8 @@
   // replace array types
   EXPECT_EQ(apply(R"cpp(au^to x = "test")cpp"),
 R"cpp(const char * x = "test")cpp");
+
+  EXPECT_UNAVAILABLE("dec^ltype(au^to) x = 10;");
 }
 
 TWEAK_TEST(ExtractFunction);
Index: clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
===
--- clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
@@ -61,7 +61,9 @@
   if (auto *Node = Inputs.ASTSelection.commonAncestor()) {
 if (auto *TypeNode = Node->ASTNode.get()) {
   if (const AutoTypeLoc Result = TypeNode->getAs()) {
-CachedLocation = Result;
+// Code in apply() does handle 'decltype(auto)' yet.
+if (!Result.getTypePtr()->isDecltypeAuto())
+  CachedLocation = Result;
   }
 }
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68526: [Diagnostics] Silence -Wsizeof-array-div for character buffers

2019-10-08 Thread James Clarke via Phabricator via cfe-commits
jrtc27 updated this revision to Diff 223823.
jrtc27 added a comment.

Rebased


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68526

Files:
  clang/lib/Sema/SemaExpr.cpp
  clang/test/Sema/div-sizeof-array.cpp


Index: clang/test/Sema/div-sizeof-array.cpp
===
--- clang/test/Sema/div-sizeof-array.cpp
+++ clang/test/Sema/div-sizeof-array.cpp
@@ -25,6 +25,8 @@
   int a10 = sizeof(arr3) / sizeof(char);
   int a11 = sizeof(arr2) / (sizeof(unsigned));
   int a12 = sizeof(arr) / (sizeof(short));
+  int a13 = sizeof(arr3) / sizeof(p);
+  int a14 = sizeof(arr3) / sizeof(int);
 
   int arr4[10][12];
   int b1 = sizeof(arr4) / sizeof(arr2[12]);
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -9197,6 +9197,7 @@
 QualType ArrayElemTy = ArrayTy->getElementType();
 if (ArrayElemTy != S.Context.getBaseElementType(ArrayTy) ||
 ArrayElemTy->isDependentType() || RHSTy->isDependentType() ||
+ArrayElemTy->isCharType() ||
 S.Context.getTypeSize(ArrayElemTy) == S.Context.getTypeSize(RHSTy))
   return;
 S.Diag(Loc, diag::warn_division_sizeof_array)


Index: clang/test/Sema/div-sizeof-array.cpp
===
--- clang/test/Sema/div-sizeof-array.cpp
+++ clang/test/Sema/div-sizeof-array.cpp
@@ -25,6 +25,8 @@
   int a10 = sizeof(arr3) / sizeof(char);
   int a11 = sizeof(arr2) / (sizeof(unsigned));
   int a12 = sizeof(arr) / (sizeof(short));
+  int a13 = sizeof(arr3) / sizeof(p);
+  int a14 = sizeof(arr3) / sizeof(int);
 
   int arr4[10][12];
   int b1 = sizeof(arr4) / sizeof(arr2[12]);
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -9197,6 +9197,7 @@
 QualType ArrayElemTy = ArrayTy->getElementType();
 if (ArrayElemTy != S.Context.getBaseElementType(ArrayTy) ||
 ArrayElemTy->isDependentType() || RHSTy->isDependentType() ||
+ArrayElemTy->isCharType() ||
 S.Context.getTypeSize(ArrayElemTy) == S.Context.getTypeSize(RHSTy))
   return;
 S.Diag(Loc, diag::warn_division_sizeof_array)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r374035 - [Diagnostics] Silence -Wsizeof-array-div for character buffers

2019-10-08 Thread James Clarke via cfe-commits
Author: jrtc27
Date: Tue Oct  8 04:34:02 2019
New Revision: 374035

URL: http://llvm.org/viewvc/llvm-project?rev=374035&view=rev
Log:
[Diagnostics] Silence -Wsizeof-array-div for character buffers

Summary:
Character buffers are sometimes used to represent a pool of memory that
contains non-character objects, due to them being synonymous with a stream of
bytes on almost all modern architectures. Often, when interacting with hardware
devices, byte buffers are therefore used as an intermediary and so we can end
Character buffers are sometimes used to represent a pool of memory that
contains non-character objects, due to them being synonymous with a stream of
bytes on almost all modern architectures. Often, when interacting with hardware
devices, byte buffers are therefore used as an intermediary and so we can end
up generating lots of false-positives.

Moreover, due to the ability of character pointers to alias non-character
pointers, the strict aliasing violations that would generally be implied by the
calculations caught by the warning (if the calculation itself is in fact
correct) do not apply here, and so although the length calculation may be
wrong, that is the only possible issue.

Reviewers: rsmith, xbolva00, thakis

Reviewed By: xbolva00, thakis

Subscribers: thakis, lebedev.ri, cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Sema/div-sizeof-array.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=374035&r1=374034&r2=374035&view=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Oct  8 04:34:02 2019
@@ -9197,6 +9197,7 @@ static void DiagnoseDivisionSizeofPointe
 QualType ArrayElemTy = ArrayTy->getElementType();
 if (ArrayElemTy != S.Context.getBaseElementType(ArrayTy) ||
 ArrayElemTy->isDependentType() || RHSTy->isDependentType() ||
+ArrayElemTy->isCharType() ||
 S.Context.getTypeSize(ArrayElemTy) == S.Context.getTypeSize(RHSTy))
   return;
 S.Diag(Loc, diag::warn_division_sizeof_array)

Modified: cfe/trunk/test/Sema/div-sizeof-array.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/div-sizeof-array.cpp?rev=374035&r1=374034&r2=374035&view=diff
==
--- cfe/trunk/test/Sema/div-sizeof-array.cpp (original)
+++ cfe/trunk/test/Sema/div-sizeof-array.cpp Tue Oct  8 04:34:02 2019
@@ -25,6 +25,8 @@ void test(void) {
   int a10 = sizeof(arr3) / sizeof(char);
   int a11 = sizeof(arr2) / (sizeof(unsigned));
   int a12 = sizeof(arr) / (sizeof(short));
+  int a13 = sizeof(arr3) / sizeof(p);
+  int a14 = sizeof(arr3) / sizeof(int);
 
   int arr4[10][12];
   int b1 = sizeof(arr4) / sizeof(arr2[12]);


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


[PATCH] D68630: [clangd] Disable expand auto on decltype(auto)

2019-10-08 Thread Christian Kühnel via Phabricator via cfe-commits
kuhnel added a comment.

as the automatic build report did not work:

  Failing Tests (1):
  LLVM :: tools/llvm-ar/mri-utf8.test

http://results.llvm-merge-guard.org/Phabricator-23/


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68630



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


[PATCH] D68634: [ASTImporter] Imported FunctionDecls inherit attributes from existing functions

2019-10-08 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision.
martong added reviewers: a_sidorin, balazske, dkrupp, vbridgers.
Herald added subscribers: cfe-commits, teemperor, gamesh411, Szelethus, 
rnkovacs.
Herald added a reviewer: a.sidorin.
Herald added a reviewer: shafik.
Herald added a project: clang.

This way some CTU false positives are eliminated.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68634

Files:
  clang/lib/AST/ASTImporter.cpp
  clang/test/Analysis/Inputs/ctu-attr-noreturn-other.c
  clang/test/Analysis/Inputs/ctu-attr-noreturn.externalDefMap.txt
  clang/test/Analysis/ctu-attr-noreturn.c
  clang/unittests/AST/ASTImporterTest.cpp

Index: clang/unittests/AST/ASTImporterTest.cpp
===
--- clang/unittests/AST/ASTImporterTest.cpp
+++ clang/unittests/AST/ASTImporterTest.cpp
@@ -5783,6 +5783,134 @@
 2u);
 }
 
+struct ImportAttrs : ASTImporterOptionSpecificTestBase {};
+
+TEST_P(ImportAttrs, InheritedAnalyzerNoreturnShouldBeImported) {
+  getToTuDecl(
+  R"(
+  void f();
+  )",
+  Lang_C);
+  Decl *FromTU = getTuDecl(
+  R"(
+  void f();/* From0 */
+  void f() __attribute__((analyzer_noreturn)); /* From1 */
+  void f();/* From2 */
+  )",
+  Lang_C, "input0.c");
+
+  auto *From2 =
+  LastDeclMatcher().match(FromTU, functionDecl(hasName("f")));
+  ASSERT_TRUE(From2->hasAttrs());
+  ASSERT_TRUE(From2->getAttr());
+  auto *From1 = From2->getPreviousDecl();
+  ASSERT_TRUE(From1->hasAttrs());
+  ASSERT_TRUE(From1->getAttr());
+  auto *From0 = From1->getPreviousDecl();
+  ASSERT_FALSE(From0->hasAttrs());
+  ASSERT_FALSE(From0->getAttr());
+
+  auto *Imported = Import(From2, Lang_C);
+  EXPECT_TRUE(Imported->hasAttrs());
+  EXPECT_TRUE(Imported->getAttr());
+  EXPECT_EQ(Imported->getAttrs().size(), 1u);
+  EXPECT_TRUE(Imported->getPreviousDecl()->hasAttrs());
+  EXPECT_TRUE(Imported->getPreviousDecl()->getAttr());
+}
+
+TEST_P(ImportAttrs, InheritedNoreturnShouldBeImported) {
+  Decl *ToTU = getToTuDecl(
+  R"(
+  void f();
+  )",
+  Lang_C);
+  auto *To =
+  FirstDeclMatcher().match(ToTU, functionDecl(hasName("f")));
+  ASSERT_FALSE(cast(To->getType())->getNoReturnAttr());
+
+  Decl *FromTU = getTuDecl(
+  R"(
+  void f();/* From0 */
+  void f() __attribute__((noreturn));  /* From1 */
+  void f();/* From2 */
+  )",
+  Lang_C, "input0.cc");
+
+  auto *From2 =
+  LastDeclMatcher().match(FromTU, functionDecl(hasName("f")));
+  ASSERT_TRUE(cast(From2->getType())->getNoReturnAttr());
+  auto *From1 = From2->getPreviousDecl();
+  ASSERT_TRUE(cast(From1->getType())->getNoReturnAttr());
+  auto *From0 = From1->getPreviousDecl();
+  ASSERT_FALSE(cast(From0->getType())->getNoReturnAttr());
+
+  auto *Imported = Import(From2, Lang_C);
+  EXPECT_TRUE(cast(Imported->getType())->getNoReturnAttr());
+  EXPECT_TRUE(cast(Imported->getPreviousDecl()->getType())
+  ->getNoReturnAttr());
+}
+
+TEST_P(ImportAttrs, ImportShouldInheritExistingInheritableAttr) {
+  Decl *ToTU = getToTuDecl(
+  R"(
+  void f() __attribute__((analyzer_noreturn));
+  void f();
+  )",
+  Lang_C);
+  Decl *FromTU = getTuDecl(
+  R"(
+  void f();
+  )",
+  Lang_C, "input0.c");
+
+  auto *From = FirstDeclMatcher().match(
+  FromTU, functionDecl(hasName("f")));
+
+  auto *To0 =
+  FirstDeclMatcher().match(ToTU, functionDecl(hasName("f")));
+  ASSERT_TRUE(To0->hasAttrs());
+  ASSERT_TRUE(To0->getAttr());
+  auto *To1 =
+  LastDeclMatcher().match(ToTU, functionDecl(hasName("f")));
+  ASSERT_TRUE(To1->hasAttrs());
+  ASSERT_TRUE(To1->getAttr());
+  ASSERT_TRUE(To1->getAttr()->isInherited());
+
+  // Should have an Inherited attribute.
+  auto *Imported = Import(From, Lang_C);
+  EXPECT_TRUE(Imported->hasAttrs());
+  ASSERT_TRUE(Imported->getAttr());
+  EXPECT_TRUE(Imported->getAttr()->isInherited());
+}
+
+TEST_P(ImportAttrs, ImportShouldInheritExistingNoreturnTypeSpec) {
+  Decl *ToTU = getToTuDecl(
+  R"(
+  void f() __attribute__((noreturn));
+  void f();
+  )",
+  Lang_C);
+  Decl *FromTU = getTuDecl(
+  R"(
+  void f();
+  )",
+  Lang_C, "input0.c");
+
+  auto *From = FirstDeclMatcher().match(
+  FromTU, functionDecl(hasName("f")));
+
+  auto *To0 =
+  FirstDeclMatcher().match(ToTU, functionDecl(hasName("f")));
+  ASSERT_TRUE(cast(To0->getType())->getNoReturnAttr());
+  auto *To1 =
+  LastDeclMatcher().match(ToTU, functionDecl(hasName("f")));
+  ASSERT_TRUE(cast(To1->getType())->getNoReturnAttr());
+
+  // Should have an Inherited attribute as part of the type.
+  auto *Imported = Import(From, Lang_C);
+  EXPECT_TRUE(cast(Imported->getType())->getNoReturnAttr());
+}
+
 INSTANTIATE_TEST_CASE_P(ParameterizedTests, ASTImporterLookupTableTest,
  

[PATCH] D68526: [Diagnostics] Silence -Wsizeof-array-div for character buffers

2019-10-08 Thread James Clarke via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG67f542aba72f: [Diagnostics] Silence -Wsizeof-array-div for 
character buffers (authored by jrtc27).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68526

Files:
  clang/lib/Sema/SemaExpr.cpp
  clang/test/Sema/div-sizeof-array.cpp


Index: clang/test/Sema/div-sizeof-array.cpp
===
--- clang/test/Sema/div-sizeof-array.cpp
+++ clang/test/Sema/div-sizeof-array.cpp
@@ -25,6 +25,8 @@
   int a10 = sizeof(arr3) / sizeof(char);
   int a11 = sizeof(arr2) / (sizeof(unsigned));
   int a12 = sizeof(arr) / (sizeof(short));
+  int a13 = sizeof(arr3) / sizeof(p);
+  int a14 = sizeof(arr3) / sizeof(int);
 
   int arr4[10][12];
   int b1 = sizeof(arr4) / sizeof(arr2[12]);
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -9197,6 +9197,7 @@
 QualType ArrayElemTy = ArrayTy->getElementType();
 if (ArrayElemTy != S.Context.getBaseElementType(ArrayTy) ||
 ArrayElemTy->isDependentType() || RHSTy->isDependentType() ||
+ArrayElemTy->isCharType() ||
 S.Context.getTypeSize(ArrayElemTy) == S.Context.getTypeSize(RHSTy))
   return;
 S.Diag(Loc, diag::warn_division_sizeof_array)


Index: clang/test/Sema/div-sizeof-array.cpp
===
--- clang/test/Sema/div-sizeof-array.cpp
+++ clang/test/Sema/div-sizeof-array.cpp
@@ -25,6 +25,8 @@
   int a10 = sizeof(arr3) / sizeof(char);
   int a11 = sizeof(arr2) / (sizeof(unsigned));
   int a12 = sizeof(arr) / (sizeof(short));
+  int a13 = sizeof(arr3) / sizeof(p);
+  int a14 = sizeof(arr3) / sizeof(int);
 
   int arr4[10][12];
   int b1 = sizeof(arr4) / sizeof(arr2[12]);
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -9197,6 +9197,7 @@
 QualType ArrayElemTy = ArrayTy->getElementType();
 if (ArrayElemTy != S.Context.getBaseElementType(ArrayTy) ||
 ArrayElemTy->isDependentType() || RHSTy->isDependentType() ||
+ArrayElemTy->isCharType() ||
 S.Context.getTypeSize(ArrayElemTy) == S.Context.getTypeSize(RHSTy))
   return;
 S.Diag(Loc, diag::warn_division_sizeof_array)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r374013 - [ItaniumMangle] Fix mangling of GNU __null in an expression to match GCC

2019-10-08 Thread James Clarke via cfe-commits
Author: jrtc27
Date: Mon Oct  7 19:28:57 2019
New Revision: 374013

URL: http://llvm.org/viewvc/llvm-project?rev=374013&view=rev
Log:
[ItaniumMangle] Fix mangling of GNU __null in an expression to match GCC

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: erik.pilkington, cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-exprs.cpp

Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=374013&r1=374012&r2=374013&view=diff
==
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Mon Oct  7 19:28:57 2019
@@ -4273,8 +4273,11 @@ recurse:
   }
 
   case Expr::GNUNullExprClass:
-// FIXME: should this really be mangled the same as nullptr?
-// fallthrough
+// Mangle as if an integer literal 0.
+Out << 'L';
+mangleType(E->getType());
+Out << "0E";
+break;
 
   case Expr::CXXNullPtrLiteralExprClass: {
 Out << "LDnE";

Modified: cfe/trunk/test/CodeGenCXX/mangle-exprs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-exprs.cpp?rev=374013&r1=374012&r2=374013&view=diff
==
--- cfe/trunk/test/CodeGenCXX/mangle-exprs.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-exprs.cpp Mon Oct  7 19:28:57 2019
@@ -373,3 +373,19 @@ namespace designated_init {
   template void f(decltype(T{.a.b[3][1 ... 4] = 9}) x) {}
   void use_f(A a) { f(a); }
 }
+
+namespace null {
+  template 
+  void cpp_nullptr(typename enable_if::type* = 0) {
+  }
+
+  template 
+  void gnu_null(typename enable_if::type* = 0) {
+  }
+
+  // CHECK-LABEL: define {{.*}} 
@_ZN4null11cpp_nullptrILDn0EEEvPN9enable_ifIXeqT_LDnEEvE4typeE
+  template void cpp_nullptr(void *);
+
+  // CHECK-LABEL: define {{.*}} 
@_ZN4null8gnu_nullILPv0EEEvPN9enable_ifIXeqT_Ll0EEvE4typeE
+  template void gnu_null(void *);
+}


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


[PATCH] D68539: [clang-tidy] fix for readability-identifier-naming incorrectly fixes variables which become keywords

2019-10-08 Thread Daniel via Phabricator via cfe-commits
Daniel599 added a comment.

In D68539#1699288 , @MyDeveloperDay 
wrote:

> > I saw this issue when I submitted mine 
> > (https://bugs.llvm.org/show_bug.cgi?id=43306) which for now seems to be a 
> > harder fix, still looking for a solution there.
>
> oh boy!...are you gonna have to look at every variable/macro in scope and 
> compare?


Don't know yet, I thought about using  Sema::CheckShadow or Sema::LookupName, 
but I can't find a Sema instance, not sure how those methods effect performance


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68539



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


r374042 - [SVE][IR] Scalable Vector size queries and IR instruction support

2019-10-08 Thread Graham Hunter via cfe-commits
Author: huntergr
Date: Tue Oct  8 05:53:54 2019
New Revision: 374042

URL: http://llvm.org/viewvc/llvm-project?rev=374042&view=rev
Log:
[SVE][IR] Scalable Vector size queries and IR instruction support

* Adds a TypeSize struct to represent the known minimum size of a type
  along with a flag to indicate that the runtime size is a integer multiple
  of that size
* Converts existing size query functions from Type.h and DataLayout.h to
  return a TypeSize result
* Adds convenience methods (including a transparent conversion operator
  to uint64_t) so that most existing code 'just works' as if the return
  values were still scalars.
* Uses the new size queries along with ElementCount to ensure that all
  supported instructions used with scalable vectors can be constructed
  in IR.

Reviewers: hfinkel, lattner, rkruppe, greened, rovka, rengolin, sdesmalen

Reviewed By: rovka, sdesmalen

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

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

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=374042&r1=374041&r2=374042&view=diff
==
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue Oct  8 05:53:54 2019
@@ -4277,8 +4277,8 @@ RValue CodeGenFunction::EmitCall(const C
   // Update the largest vector width if any arguments have vector types.
   for (unsigned i = 0; i < IRCallArgs.size(); ++i) {
 if (auto *VT = dyn_cast(IRCallArgs[i]->getType()))
-  LargestVectorWidth = std::max(LargestVectorWidth,
-VT->getPrimitiveSizeInBits());
+  LargestVectorWidth = std::max((uint64_t)LargestVectorWidth,
+   
VT->getPrimitiveSizeInBits().getFixedSize());
   }
 
   // Compute the calling convention and attributes.
@@ -4361,8 +4361,8 @@ RValue CodeGenFunction::EmitCall(const C
 
   // Update largest vector width from the return type.
   if (auto *VT = dyn_cast(CI->getType()))
-LargestVectorWidth = std::max(LargestVectorWidth,
-  VT->getPrimitiveSizeInBits());
+LargestVectorWidth = std::max((uint64_t)LargestVectorWidth,
+  VT->getPrimitiveSizeInBits().getFixedSize());
 
   // Insert instrumentation or attach profile metadata at indirect call sites.
   // For more details, see the comment before the definition of

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=374042&r1=374041&r2=374042&view=diff
==
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Tue Oct  8 05:53:54 2019
@@ -2073,8 +2073,8 @@ void CodeGenFunction::EmitAsmStmt(const
 
   // Update largest vector width for any vector types.
   if (auto *VT = dyn_cast(ResultRegTypes.back()))
-LargestVectorWidth = std::max(LargestVectorWidth,
-  VT->getPrimitiveSizeInBits());
+LargestVectorWidth = std::max((uint64_t)LargestVectorWidth,
+   
VT->getPrimitiveSizeInBits().getFixedSize());
 } else {
   ArgTypes.push_back(Dest.getAddress().getType());
   Args.push_back(Dest.getPointer());
@@ -2098,8 +2098,8 @@ void CodeGenFunction::EmitAsmStmt(const
 
   // Update largest vector width for any vector types.
   if (auto *VT = dyn_cast(Arg->getType()))
-LargestVectorWidth = std::max(LargestVectorWidth,
-  VT->getPrimitiveSizeInBits());
+LargestVectorWidth = std::max((uint64_t)LargestVectorWidth,
+   
VT->getPrimitiveSizeInBits().getFixedSize());
   if (Info.allowsRegister())
 InOutConstraints += llvm::utostr(i);
   else
@@ -2185,8 +2185,8 @@ void CodeGenFunction::EmitAsmStmt(const
 
 // Update largest vector width for any vector types.
 if (auto *VT = dyn_cast(Arg->getType()))
-  LargestVectorWidth = std::max(LargestVectorWidth,
-VT->getPrimitiveSizeInBits());
+  LargestVectorWidth = std::max((uint64_t)LargestVectorWidth,
+   
VT->getPrimitiveSizeInBits().getFixedSize());
 
 ArgTypes.push_back(Arg->getType());
 Args.push_back(Arg);

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=374042&r1=374041&r2=374042&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Tue Oct  8 05:53:54 2019
@@ -431,13 +431,13 @@ void CodeGenFunction::F

[PATCH] D53137: Scalable vector core instruction support + size queries

2019-10-08 Thread Graham Hunter via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb302561b763a: [SVE][IR] Scalable Vector size queries and IR 
instruction support (authored by huntergr).

Changed prior to commit:
  https://reviews.llvm.org/D53137?vs=222593&id=223835#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D53137

Files:
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CGStmt.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  llvm/include/llvm/ADT/DenseMapInfo.h
  llvm/include/llvm/IR/DataLayout.h
  llvm/include/llvm/IR/DerivedTypes.h
  llvm/include/llvm/IR/InstrTypes.h
  llvm/include/llvm/IR/Type.h
  llvm/include/llvm/Support/MachineValueType.h
  llvm/include/llvm/Support/ScalableSize.h
  llvm/include/llvm/Support/TypeSize.h
  llvm/lib/Analysis/InlineCost.cpp
  llvm/lib/CodeGen/Analysis.cpp
  llvm/lib/IR/DataLayout.cpp
  llvm/lib/IR/Instructions.cpp
  llvm/lib/IR/Type.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/test/Other/scalable-vectors-core-ir.ll
  llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
  llvm/unittests/IR/VectorTypesTest.cpp

Index: llvm/unittests/IR/VectorTypesTest.cpp
===
--- llvm/unittests/IR/VectorTypesTest.cpp
+++ llvm/unittests/IR/VectorTypesTest.cpp
@@ -6,9 +6,10 @@
 //
 //===--===//
 
+#include "llvm/IR/DataLayout.h"
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/LLVMContext.h"
-#include "llvm/Support/ScalableSize.h"
+#include "llvm/Support/TypeSize.h"
 #include "gtest/gtest.h"
 using namespace llvm;
 
@@ -161,4 +162,117 @@
   ASSERT_TRUE(EltCnt.Scalable);
 }
 
+TEST(VectorTypesTest, FixedLenComparisons) {
+  LLVMContext Ctx;
+  DataLayout DL("");
+
+  Type *Int32Ty = Type::getInt32Ty(Ctx);
+  Type *Int64Ty = Type::getInt64Ty(Ctx);
+
+  VectorType *V2Int32Ty = VectorType::get(Int32Ty, 2);
+  VectorType *V4Int32Ty = VectorType::get(Int32Ty, 4);
+
+  VectorType *V2Int64Ty = VectorType::get(Int64Ty, 2);
+
+  TypeSize V2I32Len = V2Int32Ty->getPrimitiveSizeInBits();
+  EXPECT_EQ(V2I32Len.getKnownMinSize(), 64U);
+  EXPECT_FALSE(V2I32Len.isScalable());
+
+  EXPECT_LT(V2Int32Ty->getPrimitiveSizeInBits(),
+V4Int32Ty->getPrimitiveSizeInBits());
+  EXPECT_GT(V2Int64Ty->getPrimitiveSizeInBits(),
+V2Int32Ty->getPrimitiveSizeInBits());
+  EXPECT_EQ(V4Int32Ty->getPrimitiveSizeInBits(),
+V2Int64Ty->getPrimitiveSizeInBits());
+  EXPECT_NE(V2Int32Ty->getPrimitiveSizeInBits(),
+V2Int64Ty->getPrimitiveSizeInBits());
+
+  // Check that a fixed-only comparison works for fixed size vectors.
+  EXPECT_EQ(V2Int64Ty->getPrimitiveSizeInBits().getFixedSize(),
+V4Int32Ty->getPrimitiveSizeInBits().getFixedSize());
+
+  // Check the DataLayout interfaces.
+  EXPECT_EQ(DL.getTypeSizeInBits(V2Int64Ty),
+DL.getTypeSizeInBits(V4Int32Ty));
+  EXPECT_EQ(DL.getTypeSizeInBits(V2Int32Ty), 64U);
+  EXPECT_EQ(DL.getTypeSizeInBits(V2Int64Ty), 128U);
+  EXPECT_EQ(DL.getTypeStoreSize(V2Int64Ty),
+DL.getTypeStoreSize(V4Int32Ty));
+  EXPECT_NE(DL.getTypeStoreSizeInBits(V2Int32Ty),
+DL.getTypeStoreSizeInBits(V2Int64Ty));
+  EXPECT_EQ(DL.getTypeStoreSizeInBits(V2Int32Ty), 64U);
+  EXPECT_EQ(DL.getTypeStoreSize(V2Int64Ty), 16U);
+  EXPECT_EQ(DL.getTypeAllocSize(V4Int32Ty),
+DL.getTypeAllocSize(V2Int64Ty));
+  EXPECT_NE(DL.getTypeAllocSizeInBits(V2Int32Ty),
+DL.getTypeAllocSizeInBits(V2Int64Ty));
+  EXPECT_EQ(DL.getTypeAllocSizeInBits(V4Int32Ty), 128U);
+  EXPECT_EQ(DL.getTypeAllocSize(V2Int32Ty), 8U);
+  ASSERT_TRUE(DL.typeSizeEqualsStoreSize(V4Int32Ty));
+}
+
+TEST(VectorTypesTest, ScalableComparisons) {
+  LLVMContext Ctx;
+  DataLayout DL("");
+
+  Type *Int32Ty = Type::getInt32Ty(Ctx);
+  Type *Int64Ty = Type::getInt64Ty(Ctx);
+
+  VectorType *ScV2Int32Ty = VectorType::get(Int32Ty, {2, true});
+  VectorType *ScV4Int32Ty = VectorType::get(Int32Ty, {4, true});
+
+  VectorType *ScV2Int64Ty = VectorType::get(Int64Ty, {2, true});
+
+  TypeSize ScV2I32Len = ScV2Int32Ty->getPrimitiveSizeInBits();
+  EXPECT_EQ(ScV2I32Len.getKnownMinSize(), 64U);
+  EXPECT_TRUE(ScV2I32Len.isScalable());
+
+  EXPECT_LT(ScV2Int32Ty->getPrimitiveSizeInBits(),
+ScV4Int32Ty->getPrimitiveSizeInBits());
+  EXPECT_GT(ScV2Int64Ty->getPrimitiveSizeInBits(),
+ScV2Int32Ty->getPrimitiveSizeInBits());
+  EXPECT_EQ(ScV4Int32Ty->getPrimitiveSizeInBits(),
+ScV2Int64Ty->getPrimitiveSizeInBits());
+  EXPECT_NE(ScV2Int32Ty->getPrimitiveSizeInBits(),
+ScV2Int64Ty->getPrimitiveSizeInBits());
+
+  // Check the DataLayout interfaces.
+  EXPECT_EQ(DL.getTypeSizeInBits(ScV2Int64Ty),
+DL.getTypeSizeInBits(ScV4Int32Ty));
+  EXPECT_EQ(DL.getTypeSizeInBits(ScV2Int32Ty).getKnownMinSize(), 64U);
+  EXPECT_EQ(DL.getTy

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

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

Nice! Thanks for adding support for RISC-V. I like the use of the ABI register 
names rather than the numeric names.

I have a few queries/nits, below.




Comment at: libunwind/include/libunwind.h:835
 
+// 64-bit RISC-V registers
+enum {

Please include a link to the RISC-V ELF psABI spec which defines these register 
numbers.



Comment at: libunwind/src/Registers.hpp:3553
+
+  GPRs_registers;
+  double  _floats[32];

Why is this a special GPR struct type, but the FPRs are not?



Comment at: libunwind/src/Registers.hpp:3585
+
+inline uint64_t Registers_riscv::getRegister(int regNum) const {
+  if (regNum == UNW_REG_IP)

Do you want to include an override in this function for `regNum == 
UNW_RISCV_X0` to always return zero?

The reason I ask is because I worry that 
`Registers_riscv::Registers_riscv(const void *registers)` could initialise a 
non-zero value into `_registers.__x[0]`, which could lead to really confusing 
bugs.

It might also make sense to include `assert(validRegister(regNum));` in both 
this function and `setRegister` as you've done with the float registers.



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

Nit: This should be formatted like the version for `Registers_sparc` above.



Comment at: libunwind/src/UnwindCursor.hpp:1071
+#if defined (_LIBUNWIND_TARGET_RISCV)
+  bool compactSaysUseDwarf(Registers_riscv &, uint32_t *) const {
+return true;

Nit: This should be formatted like the version for `Registers_sparc` above.



Comment at: libunwind/src/UnwindCursor.hpp:1143
+#if defined (_LIBUNWIND_TARGET_RISCV)
+  compact_unwind_encoding_t dwarfEncoding(Registers_riscv &) const {
+return 0;

Nit: This should be formatted like the version for `Registers_sparc` above.


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

https://reviews.llvm.org/D68362



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


[PATCH] D68637: [libTooling] Move Transformer files to their own directory/library.

2019-10-08 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel created this revision.
ymandel added a reviewer: gribozavr.
Herald added a subscriber: mgorny.
Herald added a project: clang.

The Transformer library has been growing inside of
lib/Tooling/Refactoring. However, it's not really related to anything else in
that directory. This revision moves all Transformer-related files into their own
include & lib directories.  A followup revision will (temporarily) add
forwarding headers to help any users migrate their code to the new location.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68637

Files:
  clang-tools-extra/clang-tidy/utils/CMakeLists.txt
  clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.h
  clang-tools-extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp
  clang/include/clang/Tooling/Refactoring/MatchConsumer.h
  clang/include/clang/Tooling/Refactoring/RangeSelector.h
  clang/include/clang/Tooling/Refactoring/SourceCode.h
  clang/include/clang/Tooling/Refactoring/SourceCodeBuilders.h
  clang/include/clang/Tooling/Refactoring/Stencil.h
  clang/include/clang/Tooling/Refactoring/Transformer.h
  clang/include/clang/Tooling/Transformer/MatchConsumer.h
  clang/include/clang/Tooling/Transformer/RangeSelector.h
  clang/include/clang/Tooling/Transformer/SourceCode.h
  clang/include/clang/Tooling/Transformer/SourceCodeBuilders.h
  clang/include/clang/Tooling/Transformer/Stencil.h
  clang/include/clang/Tooling/Transformer/Transformer.h
  clang/lib/Tooling/CMakeLists.txt
  clang/lib/Tooling/Refactoring/CMakeLists.txt
  clang/lib/Tooling/Refactoring/RangeSelector.cpp
  clang/lib/Tooling/Refactoring/SourceCode.cpp
  clang/lib/Tooling/Refactoring/SourceCodeBuilders.cpp
  clang/lib/Tooling/Refactoring/Stencil.cpp
  clang/lib/Tooling/Refactoring/Transformer.cpp
  clang/lib/Tooling/Transformer/CMakeLists.txt
  clang/lib/Tooling/Transformer/RangeSelector.cpp
  clang/lib/Tooling/Transformer/SourceCode.cpp
  clang/lib/Tooling/Transformer/SourceCodeBuilders.cpp
  clang/lib/Tooling/Transformer/Stencil.cpp
  clang/lib/Tooling/Transformer/Transformer.cpp
  clang/unittests/Tooling/CMakeLists.txt
  clang/unittests/Tooling/RangeSelectorTest.cpp
  clang/unittests/Tooling/SourceCodeBuildersTest.cpp
  clang/unittests/Tooling/SourceCodeTest.cpp
  clang/unittests/Tooling/StencilTest.cpp
  clang/unittests/Tooling/TransformerTest.cpp

Index: clang/unittests/Tooling/TransformerTest.cpp
===
--- clang/unittests/Tooling/TransformerTest.cpp
+++ clang/unittests/Tooling/TransformerTest.cpp
@@ -6,9 +6,9 @@
 //
 //===--===//
 
-#include "clang/Tooling/Refactoring/Transformer.h"
+#include "clang/Tooling/Transformer/Transformer.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
-#include "clang/Tooling/Refactoring/RangeSelector.h"
+#include "clang/Tooling/Transformer/RangeSelector.h"
 #include "clang/Tooling/Tooling.h"
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/Error.h"
Index: clang/unittests/Tooling/StencilTest.cpp
===
--- clang/unittests/Tooling/StencilTest.cpp
+++ clang/unittests/Tooling/StencilTest.cpp
@@ -6,7 +6,7 @@
 //
 //===--===//
 
-#include "clang/Tooling/Refactoring/Stencil.h"
+#include "clang/Tooling/Transformer/Stencil.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/Tooling/FixIt.h"
 #include "clang/Tooling/Tooling.h"
Index: clang/unittests/Tooling/SourceCodeTest.cpp
===
--- clang/unittests/Tooling/SourceCodeTest.cpp
+++ clang/unittests/Tooling/SourceCodeTest.cpp
@@ -6,7 +6,7 @@
 //
 //===--===//
 
-#include "clang/Tooling/Refactoring/SourceCode.h"
+#include "clang/Tooling/Transformer/SourceCode.h"
 #include "TestVisitor.h"
 #include "clang/Basic/Diagnostic.h"
 #include "llvm/Testing/Support/Annotations.h"
Index: clang/unittests/Tooling/SourceCodeBuildersTest.cpp
===
--- clang/unittests/Tooling/SourceCodeBuildersTest.cpp
+++ clang/unittests/Tooling/SourceCodeBuildersTest.cpp
@@ -6,7 +6,7 @@
 //
 //===--===//
 
-#include "clang/Tooling/Refactoring/SourceCodeBuilders.h"
+#include "clang/Tooling/Transformer/SourceCodeBuilders.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/Tooling/Tooling.h"
Index: clang/unittests/Tooling/RangeSelectorTest.cpp
===
--- clang/unittests/Tooling/RangeSelectorTest.cpp
+++ clang/unittests/Tooling/RangeSelectorTest.cpp
@@ -6,7 +6,7 @@
 //
 //===--===//
 
-#include "clang/Tooling/

[PATCH] D67837: [CUDA][HIP] Fix host/device check with -fopenmp

2019-10-08 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: lib/Sema/SemaCUDA.cpp:616
   if (getLangOpts().CUDAIsDevice) {
-return IsKnownEmitted(*this, dyn_cast(CurContext))
+return (getEmissionStatus(dyn_cast(CurContext)) ==
+FunctionEmissionStatus::Emitted)

I assume, better to use `cast` here, not `dyn_cast`



Comment at: lib/Sema/SemaCUDA.cpp:645
 
-  return IsKnownEmitted(*this, dyn_cast(CurContext))
+  return (getEmissionStatus(dyn_cast(CurContext)) ==
+  FunctionEmissionStatus::Emitted)

Same here, just `cast`



Comment at: lib/Sema/SemaOpenMP.cpp:1627-1628
+  if (Caller) {
+auto CallerS = getEmissionStatus(Caller);
+auto CalleeS = getEmissionStatus(Callee);
+assert(CallerS != FunctionEmissionStatus::CUDADiscarded &&

Better to use real type instead of `auto` here



Comment at: lib/Sema/SemaOpenMP.cpp:1670-1671
+  if (Caller) {
+auto CallerS = getEmissionStatus(Caller);
+auto CalleeS = getEmissionStatus(Callee);
+assert(

Real types instead of `auto`


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

https://reviews.llvm.org/D67837



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


[PATCH] D68637: [libTooling] Move Transformer files to their own directory/library.

2019-10-08 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr accepted this revision.
gribozavr added a comment.
This revision is now accepted and ready to land.

Update header guards?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68637



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


[clang-tools-extra] r374047 - [clangd] Bump timeouts in speculative completion tests

2019-10-08 Thread Kadir Cetinkaya via cfe-commits
Author: kadircet
Date: Tue Oct  8 06:54:03 2019
New Revision: 374047

URL: http://llvm.org/viewvc/llvm-project?rev=374047&view=rev
Log:
[clangd] Bump timeouts in speculative completion tests

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

Modified: clang-tools-extra/trunk/clangd/unittests/CodeCompleteTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/unittests/CodeCompleteTests.cpp?rev=374047&r1=374046&r2=374047&view=diff
==
--- clang-tools-extra/trunk/clangd/unittests/CodeCompleteTests.cpp (original)
+++ clang-tools-extra/trunk/clangd/unittests/CodeCompleteTests.cpp Tue Oct  8 
06:54:03 2019
@@ -1137,7 +1137,7 @@ public:
 
   const std::vector consumeRequests(size_t Num) const {
 std::unique_lock Lock(Mut);
-EXPECT_TRUE(wait(Lock, ReceivedRequestCV, timeoutSeconds(10),
+EXPECT_TRUE(wait(Lock, ReceivedRequestCV, timeoutSeconds(30),
  [this, Num] { return Requests.size() == Num; }));
 auto Reqs = std::move(Requests);
 Requests = {};


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


[PATCH] D68637: [libTooling] Move Transformer files to their own directory/library.

2019-10-08 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel updated this revision to Diff 223840.
ymandel added a comment.

update header guards


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68637

Files:
  clang-tools-extra/clang-tidy/utils/CMakeLists.txt
  clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.h
  clang-tools-extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp
  clang/include/clang/Tooling/Refactoring/MatchConsumer.h
  clang/include/clang/Tooling/Refactoring/RangeSelector.h
  clang/include/clang/Tooling/Refactoring/SourceCode.h
  clang/include/clang/Tooling/Refactoring/SourceCodeBuilders.h
  clang/include/clang/Tooling/Refactoring/Stencil.h
  clang/include/clang/Tooling/Refactoring/Transformer.h
  clang/include/clang/Tooling/Transformer/MatchConsumer.h
  clang/include/clang/Tooling/Transformer/RangeSelector.h
  clang/include/clang/Tooling/Transformer/SourceCode.h
  clang/include/clang/Tooling/Transformer/SourceCodeBuilders.h
  clang/include/clang/Tooling/Transformer/Stencil.h
  clang/include/clang/Tooling/Transformer/Transformer.h
  clang/lib/Tooling/CMakeLists.txt
  clang/lib/Tooling/Refactoring/CMakeLists.txt
  clang/lib/Tooling/Refactoring/RangeSelector.cpp
  clang/lib/Tooling/Refactoring/SourceCode.cpp
  clang/lib/Tooling/Refactoring/SourceCodeBuilders.cpp
  clang/lib/Tooling/Refactoring/Stencil.cpp
  clang/lib/Tooling/Refactoring/Transformer.cpp
  clang/lib/Tooling/Transformer/CMakeLists.txt
  clang/lib/Tooling/Transformer/RangeSelector.cpp
  clang/lib/Tooling/Transformer/SourceCode.cpp
  clang/lib/Tooling/Transformer/SourceCodeBuilders.cpp
  clang/lib/Tooling/Transformer/Stencil.cpp
  clang/lib/Tooling/Transformer/Transformer.cpp
  clang/unittests/Tooling/CMakeLists.txt
  clang/unittests/Tooling/RangeSelectorTest.cpp
  clang/unittests/Tooling/SourceCodeBuildersTest.cpp
  clang/unittests/Tooling/SourceCodeTest.cpp
  clang/unittests/Tooling/StencilTest.cpp
  clang/unittests/Tooling/TransformerTest.cpp

Index: clang/unittests/Tooling/TransformerTest.cpp
===
--- clang/unittests/Tooling/TransformerTest.cpp
+++ clang/unittests/Tooling/TransformerTest.cpp
@@ -6,9 +6,9 @@
 //
 //===--===//
 
-#include "clang/Tooling/Refactoring/Transformer.h"
+#include "clang/Tooling/Transformer/Transformer.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
-#include "clang/Tooling/Refactoring/RangeSelector.h"
+#include "clang/Tooling/Transformer/RangeSelector.h"
 #include "clang/Tooling/Tooling.h"
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/Error.h"
Index: clang/unittests/Tooling/StencilTest.cpp
===
--- clang/unittests/Tooling/StencilTest.cpp
+++ clang/unittests/Tooling/StencilTest.cpp
@@ -6,7 +6,7 @@
 //
 //===--===//
 
-#include "clang/Tooling/Refactoring/Stencil.h"
+#include "clang/Tooling/Transformer/Stencil.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/Tooling/FixIt.h"
 #include "clang/Tooling/Tooling.h"
Index: clang/unittests/Tooling/SourceCodeTest.cpp
===
--- clang/unittests/Tooling/SourceCodeTest.cpp
+++ clang/unittests/Tooling/SourceCodeTest.cpp
@@ -6,7 +6,7 @@
 //
 //===--===//
 
-#include "clang/Tooling/Refactoring/SourceCode.h"
+#include "clang/Tooling/Transformer/SourceCode.h"
 #include "TestVisitor.h"
 #include "clang/Basic/Diagnostic.h"
 #include "llvm/Testing/Support/Annotations.h"
Index: clang/unittests/Tooling/SourceCodeBuildersTest.cpp
===
--- clang/unittests/Tooling/SourceCodeBuildersTest.cpp
+++ clang/unittests/Tooling/SourceCodeBuildersTest.cpp
@@ -6,7 +6,7 @@
 //
 //===--===//
 
-#include "clang/Tooling/Refactoring/SourceCodeBuilders.h"
+#include "clang/Tooling/Transformer/SourceCodeBuilders.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/Tooling/Tooling.h"
Index: clang/unittests/Tooling/RangeSelectorTest.cpp
===
--- clang/unittests/Tooling/RangeSelectorTest.cpp
+++ clang/unittests/Tooling/RangeSelectorTest.cpp
@@ -6,7 +6,7 @@
 //
 //===--===//
 
-#include "clang/Tooling/Refactoring/RangeSelector.h"
+#include "clang/Tooling/Transformer/RangeSelector.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/Frontend/ASTUnit.h"
 #include "clang/Tooling/FixIt.h"
Index: clang/unittests/Tooling/CMakeLists.txt
===
--- clang/unittests/To

[PATCH] D68640: Try to get readability-deleted-default.cpp to pass on Windows.

2019-10-08 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

There's just one other use of `-fno-ms-compatibility` in clang-tidy's test 
suite, so I'm not 100% sure this is the way to go. It's better than disabling 
the test completely on Windows :)


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

https://reviews.llvm.org/D68640



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


[PATCH] D68640: Try to get readability-deleted-default.cpp to pass on Windows.

2019-10-08 Thread Nico Weber via Phabricator via cfe-commits
thakis created this revision.
thakis added a reviewer: rnk.
thakis added a comment.

There's just one other use of `-fno-ms-compatibility` in clang-tidy's test 
suite, so I'm not 100% sure this is the way to go. It's better than disabling 
the test completely on Windows :)


In MS compatibility mode, "extern inline void g()" is not a redundant
declaration for "inline void g()", because of redeclForcesDefMSVC()
(see PR19264, r205485).

To fix, just run the test with -fno-ms-compatibility.

Final bit of PR43593.


https://reviews.llvm.org/D68640

Files:
  clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp


Index: clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp
===
--- clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp
+++ clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp
@@ -1,7 +1,7 @@
 // RUN: %check_clang_tidy %s readability-redundant-declaration %t -- \
 // RUN:   -config="{CheckOptions: \
 // RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
-// RUN:   value: 0}]}"
+// RUN:   value: 0}]}" -- -fno-ms-compatibility
 
 extern int Xyz;
 extern int Xyz; // Xyz


Index: clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp
===
--- clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp
+++ clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp
@@ -1,7 +1,7 @@
 // RUN: %check_clang_tidy %s readability-redundant-declaration %t -- \
 // RUN:   -config="{CheckOptions: \
 // RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
-// RUN:   value: 0}]}"
+// RUN:   value: 0}]}" -- -fno-ms-compatibility
 
 extern int Xyz;
 extern int Xyz; // Xyz
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r374048 - [clangd] Disable expand auto on decltype(auto)

2019-10-08 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Tue Oct  8 07:03:45 2019
New Revision: 374048

URL: http://llvm.org/viewvc/llvm-project?rev=374048&view=rev
Log:
[clangd] Disable expand auto on decltype(auto)

Summary: Applying it produces incorrect code at the moment.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: kuhnel, MaskRay, jkorous, arphaman, kadircet, usaxena95, 
cfe-commits

Tags: #clang

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

Modified:
clang-tools-extra/trunk/clangd/refactor/tweaks/ExpandAutoType.cpp
clang-tools-extra/trunk/clangd/unittests/TweakTests.cpp

Modified: clang-tools-extra/trunk/clangd/refactor/tweaks/ExpandAutoType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/refactor/tweaks/ExpandAutoType.cpp?rev=374048&r1=374047&r2=374048&view=diff
==
--- clang-tools-extra/trunk/clangd/refactor/tweaks/ExpandAutoType.cpp (original)
+++ clang-tools-extra/trunk/clangd/refactor/tweaks/ExpandAutoType.cpp Tue Oct  
8 07:03:45 2019
@@ -61,7 +61,9 @@ bool ExpandAutoType::prepare(const Selec
   if (auto *Node = Inputs.ASTSelection.commonAncestor()) {
 if (auto *TypeNode = Node->ASTNode.get()) {
   if (const AutoTypeLoc Result = TypeNode->getAs()) {
-CachedLocation = Result;
+// Code in apply() does handle 'decltype(auto)' yet.
+if (!Result.getTypePtr()->isDecltypeAuto())
+  CachedLocation = Result;
   }
 }
   }

Modified: clang-tools-extra/trunk/clangd/unittests/TweakTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/unittests/TweakTests.cpp?rev=374048&r1=374047&r2=374048&view=diff
==
--- clang-tools-extra/trunk/clangd/unittests/TweakTests.cpp (original)
+++ clang-tools-extra/trunk/clangd/unittests/TweakTests.cpp Tue Oct  8 07:03:45 
2019
@@ -528,6 +528,8 @@ TEST_F(ExpandAutoTypeTest, Test) {
   // replace array types
   EXPECT_EQ(apply(R"cpp(au^to x = "test")cpp"),
 R"cpp(const char * x = "test")cpp");
+
+  EXPECT_UNAVAILABLE("dec^ltype(au^to) x = 10;");
 }
 
 TWEAK_TEST(ExtractFunction);


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


[PATCH] D68630: [clangd] Disable expand auto on decltype(auto)

2019-10-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment.

In D68630#1699371 , @kuhnel wrote:

> as the automatic build report did not work:


Definitely unrelated, `llvm-ar` does not depend on clangd... I think I was 
unlucky with the base revision...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68630



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


[PATCH] D53137: Scalable vector core instruction support + size queries

2019-10-08 Thread Graham Hunter via Phabricator via cfe-commits
huntergr added a comment.

Hmm, forgot to add the last round of minor fixes before committing. Sorry about 
that, will push them as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D53137



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


[PATCH] D68630: [clangd] Disable expand auto on decltype(auto)

2019-10-08 Thread Ilya Biryukov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1b36caf45e5e: [clangd] Disable expand auto on decltype(auto) 
(authored by ilya-biryukov).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68630

Files:
  clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
  clang-tools-extra/clangd/unittests/TweakTests.cpp


Index: clang-tools-extra/clangd/unittests/TweakTests.cpp
===
--- clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -528,6 +528,8 @@
   // replace array types
   EXPECT_EQ(apply(R"cpp(au^to x = "test")cpp"),
 R"cpp(const char * x = "test")cpp");
+
+  EXPECT_UNAVAILABLE("dec^ltype(au^to) x = 10;");
 }
 
 TWEAK_TEST(ExtractFunction);
Index: clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
===
--- clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
@@ -61,7 +61,9 @@
   if (auto *Node = Inputs.ASTSelection.commonAncestor()) {
 if (auto *TypeNode = Node->ASTNode.get()) {
   if (const AutoTypeLoc Result = TypeNode->getAs()) {
-CachedLocation = Result;
+// Code in apply() does handle 'decltype(auto)' yet.
+if (!Result.getTypePtr()->isDecltypeAuto())
+  CachedLocation = Result;
   }
 }
   }


Index: clang-tools-extra/clangd/unittests/TweakTests.cpp
===
--- clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -528,6 +528,8 @@
   // replace array types
   EXPECT_EQ(apply(R"cpp(au^to x = "test")cpp"),
 R"cpp(const char * x = "test")cpp");
+
+  EXPECT_UNAVAILABLE("dec^ltype(au^to) x = 10;");
 }
 
 TWEAK_TEST(ExtractFunction);
Index: clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
===
--- clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
@@ -61,7 +61,9 @@
   if (auto *Node = Inputs.ASTSelection.commonAncestor()) {
 if (auto *TypeNode = Node->ASTNode.get()) {
   if (const AutoTypeLoc Result = TypeNode->getAs()) {
-CachedLocation = Result;
+// Code in apply() does handle 'decltype(auto)' yet.
+if (!Result.getTypePtr()->isDecltypeAuto())
+  CachedLocation = Result;
   }
 }
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68640: Try to get readability-deleted-default.cpp to pass on Windows.

2019-10-08 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr added a comment.

It looks to me that a better fix is to fix the checker to not emit this warning 
in MS compatibility mode.

I'm OK with "fixing" the test like this, however, it should come with a TODO.


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

https://reviews.llvm.org/D68640



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


[PATCH] D67409: [RISCV] enable LTO support, pass some options to linker.

2019-10-08 Thread Sam Elliott via Phabricator via cfe-commits
lenary accepted this revision.
lenary added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: hiraditya.

Nice, LGTM


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

https://reviews.llvm.org/D67409



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


[PATCH] D68640: Try to get readability-deleted-default.cpp to pass on Windows.

2019-10-08 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

In D68640#1699563 , @gribozavr wrote:

> It looks to me that a better fix is to fix the checker to not emit this 
> warning in MS compatibility mode.


The warning is about emitting "here's a redundant declaration", and the test 
expects an "extern inline" decl to be redundant with an "inline" definition. In 
ms compat mode they aren't, so the checker does not emit the warning in ms mode 
(but does elsewhere).

Arguably having a check that suggests removing a bunch of code that's necessary 
in some modes (ms compat, or C) is a bit weird, so maybe we should never emit 
this diag for extern inlines. I don't know which policy decisions clang-tidy 
usually makes for cross-platform development – does it prioritize 
cross-platform dev, or completeness assuming single-platform dev?

(Finally, these tests have been broken for months, folks are landing lots of 
stuff with "UNSUPPORTED: win32" (clang VFS patches recently, for example) and 
we're struggling just keeping tests green on Windows. There's no shortage of 
possible implicit TODOs :) I think it's better to land this to get the 
check-clang-tools target green than it is to mark the test UNSUPPORTED.)


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

https://reviews.llvm.org/D68640



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


[PATCH] D68074: [clang-tidy] Add readability-make-member-function-const

2019-10-08 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr added a comment.

I'm holding off on reviewing the code until we figure out what the rules are.




Comment at: 
clang-tools-extra/docs/clang-tidy/checks/readability-make-member-function-const.rst:10
+The check conservatively tries to preserve logical costness in favor of
+physical costness. The only operations on ``this`` that this check considers
+to preserve logical constness are

Sorry, it is unclear to me what it means: "the check [...] tries to do X in 
favor of Y"

Also unclear what logical/physical constness mean.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/readability-make-member-function-const.rst:17
+* returning const-qualified ``this``
+* passing const-qualified ``this`` as a parameter.
+

These rules need a justification; if not for the users, but for future 
maintainers.

For example, why isn't reading a private member variable OK? Why isn't calling 
a private member function OK?




Comment at: 
clang-tools-extra/test/clang-tidy/readability-make-member-function-const.cpp:311
+  // This member function must stay non-const, even though
+  // it only calls other private const member functions.
+  int &get() {

Is it because the const version already exists? Then that should be the rule 
(not calling a private helper function).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68074



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


[PATCH] D68640: Try to get readability-deleted-default.cpp to pass on Windows.

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

In D68640#1699563 , @gribozavr wrote:

> It looks to me that a better fix is to fix the checker to not emit this 
> warning in MS compatibility mode.


+1

> I'm OK with "fixing" the test like this, however, it should come with a TODO.

I think we should also open a bug (or repurpose the existing one) to track the 
fact that the bug still exists.


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

https://reviews.llvm.org/D68640



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


[PATCH] D68640: Try to get readability-deleted-default.cpp to pass on Windows.

2019-10-08 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr added a comment.

> There's no shortage of possible implicit TODOs

I don't see "-fno-ms-compatibility" as an implicit TODO. It is most commonly 
used as "this test does something that does not work in MS mode". When I read 
it, I can't tell why it is there. When other people write tests, they will 
copy-paste the RUN line into their own test.


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

https://reviews.llvm.org/D68640



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


[PATCH] D68637: [libTooling] Move Transformer files to their own directory/library.

2019-10-08 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel updated this revision to Diff 223856.
ymandel added a comment.

update another cmakelists file (uncovered by linking for shared libs)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68637

Files:
  clang-tools-extra/clang-tidy/utils/CMakeLists.txt
  clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.h
  clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
  clang-tools-extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp
  clang/include/clang/Tooling/Refactoring/MatchConsumer.h
  clang/include/clang/Tooling/Refactoring/RangeSelector.h
  clang/include/clang/Tooling/Refactoring/SourceCode.h
  clang/include/clang/Tooling/Refactoring/SourceCodeBuilders.h
  clang/include/clang/Tooling/Refactoring/Stencil.h
  clang/include/clang/Tooling/Refactoring/Transformer.h
  clang/include/clang/Tooling/Transformer/MatchConsumer.h
  clang/include/clang/Tooling/Transformer/RangeSelector.h
  clang/include/clang/Tooling/Transformer/SourceCode.h
  clang/include/clang/Tooling/Transformer/SourceCodeBuilders.h
  clang/include/clang/Tooling/Transformer/Stencil.h
  clang/include/clang/Tooling/Transformer/Transformer.h
  clang/lib/Tooling/CMakeLists.txt
  clang/lib/Tooling/Refactoring/CMakeLists.txt
  clang/lib/Tooling/Refactoring/RangeSelector.cpp
  clang/lib/Tooling/Refactoring/SourceCode.cpp
  clang/lib/Tooling/Refactoring/SourceCodeBuilders.cpp
  clang/lib/Tooling/Refactoring/Stencil.cpp
  clang/lib/Tooling/Refactoring/Transformer.cpp
  clang/lib/Tooling/Transformer/CMakeLists.txt
  clang/lib/Tooling/Transformer/RangeSelector.cpp
  clang/lib/Tooling/Transformer/SourceCode.cpp
  clang/lib/Tooling/Transformer/SourceCodeBuilders.cpp
  clang/lib/Tooling/Transformer/Stencil.cpp
  clang/lib/Tooling/Transformer/Transformer.cpp
  clang/unittests/Tooling/CMakeLists.txt
  clang/unittests/Tooling/RangeSelectorTest.cpp
  clang/unittests/Tooling/SourceCodeBuildersTest.cpp
  clang/unittests/Tooling/SourceCodeTest.cpp
  clang/unittests/Tooling/StencilTest.cpp
  clang/unittests/Tooling/TransformerTest.cpp

Index: clang/unittests/Tooling/TransformerTest.cpp
===
--- clang/unittests/Tooling/TransformerTest.cpp
+++ clang/unittests/Tooling/TransformerTest.cpp
@@ -6,9 +6,9 @@
 //
 //===--===//
 
-#include "clang/Tooling/Refactoring/Transformer.h"
+#include "clang/Tooling/Transformer/Transformer.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
-#include "clang/Tooling/Refactoring/RangeSelector.h"
+#include "clang/Tooling/Transformer/RangeSelector.h"
 #include "clang/Tooling/Tooling.h"
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/Error.h"
Index: clang/unittests/Tooling/StencilTest.cpp
===
--- clang/unittests/Tooling/StencilTest.cpp
+++ clang/unittests/Tooling/StencilTest.cpp
@@ -6,7 +6,7 @@
 //
 //===--===//
 
-#include "clang/Tooling/Refactoring/Stencil.h"
+#include "clang/Tooling/Transformer/Stencil.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/Tooling/FixIt.h"
 #include "clang/Tooling/Tooling.h"
Index: clang/unittests/Tooling/SourceCodeTest.cpp
===
--- clang/unittests/Tooling/SourceCodeTest.cpp
+++ clang/unittests/Tooling/SourceCodeTest.cpp
@@ -6,7 +6,7 @@
 //
 //===--===//
 
-#include "clang/Tooling/Refactoring/SourceCode.h"
+#include "clang/Tooling/Transformer/SourceCode.h"
 #include "TestVisitor.h"
 #include "clang/Basic/Diagnostic.h"
 #include "llvm/Testing/Support/Annotations.h"
Index: clang/unittests/Tooling/SourceCodeBuildersTest.cpp
===
--- clang/unittests/Tooling/SourceCodeBuildersTest.cpp
+++ clang/unittests/Tooling/SourceCodeBuildersTest.cpp
@@ -6,7 +6,7 @@
 //
 //===--===//
 
-#include "clang/Tooling/Refactoring/SourceCodeBuilders.h"
+#include "clang/Tooling/Transformer/SourceCodeBuilders.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/Tooling/Tooling.h"
Index: clang/unittests/Tooling/RangeSelectorTest.cpp
===
--- clang/unittests/Tooling/RangeSelectorTest.cpp
+++ clang/unittests/Tooling/RangeSelectorTest.cpp
@@ -6,7 +6,7 @@
 //
 //===--===//
 
-#include "clang/Tooling/Refactoring/RangeSelector.h"
+#include "clang/Tooling/Transformer/RangeSelector.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/Frontend/ASTUnit.h"
 #include "clang/Tooling/FixIt.h"
Index: clang/unittests/Tooling/

[PATCH] D68640: Try to get readability-deleted-default.cpp to pass on Windows.

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

In D68640#1699605 , @thakis wrote:

> In D68640#1699563 , @gribozavr wrote:
>
> > It looks to me that a better fix is to fix the checker to not emit this 
> > warning in MS compatibility mode.
>
>
> The warning is about emitting "here's a redundant declaration", and the test 
> expects an "extern inline" decl to be redundant with an "inline" definition. 
> In ms compat mode they aren't, so the checker does not emit the warning in ms 
> mode (but does elsewhere).
>
> Arguably having a check that suggests removing a bunch of code that's 
> necessary in some modes (ms compat, or C) is a bit weird, so maybe we should 
> never emit this diag for extern inlines. I don't know which policy decisions 
> clang-tidy usually makes for cross-platform development – does it prioritize 
> cross-platform dev, or completeness assuming single-platform dev?


I think it depends on the check, but for a check in the `readability` module, 
I'm not certain there's a clear answer. My gut feeling is to diagnose based on 
platform behavior because the goal is to remove redundancy and that requires 
platform-specific knowledge. But it's not a strong opinion.

> (Finally, these tests have been broken for months, folks are landing lots of 
> stuff with "UNSUPPORTED: win32" (clang VFS patches recently, for example) and 
> we're struggling just keeping tests green on Windows. There's no shortage of 
> possible implicit TODOs :) I think it's better to land this to get the 
> check-clang-tools target green than it is to mark the test UNSUPPORTED.)

To be clear, I wasn't suggesting we fix it in this patch, just that we add a 
FIXME/TODO to the test and make sure we're tracking the bug. Explicit TODO > 
implicit TODO.


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

https://reviews.llvm.org/D68640



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


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

2019-10-08 Thread Lewis Revill via Phabricator via cfe-commits
lewis-revill updated this revision to Diff 223855.
lewis-revill added a comment.

Rebased to fix conflicts with recent split SP adjustments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62686

Files:
  clang/lib/Driver/ToolChains/Arch/RISCV.cpp
  clang/test/Driver/riscv-features.c
  llvm/lib/Target/RISCV/RISCV.td
  llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
  llvm/lib/Target/RISCV/RISCVFrameLowering.h
  llvm/lib/Target/RISCV/RISCVMachineFunctionInfo.h
  llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
  llvm/lib/Target/RISCV/RISCVRegisterInfo.h
  llvm/lib/Target/RISCV/RISCVSubtarget.h
  llvm/test/CodeGen/RISCV/saverestore.ll

Index: llvm/test/CodeGen/RISCV/saverestore.ll
===
--- /dev/null
+++ llvm/test/CodeGen/RISCV/saverestore.ll
@@ -0,0 +1,640 @@
+; RUN: llc -mtriple=riscv32 < %s | FileCheck %s -check-prefix=RV32I
+; RUN: llc -mtriple=riscv64 < %s | FileCheck %s -check-prefix=RV64I
+; RUN: llc -mtriple=riscv32 -mattr=+save-restore < %s | FileCheck %s -check-prefix=RV32I-SR
+; RUN: llc -mtriple=riscv64 -mattr=+save-restore < %s | FileCheck %s -check-prefix=RV64I-SR
+; RUN: llc -mtriple=riscv32 -mattr=+f,+save-restore -target-abi=ilp32f < %s | FileCheck %s -check-prefix=RV32I-FP-SR
+; RUN: llc -mtriple=riscv64 -mattr=+f,+d,+save-restore -target-abi=lp64d < %s | FileCheck %s -check-prefix=RV64I-FP-SR
+
+; Check that the correct save/restore libcalls are generated.
+
+@var0 = global [18 x i32] zeroinitializer
+@var1 = global [24 x i32] zeroinitializer
+@var2 = global [30 x i32] zeroinitializer
+
+define void @callee_saved0() nounwind {
+; RV32I-LABEL: callee_saved0:
+; RV32I: addi sp, sp, -32
+; RV32I-NEXT:sw s0, 28(sp)
+; RV32I-NEXT:sw s1, 24(sp)
+; RV32I-NEXT:sw s2, 20(sp)
+; RV32I-NEXT:sw s3, 16(sp)
+; RV32I-NEXT:sw s4, 12(sp)
+; RV32I: lw s4, 12(sp)
+; RV32I-NEXT:lw s3, 16(sp)
+; RV32I-NEXT:lw s2, 20(sp)
+; RV32I-NEXT:lw s1, 24(sp)
+; RV32I-NEXT:lw s0, 28(sp)
+; RV32I-NEXT:addi sp, sp, 32
+; RV32I-NEXT:ret
+;
+; RV64I-LABEL: callee_saved0:
+; RV64I: addi sp, sp, -48
+; RV64I-NEXT:sd s0, 40(sp)
+; RV64I-NEXT:sd s1, 32(sp)
+; RV64I-NEXT:sd s2, 24(sp)
+; RV64I-NEXT:sd s3, 16(sp)
+; RV64I: ld s4, 8(sp)
+; RV64I-NEXT:ld s3, 16(sp)
+; RV64I-NEXT:ld s2, 24(sp)
+; RV64I-NEXT:ld s1, 32(sp)
+; RV64I-NEXT:ld s0, 40(sp)
+; RV64I-NEXT:addi sp, sp, 48
+; RV64I-NEXT:ret
+;
+; RV32I-SR-LABEL: callee_saved0:
+; RV32I-SR: call t0, __riscv_save_5
+; RV32I-SR: tail __riscv_restore_5
+;
+; RV64I-SR-LABEL: callee_saved0:
+; RV64I-SR: call t0, __riscv_save_5
+; RV64I-SR: tail __riscv_restore_5
+;
+; RV32I-FP-SR-LABEL: callee_saved0:
+; RV32I-FP-SR: call t0, __riscv_save_5
+; RV32I-FP-SR: tail __riscv_restore_5
+;
+; RV64I-FP-SR-LABEL: callee_saved0:
+; RV64I-FP-SR: call t0, __riscv_save_5
+; RV64I-FP-SR: tail __riscv_restore_5
+  %val = load [18 x i32], [18 x i32]* @var0
+  store volatile [18 x i32] %val, [18 x i32]* @var0
+  ret void
+}
+
+define void @callee_saved1() nounwind {
+; RV32I-LABEL: callee_saved1:
+; RV32I: addi sp, sp, -48
+; RV32I-NEXT:sw s0, 44(sp)
+; RV32I-NEXT:sw s1, 40(sp)
+; RV32I-NEXT:sw s2, 36(sp)
+; RV32I-NEXT:sw s3, 32(sp)
+; RV32I-NEXT:sw s4, 28(sp)
+; RV32I-NEXT:sw s5, 24(sp)
+; RV32I-NEXT:sw s6, 20(sp)
+; RV32I-NEXT:sw s7, 16(sp)
+; RV32I-NEXT:sw s8, 12(sp)
+; RV32I-NEXT:sw s9, 8(sp)
+; RV32I-NEXT:sw s10, 4(sp)
+; RV32I: lw s10, 4(sp)
+; RV32I-NEXT:lw s9, 8(sp)
+; RV32I-NEXT:lw s8, 12(sp)
+; RV32I-NEXT:lw s7, 16(sp)
+; RV32I-NEXT:lw s6, 20(sp)
+; RV32I-NEXT:lw s5, 24(sp)
+; RV32I-NEXT:lw s4, 28(sp)
+; RV32I-NEXT:lw s3, 32(sp)
+; RV32I-NEXT:lw s2, 36(sp)
+; RV32I-NEXT:lw s1, 40(sp)
+; RV32I-NEXT:lw s0, 44(sp)
+; RV32I-NEXT:addi sp, sp, 48
+; RV32I-NEXT:ret
+;
+; RV64I-LABEL: callee_saved1:
+; RV64I: addi sp, sp, -96
+; RV64I-NEXT:sd s0, 88(sp)
+; RV64I-NEXT:sd s1, 80(sp)
+; RV64I-NEXT:sd s2, 72(sp)
+; RV64I-NEXT:sd s3, 64(sp)
+; RV64I-NEXT:sd s4, 56(sp)
+; RV64I-NEXT:sd s5, 48(sp)
+; RV64I-NEXT:sd s6, 40(sp)
+; RV64I-NEXT:sd s7, 32(sp)
+; RV64I-NEXT:sd s8, 24(sp)
+; RV64I-NEXT:sd s9, 16(sp)
+; RV64I-NEXT:sd s10, 8(sp)
+; RV64I: ld s10, 8(sp)
+; RV64I-NEXT:ld s9, 16(sp)
+; RV64I-NEXT:ld s8, 24(sp)
+; RV64I-NEXT:ld s7, 32(sp)
+; RV64I-NEXT:ld s6, 40(sp)
+; RV64I-NEXT:ld s5, 48(sp)
+; RV64I-NEXT:ld s4, 56(sp)
+; RV64I-NEXT:ld s3, 64(sp)
+; RV64I-NEXT:ld s2, 72(sp)
+; RV64I-NEXT:ld s1, 80(sp)
+; RV64I-NEXT:ld s0, 88(sp)
+; RV64I-NEXT:addi sp, sp, 96
+; RV64I-NEXT:ret
+;
+; RV32I-SR-LABEL: callee_saved1:
+; RV32I-SR: call t0, __riscv_save_11
+; RV32I-SR: ta

r374057 - [OPENMP50]Allow functions in declare variant directive to have different

2019-10-08 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Tue Oct  8 07:56:20 2019
New Revision: 374057

URL: http://llvm.org/viewvc/llvm-project?rev=374057&view=rev
Log:
[OPENMP50]Allow functions in declare variant directive to have different
C linkage.

After some discussion with OpenMP developers, it was decided that the
functions with the different C linkage can be used in declare variant
directive.

Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/declare_variant_ast_print.cpp
cfe/trunk/test/OpenMP/declare_variant_implementation_vendor_codegen.cpp
cfe/trunk/test/OpenMP/declare_variant_messages.cpp

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=374057&r1=374056&r2=374057&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Tue Oct  8 07:56:20 2019
@@ -9128,7 +9128,7 @@ public:
   const PartialDiagnosticAt &NoteCausedDiagIDAt,
   const PartialDiagnosticAt &NoSupportDiagIDAt,
   const PartialDiagnosticAt &DiffDiagIDAt, bool TemplatesSupported,
-  bool ConstexprSupported);
+  bool ConstexprSupported, bool CLinkageMayDiffer);
 
   /// Function tries to capture lambda's captured variables in the OpenMP 
region
   /// before the original lambda is captured.

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=374057&r1=374056&r2=374057&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Oct  8 07:56:20 2019
@@ -9685,7 +9685,7 @@ bool Sema::areMultiversionVariantFunctio
 const PartialDiagnosticAt &NoteCausedDiagIDAt,
 const PartialDiagnosticAt &NoSupportDiagIDAt,
 const PartialDiagnosticAt &DiffDiagIDAt, bool TemplatesSupported,
-bool ConstexprSupported) {
+bool ConstexprSupported, bool CLinkageMayDiffer) {
   enum DoesntSupport {
 FuncTemplates = 0,
 VirtFuncs = 1,
@@ -9778,7 +9778,7 @@ bool Sema::areMultiversionVariantFunctio
 if (OldFD->getStorageClass() != NewFD->getStorageClass())
   return Diag(DiffDiagIDAt.first, DiffDiagIDAt.second) << StorageClass;
 
-if (OldFD->isExternC() != NewFD->isExternC())
+if (!CLinkageMayDiffer && OldFD->isExternC() != NewFD->isExternC())
   return Diag(DiffDiagIDAt.first, DiffDiagIDAt.second) << Linkage;
 
 if (CheckEquivalentExceptionSpec(
@@ -9831,7 +9831,8 @@ static bool CheckMultiVersionAdditionalR
   PartialDiagnosticAt(NewFD->getLocation(),
   S.PDiag(diag::err_multiversion_diff)),
   /*TemplatesSupported=*/false,
-  /*ConstexprSupported=*/!IsCPUSpecificCPUDispatchMVType);
+  /*ConstexprSupported=*/!IsCPUSpecificCPUDispatchMVType,
+  /*CLinkageMayDiffer=*/false);
 }
 
 /// Check the validity of a multiversion function declaration that is the

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=374057&r1=374056&r2=374057&view=diff
==
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Tue Oct  8 07:56:20 2019
@@ -5109,7 +5109,8 @@ Sema::checkOpenMPDeclareVariantFunction(
   PartialDiagnosticAt(VariantRef->getExprLoc(),
   PDiag(diag::err_omp_declare_variant_diff)
   << FD->getLocation()),
-  /*TemplatesSupported=*/true, /*ConstexprSupported=*/false))
+  /*TemplatesSupported=*/true, /*ConstexprSupported=*/false,
+  /*CLinkageMayDiffer=*/true))
 return None;
   return std::make_pair(FD, cast(DRE));
 }

Modified: cfe/trunk/test/OpenMP/declare_variant_ast_print.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/declare_variant_ast_print.cpp?rev=374057&r1=374056&r2=374057&view=diff
==
--- cfe/trunk/test/OpenMP/declare_variant_ast_print.cpp (original)
+++ cfe/trunk/test/OpenMP/declare_variant_ast_print.cpp Tue Oct  8 07:56:20 2019
@@ -201,3 +201,22 @@ void ba() {
   s.foo1();
   static_f();
 }
+
+// CHECK: int fn_linkage_variant();
+// CHECK: extern "C" {
+// CHECK: #pragma omp declare variant(fn_linkage_variant) 
match(implementation={vendor(xxx)})
+// CHECK: int fn_linkage();
+// CHECK: }
+int fn_linkage_variant();
+extern "C" {
+#pragma omp declare variant(fn_linkage_variant) match(implementation = 
{vendor(xxx)})
+int fn_linkage();
+}
+
+// CHECK: extern "C" int fn_linkage_variant1()
+// CHECK: #pragma omp declare variant(fn_linkage_variant1) 
match(implementation={vendor(xxx)})
+// CHECK: int fn_linkage1();
+extern

r374061 - [clang][ifs] Clang Interface Stubs ToolChain plumbing.

2019-10-08 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Tue Oct  8 08:23:14 2019
New Revision: 374061

URL: http://llvm.org/viewvc/llvm-project?rev=374061&view=rev
Log:
[clang][ifs] Clang Interface Stubs ToolChain plumbing.

Second Landing Attempt:

This patch enables end to end support for generating ELF interface stubs
directly from clang. Now the following:

clang -emit-interface-stubs -o libfoo.so a.cpp b.cpp c.cpp

will product an ELF binary with visible symbols populated. Visibility attributes
and -fvisibility can be used to control what gets populated.

* Adding ToolChain support for clang Driver IFS Merge Phase
* Implementing a default InterfaceStubs Merge clang Tool, used by ToolChain
* Adds support for the clang Driver to involve llvm-ifs on ifs files.
* Adds -emit-merged-ifs flag, to tell llvm-ifs to emit a merged ifs text file
  instead of the final object format (normally ELF)


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



Added:
cfe/trunk/lib/Driver/ToolChains/InterfaceStubs.cpp
cfe/trunk/lib/Driver/ToolChains/InterfaceStubs.h
cfe/trunk/test/InterfaceStubs/conflict-type.ifs
cfe/trunk/test/InterfaceStubs/driver-test.c
cfe/trunk/test/InterfaceStubs/func.ifs
cfe/trunk/test/InterfaceStubs/merge-conflict-test.c
cfe/trunk/test/InterfaceStubs/object-double.c
cfe/trunk/test/InterfaceStubs/object-float.c
cfe/trunk/test/InterfaceStubs/object.c
cfe/trunk/test/InterfaceStubs/object.ifs
Removed:
cfe/trunk/test/InterfaceStubs/object.cpp
Modified:
cfe/trunk/include/clang/Driver/Action.h
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Driver/Phases.h
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/include/clang/Driver/Types.def
cfe/trunk/lib/Driver/Action.cpp
cfe/trunk/lib/Driver/CMakeLists.txt
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/Phases.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Driver/Types.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/InterfaceStubs/bad-format.cpp
cfe/trunk/test/InterfaceStubs/class-template-specialization.cpp
cfe/trunk/test/InterfaceStubs/externstatic.c
cfe/trunk/test/InterfaceStubs/function-template-specialization.cpp
cfe/trunk/test/InterfaceStubs/inline.c
cfe/trunk/test/InterfaceStubs/template-namespace-function.cpp
cfe/trunk/test/InterfaceStubs/weak.cpp
cfe/trunk/test/lit.cfg.py

Modified: cfe/trunk/include/clang/Driver/Action.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Action.h?rev=374061&r1=374060&r2=374061&view=diff
==
--- cfe/trunk/include/clang/Driver/Action.h (original)
+++ cfe/trunk/include/clang/Driver/Action.h Tue Oct  8 08:23:14 2019
@@ -65,6 +65,7 @@ public:
 BackendJobClass,
 AssembleJobClass,
 LinkJobClass,
+IfsMergeJobClass,
 LipoJobClass,
 DsymutilJobClass,
 VerifyDebugInfoJobClass,
@@ -485,6 +486,17 @@ public:
   }
 };
 
+class IfsMergeJobAction : public JobAction {
+  void anchor() override;
+
+public:
+  IfsMergeJobAction(ActionList &Inputs, types::ID Type);
+
+  static bool classof(const Action *A) {
+return A->getKind() == IfsMergeJobClass;
+  }
+};
+
 class LinkJobAction : public JobAction {
   void anchor() override;
 

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=374061&r1=374060&r2=374061&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Oct  8 08:23:14 2019
@@ -633,6 +633,9 @@ def emit_llvm : Flag<["-"], "emit-llvm">
   HelpText<"Use the LLVM representation for assembler and object files">;
 def emit_iterface_stubs : Flag<["-"], "emit-interface-stubs">, 
Flags<[CC1Option]>, Group,
   HelpText<"Generate Inteface Stub Files.">;
+def emit_merged_ifs : Flag<["-"], "emit-merged-ifs">,
+  Flags<[CC1Option]>, Group,
+  HelpText<"Generate Interface Stub Files, emit merged text not binary.">;
 def iterface_stub_version_EQ : JoinedOrSeparate<["-"], 
"interface-stub-version=">, Flags<[CC1Option]>;
 def exported__symbols__list : Separate<["-"], "exported_symbols_list">;
 def e : JoinedOrSeparate<["-"], "e">, Group;

Modified: cfe/trunk/include/clang/Driver/Phases.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Phases.h?rev=374061&r1=374060&r2=374061&view=diff
==
--- cfe/trunk/include/clang/Driver/Phases.h (original)
+++ cfe/trunk/include/clang/Driver/Phases.h Tue Oct  8 08:23:14 2019
@@ -20,7 +20,8 @@ namespace phases {
 Compile,
 Backend,
 Assemble,
-Link
+Link,
+IfsMerge,
   };
 
   enum {

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.or

[PATCH] D58531: [clang] Specify type of pthread_create builtin

2019-10-08 Thread James Clarke via Phabricator via cfe-commits
jrtc27 updated this revision to Diff 223871.
jrtc27 added a comment.

Rebased, added explicit no-warning test, clang-format'ed, updated assertion 
message.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D58531

Files:
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/Basic/Builtins.def
  clang/include/clang/Serialization/ASTBitCodes.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/Sema/implicit-builtin-decl.c
  clang/test/Sema/implicit-builtin-redecl.c

Index: clang/test/Sema/implicit-builtin-redecl.c
===
--- clang/test/Sema/implicit-builtin-redecl.c
+++ clang/test/Sema/implicit-builtin-redecl.c
@@ -24,3 +24,9 @@
 }
 
 typedef int rindex;
+
+// PR40692
+typedef void pthread_t;
+typedef void pthread_attr_t;
+int pthread_create(pthread_t *, const pthread_attr_t *, // no-warning
+   void *(*)(void *), void *);
Index: clang/test/Sema/implicit-builtin-decl.c
===
--- clang/test/Sema/implicit-builtin-decl.c
+++ clang/test/Sema/implicit-builtin-decl.c
@@ -68,4 +68,4 @@
 // CHECK: ReturnsTwiceAttr {{.*}} <{{.*}}> Implicit
 
 // PR40692
-void pthread_create(); // no warning expected
+void pthread_create(); // expected-warning{{declaration of built-in function 'pthread_create' requires inclusion of the header }}
Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -4966,6 +4966,8 @@
   AddTypeRef(Context.ObjCClassRedefinitionType, SpecialTypes);
   AddTypeRef(Context.ObjCSelRedefinitionType, SpecialTypes);
   AddTypeRef(Context.getucontext_tType(), SpecialTypes);
+  AddTypeRef(Context.getpthread_tType(), SpecialTypes);
+  AddTypeRef(Context.getpthread_attr_tType(), SpecialTypes);
 
   if (Chain) {
 // Write the mapping information describing our module dependencies and how
Index: clang/lib/Serialization/ASTReader.cpp
===
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -4847,6 +4847,43 @@
 }
   }
 }
+
+if (unsigned Pthread_t = SpecialTypes[SPECIAL_TYPE_PTHREAD_T]) {
+  QualType Pthread_tType = GetType(Pthread_t);
+  if (Pthread_tType.isNull()) {
+Error("pthread_t type is NULL");
+return;
+  }
+
+  if (!Context.pthread_tDecl) {
+if (const TypedefType *Typedef = Pthread_tType->getAs())
+  Context.setpthread_tDecl(Typedef->getDecl());
+else {
+  const TagType *Tag = Pthread_tType->getAs();
+  assert(Tag && "Invalid pthread_t type in AST file");
+  Context.setpthread_tDecl(Tag->getDecl());
+}
+  }
+}
+
+if (unsigned Pthread_attr_t = SpecialTypes[SPECIAL_TYPE_PTHREAD_ATTR_T]) {
+  QualType Pthread_attr_tType = GetType(Pthread_attr_t);
+  if (Pthread_attr_tType.isNull()) {
+Error("pthread_attr_t type is NULL");
+return;
+  }
+
+  if (!Context.pthread_attr_tDecl) {
+if (const TypedefType *Typedef =
+Pthread_attr_tType->getAs())
+  Context.setpthread_attr_tDecl(Typedef->getDecl());
+else {
+  const TagType *Tag = Pthread_attr_tType->getAs();
+  assert(Tag && "Invalid pthread_attr_t type in AST file");
+  Context.setpthread_attr_tDecl(Tag->getDecl());
+}
+  }
+}
   }
 
   ReadPragmaDiagnosticMappings(Context.getDiagnostics());
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -1968,6 +1968,8 @@
 return "setjmp.h";
   case ASTContext::GE_Missing_ucontext:
 return "ucontext.h";
+  case ASTContext::GE_Missing_pthread:
+return "pthread.h";
   }
   llvm_unreachable("unhandled error kind");
 }
@@ -5970,6 +5972,10 @@
 Context.setsigjmp_bufDecl(NewTD);
   else if (II->isStr("ucontext_t"))
 Context.setucontext_tDecl(NewTD);
+  else if (II->isStr("pthread_t"))
+Context.setpthread_tDecl(NewTD);
+  else if (II->isStr("pthread_attr_t"))
+Context.setpthread_attr_tDecl(NewTD);
 }
 
   return NewTD;
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -9383,6 +9383,11 @@
 //  Builtin Type Computation
 //===--===//
 
+static QualType DecodeFunctionTypeFromStr(
+const char *&TypeStr, bool IsNested, bool IsNoReturn, bool IsNoThrow,
+   

[PATCH] D58531: [clang] Specify type of pthread_create builtin

2019-10-08 Thread James Clarke via Phabricator via cfe-commits
jrtc27 marked an inline comment as done.
jrtc27 added a comment.

In D58531#1662466 , @jdoerfert wrote:

> I like the patch and I think it is fine.
>
> Small nits: 
>  Could we have a test for " we can detect dodgy pthread_create declarations" 
> and maybe `pthread[_attr]_t`?
>  There is an unresolved comment by @shrines.
>  @probinson: "it seems straightforward enough although clearly needs 
> clang-format-diff run over it."
>
> I'll accept this assuming the above points are easy to fix and given that no 
> one expressed concerns but only positive comments were made.


I believe I have addressed everything, with the possible exception of:

> Could we have a test for " we can detect dodgy pthread_create declarations" 
> and maybe `pthread[_attr]_t`?

Is that not what I had already added to 
`clang/test/Sema/implicit-builtin-decl.c`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D58531



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


[PATCH] D68578: [HIP] Fix device stub name

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

In D68578#1698864 , @t-tye wrote:

> I am a little unclear what this patch is doing as it is mentioned that the 
> mangled name has a _stub in it. My understanding is that the intention was to 
> create a distinct unmangled name for the stub, and then mangle it so that the 
> resulting symbol was a legal mangled name. It sounded like this was the 
> preferred approach, and makes sense to me based on my current understanding. 
> Am I understanding this correctly?


Yes this patch does this.


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

https://reviews.llvm.org/D68578



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


r374072 - [OPENMP50]Prohibit multiple context selector sets in context selectors.

2019-10-08 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Tue Oct  8 08:56:43 2019
New Revision: 374072

URL: http://llvm.org/viewvc/llvm-project?rev=374072&view=rev
Log:
[OPENMP50]Prohibit multiple context selector sets in context selectors.

According to OpenMP 5.0, 2.3.2 Context Selectors, Restrictions, each
trait-set-selector-name can only be specified once. Added check to
implement this restriction.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/Parse/ParseOpenMP.cpp
cfe/trunk/test/OpenMP/declare_variant_ast_print.c
cfe/trunk/test/OpenMP/declare_variant_ast_print.cpp
cfe/trunk/test/OpenMP/declare_variant_messages.c
cfe/trunk/test/OpenMP/declare_variant_messages.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=374072&r1=374071&r2=374072&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Tue Oct  8 08:56:43 
2019
@@ -1211,6 +1211,10 @@ def warn_omp_declare_variant_cs_name_exp
   InGroup;
 def err_omp_declare_variant_item_expected : Error<
   "expected %0 in '%1' context selector of '%2' selector set of 'omp declare 
variant' directive">;
+def err_omp_declare_variant_ctx_set_mutiple_use : Error<
+  "context selector set '%0' is used already in the same 'omp declare variant' 
directive">;
+def note_omp_declare_variant_ctx_set_used_here : Note<
+  "previously context selector set '%0' used here">;
 def warn_omp_more_one_device_type_clause : Warning<
   "more than one 'device_type' clause is specified">,
   InGroup;

Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=374072&r1=374071&r2=374072&view=diff
==
--- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original)
+++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Tue Oct  8 08:56:43 2019
@@ -892,6 +892,7 @@ bool Parser::parseOpenMPContextSelectors
 llvm::function_ref
 Callback) {
+  llvm::StringMap UsedCtxSets;
   do {
 // Parse inner context selector set name.
 if (!Tok.is(tok::identifier)) {
@@ -901,6 +902,16 @@ bool Parser::parseOpenMPContextSelectors
 }
 SmallString<16> Buffer;
 StringRef CtxSelectorSetName = PP.getSpelling(Tok, Buffer);
+auto Res = UsedCtxSets.try_emplace(CtxSelectorSetName, Tok.getLocation());
+if (!Res.second) {
+  // OpenMP 5.0, 2.3.2 Context Selectors, Restrictions.
+  // Each trait-set-selector-name can only be specified once.
+  Diag(Tok.getLocation(), 
diag::err_omp_declare_variant_ctx_set_mutiple_use)
+  << CtxSelectorSetName;
+  Diag(Res.first->getValue(),
+   diag::note_omp_declare_variant_ctx_set_used_here)
+  << CtxSelectorSetName;
+}
 // Parse '='.
 (void)ConsumeToken();
 if (Tok.isNot(tok::equal)) {

Modified: cfe/trunk/test/OpenMP/declare_variant_ast_print.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/declare_variant_ast_print.c?rev=374072&r1=374071&r2=374072&view=diff
==
--- cfe/trunk/test/OpenMP/declare_variant_ast_print.c (original)
+++ cfe/trunk/test/OpenMP/declare_variant_ast_print.c Tue Oct  8 08:56:43 2019
@@ -8,7 +8,7 @@ int foo(void);
 
 #pragma omp declare variant(foo) match(xxx={}, yyy={ccc})
 #pragma omp declare variant(foo) match(xxx={vvv})
-#pragma omp declare variant(foo) match(implementation={vendor(ibm)}, 
implementation={vendor(llvm)})
+#pragma omp declare variant(foo) match(implementation={vendor(llvm)})
 #pragma omp declare variant(foo) match(implementation={vendor(unknown)})
 #pragma omp declare variant(foo) match(implementation={vendor(score(5): ibm, 
xxx)})
 int bar(void);
@@ -17,6 +17,5 @@ int bar(void);
 // CHECK-NEXT: #pragma omp declare variant(foo) 
match(implementation={vendor(score(5):ibm)})
 // CHECK-NEXT: #pragma omp declare variant(foo) 
match(implementation={vendor(score(5):xxx)})
 // CHECK-NEXT: #pragma omp declare variant(foo) 
match(implementation={vendor(unknown)})
-// CHECK-NEXT: #pragma omp declare variant(foo) 
match(implementation={vendor(ibm)})
 // CHECK-NEXT: #pragma omp declare variant(foo) 
match(implementation={vendor(llvm)})
 // CHECK-NEXT: int bar();

Modified: cfe/trunk/test/OpenMP/declare_variant_ast_print.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/declare_variant_ast_print.cpp?rev=374072&r1=374071&r2=374072&view=diff
==
--- cfe/trunk/test/OpenMP/declare_variant_ast_print.cpp (original)
+++ cfe/trunk/test/OpenMP/declare_variant_ast_print.cpp Tue Oct  8 08:56:43 2019
@@ -19,12 +19,11 @@ T foofoo() { return T(); }
 
 // CHECK:  #pragma omp declare va

[PATCH] D68531: [WebAssembly] Add builtin and intrinsic for v8x16.swizzle

2019-10-08 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin accepted this revision.
aheejin added a comment.
This revision is now accepted and ready to land.

> LLVM produces a poison value if the dynamic swizzle indices are greater than 
> the vector size, but the WebAssembly instruction sets the corresponding 
> output lane to zero.

Where do we set those undef or poison lanes to zero?




Comment at: clang/include/clang/Basic/BuiltinsWebAssembly.def:63
 // SIMD builtins
+TARGET_BUILTIN(__builtin_wasm_swizzle_v8x16, "V16cV16cV16c", "nc", 
"unimplemented-simd128")
+

Is the second indices vector always v8x16 too?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68531



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


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-08 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:35
+  // Only support 32 and 64 bit
+  if (!IsArch32Bit && !IsArch64Bit)
+llvm_unreachable("Unsupported bit width value");

Is there any reason to use llvm_unreachable here? I think we should use  
'assertion' instead here:

```
assert((IsArch32Bit || IsArch64Bit) && "...");
```



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:54
+  } else {
+assert(Output.isNothing() && "Invalid output.");
+  }

I am not sure, if we compile with assertion off, does this extra 'else' {} have 
any side effect?



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:70
+
+  if (!Args.hasArg(options::OPT_nostdlib)) {
+const char *crt0 = nullptr;

line 38 and line 70 use the same query, should they be put together? Or is 
there any exact order we should follow to push args into 'CmdArgs'?



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:93
+  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
+// Support POSIX threads if "-pthreads" or 
+// "-pthread" is present

One line of comment can be <= 80 characters.



Comment at: clang/lib/Driver/ToolChains/AIX.h:33
+const char *LinkingOutput) const override;
+};
+} // end namespace aix

An extra blank line preferred below.



Comment at: clang/lib/Driver/ToolChains/AIX.h:43
+  const llvm::opt::ArgList &Args);
+  ~AIX() override;
+

Since we are not doing anything special in AIX toolchain destructor, seems like 
we don't need to override it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340



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


[PATCH] D68627: [Sema][X86] Consider target attribute into the checks in validateOutputSize and validateInputSize.

2019-10-08 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: clang/include/clang/Basic/TargetInfo.h:947
 
-  virtual bool validateOutputSize(StringRef /*Constraint*/,
+  virtual bool validateOutputSize(const llvm::StringMap &FeatureMap,
+  StringRef /*Constraint*/,

Other Parameter names are commented out (presumably to avoid an unused param 
warning?).  Do we need to do that for this parameter as well?



Comment at: clang/lib/Sema/SemaStmtAsm.cpp:240
 
+void getFunctionFeatureMap(llvm::StringMap &FeatureMap,
+   DiagnosticsEngine &Diags,

First, this ought to be static.  Second, since this is basically identical to 
what we do for CodeGen, I wonder if this needs to just be a member of 
Sema/ASTContext or something.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68627



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


[PATCH] D68652: [driver][hip] Skip bundler if host action is nothing.

2019-10-08 Thread Michael Liao via Phabricator via cfe-commits
hliao created this revision.
hliao added reviewers: sfantao, tra, yaxunl.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68652

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/hip-syntax-only.hip


Index: clang/test/Driver/hip-syntax-only.hip
===
--- /dev/null
+++ clang/test/Driver/hip-syntax-only.hip
@@ -0,0 +1,9 @@
+// REQUIRES: clang-driver
+// REQUIRES: x86-registered-target
+// REQUIRES: amdgpu-registered-target
+
+// RUN: %clang -### -x hip -nogpulib -target x86_64 -fsyntax-only %s 2>&1 | 
FileCheck %s
+
+// CHECK-DAG: clang{{.*}}" "-cc1" {{.*}} "-fcuda-is-device"
+// CHECK-DAG: clang{{.*}}" "-cc1" "-triple" "x86_64"
+// CHECK-NOT: clang-offload-bundler"
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -3105,7 +3105,8 @@
 // the resulting list. Otherwise, just append the device actions. For
 // device only compilation, HostAction is a null pointer, therefore only do
 // this when HostAction is not a null pointer.
-if (CanUseBundler && HostAction && !OffloadAL.empty()) {
+if (CanUseBundler && HostAction &&
+HostAction->getType() != types::TY_Nothing && !OffloadAL.empty()) {
   // Add the host action to the list in order to create the bundling 
action.
   OffloadAL.push_back(HostAction);
 


Index: clang/test/Driver/hip-syntax-only.hip
===
--- /dev/null
+++ clang/test/Driver/hip-syntax-only.hip
@@ -0,0 +1,9 @@
+// REQUIRES: clang-driver
+// REQUIRES: x86-registered-target
+// REQUIRES: amdgpu-registered-target
+
+// RUN: %clang -### -x hip -nogpulib -target x86_64 -fsyntax-only %s 2>&1 | FileCheck %s
+
+// CHECK-DAG: clang{{.*}}" "-cc1" {{.*}} "-fcuda-is-device"
+// CHECK-DAG: clang{{.*}}" "-cc1" "-triple" "x86_64"
+// CHECK-NOT: clang-offload-bundler"
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -3105,7 +3105,8 @@
 // the resulting list. Otherwise, just append the device actions. For
 // device only compilation, HostAction is a null pointer, therefore only do
 // this when HostAction is not a null pointer.
-if (CanUseBundler && HostAction && !OffloadAL.empty()) {
+if (CanUseBundler && HostAction &&
+HostAction->getType() != types::TY_Nothing && !OffloadAL.empty()) {
   // Add the host action to the list in order to create the bundling action.
   OffloadAL.push_back(HostAction);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62731: [RFC] Add support for options -frounding-math, -fp-model=, and -fp-exception-behavior=, : Specify floating point behavior

2019-10-08 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Thank you, this looks very clean now.




Comment at: clang/docs/UsersManual.rst:1318
+   mode informs the compiler that it must not assume any particular
+   rounding mode.
+

"represent *the* corresponding IEEE rounding rules"



Comment at: clang/docs/UsersManual.rst:1330
+   and ``fast``.
+   Details:
+

"provided by other, single-purpose floating point options."



Comment at: clang/docs/UsersManual.rst:1341
+   has been selected, then the compiler will issue a diagnostic warning
+   that the override has occurred.
+

That's not typical driver behavior; why this choice?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62731



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


Re: r373743 - [NFCI] Improve the -Wbool-operation's warning message

2019-10-08 Thread Arthur O'Dwyer via cfe-commits
On Mon, Oct 7, 2019 at 6:58 PM Dávid Bolvanský 
wrote:
>> FWIW I found the "always evaluates to 'true'" bit important to
>> understand the warning.
>
> Yeah. I moved this check somewhere else, so we can print precise message:
> r373973 should emit "bitwise negation of a boolean expression always
> evaluates to 'true'; did you mean logical negation?" where possible.
> In the suspicious case like int i = ~b there is a general message
> "bitwise negation of a boolean expression; did you mean logical
> negation?".
>
> I like it now. What do you think? fine for you?

I see. Yes, all the cases I tried produce appropriate diagnostics. I like
it!

Hm, there is no "bitwise negation of a boolean expression always
> evaluates to 'true'; did you mean logical negation?" for chromium
> case [ https://bugs.chromium.org/p/chromium/issues/detail?id=1011810 ].
> I will try to fix it.


The important part there seems to be that the result of `~b` (which must be
either -1 or -2) is used as the operand to `!=` or `==`.
My opinion is that it is not worth the extra complication just to improve
the error message for this case.
It would be interesting to do some kind of *general*-purpose dataflow
before emitting diagnostics...
I notice that Clang's optimizer is smart enough to optimize
bool foo(bool a, bool b) {
return a == ~b;
}
bool bar(int x) {
return x + 1 < -INT_MAX;
}
into `return 0`. If it could propagate that information up and produce a
diagnostic, users might appreciate that. But the challenge as always is
that we can never tell if the user might sometimes be doing that sort of
thing on purpose (in inlined code, in macros, in generated code, etc).

my $.02,
–Arthur
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68562: [clangd] Add RemoveUsingNamespace tweak.

2019-10-08 Thread UTKARSH SAXENA via Phabricator via cfe-commits
usaxena95 updated this revision to Diff 223898.
usaxena95 marked 8 inline comments as done.
usaxena95 added a comment.

Addressed comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68562

Files:
  clang-tools-extra/clangd/AST.cpp
  clang-tools-extra/clangd/AST.h
  clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt
  clang-tools-extra/clangd/refactor/tweaks/RemoveUsingNamespace.cpp
  clang-tools-extra/clangd/unittests/TweakTests.cpp

Index: clang-tools-extra/clangd/unittests/TweakTests.cpp
===
--- clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -69,7 +69,8 @@
   EXPECT_EQ(apply("^if (true) {return 100;} else {continue;}"),
 "if (true) {continue;} else {return 100;}");
   EXPECT_EQ(apply("^if () {return 100;} else {continue;}"),
-"if () {continue;} else {return 100;}") << "broken condition";
+"if () {continue;} else {return 100;}")
+  << "broken condition";
   EXPECT_AVAILABLE("^i^f^^(^t^r^u^e^) { return 100; } ^e^l^s^e^ { continue; }");
   EXPECT_UNAVAILABLE("if (true) {^return ^100;^ } else { ^continue^;^ }");
   // Available in subexpressions of the condition;
@@ -100,7 +101,7 @@
   EXPECT_UNAVAILABLE(R"cpp(R"(multi )" ^"token " u8"str\ning")cpp"); // nonascii
   EXPECT_UNAVAILABLE(R"cpp(^R^"^(^multi )" "token " "str\ning")cpp"); // raw
   EXPECT_UNAVAILABLE(R"cpp(^"token\n" __FILE__)cpp"); // chunk is macro
-  EXPECT_UNAVAILABLE(R"cpp(^"a\r\n";)cpp"); // forbidden escape char
+  EXPECT_UNAVAILABLE(R"cpp(^"a\r\n";)cpp");   // forbidden escape char
 
   const char *Input = R"cpp(R"(multi
 token)" "\nst^ring\n" "literal")cpp";
@@ -286,11 +287,11 @@
  void f(int a) {
int y = PLUS([[1+a]]);
  })cpp",
-  /*FIXME: It should be extracted like this.
-   R"cpp(#define PLUS(x) x++
- void f(int a) {
-   auto dummy = 1+a; int y = PLUS(dummy);
- })cpp"},*/
+   /*FIXME: It should be extracted like this.
+R"cpp(#define PLUS(x) x++
+  void f(int a) {
+auto dummy = 1+a; int y = PLUS(dummy);
+  })cpp"},*/
R"cpp(#define PLUS(x) x++
  void f(int a) {
auto dummy = PLUS(1+a); int y = dummy;
@@ -301,13 +302,13 @@
if(1)
 LOOP(5 + [[3]])
  })cpp",
-  /*FIXME: It should be extracted like this. SelectionTree needs to be
-* fixed for macros.
-   R"cpp(#define LOOP(x) while (1) {a = x;}
-   void f(int a) {
- auto dummy = 3; if(1)
-  LOOP(5 + dummy)
-   })cpp"},*/
+   /*FIXME: It should be extracted like this. SelectionTree needs to be
+ * fixed for macros.
+R"cpp(#define LOOP(x) while (1) {a = x;}
+void f(int a) {
+  auto dummy = 3; if(1)
+   LOOP(5 + dummy)
+})cpp"},*/
R"cpp(#define LOOP(x) while (1) {a = x;}
  void f(int a) {
auto dummy = LOOP(5 + 3); if(1)
@@ -403,8 +404,8 @@
  void f() {
auto dummy = S(2) + S(3) + S(4); S x = S(1) + dummy + S(5);
  })cpp"},
-   // Don't try to analyze across macro boundaries
-   // FIXME: it'd be nice to do this someday (in a safe way)
+  // Don't try to analyze across macro boundaries
+  // FIXME: it'd be nice to do this someday (in a safe way)
   {R"cpp(#define ECHO(X) X
  void f() {
int x = 1 + [[ECHO(2 + 3) + 4]] + 5;
@@ -521,7 +522,7 @@
   StartsWith("fail: Could not expand type of lambda expression"));
   // inline namespaces
   EXPECT_EQ(apply("au^to x = inl_ns::Visible();"),
-  "Visible x = inl_ns::Visible();");
+"Visible x = inl_ns::Visible();");
   // local class
   EXPECT_EQ(apply("namespace x { void y() { struct S{}; ^auto z = S(); } }"),
 "namespace x { void y() { struct S{}; S z = S(); } }");
@@ -656,6 +657,214 @@
   EXPECT_THAT(apply(" for(;;) { [[while(1) break; break;]] }"),
   StartsWith("fail"));
 }
+
+TWEAK_TEST(RemoveUsingNamespace);
+TEST_F(RemoveUsingNamespaceTest, All) {
+  std::pair Cases[] = {
+  {// Remove all occurrences of ns. Qualify only unqualified.
+   R"cpp(
+  namespace ns1 { struct vector {}; }
+  namespace ns2 { struct map {}; }
+  using namespace n^s1;
+  using namespace ns2;
+  using namespace ns1;
+  int main() {
+ns1::vector v1;
+vector v2;
+map m1;
+  }
+)cpp",
+   R"cpp(
+  namespace ns1 { struct vector {}; }
+  namespace 

[PATCH] D68562: [clangd] Add RemoveUsingNamespace tweak.

2019-10-08 Thread UTKARSH SAXENA via Phabricator via cfe-commits
usaxena95 added inline comments.



Comment at: clang-tools-extra/clangd/refactor/tweaks/RemoveUsingNamespace.cpp:99
+return false;
+  if (!dyn_cast(TargetDirective->getDeclContext()))
+return false;

ilya-biryukov wrote:
> I believe this check is redundant in presence of `isTopLevelDecl()`...
> (It used to check the 'using namespace' is not inside a function body)
Aah. Makes sense.



Comment at: clang-tools-extra/clangd/unittests/TweakTests.cpp:781
+namespace bb { struct map {}; }
+using namespace bb; // Qualifies this.
+  }

ilya-biryukov wrote:
> Argh, this should definitely be fixed :-(
> One simple way to handle this particular only qualify references, which come 
> **after** the first `using namespace` we are removing.
> 
> There's a `SourceManager::isBeforeInTranslationUnit` function that can be 
> used to find out whether something is written before or after a particular 
> point.
> 
> This won't fix all of the cases, but fixing in the general case seems hard.
We also need to qualify the map in such cases.
I have made an attempt to fix this by traversing all the parents namespace decl 
and checking whether they are equal to the concerned namespace.
But this introduces other problems:
```
  namespace aa { namespace bb { struct map {}; }}
  using namespace aa::bb;
  using namespace a^a;
  int main() {
map m;
  }
```
get changed to 
```
  namespace aa { namespace bb { struct map {}; }}
  using namespace aa::bb;
  
  int main() {
aa::map m;
  }
```
Here aa::map is invalid.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68562



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


[PATCH] D67980: [BPF] do compile-once run-everywhere relocation for bitfields

2019-10-08 Thread Alexei Starovoitov via Phabricator via cfe-commits
ast accepted this revision.
ast added a comment.

perfect. ship it


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67980



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


r374093 - [OPENMP50]Do not allow multiple same context traits in the same context

2019-10-08 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Tue Oct  8 10:47:52 2019
New Revision: 374093

URL: http://llvm.org/viewvc/llvm-project?rev=374093&view=rev
Log:
[OPENMP50]Do not allow multiple same context traits in the same context
selector.

According to OpenMP 5.0, 2.3.2 Context Selectors, Restrictions, each
trait-selector-name can only be specified once. Added check for this
restriction.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/Parse/ParseOpenMP.cpp
cfe/trunk/test/OpenMP/declare_variant_ast_print.c
cfe/trunk/test/OpenMP/declare_variant_ast_print.cpp
cfe/trunk/test/OpenMP/declare_variant_messages.c
cfe/trunk/test/OpenMP/declare_variant_messages.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=374093&r1=374092&r2=374093&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Tue Oct  8 10:47:52 
2019
@@ -1215,6 +1215,11 @@ def err_omp_declare_variant_ctx_set_muti
   "context selector set '%0' is used already in the same 'omp declare variant' 
directive">;
 def note_omp_declare_variant_ctx_set_used_here : Note<
   "previously context selector set '%0' used here">;
+def err_omp_expected_comma_brace : Error<"expected '}' or ',' after '%0'">;
+def err_omp_declare_variant_ctx_mutiple_use : Error<
+  "context trait selector '%0' is used already in the same '%1' context 
selector set of 'omp declare variant' directive">;
+def note_omp_declare_variant_ctx_used_here : Note<
+  "previously context trait selector '%0' used here">;
 def warn_omp_more_one_device_type_clause : Warning<
   "more than one 'device_type' clause is specified">,
   InGroup;

Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=374093&r1=374092&r2=374093&view=diff
==
--- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original)
+++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Tue Oct  8 10:47:52 2019
@@ -815,7 +815,7 @@ static ExprResult parseContextScore(Pars
 /// 'vendor' '(' [ 'score' '('  ')' ':' ]  { ','  
}
 /// ')'
 static void parseImplementationSelector(
-Parser &P, SourceLocation Loc,
+Parser &P, SourceLocation Loc, llvm::StringMap &UsedCtx,
 llvm::function_ref
 Callback) {
@@ -832,6 +832,15 @@ static void parseImplementationSelector(
   }
   SmallString<16> Buffer;
   StringRef CtxSelectorName = P.getPreprocessor().getSpelling(Tok, Buffer);
+  auto Res = UsedCtx.try_emplace(CtxSelectorName, Tok.getLocation());
+  if (!Res.second) {
+// OpenMP 5.0, 2.3.2 Context Selectors, Restrictions.
+// Each trait-selector-name can only be specified once.
+P.Diag(Tok.getLocation(), diag::err_omp_declare_variant_ctx_mutiple_use)
+<< CtxSelectorName << "implementation";
+P.Diag(Res.first->getValue(), diag::note_omp_declare_variant_ctx_used_here)
+<< CtxSelectorName;
+  }
   OMPDeclareVariantAttr::CtxSelectorType CSKind =
   OMPDeclareVariantAttr::CtxUnknown;
   (void)OMPDeclareVariantAttr::ConvertStrToCtxSelectorType(CtxSelectorName,
@@ -932,17 +941,25 @@ bool Parser::parseOpenMPContextSelectors
   OMPDeclareVariantAttr::CtxSetUnknown;
   (void)OMPDeclareVariantAttr::ConvertStrToCtxSelectorSetType(
   CtxSelectorSetName, CSSKind);
-  switch (CSSKind) {
-  case OMPDeclareVariantAttr::CtxSetImplementation:
-parseImplementationSelector(*this, Loc, Callback);
-break;
-  case OMPDeclareVariantAttr::CtxSetUnknown:
-// Skip until either '}', ')', or end of directive.
-while (!SkipUntil(tok::r_brace, tok::r_paren,
-  tok::annot_pragma_openmp_end, StopBeforeMatch))
-  ;
-break;
-  }
+  llvm::StringMap UsedCtx;
+  do {
+switch (CSSKind) {
+case OMPDeclareVariantAttr::CtxSetImplementation:
+  parseImplementationSelector(*this, Loc, UsedCtx, Callback);
+  break;
+case OMPDeclareVariantAttr::CtxSetUnknown:
+  // Skip until either '}', ')', or end of directive.
+  while (!SkipUntil(tok::r_brace, tok::r_paren,
+tok::annot_pragma_openmp_end, StopBeforeMatch))
+;
+  break;
+}
+const Token PrevTok = Tok;
+if (!TryConsumeToken(tok::comma) && Tok.isNot(tok::r_brace))
+  Diag(Tok, diag::err_omp_expected_comma_brace)
+  << (PrevTok.isAnnotation() ? "context selector trait"
+ : PP.getSpelling(PrevTok));
+  } while (Tok.is(tok::identifier));
   // Parse '}'.
   (void)TBr.consumeClose();
 }

Modified: cfe/trunk/test/OpenMP/declare_variant_ast_print.c
URL: 
http://

[PATCH] D33029: [clang-format] add option for dangling parenthesis

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

I tried the patch and rebased it locally (as there were conflicts with the 
current trunk)

The change caused other tests to fail (which doesn't completely surprise me)

most tests failures look associated with positioning of trailing brace for 
example

  @@ -1,4 +1,4 @@
   void f() {
 bar([]() {} // Did not respect SpacesBeforeTrailingComments
  -  );
  + );
   }

Below is a list of the tests that fail

  [==] 700 tests from 21 test cases ran. (6687 ms total)
  [  PASSED  ] 692 tests.
  [  FAILED  ] 8 tests, listed below:
  [  FAILED  ] FormatTest.WrapsTemplateDeclarations
  [  FAILED  ] FormatTest.BreaksStringLiteralsWithin_TMacro
  [  FAILED  ] FormatTest.FormatsLambdas
  [  FAILED  ] FormatTest.WrappedClosingParenthesisIndent
  [  FAILED  ] FormatTestJS.FunctionParametersTrailingComma
  [  FAILED  ] FormatTestJS.FunctionLiterals
  [  FAILED  ] FormatTestJS.ArrowFunctions
  [  FAILED  ] FormatTestJS.NestedLiterals
  
   8 FAILED TESTS


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

https://reviews.llvm.org/D33029



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


[PATCH] D68652: [driver][hip] Skip bundler if host action is nothing.

2019-10-08 Thread Artem Belevich via Phabricator via cfe-commits
tra accepted this revision.
tra added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/test/Driver/hip-syntax-only.hip:7
+
+// CHECK-DAG: clang{{.*}}" "-cc1" {{.*}} "-fcuda-is-device"
+// CHECK-DAG: clang{{.*}}" "-cc1" "-triple" "x86_64"

I'd include `-target ` and a comment describing that we're making sure 
that both host and device compilations are still executed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68652



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


[PATCH] D68652: [driver][hip] Skip bundler if host action is nothing.

2019-10-08 Thread Michael Liao via Phabricator via cfe-commits
hliao marked an inline comment as done.
hliao added inline comments.



Comment at: clang/test/Driver/hip-syntax-only.hip:7
+
+// CHECK-DAG: clang{{.*}}" "-cc1" {{.*}} "-fcuda-is-device"
+// CHECK-DAG: clang{{.*}}" "-cc1" "-triple" "x86_64"

tra wrote:
> I'd include `-target ` and a comment describing that we're making sure 
> that both host and device compilations are still executed.
won't -fcuda-is-device be sufficient? that's option specific to device-side 
compilation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68652



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


r374097 - [driver][hip] Skip bundler if host action is nothing.

2019-10-08 Thread Michael Liao via cfe-commits
Author: hliao
Date: Tue Oct  8 11:06:51 2019
New Revision: 374097

URL: http://llvm.org/viewvc/llvm-project?rev=374097&view=rev
Log:
[driver][hip] Skip bundler if host action is nothing.

Reviewers: sfantao, tra, yaxunl

Subscribers: cfe-commits

Tags: #clang

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

Added:
cfe/trunk/test/Driver/hip-syntax-only.hip
Modified:
cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=374097&r1=374096&r2=374097&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Oct  8 11:06:51 2019
@@ -3108,7 +3108,8 @@ public:
 // the resulting list. Otherwise, just append the device actions. For
 // device only compilation, HostAction is a null pointer, therefore only do
 // this when HostAction is not a null pointer.
-if (CanUseBundler && HostAction && !OffloadAL.empty()) {
+if (CanUseBundler && HostAction &&
+HostAction->getType() != types::TY_Nothing && !OffloadAL.empty()) {
   // Add the host action to the list in order to create the bundling 
action.
   OffloadAL.push_back(HostAction);
 

Added: cfe/trunk/test/Driver/hip-syntax-only.hip
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/hip-syntax-only.hip?rev=374097&view=auto
==
--- cfe/trunk/test/Driver/hip-syntax-only.hip (added)
+++ cfe/trunk/test/Driver/hip-syntax-only.hip Tue Oct  8 11:06:51 2019
@@ -0,0 +1,11 @@
+// REQUIRES: clang-driver
+// REQUIRES: x86-registered-target
+// REQUIRES: amdgpu-registered-target
+
+// RUN: %clang -### -x hip -nogpulib -target x86_64 -fsyntax-only %s 2>&1 | 
FileCheck %s
+
+// Check that there are commands for both host- and device-side compilations.
+//
+// CHECK-DAG: clang{{.*}}" "-cc1" {{.*}} "-fcuda-is-device"
+// CHECK-DAG: clang{{.*}}" "-cc1" "-triple" "x86_64"
+// CHECK-NOT: clang-offload-bundler"


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


[PATCH] D68652: [driver][hip] Skip bundler if host action is nothing.

2019-10-08 Thread Michael Liao via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6334a59454ef: [driver][hip] Skip bundler if host action is 
nothing. (authored by hliao).

Changed prior to commit:
  https://reviews.llvm.org/D68652?vs=223890&id=223905#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68652

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/hip-syntax-only.hip


Index: clang/test/Driver/hip-syntax-only.hip
===
--- /dev/null
+++ clang/test/Driver/hip-syntax-only.hip
@@ -0,0 +1,11 @@
+// REQUIRES: clang-driver
+// REQUIRES: x86-registered-target
+// REQUIRES: amdgpu-registered-target
+
+// RUN: %clang -### -x hip -nogpulib -target x86_64 -fsyntax-only %s 2>&1 | 
FileCheck %s
+
+// Check that there are commands for both host- and device-side compilations.
+//
+// CHECK-DAG: clang{{.*}}" "-cc1" {{.*}} "-fcuda-is-device"
+// CHECK-DAG: clang{{.*}}" "-cc1" "-triple" "x86_64"
+// CHECK-NOT: clang-offload-bundler"
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -3108,7 +3108,8 @@
 // the resulting list. Otherwise, just append the device actions. For
 // device only compilation, HostAction is a null pointer, therefore only do
 // this when HostAction is not a null pointer.
-if (CanUseBundler && HostAction && !OffloadAL.empty()) {
+if (CanUseBundler && HostAction &&
+HostAction->getType() != types::TY_Nothing && !OffloadAL.empty()) {
   // Add the host action to the list in order to create the bundling 
action.
   OffloadAL.push_back(HostAction);
 


Index: clang/test/Driver/hip-syntax-only.hip
===
--- /dev/null
+++ clang/test/Driver/hip-syntax-only.hip
@@ -0,0 +1,11 @@
+// REQUIRES: clang-driver
+// REQUIRES: x86-registered-target
+// REQUIRES: amdgpu-registered-target
+
+// RUN: %clang -### -x hip -nogpulib -target x86_64 -fsyntax-only %s 2>&1 | FileCheck %s
+
+// Check that there are commands for both host- and device-side compilations.
+//
+// CHECK-DAG: clang{{.*}}" "-cc1" {{.*}} "-fcuda-is-device"
+// CHECK-DAG: clang{{.*}}" "-cc1" "-triple" "x86_64"
+// CHECK-NOT: clang-offload-bundler"
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -3108,7 +3108,8 @@
 // the resulting list. Otherwise, just append the device actions. For
 // device only compilation, HostAction is a null pointer, therefore only do
 // this when HostAction is not a null pointer.
-if (CanUseBundler && HostAction && !OffloadAL.empty()) {
+if (CanUseBundler && HostAction &&
+HostAction->getType() != types::TY_Nothing && !OffloadAL.empty()) {
   // Add the host action to the list in order to create the bundling action.
   OffloadAL.push_back(HostAction);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r374098 - [NFC] Attempt to make ubsan-blacklist-vfs test pass on Windows

2019-10-08 Thread Jan Korous via cfe-commits
Author: jkorous
Date: Tue Oct  8 11:13:04 2019
New Revision: 374098

URL: http://llvm.org/viewvc/llvm-project?rev=374098&view=rev
Log:
[NFC] Attempt to make ubsan-blacklist-vfs test pass on Windows

Previously disabled in d0c2d5daa3e

Modified:
cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c

Modified: cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c?rev=374098&r1=374097&r2=374098&view=diff
==
--- cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c (original)
+++ cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c Tue Oct  8 11:13:04 2019
@@ -1,5 +1,3 @@
-// UNSUPPORTED: system-windows
-
 // Verify ubsan doesn't emit checks for blacklisted functions and files
 // RUN: echo "fun:hash" > %t-func.blacklist
 // RUN: echo "src:%s" | sed -e 's/\\//g' > %t-file.blacklist
@@ -7,9 +5,9 @@
 // RUN: rm -f %t-vfsoverlay.yaml
 // RUN: rm -f %t-nonexistent.blacklist
 // RUN: sed -e "s|@DIR@|%/T|g" %S/Inputs/sanitizer-blacklist-vfsoverlay.yaml | 
sed -e "s|@REAL_FILE@|%/t-func.blacklist|g" | sed -e 
"s|@NONEXISTENT_FILE@|%/t-nonexistent.blacklist|g" > %t-vfsoverlay.yaml
-// RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay 
%t-vfsoverlay.yaml -fsanitize-blacklist=%T/only-virtual-file.blacklist 
-emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC
+// RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay 
%t-vfsoverlay.yaml -fsanitize-blacklist=%/T/only-virtual-file.blacklist 
-emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC
 
-// RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay 
%t-vfsoverlay.yaml -fsanitize-blacklist=%T/invalid-virtual-file.blacklist 
-emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID-MAPPED-FILE
+// RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay 
%t-vfsoverlay.yaml -fsanitize-blacklist=%/T/invalid-virtual-file.blacklist 
-emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID-MAPPED-FILE
 // INVALID-MAPPED-FILE: invalid-virtual-file.blacklist': No such file or 
directory
 
 // RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay 
%t-vfsoverlay.yaml -fsanitize-blacklist=%t-nonexistent.blacklist -emit-llvm %s 
-o - 2>&1 | FileCheck %s --check-prefix=INVALID


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


[PATCH] D68531: [WebAssembly] Add builtin and intrinsic for v8x16.swizzle

2019-10-08 Thread Thomas Lively via Phabricator via cfe-commits
tlively marked an inline comment as done.
tlively added a comment.

In D68531#1699855 , @aheejin wrote:

> > LLVM produces a poison value if the dynamic swizzle indices are greater 
> > than the vector size, but the WebAssembly instruction sets the 
> > corresponding output lane to zero.
>
> Where do we set those undef or poison lanes to zero?


We don't do that in the toolchain. It's the runtime semantics implemented in 
engines that set the output lanes to zero.




Comment at: clang/include/clang/Basic/BuiltinsWebAssembly.def:63
 // SIMD builtins
+TARGET_BUILTIN(__builtin_wasm_swizzle_v8x16, "V16cV16cV16c", "nc", 
"unimplemented-simd128")
+

aheejin wrote:
> Is the second indices vector always v8x16 too?
Yes, that's the only version of swizzling we have for now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68531



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


r374099 - [BPF] do compile-once run-everywhere relocation for bitfields

2019-10-08 Thread Yonghong Song via cfe-commits
Author: yhs
Date: Tue Oct  8 11:23:17 2019
New Revision: 374099

URL: http://llvm.org/viewvc/llvm-project?rev=374099&view=rev
Log:
[BPF] do compile-once run-everywhere relocation for bitfields

A bpf specific clang intrinsic is introduced:
   u32 __builtin_preserve_field_info(member_access, info_kind)
Depending on info_kind, different information will
be returned to the program. A relocation is also
recorded for this builtin so that bpf loader can
patch the instruction on the target host.
This clang intrinsic is used to get certain information
to facilitate struct/union member relocations.

The offset relocation is extended by 4 bytes to
include relocation kind.
Currently supported relocation kinds are
 enum {
FIELD_BYTE_OFFSET = 0,
FIELD_BYTE_SIZE,
FIELD_EXISTENCE,
FIELD_SIGNEDNESS,
FIELD_LSHIFT_U64,
FIELD_RSHIFT_U64,
 };
for __builtin_preserve_field_info. The old
access offset relocation is covered by
FIELD_BYTE_OFFSET = 0.

An example:
struct s {
int a;
int b1:9;
int b2:4;
};
enum {
FIELD_BYTE_OFFSET = 0,
FIELD_BYTE_SIZE,
FIELD_EXISTENCE,
FIELD_SIGNEDNESS,
FIELD_LSHIFT_U64,
FIELD_RSHIFT_U64,
};

void bpf_probe_read(void *, unsigned, const void *);
int field_read(struct s *arg) {
  unsigned long long ull = 0;
  unsigned offset = __builtin_preserve_field_info(arg->b2, FIELD_BYTE_OFFSET);
  unsigned size = __builtin_preserve_field_info(arg->b2, FIELD_BYTE_SIZE);
 #ifdef USE_PROBE_READ
  bpf_probe_read(&ull, size, (const void *)arg + offset);
  unsigned lshift = __builtin_preserve_field_info(arg->b2, FIELD_LSHIFT_U64);
 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
  lshift = lshift + (size << 3) - 64;
 #endif
 #else
  switch(size) {
  case 1:
ull = *(unsigned char *)((void *)arg + offset); break;
  case 2:
ull = *(unsigned short *)((void *)arg + offset); break;
  case 4:
ull = *(unsigned int *)((void *)arg + offset); break;
  case 8:
ull = *(unsigned long long *)((void *)arg + offset); break;
  }
  unsigned lshift = __builtin_preserve_field_info(arg->b2, FIELD_LSHIFT_U64);
 #endif
  ull <<= lshift;
  if (__builtin_preserve_field_info(arg->b2, FIELD_SIGNEDNESS))
return (long long)ull >> __builtin_preserve_field_info(arg->b2, 
FIELD_RSHIFT_U64);
  return ull >> __builtin_preserve_field_info(arg->b2, FIELD_RSHIFT_U64);
}

There is a minor overhead for bpf_probe_read() on big endian.

The code and relocation generated for field_read where bpf_probe_read() is
used to access argument data on little endian mode:
r3 = r1
r1 = 0
r1 = 4  <=== relocation (FIELD_BYTE_OFFSET)
r3 += r1
r1 = r10
r1 += -8
r2 = 4  <=== relocation (FIELD_BYTE_SIZE)
call bpf_probe_read
r2 = 51 <=== relocation (FIELD_LSHIFT_U64)
r1 = *(u64 *)(r10 - 8)
r1 <<= r2
r2 = 60 <=== relocation (FIELD_RSHIFT_U64)
r0 = r1
r0 >>= r2
r3 = 1  <=== relocation (FIELD_SIGNEDNESS)
if r3 == 0 goto LBB0_2
r1 s>>= r2
r0 = r1
LBB0_2:
exit

Compare to the above code between relocations FIELD_LSHIFT_U64 and
FIELD_LSHIFT_U64, the code with big endian mode has four more
instructions.
r1 = 41   <=== relocation (FIELD_LSHIFT_U64)
r6 += r1
r6 += -64
r6 <<= 32
r6 >>= 32
r1 = *(u64 *)(r10 - 8)
r1 <<= r6
r2 = 60   <=== relocation (FIELD_RSHIFT_U64)

The code and relocation generated when using direct load.
r2 = 0
r3 = 4
r4 = 4
if r4 s> 3 goto LBB0_3
if r4 == 1 goto LBB0_5
if r4 == 2 goto LBB0_6
goto LBB0_9
LBB0_6: # %sw.bb1
r1 += r3
r2 = *(u16 *)(r1 + 0)
goto LBB0_9
LBB0_3: # %entry
if r4 == 4 goto LBB0_7
if r4 == 8 goto LBB0_8
goto LBB0_9
LBB0_8: # %sw.bb9
r1 += r3
r2 = *(u64 *)(r1 + 0)
goto LBB0_9
LBB0_5: # %sw.bb
r1 += r3
r2 = *(u8 *)(r1 + 0)
goto LBB0_9
LBB0_7: # %sw.bb5
r1 += r3
r2 = *(u32 *)(r1 + 0)
LBB0_9: # %sw.epilog
r1 = 51
r2 <<= r1
r1 = 60
r0 = r2
r0 >>= r1
r3 = 1
if r3 == 0 goto LBB0_11
r2 s>>= r1
r0 = r2
LBB0_11:# %sw.epilog
exit

Considering verifier is able to do limited constant
propogation following branches. The following is the
code actually traversed.
r2 = 0
r3 = 4   <=== relocation
r4 = 4   <=== relocation
if r4 s> 3 goto LBB0_3
LBB0_3: # %entry
if r4 == 4 goto LBB0_7
LBB0_7: # %sw.bb5
r1 += r3
r2 = *(u32 *)(r1 + 0)
LBB0_9: # %sw.epilog
r1 =

[PATCH] D62731: [RFC] Add support for options -frounding-math, -fp-model=, and -fp-exception-behavior=, : Specify floating point behavior

2019-10-08 Thread Melanie Blower via Phabricator via cfe-commits
mibintc updated this revision to Diff 223908.
mibintc added a comment.

I made a couple wording changes suggested by @rjmccall


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62731

Files:
  clang/docs/UsersManual.rst
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/LangOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/fpconstrained.c
  clang/test/Driver/clang_f_opts.c
  clang/test/Driver/fast-math.c
  llvm/include/llvm/Target/TargetOptions.h

Index: llvm/include/llvm/Target/TargetOptions.h
===
--- llvm/include/llvm/Target/TargetOptions.h
+++ llvm/include/llvm/Target/TargetOptions.h
@@ -107,7 +107,7 @@
   public:
 TargetOptions()
 : PrintMachineCode(false), UnsafeFPMath(false), NoInfsFPMath(false),
-  NoNaNsFPMath(false), NoTrappingFPMath(false),
+  NoNaNsFPMath(false), NoTrappingFPMath(true), RoundingFPMath(false),
   NoSignedZerosFPMath(false),
   HonorSignDependentRoundingFPMathOption(false), NoZerosInBSS(false),
   GuaranteedTailCallOpt(false), StackSymbolOrdering(true),
@@ -154,6 +154,11 @@
 /// specifies that there are no trap handlers to handle exceptions.
 unsigned NoTrappingFPMath : 1;
 
+/// RoundingFPMath - This flag is enabled when the
+/// -enable-rounding-fp-math is specified on the command line. This
+/// specifies dynamic rounding mode.
+unsigned RoundingFPMath : 1;
+
 /// NoSignedZerosFPMath - This flag is enabled when the
 /// -enable-no-signed-zeros-fp-math is specified on the command line. This
 /// specifies that optimizations are allowed to treat the sign of a zero
Index: clang/test/Driver/fast-math.c
===
--- clang/test/Driver/fast-math.c
+++ clang/test/Driver/fast-math.c
@@ -170,11 +170,11 @@
 // RUN: %clang -### -fno-fast-math -ffast-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FAST-MATH %s
 // RUN: %clang -### -funsafe-math-optimizations -ffinite-math-only \
-// RUN: -fno-math-errno -ffp-contract=fast -c %s 2>&1 \
+// RUN: -fno-math-errno -ffp-contract=fast -fno-rounding-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FAST-MATH %s
 // RUN: %clang -### -fno-honor-infinities -fno-honor-nans -fno-math-errno \
 // RUN: -fassociative-math -freciprocal-math -fno-signed-zeros \
-// RUN: -fno-trapping-math -ffp-contract=fast -c %s 2>&1 \
+// RUN: -fno-trapping-math -ffp-contract=fast -fno-rounding-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FAST-MATH %s
 // CHECK-FAST-MATH: "-cc1"
 // CHECK-FAST-MATH: "-ffast-math"
Index: clang/test/Driver/clang_f_opts.c
===
--- clang/test/Driver/clang_f_opts.c
+++ clang/test/Driver/clang_f_opts.c
@@ -320,7 +320,6 @@
 // RUN: -fprefetch-loop-arrays\
 // RUN: -fprofile-correction  \
 // RUN: -fprofile-values  \
-// RUN: -frounding-math   \
 // RUN: -fschedule-insns  \
 // RUN: -fsignaling-nans  \
 // RUN: -fstrength-reduce \
@@ -385,7 +384,6 @@
 // CHECK-WARNING-DAG: optimization flag '-fprefetch-loop-arrays' is not supported
 // CHECK-WARNING-DAG: optimization flag '-fprofile-correction' is not supported
 // CHECK-WARNING-DAG: optimization flag '-fprofile-values' is not supported
-// CHECK-WARNING-DAG: optimization flag '-frounding-math' is not supported
 // CHECK-WARNING-DAG: optimization flag '-fschedule-insns' is not supported
 // CHECK-WARNING-DAG: optimization flag '-fsignaling-nans' is not supported
 // CHECK-WARNING-DAG: optimization flag '-fstrength-reduce' is not supported
Index: clang/test/CodeGen/fpconstrained.c
===
--- /dev/null
+++ clang/test/CodeGen/fpconstrained.c
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -ftrapping-math -frounding-math -ffp-exception-behavior=strict -emit-llvm -o - %s | FileCheck %s -check-prefix=FPMODELSTRICT
+// RUN: %clang_cc1 -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s -check-prefix=PRECISE
+// RUN: %clang_cc1 -ffast-math -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST
+// RUN: %clang_cc1 -ffast-math -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST
+// RUN: %clang_cc1 -ffast-math -ffp-contract=fast -ffp-exception-behavior=igno

[PATCH] D68640: Try to get readability-deleted-default.cpp to pass on Windows.

2019-10-08 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

In D68640#1699628 , @aaron.ballman 
wrote:

> In D68640#1699605 , @thakis wrote:
>
> > In D68640#1699563 , @gribozavr 
> > wrote:
> >
> > > It looks to me that a better fix is to fix the checker to not emit this 
> > > warning in MS compatibility mode.
> >
> >
> > The warning is about emitting "here's a redundant declaration", and the 
> > test expects an "extern inline" decl to be redundant with an "inline" 
> > definition. In ms compat mode they aren't, so the checker does not emit the 
> > warning in ms mode (but does elsewhere).
> >
> > Arguably having a check that suggests removing a bunch of code that's 
> > necessary in some modes (ms compat, or C) is a bit weird, so maybe we 
> > should never emit this diag for extern inlines. I don't know which policy 
> > decisions clang-tidy usually makes for cross-platform development – does it 
> > prioritize cross-platform dev, or completeness assuming single-platform dev?
>
>
> I think it depends on the check, but for a check in the `readability` module, 
> I'm not certain there's a clear answer. My gut feeling is to diagnose based 
> on platform behavior because the goal is to remove redundancy and that 
> requires platform-specific knowledge. But it's not a strong opinion.
>
> > (Finally, these tests have been broken for months, folks are landing lots 
> > of stuff with "UNSUPPORTED: win32" (clang VFS patches recently, for 
> > example) and we're struggling just keeping tests green on Windows. There's 
> > no shortage of possible implicit TODOs :) I think it's better to land this 
> > to get the check-clang-tools target green than it is to mark the test 
> > UNSUPPORTED.)
>
> To be clear, I wasn't suggesting we fix it in this patch, just that we add a 
> FIXME/TODO to the test and make sure we're tracking the bug. Explicit TODO > 
> implicit TODO.


Can you clarify what exactly the TODO is? As-is, the check suggests removing 
the redeclaration where it's a no-op (non-ms) but not where it isn't (C, ms 
compat). If I understand your reply correctly, this is desired behavior. Is the 
TODO then to have test coverage for the ms compat case? If so: Can clang-tidy 
checks have different CHECK-MESSAGES suffixes in the same file? If so, we can 
just run the test once with -fms-compat and once with -fno-ms-compat and expect 
the diag in one case and not in the other.


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

https://reviews.llvm.org/D68640



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


[PATCH] D68099: [MS ABI]: Fix mangling function arguments for template types to be compatible with MSVC

2019-10-08 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

(It regressed in D62780 ; I had bisected that 
bit.)


Repository:
  rC Clang

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

https://reviews.llvm.org/D68099



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


[PATCH] D62731: [RFC] Add support for options -frounding-math, -fp-model=, and -fp-exception-behavior=, : Specify floating point behavior

2019-10-08 Thread Melanie Blower via Phabricator via cfe-commits
mibintc marked 2 inline comments as done.
mibintc added inline comments.



Comment at: clang/docs/UsersManual.rst:1341
+   has been selected, then the compiler will issue a diagnostic warning
+   that the override has occurred.
+

rjmccall wrote:
> That's not typical driver behavior; why this choice?
The rationale for the warnings is that the floating point options are 
sufficiently complicated that it makes sense to warn the uses that one of the 
later options supplied on the command line is undoing a choice made earlier.  
It's not obvious that e.g. the setting for fassociative-math is also controlled 
by  -fp-model=strict


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62731



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


[PATCH] D62731: [RFC] Add support for options -frounding-math, -fp-model=, and -fp-exception-behavior=, : Specify floating point behavior

2019-10-08 Thread Melanie Blower via Phabricator via cfe-commits
mibintc marked 2 inline comments as done.
mibintc added inline comments.



Comment at: clang/include/clang/Driver/Options.td:927
 def fdenormal_fp_math_EQ : Joined<["-"], "fdenormal-fp-math=">, 
Group, Flags<[CC1Option]>;
+def ffp_model_EQ : Joined<["-"], "ffp-model=">, Group, 
Flags<[DriverOption]>,
+  HelpText<"Controls the semantics of floating-point calculations.">;

The ffp-model= option is just  a Driver option, it is rewritten into 
combinations of lower level options like ffp-exception-behavior and 
frounding-math: it's not a cc1 option.



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:2326
   bool SignedZeros = true;
-  bool TrappingMath = true;
+  bool TrappingMath = false;
+  bool RoundingFPMath = false;

By default, floating point exceptions are masked. Previously this was set to 
true, but the value wasn't used. This patch implements support for trapping-math


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62731



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


[PATCH] D68099: [MS ABI]: Fix mangling function arguments for template types to be compatible with MSVC

2019-10-08 Thread Nico Weber via Phabricator via cfe-commits
thakis accepted this revision.
thakis added a comment.

lgtm. I finally got around to understanding the patch. Sorry for the delay, 
thanks for the fix! Next time you upload a patch, please upload it with more 
context (see 
https://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface).

Note to self: The mangleSourceName() call mentioned in the patch description is 
14 lines further up. `mangleSourceName(TemplateMangling);` outputs the number 
if there's a backref, else it outputs the argument followed by a '@'. Since we 
only cache mangleSourceName()'s argument, we need to append '@' ourselves. It 
seems a tiny bit nicer to store the '@' in the cache, but as-is is fine too.

Do you need someone to commit this for you?


Repository:
  rC Clang

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

https://reviews.llvm.org/D68099



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


[PATCH] D62731: [RFC] Add support for options -frounding-math, -fp-model=, and -fp-exception-behavior=, : Specify floating point behavior

2019-10-08 Thread Melanie Blower via Phabricator via cfe-commits
mibintc updated this revision to Diff 223911.
mibintc added a comment.

clean up some dead code


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62731

Files:
  clang/docs/UsersManual.rst
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/LangOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/fpconstrained.c
  clang/test/Driver/clang_f_opts.c
  clang/test/Driver/fast-math.c
  llvm/include/llvm/Target/TargetOptions.h

Index: llvm/include/llvm/Target/TargetOptions.h
===
--- llvm/include/llvm/Target/TargetOptions.h
+++ llvm/include/llvm/Target/TargetOptions.h
@@ -107,7 +107,7 @@
   public:
 TargetOptions()
 : PrintMachineCode(false), UnsafeFPMath(false), NoInfsFPMath(false),
-  NoNaNsFPMath(false), NoTrappingFPMath(false),
+  NoNaNsFPMath(false), NoTrappingFPMath(true), RoundingFPMath(false),
   NoSignedZerosFPMath(false),
   HonorSignDependentRoundingFPMathOption(false), NoZerosInBSS(false),
   GuaranteedTailCallOpt(false), StackSymbolOrdering(true),
@@ -154,6 +154,11 @@
 /// specifies that there are no trap handlers to handle exceptions.
 unsigned NoTrappingFPMath : 1;
 
+/// RoundingFPMath - This flag is enabled when the
+/// -enable-rounding-fp-math is specified on the command line. This
+/// specifies dynamic rounding mode.
+unsigned RoundingFPMath : 1;
+
 /// NoSignedZerosFPMath - This flag is enabled when the
 /// -enable-no-signed-zeros-fp-math is specified on the command line. This
 /// specifies that optimizations are allowed to treat the sign of a zero
Index: clang/test/Driver/fast-math.c
===
--- clang/test/Driver/fast-math.c
+++ clang/test/Driver/fast-math.c
@@ -170,11 +170,11 @@
 // RUN: %clang -### -fno-fast-math -ffast-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FAST-MATH %s
 // RUN: %clang -### -funsafe-math-optimizations -ffinite-math-only \
-// RUN: -fno-math-errno -ffp-contract=fast -c %s 2>&1 \
+// RUN: -fno-math-errno -ffp-contract=fast -fno-rounding-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FAST-MATH %s
 // RUN: %clang -### -fno-honor-infinities -fno-honor-nans -fno-math-errno \
 // RUN: -fassociative-math -freciprocal-math -fno-signed-zeros \
-// RUN: -fno-trapping-math -ffp-contract=fast -c %s 2>&1 \
+// RUN: -fno-trapping-math -ffp-contract=fast -fno-rounding-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FAST-MATH %s
 // CHECK-FAST-MATH: "-cc1"
 // CHECK-FAST-MATH: "-ffast-math"
Index: clang/test/Driver/clang_f_opts.c
===
--- clang/test/Driver/clang_f_opts.c
+++ clang/test/Driver/clang_f_opts.c
@@ -320,7 +320,6 @@
 // RUN: -fprefetch-loop-arrays\
 // RUN: -fprofile-correction  \
 // RUN: -fprofile-values  \
-// RUN: -frounding-math   \
 // RUN: -fschedule-insns  \
 // RUN: -fsignaling-nans  \
 // RUN: -fstrength-reduce \
@@ -385,7 +384,6 @@
 // CHECK-WARNING-DAG: optimization flag '-fprefetch-loop-arrays' is not supported
 // CHECK-WARNING-DAG: optimization flag '-fprofile-correction' is not supported
 // CHECK-WARNING-DAG: optimization flag '-fprofile-values' is not supported
-// CHECK-WARNING-DAG: optimization flag '-frounding-math' is not supported
 // CHECK-WARNING-DAG: optimization flag '-fschedule-insns' is not supported
 // CHECK-WARNING-DAG: optimization flag '-fsignaling-nans' is not supported
 // CHECK-WARNING-DAG: optimization flag '-fstrength-reduce' is not supported
Index: clang/test/CodeGen/fpconstrained.c
===
--- /dev/null
+++ clang/test/CodeGen/fpconstrained.c
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -ftrapping-math -frounding-math -ffp-exception-behavior=strict -emit-llvm -o - %s | FileCheck %s -check-prefix=FPMODELSTRICT
+// RUN: %clang_cc1 -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s -check-prefix=PRECISE
+// RUN: %clang_cc1 -ffast-math -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST
+// RUN: %clang_cc1 -ffast-math -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST
+// RUN: %clang_cc1 -ffast-math -ffp-contract=fast -ffp-exception-behavior=ignore -emit-llvm -o - %s | FileChe

[PATCH] D68640: Try to get readability-deleted-default.cpp to pass on Windows.

2019-10-08 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

> Can you clarify what exactly the TODO is? As-is, the check suggests removing 
> the redeclaration where it's a no-op (non-ms) but not where it isn't (C, ms 
> compat). If I understand your reply correctly, this is desired behavior. Is 
> the TODO then to have test coverage for the ms compat case? If so: Can 
> clang-tidy checks have different CHECK-MESSAGES suffixes in the same file? If 
> so, we can just run the test once with -fms-compat and once with 
> -fno-ms-compat and expect the diag in one case and not in the other.

To answer my question: 
https://clang.llvm.org/extra/clang-tidy/Contributing.html#testing-checks 
explains how to do this. I'll update the patch.


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

https://reviews.llvm.org/D68640



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


[PATCH] D68587: [hip] Assume host-only compilation if the final phase is ahead of `backend`.

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

TL; DR; 
+1 to formalizing how we want -M*/-E/-S/-emit-llvm/-fsyntax-only to behave. 
OK with -M/-E/-S defaulting to host, and erroring out if applied to multiple 
sub-compilations.
I'm still convinced that the tooling issue with multiple subcompilations is 
orthogonal to this change and should be handled in libclang and that 
-fsyntax-only should not default to one sub-compilation.

See the details below.

In D68587#1698777 , @hliao wrote:

> In D68587#1698247 , @tra wrote:
>
> > In D68587#1698102 , @hliao wrote:
> >
> > > for most compilation tools, single input and single output are expected. 
> > > Without assuming `-fsyntax-only` alone is host-compilation only, that at 
> > > least run syntax checking twice.
> >
> >
> > I believe the driver will not run subsequent jobs if one of the device 
> > compilations fails. You may see duplicate warnings from multiple stages, 
> > but overall the error handling works in a fairly predictable way now.
>
>
> It still runs and gives the same error (if that error is applicable to both 
> sides) at least twice if you just specify `-fsyntax-only` or `-E`. That won't 
> happen for regular compilation option (`-c`) due to the additional device 
> dependencies added.


Are you talking about the behavior with or without  this patch?

Without the patch I do see the driver stopping as soon as one of the 
subcompilations errors out and it needs *all* subcompilations to succeed in 
order for the whole invocation to succeed.

E.g.: err.cu:

  common error;
  
  #if __CUDA_ARCH__
  __device__ void foo() {
device error;
  }
  #else
  __host__ void bar() {
host error;
  }
  #endif



  $ bin/clang --cuda-path=$HOME/local/cuda-10.0 --cuda-gpu-arch=sm_30 
-fsyntax-only err.cu
  err.cu:1:1: error: unknown type name 'common'
  common error;
  ^
  err.cu:9:3: error: unknown type name 'host'
host error;
^
  2 errors generated when compiling for host.

If I comment out the host and common errors, then clang finishes host 
compilation, moves on to device-side compilation and reports the error there:

  err.cu:5:3: error: unknown type name 'device'; did you mean 'CUdevice'?
device error;
^~
CUdevice
  /usr/local/google/home/tra/local/cuda-10.0/include/cuda.h:252:13: note: 
'CUdevice' declared here
  typedef int CUdevice; /**< CUDA device */
  ^
  1 error generated when compiling for sm_30.

Again, it reports that there's an error on device side. My understanding is 
that with this patch clang would've succeeded, which is, IMO, incorrect.

> The error itself is, in fact, should be clear enough, the most confusing part 
> is the diagnostic message and suggestions from clang as host- and device-side 
> compilations are quite different, especially the error message may be mixed 
> with other-side the normal output.

Mixing errors and output will be confusing no matter what you do. That's why 
diags go to stderr by default, so you can separate them from the regular output.
As far as errors go, clang clearly labels which side of the compilation 
produced them:

`1 error generated when compiling for sm_30.`

>> To think of it, I'm starting to doubt that this patch is an improvement for 
>> `-M` either. You will get the dependencies for the host, but they are not 
>> necessarily the same as the dependencies for the device-side compilation. 
>> Producing a partial list of dependencies will be potentially incorrect. IMO 
>> we do need dependencies info from all sub-compilations.
> 
> Even without this patch, `-M` or more specifically `-MD` already breaks now 
> as we just run the dependency generation action twice for each side. The 
> later will overwrite the former *.d file. We need special handling of `-M` to 
> match nvcc.

This sounds like a bug to me. We should've refused to write multiple files -- 
similar to how we refuse to preprocess if we have more than one sub-compilation.
OK. In this sense defaulting to host-only here would be a marginal improvement. 
Until we can produce complete dependency info for all sub-compilations letting 
user specifically select one (with host being default) is probably the best 
choice we can make at the moment.

> 
> 
>> Perhaps we should limit the scope of this patch to -E only for now?
> 
> Just found nvcc's `-E` returns the output of the device-side compilation for 
> the first GPU arch specified. Anyway, whether to match that behavior is just 
> another question.

NVCC is not a good guideline here. Considering that they do source code 
transformation, it's not quite clear what exactly -E means for NVCC at all.
Defaulting to host-side -E would probably be fine as long as user can override 
it with --cuda-device-only.

> but some tools, like clang-tidy, may be found difficult to insert that option 
> properly, says `clang-tidy -p` supp

[PATCH] D68099: [MS ABI]: Fix mangling function arguments for template types to be compatible with MSVC

2019-10-08 Thread Adam Folwarczny via Phabricator via cfe-commits
adamf added a comment.

@thakis Yes please, I cannot commit this patch by myself, because I don't have 
commit access.
Surely, next time I will add more context in diff.
Thanks a lot for the effort.


Repository:
  rC Clang

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

https://reviews.llvm.org/D68099



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


[PATCH] D68640: Try to get readability-deleted-default.cpp to pass on Windows.

2019-10-08 Thread Nico Weber via Phabricator via cfe-commits
thakis updated this revision to Diff 223917.
thakis edited the summary of this revision.
thakis added a comment.

make test more explicit


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

https://reviews.llvm.org/D68640

Files:
  clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp


Index: clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp
===
--- clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp
+++ clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp
@@ -2,6 +2,21 @@
 // RUN:   -config="{CheckOptions: \
 // RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
 // RUN:   value: 0}]}"
+//
+// With -fms-compatibility and -DEXTERNINLINE, the extern inline shouldn't
+// produce additional diagnostics, so same check suffix as before:
+// RUN: %check_clang_tidy %s readability-redundant-declaration %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
+// RUN:   value: 0}]}" -- -fms-compatibility -DEXTERNINLINE
+//
+// With -fno-ms-compatiblity, DEXTERNINLINE causes additional output.
+// (The leading ',' means "default checks in addition to NOMSCOMPAT checks.)
+// RUN: %check_clang_tidy -check-suffix=,NOMSCOMPAT \
+// RUN:   %s readability-redundant-declaration %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
+// RUN:   value: 0}]}" -- -fno-ms-compatibility -DEXTERNINLINE
 
 extern int Xyz;
 extern int Xyz; // Xyz
@@ -74,6 +89,8 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: redundant 'g' declaration
 // CHECK-FIXES: {{^}}// g{{$}}
 
+#if defined(EXTERNINLINE)
 extern inline void g(); // extern g
-// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: redundant 'g' declaration
-// CHECK-FIXES: {{^}}// extern g{{$}}
+// CHECK-MESSAGES-NOMSCOMPAT: :[[@LINE-1]]:20: warning: redundant 'g' 
declaration
+// CHECK-FIXES-NOMSCOMPAT: {{^}}// extern g{{$}}
+#endif


Index: clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp
===
--- clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp
+++ clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp
@@ -2,6 +2,21 @@
 // RUN:   -config="{CheckOptions: \
 // RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
 // RUN:   value: 0}]}"
+//
+// With -fms-compatibility and -DEXTERNINLINE, the extern inline shouldn't
+// produce additional diagnostics, so same check suffix as before:
+// RUN: %check_clang_tidy %s readability-redundant-declaration %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
+// RUN:   value: 0}]}" -- -fms-compatibility -DEXTERNINLINE
+//
+// With -fno-ms-compatiblity, DEXTERNINLINE causes additional output.
+// (The leading ',' means "default checks in addition to NOMSCOMPAT checks.)
+// RUN: %check_clang_tidy -check-suffix=,NOMSCOMPAT \
+// RUN:   %s readability-redundant-declaration %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
+// RUN:   value: 0}]}" -- -fno-ms-compatibility -DEXTERNINLINE
 
 extern int Xyz;
 extern int Xyz; // Xyz
@@ -74,6 +89,8 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: redundant 'g' declaration
 // CHECK-FIXES: {{^}}// g{{$}}
 
+#if defined(EXTERNINLINE)
 extern inline void g(); // extern g
-// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: redundant 'g' declaration
-// CHECK-FIXES: {{^}}// extern g{{$}}
+// CHECK-MESSAGES-NOMSCOMPAT: :[[@LINE-1]]:20: warning: redundant 'g' declaration
+// CHECK-FIXES-NOMSCOMPAT: {{^}}// extern g{{$}}
+#endif
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r374098 - [NFC] Attempt to make ubsan-blacklist-vfs test pass on Windows

2019-10-08 Thread Nico Weber via cfe-commits
Almost: http://45.33.8.238/win/78/step_6.txt

C:\src\llvm-project\clang\test\CodeGen\ubsan-blacklist-vfs.c:11:25: error:
INVALID-MAPPED-FILE: expected string not found in input
// INVALID-MAPPED-FILE: invalid-virtual-file.blacklist': No such file or
directory
^
:1:1: note: scanning from here
fatal error: error in backend: can't open file
'C:/src/llvm-project/out/gn/obj/clang/test/CodeGen/Output/invalid-virtual-file.blacklist':
no such file or directory


Looks like it expects a "No such file" with a capital "No" but gets a "no
such file" with a lower-case n. {{[Nn]}}o probably fixes this.

On Tue, Oct 8, 2019 at 2:10 PM Jan Korous via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: jkorous
> Date: Tue Oct  8 11:13:04 2019
> New Revision: 374098
>
> URL: http://llvm.org/viewvc/llvm-project?rev=374098&view=rev
> Log:
> [NFC] Attempt to make ubsan-blacklist-vfs test pass on Windows
>
> Previously disabled in d0c2d5daa3e
>
> Modified:
> cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c
>
> Modified: cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c?rev=374098&r1=374097&r2=374098&view=diff
>
> ==
> --- cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c (original)
> +++ cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c Tue Oct  8 11:13:04 2019
> @@ -1,5 +1,3 @@
> -// UNSUPPORTED: system-windows
> -
>  // Verify ubsan doesn't emit checks for blacklisted functions and files
>  // RUN: echo "fun:hash" > %t-func.blacklist
>  // RUN: echo "src:%s" | sed -e 's/\\//g' > %t-file.blacklist
> @@ -7,9 +5,9 @@
>  // RUN: rm -f %t-vfsoverlay.yaml
>  // RUN: rm -f %t-nonexistent.blacklist
>  // RUN: sed -e "s|@DIR@|%/T|g"
> %S/Inputs/sanitizer-blacklist-vfsoverlay.yaml | sed -e 
> "s|@REAL_FILE@|%/t-func.blacklist|g"
> | sed -e "s|@NONEXISTENT_FILE@|%/t-nonexistent.blacklist|g" >
> %t-vfsoverlay.yaml
> -// RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay
> %t-vfsoverlay.yaml -fsanitize-blacklist=%T/only-virtual-file.blacklist
> -emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC
> +// RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay
> %t-vfsoverlay.yaml -fsanitize-blacklist=%/T/only-virtual-file.blacklist
> -emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC
>
> -// RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay
> %t-vfsoverlay.yaml -fsanitize-blacklist=%T/invalid-virtual-file.blacklist
> -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID-MAPPED-FILE
> +// RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay
> %t-vfsoverlay.yaml -fsanitize-blacklist=%/T/invalid-virtual-file.blacklist
> -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID-MAPPED-FILE
>  // INVALID-MAPPED-FILE: invalid-virtual-file.blacklist': No such file or
> directory
>
>  // RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay
> %t-vfsoverlay.yaml -fsanitize-blacklist=%t-nonexistent.blacklist -emit-llvm
> %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r374103 - Try to get readability-deleted-default.cpp to pass on Windows.

2019-10-08 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue Oct  8 12:14:34 2019
New Revision: 374103

URL: http://llvm.org/viewvc/llvm-project?rev=374103&view=rev
Log:
Try to get readability-deleted-default.cpp to pass on Windows.

In MS compatibility mode, "extern inline void g()" is not a redundant
declaration for "inline void g()", because of redeclForcesDefMSVC()
(see PR19264, r205485).

To fix, run the test with -fms-compatiblity forced on and off
and explicit check for the differing behavior for extern inline.

Final bit of PR43593.

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

Modified:

clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp?rev=374103&r1=374102&r2=374103&view=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp 
(original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp 
Tue Oct  8 12:14:34 2019
@@ -2,6 +2,21 @@
 // RUN:   -config="{CheckOptions: \
 // RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
 // RUN:   value: 0}]}"
+//
+// With -fms-compatibility and -DEXTERNINLINE, the extern inline shouldn't
+// produce additional diagnostics, so same check suffix as before:
+// RUN: %check_clang_tidy %s readability-redundant-declaration %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
+// RUN:   value: 0}]}" -- -fms-compatibility -DEXTERNINLINE
+//
+// With -fno-ms-compatiblity, DEXTERNINLINE causes additional output.
+// (The leading ',' means "default checks in addition to NOMSCOMPAT checks.)
+// RUN: %check_clang_tidy -check-suffix=,NOMSCOMPAT \
+// RUN:   %s readability-redundant-declaration %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
+// RUN:   value: 0}]}" -- -fno-ms-compatibility -DEXTERNINLINE
 
 extern int Xyz;
 extern int Xyz; // Xyz
@@ -74,6 +89,8 @@ inline void g(); // g
 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: redundant 'g' declaration
 // CHECK-FIXES: {{^}}// g{{$}}
 
+#if defined(EXTERNINLINE)
 extern inline void g(); // extern g
-// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: redundant 'g' declaration
-// CHECK-FIXES: {{^}}// extern g{{$}}
+// CHECK-MESSAGES-NOMSCOMPAT: :[[@LINE-1]]:20: warning: redundant 'g' 
declaration
+// CHECK-FIXES-NOMSCOMPAT: {{^}}// extern g{{$}}
+#endif


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


[PATCH] D68640: Try to get readability-deleted-default.cpp to pass on Windows.

2019-10-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM, thank you for this!


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

https://reviews.llvm.org/D68640



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


[PATCH] D68634: [ASTImporter] Imported FunctionDecls inherit attributes from existing functions

2019-10-08 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added inline comments.



Comment at: clang/lib/AST/ASTImporter.cpp:7842
+// This implementation is inspired by Sema::mergeDeclAttributes.
+void ASTNodeImporter::CopyInheritedAttributes(FunctionDecl *Old,
+  FunctionDecl *New) {

There are other attributes that [apply to functions as 
well](https://en.cppreference.com/w/cpp/language/attributes): `nodiscard`, 
`maybe_unused` and `deprecated`. Is there a reason not to support those as well?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68634



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


[PATCH] D68193: In openFileForRead don't cache erroneous entries if the error relates to them being directories. Add tests.

2019-10-08 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman requested changes to this revision.
arphaman added a comment.
This revision now requires changes to proceed.

@kousikk Thanks, I understand your patch better now. It makes more sense for 
sure.

When we're opening the file we shouldn't `stat` before calling `open`, as 
there's a race condition introduced, where the value of the `stat` could change 
between the call between `stat` and `open` is performed. We've seen problems 
like this before, and it ends up in crashes and mismatch size errors as Clang 
is getting invalid size from the stat if the file is modified in that time. We 
should still call `open` + `fstat` like we used. So I would recommend not 
changing the `createFileEntry` function to take in a stat, and do the fstat 
after opening the file like it used to.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68193



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


[PATCH] D68640: Try to get readability-deleted-default.cpp to pass on Windows.

2019-10-08 Thread Nico Weber via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8cb804a3c9ce: Try to get readability-deleted-default.cpp to 
pass on Windows. (authored by thakis).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68640

Files:
  clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp


Index: clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp
===
--- clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp
+++ clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp
@@ -2,6 +2,21 @@
 // RUN:   -config="{CheckOptions: \
 // RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
 // RUN:   value: 0}]}"
+//
+// With -fms-compatibility and -DEXTERNINLINE, the extern inline shouldn't
+// produce additional diagnostics, so same check suffix as before:
+// RUN: %check_clang_tidy %s readability-redundant-declaration %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
+// RUN:   value: 0}]}" -- -fms-compatibility -DEXTERNINLINE
+//
+// With -fno-ms-compatiblity, DEXTERNINLINE causes additional output.
+// (The leading ',' means "default checks in addition to NOMSCOMPAT checks.)
+// RUN: %check_clang_tidy -check-suffix=,NOMSCOMPAT \
+// RUN:   %s readability-redundant-declaration %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
+// RUN:   value: 0}]}" -- -fno-ms-compatibility -DEXTERNINLINE
 
 extern int Xyz;
 extern int Xyz; // Xyz
@@ -74,6 +89,8 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: redundant 'g' declaration
 // CHECK-FIXES: {{^}}// g{{$}}
 
+#if defined(EXTERNINLINE)
 extern inline void g(); // extern g
-// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: redundant 'g' declaration
-// CHECK-FIXES: {{^}}// extern g{{$}}
+// CHECK-MESSAGES-NOMSCOMPAT: :[[@LINE-1]]:20: warning: redundant 'g' 
declaration
+// CHECK-FIXES-NOMSCOMPAT: {{^}}// extern g{{$}}
+#endif


Index: clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp
===
--- clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp
+++ clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp
@@ -2,6 +2,21 @@
 // RUN:   -config="{CheckOptions: \
 // RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
 // RUN:   value: 0}]}"
+//
+// With -fms-compatibility and -DEXTERNINLINE, the extern inline shouldn't
+// produce additional diagnostics, so same check suffix as before:
+// RUN: %check_clang_tidy %s readability-redundant-declaration %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
+// RUN:   value: 0}]}" -- -fms-compatibility -DEXTERNINLINE
+//
+// With -fno-ms-compatiblity, DEXTERNINLINE causes additional output.
+// (The leading ',' means "default checks in addition to NOMSCOMPAT checks.)
+// RUN: %check_clang_tidy -check-suffix=,NOMSCOMPAT \
+// RUN:   %s readability-redundant-declaration %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
+// RUN:   value: 0}]}" -- -fno-ms-compatibility -DEXTERNINLINE
 
 extern int Xyz;
 extern int Xyz; // Xyz
@@ -74,6 +89,8 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: redundant 'g' declaration
 // CHECK-FIXES: {{^}}// g{{$}}
 
+#if defined(EXTERNINLINE)
 extern inline void g(); // extern g
-// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: redundant 'g' declaration
-// CHECK-FIXES: {{^}}// extern g{{$}}
+// CHECK-MESSAGES-NOMSCOMPAT: :[[@LINE-1]]:20: warning: redundant 'g' declaration
+// CHECK-FIXES-NOMSCOMPAT: {{^}}// extern g{{$}}
+#endif
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r374105 - Try to get ubsan-blacklist-vfs.c pass more on Windows

2019-10-08 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue Oct  8 12:25:49 2019
New Revision: 374105

URL: http://llvm.org/viewvc/llvm-project?rev=374105&view=rev
Log:
Try to get ubsan-blacklist-vfs.c pass more on Windows

Modified:
cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c

Modified: cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c?rev=374105&r1=374104&r2=374105&view=diff
==
--- cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c (original)
+++ cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c Tue Oct  8 12:25:49 2019
@@ -8,10 +8,10 @@
 // RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay 
%t-vfsoverlay.yaml -fsanitize-blacklist=%/T/only-virtual-file.blacklist 
-emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC
 
 // RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay 
%t-vfsoverlay.yaml -fsanitize-blacklist=%/T/invalid-virtual-file.blacklist 
-emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID-MAPPED-FILE
-// INVALID-MAPPED-FILE: invalid-virtual-file.blacklist': No such file or 
directory
+// INVALID-MAPPED-FILE: invalid-virtual-file.blacklist': {{[Nn]}}o such file 
or directory
 
 // RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay 
%t-vfsoverlay.yaml -fsanitize-blacklist=%t-nonexistent.blacklist -emit-llvm %s 
-o - 2>&1 | FileCheck %s --check-prefix=INVALID
-// INVALID: nonexistent.blacklist': No such file or directory
+// INVALID: nonexistent.blacklist': {{[Nn]}}o such file or directory
 
 unsigned i;
 


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


[PATCH] D68587: [hip] Assume host-only compilation if the final phase is ahead of `backend`.

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

In D68587#1700178 , @tra wrote:

> TL; DR; 
>  +1 to formalizing how we want -M*/-E/-S/-emit-llvm/-fsyntax-only to behave. 
>  OK with -M/-E/-S defaulting to host, and erroring out if applied to multiple 
> sub-compilations.
>  I'm still convinced that the tooling issue with multiple subcompilations is 
> orthogonal to this change and should be handled in libclang and that 
> -fsyntax-only should not default to one sub-compilation.


I am starting to fix clang tooling issues found in both driver 
(https://reviews.llvm.org/D68652) and tooling parts. Will submit tooling part 
for review soon. After that, we may nail down the details on expected output 
from -M*/-E and etc.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68587



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


[PATCH] D68587: [hip] Assume host-only compilation if the final phase is ahead of `backend`.

2019-10-08 Thread Michael Liao via Phabricator via cfe-commits
hliao abandoned this revision.
hliao added a comment.

need to more clarification and re-design


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68587



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


Re: r373743 - [NFCI] Improve the -Wbool-operation's warning message

2019-10-08 Thread Dávid Bolvanský via cfe-commits

Yeah, I tried to fix even that case but is not so simple so not worth any extra 
time/complexivity.

> Dňa 8. 10. 2019 o 19:09 užívateľ Arthur O'Dwyer  
> napísal:
> 
> 
> On Mon, Oct 7, 2019 at 6:58 PM Dávid Bolvanský  
> wrote:
> >> FWIW I found the "always evaluates to 'true'" bit important to
> >> understand the warning.
> >
> > Yeah. I moved this check somewhere else, so we can print precise message:
> > r373973 should emit "bitwise negation of a boolean expression always
> > evaluates to 'true'; did you mean logical negation?" where possible.
> > In the suspicious case like int i = ~b there is a general message
> > "bitwise negation of a boolean expression; did you mean logical
> > negation?".
> >
> > I like it now. What do you think? fine for you?
> 
> I see. Yes, all the cases I tried produce appropriate diagnostics. I like it!
> 
>> Hm, there is no "bitwise negation of a boolean expression always
>> evaluates to 'true'; did you mean logical negation?" for chromium
>> case [ https://bugs.chromium.org/p/chromium/issues/detail?id=1011810 ]. I 
>> will try to fix it.
> 
> The important part there seems to be that the result of `~b` (which must be 
> either -1 or -2) is used as the operand to `!=` or `==`.
> My opinion is that it is not worth the extra complication just to improve the 
> error message for this case.
> It would be interesting to do some kind of general-purpose dataflow before 
> emitting diagnostics...
> I notice that Clang's optimizer is smart enough to optimize
> bool foo(bool a, bool b) {
> return a == ~b;
> }
> bool bar(int x) {
> return x + 1 < -INT_MAX;
> }
> into `return 0`. If it could propagate that information up and produce a 
> diagnostic, users might appreciate that. But the challenge as always is that 
> we can never tell if the user might sometimes be doing that sort of thing on 
> purpose (in inlined code, in macros, in generated code, etc).
> 
> my $.02,
> –Arthur
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68660: [tooling] Teach Tooling to understand compilation with offloading.

2019-10-08 Thread Michael Liao via Phabricator via cfe-commits
hliao created this revision.
hliao added reviewers: tra, yaxunl.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

- So far, we only recognize the compilation with offloading and skip the 
offloading part.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68660

Files:
  clang/lib/Tooling/Tooling.cpp
  clang/test/Tooling/clang-check-offload.cpp


Index: clang/test/Tooling/clang-check-offload.cpp
===
--- /dev/null
+++ clang/test/Tooling/clang-check-offload.cpp
@@ -0,0 +1,4 @@
+// RUN: not clang-check "%s" -- -c -x hip -nogpulib 2>&1 | FileCheck %s
+
+// CHECK: C++ requires
+invalid;
Index: clang/lib/Tooling/Tooling.cpp
===
--- clang/lib/Tooling/Tooling.cpp
+++ clang/lib/Tooling/Tooling.cpp
@@ -91,7 +91,20 @@
   // We expect to get back exactly one Command job, if we didn't something
   // failed. Extract that job from the Compilation.
   const driver::JobList &Jobs = Compilation->getJobs();
-  if (Jobs.size() != 1 || !isa(*Jobs.begin())) {
+  bool OffloadCompilation = false;
+  if (Jobs.size() > 1) {
+for (auto &A : Compilation->getActions()){
+  // On MacOSX real actions may end up being wrapped in BindArchAction
+  if (isa(A))
+A = *A->input_begin();
+  if (isa(A)) {
+OffloadCompilation = true;
+break;
+  }
+}
+  }
+  if (Jobs.size() == 0 || !isa(*Jobs.begin()) ||
+  (Jobs.size() > 1 && !OffloadCompilation)) {
 SmallString<256> error_msg;
 llvm::raw_svector_ostream error_stream(error_msg);
 Jobs.Print(error_stream, "; ", true);


Index: clang/test/Tooling/clang-check-offload.cpp
===
--- /dev/null
+++ clang/test/Tooling/clang-check-offload.cpp
@@ -0,0 +1,4 @@
+// RUN: not clang-check "%s" -- -c -x hip -nogpulib 2>&1 | FileCheck %s
+
+// CHECK: C++ requires
+invalid;
Index: clang/lib/Tooling/Tooling.cpp
===
--- clang/lib/Tooling/Tooling.cpp
+++ clang/lib/Tooling/Tooling.cpp
@@ -91,7 +91,20 @@
   // We expect to get back exactly one Command job, if we didn't something
   // failed. Extract that job from the Compilation.
   const driver::JobList &Jobs = Compilation->getJobs();
-  if (Jobs.size() != 1 || !isa(*Jobs.begin())) {
+  bool OffloadCompilation = false;
+  if (Jobs.size() > 1) {
+for (auto &A : Compilation->getActions()){
+  // On MacOSX real actions may end up being wrapped in BindArchAction
+  if (isa(A))
+A = *A->input_begin();
+  if (isa(A)) {
+OffloadCompilation = true;
+break;
+  }
+}
+  }
+  if (Jobs.size() == 0 || !isa(*Jobs.begin()) ||
+  (Jobs.size() > 1 && !OffloadCompilation)) {
 SmallString<256> error_msg;
 llvm::raw_svector_ostream error_stream(error_msg);
 Jobs.Print(error_stream, "; ", true);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r374107 - [OPENMP50]Multiple vendors in vendor context must be treated as logical

2019-10-08 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Tue Oct  8 12:44:16 2019
New Revision: 374107

URL: http://llvm.org/viewvc/llvm-project?rev=374107&view=rev
Log:
[OPENMP50]Multiple vendors in vendor context must be treated as logical
and of vendors, not or.

If several vendors are provided in the same vendor context trait, the
context shall match only if all vendors are matching, not one of them.
This is per OpenMP 5.0, 2.3.3 Matching and Scoring Context Selectors,
all selectors in the construct, device, and implementation sets of the
context selector appear in the corresponding trait set of the OpenMP
context.

Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/Parse/ParseOpenMP.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/test/OpenMP/declare_variant_ast_print.c
cfe/trunk/test/OpenMP/declare_variant_ast_print.cpp
cfe/trunk/test/OpenMP/declare_variant_implementation_vendor_codegen.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=374107&r1=374106&r2=374107&view=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Tue Oct  8 12:44:16 2019
@@ -3309,7 +3309,7 @@ def OMPDeclareVariant : InheritableAttr
  [
"CtxUnknown", "CtxVendor"
  ]>,
-StringArgument<"ImplVendor", 1>
+VariadicStringArgument<"ImplVendors">
   ];
   let AdditionalMembers = [{
 void printScore(raw_ostream & OS, const PrintingPolicy &Policy) const {
@@ -3337,7 +3337,11 @@ def OMPDeclareVariant : InheritableAttr
 case CtxVendor:
   OS << "vendor(";
   printScore(OS, Policy);
-  OS << getImplVendor();
+  if (implVendors_size() > 0) {
+OS << *implVendors(). begin();
+for (StringRef VendorName : llvm::drop_begin(implVendors(), 1))
+  OS << ", " << VendorName;
+  }
   OS << ")";
   break;
 case CtxUnknown:

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=374107&r1=374106&r2=374107&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Tue Oct  8 12:44:16 2019
@@ -9110,15 +9110,15 @@ public:
 OMPDeclareVariantAttr::CtxSetUnknown;
 OMPDeclareVariantAttr::CtxSelectorType Ctx =
 OMPDeclareVariantAttr::CtxUnknown;
-StringRef ImplVendor;
+MutableArrayRef ImplVendors;
 ExprResult CtxScore;
 explicit OpenMPDeclareVariantCtsSelectorData() = default;
 explicit OpenMPDeclareVariantCtsSelectorData(
 OMPDeclareVariantAttr::CtxSelectorSetType CtxSet,
-OMPDeclareVariantAttr::CtxSelectorType Ctx, StringRef ImplVendor,
-ExprResult CtxScore)
-: CtxSet(CtxSet), Ctx(Ctx), ImplVendor(ImplVendor), CtxScore(CtxScore) 
{
-}
+OMPDeclareVariantAttr::CtxSelectorType Ctx,
+MutableArrayRef ImplVendors, ExprResult CtxScore)
+: CtxSet(CtxSet), Ctx(Ctx), ImplVendors(ImplVendors),
+  CtxScore(CtxScore) {}
   };
 
   /// Checks if the variant/multiversion functions are compatible.

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=374107&r1=374106&r2=374107&view=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Tue Oct  8 12:44:16 2019
@@ -11172,7 +11172,8 @@ template <>
 bool checkContext(
 const OMPDeclareVariantAttr *A) {
-  return !A->getImplVendor().compare("llvm");
+  return llvm::all_of(A->implVendors(),
+  [](StringRef S) { return !S.compare_lower("llvm"); });
 }
 
 static bool greaterCtxScore(ASTContext &Ctx, const Expr *LHS, const Expr *RHS) 
{

Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=374107&r1=374106&r2=374107&view=diff
==
--- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original)
+++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Tue Oct  8 12:44:16 2019
@@ -853,6 +853,7 @@ static void parseImplementationSelector(
 (void)T.expectAndConsume(diag::err_expected_lparen_after,
  CtxSelectorName.data());
 const ExprResult Score = parseContextScore(P);
+SmallVector, 4> Vendors;
 do {
   // Parse .
   StringRef VendorName;
@@ -860,18 +861,14 @@ static void parseImplementationSelector(
 Buffer.clear

Re: r374098 - [NFC] Attempt to make ubsan-blacklist-vfs test pass on Windows

2019-10-08 Thread Jan Korous via cfe-commits
Thanks for the fix!

> On Oct 8, 2019, at 12:06 PM, Nico Weber  wrote:
> 
> Almost: http://45.33.8.238/win/78/step_6.txt 
> 
> 
> C:\src\llvm-project\clang\test\CodeGen\ubsan-blacklist-vfs.c:11:25: error: 
> INVALID-MAPPED-FILE: expected string not found in input
> // INVALID-MAPPED-FILE: invalid-virtual-file.blacklist': No such file or 
> directory
> ^
> :1:1: note: scanning from here
> fatal error: error in backend: can't open file 
> 'C:/src/llvm-project/out/gn/obj/clang/test/CodeGen/Output/invalid-virtual-file.blacklist':
>  no such file or directory
> 
> 
> Looks like it expects a "No such file" with a capital "No" but gets a "no 
> such file" with a lower-case n. {{[Nn]}}o probably fixes this.
> 
> On Tue, Oct 8, 2019 at 2:10 PM Jan Korous via cfe-commits 
> mailto:cfe-commits@lists.llvm.org>> wrote:
> Author: jkorous
> Date: Tue Oct  8 11:13:04 2019
> New Revision: 374098
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=374098&view=rev 
> 
> Log:
> [NFC] Attempt to make ubsan-blacklist-vfs test pass on Windows
> 
> Previously disabled in d0c2d5daa3e
> 
> Modified:
> cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c
> 
> Modified: cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c?rev=374098&r1=374097&r2=374098&view=diff
>  
> 
> ==
> --- cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c (original)
> +++ cfe/trunk/test/CodeGen/ubsan-blacklist-vfs.c Tue Oct  8 11:13:04 2019
> @@ -1,5 +1,3 @@
> -// UNSUPPORTED: system-windows
> -
>  // Verify ubsan doesn't emit checks for blacklisted functions and files
>  // RUN: echo "fun:hash" > %t-func.blacklist
>  // RUN: echo "src:%s" | sed -e 's/\\//g' > %t-file.blacklist
> @@ -7,9 +5,9 @@
>  // RUN: rm -f %t-vfsoverlay.yaml
>  // RUN: rm -f %t-nonexistent.blacklist
>  // RUN: sed -e "s|@DIR@|%/T|g" %S/Inputs/sanitizer-blacklist-vfsoverlay.yaml 
> | sed -e "s|@REAL_FILE@|%/t-func.blacklist|g" | sed -e 
> "s|@NONEXISTENT_FILE@|%/t-nonexistent.blacklist|g" > %t-vfsoverlay.yaml
> -// RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay 
> %t-vfsoverlay.yaml -fsanitize-blacklist=%T/only-virtual-file.blacklist 
> -emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC
> +// RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay 
> %t-vfsoverlay.yaml -fsanitize-blacklist=%/T/only-virtual-file.blacklist 
> -emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC
> 
> -// RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay 
> %t-vfsoverlay.yaml -fsanitize-blacklist=%T/invalid-virtual-file.blacklist 
> -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID-MAPPED-FILE
> +// RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay 
> %t-vfsoverlay.yaml -fsanitize-blacklist=%/T/invalid-virtual-file.blacklist 
> -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID-MAPPED-FILE
>  // INVALID-MAPPED-FILE: invalid-virtual-file.blacklist': No such file or 
> directory
> 
>  // RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay 
> %t-vfsoverlay.yaml -fsanitize-blacklist=%t-nonexistent.blacklist -emit-llvm 
> %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID
> 
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org 
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits 
> 

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


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-08 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:38
+
+  if (!Args.hasArg(options::OPT_nostdlib)) {
+CmdArgs.push_back("-e");

Test with Clangtana on terran, when no '-nostdlib' specified, since '-e' & 
'__start' are the default behavior for AIX system linker, so there are no 
explicitly '-e' & '__start' found on linker input commanline, so I am wondering 
do we need to explicitly add them to 'CmdArgs'?



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:47
+  else
+CmdArgs.push_back("-bso");
+

Ditto. Since by default, AIX linker is dynamically linked, '-bso' is implicitly 
set on AIX system linker when testing with Clangtana, so do we need to 
explicitly set '-bso' in LLVM?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340



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


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-08 Thread Jason Liu via Phabricator via cfe-commits
jasonliu added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:35
+  // Only support 32 and 64 bit
+  if (!IsArch32Bit && !IsArch64Bit)
+llvm_unreachable("Unsupported bit width value");

Xiangling_L wrote:
> Is there any reason to use llvm_unreachable here? I think we should use  
> 'assertion' instead here:
> 
> ```
> assert((IsArch32Bit || IsArch64Bit) && "...");
> ```
IsArch64Bit used only in the assertion could cause warning when the assertion 
is turned off. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340



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


[PATCH] D67112: [Sema] Add implicit cast for conversion of function references

2019-10-08 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert planned changes to this revision.
aaronpuchert added a comment.

In D67112#1655937 , @aaronpuchert 
wrote:

> If anyone shares my feeling that the boolean output parameters of 
> `CompareReferenceRelationship` should rather move to the return value, I 
> would be happy to do that.


I'll do that in a separate change and then rebase this on top.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67112



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


[PATCH] D55326: [Driver] Fix incorrect GNU triplet for PowerPC on SUSE Linux

2019-10-08 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert added a comment.

Gentle ping.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D55326



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


r374110 - [clang] Add llvm-ifs in test deps

2019-10-08 Thread Vitaly Buka via cfe-commits
Author: vitalybuka
Date: Tue Oct  8 13:23:24 2019
New Revision: 374110

URL: http://llvm.org/viewvc/llvm-project?rev=374110&view=rev
Log:
[clang] Add llvm-ifs in test deps

Modified:
cfe/trunk/test/CMakeLists.txt

Modified: cfe/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=374110&r1=374109&r2=374110&view=diff
==
--- cfe/trunk/test/CMakeLists.txt (original)
+++ cfe/trunk/test/CMakeLists.txt Tue Oct  8 13:23:24 2019
@@ -108,6 +108,7 @@ if( NOT CLANG_BUILT_STANDALONE )
 llvm-cxxfilt
 llvm-dis
 llvm-dwarfdump
+llvm-ifs
 llvm-lto2
 llvm-modextract
 llvm-nm


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


[PATCH] D68663: [clang-offload-bundler] Support `.cui` and `.d`.

2019-10-08 Thread Michael Liao via Phabricator via cfe-commits
hliao created this revision.
hliao added reviewers: tra, yaxunl.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68663

Files:
  clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp


Index: clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
===
--- clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
+++ clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
@@ -71,6 +71,8 @@
"Current supported types are:\n"
"  i   - cpp-output\n"
"  ii  - c++-cpp-output\n"
+   "  cui - cuda/hip-output\n"
+   "  d   - dependency\n"
"  ll  - llvm\n"
"  bc  - llvm-bc\n"
"  s   - assembler\n"
@@ -628,6 +630,10 @@
 return new TextFileHandler(/*Comment=*/"//");
   if (FilesType == "ii")
 return new TextFileHandler(/*Comment=*/"//");
+  if (FilesType == "cui")
+return new TextFileHandler(/*Comment=*/"//");
+  if (FilesType == "d")
+return new TextFileHandler(/*Comment=*/"#");
   if (FilesType == "ll")
 return new TextFileHandler(/*Comment=*/";");
   if (FilesType == "bc")


Index: clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
===
--- clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
+++ clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
@@ -71,6 +71,8 @@
"Current supported types are:\n"
"  i   - cpp-output\n"
"  ii  - c++-cpp-output\n"
+   "  cui - cuda/hip-output\n"
+   "  d   - dependency\n"
"  ll  - llvm\n"
"  bc  - llvm-bc\n"
"  s   - assembler\n"
@@ -628,6 +630,10 @@
 return new TextFileHandler(/*Comment=*/"//");
   if (FilesType == "ii")
 return new TextFileHandler(/*Comment=*/"//");
+  if (FilesType == "cui")
+return new TextFileHandler(/*Comment=*/"//");
+  if (FilesType == "d")
+return new TextFileHandler(/*Comment=*/"#");
   if (FilesType == "ll")
 return new TextFileHandler(/*Comment=*/";");
   if (FilesType == "bc")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68610: [clang] enable_trivial_var_init_zero should not be Joined<>

2019-10-08 Thread Reid Kleckner via Phabricator via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68610



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


[PATCH] D68663: [clang-offload-bundler] Support `.cui` and `.d`.

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

Adding this support is aimed to prevent crashing or failure, it's not intended 
to be final output for -M or -E. So, hip fails on these options due to the 
unsupported type of clang-offload-bundler. Before we nail down the details on 
the expected output of -M or -E, especially -M, we at least should not fail 
them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68663



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


r374113 - [clang] enable_trivial_var_init_zero should not be Joined<>

2019-10-08 Thread Vitaly Buka via cfe-commits
Author: vitalybuka
Date: Tue Oct  8 13:34:53 2019
New Revision: 374113

URL: http://llvm.org/viewvc/llvm-project?rev=374113&view=rev
Log:
[clang] enable_trivial_var_init_zero should not be Joined<>

Reviewers: rnk

Subscribers: cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/include/clang/Driver/Options.td

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=374113&r1=374112&r2=374113&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Oct  8 13:34:53 2019
@@ -1720,7 +1720,7 @@ def fstack_protector : Flag<["-"], "fsta
 def ftrivial_auto_var_init : Joined<["-"], "ftrivial-auto-var-init=">, 
Group,
   Flags<[CC1Option, CoreOption]>, HelpText<"Initialize trivial automatic stack 
variables: uninitialized (default)"
   " | pattern">, Values<"uninitialized,pattern">;
-def enable_trivial_var_init_zero : Joined<["-"], 
"enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang">,
+def enable_trivial_var_init_zero : Flag<["-"], 
"enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang">,
   Flags<[CC1Option, CoreOption]>,
   HelpText<"Trivial automatic variable initialization to zero is only here for 
benchmarks, it'll eventually be removed, and I'm OK with that because I'm only 
using it to benchmark">;
 def fstandalone_debug : Flag<["-"], "fstandalone-debug">, Group, 
Flags<[CoreOption]>,


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


[PATCH] D68610: [clang] enable_trivial_var_init_zero should not be Joined<>

2019-10-08 Thread Vitaly Buka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc831ce8c0619: [clang] enable_trivial_var_init_zero should 
not be Joined<> (authored by vitalybuka).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68610

Files:
  clang/include/clang/Driver/Options.td


Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1720,7 +1720,7 @@
 def ftrivial_auto_var_init : Joined<["-"], "ftrivial-auto-var-init=">, 
Group,
   Flags<[CC1Option, CoreOption]>, HelpText<"Initialize trivial automatic stack 
variables: uninitialized (default)"
   " | pattern">, Values<"uninitialized,pattern">;
-def enable_trivial_var_init_zero : Joined<["-"], 
"enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang">,
+def enable_trivial_var_init_zero : Flag<["-"], 
"enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang">,
   Flags<[CC1Option, CoreOption]>,
   HelpText<"Trivial automatic variable initialization to zero is only here for 
benchmarks, it'll eventually be removed, and I'm OK with that because I'm only 
using it to benchmark">;
 def fstandalone_debug : Flag<["-"], "fstandalone-debug">, Group, 
Flags<[CoreOption]>,


Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1720,7 +1720,7 @@
 def ftrivial_auto_var_init : Joined<["-"], "ftrivial-auto-var-init=">, Group,
   Flags<[CC1Option, CoreOption]>, HelpText<"Initialize trivial automatic stack variables: uninitialized (default)"
   " | pattern">, Values<"uninitialized,pattern">;
-def enable_trivial_var_init_zero : Joined<["-"], "enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang">,
+def enable_trivial_var_init_zero : Flag<["-"], "enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang">,
   Flags<[CC1Option, CoreOption]>,
   HelpText<"Trivial automatic variable initialization to zero is only here for benchmarks, it'll eventually be removed, and I'm OK with that because I'm only using it to benchmark">;
 def fstandalone_debug : Flag<["-"], "fstandalone-debug">, Group, Flags<[CoreOption]>,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68640: Try to get readability-deleted-default.cpp to pass on Windows.

2019-10-08 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr added a comment.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68640



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


[PATCH] D68660: [tooling] Teach Tooling to understand compilation with offloading.

2019-10-08 Thread Artem Belevich via Phabricator via cfe-commits
tra added a reviewer: klimek.
tra added a comment.

Added Manuel as someone familiar with tooling.




Comment at: clang/lib/Tooling/Tooling.cpp:117
   // The one job we find should be to invoke clang again.
   const auto &Cmd = cast(*Jobs.begin());
   if (StringRef(Cmd.getCreator().getName()) != "clang") {

Is this still the right job for us to pick? I think we want this to be the host 
compilation. 

As things are right now my guess is that we're probably picking the first 
device-side compilation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68660



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


  1   2   >