r362062 - [AST] asm goto labels don't have constraints, don't try to copy them.

2019-05-30 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Thu May 30 00:21:08 2019
New Revision: 362062

URL: http://llvm.org/viewvc/llvm-project?rev=362062&view=rev
Log:
[AST] asm goto labels don't have constraints, don't try to copy them.

Found by asan.

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

Modified: cfe/trunk/lib/AST/Stmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=362062&r1=362061&r2=362062&view=diff
==
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Thu May 30 00:21:08 2019
@@ -483,9 +483,10 @@ void GCCAsmStmt::setOutputsAndInputsAndC
   this->Exprs = new (C) Stmt*[NumExprs];
   std::copy(Exprs, Exprs + NumExprs, this->Exprs);
 
+  unsigned NumConstraints = NumOutputs + NumInputs;
   C.Deallocate(this->Constraints);
-  this->Constraints = new (C) StringLiteral*[NumExprs];
-  std::copy(Constraints, Constraints + NumExprs, this->Constraints);
+  this->Constraints = new (C) StringLiteral*[NumConstraints];
+  std::copy(Constraints, Constraints + NumConstraints, this->Constraints);
 
   C.Deallocate(this->Clobbers);
   this->Clobbers = new (C) StringLiteral*[NumClobbers];
@@ -756,8 +757,9 @@ GCCAsmStmt::GCCAsmStmt(const ASTContext
   Exprs = new (C) Stmt*[NumExprs];
   std::copy(exprs, exprs + NumExprs, Exprs);
 
-  Constraints = new (C) StringLiteral*[NumExprs];
-  std::copy(constraints, constraints + NumExprs, Constraints);
+  unsigned NumConstraints = NumOutputs + NumInputs;
+  Constraints = new (C) StringLiteral*[NumConstraints];
+  std::copy(constraints, constraints + NumConstraints, Constraints);
 
   Clobbers = new (C) StringLiteral*[NumClobbers];
   std::copy(clobbers, clobbers + NumClobbers, Clobbers);


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


[libunwind] r362065 - [CMake] Use find_package(LLVM) instead of LLVMConfig

2019-05-30 Thread Petr Hosek via cfe-commits
Author: phosek
Date: Thu May 30 00:34:39 2019
New Revision: 362065

URL: http://llvm.org/viewvc/llvm-project?rev=362065&view=rev
Log:
[CMake] Use find_package(LLVM) instead of LLVMConfig

This addresses an issues introduced in r362047.

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

Modified:
libunwind/trunk/CMakeLists.txt

Modified: libunwind/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=362065&r1=362064&r2=362065&view=diff
==
--- libunwind/trunk/CMakeLists.txt (original)
+++ libunwind/trunk/CMakeLists.txt Thu May 30 00:34:39 2019
@@ -15,7 +15,7 @@ set(CMAKE_MODULE_PATH
   ${CMAKE_MODULE_PATH}
   )
 
-if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR 
LIBUNWIND_STANDALONE_BUILD)
   project(libunwind)
 
   # Rely on llvm-config.


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


r362067 - asm goto: fix out-of-bounds read of Constraints after rC362045

2019-05-30 Thread Fangrui Song via cfe-commits
Author: maskray
Date: Thu May 30 01:03:02 2019
New Revision: 362067

URL: http://llvm.org/viewvc/llvm-project?rev=362067&view=rev
Log:
asm goto: fix out-of-bounds read of Constraints after rC362045

When parsing goto labels, Names and Exprs are expanded but Constraints
is not, this may cause a out-of-bounds read later in:

// GCCAsmStmt::GCCAsmStmt
// `constraints` has only `NumExprs - NumLabels` elements
  Constraints = new (C) StringLiteral*[NumExprs];
  std::copy(constraints, constraints + NumExprs, Constraints);

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

Modified: cfe/trunk/lib/Parse/ParseStmtAsm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmtAsm.cpp?rev=362067&r1=362066&r2=362067&view=diff
==
--- cfe/trunk/lib/Parse/ParseStmtAsm.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmtAsm.cpp Thu May 30 01:03:02 2019
@@ -846,6 +846,7 @@ StmtResult Parser::ParseAsmStatement(boo
   ExprResult Res =
   Actions.ActOnAddrLabel(Tok.getLocation(), Tok.getLocation(), LD);
   Exprs.push_back(Res.get());
+  Constraints.emplace_back();
   NumLabels++;
   ConsumeToken();
   if (!TryConsumeToken(tok::comma))


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


[PATCH] D62648: [Sema][Typo] Fix assertion failure for expressions with multiple typos

2019-05-30 Thread David Goldman via Phabricator via cfe-commits
dgoldman created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

As Typo Resolution can create new TypoExprs while resolving typos,
it is necessary to recurse through the expression to search for more
typos.

This should fix the assertion failure in `clang::Sema::~Sema()`:

  `DelayedTypos.empty() && "Uncorrected typos!"`

Notes:

- For expressions with multiple typos, we only give suggestions if we are able 
to resolve all typos in the expression
- This patch is similar to D37521  except that 
it does not eagerly commit to a correction for the first typo in the 
expression. Instead, it will search for corrections which fix all of the typos 
in the expression.


Repository:
  rC Clang

https://reviews.llvm.org/D62648

Files:
  lib/Sema/SemaExprCXX.cpp
  test/Sema/typo-correction-recursive.cpp

Index: test/Sema/typo-correction-recursive.cpp
===
--- /dev/null
+++ test/Sema/typo-correction-recursive.cpp
@@ -0,0 +1,50 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Check the following typo correction behavior:
+// - multiple typos in a single member call chain are all diagnosed
+// - no typos are diagnosed for multiple typos in an expression when not all
+//   typos can be corrected
+
+class DeepClass
+{
+public:
+  void trigger() const;  // expected-note {{'trigger' declared here}}
+};
+
+class Y
+{
+public:
+  const DeepClass& getX() const { return m_deepInstance; } // expected-note {{'getX' declared here}}
+  int getN() const { return m_n; }
+private:
+  DeepClass m_deepInstance;
+  int m_n;
+};
+
+class Z
+{
+public:
+  const Y& getY0() const { return m_y0; } // expected-note {{'getY0' declared here}}
+  const Y& getY1() const { return m_y1; }
+  const Y& getActiveY() const { return m_y0; }
+
+private:
+  Y m_y0;
+  Y m_y1;
+};
+
+Z z_obj;
+
+void testMultipleCorrections()
+{
+  z_obj.getY2(). // expected-error {{no member named 'getY2' in 'Z'; did you mean 'getY0'}}
+getM().  // expected-error {{no member named 'getM' in 'Y'; did you mean 'getX'}}
+triggee();   // expected-error {{no member named 'triggee' in 'DeepClass'; did you mean 'trigger'}}
+}
+
+void testNoCorrections()
+{
+  z_obj.getY2(). // expected-error {{no member named 'getY2' in 'Z'}}
+getM().
+thisDoesntSeemToMakeSense();
+}
Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -7680,6 +7680,56 @@
 return ExprFilter(Res.get());
   }
 
+  // Try to transform the given expression, looping through the correction
+  // candidates with `CheckAndAdvanceTypoExprCorrectionStreams`.
+  //
+  // Since correcting typos may intoduce new TypoExprs, this function
+  // checks for new TypoExprs and recurses if it finds any. Note that it will
+  // only succeed if it is able to correct all typos in the given expression.
+  ExprResult RecursiveTransformLoop(Expr *E) {
+ExprResult Res;
+while (true) {
+  Res = TryTransform(E);
+
+  // The transform was valid: check if there any new TypoExprs were created.
+  // If so, we need to recurse to check their validity.
+  if (!Res.isInvalid()) {
+Expr *FixedExpr = Res.get();
+auto SavedTypoExprs = TypoExprs;
+llvm::SmallSetVector RecursiveTypoExprs;
+TypoExprs = RecursiveTypoExprs;
+FindTypoExprs(TypoExprs).TraverseStmt(FixedExpr);
+
+// Check to see if any new TypoExprs were created. If they were, we need
+// to recurse in order to handle them. If we're not able to handle them,
+// discard this correction.
+if (!TypoExprs.empty()) {
+  ExprResult RecurResult = RecursiveTransformLoop(FixedExpr);
+  if (RecurResult.isInvalid())
+Res = ExprError();
+  else
+Res = RecurResult;
+  // Add the newly created typos to the TypoExprs list, even if they
+  // failed to apply. This allows them to be reaped although they won't
+  // emit any diagnostic.
+  SavedTypoExprs.set_union(TypoExprs);
+}
+
+TypoExprs = SavedTypoExprs;
+  }
+  // If the transform is still valid after checking for any new typos,
+  // it's good to go.
+  if (!Res.isInvalid())
+break;
+
+  // The transform was invalid, see if we have any TypoExprs with untried
+  // correction candidates.
+  if (!CheckAndAdvanceTypoExprCorrectionStreams())
+break;
+}
+return Res;
+  }
+
 public:
   TransformTypos(Sema &SemaRef, VarDecl *InitDecl, llvm::function_ref Filter)
   : BaseTransform(SemaRef), InitDecl(InitDecl), ExprFilter(Filter) {}
@@ -7707,16 +7757,7 @@
   ExprResult TransformBlockExpr(BlockExpr *E) { return Owned(E); }
 
   ExprResult Transform(Expr *E) {
-ExprResult Res;
-while (true) {
-  Res = TryTransform(E);
-
-  // Exit if eith

[PATCH] D62623: Reduce memory consumption of coverage dumps

2019-05-30 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

@kwk: looks like you're still compiling with clang-7, this patch is to be 
applied on the master version of LLVM/clang, then you can install it and use it 
to recompile llvm/lld with coverage info.

Does it make sense to you?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62623



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


[PATCH] D60763: Prototype OpenCL BIFs using Tablegen

2019-05-30 Thread Alexey Sotkin via Phabricator via cfe-commits
AlexeySotkin added inline comments.



Comment at: clang/include/clang/Basic/OpenCLBuiltins.td:298-302
+def write_imagef : Builtin<"write_imagef",
+[void_t,
+  image2d_WO_t,
+  VectorType,
+  VectorType]>;

Pierre wrote:
> AlexeySotkin wrote:
> > It seems like there is something wrong with access qualifiers for images. I 
> > have applied this patch and tried to compile the following code:
> > 
> > ```
> > typedef int int2 __attribute__((ext_vector_type(2)));
> > typedef float float4 __attribute__((ext_vector_type(4)));
> > 
> > void kernel k(write_only image2d_t image, int2 coord, float4 data) {
> >   write_imagef(image, coord, data);
> > }
> > 
> > ```
> > I got the following output:
> > ```
> > clang -cc1 -triple spir /work/tmp/tmp.cl -emit-llvm -o -  
> > -fadd-opencl-builtins
> > /work/tmp/tmp.cl:5:16: error: passing '__write_only image2d_t' to parameter 
> > of incompatible type '__read_only image2d_t'
> >   write_imagef(image, coord, data);
> >  ^
> > 1 error generated.
> > ```
> What you are saying is right. This patch is incomplete and some features are 
> missing/ broken. 
> I have a new version of the tablegen builtin feature where the access 
> qualifiers are actually taken into account, but I cannot extract only this 
> from my version. This would imply uploading the whole new version. 
> The new version will hopefully be on top of this patch, making access 
> qualifiers work.
Thanks, Pierre. I'd like to start early testing of image builtins with this 
prototype. Do you have an idea when you will have image builtins done in this 
(or other) patch?
If it is not going to happen in the nearest future, would you mind if I'll 
propose some changes for this patch/prototype meanwhile?


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

https://reviews.llvm.org/D60763



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


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

2019-05-30 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Thu May 30 02:39:45 2019
New Revision: 362076

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

Modified:
cfe/trunk/include/clang/Basic/ObjCRuntime.h

Modified: cfe/trunk/include/clang/Basic/ObjCRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/ObjCRuntime.h?rev=362076&r1=362075&r2=362076&view=diff
==
--- cfe/trunk/include/clang/Basic/ObjCRuntime.h (original)
+++ cfe/trunk/include/clang/Basic/ObjCRuntime.h Thu May 30 02:39:45 2019
@@ -443,6 +443,7 @@ public:
 case WatchOS:
   return true;
 }
+llvm_unreachable("bad kind");
   }
 
   /// Try to parse an Objective-C runtime specification from the given


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


Re: r362067 - asm goto: fix out-of-bounds read of Constraints after rC362045

2019-05-30 Thread Benjamin Kramer via cfe-commits
Is this still necessary after r362062?

On Thu, May 30, 2019 at 10:00 AM Fangrui Song via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: maskray
> Date: Thu May 30 01:03:02 2019
> New Revision: 362067
>
> URL: http://llvm.org/viewvc/llvm-project?rev=362067&view=rev
> Log:
> asm goto: fix out-of-bounds read of Constraints after rC362045
>
> When parsing goto labels, Names and Exprs are expanded but Constraints
> is not, this may cause a out-of-bounds read later in:
>
> // GCCAsmStmt::GCCAsmStmt
> // `constraints` has only `NumExprs - NumLabels` elements
>   Constraints = new (C) StringLiteral*[NumExprs];
>   std::copy(constraints, constraints + NumExprs, Constraints);
>
> Modified:
> cfe/trunk/lib/Parse/ParseStmtAsm.cpp
>
> Modified: cfe/trunk/lib/Parse/ParseStmtAsm.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmtAsm.cpp?rev=362067&r1=362066&r2=362067&view=diff
>
> ==
> --- cfe/trunk/lib/Parse/ParseStmtAsm.cpp (original)
> +++ cfe/trunk/lib/Parse/ParseStmtAsm.cpp Thu May 30 01:03:02 2019
> @@ -846,6 +846,7 @@ StmtResult Parser::ParseAsmStatement(boo
>ExprResult Res =
>Actions.ActOnAddrLabel(Tok.getLocation(), Tok.getLocation(),
> LD);
>Exprs.push_back(Res.get());
> +  Constraints.emplace_back();
>NumLabels++;
>ConsumeToken();
>if (!TryConsumeToken(tok::comma))
>
>
> ___
> 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


r362079 - Revert "asm goto: fix out-of-bounds read of Constraints after rC362045"

2019-05-30 Thread Fangrui Song via cfe-commits
Author: maskray
Date: Thu May 30 03:05:52 2019
New Revision: 362079

URL: http://llvm.org/viewvc/llvm-project?rev=362079&view=rev
Log:
Revert "asm goto: fix out-of-bounds read of Constraints after rC362045"

It was fixed by rC362062.

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

Modified: cfe/trunk/lib/Parse/ParseStmtAsm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmtAsm.cpp?rev=362079&r1=362078&r2=362079&view=diff
==
--- cfe/trunk/lib/Parse/ParseStmtAsm.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmtAsm.cpp Thu May 30 03:05:52 2019
@@ -846,7 +846,6 @@ StmtResult Parser::ParseAsmStatement(boo
   ExprResult Res =
   Actions.ActOnAddrLabel(Tok.getLocation(), Tok.getLocation(), LD);
   Exprs.push_back(Res.get());
-  Constraints.emplace_back();
   NumLabels++;
   ConsumeToken();
   if (!TryConsumeToken(tok::comma))


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


Re: r362067 - asm goto: fix out-of-bounds read of Constraints after rC362045

2019-05-30 Thread Fāng-ruì Sòng via cfe-commits
You beat me to it.. Reverted

On Thu, May 30, 2019 at 5:41 PM Benjamin Kramer  wrote:

> Is this still necessary after r362062?
>
> On Thu, May 30, 2019 at 10:00 AM Fangrui Song via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: maskray
>> Date: Thu May 30 01:03:02 2019
>> New Revision: 362067
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=362067&view=rev
>> Log:
>> asm goto: fix out-of-bounds read of Constraints after rC362045
>>
>> When parsing goto labels, Names and Exprs are expanded but Constraints
>> is not, this may cause a out-of-bounds read later in:
>>
>> // GCCAsmStmt::GCCAsmStmt
>> // `constraints` has only `NumExprs - NumLabels` elements
>>   Constraints = new (C) StringLiteral*[NumExprs];
>>   std::copy(constraints, constraints + NumExprs, Constraints);
>>
>> Modified:
>> cfe/trunk/lib/Parse/ParseStmtAsm.cpp
>>
>> Modified: cfe/trunk/lib/Parse/ParseStmtAsm.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmtAsm.cpp?rev=362067&r1=362066&r2=362067&view=diff
>>
>> ==
>> --- cfe/trunk/lib/Parse/ParseStmtAsm.cpp (original)
>> +++ cfe/trunk/lib/Parse/ParseStmtAsm.cpp Thu May 30 01:03:02 2019
>> @@ -846,6 +846,7 @@ StmtResult Parser::ParseAsmStatement(boo
>>ExprResult Res =
>>Actions.ActOnAddrLabel(Tok.getLocation(), Tok.getLocation(),
>> LD);
>>Exprs.push_back(Res.get());
>> +  Constraints.emplace_back();
>>NumLabels++;
>>ConsumeToken();
>>if (!TryConsumeToken(tok::comma))
>>
>>
>> ___
>> 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] D60499: [ASTImporter] Various source location and range import fixes.

2019-05-30 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment.

It looks like that the same test can be applied as in D60463 
 but check only the first line of the AST 
dump. The first line contains information about the actual Decl only. This 
checks less than checking the full AST dump but finds some of wrong 
`SourceLocation` import. The problem is that the test can not be added yet 
because there are other failures. At least one new patch is needed with 
corrections related to import of `TypeSourceInfo`. Anyway this change (and the 
others) can not be added together with the test because multiple patches 
(including this) are needed to make the test not fail.

Source locations can be observed here:
http://ce.steveire.com/z/WB9VAu


Repository:
  rC Clang

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

https://reviews.llvm.org/D60499



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


r362085 - Fix Wdocumentation warning. NFCI.

2019-05-30 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Thu May 30 03:44:36 2019
New Revision: 362085

URL: http://llvm.org/viewvc/llvm-project?rev=362085&view=rev
Log:
Fix Wdocumentation warning. NFCI.

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/CheckerManager.h

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/CheckerManager.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/CheckerManager.h?rev=362085&r1=362084&r2=362085&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/CheckerManager.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/CheckerManager.h Thu May 30 
03:44:36 2019
@@ -410,7 +410,6 @@ public:
   /// \param Out   The output stream
   /// \param State The state being printed
   /// \param NLThe preferred representation of a newline.
-  /// \param Sep   The preferred separator between different messages.
   /// \param Space The preferred space between the left side and the message.
   /// \param IsDot Whether the message will be printed in 'dot' format.
   void runCheckersForPrintStateJson(raw_ostream &Out, ProgramStateRef State,


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


[PATCH] D62638: [analyzer] A Python script to prettify the ExplodedGraph dumps.

2019-05-30 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso added a comment.

Sorry for that much rewrite request but in a script language you have to name 
your stuff properly or you will be completely lost. I have not written a single 
Python class yet, but trust me.

I really like that `DotDumpVisitor` semantic, but it would be a lot better at 
SVG level. At the moment whatever style/table-data you insert it adds an extra 
text tag per styling which is quite inefficient.

We could use "foreignObject" (somehow) and apply pure HTML tables or I could 
use my `` idea instead 
(https://developer.mozilla.org/en-US/docs/Web/SVG/Element/tspan). I recommend 
the latter as it is better than a fixed table.

With the current representation it would be difficult to apply every styling to 
tspans. I think it also would be difficult to use your `Explorer` idea as we 
are talking about modificating the SVG dynamically.

In D62638#1522357 , @NoQ wrote:

> > I wrote some tests but i'm not really sure they're worth it.
>
> Mmm, on second thought, they probably won't work out of the box, because they 
> might require installing python modules in order to work. I'm actually not 
> sure if all machines have python3. I'll try but it'll most likely fail. I 
> guess i could try excluding them from `make check-all`.


It would be cool to introduce something like `check-scripts`.




Comment at: clang/utils/analyzer/exploded-graph-rewriter.py:5
+import collections
+import json as json_module  # 'json' is a great name for a variable.
+import logging

I think it is not that cool variable name. I would use the appropiate name of 
the object instead of the generic `json` name.



Comment at: clang/utils/analyzer/exploded-graph-rewriter.py:12
+class SourceLocation(object):
+def __init__(self, json):
+super(SourceLocation, self).__init__()

`json` -> `loc`



Comment at: clang/utils/analyzer/exploded-graph-rewriter.py:22
+class ProgramPoint(object):
+def __init__(self, json):
+super(ProgramPoint, self).__init__()

`json` -> `program_point` and so on...



Comment at: clang/utils/analyzer/exploded-graph-rewriter.py:33
+self.pretty = json['pretty']
+self.sloc = SourceLocation(json['location']) \
+if json['location'] is not None else None

What about just `loc`?



Comment at: clang/utils/analyzer/exploded-graph-rewriter.py:124
+self.parents = []
+self.children = []
+

What about `predecessors` and `successors`? It is the proper name in the Static 
Analyzer world.



Comment at: clang/utils/analyzer/exploded-graph-rewriter.py:126
+
+def set_json(self, node_id, json):
+logging.debug('Adding ' + node_id)

- `set_json()` -> `set()` the given `node`
- `json` -> `node`



Comment at: clang/utils/analyzer/exploded-graph-rewriter.py:151
+super(ExplodedGraph, self).__init__()
+self.nodes = collections.defaultdict(ExplodedNode)
+self.root_id = None

`nodes` -> `graph`



Comment at: clang/utils/analyzer/exploded-graph-rewriter.py:184
+# even though in a valid dot file everything is escaped.
+raw_json = result[2].replace('\\l', '') \
+.replace(' ', '') \

`raw_json` -> `node_string` which will be a raw JSON after `loads()`.



Comment at: clang/utils/analyzer/exploded-graph-rewriter.py:191
+.replace('\\>', '>') \
+.rstrip(',')
+logging.debug(raw_json)

I have removed the trailing `,` from the end yesterday so `rstrip(',')` is not 
needed.

It would be cool to name the `result[]`, like: `pred_id = result[1]` and 
`succ_id = result[2]` or current/previous ID, or something like that.

I also would put the regexes into a function and you could write:
`pred_id, succ_id = parse_edge()` or something more simpler.

What is `result[0]` btw? That confused me a little-bit.



Comment at: clang/utils/analyzer/exploded-graph-rewriter.py:233
+else:
+color = 'cyan3'
+

It would be cool to put it into a "switch-statement" 
(https://stackoverflow.com/questions/60208/replacements-for-switch-statement-in-python).



Comment at: clang/utils/analyzer/exploded-graph-rewriter.py:237
+if p.sloc is not None:
+self._dump(''
+   '%s:%s:%s:'

I think tables are left aligned by default, so you could remove your left 
alignments.



Comment at: clang/utils/analyzer/exploded-graph-rewriter.py:326
+self._dump('Program point:')
+self._dump(''
+   '')

I would c

Re: r361329 - [c++20] P1330R0: permit simple-assignments that change the active member

2019-05-30 Thread Stephan Bergmann via cfe-commits

On 22/05/2019 01:15, Richard Smith via cfe-commits wrote:

Author: rsmith
Date: Tue May 21 16:15:20 2019
New Revision: 361329

URL: http://llvm.org/viewvc/llvm-project?rev=361329&view=rev
Log:
[c++20] P1330R0: permit simple-assignments that change the active member
of a union within constant expression evaluation.

[...]

--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Tue May 21 16:15:20 2019

[...]> @@ -4888,6 +4916,159 @@ static bool HandleDynamicCast(EvalInfo &
[...]

+/// Handle a builtin simple-assignment or a call to a trivial assignment
+/// operator whose left-hand side might involve a union member access. If it
+/// does, implicitly start the lifetime of any accessed union elements per
+/// C++20 [class.union]5.
+static bool HandleUnionActiveMemberChange(EvalInfo &Info, const Expr *LHSExpr,
+  const LValue &LHS) {
+  if (LHS.InvalidBase || LHS.Designator.Invalid)
+return false;
+
+  llvm::SmallVector, 4> UnionPathLengths;
+  // C++ [class.union]p5:
+  //   define the set S(E) of subexpressions of E as follows:
+  const Expr *E = LHSExpr;
+  unsigned PathLength = LHS.Designator.Entries.size();
+  while (E) {
+//   -- If E is of the form A.B, S(E) contains the elements of S(A)...
+if (auto *ME = dyn_cast(E)) {
+  auto *FD = dyn_cast(ME->getMemberDecl());
+  if (!FD)
+break;
+
+  //... and also contains A.B if B names a union member
+  if (FD->getParent()->isUnion())
+UnionPathLengths.push_back({PathLength - 1, FD});
+
+  E = ME->getBase();
+  --PathLength;
+  assert(declaresSameEntity(FD,
+LHS.Designator.Entries[PathLength]
+.getAsBaseOrMember().getPointer()));
+
+  //   -- If E is of the form A[B] and is interpreted as a built-in array
+  //  subscripting operator, S(E) is [S(the array operand, if any)].
+} else if (auto *ASE = dyn_cast(E)) {
+  // Step over an ArrayToPointerDecay implicit cast.
+  auto *Base = ASE->getBase()->IgnoreImplicit();
+  if (!Base->getType()->isArrayType())
+break;
+
+  E = Base;
+  --PathLength;
+
+} else if (auto *ICE = dyn_cast(E)) {
+  // Step over a derived-to-base conversion.
+  if (ICE->getCastKind() == CK_NoOp)
+continue;
+  if (ICE->getCastKind() != CK_DerivedToBase &&
+  ICE->getCastKind() != CK_UncheckedDerivedToBase)
+break;
+  for (const CXXBaseSpecifier *Elt : ICE->path()) {
+--PathLength;
+assert(declaresSameEntity(Elt->getType()->getAsCXXRecordDecl(),
+  LHS.Designator.Entries[PathLength]
+  .getAsBaseOrMember().getPointer()));


the above assert fires for the below test.cc with `clang++ -std=c++2a 
-fsyntax-only test.cc`:



struct S1 { int n; };
struct S2: S1 {};
struct S3: S2 {};
void f() {
 S3 s;
 s.n = 0;
}

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


[PATCH] D60748: Fix i386 struct and union parameter alignment

2019-05-30 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added inline comments.



Comment at: lib/CodeGen/TargetInfo.cpp:1501
+//
+// Exclude other System V OS (e.g Darwin, PS4 and FreeBSD) since we don't
+// want to spend any effort dealing with the ramifications of ABI breaks.

krytarowski wrote:
> Darwin and BSD are not System V.
> 
> CC: @joerg @mgorny for NetBSD. Do we need to do something here?
It's a misnomer. The ABI standard for i386 was the SysV ABI before GNU decided 
to silently break the stack alignment and calling it the new ABI. That said, 
I'm not sure how much copy-by-value of vector types actually happens and that's 
the only situation affected by this.


Repository:
  rC Clang

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

https://reviews.llvm.org/D60748



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


[PATCH] D62580: [OpenCL] Use long instead of long long in x86 builtins

2019-05-30 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

Do you think it's possible to add a test?


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

https://reviews.llvm.org/D62580



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


[PATCH] D62654: [Docs] Modernize references to macOS

2019-05-30 Thread J. Ryan Stinnett via Phabricator via cfe-commits
jryans created this revision.
jryans added a reviewer: JDevlieghere.
Herald added subscribers: llvm-commits, libcxx-commits, lldb-commits, 
cfe-commits, arphaman, christof, mgorny.
Herald added projects: clang, LLDB, libc++, LLVM.

This updates all places in documentation that refer to "Mac OS X", "OS X", etc.
to instead use the modern name "macOS" when no specific version number is
mentioned.

If a specific version is mentioned, this attempts to use the OS name at the time
of that version:

- Mac OS X for 10.0 - 10.7
- OS X for 10.8 - 10.11
- macOS for 10.12 - present


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62654

Files:
  clang/docs/AddressSanitizer.rst
  clang/docs/AutomaticReferenceCounting.rst
  clang/docs/ClangCommandLineReference.rst
  clang/docs/CommandGuide/clang.rst
  clang/docs/LeakSanitizer.rst
  clang/docs/Modules.rst
  clang/docs/SafeStack.rst
  clang/docs/UndefinedBehaviorSanitizer.rst
  clang/docs/UsersManual.rst
  clang/docs/analyzer/checkers.rst
  clang/docs/analyzer/developer-docs/DebugChecks.rst
  libcxx/docs/BuildingLibcxx.rst
  libcxx/docs/UsingLibcxx.rst
  libcxx/docs/index.rst
  libunwind/docs/index.rst
  lld/docs/sphinx_intro.rst
  lldb/docs/lldb-gdb-remote.txt
  lldb/docs/resources/build.rst
  lldb/docs/use/remote.rst
  llvm/docs/CMake.rst
  llvm/docs/CommandGuide/llvm-ar.rst
  llvm/docs/CompilerWriterInfo.rst
  llvm/docs/DebuggingJITedCode.rst
  llvm/docs/GettingStarted.rst
  llvm/docs/ProgrammersManual.rst
  llvm/docs/TestingGuide.rst
  llvm/docs/WritingAnLLVMPass.rst

Index: llvm/docs/WritingAnLLVMPass.rst
===
--- llvm/docs/WritingAnLLVMPass.rst
+++ llvm/docs/WritingAnLLVMPass.rst
@@ -77,7 +77,7 @@
 is to be compiled and linked into a shared object ``$(LEVEL)/lib/LLVMHello.so`` that
 can be dynamically loaded by the :program:`opt` tool via its :option:`-load`
 option. If your operating system uses a suffix other than ``.so`` (such as
-Windows or Mac OS X), the appropriate extension will be used.
+Windows or macOS), the appropriate extension will be used.
 
 Now that we have the build scripts set up, we just need to write the code for
 the pass itself.
Index: llvm/docs/TestingGuide.rst
===
--- llvm/docs/TestingGuide.rst
+++ llvm/docs/TestingGuide.rst
@@ -511,7 +511,7 @@
The suffix for the host platforms shared library files. This includes the
period as the first character.
 
-   Example: ``.so`` (Linux), ``.dylib`` (OS X), ``.dll`` (Windows)
+   Example: ``.so`` (Linux), ``.dylib`` (macOS), ``.dll`` (Windows)
 
 ``%exeext``
The suffix for the host platforms executable files. This includes the
Index: llvm/docs/ProgrammersManual.rst
===
--- llvm/docs/ProgrammersManual.rst
+++ llvm/docs/ProgrammersManual.rst
@@ -1372,8 +1372,8 @@
 
 Getting this to work requires a small amount of setup.  On Unix systems
 with X11, install the `graphviz `_ toolkit, and make
-sure 'dot' and 'gv' are in your path.  If you are running on Mac OS X, download
-and install the Mac OS X `Graphviz program
+sure 'dot' and 'gv' are in your path.  If you are running on macOS, download
+and install the macOS `Graphviz program
 `_ and add
 ``/Applications/Graphviz.app/Contents/MacOS/`` (or wherever you install it) to
 your path. The programs need not be present when configuring, building or
Index: llvm/docs/GettingStarted.rst
===
--- llvm/docs/GettingStarted.rst
+++ llvm/docs/GettingStarted.rst
@@ -128,8 +128,8 @@
 FreeBSDamd64 GCC, Clang
 NetBSD x86\ :sup:`1` GCC, Clang
 NetBSD amd64 GCC, Clang
-MacOS X\ :sup:`2`  PowerPC   GCC
-MacOS Xx86   GCC, Clang
+macOS\ :sup:`2`PowerPC   GCC
+macOS  x86   GCC, Clang
 Cygwin/Win32   x86\ :sup:`1, 3`  GCC
 Windowsx86\ :sup:`1` Visual Studio
 Windows x64x86-64Visual Studio
@@ -272,7 +272,7 @@
 Getting a Modern Host C++ Toolchain
 ^^^
 
-This section mostly applies to Linux and older BSDs. On Mac OS X, you should
+This section mostly applies to Linux and older BSDs. On macOS, you should
 have a sufficiently modern Xcode, or you will likely need to upgrade until you
 do. Windows does not have a "system compiler", so you must install either Visual
 Studio 2015 or a recent version of mingw64. FreeBSD 10.0 and newer have a modern
@@ -711,7 +711,7 @@
 
 The result of such a build is executables that are not runnable on the build
 host but can be executed on the target. As an example the following CMake
-invocation can generate build files targeting iOS. This will work on Mac OS X
+invocation 

r362087 - [OpenCL] Support logical vector operators in C++ mode

2019-05-30 Thread Sven van Haastregt via cfe-commits
Author: svenvh
Date: Thu May 30 05:35:19 2019
New Revision: 362087

URL: http://llvm.org/viewvc/llvm-project?rev=362087&view=rev
Log:
[OpenCL] Support logical vector operators in C++ mode

Support logical operators on vectors in C++ for OpenCL mode, to
preserve backwards compatibility with OpenCL C.

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

Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/CodeGenOpenCL/logical-ops.cl

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=362087&r1=362086&r2=362087&view=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu May 30 05:35:19 2019
@@ -10902,7 +10902,7 @@ QualType Sema::CheckVectorLogicalOperand
   if (vType.isNull())
 return InvalidOperands(Loc, LHS, RHS);
   if (getLangOpts().OpenCL && getLangOpts().OpenCLVersion < 120 &&
-  vType->hasFloatingRepresentation())
+  !getLangOpts().OpenCLCPlusPlus && vType->hasFloatingRepresentation())
 return InvalidOperands(Loc, LHS, RHS);
   // FIXME: The check for C++ here is for GCC compatibility. GCC rejects the
   //usage of the logical operators && and || with vectors in C. This
@@ -13165,7 +13165,8 @@ ExprResult Sema::CreateBuiltinUnaryOp(So
   }
 } else if (resultType->isExtVectorType()) {
   if (Context.getLangOpts().OpenCL &&
-  Context.getLangOpts().OpenCLVersion < 120) {
+  Context.getLangOpts().OpenCLVersion < 120 &&
+  !Context.getLangOpts().OpenCLCPlusPlus) {
 // OpenCL v1.1 6.3.h: The logical operator not (!) does not
 // operate on vector float types.
 QualType T = resultType->getAs()->getElementType();

Modified: cfe/trunk/test/CodeGenOpenCL/logical-ops.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/logical-ops.cl?rev=362087&r1=362086&r2=362087&view=diff
==
--- cfe/trunk/test/CodeGenOpenCL/logical-ops.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/logical-ops.cl Thu May 30 05:35:19 2019
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL1.2 -O1 -triple 
x86_64-unknown-linux-gnu | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=c++ -O1 -triple 
x86_64-unknown-linux-gnu | FileCheck %s
 
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 


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


[PATCH] D62588: [OpenCL] Support logical vector operators in C++ mode

2019-05-30 Thread Sven van Haastregt via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362087: [OpenCL] Support logical vector operators in C++ 
mode (authored by svenvh, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62588?vs=201897&id=202162#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62588

Files:
  cfe/trunk/lib/Sema/SemaExpr.cpp
  cfe/trunk/test/CodeGenOpenCL/logical-ops.cl


Index: cfe/trunk/test/CodeGenOpenCL/logical-ops.cl
===
--- cfe/trunk/test/CodeGenOpenCL/logical-ops.cl
+++ cfe/trunk/test/CodeGenOpenCL/logical-ops.cl
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL1.2 -O1 -triple 
x86_64-unknown-linux-gnu | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=c++ -O1 -triple 
x86_64-unknown-linux-gnu | FileCheck %s
 
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 
Index: cfe/trunk/lib/Sema/SemaExpr.cpp
===
--- cfe/trunk/lib/Sema/SemaExpr.cpp
+++ cfe/trunk/lib/Sema/SemaExpr.cpp
@@ -10902,7 +10902,7 @@
   if (vType.isNull())
 return InvalidOperands(Loc, LHS, RHS);
   if (getLangOpts().OpenCL && getLangOpts().OpenCLVersion < 120 &&
-  vType->hasFloatingRepresentation())
+  !getLangOpts().OpenCLCPlusPlus && vType->hasFloatingRepresentation())
 return InvalidOperands(Loc, LHS, RHS);
   // FIXME: The check for C++ here is for GCC compatibility. GCC rejects the
   //usage of the logical operators && and || with vectors in C. This
@@ -13165,7 +13165,8 @@
   }
 } else if (resultType->isExtVectorType()) {
   if (Context.getLangOpts().OpenCL &&
-  Context.getLangOpts().OpenCLVersion < 120) {
+  Context.getLangOpts().OpenCLVersion < 120 &&
+  !Context.getLangOpts().OpenCLCPlusPlus) {
 // OpenCL v1.1 6.3.h: The logical operator not (!) does not
 // operate on vector float types.
 QualType T = resultType->getAs()->getElementType();


Index: cfe/trunk/test/CodeGenOpenCL/logical-ops.cl
===
--- cfe/trunk/test/CodeGenOpenCL/logical-ops.cl
+++ cfe/trunk/test/CodeGenOpenCL/logical-ops.cl
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL1.2 -O1 -triple x86_64-unknown-linux-gnu | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=c++ -O1 -triple x86_64-unknown-linux-gnu | FileCheck %s
 
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 
Index: cfe/trunk/lib/Sema/SemaExpr.cpp
===
--- cfe/trunk/lib/Sema/SemaExpr.cpp
+++ cfe/trunk/lib/Sema/SemaExpr.cpp
@@ -10902,7 +10902,7 @@
   if (vType.isNull())
 return InvalidOperands(Loc, LHS, RHS);
   if (getLangOpts().OpenCL && getLangOpts().OpenCLVersion < 120 &&
-  vType->hasFloatingRepresentation())
+  !getLangOpts().OpenCLCPlusPlus && vType->hasFloatingRepresentation())
 return InvalidOperands(Loc, LHS, RHS);
   // FIXME: The check for C++ here is for GCC compatibility. GCC rejects the
   //usage of the logical operators && and || with vectors in C. This
@@ -13165,7 +13165,8 @@
   }
 } else if (resultType->isExtVectorType()) {
   if (Context.getLangOpts().OpenCL &&
-  Context.getLangOpts().OpenCLVersion < 120) {
+  Context.getLangOpts().OpenCLVersion < 120 &&
+  !Context.getLangOpts().OpenCLCPlusPlus) {
 // OpenCL v1.1 6.3.h: The logical operator not (!) does not
 // operate on vector float types.
 QualType T = resultType->getAs()->getElementType();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61743: New clang option -MD-filter=prefix to filter files from make dependencies

2019-05-30 Thread Melanie Blower via Phabricator via cfe-commits
mibintc abandoned this revision.
mibintc added a comment.

I'll modify this to be a cc1 only option, there doesn't seem to be community 
interest.


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

https://reviews.llvm.org/D61743



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


[PATCH] D62657: [OpenCL] Fix OpenCL/SPIR version metadata

2019-05-30 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia created this revision.
Anastasia added a reviewer: svenvh.
Herald added subscribers: ebevhan, yaxunl.

C++ is derived from OpenCL v2.0 therefore set the versions to the same.

In the future we might need to add extra version for CXX.


https://reviews.llvm.org/D62657

Files:
  lib/CodeGen/CodeGenModule.cpp
  test/CodeGenOpenCL/spir_version.cl


Index: test/CodeGenOpenCL/spir_version.cl
===
--- test/CodeGenOpenCL/spir_version.cl
+++ test/CodeGenOpenCL/spir_version.cl
@@ -5,6 +5,9 @@
 // RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - 
-cl-std=CL1.2 | FileCheck %s --check-prefix=CHECK-SPIR-CL12
 // RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - 
-cl-std=CL2.0 | FileCheck %s --check-prefix=CHECK-SPIR-CL20
 
+
+// RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - 
-cl-std=c++ | FileCheck %s --check-prefix=CHECK-SPIR-CL20
+
 // RUN: %clang_cc1 %s -triple "amdgcn--amdhsa" -emit-llvm -o - | FileCheck %s 
--check-prefix=CHECK-AMDGCN-CL10
 // RUN: %clang_cc1 %s -triple "amdgcn--amdhsa" -emit-llvm -o - -cl-std=CL1.2 | 
FileCheck %s --check-prefix=CHECK-AMDGCN-CL12
 // RUN: %clang_cc1 %s -triple "amdgcn--amdhsa" -emit-llvm -o - -cl-std=CL2.0 | 
FileCheck %s --check-prefix=CHECK-AMDGCN-CL20
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -559,11 +559,13 @@
 if (getTriple().isSPIR()) {
   // SPIR v2.0 s2.12 - The SPIR version used by the module is stored in the
   // opencl.spir.version named metadata.
+  // C++ is backwards compatible with v2.0.
+  auto Version = LangOpts.OpenCLCPlusPlus ? 200 : LangOpts.OpenCLVersion;
   llvm::Metadata *SPIRVerElts[] = {
   llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
-  Int32Ty, LangOpts.OpenCLVersion / 100)),
+  Int32Ty, Version / 100)),
   llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
-  Int32Ty, (LangOpts.OpenCLVersion / 100 > 1) ? 0 : 2))};
+  Int32Ty, (Version / 100 > 1) ? 0 : 2))};
   llvm::NamedMDNode *SPIRVerMD =
   TheModule.getOrInsertNamedMetadata("opencl.spir.version");
   llvm::LLVMContext &Ctx = TheModule.getContext();
@@ -618,11 +620,14 @@
 void CodeGenModule::EmitOpenCLMetadata() {
   // SPIR v2.0 s2.13 - The OpenCL version used by the module is stored in the
   // opencl.ocl.version named metadata node.
+  // C++ is backwards compatible with v2.0.
+  // FIXME: We might need to add CXX version at some point too?
+  auto Version = LangOpts.OpenCLCPlusPlus ? 200 : LangOpts.OpenCLVersion;
   llvm::Metadata *OCLVerElts[] = {
   llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
-  Int32Ty, LangOpts.OpenCLVersion / 100)),
+  Int32Ty, Version / 100)),
   llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
-  Int32Ty, (LangOpts.OpenCLVersion % 100) / 10))};
+  Int32Ty, (Version % 100) / 10))};
   llvm::NamedMDNode *OCLVerMD =
   TheModule.getOrInsertNamedMetadata("opencl.ocl.version");
   llvm::LLVMContext &Ctx = TheModule.getContext();


Index: test/CodeGenOpenCL/spir_version.cl
===
--- test/CodeGenOpenCL/spir_version.cl
+++ test/CodeGenOpenCL/spir_version.cl
@@ -5,6 +5,9 @@
 // RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - -cl-std=CL1.2 | FileCheck %s --check-prefix=CHECK-SPIR-CL12
 // RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - -cl-std=CL2.0 | FileCheck %s --check-prefix=CHECK-SPIR-CL20
 
+
+// RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - -cl-std=c++ | FileCheck %s --check-prefix=CHECK-SPIR-CL20
+
 // RUN: %clang_cc1 %s -triple "amdgcn--amdhsa" -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-AMDGCN-CL10
 // RUN: %clang_cc1 %s -triple "amdgcn--amdhsa" -emit-llvm -o - -cl-std=CL1.2 | FileCheck %s --check-prefix=CHECK-AMDGCN-CL12
 // RUN: %clang_cc1 %s -triple "amdgcn--amdhsa" -emit-llvm -o - -cl-std=CL2.0 | FileCheck %s --check-prefix=CHECK-AMDGCN-CL20
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -559,11 +559,13 @@
 if (getTriple().isSPIR()) {
   // SPIR v2.0 s2.12 - The SPIR version used by the module is stored in the
   // opencl.spir.version named metadata.
+  // C++ is backwards compatible with v2.0.
+  auto Version = LangOpts.OpenCLCPlusPlus ? 200 : LangOpts.OpenCLVersion;
   llvm::Metadata *SPIRVerElts[] = {
   llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
-  Int32Ty, LangOpts.OpenCLVersion / 100)),
+  Int32Ty, Version / 100)),
   llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
-  Int32Ty, (La

[PATCH] D62654: [Docs] Modernize references to macOS

2019-05-30 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

I'm fine with the libc++ changes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62654



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


[PATCH] D62658: [analyzer] print() JSONify: ExplodedNode revision

2019-05-30 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso created this revision.
Charusso added reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, 
Szelethus.
Charusso added a project: clang.
Herald added subscribers: cfe-commits, dkrupp, donat.nagy, mikhail.ramalho, 
a.sidorin, rnkovacs, szepet.

Revert node-ID removal.


Repository:
  rC Clang

https://reviews.llvm.org/D62658

Files:
  clang/lib/StaticAnalyzer/Core/ExprEngine.cpp


Index: clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
===
--- clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -3075,8 +3075,8 @@
 const unsigned int Space = 1;
 ProgramStateRef State = N->getState();
 
-Out << "{ \"node_id\": \"" << (const void *)N
-<< "\", \"state_id\": " << State->getID()
+Out << "{ \"node_id\": " << N->getID(G) << ", \"pointer\": \""
+<< (const void *)N << "\", \"state_id\": " << State->getID()
 << ", \"has_report\": " << (nodeHasBugReport(N) ? "true" : "false")
 << ",\\l";
 
@@ -3094,7 +3094,7 @@
   else
 Out << "null }";
 },
-   // Adds a comma and a new-line between each program point.
+// Adds a comma and a new-line between each program point.
 [&](const ExplodedNode *) { Out << ",\\l"; },
 [&](const ExplodedNode *) { return false; });
 


Index: clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
===
--- clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -3075,8 +3075,8 @@
 const unsigned int Space = 1;
 ProgramStateRef State = N->getState();
 
-Out << "{ \"node_id\": \"" << (const void *)N
-<< "\", \"state_id\": " << State->getID()
+Out << "{ \"node_id\": " << N->getID(G) << ", \"pointer\": \""
+<< (const void *)N << "\", \"state_id\": " << State->getID()
 << ", \"has_report\": " << (nodeHasBugReport(N) ? "true" : "false")
 << ",\\l";
 
@@ -3094,7 +3094,7 @@
   else
 Out << "null }";
 },
-	// Adds a comma and a new-line between each program point.
+// Adds a comma and a new-line between each program point.
 [&](const ExplodedNode *) { Out << ",\\l"; },
 [&](const ExplodedNode *) { return false; });
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62657: [OpenCL] Fix OpenCL/SPIR version metadata

2019-05-30 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh accepted this revision.
svenvh added a comment.
This revision is now accepted and ready to land.

LGTM!


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

https://reviews.llvm.org/D62657



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


Re: r361997 - [analyzer] print() JSONify: getNodeLabel implementation

2019-05-30 Thread Russell Gallop via cfe-commits
Hi Csaba,

The test dump_egraph.cpp appears to be flaky on Windows. For example here:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/26183
.

C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\Analysis\dump_egraph.cpp:23:11:
error: CHECK: expected string not found in input
// CHECK: \"store\": [\l  \{ \"cluster\":
\"t\", \"items\": [\l\{
\"kind\": \"Default\", \"offset\": 0, \"value\": \"conj_$3\{int, LC3, no
stmt, #1\}\"

Running locally, it fails after 2-5 runs for me, running:
python bin/llvm-lit.py -v ../clang/test/Analysis/dump_egraph.cpp

Please could you take a look?

Note that I'm not certain it was this commit that started the flakiness, it
is the latest which changed the failing line.

Thanks
Russ

On Wed, 29 May 2019 at 19:02, Csaba Dabis via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: charusso
> Date: Wed May 29 11:05:53 2019
> New Revision: 361997
>
> URL: http://llvm.org/viewvc/llvm-project?rev=361997&view=rev
> Log:
> [analyzer] print() JSONify: getNodeLabel implementation
>
> Summary: This patch also rewrites the ProgramPoint printing.
>
> Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus
>
> Reviewed By: NoQ
>
> Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin, mikhail.ramalho,
>  donat.nagy, dkrupp
>
> Tags: #clang
>
> Differential Revision: https://reviews.llvm.org/D62346
>
> Modified:
> cfe/trunk/include/clang/Analysis/ProgramPoint.h
> cfe/trunk/lib/Analysis/ProgramPoint.cpp
> cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
> cfe/trunk/test/Analysis/dump_egraph.c
> cfe/trunk/test/Analysis/dump_egraph.cpp
>
> Modified: cfe/trunk/include/clang/Analysis/ProgramPoint.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/ProgramPoint.h?rev=361997&r1=361996&r2=361997&view=diff
>
> ==
> --- cfe/trunk/include/clang/Analysis/ProgramPoint.h (original)
> +++ cfe/trunk/include/clang/Analysis/ProgramPoint.h Wed May 29 11:05:53
> 2019
> @@ -213,7 +213,7 @@ public:
>  ID.AddPointer(getTag());
>}
>
> -  void print(StringRef CR, llvm::raw_ostream &Out) const;
> +  void printJson(llvm::raw_ostream &Out, const char *NL = "\n") const;
>
>LLVM_DUMP_METHOD void dump() const;
>
>
> Modified: cfe/trunk/lib/Analysis/ProgramPoint.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ProgramPoint.cpp?rev=361997&r1=361996&r2=361997&view=diff
>
> ==
> --- cfe/trunk/lib/Analysis/ProgramPoint.cpp (original)
> +++ cfe/trunk/lib/Analysis/ProgramPoint.cpp Wed May 29 11:05:53 2019
> @@ -43,151 +43,152 @@ ProgramPoint ProgramPoint::getProgramPoi
>  }
>
>  LLVM_DUMP_METHOD void ProgramPoint::dump() const {
> -  return print(/*CR=*/"\n", llvm::errs());
> +  return printJson(llvm::errs());
>  }
>
> -static void printLocation(raw_ostream &Out, SourceLocation SLoc,
> -  const SourceManager &SM,
> -  StringRef CR,
> -  StringRef Postfix) {
> -  if (SLoc.isFileID()) {
> -Out << CR << "line=" << SM.getExpansionLineNumber(SLoc)
> -<< " col=" << SM.getExpansionColumnNumber(SLoc) << Postfix;
> +static void printLocation(raw_ostream &Out, SourceLocation Loc,
> +  const SourceManager &SM) {
> +  Out << "\"location\": ";
> +  if (!Loc.isFileID()) {
> +Out << "null";
> +return;
>}
> +
> +  Out << "{ \"line\": " << SM.getExpansionLineNumber(Loc)
> +  << ", \"column\": " << SM.getExpansionColumnNumber(Loc) << " }";
>  }
>
> -void ProgramPoint::print(StringRef CR, llvm::raw_ostream &Out) const {
> +void ProgramPoint::printJson(llvm::raw_ostream &Out, const char *NL)
> const {
>const ASTContext &Context =
>getLocationContext()->getAnalysisDeclContext()->getASTContext();
>const SourceManager &SM = Context.getSourceManager();
> +
> +  Out << "\"kind\": \"";
>switch (getKind()) {
>case ProgramPoint::BlockEntranceKind:
> -Out << "Block Entrance: B"
> +Out << "BlockEntrance\""
> +<< ", \"block_id\": "
>  << castAs().getBlock()->getBlockID();
>  break;
>
>case ProgramPoint::FunctionExitKind: {
>  auto FEP = getAs();
> -Out << "Function Exit: B" << FEP->getBlock()->getBlockID();
> +Out << "FunctionExit\""
> +<< ", \"block_id\": " << FEP->getBlock()->getBlockID()
> +<< ", \"stmt_id\": ";
> +
>  if (const ReturnStmt *RS = FEP->getStmt()) {
> -  Out << CR << " Return: S" << RS->getID(Context) << CR;
> -  RS->printPretty(Out, /*helper=*/nullptr,
> Context.getPrintingPolicy(),
> -  /*Indentation=*/2, /*NewlineSymbol=*/CR);
> +  Out << RS->getID(Context) << ", \"stmt\": \"";
> +  RS->printPretty(Out, /*Helper=*/nullptr,
> Context.getPr

Re: r361997 - [analyzer] print() JSONify: getNodeLabel implementation

2019-05-30 Thread Csaba Dabis via cfe-commits
Hey!

When it fails, could you provide the DOT dump? The path
is: llvm-project/build/tools/clang/test/Analysis/Output/dump_egraph.cpp.tmp.dot

Thanks,
Csaba.

On Thu, May 30, 2019 at 4:00 PM Russell Gallop 
wrote:

> Hi Csaba,
>
> The test dump_egraph.cpp appears to be flaky on Windows. For example here:
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/26183
> .
>
> C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\Analysis\dump_egraph.cpp:23:11:
> error: CHECK: expected string not found in input
> // CHECK: \"store\": [\l  \{
> \"cluster\": \"t\", \"items\":
> [\l\{ \"kind\":
> \"Default\", \"offset\": 0, \"value\": \"conj_$3\{int, LC3, no stmt, #1\}\"
>
> Running locally, it fails after 2-5 runs for me, running:
> python bin/llvm-lit.py -v ../clang/test/Analysis/dump_egraph.cpp
>
> Please could you take a look?
>
> Note that I'm not certain it was this commit that started the flakiness,
> it is the latest which changed the failing line.
>
> Thanks
> Russ
>
> On Wed, 29 May 2019 at 19:02, Csaba Dabis via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: charusso
>> Date: Wed May 29 11:05:53 2019
>> New Revision: 361997
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=361997&view=rev
>> Log:
>> [analyzer] print() JSONify: getNodeLabel implementation
>>
>> Summary: This patch also rewrites the ProgramPoint printing.
>>
>> Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus
>>
>> Reviewed By: NoQ
>>
>> Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin, mikhail.ramalho,
>>  donat.nagy, dkrupp
>>
>> Tags: #clang
>>
>> Differential Revision: https://reviews.llvm.org/D62346
>>
>> Modified:
>> cfe/trunk/include/clang/Analysis/ProgramPoint.h
>> cfe/trunk/lib/Analysis/ProgramPoint.cpp
>> cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
>> cfe/trunk/test/Analysis/dump_egraph.c
>> cfe/trunk/test/Analysis/dump_egraph.cpp
>>
>> Modified: cfe/trunk/include/clang/Analysis/ProgramPoint.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/ProgramPoint.h?rev=361997&r1=361996&r2=361997&view=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Analysis/ProgramPoint.h (original)
>> +++ cfe/trunk/include/clang/Analysis/ProgramPoint.h Wed May 29 11:05:53
>> 2019
>> @@ -213,7 +213,7 @@ public:
>>  ID.AddPointer(getTag());
>>}
>>
>> -  void print(StringRef CR, llvm::raw_ostream &Out) const;
>> +  void printJson(llvm::raw_ostream &Out, const char *NL = "\n") const;
>>
>>LLVM_DUMP_METHOD void dump() const;
>>
>>
>> Modified: cfe/trunk/lib/Analysis/ProgramPoint.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ProgramPoint.cpp?rev=361997&r1=361996&r2=361997&view=diff
>>
>> ==
>> --- cfe/trunk/lib/Analysis/ProgramPoint.cpp (original)
>> +++ cfe/trunk/lib/Analysis/ProgramPoint.cpp Wed May 29 11:05:53 2019
>> @@ -43,151 +43,152 @@ ProgramPoint ProgramPoint::getProgramPoi
>>  }
>>
>>  LLVM_DUMP_METHOD void ProgramPoint::dump() const {
>> -  return print(/*CR=*/"\n", llvm::errs());
>> +  return printJson(llvm::errs());
>>  }
>>
>> -static void printLocation(raw_ostream &Out, SourceLocation SLoc,
>> -  const SourceManager &SM,
>> -  StringRef CR,
>> -  StringRef Postfix) {
>> -  if (SLoc.isFileID()) {
>> -Out << CR << "line=" << SM.getExpansionLineNumber(SLoc)
>> -<< " col=" << SM.getExpansionColumnNumber(SLoc) << Postfix;
>> +static void printLocation(raw_ostream &Out, SourceLocation Loc,
>> +  const SourceManager &SM) {
>> +  Out << "\"location\": ";
>> +  if (!Loc.isFileID()) {
>> +Out << "null";
>> +return;
>>}
>> +
>> +  Out << "{ \"line\": " << SM.getExpansionLineNumber(Loc)
>> +  << ", \"column\": " << SM.getExpansionColumnNumber(Loc) << " }";
>>  }
>>
>> -void ProgramPoint::print(StringRef CR, llvm::raw_ostream &Out) const {
>> +void ProgramPoint::printJson(llvm::raw_ostream &Out, const char *NL)
>> const {
>>const ASTContext &Context =
>>getLocationContext()->getAnalysisDeclContext()->getASTContext();
>>const SourceManager &SM = Context.getSourceManager();
>> +
>> +  Out << "\"kind\": \"";
>>switch (getKind()) {
>>case ProgramPoint::BlockEntranceKind:
>> -Out << "Block Entrance: B"
>> +Out << "BlockEntrance\""
>> +<< ", \"block_id\": "
>>  << castAs().getBlock()->getBlockID();
>>  break;
>>
>>case ProgramPoint::FunctionExitKind: {
>>  auto FEP = getAs();
>> -Out << "Function Exit: B" << FEP->getBlock()->getBlockID();
>> +Out << "FunctionExit\""
>> +<< ", \"block_id\": " << FEP->getBlock()->getBlockID()
>> +<< ", \"stmt_id\": ";
>> +
>>  if (const Ret

[PATCH] D43576: Solution to fix PR27066 - Redefinition with same mangled name as another definition (dllexport and uuid)

2019-05-30 Thread Zahira Ammarguellat via Phabricator via cfe-commits
zahiraam added a comment.

A review please :-) Thanks.


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

https://reviews.llvm.org/D43576



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


[PATCH] D62035: [AST] const-ify ObjC inherited class search

2019-05-30 Thread James Y Knight via Phabricator via cfe-commits
jyknight added a comment.

I don't really have much to say about this, and the patch is probably fine, but 
I do note that most of the other accessors on this class also return mutable 
objects.


Repository:
  rC Clang

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

https://reviews.llvm.org/D62035



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


Re: r361997 - [analyzer] print() JSONify: getNodeLabel implementation

2019-05-30 Thread Russell Gallop via cfe-commits
Hi Csaba,

Failing example attached. Note that the output is different every time so
there is potentially more than one failure mode.

Thanks
Russ

On Thu, 30 May 2019 at 15:05, Csaba Dabis  wrote:

> Hey!
>
> When it fails, could you provide the DOT dump? The path
> is: 
> llvm-project/build/tools/clang/test/Analysis/Output/dump_egraph.cpp.tmp.dot
>
> Thanks,
> Csaba.
>
> On Thu, May 30, 2019 at 4:00 PM Russell Gallop 
> wrote:
>
>> Hi Csaba,
>>
>> The test dump_egraph.cpp appears to be flaky on Windows. For example
>> here:
>> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/26183
>> .
>>
>> C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\Analysis\dump_egraph.cpp:23:11:
>> error: CHECK: expected string not found in input
>> // CHECK: \"store\": [\l  \{
>> \"cluster\": \"t\", \"items\":
>> [\l\{ \"kind\":
>> \"Default\", \"offset\": 0, \"value\": \"conj_$3\{int, LC3, no stmt, #1\}\"
>>
>> Running locally, it fails after 2-5 runs for me, running:
>> python bin/llvm-lit.py -v ../clang/test/Analysis/dump_egraph.cpp
>>
>> Please could you take a look?
>>
>> Note that I'm not certain it was this commit that started the flakiness,
>> it is the latest which changed the failing line.
>>
>> Thanks
>> Russ
>>
>> On Wed, 29 May 2019 at 19:02, Csaba Dabis via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: charusso
>>> Date: Wed May 29 11:05:53 2019
>>> New Revision: 361997
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=361997&view=rev
>>> Log:
>>> [analyzer] print() JSONify: getNodeLabel implementation
>>>
>>> Summary: This patch also rewrites the ProgramPoint printing.
>>>
>>> Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus
>>>
>>> Reviewed By: NoQ
>>>
>>> Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin, mikhail.ramalho,
>>>  donat.nagy, dkrupp
>>>
>>> Tags: #clang
>>>
>>> Differential Revision: https://reviews.llvm.org/D62346
>>>
>>> Modified:
>>> cfe/trunk/include/clang/Analysis/ProgramPoint.h
>>> cfe/trunk/lib/Analysis/ProgramPoint.cpp
>>> cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
>>> cfe/trunk/test/Analysis/dump_egraph.c
>>> cfe/trunk/test/Analysis/dump_egraph.cpp
>>>
>>> Modified: cfe/trunk/include/clang/Analysis/ProgramPoint.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/ProgramPoint.h?rev=361997&r1=361996&r2=361997&view=diff
>>>
>>> ==
>>> --- cfe/trunk/include/clang/Analysis/ProgramPoint.h (original)
>>> +++ cfe/trunk/include/clang/Analysis/ProgramPoint.h Wed May 29 11:05:53
>>> 2019
>>> @@ -213,7 +213,7 @@ public:
>>>  ID.AddPointer(getTag());
>>>}
>>>
>>> -  void print(StringRef CR, llvm::raw_ostream &Out) const;
>>> +  void printJson(llvm::raw_ostream &Out, const char *NL = "\n") const;
>>>
>>>LLVM_DUMP_METHOD void dump() const;
>>>
>>>
>>> Modified: cfe/trunk/lib/Analysis/ProgramPoint.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ProgramPoint.cpp?rev=361997&r1=361996&r2=361997&view=diff
>>>
>>> ==
>>> --- cfe/trunk/lib/Analysis/ProgramPoint.cpp (original)
>>> +++ cfe/trunk/lib/Analysis/ProgramPoint.cpp Wed May 29 11:05:53 2019
>>> @@ -43,151 +43,152 @@ ProgramPoint ProgramPoint::getProgramPoi
>>>  }
>>>
>>>  LLVM_DUMP_METHOD void ProgramPoint::dump() const {
>>> -  return print(/*CR=*/"\n", llvm::errs());
>>> +  return printJson(llvm::errs());
>>>  }
>>>
>>> -static void printLocation(raw_ostream &Out, SourceLocation SLoc,
>>> -  const SourceManager &SM,
>>> -  StringRef CR,
>>> -  StringRef Postfix) {
>>> -  if (SLoc.isFileID()) {
>>> -Out << CR << "line=" << SM.getExpansionLineNumber(SLoc)
>>> -<< " col=" << SM.getExpansionColumnNumber(SLoc) << Postfix;
>>> +static void printLocation(raw_ostream &Out, SourceLocation Loc,
>>> +  const SourceManager &SM) {
>>> +  Out << "\"location\": ";
>>> +  if (!Loc.isFileID()) {
>>> +Out << "null";
>>> +return;
>>>}
>>> +
>>> +  Out << "{ \"line\": " << SM.getExpansionLineNumber(Loc)
>>> +  << ", \"column\": " << SM.getExpansionColumnNumber(Loc) << " }";
>>>  }
>>>
>>> -void ProgramPoint::print(StringRef CR, llvm::raw_ostream &Out) const {
>>> +void ProgramPoint::printJson(llvm::raw_ostream &Out, const char *NL)
>>> const {
>>>const ASTContext &Context =
>>>getLocationContext()->getAnalysisDeclContext()->getASTContext();
>>>const SourceManager &SM = Context.getSourceManager();
>>> +
>>> +  Out << "\"kind\": \"";
>>>switch (getKind()) {
>>>case ProgramPoint::BlockEntranceKind:
>>> -Out << "Block Entrance: B"
>>> +Out << "BlockEntrance\""
>>> +<< ", \"block_id\": "
>>>  << castAs().

r362096 - [ARM] Add CLI support for Armv8.1-M and MVE

2019-05-30 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Thu May 30 07:22:26 2019
New Revision: 362096

URL: http://llvm.org/viewvc/llvm-project?rev=362096&view=rev
Log:
[ARM] Add CLI support for Armv8.1-M and MVE

Given the existing infrastructure in LLVM side for +fp and +fp.dp,
this is more or less trivial, needing only one tiny source change and
a couple of tests.

Patch by Simon Tatham.

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

Added:
cfe/trunk/test/Driver/armv8.1m.main.c
cfe/trunk/test/Driver/armv8.1m.main.s
Modified:
cfe/trunk/lib/Basic/Targets/ARM.cpp

Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=362096&r1=362095&r2=362096&view=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp Thu May 30 07:22:26 2019
@@ -197,6 +197,8 @@ StringRef ARMTargetInfo::getCPUAttr() co
 return "8M_MAIN";
   case llvm::ARM::ArchKind::ARMV8R:
 return "8R";
+  case llvm::ARM::ArchKind::ARMV8_1MMainline:
+return "8_1M_MAIN";
   }
 }
 

Added: cfe/trunk/test/Driver/armv8.1m.main.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/armv8.1m.main.c?rev=362096&view=auto
==
--- cfe/trunk/test/Driver/armv8.1m.main.c (added)
+++ cfe/trunk/test/Driver/armv8.1m.main.c Thu May 30 07:22:26 2019
@@ -0,0 +1,34 @@
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+dsp  -### %s 2> 
%t
+// RUN: FileCheck --check-prefix=CHECK-DSP < %t %s
+// CHECK-DSP: "-target-feature" "+dsp"
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+fp  -### %s 2> 
%t
+// RUN: FileCheck --check-prefix=CHECK-FP < %t %s
+// CHECK-FP: "-target-feature" "+fp-armv8"
+// CHECK-FP-NOT: "-target-feature" "+fp64"
+// CHECK-FP-NOT: "-target-feature" "+d32"
+// CHECK-FP: "-target-feature" "+fullfp16"
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+fp.dp  -### %s 
2> %t
+// RUN: FileCheck --check-prefix=CHECK-FPDP < %t %s
+// CHECK-FPDP: "-target-feature" "+fp-armv8"
+// CHECK-FPDP: "-target-feature" "+fullfp16"
+// CHECK-FPDP: "-target-feature" "+fp64"
+// CHECK-FPDP-NOT: "-target-feature" "+d32"
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve  -### %s 2> 
%t
+// RUN: FileCheck --check-prefix=CHECK-MVE < %t %s
+// CHECK-MVE: "-target-feature" "+mve"
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp  -### %s 
2> %t
+// RUN: FileCheck --check-prefix=CHECK-MVEFP < %t %s
+// CHECK-MVEFP: "-target-feature" "+mve.fp"
+// CHECK-MVEFP-NOT: "-target-feature" "+fp64"
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp+fp.dp  
-### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-MVEFP_DP < %t %s
+// CHECK-MVEFP_DP: "-target-feature" "+mve.fp"
+// CHECK-MVEFP_DP: "-target-feature" "+fp64"
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1m.main+fp -S %s
+double foo (double a) { return a; }

Added: cfe/trunk/test/Driver/armv8.1m.main.s
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/armv8.1m.main.s?rev=362096&view=auto
==
--- cfe/trunk/test/Driver/armv8.1m.main.s (added)
+++ cfe/trunk/test/Driver/armv8.1m.main.s Thu May 30 07:22:26 2019
@@ -0,0 +1,65 @@
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8-m.main %s 2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V8M < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main %s 2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+dsp %s 
2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M_DSP < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+fp %s 
2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M_FP < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+fp.dp %s 
2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M_FPDP < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve %s 
2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M_MVE < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve+fp 
%s 2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M_MVE_FP < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve.fp 
%s 2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M_MVEFP < %t %s
+# RUN: %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve.fp+fp.dp 
%s
+
+.syntax unified
+.thumb
+.text
+
+csinc r0, r1, r2, eq
+# ERROR-V8M: :[[@LINE-1]]:1: error
+
+qadd r0, r1, r2
+# ERROR-V8M: :[[@LINE-1]]:1: error
+# ERROR-V81M: :[[@LINE-2]]:1: error
+# ERROR-V81M_FP: :[[@LINE-3]]:1: error
+# ERROR-V81M_FPDP: :[[@LINE-4]]:1: error
+
+vadd.f16 s0, s1, s2
+# ERROR-V8M: :[[@LINE-1]]:

[PATCH] D60699: [ARM] add CLI support for 8.1-M and MVE.

2019-05-30 Thread Sjoerd Meijer via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362096: [ARM] Add CLI support for Armv8.1-M and MVE 
(authored by SjoerdMeijer, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D60699?vs=195157&id=202185#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D60699

Files:
  cfe/trunk/lib/Basic/Targets/ARM.cpp
  cfe/trunk/test/Driver/armv8.1m.main.c
  cfe/trunk/test/Driver/armv8.1m.main.s

Index: cfe/trunk/lib/Basic/Targets/ARM.cpp
===
--- cfe/trunk/lib/Basic/Targets/ARM.cpp
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp
@@ -197,6 +197,8 @@
 return "8M_MAIN";
   case llvm::ARM::ArchKind::ARMV8R:
 return "8R";
+  case llvm::ARM::ArchKind::ARMV8_1MMainline:
+return "8_1M_MAIN";
   }
 }
 
Index: cfe/trunk/test/Driver/armv8.1m.main.s
===
--- cfe/trunk/test/Driver/armv8.1m.main.s
+++ cfe/trunk/test/Driver/armv8.1m.main.s
@@ -0,0 +1,65 @@
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8-m.main %s 2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V8M < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main %s 2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+dsp %s 2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M_DSP < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+fp %s 2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M_FP < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+fp.dp %s 2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M_FPDP < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve %s 2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M_MVE < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve+fp %s 2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M_MVE_FP < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve.fp %s 2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M_MVEFP < %t %s
+# RUN: %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve.fp+fp.dp %s
+
+.syntax unified
+.thumb
+.text
+
+csinc r0, r1, r2, eq
+# ERROR-V8M: :[[@LINE-1]]:1: error
+
+qadd r0, r1, r2
+# ERROR-V8M: :[[@LINE-1]]:1: error
+# ERROR-V81M: :[[@LINE-2]]:1: error
+# ERROR-V81M_FP: :[[@LINE-3]]:1: error
+# ERROR-V81M_FPDP: :[[@LINE-4]]:1: error
+
+vadd.f16 s0, s1, s2
+# ERROR-V8M: :[[@LINE-1]]:1: error
+# ERROR-V81M: :[[@LINE-2]]:1: error
+# ERROR-V81M_DSP: :[[@LINE-3]]:1: error
+# ERROR-V81M_MVE: :[[@LINE-4]]:1: error
+
+vabs.f32 s0, s1
+# ERROR-V8M: :[[@LINE-1]]:1: error
+# ERROR-V81M: :[[@LINE-2]]:1: error
+# ERROR-V81M_DSP: :[[@LINE-3]]:1: error
+# ERROR-V81M_MVE: :[[@LINE-4]]:1: error
+
+vcmp.f64 d0,d1
+# ERROR-V8M: :[[@LINE-1]]:1: error
+# ERROR-V81M: :[[@LINE-2]]:1: error
+# ERROR-V81M_DSP: :[[@LINE-3]]:1: error
+# ERROR-V81M_FP: :[[@LINE-4]]:1: error
+# ERROR-V81M_MVE: :[[@LINE-5]]:1: error
+# ERROR-V81M_MVE_FP: :[[@LINE-6]]:1: error
+# ERROR-V81M_MVEFP: :[[@LINE-7]]:1: error
+
+asrl r0, r1, r2
+# ERROR-V8M: :[[@LINE-1]]:1: error
+# ERROR-V81M: :[[@LINE-2]]:1: error
+# ERROR-V81M_DSP: :[[@LINE-3]]:1: error
+# ERROR-V81M_FP: :[[@LINE-4]]:1: error
+# ERROR-V81M_FPDP: :[[@LINE-5]]:1: error
+
+vcadd.i8 q0, q1, q2, #90
+# ERROR-V8M: :[[@LINE-1]]:1: error
+# ERROR-V81M: :[[@LINE-2]]:1: error
+# ERROR-V81M_DSP: :[[@LINE-3]]:1: error
+# ERROR-V81M_FP: :[[@LINE-4]]:1: error
+# ERROR-V81M_FPDP: :[[@LINE-5]]:1: error
Index: cfe/trunk/test/Driver/armv8.1m.main.c
===
--- cfe/trunk/test/Driver/armv8.1m.main.c
+++ cfe/trunk/test/Driver/armv8.1m.main.c
@@ -0,0 +1,34 @@
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+dsp  -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-DSP < %t %s
+// CHECK-DSP: "-target-feature" "+dsp"
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+fp  -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FP < %t %s
+// CHECK-FP: "-target-feature" "+fp-armv8"
+// CHECK-FP-NOT: "-target-feature" "+fp64"
+// CHECK-FP-NOT: "-target-feature" "+d32"
+// CHECK-FP: "-target-feature" "+fullfp16"
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+fp.dp  -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FPDP < %t %s
+// CHECK-FPDP: "-target-feature" "+fp-armv8"
+// CHECK-FPDP: "-target-feature" "+fullfp16"
+// CHECK-FPDP: "-target-feature" "+fp64"
+// CHECK-FPDP-NOT: "-target-feature" "+d32"
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve  -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-MVE < %t %s
+// CHECK-MVE: "-target-feature" "+mve"
+
+// RUN: %clang -target arm-arm-n

[PATCH] D62665: Fix constexpr __builtin_*_overflow issue when unsigned->signed operand.

2019-05-30 Thread Erich Keane via Phabricator via cfe-commits
erichkeane created this revision.
erichkeane added reviewers: eli.friedman, efriedma, craig.topper.

As reported here https://bugs.llvm.org/show_bug.cgi?id=42000, it was
possible to get the constexpr version of __builtin_*_overflow to give
the wrong answer.

This was because when extending the operands to fit the largest type (so
that the math could be done), the decision on whether to sign/zero
extend the operands was based on the result signedness, not on the
operands signedness.

In the reported case, (unsigned char)255 - (int)100 needed
to have each extended to the int in order to do the math.  However, when
extending the first operand to 'int', we incorrectly sign extended it
instead of zero extending.  Thus, the result didnt fit back into the
unsigned char.

The fix for this was simply to choose zero/sign extension based on the
sign of the operand itself.


https://reviews.llvm.org/D62665

Files:
  clang/lib/AST/ExprConstant.cpp
  clang/test/SemaCXX/builtins-overflow.cpp


Index: clang/test/SemaCXX/builtins-overflow.cpp
===
--- clang/test/SemaCXX/builtins-overflow.cpp
+++ clang/test/SemaCXX/builtins-overflow.cpp
@@ -2,6 +2,7 @@
 // expected-no-diagnostics
 
 #include 
+#include 
 
 int a() {
   const int x = 3;
@@ -50,6 +51,7 @@
 static_assert(sub(static_cast(0),static_cast(1)) == 
Result{true, UCHAR_MAX});
 static_assert(sub(static_cast(0),static_cast(1)) == Result{false, -1});
 static_assert(sub(static_cast(0),static_cast(1)) 
== Result{true, USHRT_MAX});
+static_assert(sub(static_cast(255),static_cast(100)) == 
Result{false, 155});
 
 static_assert(sub(17,22) == Result{false, -5});
 static_assert(sub(INT_MAX - 22, -23) == Result{true, INT_MIN});
@@ -91,3 +93,4 @@
 static_assert(smul(17,22) == Result{false, 374});
 static_assert(smul(INT_MAX / 22, 23) == Result{true, -2049870757});
 static_assert(smul(INT_MIN / 22, -23) == Result{true, -2049870757});
+
Index: clang/lib/AST/ExprConstant.cpp
===
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -9453,9 +9453,11 @@
   if (IsSigned && !AllSigned)
 ++MaxBits;
 
-  LHS = APSInt(IsSigned ? LHS.sextOrSelf(MaxBits) : 
LHS.zextOrSelf(MaxBits),
+  LHS = APSInt(LHS.isSigned() ? LHS.sextOrSelf(MaxBits)
+  : LHS.zextOrSelf(MaxBits),
!IsSigned);
-  RHS = APSInt(IsSigned ? RHS.sextOrSelf(MaxBits) : 
RHS.zextOrSelf(MaxBits),
+  RHS = APSInt(RHS.isSigned() ? RHS.sextOrSelf(MaxBits)
+  : RHS.zextOrSelf(MaxBits),
!IsSigned);
   Result = APSInt(MaxBits, !IsSigned);
 }


Index: clang/test/SemaCXX/builtins-overflow.cpp
===
--- clang/test/SemaCXX/builtins-overflow.cpp
+++ clang/test/SemaCXX/builtins-overflow.cpp
@@ -2,6 +2,7 @@
 // expected-no-diagnostics
 
 #include 
+#include 
 
 int a() {
   const int x = 3;
@@ -50,6 +51,7 @@
 static_assert(sub(static_cast(0),static_cast(1)) == Result{true, UCHAR_MAX});
 static_assert(sub(static_cast(0),static_cast(1)) == Result{false, -1});
 static_assert(sub(static_cast(0),static_cast(1)) == Result{true, USHRT_MAX});
+static_assert(sub(static_cast(255),static_cast(100)) == Result{false, 155});
 
 static_assert(sub(17,22) == Result{false, -5});
 static_assert(sub(INT_MAX - 22, -23) == Result{true, INT_MIN});
@@ -91,3 +93,4 @@
 static_assert(smul(17,22) == Result{false, 374});
 static_assert(smul(INT_MAX / 22, 23) == Result{true, -2049870757});
 static_assert(smul(INT_MIN / 22, -23) == Result{true, -2049870757});
+
Index: clang/lib/AST/ExprConstant.cpp
===
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -9453,9 +9453,11 @@
   if (IsSigned && !AllSigned)
 ++MaxBits;
 
-  LHS = APSInt(IsSigned ? LHS.sextOrSelf(MaxBits) : LHS.zextOrSelf(MaxBits),
+  LHS = APSInt(LHS.isSigned() ? LHS.sextOrSelf(MaxBits)
+  : LHS.zextOrSelf(MaxBits),
!IsSigned);
-  RHS = APSInt(IsSigned ? RHS.sextOrSelf(MaxBits) : RHS.zextOrSelf(MaxBits),
+  RHS = APSInt(RHS.isSigned() ? RHS.sextOrSelf(MaxBits)
+  : RHS.zextOrSelf(MaxBits),
!IsSigned);
   Result = APSInt(MaxBits, !IsSigned);
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50256: [Analyzer] [WIP] Basic support for multiplication and division in the constraint manager (for == and != only)

2019-05-30 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 202191.
baloghadamsoftware added a comment.
Herald added a subscriber: Charusso.

Multipliers limited to less or equal to 255.


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

https://reviews.llvm.org/D50256

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h
  lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
  lib/StaticAnalyzer/Core/RangedConstraintManager.cpp
  test/Analysis/multiplicative-folding.c

Index: test/Analysis/multiplicative-folding.c
===
--- /dev/null
+++ test/Analysis/multiplicative-folding.c
@@ -0,0 +1,686 @@
+// RUN: %clang_analyze_cc1 --std=c11 -analyzer-checker=core,debug.ExprInspection -verify %s
+
+void clang_analyzer_eval(int);
+void clang_analyzer_warnIfReached(void);
+
+#define UINT_MAX (~0U)
+#define INT_MAX (int)(UINT_MAX & (UINT_MAX >> 1))
+#define INT_MIN (-INT_MAX - 1)
+
+#define ULONG_LONG_MAX (~0UL)
+#define LONG_LONG_MAX (long long)(ULONG_LONG_MAX & (ULONG_LONG_MAX >> 1))
+#define LONG_LONG_MIN (-LONG_LONG_MAX - 1)
+
+extern void __assert_fail (__const char *__assertion, __const char *__file,
+unsigned int __line, __const char *__function)
+ __attribute__ ((__noreturn__));
+#define assert(expr) \
+  ((expr)  ? (void)(0)  : __assert_fail (#expr, __FILE__, __LINE__, __func__))
+
+typedef int int32_t;
+typedef unsigned int uint32_t;
+typedef long long int64_t;
+typedef unsigned long long uint64_t;
+
+void signed_multiplication_eq(int32_t n) {
+  if (n * 2 == 3) {
+clang_analyzer_warnIfReached(); // no-warning
+
+  } else if (n * 2 == 4) {
+const int32_t C1 = 0x8002, C2 = 2;
+
+assert(C1 * 2 == 4);
+assert(C2 * 2 == 4);
+
+clang_analyzer_eval(n == INT_MIN); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == C1 - 1); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == C1); //expected-warning{{FALSE}}
+  //expected-warning@-1{{TRUE}}
+clang_analyzer_eval(n == C1 + 1); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == 0); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == C2 - 1); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == C2); //expected-warning{{FALSE}}
+  //expected-warning@-1{{TRUE}}
+clang_analyzer_eval(n == C2 + 1); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == INT_MAX); //expected-warning{{FALSE}}
+
+  } else if (n * 3 == 4) {
+const int32_t C1 = 0xaaac;
+
+assert(C1 * 3 == 4);
+
+clang_analyzer_eval(n == INT_MIN); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == C1 - 1); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == C1); //expected-warning{{TRUE}}
+clang_analyzer_eval(n == C1 + 1); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == 0); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == INT_MAX); //expected-warning{{FALSE}}
+
+  } else if (n * 4 == -5) {
+clang_analyzer_warnIfReached(); // no-warning
+
+  } else if (n * 4 == -8) {
+const int32_t C1 = 0xbffe, C2 = 0xfffe,
+  C3 = 0x3ffe, C4 = 0x7ffe;
+
+assert(C1 * 4 == -8);
+assert(C2 * 4 == -8);
+assert(C3 * 4 == -8);
+assert(C4 * 4 == -8);
+
+clang_analyzer_eval(n == INT_MIN); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == C1 - 1); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == C1); //expected-warning{{FALSE}}
+  //expected-warning@-1{{TRUE}}
+clang_analyzer_eval(n == C1 + 1); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == C2 - 1); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == C2); //expected-warning{{FALSE}}
+  //expected-warning@-1{{TRUE}}
+clang_analyzer_eval(n == C2 + 1); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == 0); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == C3 - 1); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == C3); //expected-warning{{FALSE}}
+  //expected-warning@-1{{TRUE}}
+clang_analyzer_eval(n == C3 + 1); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == C4 - 1); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == C4); //expected-warning{{FALSE}}
+  //expected-warning@-1{{TRUE}}
+clang_analyzer_eval(n == C4 + 1); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == INT_MAX); //expected-warning{{FALSE}}
+
+  } else if (n * 6 == -7) {
+clang_analyzer_warnIfReached(); // no-warning
+
+  } else if (n * 6 == -2) {
+const int32_t C1 = 0xd555, C2 = 0x;
+
+assert(C1 * 6 == -2);
+assert(C2 * 6 == -2);
+
+clang_analyzer_eval(n == INT_MIN); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == C1 - 1); //expected-warning{{FALSE}}
+clang_analyzer_eval(n == C1); //expected-warning{{FALSE}}
+

r362098 - [analyzer] print() JSONify chain: Fix build-bot breaks

2019-05-30 Thread Csaba Dabis via cfe-commits
Author: charusso
Date: Thu May 30 07:48:43 2019
New Revision: 362098

URL: http://llvm.org/viewvc/llvm-project?rev=362098&view=rev
Log:
[analyzer] print() JSONify chain: Fix build-bot breaks

Summary:
Printing out a map structure different in different environments so that
this patch generalize the test-case to check for the 'no stmt'-case
anywhere in the Store.

Modified:
cfe/trunk/test/Analysis/dump_egraph.cpp

Modified: cfe/trunk/test/Analysis/dump_egraph.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/dump_egraph.cpp?rev=362098&r1=362097&r2=362098&view=diff
==
--- cfe/trunk/test/Analysis/dump_egraph.cpp (original)
+++ cfe/trunk/test/Analysis/dump_egraph.cpp Thu May 30 07:48:43 2019
@@ -20,5 +20,5 @@ void foo() {
 
 // CHECK: \"constructing_objects\": [\l  \{ 
\"location_context\": \"#0 Call\", \"calling\": \"T::T\", \"call_line\": 
\"16\", \"items\": [\l\{ 
\"lctx_id\": 2, \"init_id\": {{[0-9]+}}, \"kind\": \"construct into member 
variable\", \"argument_index\": null, \"pretty\": \"s\", \"value\": \"&t-\>s\"
 
-// CHECK: \"store\": [\l  \{ \"cluster\": 
\"t\", \"items\": [\l\{ 
\"kind\": \"Default\", \"offset\": 0, \"value\": \"conj_$3\{int, LC3, no stmt, 
#1\}\"
+// CHECK: \"cluster\": \"t\", \"items\": 
[\l\{ \"kind\": \"Default\", 
\"offset\": 0, \"value\": \"conj_$3\{int, LC3, no stmt, #1\}\"
 


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


[PATCH] D49074: [Analyzer] [WIP] Basic support for multiplication and division in the constraint manager

2019-05-30 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 202192.
baloghadamsoftware removed a reviewer: george.karpenkov.
baloghadamsoftware added a comment.
Herald added a subscriber: Charusso.

Rebased.


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

https://reviews.llvm.org/D49074

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h
  lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
  lib/StaticAnalyzer/Core/RangedConstraintManager.cpp
  test/Analysis/multiplicative-folding.c

Index: test/Analysis/multiplicative-folding.c
===
--- test/Analysis/multiplicative-folding.c
+++ test/Analysis/multiplicative-folding.c
@@ -570,6 +570,1478 @@
   }
 }
 
+void signed_multiplication_lt_0(int32_t n) {
+  if (n * 2 < 3) {
+int32_t  U1 = 0x8001,
+L2 = 0xc000, U2 = 1,
+L3 = 0x4000;
+
+assert(INT_MIN * 2 < 3);
+assert(U1 * 2 < 3);
+assert((U1 + 1) * 2 >= 3);
+assert(L2 * 2 < 3);
+assert((L2 - 1) * 2 >= 3);
+assert(U2 * 2 < 3);
+assert((U2 + 1) * 2 >= 3);
+assert(L3 * 2 < 3);
+assert((L3 - 1) * 2 >= 3);
+assert(INT_MAX * 2 < 3);
+
+if (n < INT_MIN / 2) {
+  clang_analyzer_eval(n == INT_MIN); //expected-warning{{FALSE}}
+ //expected-warning@-1{{TRUE}}
+  clang_analyzer_eval(n <= U1); //expected-warning{{TRUE}}
+  clang_analyzer_eval(n > U1); //expected-warning{{FALSE}}
+} else if (n < INT_MAX / 2){
+  clang_analyzer_eval(n < L2); //expected-warning{{FALSE}}
+  clang_analyzer_eval(n >= L2); //expected-warning{{TRUE}}
+  clang_analyzer_eval(n <= U2); //expected-warning{{TRUE}}
+  clang_analyzer_eval(n > U2); //expected-warning{{FALSE}}
+} else {
+  clang_analyzer_eval(n < L3); //expected-warning{{FALSE}}
+  clang_analyzer_eval(n >= L3); //expected-warning{{TRUE}}
+  clang_analyzer_eval(n == INT_MAX); //expected-warning{{FALSE}}
+ //expected-warning@-1{{TRUE}}
+}
+  }
+}
+
+void signed_multiplication_lt_1(int32_t n) {
+  if (n * 2 < 4) {
+int32_t  U1 = 0x8001,
+L2 = 0xc000, U2 = 1,
+L3 = 0x4000;
+
+assert(INT_MIN * 2 < 4);
+assert(U1 * 2 < 4);
+assert((U1 + 1) * 2 >= 4);
+assert(L2 * 2 < 4);
+assert((L2 - 1) * 2 >= 4);
+assert(U2 * 2 < 4);
+assert((U2 + 1) * 2 >= 4);
+assert(L3 * 2 < 4);
+assert((L3 - 1) * 2 >= 4);
+assert(INT_MAX * 2 < 4);
+
+if (n < INT_MIN / 2) {
+  clang_analyzer_eval(n == INT_MIN); //expected-warning{{FALSE}}
+ //expected-warning@-1{{TRUE}}
+  clang_analyzer_eval(n <= U1); //expected-warning{{TRUE}}
+  clang_analyzer_eval(n > U1); //expected-warning{{FALSE}}
+} else if (n < INT_MAX / 2){
+  clang_analyzer_eval(n < L2); //expected-warning{{FALSE}}
+  clang_analyzer_eval(n >= L2); //expected-warning{{TRUE}}
+  clang_analyzer_eval(n <= U2); //expected-warning{{TRUE}}
+  clang_analyzer_eval(n > U2); //expected-warning{{FALSE}}
+} else {
+  clang_analyzer_eval(n < L3); //expected-warning{{FALSE}}
+  clang_analyzer_eval(n >= L3); //expected-warning{{TRUE}}
+  clang_analyzer_eval(n == INT_MAX); //expected-warning{{FALSE}}
+ //expected-warning@-1{{TRUE}}
+}
+  }
+}
+
+void signed_multiplication_lt_2(int32_t n) {
+  if (n * 2 < 5) {
+int32_t  U1 = 0x8002,
+L2 = 0xc000, U2 = 2,
+L3 = 0x4000;
+
+assert(INT_MIN * 2 < 5);
+assert(U1 * 2 < 5);
+assert((U1 + 1) * 2 >= 5);
+assert(L2 * 2 < 5);
+assert((L2 - 1) * 2 >= 5);
+assert(U2 * 2 < 5);
+assert((U2 + 1) * 2 >= 5);
+assert(L3 * 2 < 5);
+assert((L3 - 1) * 2 >= 5);
+assert(INT_MAX * 2 < 5);
+
+if (n < INT_MIN / 2) {
+  clang_analyzer_eval(n == INT_MIN); //expected-warning{{FALSE}}
+ //expected-warning@-1{{TRUE}}
+  clang_analyzer_eval(n <= U1); //expected-warning{{TRUE}}
+  clang_analyzer_eval(n > U1); //expected-warning{{FALSE}}
+} else if (n < INT_MAX / 2){
+  clang_analyzer_eval(n < L2); //expected-warning{{FALSE}}
+  clang_analyzer_eval(n >= L2); //expected-warning{{TRUE}}
+  clang_analyzer_eval(n <= U2); //expected-warning{{TRUE}}
+  clang_analyzer_eval(n > U2); //expected-warning{{FALSE}}
+} else {
+  clang_analyzer_eval(n < L3); //expected-warning{{FALSE}}
+  clang_analyzer_eval(n >= L3); //expected-warning{{TRUE}}
+  clang_analyzer_eval(n == INT_MAX); //expected-warning{{FALSE}}
+ //expected-warning@-1{{TRUE}}
+}
+  }
+}
+
+void signed_multiplication_lt_3(int32_t n) {
+  if (n * 3 < 4) {
+int32_t  U1 = 0xaaab,
+L2 = 0xd556, U2 = 1,

[PATCH] D62156: [Sema][PR41730] Diagnose addr space mismatch while constructing objects

2019-05-30 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia updated this revision to Diff 202193.
Anastasia marked 3 inline comments as done.
Anastasia added a comment.

- Improved diagnostic
- Added more comments


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

https://reviews.llvm.org/D62156

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Overload.h
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaInit.cpp
  lib/Sema/SemaOverload.cpp
  test/CodeGenCXX/address-space-of-this.cpp
  test/CodeGenOpenCLCXX/addrspace-ctor.cl
  test/SemaCXX/address-space-ctor.cpp

Index: test/SemaCXX/address-space-ctor.cpp
===
--- /dev/null
+++ test/SemaCXX/address-space-ctor.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 %s -std=c++14 -triple=spir -verify -fsyntax-only
+// RUN: %clang_cc1 %s -std=c++17 -triple=spir -verify -fsyntax-only
+
+struct MyType {
+  MyType(int i) : i(i) {}
+  int i;
+};
+
+//expected-note@-5{{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const MyType &' for 1st argument}}
+//expected-note@-6{{candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'MyType &&' for 1st argument}}
+//expected-note@-6{{candidate constructor ignored: cannot be used to construct an object in address space '__attribute__((address_space(10)))'}}
+//expected-note@-8{{candidate constructor ignored: cannot be used to construct an object in address space '__attribute__((address_space(10)))'}}
+//expected-note@-9{{candidate constructor ignored: cannot be used to construct an object in address space '__attribute__((address_space(10)))'}}
+//expected-note@-9{{candidate constructor ignored: cannot be used to construct an object in address space '__attribute__((address_space(10)))'}}
+
+// FIXME: We can't implicitly convert between address spaces yet.
+MyType __attribute__((address_space(10))) m1 = 123; //expected-error{{no viable conversion from 'int' to '__attribute__((address_space(10))) MyType'}}
+MyType __attribute__((address_space(10))) m2(123);  //expected-error{{no matching constructor for initialization of '__attribute__((address_space(10))) MyType'}}
Index: test/CodeGenOpenCLCXX/addrspace-ctor.cl
===
--- /dev/null
+++ test/CodeGenOpenCLCXX/addrspace-ctor.cl
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -emit-llvm -O0 -o - | FileCheck %s
+
+struct MyType {
+  MyType(int i) : i(i) {}
+  MyType(int i) __constant : i(i) {}
+  int i;
+};
+
+//CHECK: call void @_ZNU3AS26MyTypeC1Ei(%struct.MyType addrspace(2)* @const1, i32 1)
+__constant MyType const1 = 1;
+//CHECK: call void @_ZNU3AS26MyTypeC1Ei(%struct.MyType addrspace(2)* @const2, i32 2)
+__constant MyType const2(2);
+//CHECK: call void @_ZNU3AS46MyTypeC1Ei(%struct.MyType addrspace(4)* addrspacecast (%struct.MyType addrspace(1)* @glob to %struct.MyType addrspace(4)*), i32 1)
+MyType glob(1);
Index: test/CodeGenCXX/address-space-of-this.cpp
===
--- test/CodeGenCXX/address-space-of-this.cpp
+++ test/CodeGenCXX/address-space-of-this.cpp
@@ -1,8 +1,11 @@
 // RUN: %clang_cc1 %s -std=c++14 -triple=spir -emit-llvm -o - | FileCheck %s
 // RUN: %clang_cc1 %s -std=c++17 -triple=spir -emit-llvm -o - | FileCheck %s
+// XFAIL: *
 
+// FIXME: We can't compile address space method qualifiers yet.
+// Therefore there is no way to check correctness of this code.
 struct MyType {
-  MyType(int i) : i(i) {}
+  MyType(int i) __attribute__((address_space(10))) : i(i) {}
   int i;
 };
 //CHECK: call void @_ZN6MyTypeC1Ei(%struct.MyType* addrspacecast (%struct.MyType addrspace(10)* @m to %struct.MyType*), i32 123)
Index: lib/Sema/SemaOverload.cpp
===
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -6101,6 +6101,15 @@
 return;
   }
 }
+
+// Check that the constructor is capable of constructing an object in the
+// destination address space.
+if (!Qualifiers::isAddressSpaceSupersetOf(
+Constructor->getMethodQualifiers().getAddressSpace(),
+CandidateSet.getDestAS())) {
+  Candidate.Viable = false;
+  Candidate.FailureKind = ovl_fail_object_addrspace_mismatch;
+}
   }
 
   unsigned NumParams = Proto->getNumParams();
@@ -10392,9 +10401,12 @@
 /// It would be great to be able to express per-candidate problems
 /// more richly for those diagnostic clients that cared, but we'd
 /// still have to be just as careful with the default diagnostics.
+/// \param CtorDestAS Addr space of object being constructed (for ctor
+/// candidates only).
 static void NoteFunctionCandidate(Sema &S, OverloadCandidate *Cand,
   unsigned NumArgs,
-  bool TakingCandidateAddress) {
+  bool TakingCa

[PATCH] D62156: [Sema][PR41730] Diagnose addr space mismatch while constructing objects

2019-05-30 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia marked 4 inline comments as done.
Anastasia added inline comments.



Comment at: lib/Sema/SemaDeclCXX.cpp:8229
+  if (FTI.hasMethodTypeCVRUQualifiers()) {
+FTI.MethodQualifiers->forEachCVRUQualifier(
 [&](DeclSpec::TQ TypeQual, StringRef QualName, SourceLocation SL) {

rjmccall wrote:
> Anastasia wrote:
> > rjmccall wrote:
> > > rjmccall wrote:
> > > > We want to catch `_Atomic`, too, so please just change this loop to 
> > > > ignore address-space qualifiers, using a flag to decide whether to call 
> > > > `setInvalidType`.
> > > If there aren't any qualifiers we're skipping, the flag isn't necessary.
> > We are skipping addr space currently. I use this flag to avoid setting 
> > declaration as invalid below if it's only qualified by an addr space.
> Okay.  Does `forEachQualifier` not visit address-space qualifiers?
> 
> Please leave a comment explaining that that's the intended behavior: we 
> should visit everything except an address space.
> Okay. Does forEachQualifier not visit address-space qualifiers?

It calls `forEachCVRUQualifier`, nothing else.

> Please leave a comment explaining that that's the intended behavior: we 
> should visit everything except an address space.

Added in FIXME.




Comment at: lib/Sema/SemaOverload.cpp:6095
+// Check that addr space of an object being constructed is convertible to
+// the one ctor qualified with.
+if (!Qualifiers::isAddressSpaceSupersetOf(

rjmccall wrote:
> "Check that the constructor is capable of constructing an object in the 
> destination address space."
> 
> Should there be an exception here for trivial default/copy/move constructors?
Good point. Current implementation is generating one overload of each 
default/copy/move in generic address space only. But we could potentially look 
at changing this. If we could add extra overloads once we encounter each new 
ctor invocation it would be the easiest approach and this code would still be 
applicable. However, I would need to understand the feasibility in more 
details. May be this is something for the future work? Or do you have other 
suggestions? 



Comment at: test/CodeGenCXX/address-space-of-this.cpp:3
 // RUN: %clang_cc1 %s -std=c++17 -triple=spir -emit-llvm -o - | FileCheck %s
+// XFAIL: *
 

rjmccall wrote:
> Is there nothing in this test that's worth continuing to check while we work 
> on fixing this problem?
We can only compile this file if we had address space qualifiers accepted on 
methods, but it's still WIP (https://reviews.llvm.org/D57464) and I don't have 
the time to fix it now. But at the same time the OpenCL test cover the 
functionality originally intended in this test. Not sure if it's better to 
remove this test completely?



Comment at: test/SemaCXX/address-space-ctor.cpp:11
+//expected-note@-6{{candidate constructor (the implicit move constructor) not 
viable: no known conversion from 'int' to 'MyType &&' for 1st argument}}
+//expected-note@-6{{candidate constructor ignored: cannot be used to construct 
an object in address space '__attribute__((address_space(10)))'}}
+//expected-note@-8{{candidate constructor ignored: cannot be used to construct 
an object in address space '__attribute__((address_space(10)))'}}

Not sure if we should change to:
  cannot be used to construct an object with 
'__attribute__((address_space(10)))'

Although for OpenCL it would be ok as is.

Or may be it's better to add custom printing of addr spaces?


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

https://reviews.llvm.org/D62156



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


Re: r361997 - [analyzer] print() JSONify: getNodeLabel implementation

2019-05-30 Thread Csaba Dabis via cfe-commits
Thanks you!

Fixed by
https://github.com/llvm/llvm-project/commit/17604c3486cbe7c27cadac1757cd0a9109a92792

On Thu, May 30, 2019 at 4:16 PM Russell Gallop 
wrote:

> Hi Csaba,
>
> Failing example attached. Note that the output is different every time so
> there is potentially more than one failure mode.
>
> Thanks
> Russ
>
> On Thu, 30 May 2019 at 15:05, Csaba Dabis  wrote:
>
>> Hey!
>>
>> When it fails, could you provide the DOT dump? The path
>> is: 
>> llvm-project/build/tools/clang/test/Analysis/Output/dump_egraph.cpp.tmp.dot
>>
>> Thanks,
>> Csaba.
>>
>> On Thu, May 30, 2019 at 4:00 PM Russell Gallop 
>> wrote:
>>
>>> Hi Csaba,
>>>
>>> The test dump_egraph.cpp appears to be flaky on Windows. For example
>>> here:
>>> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/26183
>>> .
>>>
>>> C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\Analysis\dump_egraph.cpp:23:11:
>>> error: CHECK: expected string not found in input
>>> // CHECK: \"store\": [\l  \{
>>> \"cluster\": \"t\", \"items\":
>>> [\l\{ \"kind\":
>>> \"Default\", \"offset\": 0, \"value\": \"conj_$3\{int, LC3, no stmt, #1\}\"
>>>
>>> Running locally, it fails after 2-5 runs for me, running:
>>> python bin/llvm-lit.py -v ../clang/test/Analysis/dump_egraph.cpp
>>>
>>> Please could you take a look?
>>>
>>> Note that I'm not certain it was this commit that started the flakiness,
>>> it is the latest which changed the failing line.
>>>
>>> Thanks
>>> Russ
>>>
>>> On Wed, 29 May 2019 at 19:02, Csaba Dabis via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 Author: charusso
 Date: Wed May 29 11:05:53 2019
 New Revision: 361997

 URL: http://llvm.org/viewvc/llvm-project?rev=361997&view=rev
 Log:
 [analyzer] print() JSONify: getNodeLabel implementation

 Summary: This patch also rewrites the ProgramPoint printing.

 Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus

 Reviewed By: NoQ

 Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin, mikhail.ramalho,
  donat.nagy, dkrupp

 Tags: #clang

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

 Modified:
 cfe/trunk/include/clang/Analysis/ProgramPoint.h
 cfe/trunk/lib/Analysis/ProgramPoint.cpp
 cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
 cfe/trunk/test/Analysis/dump_egraph.c
 cfe/trunk/test/Analysis/dump_egraph.cpp

 Modified: cfe/trunk/include/clang/Analysis/ProgramPoint.h
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/ProgramPoint.h?rev=361997&r1=361996&r2=361997&view=diff

 ==
 --- cfe/trunk/include/clang/Analysis/ProgramPoint.h (original)
 +++ cfe/trunk/include/clang/Analysis/ProgramPoint.h Wed May 29 11:05:53
 2019
 @@ -213,7 +213,7 @@ public:
  ID.AddPointer(getTag());
}

 -  void print(StringRef CR, llvm::raw_ostream &Out) const;
 +  void printJson(llvm::raw_ostream &Out, const char *NL = "\n") const;

LLVM_DUMP_METHOD void dump() const;


 Modified: cfe/trunk/lib/Analysis/ProgramPoint.cpp
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ProgramPoint.cpp?rev=361997&r1=361996&r2=361997&view=diff

 ==
 --- cfe/trunk/lib/Analysis/ProgramPoint.cpp (original)
 +++ cfe/trunk/lib/Analysis/ProgramPoint.cpp Wed May 29 11:05:53 2019
 @@ -43,151 +43,152 @@ ProgramPoint ProgramPoint::getProgramPoi
  }

  LLVM_DUMP_METHOD void ProgramPoint::dump() const {
 -  return print(/*CR=*/"\n", llvm::errs());
 +  return printJson(llvm::errs());
  }

 -static void printLocation(raw_ostream &Out, SourceLocation SLoc,
 -  const SourceManager &SM,
 -  StringRef CR,
 -  StringRef Postfix) {
 -  if (SLoc.isFileID()) {
 -Out << CR << "line=" << SM.getExpansionLineNumber(SLoc)
 -<< " col=" << SM.getExpansionColumnNumber(SLoc) << Postfix;
 +static void printLocation(raw_ostream &Out, SourceLocation Loc,
 +  const SourceManager &SM) {
 +  Out << "\"location\": ";
 +  if (!Loc.isFileID()) {
 +Out << "null";
 +return;
}
 +
 +  Out << "{ \"line\": " << SM.getExpansionLineNumber(Loc)
 +  << ", \"column\": " << SM.getExpansionColumnNumber(Loc) << " }";
  }

 -void ProgramPoint::print(StringRef CR, llvm::raw_ostream &Out) const {
 +void ProgramPoint::printJson(llvm::raw_ostream &Out, const char *NL)
 const {
const ASTContext &Context =
getLocationContext()->getAnalysisDeclContext()->getASTContex

Re: r361997 - [analyzer] print() JSONify: getNodeLabel implementation

2019-05-30 Thread Roman Lebedev via cfe-commits
On Thu, May 30, 2019 at 5:48 PM Csaba Dabis via cfe-commits
 wrote:
>
> Thanks you!
>
> Fixed by 
> https://github.com/llvm/llvm-project/commit/17604c3486cbe7c27cadac1757cd0a9109a92792
The non-determinism is still there though, so this isn't correct fix.

> On Thu, May 30, 2019 at 4:16 PM Russell Gallop  
> wrote:
>>
>> Hi Csaba,
>>
>> Failing example attached. Note that the output is different every time so 
>> there is potentially more than one failure mode.
>>
>> Thanks
>> Russ
>>
>> On Thu, 30 May 2019 at 15:05, Csaba Dabis  wrote:
>>>
>>> Hey!
>>>
>>> When it fails, could you provide the DOT dump? The path is: 
>>> llvm-project/build/tools/clang/test/Analysis/Output/dump_egraph.cpp.tmp.dot
>>>
>>> Thanks,
>>> Csaba.
>>>
>>> On Thu, May 30, 2019 at 4:00 PM Russell Gallop  
>>> wrote:

 Hi Csaba,

 The test dump_egraph.cpp appears to be flaky on Windows. For example here: 
 http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/26183.

 C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\Analysis\dump_egraph.cpp:23:11:
  error: CHECK: expected string not found in input
 // CHECK: \"store\": [\l  \{ 
 \"cluster\": \"t\", \"items\": 
 [\l\{ \"kind\": 
 \"Default\", \"offset\": 0, \"value\": \"conj_$3\{int, LC3, no stmt, #1\}\"

 Running locally, it fails after 2-5 runs for me, running:
 python bin/llvm-lit.py -v ../clang/test/Analysis/dump_egraph.cpp

 Please could you take a look?

 Note that I'm not certain it was this commit that started the flakiness, 
 it is the latest which changed the failing line.

 Thanks
 Russ

 On Wed, 29 May 2019 at 19:02, Csaba Dabis via cfe-commits 
  wrote:
>
> Author: charusso
> Date: Wed May 29 11:05:53 2019
> New Revision: 361997
>
> URL: http://llvm.org/viewvc/llvm-project?rev=361997&view=rev
> Log:
> [analyzer] print() JSONify: getNodeLabel implementation
>
> Summary: This patch also rewrites the ProgramPoint printing.
>
> Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus
>
> Reviewed By: NoQ
>
> Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin, mikhail.ramalho,
>  donat.nagy, dkrupp
>
> Tags: #clang
>
> Differential Revision: https://reviews.llvm.org/D62346
>
> Modified:
> cfe/trunk/include/clang/Analysis/ProgramPoint.h
> cfe/trunk/lib/Analysis/ProgramPoint.cpp
> cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
> cfe/trunk/test/Analysis/dump_egraph.c
> cfe/trunk/test/Analysis/dump_egraph.cpp
>
> Modified: cfe/trunk/include/clang/Analysis/ProgramPoint.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/ProgramPoint.h?rev=361997&r1=361996&r2=361997&view=diff
> ==
> --- cfe/trunk/include/clang/Analysis/ProgramPoint.h (original)
> +++ cfe/trunk/include/clang/Analysis/ProgramPoint.h Wed May 29 11:05:53 
> 2019
> @@ -213,7 +213,7 @@ public:
>  ID.AddPointer(getTag());
>}
>
> -  void print(StringRef CR, llvm::raw_ostream &Out) const;
> +  void printJson(llvm::raw_ostream &Out, const char *NL = "\n") const;
>
>LLVM_DUMP_METHOD void dump() const;
>
>
> Modified: cfe/trunk/lib/Analysis/ProgramPoint.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ProgramPoint.cpp?rev=361997&r1=361996&r2=361997&view=diff
> ==
> --- cfe/trunk/lib/Analysis/ProgramPoint.cpp (original)
> +++ cfe/trunk/lib/Analysis/ProgramPoint.cpp Wed May 29 11:05:53 2019
> @@ -43,151 +43,152 @@ ProgramPoint ProgramPoint::getProgramPoi
>  }
>
>  LLVM_DUMP_METHOD void ProgramPoint::dump() const {
> -  return print(/*CR=*/"\n", llvm::errs());
> +  return printJson(llvm::errs());
>  }
>
> -static void printLocation(raw_ostream &Out, SourceLocation SLoc,
> -  const SourceManager &SM,
> -  StringRef CR,
> -  StringRef Postfix) {
> -  if (SLoc.isFileID()) {
> -Out << CR << "line=" << SM.getExpansionLineNumber(SLoc)
> -<< " col=" << SM.getExpansionColumnNumber(SLoc) << Postfix;
> +static void printLocation(raw_ostream &Out, SourceLocation Loc,
> +  const SourceManager &SM) {
> +  Out << "\"location\": ";
> +  if (!Loc.isFileID()) {
> +Out << "null";
> +return;
>}
> +
> +  Out << "{ \"line\": " << SM.getExpansionLineNumber(Loc)
> +  << ", \"column\": " << SM.getExpansionColumnNumber(Loc) << " }";
>  }
>
> -void ProgramPoint::pri

[PATCH] D62525: [Analyzer] Add new visitor to the iterator checkers

2019-05-30 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment.

In D62525#1519868 , @NoQ wrote:

> In D62525#1519475 , 
> @baloghadamsoftware wrote:
>
> > Before someone asks: `NoteTag`s are not applicable here since invalidation 
> > and reaching one end of the range happens in many different places. This is 
> > also true for container emptiness.
>
>
> Mm, what's wrong with many different places? If you're worried about code 
> duplication, just put tag construction into a function (?)


It is not about code duplication. Of course, that can be handled by a function.

The problem is that the transition is added in the top level function but 
iterator position adjustments happen in the lower level ones. Data flow is 
one-way, top-down. For example, an insertion happens into a vector that 
invalidates all the iterators at and after the position where it is inserted. 
In this case `handleInsert()` calls a function that iterates all the active 
iterator positions and calls other one that invalidates the ones affected by 
the insertion. To propagate back the list of iterators invalidated would be too 
complex. Increments and decrements are even worse. Thus here the correct way 
seems to find the relevant transitions in a visitor instead of trying to figure 
out what note tags to add at each transition.


Repository:
  rC Clang

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

https://reviews.llvm.org/D62525



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


[PATCH] D62525: [Analyzer] Add new visitor to the iterator checkers

2019-05-30 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done.
baloghadamsoftware added inline comments.



Comment at: lib/StaticAnalyzer/Checkers/IteratorChecker.cpp:281-282
+
+  // `FoundChange` becomes true when we find the statement the results in the
+  // current state of the iterator.
+  // `FoundEmptyness` becomes true when we find the block edge assuming

NoQ wrote:
> I don't think we should stop here. I think it's worth it to highlight *all* 
> increments and decrements of the interesting iterator, so that it was clear 
> how come that it has the given value.
> 
> Additionally, because iterators are copied around, it makes sense to 
> "recursively" apply the visitor to the original object when the iterator is 
> obtained as a copy (similarly to how `trackExpressionValue` works).
This can be done but an iterator can reach the past-the-end or the first 
position by changing the container's size as well, not only by incrementing or 
decrementing the iterator itself.


Repository:
  rC Clang

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

https://reviews.llvm.org/D62525



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


r362100 - Follow up of r362096

2019-05-30 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Thu May 30 08:04:06 2019
New Revision: 362100

URL: http://llvm.org/viewvc/llvm-project?rev=362100&view=rev
Log:
Follow up of r362096

The new tests were failing, because I missed dependent patch D60697.
I have removed the failing cases for now, which I will restore once
D60697 is in.

Modified:
cfe/trunk/test/Driver/armv8.1m.main.c
cfe/trunk/test/Driver/armv8.1m.main.s

Modified: cfe/trunk/test/Driver/armv8.1m.main.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/armv8.1m.main.c?rev=362100&r1=362099&r2=362100&view=diff
==
--- cfe/trunk/test/Driver/armv8.1m.main.c (original)
+++ cfe/trunk/test/Driver/armv8.1m.main.c Thu May 30 08:04:06 2019
@@ -2,20 +2,6 @@
 // RUN: FileCheck --check-prefix=CHECK-DSP < %t %s
 // CHECK-DSP: "-target-feature" "+dsp"
 
-// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+fp  -### %s 2> 
%t
-// RUN: FileCheck --check-prefix=CHECK-FP < %t %s
-// CHECK-FP: "-target-feature" "+fp-armv8"
-// CHECK-FP-NOT: "-target-feature" "+fp64"
-// CHECK-FP-NOT: "-target-feature" "+d32"
-// CHECK-FP: "-target-feature" "+fullfp16"
-
-// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+fp.dp  -### %s 
2> %t
-// RUN: FileCheck --check-prefix=CHECK-FPDP < %t %s
-// CHECK-FPDP: "-target-feature" "+fp-armv8"
-// CHECK-FPDP: "-target-feature" "+fullfp16"
-// CHECK-FPDP: "-target-feature" "+fp64"
-// CHECK-FPDP-NOT: "-target-feature" "+d32"
-
 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve  -### %s 2> 
%t
 // RUN: FileCheck --check-prefix=CHECK-MVE < %t %s
 // CHECK-MVE: "-target-feature" "+mve"
@@ -25,10 +11,4 @@
 // CHECK-MVEFP: "-target-feature" "+mve.fp"
 // CHECK-MVEFP-NOT: "-target-feature" "+fp64"
 
-// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp+fp.dp  
-### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-MVEFP_DP < %t %s
-// CHECK-MVEFP_DP: "-target-feature" "+mve.fp"
-// CHECK-MVEFP_DP: "-target-feature" "+fp64"
-
-// RUN: %clang -target arm-arm-none-eabi -march=armv8.1m.main+fp -S %s
 double foo (double a) { return a; }

Modified: cfe/trunk/test/Driver/armv8.1m.main.s
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/armv8.1m.main.s?rev=362100&r1=362099&r2=362100&view=diff
==
--- cfe/trunk/test/Driver/armv8.1m.main.s (original)
+++ cfe/trunk/test/Driver/armv8.1m.main.s Thu May 30 08:04:06 2019
@@ -4,17 +4,10 @@
 # RUN:  FileCheck --check-prefix=ERROR-V81M < %t %s
 # RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+dsp %s 
2>%t
 # RUN:  FileCheck --check-prefix=ERROR-V81M_DSP < %t %s
-# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+fp %s 
2>%t
-# RUN:  FileCheck --check-prefix=ERROR-V81M_FP < %t %s
-# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+fp.dp %s 
2>%t
-# RUN:  FileCheck --check-prefix=ERROR-V81M_FPDP < %t %s
 # RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve %s 
2>%t
 # RUN:  FileCheck --check-prefix=ERROR-V81M_MVE < %t %s
-# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve+fp 
%s 2>%t
-# RUN:  FileCheck --check-prefix=ERROR-V81M_MVE_FP < %t %s
 # RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve.fp 
%s 2>%t
 # RUN:  FileCheck --check-prefix=ERROR-V81M_MVEFP < %t %s
-# RUN: %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve.fp+fp.dp 
%s
 
 .syntax unified
 .thumb
@@ -45,21 +38,15 @@ vcmp.f64 d0,d1
 # ERROR-V8M: :[[@LINE-1]]:1: error
 # ERROR-V81M: :[[@LINE-2]]:1: error
 # ERROR-V81M_DSP: :[[@LINE-3]]:1: error
-# ERROR-V81M_FP: :[[@LINE-4]]:1: error
-# ERROR-V81M_MVE: :[[@LINE-5]]:1: error
-# ERROR-V81M_MVE_FP: :[[@LINE-6]]:1: error
-# ERROR-V81M_MVEFP: :[[@LINE-7]]:1: error
+# ERROR-V81M_MVE: :[[@LINE-4]]:1: error
+# ERROR-V81M_MVEFP: :[[@LINE-5]]:1: error
 
 asrl r0, r1, r2
 # ERROR-V8M: :[[@LINE-1]]:1: error
 # ERROR-V81M: :[[@LINE-2]]:1: error
 # ERROR-V81M_DSP: :[[@LINE-3]]:1: error
-# ERROR-V81M_FP: :[[@LINE-4]]:1: error
-# ERROR-V81M_FPDP: :[[@LINE-5]]:1: error
 
 vcadd.i8 q0, q1, q2, #90
 # ERROR-V8M: :[[@LINE-1]]:1: error
 # ERROR-V81M: :[[@LINE-2]]:1: error
 # ERROR-V81M_DSP: :[[@LINE-3]]:1: error
-# ERROR-V81M_FP: :[[@LINE-4]]:1: error
-# ERROR-V81M_FPDP: :[[@LINE-5]]:1: error


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


[PATCH] D60463: [ASTImporter] Add check for correct import of source locations.

2019-05-30 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 202197.
balazske added a comment.

New patch and check the first line of AST dump only.


Repository:
  rC Clang

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

https://reviews.llvm.org/D60463

Files:
  unittests/AST/ASTImporterFixtures.cpp
  unittests/AST/ASTImporterFixtures.h
  unittests/AST/ASTImporterTest.cpp

Index: unittests/AST/ASTImporterTest.cpp
===
--- unittests/AST/ASTImporterTest.cpp
+++ unittests/AST/ASTImporterTest.cpp
@@ -49,9 +49,8 @@
   llvm::raw_svector_ostream ToNothing(ImportChecker);
   ToCtx.getTranslationUnitDecl()->print(ToNothing);
 
-  // This traverses the AST to catch certain bugs like poorly or not
-  // implemented subtrees.
-  (*Imported)->dump(ToNothing);
+  // Additional SourceLocation checks.
+  checkImportedSourceLocations(Node, *Imported);
 }
 
 return Imported;
Index: unittests/AST/ASTImporterFixtures.h
===
--- unittests/AST/ASTImporterFixtures.h
+++ unittests/AST/ASTImporterFixtures.h
@@ -42,6 +42,8 @@
 void createVirtualFileIfNeeded(ASTUnit *ToAST, StringRef FileName,
StringRef Code);
 
+void checkImportedSourceLocations(const Decl *FromD, const Decl *ToD);
+
 // Common base for the different families of ASTImporter tests that are
 // parameterized on the compiler options which may result a different AST. E.g.
 // -fms-compatibility or -fdelayed-template-parsing.
Index: unittests/AST/ASTImporterFixtures.cpp
===
--- unittests/AST/ASTImporterFixtures.cpp
+++ unittests/AST/ASTImporterFixtures.cpp
@@ -18,6 +18,8 @@
 #include "clang/Frontend/ASTUnit.h"
 #include "clang/Tooling/Tooling.h"
 
+#include 
+
 namespace clang {
 namespace ast_matchers {
 
@@ -38,6 +40,82 @@
llvm::MemoryBuffer::getMemBuffer(Code));
 }
 
+void checkImportedSourceLocations(const Decl *FromD, const Decl *ToD) {
+  // Check AST dump for matching source locations in From and To AST.
+  // The first line of the AST dump contains information about the root node and
+  // some of the SourceLocation info, but certainly not everything.
+  // Still it is worth to check these. The test can be extended to check the
+  // whole AST dump but for this to work the ordering of imported Decls must be
+  // the same which is not the case now.
+  // The AST dump additionally traverses the AST and can catch certain bugs like
+  // poorly or not implemented subtrees.
+
+  // Print debug information?
+  const bool Print = false;
+
+  SmallString<1024> ToPrinted;
+  SmallString<1024> FromPrinted;
+  llvm::raw_svector_ostream ToStream(ToPrinted);
+  llvm::raw_svector_ostream FromStream(FromPrinted);
+
+  ToD->dump(ToStream);
+  FromD->dump(FromStream);
+
+  // search for SourceLocation strings:
+  // ::
+  // or
+  // line::
+  // or
+  // col:
+  // or
+  // ''
+  // If a component (filename or line) is same as in the last location
+  // it is not printed.
+  // Filename component is grouped into sub-expression to make it extractable.
+  std::regex MatchSourceLoc(
+  "|((\\w|\\.)+):\\d+:\\d+|line:\\d+:\\d+|col:\\d+");
+
+  std::string ToString(ToStream.str());
+  std::string FromString(FromStream.str());
+  int ToEndl = ToString.find('\n');
+  if (ToEndl == std::string::npos)
+ToEndl = ToString.size();
+  int FromEndl = FromString.find('\n');
+  if (FromEndl == std::string::npos)
+FromEndl = FromString.size();
+  auto ToLoc = std::sregex_iterator(ToString.begin(), ToString.begin() + ToEndl,
+MatchSourceLoc);
+  auto FromLoc = std::sregex_iterator(
+  FromString.begin(), FromString.begin() + FromEndl, MatchSourceLoc);
+  if (Print) {
+llvm::errs() << ToString << "\n\n\n" << FromString << "\n";
+llvm::errs() << "\n";
+  }
+  if (ToLoc->size() > 1 && FromLoc->size() > 1 && (*ToLoc)[1] != (*FromLoc)[1])
+// Different filenames in To and From.
+// This should mean that a to-be-imported decl was mapped to an existing
+// (these normally reside in different files) and the check is
+// not applicable.
+return;
+
+  bool SourceLocationMismatch = false;
+  while (ToLoc != std::sregex_iterator() && FromLoc != std::sregex_iterator()) {
+if (Print)
+  llvm::errs() << ToLoc->str() << "|" << FromLoc->str() << "\n";
+SourceLocationMismatch =
+SourceLocationMismatch || (ToLoc->str() != FromLoc->str());
+++ToLoc;
+++FromLoc;
+  }
+  if (Print)
+llvm::errs() << "\n";
+
+  if (FromLoc != std::sregex_iterator() || ToLoc != std::sregex_iterator())
+SourceLocationMismatch = true;
+
+  EXPECT_FALSE(SourceLocationMismatch);
+}
+
 ASTImporterTestBase::TU::TU(StringRef Code, StringRef FileName, ArgVector Args,
 ImporterConstructor C)
 : Code(Code),

[PATCH] D60463: [ASTImporter] Add check for correct import of source locations.

2019-05-30 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment.

In the current state there are failing AST tests. This test can be added after 
the problems are fixed.


Repository:
  rC Clang

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

https://reviews.llvm.org/D60463



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


r362101 - [analyzer] print() JSONify chain: Fix possible build-bot breaks

2019-05-30 Thread Csaba Dabis via cfe-commits
Author: charusso
Date: Thu May 30 08:15:57 2019
New Revision: 362101

URL: http://llvm.org/viewvc/llvm-project?rev=362101&view=rev
Log:
[analyzer] print() JSONify chain: Fix possible build-bot breaks

Summary:
Printing constructing_objects could be non-deterministic as it is a map.

Modified:
cfe/trunk/test/Analysis/dump_egraph.cpp

Modified: cfe/trunk/test/Analysis/dump_egraph.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/dump_egraph.cpp?rev=362101&r1=362100&r2=362101&view=diff
==
--- cfe/trunk/test/Analysis/dump_egraph.cpp (original)
+++ cfe/trunk/test/Analysis/dump_egraph.cpp Thu May 30 08:15:57 2019
@@ -16,9 +16,9 @@ void foo() {
   T t;
 }
 
-// CHECK: \"constructing_objects\": [\l  \{ 
\"location_context\": \"#0 Call\", \"calling\": \"foo\", \"call_line\": null, 
\"items\": [\l\{ \"lctx_id\": 
1, \"stmt_id\": {{[0-9]+}}, \"kind\": \"construct into local variable\", 
\"argument_index\": null, \"pretty\": \"T t;\", \"value\": \"&t\"
+// CHECK: \"location_context\": \"#0 Call\", \"calling\": \"foo\", 
\"call_line\": null, \"items\": 
[\l\{ \"lctx_id\": 1, 
\"stmt_id\": {{[0-9]+}}, \"kind\": \"construct into local variable\", 
\"argument_index\": null, \"pretty\": \"T t;\", \"value\": \"&t\"
 
-// CHECK: \"constructing_objects\": [\l  \{ 
\"location_context\": \"#0 Call\", \"calling\": \"T::T\", \"call_line\": 
\"16\", \"items\": [\l\{ 
\"lctx_id\": 2, \"init_id\": {{[0-9]+}}, \"kind\": \"construct into member 
variable\", \"argument_index\": null, \"pretty\": \"s\", \"value\": \"&t-\>s\"
+// CHECK: \"location_context\": \"#0 Call\", \"calling\": \"T::T\", 
\"call_line\": \"16\", \"items\": 
[\l\{ \"lctx_id\": 2, 
\"init_id\": {{[0-9]+}}, \"kind\": \"construct into member variable\", 
\"argument_index\": null, \"pretty\": \"s\", \"value\": \"&t-\>s\"
 
 // CHECK: \"cluster\": \"t\", \"items\": 
[\l\{ \"kind\": \"Default\", 
\"offset\": 0, \"value\": \"conj_$3\{int, LC3, no stmt, #1\}\"
 


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


r362102 - [OpenCL] Fix OpenCL/SPIR version metadata in C++ mode.

2019-05-30 Thread Anastasia Stulova via cfe-commits
Author: stulova
Date: Thu May 30 08:18:07 2019
New Revision: 362102

URL: http://llvm.org/viewvc/llvm-project?rev=362102&view=rev
Log:
[OpenCL] Fix OpenCL/SPIR version metadata in C++ mode.

C++ is derived from OpenCL v2.0 therefore set the versions
identically.

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


Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/test/CodeGenOpenCL/spir_version.cl

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=362102&r1=362101&r2=362102&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu May 30 08:18:07 2019
@@ -564,11 +564,13 @@ void CodeGenModule::Release() {
 if (getTriple().isSPIR()) {
   // SPIR v2.0 s2.12 - The SPIR version used by the module is stored in the
   // opencl.spir.version named metadata.
+  // C++ is backwards compatible with OpenCL v2.0.
+  auto Version = LangOpts.OpenCLCPlusPlus ? 200 : LangOpts.OpenCLVersion;
   llvm::Metadata *SPIRVerElts[] = {
   llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
-  Int32Ty, LangOpts.OpenCLVersion / 100)),
+  Int32Ty, Version / 100)),
   llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
-  Int32Ty, (LangOpts.OpenCLVersion / 100 > 1) ? 0 : 2))};
+  Int32Ty, (Version / 100 > 1) ? 0 : 2))};
   llvm::NamedMDNode *SPIRVerMD =
   TheModule.getOrInsertNamedMetadata("opencl.spir.version");
   llvm::LLVMContext &Ctx = TheModule.getContext();
@@ -623,11 +625,14 @@ void CodeGenModule::Release() {
 void CodeGenModule::EmitOpenCLMetadata() {
   // SPIR v2.0 s2.13 - The OpenCL version used by the module is stored in the
   // opencl.ocl.version named metadata node.
+  // C++ is backwards compatible with OpenCL v2.0.
+  // FIXME: We might need to add CXX version at some point too?
+  auto Version = LangOpts.OpenCLCPlusPlus ? 200 : LangOpts.OpenCLVersion;
   llvm::Metadata *OCLVerElts[] = {
   llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
-  Int32Ty, LangOpts.OpenCLVersion / 100)),
+  Int32Ty, Version / 100)),
   llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
-  Int32Ty, (LangOpts.OpenCLVersion % 100) / 10))};
+  Int32Ty, (Version % 100) / 10))};
   llvm::NamedMDNode *OCLVerMD =
   TheModule.getOrInsertNamedMetadata("opencl.ocl.version");
   llvm::LLVMContext &Ctx = TheModule.getContext();

Modified: cfe/trunk/test/CodeGenOpenCL/spir_version.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/spir_version.cl?rev=362102&r1=362101&r2=362102&view=diff
==
--- cfe/trunk/test/CodeGenOpenCL/spir_version.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/spir_version.cl Thu May 30 08:18:07 2019
@@ -5,6 +5,9 @@
 // RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - 
-cl-std=CL1.2 | FileCheck %s --check-prefix=CHECK-SPIR-CL12
 // RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - 
-cl-std=CL2.0 | FileCheck %s --check-prefix=CHECK-SPIR-CL20
 
+
+// RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - 
-cl-std=c++ | FileCheck %s --check-prefix=CHECK-SPIR-CL20
+
 // RUN: %clang_cc1 %s -triple "amdgcn--amdhsa" -emit-llvm -o - | FileCheck %s 
--check-prefix=CHECK-AMDGCN-CL10
 // RUN: %clang_cc1 %s -triple "amdgcn--amdhsa" -emit-llvm -o - -cl-std=CL1.2 | 
FileCheck %s --check-prefix=CHECK-AMDGCN-CL12
 // RUN: %clang_cc1 %s -triple "amdgcn--amdhsa" -emit-llvm -o - -cl-std=CL2.0 | 
FileCheck %s --check-prefix=CHECK-AMDGCN-CL20


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


Re: r361997 - [analyzer] print() JSONify: getNodeLabel implementation

2019-05-30 Thread Csaba Dabis via cfe-commits
Hm, the first `CHECK: constructing_objects` contains only one element,
which is fine,
the second `CHECK: constructing_objects` has two, which could be
non-determinism,
but surprisingly it is worked as excepted.
Because of the edge-case I have changed my mind:
https://github.com/llvm/llvm-project/commit/32d545f930ce44614ac8398693dacd1d6dbc41a3

Thanks everyone!

On Thu, May 30, 2019 at 4:52 PM Roman Lebedev  wrote:

> On Thu, May 30, 2019 at 5:48 PM Csaba Dabis via cfe-commits
>  wrote:
> >
> > Thanks you!
> >
> > Fixed by
> https://github.com/llvm/llvm-project/commit/17604c3486cbe7c27cadac1757cd0a9109a92792
> The non-determinism is still there though, so this isn't correct fix.
>
> > On Thu, May 30, 2019 at 4:16 PM Russell Gallop 
> wrote:
> >>
> >> Hi Csaba,
> >>
> >> Failing example attached. Note that the output is different every time
> so there is potentially more than one failure mode.
> >>
> >> Thanks
> >> Russ
> >>
> >> On Thu, 30 May 2019 at 15:05, Csaba Dabis 
> wrote:
> >>>
> >>> Hey!
> >>>
> >>> When it fails, could you provide the DOT dump? The path is:
> llvm-project/build/tools/clang/test/Analysis/Output/dump_egraph.cpp.tmp.dot
> >>>
> >>> Thanks,
> >>> Csaba.
> >>>
> >>> On Thu, May 30, 2019 at 4:00 PM Russell Gallop <
> russell.gal...@gmail.com> wrote:
> 
>  Hi Csaba,
> 
>  The test dump_egraph.cpp appears to be flaky on Windows. For example
> here:
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/26183
> .
> 
> 
> C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\Analysis\dump_egraph.cpp:23:11:
> error: CHECK: expected string not found in input
>  // CHECK: \"store\": [\l  \{
> \"cluster\": \"t\", \"items\":
> [\l\{ \"kind\":
> \"Default\", \"offset\": 0, \"value\": \"conj_$3\{int, LC3, no stmt, #1\}\"
> 
>  Running locally, it fails after 2-5 runs for me, running:
>  python bin/llvm-lit.py -v ../clang/test/Analysis/dump_egraph.cpp
> 
>  Please could you take a look?
> 
>  Note that I'm not certain it was this commit that started the
> flakiness, it is the latest which changed the failing line.
> 
>  Thanks
>  Russ
> 
>  On Wed, 29 May 2019 at 19:02, Csaba Dabis via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> >
> > Author: charusso
> > Date: Wed May 29 11:05:53 2019
> > New Revision: 361997
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=361997&view=rev
> > Log:
> > [analyzer] print() JSONify: getNodeLabel implementation
> >
> > Summary: This patch also rewrites the ProgramPoint printing.
> >
> > Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware,
> Szelethus
> >
> > Reviewed By: NoQ
> >
> > Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin,
> mikhail.ramalho,
> >  donat.nagy, dkrupp
> >
> > Tags: #clang
> >
> > Differential Revision: https://reviews.llvm.org/D62346
> >
> > Modified:
> > cfe/trunk/include/clang/Analysis/ProgramPoint.h
> > cfe/trunk/lib/Analysis/ProgramPoint.cpp
> > cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
> > cfe/trunk/test/Analysis/dump_egraph.c
> > cfe/trunk/test/Analysis/dump_egraph.cpp
> >
> > Modified: cfe/trunk/include/clang/Analysis/ProgramPoint.h
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/ProgramPoint.h?rev=361997&r1=361996&r2=361997&view=diff
> >
> ==
> > --- cfe/trunk/include/clang/Analysis/ProgramPoint.h (original)
> > +++ cfe/trunk/include/clang/Analysis/ProgramPoint.h Wed May 29
> 11:05:53 2019
> > @@ -213,7 +213,7 @@ public:
> >  ID.AddPointer(getTag());
> >}
> >
> > -  void print(StringRef CR, llvm::raw_ostream &Out) const;
> > +  void printJson(llvm::raw_ostream &Out, const char *NL = "\n")
> const;
> >
> >LLVM_DUMP_METHOD void dump() const;
> >
> >
> > Modified: cfe/trunk/lib/Analysis/ProgramPoint.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ProgramPoint.cpp?rev=361997&r1=361996&r2=361997&view=diff
> >
> ==
> > --- cfe/trunk/lib/Analysis/ProgramPoint.cpp (original)
> > +++ cfe/trunk/lib/Analysis/ProgramPoint.cpp Wed May 29 11:05:53 2019
> > @@ -43,151 +43,152 @@ ProgramPoint ProgramPoint::getProgramPoi
> >  }
> >
> >  LLVM_DUMP_METHOD void ProgramPoint::dump() const {
> > -  return print(/*CR=*/"\n", llvm::errs());
> > +  return printJson(llvm::errs());
> >  }
> >
> > -static void printLocation(raw_ostream &Out, SourceLocation SLoc,
> > -  const SourceManager &SM,
> > -  StringRef CR,
> > -   

Re: r361997 - [analyzer] print() JSONify: getNodeLabel implementation

2019-05-30 Thread Roman Lebedev via cfe-commits
I think we're still talking past each other.

I'm saying that *any* commit that does not fix the underlying nondeterminizm,
but only hides it by deleting tests that showed that said determinism
exists in the first place,
is not a fix.

Roman.

On Thu, May 30, 2019 at 6:14 PM Csaba Dabis  wrote:
>
> Hm, the first `CHECK: constructing_objects` contains only one element, which 
> is fine,
> the second `CHECK: constructing_objects` has two, which could be 
> non-determinism,
> but surprisingly it is worked as excepted.
> Because of the edge-case I have changed my mind:
> https://github.com/llvm/llvm-project/commit/32d545f930ce44614ac8398693dacd1d6dbc41a3
>
> Thanks everyone!
>
> On Thu, May 30, 2019 at 4:52 PM Roman Lebedev  wrote:
>>
>> On Thu, May 30, 2019 at 5:48 PM Csaba Dabis via cfe-commits
>>  wrote:
>> >
>> > Thanks you!
>> >
>> > Fixed by 
>> > https://github.com/llvm/llvm-project/commit/17604c3486cbe7c27cadac1757cd0a9109a92792
>> The non-determinism is still there though, so this isn't correct fix.
>>
>> > On Thu, May 30, 2019 at 4:16 PM Russell Gallop  
>> > wrote:
>> >>
>> >> Hi Csaba,
>> >>
>> >> Failing example attached. Note that the output is different every time so 
>> >> there is potentially more than one failure mode.
>> >>
>> >> Thanks
>> >> Russ
>> >>
>> >> On Thu, 30 May 2019 at 15:05, Csaba Dabis  wrote:
>> >>>
>> >>> Hey!
>> >>>
>> >>> When it fails, could you provide the DOT dump? The path is: 
>> >>> llvm-project/build/tools/clang/test/Analysis/Output/dump_egraph.cpp.tmp.dot
>> >>>
>> >>> Thanks,
>> >>> Csaba.
>> >>>
>> >>> On Thu, May 30, 2019 at 4:00 PM Russell Gallop 
>> >>>  wrote:
>> 
>>  Hi Csaba,
>> 
>>  The test dump_egraph.cpp appears to be flaky on Windows. For example 
>>  here: 
>>  http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/26183.
>> 
>>  C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\Analysis\dump_egraph.cpp:23:11:
>>   error: CHECK: expected string not found in input
>>  // CHECK: \"store\": [\l  \{ 
>>  \"cluster\": \"t\", \"items\": 
>>  [\l\{ \"kind\": 
>>  \"Default\", \"offset\": 0, \"value\": \"conj_$3\{int, LC3, no stmt, 
>>  #1\}\"
>> 
>>  Running locally, it fails after 2-5 runs for me, running:
>>  python bin/llvm-lit.py -v ../clang/test/Analysis/dump_egraph.cpp
>> 
>>  Please could you take a look?
>> 
>>  Note that I'm not certain it was this commit that started the 
>>  flakiness, it is the latest which changed the failing line.
>> 
>>  Thanks
>>  Russ
>> 
>>  On Wed, 29 May 2019 at 19:02, Csaba Dabis via cfe-commits 
>>   wrote:
>> >
>> > Author: charusso
>> > Date: Wed May 29 11:05:53 2019
>> > New Revision: 361997
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=361997&view=rev
>> > Log:
>> > [analyzer] print() JSONify: getNodeLabel implementation
>> >
>> > Summary: This patch also rewrites the ProgramPoint printing.
>> >
>> > Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus
>> >
>> > Reviewed By: NoQ
>> >
>> > Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin, mikhail.ramalho,
>> >  donat.nagy, dkrupp
>> >
>> > Tags: #clang
>> >
>> > Differential Revision: https://reviews.llvm.org/D62346
>> >
>> > Modified:
>> > cfe/trunk/include/clang/Analysis/ProgramPoint.h
>> > cfe/trunk/lib/Analysis/ProgramPoint.cpp
>> > cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
>> > cfe/trunk/test/Analysis/dump_egraph.c
>> > cfe/trunk/test/Analysis/dump_egraph.cpp
>> >
>> > Modified: cfe/trunk/include/clang/Analysis/ProgramPoint.h
>> > URL: 
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/ProgramPoint.h?rev=361997&r1=361996&r2=361997&view=diff
>> > ==
>> > --- cfe/trunk/include/clang/Analysis/ProgramPoint.h (original)
>> > +++ cfe/trunk/include/clang/Analysis/ProgramPoint.h Wed May 29 
>> > 11:05:53 2019
>> > @@ -213,7 +213,7 @@ public:
>> >  ID.AddPointer(getTag());
>> >}
>> >
>> > -  void print(StringRef CR, llvm::raw_ostream &Out) const;
>> > +  void printJson(llvm::raw_ostream &Out, const char *NL = "\n") const;
>> >
>> >LLVM_DUMP_METHOD void dump() const;
>> >
>> >
>> > Modified: cfe/trunk/lib/Analysis/ProgramPoint.cpp
>> > URL: 
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ProgramPoint.cpp?rev=361997&r1=361996&r2=361997&view=diff
>> > ==
>> > --- cfe/trunk/lib/Analysis/ProgramPoint.cpp (original)
>> > +++ cfe/trunk/lib/Analysis/ProgramPoint.cpp Wed May 29 11:05:53 2019
>> > @@ -

Re: r361997 - [analyzer] print() JSONify: getNodeLabel implementation

2019-05-30 Thread Russell Gallop via cfe-commits
Hi Csaba,

I see what Roman means. Output should be deterministic for given input
(unless there is a very good reason not to (e.g. timing or deliberate
randomness)).

You can check whether the output is the same with a script like below. It
looks like the node numbers are different every time. Is there a good
reason for this?

Regards
Russ

$ cat test.sh
#!/bin/bash -xe

python bin/llvm-lit.py -v ../clang/test/Analysis/dump_egraph.cpp
cp tools/clang/test/Analysis/Output/dump_egraph.cpp.tmp.dot ref.dot

for ((i=0;i<100;i++));
do
 python bin/llvm-lit.py -v ../clang/test/Analysis/dump_egraph.cpp
 diff ref.dot tools/clang/test/Analysis/Output/dump_egraph.cpp.tmp.dot
done

On Thu, 30 May 2019 at 16:18, Roman Lebedev  wrote:

> I think we're still talking past each other.
>
> I'm saying that *any* commit that does not fix the underlying
> nondeterminizm,
> but only hides it by deleting tests that showed that said determinism
> exists in the first place,
> is not a fix.
>
> Roman.
>
> On Thu, May 30, 2019 at 6:14 PM Csaba Dabis 
> wrote:
> >
> > Hm, the first `CHECK: constructing_objects` contains only one element,
> which is fine,
> > the second `CHECK: constructing_objects` has two, which could be
> non-determinism,
> > but surprisingly it is worked as excepted.
> > Because of the edge-case I have changed my mind:
> >
> https://github.com/llvm/llvm-project/commit/32d545f930ce44614ac8398693dacd1d6dbc41a3
> >
> > Thanks everyone!
> >
> > On Thu, May 30, 2019 at 4:52 PM Roman Lebedev 
> wrote:
> >>
> >> On Thu, May 30, 2019 at 5:48 PM Csaba Dabis via cfe-commits
> >>  wrote:
> >> >
> >> > Thanks you!
> >> >
> >> > Fixed by
> https://github.com/llvm/llvm-project/commit/17604c3486cbe7c27cadac1757cd0a9109a92792
> >> The non-determinism is still there though, so this isn't correct fix.
> >>
> >> > On Thu, May 30, 2019 at 4:16 PM Russell Gallop <
> russell.gal...@gmail.com> wrote:
> >> >>
> >> >> Hi Csaba,
> >> >>
> >> >> Failing example attached. Note that the output is different every
> time so there is potentially more than one failure mode.
> >> >>
> >> >> Thanks
> >> >> Russ
> >> >>
> >> >> On Thu, 30 May 2019 at 15:05, Csaba Dabis 
> wrote:
> >> >>>
> >> >>> Hey!
> >> >>>
> >> >>> When it fails, could you provide the DOT dump? The path is:
> llvm-project/build/tools/clang/test/Analysis/Output/dump_egraph.cpp.tmp.dot
> >> >>>
> >> >>> Thanks,
> >> >>> Csaba.
> >> >>>
> >> >>> On Thu, May 30, 2019 at 4:00 PM Russell Gallop <
> russell.gal...@gmail.com> wrote:
> >> 
> >>  Hi Csaba,
> >> 
> >>  The test dump_egraph.cpp appears to be flaky on Windows. For
> example here:
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/26183
> .
> >> 
> >> 
> C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\Analysis\dump_egraph.cpp:23:11:
> error: CHECK: expected string not found in input
> >>  // CHECK: \"store\": [\l  \{
> \"cluster\": \"t\", \"items\":
> [\l\{ \"kind\":
> \"Default\", \"offset\": 0, \"value\": \"conj_$3\{int, LC3, no stmt, #1\}\"
> >> 
> >>  Running locally, it fails after 2-5 runs for me, running:
> >>  python bin/llvm-lit.py -v ../clang/test/Analysis/dump_egraph.cpp
> >> 
> >>  Please could you take a look?
> >> 
> >>  Note that I'm not certain it was this commit that started the
> flakiness, it is the latest which changed the failing line.
> >> 
> >>  Thanks
> >>  Russ
> >> 
> >>  On Wed, 29 May 2019 at 19:02, Csaba Dabis via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> >> >
> >> > Author: charusso
> >> > Date: Wed May 29 11:05:53 2019
> >> > New Revision: 361997
> >> >
> >> > URL: http://llvm.org/viewvc/llvm-project?rev=361997&view=rev
> >> > Log:
> >> > [analyzer] print() JSONify: getNodeLabel implementation
> >> >
> >> > Summary: This patch also rewrites the ProgramPoint printing.
> >> >
> >> > Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware,
> Szelethus
> >> >
> >> > Reviewed By: NoQ
> >> >
> >> > Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin,
> mikhail.ramalho,
> >> >  donat.nagy, dkrupp
> >> >
> >> > Tags: #clang
> >> >
> >> > Differential Revision: https://reviews.llvm.org/D62346
> >> >
> >> > Modified:
> >> > cfe/trunk/include/clang/Analysis/ProgramPoint.h
> >> > cfe/trunk/lib/Analysis/ProgramPoint.cpp
> >> > cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
> >> > cfe/trunk/test/Analysis/dump_egraph.c
> >> > cfe/trunk/test/Analysis/dump_egraph.cpp
> >> >
> >> > Modified: cfe/trunk/include/clang/Analysis/ProgramPoint.h
> >> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/ProgramPoint.h?rev=361997&r1=361996&r2=361997&view=diff
> >> >
> ==
> >> 

[PATCH] D62622: [CMake] Provide an option to use relative paths in debug info

2019-05-30 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added a comment.

I like LLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO.


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

https://reviews.llvm.org/D62622



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


r362106 - Revert "clang support gnu asm goto."

2019-05-30 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Thu May 30 08:38:02 2019
New Revision: 362106

URL: http://llvm.org/viewvc/llvm-project?rev=362106&view=rev
Log:
Revert "clang support gnu asm goto."

This reverts commit 954ec09aed4f2be04bb5f4e10dbb4ea8bd19ef9a.

Reverting due to test failures as requested by Jennifer Yu.

Conflicts:
clang/test/CodeGen/asm-goto.c

Removed:
cfe/trunk/test/Analysis/asm-goto.cpp
cfe/trunk/test/CodeGen/asm-goto.c
cfe/trunk/test/Sema/asm-goto.cpp
Modified:
cfe/trunk/include/clang/AST/Stmt.h
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/lib/AST/Stmt.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/Analysis/CFG.cpp
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/lib/Parse/ParseStmtAsm.cpp
cfe/trunk/lib/Sema/JumpDiagnostics.cpp
cfe/trunk/lib/Sema/SemaStmtAsm.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/test/CodeGen/asm.c
cfe/trunk/test/CodeGen/inline-asm-mixed-style.c
cfe/trunk/test/Coverage/c-language-features.inc
cfe/trunk/test/PCH/asm.h
cfe/trunk/test/Parser/asm.c
cfe/trunk/test/Parser/asm.cpp
cfe/trunk/test/Sema/asm.c
cfe/trunk/test/Sema/inline-asm-validate-tmpl.cpp
cfe/trunk/test/Sema/scope-check.c

Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=362106&r1=362105&r2=362106&view=diff
==
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Thu May 30 08:38:02 2019
@@ -46,7 +46,6 @@ class Attr;
 class CapturedDecl;
 class Decl;
 class Expr;
-class AddrLabelExpr;
 class LabelDecl;
 class ODRHash;
 class PrinterHelper;
@@ -2817,15 +2816,13 @@ class GCCAsmStmt : public AsmStmt {
   StringLiteral **Constraints = nullptr;
   StringLiteral **Clobbers = nullptr;
   IdentifierInfo **Names = nullptr;
-  unsigned NumLabels = 0;
 
 public:
   GCCAsmStmt(const ASTContext &C, SourceLocation asmloc, bool issimple,
  bool isvolatile, unsigned numoutputs, unsigned numinputs,
  IdentifierInfo **names, StringLiteral **constraints, Expr **exprs,
  StringLiteral *asmstr, unsigned numclobbers,
- StringLiteral **clobbers, unsigned numlabels,
- SourceLocation rparenloc);
+ StringLiteral **clobbers, SourceLocation rparenloc);
 
   /// Build an empty inline-assembly statement.
   explicit GCCAsmStmt(EmptyShell Empty) : AsmStmt(GCCAsmStmtClass, Empty) {}
@@ -2950,51 +2947,6 @@ public:
 return const_cast(this)->getInputExpr(i);
   }
 
-  //===--- Labels ---===//
-
-  bool isAsmGoto() const {
-return NumLabels > 0;
-  }
-
-  unsigned getNumLabels() const {
-return NumLabels;
-  }
-
-  IdentifierInfo *getLabelIdentifier(unsigned i) const {
-return Names[i + NumInputs];
-  }
-
-  AddrLabelExpr *getLabelExpr(unsigned i) const;
-  StringRef getLabelName(unsigned i) const;
-  using labels_iterator = CastIterator;
-  using const_labels_iterator = ConstCastIterator;
-  using labels_range = llvm::iterator_range;
-  using labels_const_range = llvm::iterator_range;
-
-  labels_iterator begin_labels() {
-return &Exprs[0] + NumInputs;
-  }
-
-  labels_iterator end_labels() {
-return &Exprs[0] + NumInputs + NumLabels;
-  }
-
-  labels_range labels() {
-return labels_range(begin_labels(), end_labels());
-  }
-
-  const_labels_iterator begin_labels() const {
-return &Exprs[0] + NumInputs;
-  }
-
-  const_labels_iterator end_labels() const {
-return &Exprs[0] + NumInputs + NumLabels;
-  }
-
-  labels_const_range labels() const {
-return labels_const_range(begin_labels(), end_labels());
-  }
-
 private:
   void setOutputsAndInputsAndClobbers(const ASTContext &C,
   IdentifierInfo **Names,
@@ -3002,7 +2954,6 @@ private:
   Stmt **Exprs,
   unsigned NumOutputs,
   unsigned NumInputs,
-  unsigned NumLabels,
   StringLiteral **Clobbers,
   unsigned NumClobbers);
 

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=362106&r1=362105&r2=362106&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Thu May 30 08:38:02 
2019
@@ -27,8 +27,8 @@ def err_msasm_unabl

Re: r361997 - [analyzer] print() JSONify: getNodeLabel implementation

2019-05-30 Thread Csaba Dabis via cfe-commits
I have not said there is determinism to print out a map as Static Analyzer
cannot provide that. We have no plans to make it deterministic, as it is
just dumping out the ExplodedGraph in JSON format, which is an internal
stuff.

This non-deterministic behaviour has been seen first only some days ago, as
no-one ever was that crazy to rewrite the backend of the Static Analyzer.
Now we are doing that as a part of my GSoC project, and that little QoL
patch-chain cannot take more than a week of work, as we planned.

I have said the non-deterministic behaviour of Windows has been fixed. When
you put that for-loop to `check-clang` on a Linux machine it will pass 100
times, however on Windows it will fail 60 times. I am not a Windows user
and I did not know about that behaviour to write out a map could be that
silly. By "hiding" the non-determinism of Windows map-handling the Test
became deterministic.

We had that structure behind:

First CHECK was:
"constructing_objects": [
  { "location_context": "#0 Call", "calling": "foo", "call_line": null, "
*items*": [
{ "lctx_id": 1, "stmt_id": 1125, "kind": "construct into local
variable", "argument_index": null, "pretty": "T t;", "value": "&t" }
  ]}
]

Second CHECK was:
"constructing_objects": [
  { "location_context": "#0 Call", "calling": "T::T", "call_line": "16", "
*items*": [
{ "lctx_id": 2, "init_id": 1062, "kind": "construct into member
variable", "argument_index": null, "pretty": "s", "value": "&t->s" }
  ]},
  { "location_context": "#1 Call", "calling": "foo", "call_line": null, "
*items*": [
{ "lctx_id": 1, "stmt_id": 1125, "kind": "construct into local
variable", "argument_index": null, "pretty": "T t;", "value": "&t" }
  ]}
]

By removing the `constructing_objects` that Test is deterministic every
time as no map structure with multiple elements involved.

I am also sad because the core developers did not care about maps. I will
not too, as I said it is just dumping out the internal of the internals.

Thanks for your understanding,
Csaba.

On Thu, May 30, 2019 at 5:28 PM Russell Gallop 
wrote:

> Hi Csaba,
>
> I see what Roman means. Output should be deterministic for given input
> (unless there is a very good reason not to (e.g. timing or deliberate
> randomness)).
>
> You can check whether the output is the same with a script like below. It
> looks like the node numbers are different every time. Is there a good
> reason for this?
>
> Regards
> Russ
>
> $ cat test.sh
> #!/bin/bash -xe
>
> python bin/llvm-lit.py -v ../clang/test/Analysis/dump_egraph.cpp
> cp tools/clang/test/Analysis/Output/dump_egraph.cpp.tmp.dot ref.dot
>
> for ((i=0;i<100;i++));
> do
>  python bin/llvm-lit.py -v ../clang/test/Analysis/dump_egraph.cpp
>  diff ref.dot tools/clang/test/Analysis/Output/dump_egraph.cpp.tmp.dot
> done
>
> On Thu, 30 May 2019 at 16:18, Roman Lebedev  wrote:
>
>> I think we're still talking past each other.
>>
>> I'm saying that *any* commit that does not fix the underlying
>> nondeterminizm,
>> but only hides it by deleting tests that showed that said determinism
>> exists in the first place,
>> is not a fix.
>>
>> Roman.
>>
>> On Thu, May 30, 2019 at 6:14 PM Csaba Dabis 
>> wrote:
>> >
>> > Hm, the first `CHECK: constructing_objects` contains only one element,
>> which is fine,
>> > the second `CHECK: constructing_objects` has two, which could be
>> non-determinism,
>> > but surprisingly it is worked as excepted.
>> > Because of the edge-case I have changed my mind:
>> >
>> https://github.com/llvm/llvm-project/commit/32d545f930ce44614ac8398693dacd1d6dbc41a3
>> >
>> > Thanks everyone!
>> >
>> > On Thu, May 30, 2019 at 4:52 PM Roman Lebedev 
>> wrote:
>> >>
>> >> On Thu, May 30, 2019 at 5:48 PM Csaba Dabis via cfe-commits
>> >>  wrote:
>> >> >
>> >> > Thanks you!
>> >> >
>> >> > Fixed by
>> https://github.com/llvm/llvm-project/commit/17604c3486cbe7c27cadac1757cd0a9109a92792
>> >> The non-determinism is still there though, so this isn't correct fix.
>> >>
>> >> > On Thu, May 30, 2019 at 4:16 PM Russell Gallop <
>> russell.gal...@gmail.com> wrote:
>> >> >>
>> >> >> Hi Csaba,
>> >> >>
>> >> >> Failing example attached. Note that the output is different every
>> time so there is potentially more than one failure mode.
>> >> >>
>> >> >> Thanks
>> >> >> Russ
>> >> >>
>> >> >> On Thu, 30 May 2019 at 15:05, Csaba Dabis 
>> wrote:
>> >> >>>
>> >> >>> Hey!
>> >> >>>
>> >> >>> When it fails, could you provide the DOT dump? The path is:
>> llvm-project/build/tools/clang/test/Analysis/Output/dump_egraph.cpp.tmp.dot
>> >> >>>
>> >> >>> Thanks,
>> >> >>> Csaba.
>> >> >>>
>> >> >>> On Thu, May 30, 2019 at 4:00 PM Russell Gallop <
>> russell.gal...@gmail.com> wrote:
>> >> 
>> >>  Hi Csaba,
>> >> 
>> >>  The test dump_egraph.cpp appears to be flaky on Windows. For
>> example here:
>> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/26183
>> .
>> >> 
>> >> 
>> C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-p

[PATCH] D62435: Add Attribute NoThrow as an Exception Specifier Type

2019-05-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.

LGTM aside from some minor nits.




Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:2789
   InGroup;
+def warn_nothrow_attribute_ignored : Warning<"nothrow attribute conflicts with"
+  " exception specification; attribute ignored">,

Add single quotes around the attribute name: `'nothrow' attribute conflicts...`



Comment at: clang/include/clang/Sema/DeclSpec.h:1547
 
+  bool hasAttr(ParsedAttr::Kind Kind) const {
+return llvm::find_if(getAttrs(), [Kind](const ParsedAttr &P) {

Not that I dislike this, but is this function being used? It seems to be the 
only `hasAttr` in the review.



Comment at: clang/lib/Sema/SemaType.cpp:6968
+
+// MSVC ignores nothrow for exception specification if it is in conflict.
+if (Proto->hasExceptionSpec()) {

How about: `MSVC ignores nothrow if it is in conflict with an explicit 
exception specification.`



Comment at: clang/lib/Sema/SemaType.cpp:6971
+  switch (Proto->getExceptionSpecType()) {
+  case EST_None: llvm_unreachable("This doesn't have an exception spec!");
+  case EST_DynamicNone:

Will this need a fallthrough attribute because of the statement between the 
labels?


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

https://reviews.llvm.org/D62435



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


[PATCH] D62688: [Analyzer] Iterator Checkers - Model `empty()` method of containers

2019-05-30 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware created this revision.
baloghadamsoftware added reviewers: NoQ, Szelethus.
baloghadamsoftware added a project: clang.
Herald added subscribers: Charusso, gamesh411, donat.nagy, mikhail.ramalho, 
a.sidorin, rnkovacs, szepet, xazax.hun, whisperity.

Modeling of the `empty()` method is essential for more accurate reporting 
past-the-end iterator access.


Repository:
  rC Clang

https://reviews.llvm.org/D62688

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

Index: test/Analysis/iterator-range.cpp
===
--- test/Analysis/iterator-range.cpp
+++ test/Analysis/iterator-range.cpp
@@ -5,6 +5,12 @@
 
 void clang_analyzer_warnIfReached();
 
+extern void __assert_fail (__const char *__assertion, __const char *__file,
+unsigned int __line, __const char *__function)
+ __attribute__ ((__noreturn__));
+#define assert(expr) \
+  ((expr)  ? (void)(0)  : __assert_fail (#expr, __FILE__, __LINE__, __func__))
+
 void simple_good_end(const std::vector &v) {
   auto i = v.end();
   if (i != v.end()) {
@@ -236,3 +242,32 @@
 *i0; // no-warning
   }
 }
+
+void empty(const std::vector &V) {
+  for (auto n: V) {}
+  *V.begin(); // expected-warning{{Past-the-end iterator dereferenced}}
+}
+
+void non_empty1(const std::vector &V) {
+  assert(!V.empty());
+  for (auto n: V) {}
+  *V.begin(); // no-warning
+}
+
+void non_empty2(const std::vector &V) {
+  for (auto n: V) {}
+  assert(!V.empty());
+  *V.begin(); // no-warning
+}
+
+bool is_empty_V() {
+  std::vector V;
+  bool e = V.empty();
+  return e;
+}
+
+void deferred_emptiness_check() {
+  bool b = is_empty_V();
+  if (b) {
+  }
+}
Index: test/Analysis/diagnostics/explicit-suppression.cpp
===
--- test/Analysis/diagnostics/explicit-suppression.cpp
+++ test/Analysis/diagnostics/explicit-suppression.cpp
@@ -19,6 +19,6 @@
 void testCopyNull(C *I, C *E) {
   std::copy(I, E, (C *)0);
 #ifndef SUPPRESSED
-  // expected-warning@../Inputs/system-header-simulator-cxx.h:677 {{Called C++ object pointer is null}}
+  // expected-warning@../Inputs/system-header-simulator-cxx.h:685 {{Called C++ object pointer is null}}
 #endif
 }
Index: test/Analysis/Inputs/system-header-simulator-cxx.h
===
--- test/Analysis/Inputs/system-header-simulator-cxx.h
+++ test/Analysis/Inputs/system-header-simulator-cxx.h
@@ -316,6 +316,8 @@
 const T& front() const { return *begin(); }
 T& back() { return *(end() - 1); }
 const T& back() const { return *(end() - 1); }
+
+bool empty() const;
   };
   
   template
@@ -386,6 +388,8 @@
 const T& front() const { return *begin(); }
 T& back() { return *--end(); }
 const T& back() const { return *--end(); }
+
+bool empty() const;
   };
 
   template
@@ -466,6 +470,8 @@
 const T& front() const { return *begin(); }
 T& back() { return *(end() - 1); }
 const T& back() const { return *(end() - 1); }
+
+bool empty() const;
   };
 
   template
@@ -529,6 +535,8 @@
 
 T& front() { return *begin(); }
 const T& front() const { return *begin(); }
+
+bool empty() const;
   };
 
   template 
Index: lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
+++ lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
@@ -182,6 +182,8 @@
   void handleComparison(CheckerContext &C, const Expr *CE, const SVal &RetVal,
 const SVal &LVal, const SVal &RVal,
 OverloadedOperatorKind Op) const;
+  void handleEmpty(CheckerContext &C, const Expr *CE, const SVal &Cont,
+   const SVal &RetVal) const;
   void processComparison(CheckerContext &C, ProgramStateRef State,
  SymbolRef Sym1, SymbolRef Sym2, const SVal &RetVal,
  OverloadedOperatorKind Op) const;
@@ -272,6 +274,7 @@
 
 bool isIteratorType(const QualType &Type);
 bool isIterator(const CXXRecordDecl *CRD);
+bool isContainerType(const QualType &Type);
 bool isComparisonOperator(OverloadedOperatorKind OK);
 bool isBeginCall(const FunctionDecl *Func);
 bool isEndCall(const FunctionDecl *Func);
@@ -279,6 +282,7 @@
 bool isClearCall(const FunctionDecl *Func);
 bool isPushBackCall(const FunctionDecl *Func);
 bool isEmplaceBackCall(const FunctionDecl *Func);
+bool isEmptyCall(const FunctionDecl *Func);
 bool isPopBackCall(const FunctionDecl *Func);
 bool isPushFrontCall(const FunctionDecl *Func);
 bool isEmplaceFrontCall(const FunctionDecl *Func);
@@ -691,6 +695,17 @@
 if (!OrigExpr)
   return;
 
+if (const auto *InstCall = dyn_cast(&Call)) {
+  if (isContainerType(InstCall->getCXXThisExpr()->getType())) {
+

[PATCH] D60763: Prototype OpenCL BIFs using Tablegen

2019-05-30 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh added inline comments.



Comment at: clang/include/clang/Basic/OpenCLBuiltins.td:298-302
+def write_imagef : Builtin<"write_imagef",
+[void_t,
+  image2d_WO_t,
+  VectorType,
+  VectorType]>;

AlexeySotkin wrote:
> Pierre wrote:
> > AlexeySotkin wrote:
> > > It seems like there is something wrong with access qualifiers for images. 
> > > I have applied this patch and tried to compile the following code:
> > > 
> > > ```
> > > typedef int int2 __attribute__((ext_vector_type(2)));
> > > typedef float float4 __attribute__((ext_vector_type(4)));
> > > 
> > > void kernel k(write_only image2d_t image, int2 coord, float4 data) {
> > >   write_imagef(image, coord, data);
> > > }
> > > 
> > > ```
> > > I got the following output:
> > > ```
> > > clang -cc1 -triple spir /work/tmp/tmp.cl -emit-llvm -o -  
> > > -fadd-opencl-builtins
> > > /work/tmp/tmp.cl:5:16: error: passing '__write_only image2d_t' to 
> > > parameter of incompatible type '__read_only image2d_t'
> > >   write_imagef(image, coord, data);
> > >  ^
> > > 1 error generated.
> > > ```
> > What you are saying is right. This patch is incomplete and some features 
> > are missing/ broken. 
> > I have a new version of the tablegen builtin feature where the access 
> > qualifiers are actually taken into account, but I cannot extract only this 
> > from my version. This would imply uploading the whole new version. 
> > The new version will hopefully be on top of this patch, making access 
> > qualifiers work.
> Thanks, Pierre. I'd like to start early testing of image builtins with this 
> prototype. Do you have an idea when you will have image builtins done in this 
> (or other) patch?
> If it is not going to happen in the nearest future, would you mind if I'll 
> propose some changes for this patch/prototype meanwhile?
We're planning to commit the basic infrastructure early next week, which should 
make it easier to extend this work and enable contributions from the wider 
community.


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

https://reviews.llvm.org/D60763



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


[PATCH] D62654: [Docs] Modernize references to macOS

2019-05-30 Thread Jonas Devlieghere via Phabricator via cfe-commits
JDevlieghere accepted this revision.
JDevlieghere 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/D62654/new/

https://reviews.llvm.org/D62654



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


[PATCH] D60748: Fix i386 struct and union parameter alignment

2019-05-30 Thread James Y Knight via Phabricator via cfe-commits
jyknight added a comment.

I don't think this was correct (where by "correct", there, I mean "what GCC 
does", as this patch is intended to match GCC behavior).

I think this change may well break more cases than it fixes, so IMO, this 
should be reverted, until it's implemented properly.

Consider one example:

  #include 
  
  typedef __attribute__((aligned(16))) int alignedint;
  
  struct __attribute__((aligned(64))) X {
  int x;
  //alignedint y;
  //__m128 y;
  };
  void g(int x, struct X);
  
  _Static_assert(_Alignof(struct X) == 64);
  
  struct X gx;
  
  void f() {
  g(1, gx);
  }

Note that when compiling this as is GCC does _not_ align X when calling g(). 
But, as of this change, now clang does. If you uncomment either the __m128 or 
alignedint lines, and now GCC aligns to 64 bytes too.

This is because GCC's algorithm is a whole lot more complex than what you've 
implemented. See its function ix86_function_arg_boundary.

The way I interpret GCC, it's doing effectively the following:
StackAlignmentForType(T):

1. If T's alignment is < 16 bytes, return 4.
2. If T is a struct/union/array type, then:
  - recursively call StackAlignmentForType() on each member's type (note -- 
this ignores any attribute((aligned(N))) directly on the //fields// of a 
struct, but not those that appear on typedefs, or the underlying types).
  - If all of those calls return alignments < 16, then return 4.
3. Otherwise, return the alignment of T.


Repository:
  rC Clang

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

https://reviews.llvm.org/D60748



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


r362113 - [Docs] Modernize references to macOS

2019-05-30 Thread J. Ryan Stinnett via cfe-commits
Author: jryans
Date: Thu May 30 09:46:22 2019
New Revision: 362113

URL: http://llvm.org/viewvc/llvm-project?rev=362113&view=rev
Log:
[Docs] Modernize references to macOS

Summary:
This updates all places in documentation that refer to "Mac OS X", "OS X", etc.
to instead use the modern name "macOS" when no specific version number is
mentioned.

If a specific version is mentioned, this attempts to use the OS name at the time
of that version:

* Mac OS X for 10.0 - 10.7
* OS X for 10.8 - 10.11
* macOS for 10.12 - present

Reviewers: JDevlieghere

Subscribers: mgorny, christof, arphaman, cfe-commits, lldb-commits, 
libcxx-commits, llvm-commits

Tags: #clang, #lldb, #libc, #llvm

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

Modified:
cfe/trunk/docs/AddressSanitizer.rst
cfe/trunk/docs/AutomaticReferenceCounting.rst
cfe/trunk/docs/ClangCommandLineReference.rst
cfe/trunk/docs/CommandGuide/clang.rst
cfe/trunk/docs/LeakSanitizer.rst
cfe/trunk/docs/Modules.rst
cfe/trunk/docs/SafeStack.rst
cfe/trunk/docs/UndefinedBehaviorSanitizer.rst
cfe/trunk/docs/UsersManual.rst
cfe/trunk/docs/analyzer/checkers.rst
cfe/trunk/docs/analyzer/developer-docs/DebugChecks.rst

Modified: cfe/trunk/docs/AddressSanitizer.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/AddressSanitizer.rst?rev=362113&r1=362112&r2=362113&view=diff
==
--- cfe/trunk/docs/AddressSanitizer.rst (original)
+++ cfe/trunk/docs/AddressSanitizer.rst Thu May 30 09:46:22 2019
@@ -119,7 +119,7 @@ force disabled by setting ``ASAN_OPTIONS
 #1 0x7f7ddabcac4d in __libc_start_main ??:0
 ...
 
-Note that on OS X you may need to run ``dsymutil`` on your binary to have the
+Note that on macOS you may need to run ``dsymutil`` on your binary to have the
 file\:line info in the AddressSanitizer reports.
 
 Additional Checks
@@ -134,14 +134,14 @@ globals defined in another translation u
 you should set environment variable
 ``ASAN_OPTIONS=check_initialization_order=1``.
 
-Note that this option is not supported on OS X.
+Note that this option is not supported on macOS.
 
 Memory leak detection
 -
 
 For more information on leak detector in AddressSanitizer, see
 :doc:`LeakSanitizer`. The leak detection is turned on by default on Linux,
-and can be enabled using ``ASAN_OPTIONS=detect_leaks=1`` on OS X;
+and can be enabled using ``ASAN_OPTIONS=detect_leaks=1`` on macOS;
 however, it is not yet supported on other platforms.
 
 Issue Suppression
@@ -273,7 +273,7 @@ Supported Platforms
 AddressSanitizer is supported on:
 
 * Linux i386/x86\_64 (tested on Ubuntu 12.04)
-* OS X 10.7 - 10.11 (i386/x86\_64)
+* macOS 10.7 - 10.11 (i386/x86\_64)
 * iOS Simulator
 * Android ARM
 * NetBSD i386/x86\_64

Modified: cfe/trunk/docs/AutomaticReferenceCounting.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/AutomaticReferenceCounting.rst?rev=362113&r1=362112&r2=362113&view=diff
==
--- cfe/trunk/docs/AutomaticReferenceCounting.rst (original)
+++ cfe/trunk/docs/AutomaticReferenceCounting.rst Thu May 30 09:46:22 2019
@@ -268,7 +268,7 @@ ARC's semantics and restrictions.
   * There must be reliable conventions for whether and when "ownership" is
 passed between caller and callee, for both arguments and return values.
 Objective-C methods follow such a convention very reliably, at least for
-system libraries on Mac OS X, and functions always pass objects at +0.  The
+system libraries on macOS, and functions always pass objects at +0.  The
 C-based APIs for Core Foundation objects, on the other hand, have much more
 varied transfer semantics.
 

Modified: cfe/trunk/docs/ClangCommandLineReference.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=362113&r1=362112&r2=362113&view=diff
==
--- cfe/trunk/docs/ClangCommandLineReference.rst (original)
+++ cfe/trunk/docs/ClangCommandLineReference.rst Thu May 30 09:46:22 2019
@@ -2218,7 +2218,7 @@ Generate branches with extended addressa
 
 .. option:: -mmacosx-version-min=, -mmacos-version-min=
 
-Set Mac OS X deployment target
+Set macOS deployment target
 
 .. option:: -mmcu=
 

Modified: cfe/trunk/docs/CommandGuide/clang.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/CommandGuide/clang.rst?rev=362113&r1=362112&r2=362113&view=diff
==
--- cfe/trunk/docs/CommandGuide/clang.rst (original)
+++ cfe/trunk/docs/CommandGuide/clang.rst Thu May 30 09:46:22 2019
@@ -316,7 +316,7 @@ number of cross compilers, or may only s
 
 .. option:: -mmacosx-version-min=
 
-  When building for Mac OS X, specify the minimum version supported by your
+  When building for macOS, specify the minimum vers

[libunwind] r362113 - [Docs] Modernize references to macOS

2019-05-30 Thread J. Ryan Stinnett via cfe-commits
Author: jryans
Date: Thu May 30 09:46:22 2019
New Revision: 362113

URL: http://llvm.org/viewvc/llvm-project?rev=362113&view=rev
Log:
[Docs] Modernize references to macOS

Summary:
This updates all places in documentation that refer to "Mac OS X", "OS X", etc.
to instead use the modern name "macOS" when no specific version number is
mentioned.

If a specific version is mentioned, this attempts to use the OS name at the time
of that version:

* Mac OS X for 10.0 - 10.7
* OS X for 10.8 - 10.11
* macOS for 10.12 - present

Reviewers: JDevlieghere

Subscribers: mgorny, christof, arphaman, cfe-commits, lldb-commits, 
libcxx-commits, llvm-commits

Tags: #clang, #lldb, #libc, #llvm

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

Modified:
libunwind/trunk/docs/index.rst

Modified: libunwind/trunk/docs/index.rst
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/docs/index.rst?rev=362113&r1=362112&r2=362113&view=diff
==
--- libunwind/trunk/docs/index.rst (original)
+++ libunwind/trunk/docs/index.rst Thu May 30 09:46:22 2019
@@ -50,7 +50,7 @@ FreeBSD  i386, x86_64, ARM64  Cl
 iOS  ARM  ClangSjLj
 LinuxARM  Clang, GCC   EHABI
 Linuxi386, x86_64, ARM64  Clang, GCC   DWARF CFI
-Mac OS X i386, x86_64 Clang, GCC   DWARF CFI
+macOSi386, x86_64 Clang, GCC   DWARF CFI
 NetBSD   x86_64   Clang, GCC   DWARF CFI
 Windows  i386, x86_64, ARM, ARM64 ClangDWARF CFI
    


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


[PATCH] D62690: Modify StepsLeft counter behaivior for constexprs

2019-05-30 Thread wasiher via Phabricator via cfe-commits
wasiher created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

When I was trying to remove limits from constexpr steps (I wanted to give 
compiler as much time as it it needs), I  found -fconstexpr-steps option.
Naively i decided that -fconstexpr-steps=-1 is the best solution for this, 
because clang worked fine with my big constexpr function, and was not stopping. 
But when I checked source code, I understood that it is integer overflow, and 
compilation will stop  with error some day even if I will try to compile 
"while(1);" like code.

In the source code step limit is accesed as signed interger:
Opts.ConstexprStepLimit = getLastArgIntValue(Args, OPT_fconstexpr_steps, 
1048576, Diags);

But later unsigned variable StepsLeft based on ConstexprStepLimit used as 
counter.

So maybe it will be better to make StepsLeft signed int?
In the negative case StepsLeft decrement will be disabled.

I also thought about making zero value to have same behavior, but such behavior 
was not declared anywhere before, and zero value probably can be used by 
someone as disabler of constexpr for example. But in the current implementation 
of clang negative value is not prohibited, but usage probably would not produce 
right expectation for user.


Repository:
  rC Clang

https://reviews.llvm.org/D62690

Files:
  clang/lib/AST/ExprConstant.cpp


Index: clang/lib/AST/ExprConstant.cpp
===
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -721,7 +721,7 @@
 /// StepsLeft - The remaining number of evaluation steps we're permitted
 /// to perform. This is essentially a limit for the number of statements
 /// we will evaluate.
-unsigned StepsLeft;
+int StepsLeft;
 
 /// BottomFrame - The frame in which evaluation started. This must be
 /// initialized after CurrentCall and CallStackDepth.
@@ -898,7 +898,8 @@
 FFDiag(S->getBeginLoc(), diag::note_constexpr_step_limit_exceeded);
 return false;
   }
-  --StepsLeft;
+  if (StepsLeft > 0)
+--StepsLeft;
   return true;
 }
 


Index: clang/lib/AST/ExprConstant.cpp
===
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -721,7 +721,7 @@
 /// StepsLeft - The remaining number of evaluation steps we're permitted
 /// to perform. This is essentially a limit for the number of statements
 /// we will evaluate.
-unsigned StepsLeft;
+int StepsLeft;
 
 /// BottomFrame - The frame in which evaluation started. This must be
 /// initialized after CurrentCall and CallStackDepth.
@@ -898,7 +898,8 @@
 FFDiag(S->getBeginLoc(), diag::note_constexpr_step_limit_exceeded);
 return false;
   }
-  --StepsLeft;
+  if (StepsLeft > 0)
+--StepsLeft;
   return true;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62435: Add Attribute NoThrow as an Exception Specifier Type

2019-05-30 Thread Erich Keane via Phabricator via cfe-commits
erichkeane marked 6 inline comments as done.
erichkeane added inline comments.



Comment at: clang/include/clang/Sema/DeclSpec.h:1547
 
+  bool hasAttr(ParsedAttr::Kind Kind) const {
+return llvm::find_if(getAttrs(), [Kind](const ParsedAttr &P) {

aaron.ballman wrote:
> Not that I dislike this, but is this function being used? It seems to be the 
> only `hasAttr` in the review.
Woops, likely a leftover from a previous iteration, removing it!



Comment at: clang/lib/Sema/SemaType.cpp:6971
+  switch (Proto->getExceptionSpecType()) {
+  case EST_None: llvm_unreachable("This doesn't have an exception spec!");
+  case EST_DynamicNone:

aaron.ballman wrote:
> Will this need a fallthrough attribute because of the statement between the 
> labels?
Ah, I think it depends on what llvm_unreachable ends up expanding to (actually, 
LLVM_ATTRIBUTE_NORETURN). 

Basically, here: https://llvm.org/doxygen/Support_2ErrorHandling_8h_source.html

I'm not sure of what compilers has that expand to nothing don't support it 
(would need !def __GNUC__ and !def _MSC_VER), but an LLVM_FALLTHROUGH is easy 
enough to add, thanks!


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

https://reviews.llvm.org/D62435



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


r362119 - Add Attribute NoThrow as an Exception Specifier Type

2019-05-30 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Thu May 30 10:31:54 2019
New Revision: 362119

URL: http://llvm.org/viewvc/llvm-project?rev=362119&view=rev
Log:
Add Attribute NoThrow as an Exception Specifier Type

In response to https://bugs.llvm.org/show_bug.cgi?id=33235, it became
clear that the current mechanism of hacking through checks for the
exception specification of a function gets confused really quickly when
there are alternate exception specifiers.

This patch introcues EST_NoThrow, which is the equivilent of
EST_noexcept when caused by EST_noThrow. The existing implementation is
left in place to cover functions with no FunctionProtoType.

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

Added:
cfe/trunk/test/SemaCXX/nothrow-vs-exception-specs.cpp   (with props)
Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/ExceptionSpecificationType.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/JSONNodeDumper.cpp
cfe/trunk/lib/AST/Type.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/tools/libclang/CXType.cpp

Modified: cfe/trunk/include/clang-c/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=362119&r1=362118&r2=362119&view=diff
==
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Thu May 30 10:31:54 2019
@@ -32,7 +32,7 @@
  * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable.
  */
 #define CINDEX_VERSION_MAJOR 0
-#define CINDEX_VERSION_MINOR 57
+#define CINDEX_VERSION_MINOR 58
 
 #define CINDEX_VERSION_ENCODE(major, minor) ( \
   ((major) * 1)   \
@@ -221,7 +221,12 @@ enum CXCursor_ExceptionSpecificationKind
   /**
* The exception specification has not been parsed yet.
*/
-  CXCursor_ExceptionSpecificationKind_Unparsed
+  CXCursor_ExceptionSpecificationKind_Unparsed,
+
+  /**
+   * The cursor has a __declspec(nothrow) exception specification.
+   */
+  CXCursor_ExceptionSpecificationKind_NoThrow
 };
 
 /**

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=362119&r1=362118&r2=362119&view=diff
==
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Thu May 30 10:31:54 2019
@@ -2330,6 +2330,14 @@ public:
 return T->castAs()->getReturnType();
   }
 
+  /// Gets the ExceptionSpecificationType as declared.
+  ExceptionSpecificationType getExceptionSpecType() const {
+auto *TSI = getTypeSourceInfo();
+QualType T = TSI ? TSI->getType() : getType();
+const auto *FPT = T->getAs();
+return FPT ? FPT->getExceptionSpecType() : EST_None;
+  }
+
   /// Attempt to compute an informative source range covering the
   /// function exception specification, if any.
   SourceRange getExceptionSpecSourceRange() const;

Modified: cfe/trunk/include/clang/AST/Type.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=362119&r1=362118&r2=362119&view=diff
==
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Thu May 30 10:31:54 2019
@@ -3855,6 +3855,7 @@ private:
 case EST_MSAny:
 case EST_BasicNoexcept:
 case EST_Unparsed:
+case EST_NoThrow:
   return {0, 0, 0};
 
 case EST_Dynamic:

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=362119&r1=362118&r2=362119&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu May 30 10:31:54 
2019
@@ -2792,6 +2792,9 @@ def warn_dllimport_dropped_from_inline_f
   InGroup;
 def warn_attribute_ignored : Warning<"%0 attribute ignored">,
   InGroup;
+def warn_nothrow_attribute_ignored : Warning<"'nothrow' attribute conflicts 
with"
+  " exception specification; attribute ignored">,
+  InGroup;
 def warn_attribute_ignored_on_inline :
   Warning<"%0 attribute ignored on inline function">,
   InGroup;

Modified: cfe/trunk/include/clang/Basic/ExceptionSpecificationType.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/ExceptionSpecificationType.h?rev=362119&r1=362118&r2=362119&view=diff
==
--- cfe/trunk/include/clang/Basic/ExceptionSpecificationType.h (original)
+++ cfe/tr

[PATCH] D61923: [GWP-ASan] Mutex implementation [2].

2019-05-30 Thread Mitch Phillips via Phabricator via cfe-commits
hctim updated this revision to Diff 202237.
hctim marked 7 inline comments as done.
hctim added a comment.

- Updated from Matt's comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61923

Files:
  clang/runtime/CMakeLists.txt
  compiler-rt/lib/gwp_asan/CMakeLists.txt
  compiler-rt/lib/gwp_asan/mutex.h
  compiler-rt/lib/gwp_asan/platform_specific/mutex_posix.cpp
  compiler-rt/lib/gwp_asan/tests/CMakeLists.txt
  compiler-rt/lib/gwp_asan/tests/driver.cpp
  compiler-rt/lib/gwp_asan/tests/mutex_test.cpp
  compiler-rt/test/gwp_asan/CMakeLists.txt
  compiler-rt/test/gwp_asan/dummy_test.cc
  compiler-rt/test/gwp_asan/lit.cfg
  compiler-rt/test/gwp_asan/lit.site.cfg.in
  compiler-rt/test/gwp_asan/unit/lit.site.cfg.in

Index: compiler-rt/test/gwp_asan/unit/lit.site.cfg.in
===
--- /dev/null
+++ compiler-rt/test/gwp_asan/unit/lit.site.cfg.in
@@ -0,0 +1,9 @@
+@LIT_SITE_CFG_IN_HEADER@
+
+config.name = "GwpAsan-Unittest"
+# Load common config for all compiler-rt unit tests.
+lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/unittests/lit.common.unit.configured")
+
+config.test_exec_root = os.path.join("@COMPILER_RT_BINARY_DIR@",
+ "lib", "gwp_asan", "tests")
+config.test_source_root = config.test_exec_root
Index: compiler-rt/test/gwp_asan/lit.site.cfg.in
===
--- /dev/null
+++ compiler-rt/test/gwp_asan/lit.site.cfg.in
@@ -0,0 +1,11 @@
+@LIT_SITE_CFG_IN_HEADER@
+
+config.name_suffix = "@GWP_ASAN_TEST_CONFIG_SUFFIX@"
+config.target_arch = "@GWP_ASAN_TEST_TARGET_ARCH@"
+config.target_cflags = "@GWP_ASAN_TEST_TARGET_CFLAGS@"
+
+# Load common config for all compiler-rt lit tests.
+lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
+
+# Load tool-specific config that would do the real work.
+lit_config.load_config(config, "@GWP_ASAN_LIT_SOURCE_DIR@/lit.cfg")
Index: compiler-rt/test/gwp_asan/lit.cfg
===
--- /dev/null
+++ compiler-rt/test/gwp_asan/lit.cfg
@@ -0,0 +1,31 @@
+# -*- Python -*-
+
+import os
+
+# Setup config name.
+config.name = 'GWP-ASan' + config.name_suffix
+
+# Setup source root.
+config.test_source_root = os.path.dirname(__file__)
+
+# Test suffixes.
+config.suffixes = ['.c', '.cc', '.cpp', '.test']
+
+# C & CXX flags.
+c_flags = ([config.target_cflags])
+
+# Android doesn't want -lrt.
+if not config.android:
+  c_flags += ["-lrt"]
+
+cxx_flags = (c_flags + config.cxx_mode_flags + ["-std=c++11"])
+
+def build_invocation(compile_flags):
+  return " " + " ".join([config.clang] + compile_flags) + " "
+
+# Add substitutions.
+config.substitutions.append(("%clang ", build_invocation(c_flags)))
+
+# GWP-ASan tests are currently supported on Linux only.
+if config.host_os not in ['Linux']:
+   config.unsupported = True
Index: compiler-rt/test/gwp_asan/dummy_test.cc
===
--- /dev/null
+++ compiler-rt/test/gwp_asan/dummy_test.cc
@@ -0,0 +1,4 @@
+// Exists to simply stop warnings about lit not discovering any tests here.
+// RUN: %clang %s
+
+int main() { return 0; }
Index: compiler-rt/test/gwp_asan/CMakeLists.txt
===
--- compiler-rt/test/gwp_asan/CMakeLists.txt
+++ compiler-rt/test/gwp_asan/CMakeLists.txt
@@ -0,0 +1,45 @@
+set(GWP_ASAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+set(GWP_ASAN_LIT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+
+set(GWP_ASAN_TESTSUITES)
+
+set(GWP_ASAN_UNITTEST_DEPS)
+set(GWP_ASAN_TEST_DEPS
+  ${SANITIZER_COMMON_LIT_TEST_DEPS}
+  gwp_asan)
+
+if (COMPILER_RT_INCLUDE_TESTS)
+  list(APPEND GWP_ASAN_TEST_DEPS GwpAsanUnitTests)
+  configure_lit_site_cfg(
+${CMAKE_CURRENT_SOURCE_DIR}/unit/lit.site.cfg.in
+${CMAKE_CURRENT_BINARY_DIR}/unit/lit.site.cfg)
+  add_lit_testsuite(check-gwp_asan-unit "Running GWP-ASan unit tests"
+${CMAKE_CURRENT_BINARY_DIR}/unit
+DEPENDS ${GWP_ASAN_TEST_DEPS})
+  set_target_properties(check-gwp_asan-unit PROPERTIES FOLDER
+"Compiler-RT Tests")
+list(APPEND GWP_ASAN_TEST_DEPS check-gwp_asan-unit)
+endif()
+
+configure_lit_site_cfg(
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+  )
+
+foreach(arch ${GWP_ASAN_SUPPORTED_ARCH})
+  set(GWP_ASAN_TEST_TARGET_ARCH ${arch})
+  string(TOLOWER "-${arch}" GWP_ASAN_TEST_CONFIG_SUFFIX)
+  get_test_cc_for_arch(${arch} GWP_ASAN_TEST_TARGET_CC GWP_ASAN_TEST_TARGET_CFLAGS)
+  string(TOUPPER ${arch} ARCH_UPPER_CASE)
+  set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config)
+
+  configure_lit_site_cfg(
+${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
+${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg)
+  list(APPEND GWP_ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
+endforeach

[PATCH] D61923: [GWP-ASan] Mutex implementation [2].

2019-05-30 Thread Mitch Phillips via Phabricator via cfe-commits
hctim added inline comments.



Comment at: compiler-rt/lib/gwp_asan/tests/driver.cpp:14
+  return RUN_ALL_TESTS();
+}

morehouse wrote:
> hctim wrote:
> > morehouse wrote:
> > > Can we just link with gtest_main instead of having this?
> > Unfortunately not easily. `generate_compiler_rt_tests` builds each test cpp 
> > file individually, and provides no way to add `gtest_main` only during link 
> > time. 
> Then how does this driver.cpp get included in each unit test?
> 
> Maybe we should put the `main` in each test as is usually done.
Basically what happens:
```
for x in *.cpp;
  do clang++ $x -o $x.o
done
clang++ *.o -o GwpAsanUnitTests
```

The unittests are all packaged together into a single binary. Also, AFAIK, 
compiler-rt all has a single `main()` driver for unittests (at least 
ASan+MSan+Scudo do this).



Comment at: compiler-rt/lib/gwp_asan/tests/mutex_test.cpp:102
+TEST(GwpAsanMutexTest, ThrashTests) {
+  runThrashTest(2, 1);
+  runThrashTest(4, 1);

morehouse wrote:
> morehouse wrote:
> > This test case seems to test a superset of ThreadedConstructionTest, so do 
> > we really need that one?
> This test case seems to test a superset of ThreadedConstructionTest, so do we 
> really need that one?
Deleted ThreadedLockUnlockTest.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61923



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


[PATCH] D62693: Support codesigning bundles and forcing

2019-05-30 Thread Chris Bieneman via Phabricator via cfe-commits
beanz created this revision.
beanz added reviewers: jkorous, bogner.
Herald added subscribers: kadircet, arphaman, dexonsmith, ilya-biryukov, mgorny.
Herald added projects: clang, LLVM.

Clangd's framework is assembled by copying binaries from the lib and bin 
directories into a bundle shape. This results in an invalid bundle code 
signature because the signature only applies to the binaries not the resources.

This patch adds two new options to `llvm_codesign` to enable re-signing the 
library and XPC service as bundles.

The `BUNDLE_PATH` option allow specifying an explicit path to codesign, which 
enables signing bundles which aren't generated using CMake's `FRAMEWORK` or 
`BUNDLE` target properties.

The `FORCE` option allows re-signing binaries that have already been signed. 
This is required for how clangd exposes the clangd library and tools as both 
XPC and non-XPC services using the same binary.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62693

Files:
  clang-tools-extra/clangd/xpc/cmake/modules/CreateClangdXPCFramework.cmake
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1659,9 +1659,9 @@
   endif()
 endfunction()
 
-# Usage: llvm_codesign(name [ENTITLEMENTS file])
+# Usage: llvm_codesign(name [FORCE] [ENTITLEMENTS file] [BUNDLE_PATH path])
 function(llvm_codesign name)
-  cmake_parse_arguments(ARG "" "ENTITLEMENTS" "" ${ARGN})
+  cmake_parse_arguments(ARG "FORCE" "ENTITLEMENTS;BUNDLE_PATH" "" ${ARGN})
 
   if(NOT LLVM_CODESIGNING_IDENTITY)
 return()
@@ -1691,12 +1691,20 @@
   set(pass_entitlements --entitlements ${ARG_ENTITLEMENTS})
 endif()
 
+if (NOT ARG_BUNDLE_PATH)
+  set(ARG_BUNDLE_PATH $)
+endif()
+
+if(ARG_FORCE)
+  set(force_flag "-f")
+endif()
+
 add_custom_command(
   TARGET ${name} POST_BUILD
   COMMAND ${CMAKE_COMMAND} -E
   env CODESIGN_ALLOCATE=${CMAKE_CODESIGN_ALLOCATE}
   ${CMAKE_CODESIGN} -s ${LLVM_CODESIGNING_IDENTITY}
-  ${pass_entitlements} $
+  ${pass_entitlements} ${force_flag} ${ARG_BUNDLE_PATH}
 )
   endif()
 endfunction()
Index: clang-tools-extra/clangd/xpc/cmake/modules/CreateClangdXPCFramework.cmake
===
--- clang-tools-extra/clangd/xpc/cmake/modules/CreateClangdXPCFramework.cmake
+++ clang-tools-extra/clangd/xpc/cmake/modules/CreateClangdXPCFramework.cmake
@@ -70,4 +70,9 @@
 ${target}
 ${CLANGD_FRAMEWORK_LOCATION}
   )
+
+  # clangd is already signed as a standalone executable, so it must be forced.
+  llvm_codesign(ClangdXPC BUNDLE_PATH 
"${CLANGD_FRAMEWORK_OUT_LOCATION}/XPCServices/${CLANGD_XPC_SERVICE_NAME}.xpc/" 
FORCE)
+  # ClangdXPC library is already signed as a standalone library, so it must be 
forced.
+  llvm_codesign(ClangdXPC BUNDLE_PATH "${CLANGD_FRAMEWORK_LOCATION}" FORCE)
 endmacro(create_clangd_xpc_framework)


Index: llvm/cmake/modules/AddLLVM.cmake
===
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1659,9 +1659,9 @@
   endif()
 endfunction()
 
-# Usage: llvm_codesign(name [ENTITLEMENTS file])
+# Usage: llvm_codesign(name [FORCE] [ENTITLEMENTS file] [BUNDLE_PATH path])
 function(llvm_codesign name)
-  cmake_parse_arguments(ARG "" "ENTITLEMENTS" "" ${ARGN})
+  cmake_parse_arguments(ARG "FORCE" "ENTITLEMENTS;BUNDLE_PATH" "" ${ARGN})
 
   if(NOT LLVM_CODESIGNING_IDENTITY)
 return()
@@ -1691,12 +1691,20 @@
   set(pass_entitlements --entitlements ${ARG_ENTITLEMENTS})
 endif()
 
+if (NOT ARG_BUNDLE_PATH)
+  set(ARG_BUNDLE_PATH $)
+endif()
+
+if(ARG_FORCE)
+  set(force_flag "-f")
+endif()
+
 add_custom_command(
   TARGET ${name} POST_BUILD
   COMMAND ${CMAKE_COMMAND} -E
   env CODESIGN_ALLOCATE=${CMAKE_CODESIGN_ALLOCATE}
   ${CMAKE_CODESIGN} -s ${LLVM_CODESIGNING_IDENTITY}
-  ${pass_entitlements} $
+  ${pass_entitlements} ${force_flag} ${ARG_BUNDLE_PATH}
 )
   endif()
 endfunction()
Index: clang-tools-extra/clangd/xpc/cmake/modules/CreateClangdXPCFramework.cmake
===
--- clang-tools-extra/clangd/xpc/cmake/modules/CreateClangdXPCFramework.cmake
+++ clang-tools-extra/clangd/xpc/cmake/modules/CreateClangdXPCFramework.cmake
@@ -70,4 +70,9 @@
 ${target}
 ${CLANGD_FRAMEWORK_LOCATION}
   )
+
+  # clangd is already signed as a standalone executable, so it must be forced.
+  llvm_codesign(ClangdXPC BUNDLE_PATH "${CLANGD_FRAMEWORK_OUT_LOCATION}/XPCServices/${CLANGD_XPC_SERVICE_NAME}.xpc/" FORCE)
+  # ClangdXPC library is already signed as a standalone library, so it must be forced.
+  llvm_codesign(ClangdXPC BUNDLE_PATH "${CLANGD_FRAMEWORK_LOC

[PATCH] D60455: [SYCL] Implement SYCL device code outlining

2019-05-30 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added inline comments.



Comment at: clang/include/clang/Basic/Attr.td:1017
+  let LangOpts = [SYCL];
+  let Documentation = [Undocumented];
+}

Undocumented -> SYCLKernelDocs



Comment at: clang/include/clang/Basic/AttrDocs.td:269
+
+  using namespace cl::sycl;
+  queue Q;

The example doesn't demonstrate the use of the attribute.

It explains how it is used by the toolchain only!

May be @aaron.ballman can help here as I am not sure what the format should be.



Comment at: clang/lib/Parse/ParseAST.cpp:171
 
+  if (S.getLangOpts().SYCLIsDevice) {
+for (Decl *D : S.SyclDeviceFuncs()) {

Do you also need to prevent generation of non-device functions somehow?



Comment at: clang/lib/Sema/SemaSYCL.cpp:23
+
+  bool VisitCallExpr(CallExpr *e) {
+if (FunctionDecl *Callee = e->getDirectCallee()) {

Anastasia wrote:
> bader wrote:
> > Anastasia wrote:
> > > This is probably not something we can change at this point but I wish we 
> > > could avoid complexities like this. :(
> > > 
> > > I think this is also preventing traditional linking of translation units. 
> > > That is somewhat unfortunate.
> > > 
> > > It is good direction however to keep this logic in a separate dedicated 
> > > compilation unit.
> > > 
> > > I would suggest to document it a bit more including any current 
> > > limitations/assumption that you can mark under FIXME i.e. does your code 
> > > handle lambdas yet, what if lambdas are used in function parameters, 
> > > etc...
> > > I think this is also preventing traditional linking of translation units.
> > 
> > Could you elaborate more on this topic, please?
> > What do you mean by "traditional linking of translation units" and what 
> > exactly "is preventing" it?
> > Do you compare with the linking of regular C++ code (i.e. which do not 
> > split into host and device code)?
> > If so, SYCL is different from this model and more similar to CUDA/OpenMP 
> > models, which also skip "linking" of irrelevant part (e.g. host code is not 
> > linked by the device compiler).
> > Mariya added Justin (@jlebar) and Alexey (@ABataev), who work on 
> > single-source programming models to make them aware and provide feedback if 
> > any.
> Yes indeed, I mean linking of modules in C/C++ even though it doesn't 
> necessarily mean linking of object files. So you don't plan to support 
> `SYCL_EXTERNAL` in clang?
> 
> In CUDA the functions executed on device are annotated manually using 
> `__device__` hence separate translation units can specify external device 
> function... although I don't know if CUDA implementation in clang support 
> this.
> 
> I guess OpenMP is allowed to fall back to run on host?
Ping!



> I would suggest to document it a bit more including any current 
> limitations/assumption that you can mark under FIXME i.e. does your code 
> handle lambdas yet, what if lambdas are used in function parameters, etc...





Comment at: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:5520
 DefinitionRequired, true);
-  if (CurFD->isDefined())
+  if (CurFD->isDefined()) {
+// Because all SYCL kernel functions are template functions - 
they

May be this should go into a helper function as it seems to be now a bigger 
chunk of code that is repeated?

Although, I am not very familiar with this code. You can try to get someone to 
review who has contributed to this more recently.



Comment at: clang/test/CodeGenSYCL/device-functions.cpp:24
+}
+// CHECK: define spir_func void @{{.*}}foo
+// CHECK: define linkonce_odr spir_func i32 @{{.*}}bar

I can't see where the SPIR calling convention is currently set for SYCL?



Comment at: clang/test/SemaSYCL/device-attributes-on-non-sycl.cpp:3
+// Now pretend that we're compiling regular C++ file without SYCL mode enabled.
+// There should be warnings.
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -x c++ %s

I don't think this comment is necessary.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D60455



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


[PATCH] D62693: Support codesigning bundles and forcing

2019-05-30 Thread Justin Bogner via Phabricator via cfe-commits
bogner accepted this revision.
bogner added a comment.
This revision is now accepted and ready to land.

Seems straightforward enough


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62693



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


[PATCH] D62550: [coroutines][PR41909] Don't build dependent coroutine statements for generic lambda

2019-05-30 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov accepted this revision.
GorNishanov added a comment.
This revision is now accepted and ready to land.

LGTM! Thank you for the fix


Repository:
  rC Clang

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

https://reviews.llvm.org/D62550



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


[PATCH] D62657: [OpenCL] Fix OpenCL/SPIR version metadata

2019-05-30 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC362102: [OpenCL] Fix OpenCL/SPIR version metadata in C++ 
mode. (authored by stulova, committed by ).
Herald added a project: clang.

Changed prior to commit:
  https://reviews.llvm.org/D62657?vs=202169&id=202241#toc

Repository:
  rC Clang

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

https://reviews.llvm.org/D62657

Files:
  lib/CodeGen/CodeGenModule.cpp
  test/CodeGenOpenCL/spir_version.cl


Index: test/CodeGenOpenCL/spir_version.cl
===
--- test/CodeGenOpenCL/spir_version.cl
+++ test/CodeGenOpenCL/spir_version.cl
@@ -5,6 +5,9 @@
 // RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - 
-cl-std=CL1.2 | FileCheck %s --check-prefix=CHECK-SPIR-CL12
 // RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - 
-cl-std=CL2.0 | FileCheck %s --check-prefix=CHECK-SPIR-CL20
 
+
+// RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - 
-cl-std=c++ | FileCheck %s --check-prefix=CHECK-SPIR-CL20
+
 // RUN: %clang_cc1 %s -triple "amdgcn--amdhsa" -emit-llvm -o - | FileCheck %s 
--check-prefix=CHECK-AMDGCN-CL10
 // RUN: %clang_cc1 %s -triple "amdgcn--amdhsa" -emit-llvm -o - -cl-std=CL1.2 | 
FileCheck %s --check-prefix=CHECK-AMDGCN-CL12
 // RUN: %clang_cc1 %s -triple "amdgcn--amdhsa" -emit-llvm -o - -cl-std=CL2.0 | 
FileCheck %s --check-prefix=CHECK-AMDGCN-CL20
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -564,11 +564,13 @@
 if (getTriple().isSPIR()) {
   // SPIR v2.0 s2.12 - The SPIR version used by the module is stored in the
   // opencl.spir.version named metadata.
+  // C++ is backwards compatible with OpenCL v2.0.
+  auto Version = LangOpts.OpenCLCPlusPlus ? 200 : LangOpts.OpenCLVersion;
   llvm::Metadata *SPIRVerElts[] = {
   llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
-  Int32Ty, LangOpts.OpenCLVersion / 100)),
+  Int32Ty, Version / 100)),
   llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
-  Int32Ty, (LangOpts.OpenCLVersion / 100 > 1) ? 0 : 2))};
+  Int32Ty, (Version / 100 > 1) ? 0 : 2))};
   llvm::NamedMDNode *SPIRVerMD =
   TheModule.getOrInsertNamedMetadata("opencl.spir.version");
   llvm::LLVMContext &Ctx = TheModule.getContext();
@@ -623,11 +625,14 @@
 void CodeGenModule::EmitOpenCLMetadata() {
   // SPIR v2.0 s2.13 - The OpenCL version used by the module is stored in the
   // opencl.ocl.version named metadata node.
+  // C++ is backwards compatible with OpenCL v2.0.
+  // FIXME: We might need to add CXX version at some point too?
+  auto Version = LangOpts.OpenCLCPlusPlus ? 200 : LangOpts.OpenCLVersion;
   llvm::Metadata *OCLVerElts[] = {
   llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
-  Int32Ty, LangOpts.OpenCLVersion / 100)),
+  Int32Ty, Version / 100)),
   llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
-  Int32Ty, (LangOpts.OpenCLVersion % 100) / 10))};
+  Int32Ty, (Version % 100) / 10))};
   llvm::NamedMDNode *OCLVerMD =
   TheModule.getOrInsertNamedMetadata("opencl.ocl.version");
   llvm::LLVMContext &Ctx = TheModule.getContext();


Index: test/CodeGenOpenCL/spir_version.cl
===
--- test/CodeGenOpenCL/spir_version.cl
+++ test/CodeGenOpenCL/spir_version.cl
@@ -5,6 +5,9 @@
 // RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - -cl-std=CL1.2 | FileCheck %s --check-prefix=CHECK-SPIR-CL12
 // RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - -cl-std=CL2.0 | FileCheck %s --check-prefix=CHECK-SPIR-CL20
 
+
+// RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - -cl-std=c++ | FileCheck %s --check-prefix=CHECK-SPIR-CL20
+
 // RUN: %clang_cc1 %s -triple "amdgcn--amdhsa" -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-AMDGCN-CL10
 // RUN: %clang_cc1 %s -triple "amdgcn--amdhsa" -emit-llvm -o - -cl-std=CL1.2 | FileCheck %s --check-prefix=CHECK-AMDGCN-CL12
 // RUN: %clang_cc1 %s -triple "amdgcn--amdhsa" -emit-llvm -o - -cl-std=CL2.0 | FileCheck %s --check-prefix=CHECK-AMDGCN-CL20
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -564,11 +564,13 @@
 if (getTriple().isSPIR()) {
   // SPIR v2.0 s2.12 - The SPIR version used by the module is stored in the
   // opencl.spir.version named metadata.
+  // C++ is backwards compatible with OpenCL v2.0.
+  auto Version = LangOpts.OpenCLCPlusPlus ? 200 : LangOpts.OpenCLVersion;
   llvm::Metadata *SPIRVerElts[] = {
   llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
-

[PATCH] D62654: [Docs] Modernize references to macOS

2019-05-30 Thread J. Ryan Stinnett via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362113: [Docs] Modernize references to macOS (authored by 
jryans, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62654?vs=202161&id=202247#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62654

Files:
  cfe/trunk/docs/AddressSanitizer.rst
  cfe/trunk/docs/AutomaticReferenceCounting.rst
  cfe/trunk/docs/ClangCommandLineReference.rst
  cfe/trunk/docs/CommandGuide/clang.rst
  cfe/trunk/docs/LeakSanitizer.rst
  cfe/trunk/docs/Modules.rst
  cfe/trunk/docs/SafeStack.rst
  cfe/trunk/docs/UndefinedBehaviorSanitizer.rst
  cfe/trunk/docs/UsersManual.rst
  cfe/trunk/docs/analyzer/checkers.rst
  cfe/trunk/docs/analyzer/developer-docs/DebugChecks.rst
  libcxx/trunk/docs/BuildingLibcxx.rst
  libcxx/trunk/docs/UsingLibcxx.rst
  libcxx/trunk/docs/index.rst
  libunwind/trunk/docs/index.rst
  lld/trunk/docs/sphinx_intro.rst
  lldb/trunk/docs/lldb-gdb-remote.txt
  lldb/trunk/docs/resources/build.rst
  lldb/trunk/docs/use/remote.rst
  llvm/trunk/docs/CMake.rst
  llvm/trunk/docs/CommandGuide/llvm-ar.rst
  llvm/trunk/docs/CompilerWriterInfo.rst
  llvm/trunk/docs/DebuggingJITedCode.rst
  llvm/trunk/docs/GettingStarted.rst
  llvm/trunk/docs/ProgrammersManual.rst
  llvm/trunk/docs/TestingGuide.rst
  llvm/trunk/docs/WritingAnLLVMPass.rst

Index: libcxx/trunk/docs/index.rst
===
--- libcxx/trunk/docs/index.rst
+++ libcxx/trunk/docs/index.rst
@@ -93,7 +93,7 @@
    
 OS   Arch CompilersABI Library
    
-Mac OS X i386, x86_64 Clang, GCC   libc++abi
+macOSi386, x86_64 Clang, GCC   libc++abi
 FreeBSD 10+  i386, x86_64, ARMClang, GCC   libcxxrt, libc++abi
 Linuxi386, x86_64 Clang, GCC   libc++abi
    
Index: libcxx/trunk/docs/BuildingLibcxx.rst
===
--- libcxx/trunk/docs/BuildingLibcxx.rst
+++ libcxx/trunk/docs/BuildingLibcxx.rst
@@ -41,7 +41,7 @@
 
.. warning::
  * Replacing your systems libc++ installation could render the system non-functional.
- * Mac OS X will not boot without a valid copy of ``libc++.1.dylib`` in ``/usr/lib``.
+ * macOS will not boot without a valid copy of ``libc++.1.dylib`` in ``/usr/lib``.
 
 
 The instructions are for building libc++ on
Index: libcxx/trunk/docs/UsingLibcxx.rst
===
--- libcxx/trunk/docs/UsingLibcxx.rst
+++ libcxx/trunk/docs/UsingLibcxx.rst
@@ -15,7 +15,7 @@
 $ clang++ -stdlib=libc++ test.cpp
 $ clang++ -std=c++11 -stdlib=libc++ test.cpp
 
-On OS X and FreeBSD libc++ is the default standard library
+On macOS and FreeBSD libc++ is the default standard library
 and the ``-stdlib=libc++`` is not required.
 
 .. _alternate libcxx:
@@ -34,7 +34,7 @@
 The option ``-Wl,-rpath,/lib`` adds a runtime library
 search path. Meaning that the systems dynamic linker will look for libc++ in
 ``/lib`` whenever the program is run. Alternatively the
-environment variable ``LD_LIBRARY_PATH`` (``DYLD_LIBRARY_PATH`` on OS X) can
+environment variable ``LD_LIBRARY_PATH`` (``DYLD_LIBRARY_PATH`` on macOS) can
 be used to change the dynamic linkers search paths after a program is compiled.
 
 An example of using ``LD_LIBRARY_PATH``:
Index: lld/trunk/docs/sphinx_intro.rst
===
--- lld/trunk/docs/sphinx_intro.rst
+++ lld/trunk/docs/sphinx_intro.rst
@@ -43,8 +43,8 @@
 Use your distribution's standard package management tool to install it,
 i.e., ``apt-get install easy_install`` or ``yum install easy_install``.
 
-  Mac OS X
-All modern Mac OS X systems come with ``easy_install`` as part of the base
+  macOS
+All modern macOS systems come with ``easy_install`` as part of the base
 system.
 
   Windows
Index: llvm/trunk/docs/CMake.rst
===
--- llvm/trunk/docs/CMake.rst
+++ llvm/trunk/docs/CMake.rst
@@ -533,7 +533,7 @@
   `share/doc/llvm/ocaml-html`.
 
 **LLVM_CREATE_XCODE_TOOLCHAIN**:BOOL
-  OS X Only: If enabled CMake will generate a target named
+  macOS Only: If enabled CMake will generate a target named
   'install-xcode-toolchain'. This target will create a directory at
   $CMAKE_INSTALL_PREFIX/Toolchains containing an xctoolchain directory which can
   be used to override the default system tools.
Index: llvm/trunk/docs/DebuggingJITedCode.rst
===
--- llvm/trunk/docs/DebuggingJITedCode.rst
+++ llvm/trunk/docs/DebuggingJITedCode.rst
@@ -29,7 +29,7 

[PATCH] D62435: Add Attribute NoThrow as an Exception Specifier Type

2019-05-30 Thread Erich Keane via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
erichkeane marked 2 inline comments as done.
Closed by commit rL362119: Add Attribute NoThrow as an Exception Specifier Type 
(authored by erichkeane, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62435?vs=201673&id=202249#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62435

Files:
  cfe/trunk/include/clang-c/Index.h
  cfe/trunk/include/clang/AST/Decl.h
  cfe/trunk/include/clang/AST/Type.h
  cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
  cfe/trunk/include/clang/Basic/ExceptionSpecificationType.h
  cfe/trunk/lib/AST/ASTContext.cpp
  cfe/trunk/lib/AST/JSONNodeDumper.cpp
  cfe/trunk/lib/AST/Type.cpp
  cfe/trunk/lib/Sema/SemaDeclAttr.cpp
  cfe/trunk/lib/Sema/SemaDeclCXX.cpp
  cfe/trunk/lib/Sema/SemaExprCXX.cpp
  cfe/trunk/lib/Sema/SemaType.cpp
  cfe/trunk/test/SemaCXX/nothrow-vs-exception-specs.cpp
  cfe/trunk/tools/libclang/CXType.cpp

Index: cfe/trunk/lib/AST/Type.cpp
===
--- cfe/trunk/lib/AST/Type.cpp
+++ cfe/trunk/lib/AST/Type.cpp
@@ -3077,6 +3077,7 @@
   case EST_DynamicNone:
   case EST_BasicNoexcept:
   case EST_NoexceptTrue:
+  case EST_NoThrow:
 return CT_Cannot;
 
   case EST_None:
Index: cfe/trunk/lib/AST/JSONNodeDumper.cpp
===
--- cfe/trunk/lib/AST/JSONNodeDumper.cpp
+++ cfe/trunk/lib/AST/JSONNodeDumper.cpp
@@ -464,7 +464,9 @@
 //JOS.attributeWithCall("exceptionSpecExpr",
 //[this, E]() { Visit(E.ExceptionSpec.NoexceptExpr); });
 break;
-
+  case EST_NoThrow:
+JOS.attribute("exceptionSpec", "nothrow");
+break;
   // FIXME: I cannot find a way to trigger these cases while dumping the AST. I
   // suspect you can only run into them when executing an AST dump from within
   // the debugger, which is not a use case we worry about for the JSON dumping
Index: cfe/trunk/lib/AST/ASTContext.cpp
===
--- cfe/trunk/lib/AST/ASTContext.cpp
+++ cfe/trunk/lib/AST/ASTContext.cpp
@@ -3742,7 +3742,10 @@
 break;
   }
 
-  case EST_DynamicNone: case EST_BasicNoexcept: case EST_NoexceptTrue:
+  case EST_DynamicNone:
+  case EST_BasicNoexcept:
+  case EST_NoexceptTrue:
+  case EST_NoThrow:
 CanonicalEPI.ExceptionSpec.Type = EST_BasicNoexcept;
 break;
 
Index: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
===
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp
@@ -6853,7 +6853,8 @@
 handleNoCfCheckAttr(S, D, AL);
 break;
   case ParsedAttr::AT_NoThrow:
-handleSimpleAttribute(S, D, AL);
+if (!AL.isUsedAsTypeAttr())
+  handleSimpleAttribute(S, D, AL);
 break;
   case ParsedAttr::AT_CUDAShared:
 handleSharedAttr(S, D, AL);
Index: cfe/trunk/lib/Sema/SemaExprCXX.cpp
===
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp
@@ -6045,6 +6045,8 @@
   if (EST2 == EST_NoexceptFalse) return ESI2;
 
   // If either of them is non-throwing, the result is the other.
+  if (EST1 == EST_NoThrow) return ESI2;
+  if (EST2 == EST_NoThrow) return ESI1;
   if (EST1 == EST_DynamicNone) return ESI2;
   if (EST2 == EST_DynamicNone) return ESI1;
   if (EST1 == EST_BasicNoexcept) return ESI2;
@@ -6073,6 +6075,7 @@
   case EST_DependentNoexcept:
   case EST_NoexceptFalse:
   case EST_NoexceptTrue:
+  case EST_NoThrow:
 llvm_unreachable("handled above");
 
   case EST_Dynamic: {
Index: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
===
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp
@@ -192,6 +192,7 @@
   // If this function has a basic noexcept, it doesn't affect the outcome.
   case EST_BasicNoexcept:
   case EST_NoexceptTrue:
+  case EST_NoThrow:
 return;
   // If we're still at noexcept(true) and there's a throw() callee,
   // change to that specification.
@@ -15457,6 +15458,7 @@
   case EST_Uninstantiated:
   case EST_Unevaluated:
   case EST_BasicNoexcept:
+  case EST_NoThrow:
   case EST_DynamicNone:
   case EST_MSAny:
   case EST_None:
Index: cfe/trunk/lib/Sema/SemaType.cpp
===
--- cfe/trunk/lib/Sema/SemaType.cpp
+++ cfe/trunk/lib/Sema/SemaType.cpp
@@ -130,6 +130,7 @@
   case ParsedAttr::AT_Regparm: \
   case ParsedAttr::AT_AnyX86NoCallerSavedRegisters:\
   case ParsedAttr::AT_AnyX86NoCfCheck: \
+  case ParsedAttr::AT_NoThrow:   

r362129 - Reapply: LLVM IR: update Clang tests for byval being a typed attribute.

2019-05-30 Thread Tim Northover via cfe-commits
Author: tnorthover
Date: Thu May 30 11:49:19 2019
New Revision: 362129

URL: http://llvm.org/viewvc/llvm-project?rev=362129&view=rev
Log:
Reapply: LLVM IR: update Clang tests for byval being a typed attribute.

Since byval is now a typed attribute it gets sorted slightly differently by
LLVM when the order of attributes is being canonicalized. This updates the few
Clang tests that depend on the old order.

Clang patch is unchanged.

Modified:
cfe/trunk/test/CodeGen/aapcs-align.cpp
cfe/trunk/test/CodeGenCXX/builtin-source-location.cpp
cfe/trunk/test/CodeGenCXX/wasm-args-returns.cpp
cfe/trunk/test/CodeGenCXX/x86_64-arguments-nacl-x32.cpp
cfe/trunk/test/CodeGenOpenCL/amdgpu-abi-struct-coerce.cl
cfe/trunk/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl

Modified: cfe/trunk/test/CodeGen/aapcs-align.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/aapcs-align.cpp?rev=362129&r1=362128&r2=362129&view=diff
==
--- cfe/trunk/test/CodeGen/aapcs-align.cpp (original)
+++ cfe/trunk/test/CodeGen/aapcs-align.cpp Thu May 30 11:49:19 2019
@@ -95,8 +95,8 @@ void g4() {
   f4m(1, 2, 3, 4, 5, s);
 }
 // CHECK: define void @g4
-// CHECK: call void @f4(i32 1, %struct.SF16* byval nonnull align 8
-// CHECK: call void @f4m(i32 1, i32 2, i32 3, i32 4, i32 5, %struct.SF16* 
byval nonnull align 8
+// CHECK: call void @f4(i32 1, %struct.SF16* nonnull byval align 8
+// CHECK: call void @f4m(i32 1, i32 2, i32 3, i32 4, i32 5, %struct.SF16* 
nonnull byval align 8
 // CHECK: declare void @f4(i32, %struct.SF16* byval align 8)
 // CHECK: declare void @f4m(i32, i32, i32, i32, i32, %struct.SF16* byval align 
8)
 

Modified: cfe/trunk/test/CodeGenCXX/builtin-source-location.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/builtin-source-location.cpp?rev=362129&r1=362128&r2=362129&view=diff
==
--- cfe/trunk/test/CodeGenCXX/builtin-source-location.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/builtin-source-location.cpp Thu May 30 11:49:19 
2019
@@ -104,7 +104,7 @@ struct TestInit {
 //
 // CHECK-CTOR-GLOBAL: call void 
@_ZN15source_location7currentEjjPKcS1_(%struct.source_location* sret 
%[[TMP_ONE:[^,]*]],
 // CHECK-CTOR-GLOBAL-SAME: i32 3400, i32 {{[0-9]+}}, {{[^@]*}}@[[FILE]], 
{{[^@]*}}@[[FUNC]],
-// CHECK-CTOR-GLOBAL-NEXT: call void 
@_ZN8TestInitC1E15source_location(%struct.TestInit* @GlobalInitVal, 
%struct.source_location* {{[^%]*}}%[[TMP_ONE]])
+// CHECK-CTOR-GLOBAL-NEXT: call void 
@_ZN8TestInitC1E15source_location(%struct.TestInit* @GlobalInitVal, 
%struct.source_location* {{.*}}%[[TMP_ONE]])
 #line 3400 "GlobalInitVal.cpp"
 TestInit GlobalInitVal;
 
@@ -119,7 +119,7 @@ extern "C" void test_init_function() {
 //
 // CHECK-CTOR-LOCAL: call void 
@_ZN15source_location7currentEjjPKcS1_(%struct.source_location* sret 
%[[TMP:[^,]*]],
 // CHECK-CTOR-LOCAL-SAME: i32 3500, i32 {{[0-9]+}}, {{[^@]*}}@[[FILE]], 
{{[^@]*}}@[[FUNC]],
-// CHECK-CTOR-LOCAL-NEXT: call void 
@_ZN8TestInitC1E15source_location(%struct.TestInit* %init_local, 
%struct.source_location* {{[^%]*}}%[[TMP]])
+// CHECK-CTOR-LOCAL-NEXT: call void 
@_ZN8TestInitC1E15source_location(%struct.TestInit* %init_local, 
%struct.source_location* {{.*}}%[[TMP]])
 #line 3500 "LocalInitVal.cpp"
   TestInit init_local;
   sink(init_local);

Modified: cfe/trunk/test/CodeGenCXX/wasm-args-returns.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/wasm-args-returns.cpp?rev=362129&r1=362128&r2=362129&view=diff
==
--- cfe/trunk/test/CodeGenCXX/wasm-args-returns.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/wasm-args-returns.cpp Thu May 30 11:49:19 2019
@@ -30,12 +30,12 @@ struct two_fields {
   double d, e;
 };
 test(two_fields);
-// CHECK: define void @_Z7forward10two_fields(%struct.two_fields* noalias 
nocapture sret %{{.*}}, %struct.two_fields* byval nocapture readonly align 8 
%{{.*}})
+// CHECK: define void @_Z7forward10two_fields(%struct.two_fields* noalias 
nocapture sret %{{.*}}, %struct.two_fields* nocapture readonly byval align 8 
%{{.*}})
 //
 // CHECK: define void @_Z15test_two_fieldsv()
 // CHECK: %[[tmp:.*]] = alloca %struct.two_fields, align 8
 // CHECK: call void @_Z14def_two_fieldsv(%struct.two_fields* nonnull sret 
%[[tmp]])
-// CHECK: call void @_Z3use10two_fields(%struct.two_fields* byval nonnull 
align 8 %[[tmp]])
+// CHECK: call void @_Z3use10two_fields(%struct.two_fields* nonnull byval 
align 8 %[[tmp]])
 // CHECK: ret void
 //
 // CHECK: declare void @_Z3use10two_fields(%struct.two_fields* byval align 8)

Modified: cfe/trunk/test/CodeGenCXX/x86_64-arguments-nacl-x32.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/x86_64-arguments-nacl-x32.cpp?rev=362129&r1=362128&r2=362129&view=diff

[PATCH] D60499: [ASTImporter] Various source location and range import fixes.

2019-05-30 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik requested changes to this revision.
shafik added a comment.
This revision now requires changes to proceed.

Actually I was mistaken, we can see the difference for `EnumDecl` and 
`ClassTemplateSpecializationDecl` as well.

For `EnumDecl` before:

  EnumDecl 0x7fd0ae884800  col:6 referenced B

After:

  EnumDecl 0x7fa703882600  line:2:6 referenced B

For `ClassTemplateSpecializationDecl` before:

  ClassTemplateSpecializationDecl 0x7f8c338846a0  col:7 
class A definition

after:

  ClassTemplateSpecializationDecl 0x7fca150832a0  line:5:7 
class A definition

So once we have tests similar to D61140  I 
would feel good about this change. Especially since it is not clear when the 
other changes will be in and tests are important to guard against regressions.


Repository:
  rC Clang

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

https://reviews.llvm.org/D60499



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


[PATCH] D62665: Fix constexpr __builtin_*_overflow issue when unsigned->signed operand.

2019-05-30 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments.



Comment at: clang/lib/AST/ExprConstant.cpp:9457
+  LHS = APSInt(LHS.isSigned() ? LHS.sextOrSelf(MaxBits)
+  : LHS.zextOrSelf(MaxBits),
!IsSigned);

Can you just write `LHS = APSInt(LHS.extOrTrunc(MaxBits), !IsSigned);`, or 
something like that?  


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

https://reviews.llvm.org/D62665



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


[PATCH] D61923: [GWP-ASan] Mutex implementation [2].

2019-05-30 Thread Matt Morehouse via Phabricator via cfe-commits
morehouse accepted this revision.
morehouse 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/D61923/new/

https://reviews.llvm.org/D61923



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


[PATCH] D62665: Fix constexpr __builtin_*_overflow issue when unsigned->signed operand.

2019-05-30 Thread Erich Keane via Phabricator via cfe-commits
erichkeane marked an inline comment as done.
erichkeane added inline comments.



Comment at: clang/lib/AST/ExprConstant.cpp:9457
+  LHS = APSInt(LHS.isSigned() ? LHS.sextOrSelf(MaxBits)
+  : LHS.zextOrSelf(MaxBits),
!IsSigned);

efriedma wrote:
> Can you just write `LHS = APSInt(LHS.extOrTrunc(MaxBits), !IsSigned);`, or 
> something like that?  
I believe I can!  I was unaware of this function.


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

https://reviews.llvm.org/D62665



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


[PATCH] D62574: Initial draft of target-configurable address spaces.

2019-05-30 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

> This patch does not address the issue with the accessors
>  on Qualifiers (isAddressSpaceSupersetOf, compatiblyIncludes),
>  because I don't know how to solve it without breaking a ton of
>  rather nice encapsulation. Either, every mention of compatiblyIncludes
>  must be replaced with a call to a corresponding ASTContext method,
>  Qualifiers must have a handle to ASTContext, or ASTContext must be
>  passed to every such call. This revision mentions the issue in a comment:
>  https://reviews.llvm.org/D49294

I think using ASTContext helper is ok then.

I was just thinking about testing the new logic. Should we add something like  
`-ffake-address-space-map` 
(https://clang.llvm.org/docs/UsersManual.html#opencl-specific-options) that 
will force targets to use some implementation of fake address space 
conversions? It was quite useful in OpenCL before we added concrete targets 
with address spaces. Alternatively, we can try to use SPIR that is a generic 
Clang-only target that has address spaces.




Comment at: lib/Sema/SemaOverload.cpp:3171
+  // qualification conversion for disjoint address spaces make address space
+  // casts *work*?
   Qualifiers FromQuals = FromType.getQualifiers();

I guess if address spaces don't overlap we don't have a valid qualification 
conversion. This seems to align with the logic for cv. My guess is that none of 
the other conversions will be valid for non overlapping address spaces and the 
error will occur.

I think at this point we might not need to know if it's implicit or explicit? I 
believe we might have a separate check for this somewhere because it works for 
OpenCL. I don't know though if it might simplify the flow if we move this logic 
rather here.

The cv checks above seem to use `CStyle` flag. I am wondering if we could use 
it to detect implicit or explicit. Because we can only cast address space with 
C style cast at the moment.  Although after adding `addrspace_cast` operator 
that will no longer be the only way.



Comment at: lib/Sema/SemaOverload.cpp:5150
 
+  // FIXME: hasAddressSpace is wrong; this check will be skipped if FromType is
+  // not qualified with an address space, but if there's no implicit conversion

Agree! We need to check that address spaces are not identical and then validity!

But I guess it's ok for C++ because we can't add addr space qualifier to 
implicit object parameter yet?

It's broken for OpenCL though!


Repository:
  rC Clang

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

https://reviews.llvm.org/D62574



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


[PATCH] D62648: [Sema][Typo] Fix assertion failure for expressions with multiple typos

2019-05-30 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: lib/Sema/SemaExprCXX.cpp:7713-7714
+  // Add the newly created typos to the TypoExprs list, even if they
+  // failed to apply. This allows them to be reaped although they won't
+  // emit any diagnostic.
+  SavedTypoExprs.set_union(TypoExprs);

What prevents diagnostics from being emitted for `TypoExpr`s we create for an 
outer transform that we end up discarding? Eg, in:

```
struct Y {};
struct Z { int value; };
struct A {
  Y get_me_a_Y();
};
struct B {
  Z get_me_a_Z();
};
A make_an_A();
B make_a_B();
int f() {
  return make_an_E().get_me_a_Z().value;
}
```

I'm concerned that we will:
 * try correcting `make_me_an_E` (`TypoExpr` `T0`) to `make_me_an_A` (because 
that correction has the minimum edit distance) and discover that there is no 
`get_me_a_Z` member, creating a new `TypoExpr` `T1`, and recurse:
   * try correcting `get_me_a_Z` (`TypoExpr` `T1`) to `get_me_a_Y` and discover 
that there is no `value` member
   * no correction works: bail out of recursive step
 * try correcting `make_me_an_E` (`TypoExpr` `T0`) to `make_me_a_B` and succeed

But now we still have `T1` in our list of `TypoExpr`s, and will presumably 
diagnose it (and take action below if it turned out to be ambiguous etc).




Comment at: lib/Sema/SemaExprCXX.cpp:7762-7787
 // Ensure none of the TypoExprs have multiple typo correction candidates
 // with the same edit length that pass all the checks and filters.
 // TODO: Properly handle various permutations of possible corrections when
 // there is more than one potentially ambiguous typo correction.
 // Also, disable typo correction while attempting the transform when
 // handling potentially ambiguous typo corrections as any new TypoExprs 
will
 // have been introduced by the application of one of the correction

What happens if an ambiguous `TypoExpr` is created as a result of one of the 
outer level transformations?

In that case, I think that we will try alternatives for that `TypoExpr` here, 
but that `TypoExpr` is not in the expression we're transforming (it was created 
within `RecursiveTransformLoop` and isn't part of `E`), so we're just redoing 
the same transformation we already did but with typo-correction disabled. This 
means that the transform will fail (because we hit a typo and can't correct 
it), so we'll accept the original set of corrections despite them being 
ambiguous.


Repository:
  rC Clang

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

https://reviews.llvm.org/D62648



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


[PATCH] D62665: Fix constexpr __builtin_*_overflow issue when unsigned->signed operand.

2019-05-30 Thread Erich Keane via Phabricator via cfe-commits
erichkeane updated this revision to Diff 202268.
erichkeane marked an inline comment as done.

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

https://reviews.llvm.org/D62665

Files:
  clang/lib/AST/ExprConstant.cpp
  clang/test/SemaCXX/builtins-overflow.cpp


Index: clang/test/SemaCXX/builtins-overflow.cpp
===
--- clang/test/SemaCXX/builtins-overflow.cpp
+++ clang/test/SemaCXX/builtins-overflow.cpp
@@ -2,6 +2,7 @@
 // expected-no-diagnostics
 
 #include 
+#include 
 
 int a() {
   const int x = 3;
@@ -50,6 +51,7 @@
 static_assert(sub(static_cast(0),static_cast(1)) == 
Result{true, UCHAR_MAX});
 static_assert(sub(static_cast(0),static_cast(1)) == Result{false, -1});
 static_assert(sub(static_cast(0),static_cast(1)) 
== Result{true, USHRT_MAX});
+static_assert(sub(static_cast(255),static_cast(100)) == 
Result{false, 155});
 
 static_assert(sub(17,22) == Result{false, -5});
 static_assert(sub(INT_MAX - 22, -23) == Result{true, INT_MIN});
@@ -91,3 +93,4 @@
 static_assert(smul(17,22) == Result{false, 374});
 static_assert(smul(INT_MAX / 22, 23) == Result{true, -2049870757});
 static_assert(smul(INT_MIN / 22, -23) == Result{true, -2049870757});
+
Index: clang/lib/AST/ExprConstant.cpp
===
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -9453,10 +9453,8 @@
   if (IsSigned && !AllSigned)
 ++MaxBits;
 
-  LHS = APSInt(IsSigned ? LHS.sextOrSelf(MaxBits) : 
LHS.zextOrSelf(MaxBits),
-   !IsSigned);
-  RHS = APSInt(IsSigned ? RHS.sextOrSelf(MaxBits) : 
RHS.zextOrSelf(MaxBits),
-   !IsSigned);
+  LHS = APSInt(LHS.extOrTrunc(MaxBits), !IsSigned);
+  RHS = APSInt(RHS.extOrTrunc(MaxBits), !IsSigned);
   Result = APSInt(MaxBits, !IsSigned);
 }
 


Index: clang/test/SemaCXX/builtins-overflow.cpp
===
--- clang/test/SemaCXX/builtins-overflow.cpp
+++ clang/test/SemaCXX/builtins-overflow.cpp
@@ -2,6 +2,7 @@
 // expected-no-diagnostics
 
 #include 
+#include 
 
 int a() {
   const int x = 3;
@@ -50,6 +51,7 @@
 static_assert(sub(static_cast(0),static_cast(1)) == Result{true, UCHAR_MAX});
 static_assert(sub(static_cast(0),static_cast(1)) == Result{false, -1});
 static_assert(sub(static_cast(0),static_cast(1)) == Result{true, USHRT_MAX});
+static_assert(sub(static_cast(255),static_cast(100)) == Result{false, 155});
 
 static_assert(sub(17,22) == Result{false, -5});
 static_assert(sub(INT_MAX - 22, -23) == Result{true, INT_MIN});
@@ -91,3 +93,4 @@
 static_assert(smul(17,22) == Result{false, 374});
 static_assert(smul(INT_MAX / 22, 23) == Result{true, -2049870757});
 static_assert(smul(INT_MIN / 22, -23) == Result{true, -2049870757});
+
Index: clang/lib/AST/ExprConstant.cpp
===
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -9453,10 +9453,8 @@
   if (IsSigned && !AllSigned)
 ++MaxBits;
 
-  LHS = APSInt(IsSigned ? LHS.sextOrSelf(MaxBits) : LHS.zextOrSelf(MaxBits),
-   !IsSigned);
-  RHS = APSInt(IsSigned ? RHS.sextOrSelf(MaxBits) : RHS.zextOrSelf(MaxBits),
-   !IsSigned);
+  LHS = APSInt(LHS.extOrTrunc(MaxBits), !IsSigned);
+  RHS = APSInt(RHS.extOrTrunc(MaxBits), !IsSigned);
   Result = APSInt(MaxBits, !IsSigned);
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61923: [GWP-ASan] Mutex implementation [2].

2019-05-30 Thread Mitch Phillips via Phabricator via cfe-commits
hctim updated this revision to Diff 202275.
hctim added a comment.

Merged with tip-of-tree in preparation for submit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61923

Files:
  clang/runtime/CMakeLists.txt
  compiler-rt/lib/gwp_asan/CMakeLists.txt
  compiler-rt/lib/gwp_asan/mutex.h
  compiler-rt/lib/gwp_asan/platform_specific/mutex_posix.cpp
  compiler-rt/lib/gwp_asan/tests/CMakeLists.txt
  compiler-rt/lib/gwp_asan/tests/driver.cpp
  compiler-rt/lib/gwp_asan/tests/mutex_test.cpp
  compiler-rt/test/gwp_asan/CMakeLists.txt
  compiler-rt/test/gwp_asan/dummy_test.cc
  compiler-rt/test/gwp_asan/lit.cfg
  compiler-rt/test/gwp_asan/lit.site.cfg.in
  compiler-rt/test/gwp_asan/unit/lit.site.cfg.in

Index: compiler-rt/test/gwp_asan/unit/lit.site.cfg.in
===
--- /dev/null
+++ compiler-rt/test/gwp_asan/unit/lit.site.cfg.in
@@ -0,0 +1,9 @@
+@LIT_SITE_CFG_IN_HEADER@
+
+config.name = "GwpAsan-Unittest"
+# Load common config for all compiler-rt unit tests.
+lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/unittests/lit.common.unit.configured")
+
+config.test_exec_root = os.path.join("@COMPILER_RT_BINARY_DIR@",
+ "lib", "gwp_asan", "tests")
+config.test_source_root = config.test_exec_root
Index: compiler-rt/test/gwp_asan/lit.site.cfg.in
===
--- /dev/null
+++ compiler-rt/test/gwp_asan/lit.site.cfg.in
@@ -0,0 +1,11 @@
+@LIT_SITE_CFG_IN_HEADER@
+
+config.name_suffix = "@GWP_ASAN_TEST_CONFIG_SUFFIX@"
+config.target_arch = "@GWP_ASAN_TEST_TARGET_ARCH@"
+config.target_cflags = "@GWP_ASAN_TEST_TARGET_CFLAGS@"
+
+# Load common config for all compiler-rt lit tests.
+lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
+
+# Load tool-specific config that would do the real work.
+lit_config.load_config(config, "@GWP_ASAN_LIT_SOURCE_DIR@/lit.cfg")
Index: compiler-rt/test/gwp_asan/lit.cfg
===
--- /dev/null
+++ compiler-rt/test/gwp_asan/lit.cfg
@@ -0,0 +1,31 @@
+# -*- Python -*-
+
+import os
+
+# Setup config name.
+config.name = 'GWP-ASan' + config.name_suffix
+
+# Setup source root.
+config.test_source_root = os.path.dirname(__file__)
+
+# Test suffixes.
+config.suffixes = ['.c', '.cc', '.cpp', '.test']
+
+# C & CXX flags.
+c_flags = ([config.target_cflags])
+
+# Android doesn't want -lrt.
+if not config.android:
+  c_flags += ["-lrt"]
+
+cxx_flags = (c_flags + config.cxx_mode_flags + ["-std=c++11"])
+
+def build_invocation(compile_flags):
+  return " " + " ".join([config.clang] + compile_flags) + " "
+
+# Add substitutions.
+config.substitutions.append(("%clang ", build_invocation(c_flags)))
+
+# GWP-ASan tests are currently supported on Linux only.
+if config.host_os not in ['Linux']:
+   config.unsupported = True
Index: compiler-rt/test/gwp_asan/dummy_test.cc
===
--- /dev/null
+++ compiler-rt/test/gwp_asan/dummy_test.cc
@@ -0,0 +1,4 @@
+// Exists to simply stop warnings about lit not discovering any tests here.
+// RUN: %clang %s
+
+int main() { return 0; }
Index: compiler-rt/test/gwp_asan/CMakeLists.txt
===
--- compiler-rt/test/gwp_asan/CMakeLists.txt
+++ compiler-rt/test/gwp_asan/CMakeLists.txt
@@ -0,0 +1,45 @@
+set(GWP_ASAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+set(GWP_ASAN_LIT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+
+set(GWP_ASAN_TESTSUITES)
+
+set(GWP_ASAN_UNITTEST_DEPS)
+set(GWP_ASAN_TEST_DEPS
+  ${SANITIZER_COMMON_LIT_TEST_DEPS}
+  gwp_asan)
+
+if (COMPILER_RT_INCLUDE_TESTS)
+  list(APPEND GWP_ASAN_TEST_DEPS GwpAsanUnitTests)
+  configure_lit_site_cfg(
+${CMAKE_CURRENT_SOURCE_DIR}/unit/lit.site.cfg.in
+${CMAKE_CURRENT_BINARY_DIR}/unit/lit.site.cfg)
+  add_lit_testsuite(check-gwp_asan-unit "Running GWP-ASan unit tests"
+${CMAKE_CURRENT_BINARY_DIR}/unit
+DEPENDS ${GWP_ASAN_TEST_DEPS})
+  set_target_properties(check-gwp_asan-unit PROPERTIES FOLDER
+"Compiler-RT Tests")
+list(APPEND GWP_ASAN_TEST_DEPS check-gwp_asan-unit)
+endif()
+
+configure_lit_site_cfg(
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+  )
+
+foreach(arch ${GWP_ASAN_SUPPORTED_ARCH})
+  set(GWP_ASAN_TEST_TARGET_ARCH ${arch})
+  string(TOLOWER "-${arch}" GWP_ASAN_TEST_CONFIG_SUFFIX)
+  get_test_cc_for_arch(${arch} GWP_ASAN_TEST_TARGET_CC GWP_ASAN_TEST_TARGET_CFLAGS)
+  string(TOUPPER ${arch} ARCH_UPPER_CASE)
+  set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config)
+
+  configure_lit_site_cfg(
+${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
+${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg)
+  list(APPEND GWP_ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
+endforeach()
+
+add_lit_testsui

r362138 - [GWP-ASan] Mutex implementation [2].

2019-05-30 Thread Mitch Phillips via cfe-commits
Author: hctim
Date: Thu May 30 12:45:32 2019
New Revision: 362138

URL: http://llvm.org/viewvc/llvm-project?rev=362138&view=rev
Log:
[GWP-ASan] Mutex implementation [2].

Summary:
See D60593 for further information.
This patch pulls out the mutex implementation and the required definitions file.

We implement our own mutex for GWP-ASan currently, because:

1. We must be compatible with the sum of the most restrictive elements of the 
supporting allocator's build system. Current targets for GWP-ASan include Scudo 
(on Linux and Fuchsia), and bionic (on Android).
2. Scudo specifies `-nostdlib++ -nonodefaultlibs`, meaning we can't use 
`std::mutex` or `mtx_t`.
3. We can't use `sanitizer_common`'s mutex, as the supporting allocators cannot 
afford the extra maintenance (Android, Fuchsia) and code size (Fuchsia) 
overheads that this would incur.

In future, we would like to implement a shared base mutex for GWP-ASan, Scudo 
and sanitizer_common. This will likely happen when both GWP-ASan and Scudo 
standalone are not in the development phase, at which point they will have 
stable requirements.

Reviewers: vlad.tsyrklevich, morehouse, jfb

Reviewed By: morehouse

Subscribers: dexonsmith, srhines, cfe-commits, kubamracek, mgorny, cryptoad, 
jfb, #sanitizers, llvm-commits, vitalybuka, eugenis

Tags: #sanitizers, #llvm, #clang

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

Modified:
cfe/trunk/runtime/CMakeLists.txt

Modified: cfe/trunk/runtime/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/runtime/CMakeLists.txt?rev=362138&r1=362137&r2=362138&view=diff
==
--- cfe/trunk/runtime/CMakeLists.txt (original)
+++ cfe/trunk/runtime/CMakeLists.txt Thu May 30 12:45:32 2019
@@ -132,7 +132,7 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND E
 # Add top-level targets for various compiler-rt test suites.
 set(COMPILER_RT_TEST_SUITES check-fuzzer check-asan check-hwasan 
check-asan-dynamic check-dfsan
   check-lsan check-msan check-sanitizer check-tsan check-ubsan 
check-ubsan-minimal
-  check-profile check-cfi check-cfi-and-supported check-safestack)
+  check-profile check-cfi check-cfi-and-supported check-safestack 
check-gwp_asan)
 foreach(test_suite ${COMPILER_RT_TEST_SUITES})
   get_ext_project_build_command(run_test_suite ${test_suite})
   add_custom_target(${test_suite}


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


[PATCH] D61923: [GWP-ASan] Mutex implementation [2].

2019-05-30 Thread Mitch Phillips via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362138: [GWP-ASan] Mutex implementation [2]. (authored by 
hctim, committed by ).
Herald added a subscriber: delcypher.

Changed prior to commit:
  https://reviews.llvm.org/D61923?vs=202275&id=202276#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D61923

Files:
  cfe/trunk/runtime/CMakeLists.txt
  compiler-rt/trunk/lib/gwp_asan/CMakeLists.txt
  compiler-rt/trunk/lib/gwp_asan/mutex.h
  compiler-rt/trunk/lib/gwp_asan/platform_specific/mutex_posix.cpp
  compiler-rt/trunk/lib/gwp_asan/tests/CMakeLists.txt
  compiler-rt/trunk/lib/gwp_asan/tests/driver.cpp
  compiler-rt/trunk/lib/gwp_asan/tests/mutex_test.cpp
  compiler-rt/trunk/test/gwp_asan/CMakeLists.txt
  compiler-rt/trunk/test/gwp_asan/dummy_test.cc
  compiler-rt/trunk/test/gwp_asan/lit.cfg
  compiler-rt/trunk/test/gwp_asan/lit.site.cfg.in
  compiler-rt/trunk/test/gwp_asan/unit/lit.site.cfg.in

Index: cfe/trunk/runtime/CMakeLists.txt
===
--- cfe/trunk/runtime/CMakeLists.txt
+++ cfe/trunk/runtime/CMakeLists.txt
@@ -132,7 +132,7 @@
 # Add top-level targets for various compiler-rt test suites.
 set(COMPILER_RT_TEST_SUITES check-fuzzer check-asan check-hwasan check-asan-dynamic check-dfsan
   check-lsan check-msan check-sanitizer check-tsan check-ubsan check-ubsan-minimal
-  check-profile check-cfi check-cfi-and-supported check-safestack)
+  check-profile check-cfi check-cfi-and-supported check-safestack check-gwp_asan)
 foreach(test_suite ${COMPILER_RT_TEST_SUITES})
   get_ext_project_build_command(run_test_suite ${test_suite})
   add_custom_target(${test_suite}
Index: compiler-rt/trunk/test/gwp_asan/unit/lit.site.cfg.in
===
--- compiler-rt/trunk/test/gwp_asan/unit/lit.site.cfg.in
+++ compiler-rt/trunk/test/gwp_asan/unit/lit.site.cfg.in
@@ -0,0 +1,9 @@
+@LIT_SITE_CFG_IN_HEADER@
+
+config.name = "GwpAsan-Unittest"
+# Load common config for all compiler-rt unit tests.
+lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/unittests/lit.common.unit.configured")
+
+config.test_exec_root = os.path.join("@COMPILER_RT_BINARY_DIR@",
+ "lib", "gwp_asan", "tests")
+config.test_source_root = config.test_exec_root
Index: compiler-rt/trunk/test/gwp_asan/lit.site.cfg.in
===
--- compiler-rt/trunk/test/gwp_asan/lit.site.cfg.in
+++ compiler-rt/trunk/test/gwp_asan/lit.site.cfg.in
@@ -0,0 +1,11 @@
+@LIT_SITE_CFG_IN_HEADER@
+
+config.name_suffix = "@GWP_ASAN_TEST_CONFIG_SUFFIX@"
+config.target_arch = "@GWP_ASAN_TEST_TARGET_ARCH@"
+config.target_cflags = "@GWP_ASAN_TEST_TARGET_CFLAGS@"
+
+# Load common config for all compiler-rt lit tests.
+lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
+
+# Load tool-specific config that would do the real work.
+lit_config.load_config(config, "@GWP_ASAN_LIT_SOURCE_DIR@/lit.cfg")
Index: compiler-rt/trunk/test/gwp_asan/dummy_test.cc
===
--- compiler-rt/trunk/test/gwp_asan/dummy_test.cc
+++ compiler-rt/trunk/test/gwp_asan/dummy_test.cc
@@ -0,0 +1,4 @@
+// Exists to simply stop warnings about lit not discovering any tests here.
+// RUN: %clang %s
+
+int main() { return 0; }
Index: compiler-rt/trunk/test/gwp_asan/CMakeLists.txt
===
--- compiler-rt/trunk/test/gwp_asan/CMakeLists.txt
+++ compiler-rt/trunk/test/gwp_asan/CMakeLists.txt
@@ -0,0 +1,45 @@
+set(GWP_ASAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+set(GWP_ASAN_LIT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+
+set(GWP_ASAN_TESTSUITES)
+
+set(GWP_ASAN_UNITTEST_DEPS)
+set(GWP_ASAN_TEST_DEPS
+  ${SANITIZER_COMMON_LIT_TEST_DEPS}
+  gwp_asan)
+
+if (COMPILER_RT_INCLUDE_TESTS)
+  list(APPEND GWP_ASAN_TEST_DEPS GwpAsanUnitTests)
+  configure_lit_site_cfg(
+${CMAKE_CURRENT_SOURCE_DIR}/unit/lit.site.cfg.in
+${CMAKE_CURRENT_BINARY_DIR}/unit/lit.site.cfg)
+  add_lit_testsuite(check-gwp_asan-unit "Running GWP-ASan unit tests"
+${CMAKE_CURRENT_BINARY_DIR}/unit
+DEPENDS ${GWP_ASAN_TEST_DEPS})
+  set_target_properties(check-gwp_asan-unit PROPERTIES FOLDER
+"Compiler-RT Tests")
+list(APPEND GWP_ASAN_TEST_DEPS check-gwp_asan-unit)
+endif()
+
+configure_lit_site_cfg(
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+  )
+
+foreach(arch ${GWP_ASAN_SUPPORTED_ARCH})
+  set(GWP_ASAN_TEST_TARGET_ARCH ${arch})
+  string(TOLOWER "-${arch}" GWP_ASAN_TEST_CONFIG_SUFFIX)
+  get_test_cc_for_arch(${arch} GWP_ASAN_TEST_TARGET_CC GWP_ASAN_TEST_TARGET_CFLAGS)
+  string(TOUPPER ${arch} ARCH_UPPER_CASE)
+  set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config)
+
+  configure_lit_site_c

[PATCH] D62696: AMDGPU: Use AMDGPU toolchain for other OSes

2019-05-30 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm created this revision.
arsenm added a reviewer: yaxunl.
Herald added subscribers: t-tye, tpr, dstuttard, nhaehnle, wdng, jvesely, 
kzhuravl.

This would need more work to actually support them, but this is less
wrong than the default.


https://reviews.llvm.org/D62696

Files:
  lib/Driver/Driver.cpp
  test/Driver/amdgpu-toolchain.c


Index: test/Driver/amdgpu-toolchain.c
===
--- test/Driver/amdgpu-toolchain.c
+++ test/Driver/amdgpu-toolchain.c
@@ -1,6 +1,11 @@
 // RUN: %clang -### -target amdgcn--amdhsa -x assembler -mcpu=kaveri %s 2>&1 | 
FileCheck -check-prefix=AS_LINK %s
+// RUN: %clang -### -g -target amdgcn--amdhsa -mcpu=kaveri %s 2>&1 | FileCheck 
-check-prefix=DWARF_VER %s
+// RUN: %clang -### -target amdgcn-amd-amdpal -x assembler -mcpu=kaveri %s 
2>&1 | FileCheck -check-prefix=AS_LINK %s
+// RUN: %clang -### -g -target amdgcn-amd-amdpal -mcpu=kaveri %s 2>&1 | 
FileCheck -check-prefix=DWARF_VER %s
+// RUN: %clang -### -target amdgcn-mesa-mesa3d -x assembler -mcpu=kaveri %s 
2>&1 | FileCheck -check-prefix=AS_LINK %s
+// RUN: %clang -### -g -target amdgcn-mesa-mesa3d -mcpu=kaveri %s 2>&1 | 
FileCheck -check-prefix=DWARF_VER %s
+
 // AS_LINK: clang{{.*}} "-cc1as"
 // AS_LINK: ld.lld{{.*}} "-shared"
 
-// RUN: %clang -### -g -target amdgcn--amdhsa -mcpu=kaveri %s 2>&1 | FileCheck 
-check-prefix=DWARF_VER %s
 // DWARF_VER: "-dwarf-version=5"
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -4617,6 +4617,8 @@
   TC = llvm::make_unique(*this, Target, Args);
   break;
 case llvm::Triple::AMDHSA:
+case llvm::Triple::AMDPAL:
+case llvm::Triple::Mesa3D:
   TC = llvm::make_unique(*this, Target, Args);
   break;
 case llvm::Triple::Win32:


Index: test/Driver/amdgpu-toolchain.c
===
--- test/Driver/amdgpu-toolchain.c
+++ test/Driver/amdgpu-toolchain.c
@@ -1,6 +1,11 @@
 // RUN: %clang -### -target amdgcn--amdhsa -x assembler -mcpu=kaveri %s 2>&1 | FileCheck -check-prefix=AS_LINK %s
+// RUN: %clang -### -g -target amdgcn--amdhsa -mcpu=kaveri %s 2>&1 | FileCheck -check-prefix=DWARF_VER %s
+// RUN: %clang -### -target amdgcn-amd-amdpal -x assembler -mcpu=kaveri %s 2>&1 | FileCheck -check-prefix=AS_LINK %s
+// RUN: %clang -### -g -target amdgcn-amd-amdpal -mcpu=kaveri %s 2>&1 | FileCheck -check-prefix=DWARF_VER %s
+// RUN: %clang -### -target amdgcn-mesa-mesa3d -x assembler -mcpu=kaveri %s 2>&1 | FileCheck -check-prefix=AS_LINK %s
+// RUN: %clang -### -g -target amdgcn-mesa-mesa3d -mcpu=kaveri %s 2>&1 | FileCheck -check-prefix=DWARF_VER %s
+
 // AS_LINK: clang{{.*}} "-cc1as"
 // AS_LINK: ld.lld{{.*}} "-shared"
 
-// RUN: %clang -### -g -target amdgcn--amdhsa -mcpu=kaveri %s 2>&1 | FileCheck -check-prefix=DWARF_VER %s
 // DWARF_VER: "-dwarf-version=5"
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -4617,6 +4617,8 @@
   TC = llvm::make_unique(*this, Target, Args);
   break;
 case llvm::Triple::AMDHSA:
+case llvm::Triple::AMDPAL:
+case llvm::Triple::Mesa3D:
   TC = llvm::make_unique(*this, Target, Args);
   break;
 case llvm::Triple::Win32:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r362140 - Mark test as requiring an ARM target.

2019-05-30 Thread Douglas Yung via cfe-commits
Author: dyung
Date: Thu May 30 13:02:51 2019
New Revision: 362140

URL: http://llvm.org/viewvc/llvm-project?rev=362140&view=rev
Log:
Mark test as requiring an ARM target.

Modified:
cfe/trunk/test/Driver/armv8.1m.main.s

Modified: cfe/trunk/test/Driver/armv8.1m.main.s
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/armv8.1m.main.s?rev=362140&r1=362139&r2=362140&view=diff
==
--- cfe/trunk/test/Driver/armv8.1m.main.s (original)
+++ cfe/trunk/test/Driver/armv8.1m.main.s Thu May 30 13:02:51 2019
@@ -1,3 +1,4 @@
+# REQUIRES: arm-registered-target
 # RUN: not %clang -c -target arm-none-none-eabi -march=armv8-m.main %s 2>%t
 # RUN:  FileCheck --check-prefix=ERROR-V8M < %t %s
 # RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main %s 2>%t


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


[PATCH] D62697: AMDGPU: Disable errno by default

2019-05-30 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm created this revision.
arsenm added a reviewer: yaxunl.
Herald added subscribers: t-tye, tpr, dstuttard, nhaehnle, wdng, jvesely, 
kzhuravl.

https://reviews.llvm.org/D62697

Files:
  lib/Driver/ToolChains/AMDGPU.h
  test/Driver/fast-math.c


Index: test/Driver/fast-math.c
===
--- test/Driver/fast-math.c
+++ test/Driver/fast-math.c
@@ -97,6 +97,12 @@
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-linux-android -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### -target amdgcn-amd-amdhsa -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### -target amdgcn-amd-amdpal -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### -target amdgcn-mesa-mesa3d -c %s 2>&1   \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 //
 // Check that -ffast-math disables -fmath-errno, and -fno-fast-math merely
 // preserves the target default. Also check various flag set operations between
Index: lib/Driver/ToolChains/AMDGPU.h
===
--- lib/Driver/ToolChains/AMDGPU.h
+++ lib/Driver/ToolChains/AMDGPU.h
@@ -57,6 +57,8 @@
   const llvm::opt::ArgList &Args);
   unsigned GetDefaultDwarfVersion() const override { return 5; }
   bool IsIntegratedAssemblerDefault() const override { return true; }
+  bool IsMathErrnoDefault() const override { return false; }
+
   llvm::opt::DerivedArgList *
   TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
 Action::OffloadKind DeviceOffloadKind) const override;


Index: test/Driver/fast-math.c
===
--- test/Driver/fast-math.c
+++ test/Driver/fast-math.c
@@ -97,6 +97,12 @@
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-linux-android -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### -target amdgcn-amd-amdhsa -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### -target amdgcn-amd-amdpal -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### -target amdgcn-mesa-mesa3d -c %s 2>&1   \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 //
 // Check that -ffast-math disables -fmath-errno, and -fno-fast-math merely
 // preserves the target default. Also check various flag set operations between
Index: lib/Driver/ToolChains/AMDGPU.h
===
--- lib/Driver/ToolChains/AMDGPU.h
+++ lib/Driver/ToolChains/AMDGPU.h
@@ -57,6 +57,8 @@
   const llvm::opt::ArgList &Args);
   unsigned GetDefaultDwarfVersion() const override { return 5; }
   bool IsIntegratedAssemblerDefault() const override { return true; }
+  bool IsMathErrnoDefault() const override { return false; }
+
   llvm::opt::DerivedArgList *
   TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
 Action::OffloadKind DeviceOffloadKind) const override;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r361997 - [analyzer] print() JSONify: getNodeLabel implementation

2019-05-30 Thread Artem Dergachev via cfe-commits

Hi all,

I'm perfectly fine with reducing this test case to only test the 
`conj_$3\{int, LC3, no stmt, #1\}` part and drop everything else, 
because that's what i've been testing when i originally introduced this 
test.


The lack of determinism here indeed only affects our own self-debugging 
facilities and doesn't affect the end users, while also being a 
characteristic of the most performance-critical low-level part of the 
static analyzer (immutable sets and maps), so while we're aware of the 
problem, we're not actively trying to fix it. Generally we are very 
careful about determinism when it comes to emitting or not emitting 
warnings, but this is not the case here.


On 5/30/19 8:44 AM, Csaba Dabis via cfe-commits wrote:
I have not said there is determinism to print out a map as Static 
Analyzer cannot provide that. We have no plans to make it 
deterministic, as it is just dumping out the ExplodedGraph in JSON 
format, which is an internal stuff.


This non-deterministic behaviour has been seen first only some days 
ago, as no-one ever was that crazy to rewrite the backend of the 
Static Analyzer. Now we are doing that as a part of my GSoC project, 
and that little QoL patch-chain cannot take more than a week of work, 
as we planned.


I have said the non-deterministic behaviour of Windows has been fixed. 
When you put that for-loop to `check-clang` on a Linux machine it will 
pass 100 times, however on Windows it will fail 60 times. I am not a 
Windows user and I did not know about that behaviour to write out a 
map could be that silly. By "hiding" the non-determinism of Windows 
map-handling the Test became deterministic.


We had that structure behind:

First CHECK was:
"constructing_objects": [
  { "location_context": "#0 Call", "calling": "foo", "call_line": 
null, "*items*": [
    { "lctx_id": 1, "stmt_id": 1125, "kind": "construct into local 
variable", "argument_index": null, "pretty": "T t;", "value": "&t" }

  ]}
]

Second CHECK was:
"constructing_objects": [
  { "location_context": "#0 Call", "calling": "T::T", "call_line": 
"16", "*items*": [
    { "lctx_id": 2, "init_id": 1062, "kind": "construct into member 
variable", "argument_index": null, "pretty": "s", "value": "&t->s" }

  ]},
  { "location_context": "#1 Call", "calling": "foo", "call_line": 
null, "*items*": [
    { "lctx_id": 1, "stmt_id": 1125, "kind": "construct into local 
variable", "argument_index": null, "pretty": "T t;", "value": "&t" }

  ]}
]

By removing the `constructing_objects` that Test is deterministic 
every time as no map structure with multiple elements involved.


I am also sad because the core developers did not care about maps. I 
will not too, as I said it is just dumping out the internal of the 
internals.


Thanks for your understanding,
Csaba.

On Thu, May 30, 2019 at 5:28 PM Russell Gallop 
mailto:russell.gal...@gmail.com>> wrote:


Hi Csaba,

I see what Roman means. Output should be deterministic for given
input (unless there is a very good reason not to (e.g. timing or
deliberate randomness)).

You can check whether the output is the same with a script like
below. It looks like the node numbers are different every time. Is
there a good reason for this?

Regards
Russ

$ cat test.sh
#!/bin/bash -xe

python bin/llvm-lit.py -v ../clang/test/Analysis/dump_egraph.cpp
cp tools/clang/test/Analysis/Output/dump_egraph.cpp.tmp.dot ref.dot

for ((i=0;i<100;i++));
do
 python bin/llvm-lit.py -v ../clang/test/Analysis/dump_egraph.cpp
 diff ref.dot tools/clang/test/Analysis/Output/dump_egraph.cpp.tmp.dot
done

On Thu, 30 May 2019 at 16:18, Roman Lebedev mailto:lebedev...@gmail.com>> wrote:

I think we're still talking past each other.

I'm saying that *any* commit that does not fix the underlying
nondeterminizm,
but only hides it by deleting tests that showed that said
determinism
exists in the first place,
is not a fix.

Roman.

On Thu, May 30, 2019 at 6:14 PM Csaba Dabis
mailto:dabis.csab...@gmail.com>> wrote:
>
> Hm, the first `CHECK: constructing_objects` contains only
one element, which is fine,
> the second `CHECK: constructing_objects` has two, which
could be non-determinism,
> but surprisingly it is worked as excepted.
> Because of the edge-case I have changed my mind:
>

https://github.com/llvm/llvm-project/commit/32d545f930ce44614ac8398693dacd1d6dbc41a3
>
> Thanks everyone!
>
> On Thu, May 30, 2019 at 4:52 PM Roman Lebedev
mailto:lebedev...@gmail.com>> wrote:
>>
>> On Thu, May 30, 2019 at 5:48 PM Csaba Dabis via cfe-commits
>> mailto:cfe-commits@lists.llvm.org>> wrote:
>> >
>> > Thanks you!
>> >
>> > Fixed by

https://github.com/llvm/llvm-project/commit/17604c3486cbe7c27cadac17

r362147 - [c++2a] Fix assertion failure if we would walk over more than one level

2019-05-30 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu May 30 13:45:12 2019
New Revision: 362147

URL: http://llvm.org/viewvc/llvm-project?rev=362147&view=rev
Log:
[c++2a] Fix assertion failure if we would walk over more than one level
of derived-to-base conversion path when implicitly starting union
subobject lifetimes in constant evaluation.

Modified:
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/test/SemaCXX/constant-expression-cxx2a.cpp

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=362147&r1=362146&r2=362147&view=diff
==
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Thu May 30 13:45:12 2019
@@ -5031,7 +5031,8 @@ static bool HandleUnionActiveMemberChang
   if (ICE->getCastKind() != CK_DerivedToBase &&
   ICE->getCastKind() != CK_UncheckedDerivedToBase)
 break;
-  for (const CXXBaseSpecifier *Elt : ICE->path()) {
+  // Walk path backwards as we walk up from the base to the derived class.
+  for (const CXXBaseSpecifier *Elt : llvm::reverse(ICE->path())) {
 --PathLength;
 (void)Elt;
 assert(declaresSameEntity(Elt->getType()->getAsCXXRecordDecl(),

Modified: cfe/trunk/test/SemaCXX/constant-expression-cxx2a.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constant-expression-cxx2a.cpp?rev=362147&r1=362146&r2=362147&view=diff
==
--- cfe/trunk/test/SemaCXX/constant-expression-cxx2a.cpp (original)
+++ cfe/trunk/test/SemaCXX/constant-expression-cxx2a.cpp Thu May 30 13:45:12 
2019
@@ -521,4 +521,14 @@ namespace Union {
 u1 = u2;
 return true;
   }();
+
+  struct S1 {
+int n;
+  };
+  struct S2 : S1 {};
+  struct S3 : S2 {};
+  void f() {
+S3 s;
+s.n = 0;
+  }
 }


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


Re: r361329 - [c++20] P1330R0: permit simple-assignments that change the active member

2019-05-30 Thread Richard Smith via cfe-commits
On Thu, 30 May 2019 at 04:31, Stephan Bergmann via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On 22/05/2019 01:15, Richard Smith via cfe-commits wrote:
> > Author: rsmith
> > Date: Tue May 21 16:15:20 2019
> > New Revision: 361329
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=361329&view=rev
> > Log:
> > [c++20] P1330R0: permit simple-assignments that change the active member
> > of a union within constant expression evaluation.
> [...]
> > --- cfe/trunk/lib/AST/ExprConstant.cpp (original)
> > +++ cfe/trunk/lib/AST/ExprConstant.cpp Tue May 21 16:15:20 2019
> [...]> @@ -4888,6 +4916,159 @@ static bool HandleDynamicCast(EvalInfo &
> [...]
> > +/// Handle a builtin simple-assignment or a call to a trivial assignment
> > +/// operator whose left-hand side might involve a union member access.
> If it
> > +/// does, implicitly start the lifetime of any accessed union elements
> per
> > +/// C++20 [class.union]5.
> > +static bool HandleUnionActiveMemberChange(EvalInfo &Info, const Expr
> *LHSExpr,
> > +  const LValue &LHS) {
> > +  if (LHS.InvalidBase || LHS.Designator.Invalid)
> > +return false;
> > +
> > +  llvm::SmallVector, 4>
> UnionPathLengths;
> > +  // C++ [class.union]p5:
> > +  //   define the set S(E) of subexpressions of E as follows:
> > +  const Expr *E = LHSExpr;
> > +  unsigned PathLength = LHS.Designator.Entries.size();
> > +  while (E) {
> > +//   -- If E is of the form A.B, S(E) contains the elements of
> S(A)...
> > +if (auto *ME = dyn_cast(E)) {
> > +  auto *FD = dyn_cast(ME->getMemberDecl());
> > +  if (!FD)
> > +break;
> > +
> > +  //... and also contains A.B if B names a union member
> > +  if (FD->getParent()->isUnion())
> > +UnionPathLengths.push_back({PathLength - 1, FD});
> > +
> > +  E = ME->getBase();
> > +  --PathLength;
> > +  assert(declaresSameEntity(FD,
> > +LHS.Designator.Entries[PathLength]
> > +.getAsBaseOrMember().getPointer()));
> > +
> > +  //   -- If E is of the form A[B] and is interpreted as a built-in
> array
> > +  //  subscripting operator, S(E) is [S(the array operand, if
> any)].
> > +} else if (auto *ASE = dyn_cast(E)) {
> > +  // Step over an ArrayToPointerDecay implicit cast.
> > +  auto *Base = ASE->getBase()->IgnoreImplicit();
> > +  if (!Base->getType()->isArrayType())
> > +break;
> > +
> > +  E = Base;
> > +  --PathLength;
> > +
> > +} else if (auto *ICE = dyn_cast(E)) {
> > +  // Step over a derived-to-base conversion.
> > +  if (ICE->getCastKind() == CK_NoOp)
> > +continue;
> > +  if (ICE->getCastKind() != CK_DerivedToBase &&
> > +  ICE->getCastKind() != CK_UncheckedDerivedToBase)
> > +break;
> > +  for (const CXXBaseSpecifier *Elt : ICE->path()) {
> > +--PathLength;
> > +assert(declaresSameEntity(Elt->getType()->getAsCXXRecordDecl(),
> > +  LHS.Designator.Entries[PathLength]
> > +
> .getAsBaseOrMember().getPointer()));
>
> the above assert fires for the below test.cc with `clang++ -std=c++2a
> -fsyntax-only test.cc`:
>
> > struct S1 { int n; };
> > struct S2: S1 {};
> > struct S3: S2 {};
> > void f() {
> >  S3 s;
> >  s.n = 0;
> > }
>

Thanks for the great testcase, fixed in r362147.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61923: [GWP-ASan] Mutex implementation [2].

2019-05-30 Thread Mitch Phillips via Phabricator via cfe-commits
hctim added a comment.

Looks like this broke an autoconf bot 
.
 Have submitted rL362149 , which should 
hopefully fix the issue.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D61923



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


[PATCH] D62665: Fix constexpr __builtin_*_overflow issue when unsigned->signed operand.

2019-05-30 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM


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

https://reviews.llvm.org/D62665



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


[PATCH] D62638: [analyzer] A Python script to prettify the ExplodedGraph dumps.

2019-05-30 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ marked an inline comment as done.
NoQ added inline comments.



Comment at: clang/utils/analyzer/exploded-graph-rewriter.py:326
+self._dump('Program point:')
+self._dump(''
+   '')

Charusso wrote:
> I would create a table-builder class to reduce the repetition and for better 
> readability what is going on. Also you could avoid `balign` typo.
> 
> Then may each class could have its own pretty-print method like LLVM does.
`balign` is a thing in the graphviz dialect of html 
(https://www.graphviz.org/doc/info/shapes.html)

(not sure i still need this in the current incarnation of the script, given 
that we've removed those whole-decl pretty-prints in D62495)


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

https://reviews.llvm.org/D62638



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


[PATCH] D62635: Add enums as global variables in the IR metadata.

2019-05-30 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  That was... easier and more painless than I would've imagined.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62635



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


r362157 - Fix constexpr __builtin_*_overflow issue when unsigned->signed operand.

2019-05-30 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Thu May 30 14:35:32 2019
New Revision: 362157

URL: http://llvm.org/viewvc/llvm-project?rev=362157&view=rev
Log:
Fix constexpr __builtin_*_overflow issue when unsigned->signed operand.

As reported here https://bugs.llvm.org/show_bug.cgi?id=42000, it was
possible to get the constexpr version of __builtin_*_overflow to give
the wrong answer.

This was because when extending the operands to fit the largest type (so
that the math could be done), the decision on whether to sign/zero
extend the operands was based on the result signedness, not on the
operands signedness.

In the reported case, (unsigned char)255 - (int)100 needed
to have each extended to the int in order to do the math.  However, when
extending the first operand to 'int', we incorrectly sign extended it
instead of zero extending.  Thus, the result didnt fit back into the
unsigned char.

The fix for this was simply to choose zero/sign extension based on the
sign of the operand itself.

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

Modified:
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/test/SemaCXX/builtins-overflow.cpp

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=362157&r1=362156&r2=362157&view=diff
==
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Thu May 30 14:35:32 2019
@@ -9454,10 +9454,8 @@ bool IntExprEvaluator::VisitBuiltinCallE
   if (IsSigned && !AllSigned)
 ++MaxBits;
 
-  LHS = APSInt(IsSigned ? LHS.sextOrSelf(MaxBits) : 
LHS.zextOrSelf(MaxBits),
-   !IsSigned);
-  RHS = APSInt(IsSigned ? RHS.sextOrSelf(MaxBits) : 
RHS.zextOrSelf(MaxBits),
-   !IsSigned);
+  LHS = APSInt(LHS.extOrTrunc(MaxBits), !IsSigned);
+  RHS = APSInt(RHS.extOrTrunc(MaxBits), !IsSigned);
   Result = APSInt(MaxBits, !IsSigned);
 }
 

Modified: cfe/trunk/test/SemaCXX/builtins-overflow.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/builtins-overflow.cpp?rev=362157&r1=362156&r2=362157&view=diff
==
--- cfe/trunk/test/SemaCXX/builtins-overflow.cpp (original)
+++ cfe/trunk/test/SemaCXX/builtins-overflow.cpp Thu May 30 14:35:32 2019
@@ -2,6 +2,7 @@
 // expected-no-diagnostics
 
 #include 
+#include 
 
 int a() {
   const int x = 3;
@@ -50,6 +51,7 @@ constexpr Result sub(LHS &&lhs, RHS
 static_assert(sub(static_cast(0),static_cast(1)) == 
Result{true, UCHAR_MAX});
 static_assert(sub(static_cast(0),static_cast(1)) == Result{false, -1});
 static_assert(sub(static_cast(0),static_cast(1)) 
== Result{true, USHRT_MAX});
+static_assert(sub(static_cast(255),static_cast(100)) == 
Result{false, 155});
 
 static_assert(sub(17,22) == Result{false, -5});
 static_assert(sub(INT_MAX - 22, -23) == Result{true, INT_MIN});
@@ -91,3 +93,4 @@ constexpr Result smul(int lhs, int
 static_assert(smul(17,22) == Result{false, 374});
 static_assert(smul(INT_MAX / 22, 23) == Result{true, -2049870757});
 static_assert(smul(INT_MIN / 22, -23) == Result{true, -2049870757});
+


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


[PATCH] D62665: Fix constexpr __builtin_*_overflow issue when unsigned->signed operand.

2019-05-30 Thread Erich Keane via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362157: Fix constexpr __builtin_*_overflow issue when 
unsigned->signed operand. (authored by erichkeane, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62665?vs=202268&id=202302#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62665

Files:
  cfe/trunk/lib/AST/ExprConstant.cpp
  cfe/trunk/test/SemaCXX/builtins-overflow.cpp


Index: cfe/trunk/test/SemaCXX/builtins-overflow.cpp
===
--- cfe/trunk/test/SemaCXX/builtins-overflow.cpp
+++ cfe/trunk/test/SemaCXX/builtins-overflow.cpp
@@ -2,6 +2,7 @@
 // expected-no-diagnostics
 
 #include 
+#include 
 
 int a() {
   const int x = 3;
@@ -50,6 +51,7 @@
 static_assert(sub(static_cast(0),static_cast(1)) == 
Result{true, UCHAR_MAX});
 static_assert(sub(static_cast(0),static_cast(1)) == Result{false, -1});
 static_assert(sub(static_cast(0),static_cast(1)) 
== Result{true, USHRT_MAX});
+static_assert(sub(static_cast(255),static_cast(100)) == 
Result{false, 155});
 
 static_assert(sub(17,22) == Result{false, -5});
 static_assert(sub(INT_MAX - 22, -23) == Result{true, INT_MIN});
@@ -91,3 +93,4 @@
 static_assert(smul(17,22) == Result{false, 374});
 static_assert(smul(INT_MAX / 22, 23) == Result{true, -2049870757});
 static_assert(smul(INT_MIN / 22, -23) == Result{true, -2049870757});
+
Index: cfe/trunk/lib/AST/ExprConstant.cpp
===
--- cfe/trunk/lib/AST/ExprConstant.cpp
+++ cfe/trunk/lib/AST/ExprConstant.cpp
@@ -9454,10 +9454,8 @@
   if (IsSigned && !AllSigned)
 ++MaxBits;
 
-  LHS = APSInt(IsSigned ? LHS.sextOrSelf(MaxBits) : 
LHS.zextOrSelf(MaxBits),
-   !IsSigned);
-  RHS = APSInt(IsSigned ? RHS.sextOrSelf(MaxBits) : 
RHS.zextOrSelf(MaxBits),
-   !IsSigned);
+  LHS = APSInt(LHS.extOrTrunc(MaxBits), !IsSigned);
+  RHS = APSInt(RHS.extOrTrunc(MaxBits), !IsSigned);
   Result = APSInt(MaxBits, !IsSigned);
 }
 


Index: cfe/trunk/test/SemaCXX/builtins-overflow.cpp
===
--- cfe/trunk/test/SemaCXX/builtins-overflow.cpp
+++ cfe/trunk/test/SemaCXX/builtins-overflow.cpp
@@ -2,6 +2,7 @@
 // expected-no-diagnostics
 
 #include 
+#include 
 
 int a() {
   const int x = 3;
@@ -50,6 +51,7 @@
 static_assert(sub(static_cast(0),static_cast(1)) == Result{true, UCHAR_MAX});
 static_assert(sub(static_cast(0),static_cast(1)) == Result{false, -1});
 static_assert(sub(static_cast(0),static_cast(1)) == Result{true, USHRT_MAX});
+static_assert(sub(static_cast(255),static_cast(100)) == Result{false, 155});
 
 static_assert(sub(17,22) == Result{false, -5});
 static_assert(sub(INT_MAX - 22, -23) == Result{true, INT_MIN});
@@ -91,3 +93,4 @@
 static_assert(smul(17,22) == Result{false, 374});
 static_assert(smul(INT_MAX / 22, 23) == Result{true, -2049870757});
 static_assert(smul(INT_MIN / 22, -23) == Result{true, -2049870757});
+
Index: cfe/trunk/lib/AST/ExprConstant.cpp
===
--- cfe/trunk/lib/AST/ExprConstant.cpp
+++ cfe/trunk/lib/AST/ExprConstant.cpp
@@ -9454,10 +9454,8 @@
   if (IsSigned && !AllSigned)
 ++MaxBits;
 
-  LHS = APSInt(IsSigned ? LHS.sextOrSelf(MaxBits) : LHS.zextOrSelf(MaxBits),
-   !IsSigned);
-  RHS = APSInt(IsSigned ? RHS.sextOrSelf(MaxBits) : RHS.zextOrSelf(MaxBits),
-   !IsSigned);
+  LHS = APSInt(LHS.extOrTrunc(MaxBits), !IsSigned);
+  RHS = APSInt(RHS.extOrTrunc(MaxBits), !IsSigned);
   Result = APSInt(MaxBits, !IsSigned);
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r362160 - [Remarks][NFC] Move the serialization to lib/Remarks

2019-05-30 Thread Francis Visoiu Mistrih via cfe-commits
Author: thegameg
Date: Thu May 30 14:45:59 2019
New Revision: 362160

URL: http://llvm.org/viewvc/llvm-project?rev=362160&view=rev
Log:
[Remarks][NFC] Move the serialization to lib/Remarks

Separate the remark serialization to YAML from the LLVM Diagnostics.

This adds a new serialization abstraction: remarks::Serializer. It's
completely independent from lib/IR and it provides an easy way to
replace YAML by providing a new remarks::Serializer.

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

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

Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=362160&r1=362159&r2=362160&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Thu May 30 14:45:59 2019
@@ -279,7 +279,8 @@ namespace clang {
 }
 
 Ctx.setRemarkStreamer(llvm::make_unique(
-CodeGenOpts.OptRecordFile, OptRecordFile->os()));
+CodeGenOpts.OptRecordFile,
+llvm::make_unique(OptRecordFile->os(;
 
 if (!CodeGenOpts.OptRecordPasses.empty())
   if (Error E = Ctx.getRemarkStreamer()->setFilter(


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


[PATCH] D62622: [CMake] Provide an option to use relative paths in debug info

2019-05-30 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 202310.

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

https://reviews.llvm.org/D62622

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake
  llvm/cmake/modules/HandleLLVMOptions.cmake
  llvm/cmake/modules/LLVMExternalProjectUtils.cmake
  llvm/runtimes/CMakeLists.txt


Index: llvm/runtimes/CMakeLists.txt
===
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -371,7 +371,9 @@
 
-DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
 -DLLVM_BINARY_DIR=${LLVM_BINARY_DIR}
 -DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR}
+
-DLLVM_MAIN_SRC_DIR=${LLVM_MAIN_SRC_DIR}
 
-DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_TRIPLE}
+
-DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
 
-DCMAKE_C_COMPILER_TARGET=${TARGET_TRIPLE}
 
-DCMAKE_CXX_COMPILER_TARGET=${TARGET_TRIPLE}
@@ -462,7 +464,9 @@
 
-DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
 -DLLVM_BINARY_DIR=${LLVM_BINARY_DIR}
 -DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR}
+
-DLLVM_MAIN_SRC_DIR=${LLVM_MAIN_SRC_DIR}
 -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+
-DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
 -DCMAKE_C_COMPILER_TARGET=${target}
 -DCMAKE_CXX_COMPILER_TARGET=${target}
Index: llvm/cmake/modules/LLVMExternalProjectUtils.cmake
===
--- llvm/cmake/modules/LLVMExternalProjectUtils.cmake
+++ llvm/cmake/modules/LLVMExternalProjectUtils.cmake
@@ -231,6 +231,8 @@
-DLLVM_ENABLE_WERROR=${LLVM_ENABLE_WERROR}
-DLLVM_HOST_TRIPLE=${LLVM_HOST_TRIPLE}
-DLLVM_HAVE_LINK_VERSION_SCRIPT=${LLVM_HAVE_LINK_VERSION_SCRIPT}
+   -DLLVM_USE_RELATIVE_PATHS=${LLVM_USE_RELATIVE_PATHS}
+   -DLLVM_SOURCE_PREFIX=${LLVM_SOURCE_PREFIX}
-DPACKAGE_VERSION=${PACKAGE_VERSION}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -977,3 +977,19 @@
 endif()
   endif()
 endif()
+
+option(LLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO "Use relative paths in debug 
info" OFF)
+set(LLVM_SOURCE_PREFIX "" CACHE STRING "Use prefix for sources in debug info")
+
+if(LLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO)
+  check_c_compiler_flag("-fdebug-prefix-map=foo=bar" 
SUPPORTS_FDEBUG_PREFIX_MAP)
+  if(LLVM_ENABLE_PROJECTS_USED)
+get_filename_component(source_root "${LLVM_MAIN_SRC_DIR}/.." ABSOLUTE)
+  else()
+set(source_root "${LLVM_MAIN_SRC_DIR}")
+  endif()
+  file(RELATIVE_PATH relative_root "${source_root}" "${CMAKE_BINARY_DIR}")
+  append_if(SUPPORTS_FDEBUG_PREFIX_MAP 
"-fdebug-prefix-map=${CMAKE_BINARY_DIR}=${relative_root}" CMAKE_C_FLAGS 
CMAKE_CXX_FLAGS)
+  append_if(SUPPORTS_FDEBUG_PREFIX_MAP 
"-fdebug-prefix-map=${source_root}/=${LLVM_SOURCE_PREFIX}" CMAKE_C_FLAGS 
CMAKE_CXX_FLAGS)
+  add_flag_if_supported("-no-canonical-prefixes" NO_CANONICAL_PREFIXES)
+endif()
Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -15,6 +15,7 @@
 set(LLVM_EXTERNALIZE_DEBUGINFO ON CACHE BOOL "")
 set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "")
 set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "")
+set(LLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO ON CACHE BOOL "")
 
 set(CLANG_DEFAULT_CXX_STDLIB libc++ CACHE STRING "")
 if(NOT APPLE)


Index: llvm/runtimes/CMakeLists.txt
===
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -371,7 +371,9 @@
 -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
 -DLLVM_BINARY_DIR=${LLVM_BINARY_DIR}
 -DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR}
+-DLLVM_MAIN_SRC_DIR=${LLVM_MAIN_SRC_DIR}
 -DLLVM_

[PATCH] D62622: [CMake] Provide an option to use relative paths in debug info

2019-05-30 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

In D62622#1523269 , @aprantl wrote:

> I like LLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO.


Done


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

https://reviews.llvm.org/D62622



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


[PATCH] D61923: [GWP-ASan] Mutex implementation [2].

2019-05-30 Thread Mitch Phillips via Phabricator via cfe-commits
hctim added a comment.

Looks like this also broke an armv8 bot, due to a maximum number of threads 
issue. Have filed rL362163  to attempt to 
fix. If that doesn't work, I'll just disable the test for armv8.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D61923



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


r362166 - Add enums as global variables in the IR metadata.

2019-05-30 Thread Amy Huang via cfe-commits
Author: akhuang
Date: Thu May 30 15:04:11 2019
New Revision: 362166

URL: http://llvm.org/viewvc/llvm-project?rev=362166&view=rev
Log:
Add enums as global variables in the IR metadata.

Summary:
Keeps track of the enums that were used by saving them as DIGlobalVariables,
since CodeView emits debug info for global constants.

Reviewers: rnk

Subscribers: aprantl, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/test/CodeGenCXX/debug-info-enum.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=362166&r1=362165&r2=362166&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu May 30 15:04:11 2019
@@ -4240,7 +4240,7 @@ void CGDebugInfo::EmitDeclareOfBlockLite
 
 llvm::DIDerivedType *
 CGDebugInfo::getOrCreateStaticDataMemberDeclarationOrNull(const VarDecl *D) {
-  if (!D->isStaticDataMember())
+  if (!D || !D->isStaticDataMember())
 return nullptr;
 
   auto MI = StaticDataMemberCache.find(D->getCanonicalDecl());
@@ -4353,12 +4353,14 @@ void CGDebugInfo::EmitGlobalVariable(con
   StringRef Name = VD->getName();
   llvm::DIType *Ty = getOrCreateType(VD->getType(), Unit);
 
-  // Do not use global variables for enums.
+  // Do not use global variables for enums, unless for CodeView.
   if (const auto *ECD = dyn_cast(VD)) {
 const auto *ED = cast(ECD->getDeclContext());
 assert(isa(ED->getTypeForDecl()) && "Enum without EnumType?");
 (void)ED;
-return;
+
+if (!CGM.getCodeGenOpts().EmitCodeView)
+  return;
   }
 
   llvm::DIScope *DContext = nullptr;
@@ -4369,8 +4371,8 @@ void CGDebugInfo::EmitGlobalVariable(con
 
   // Emit definition for static members in CodeView.
   VD = cast(VD->getCanonicalDecl());
-  auto *VarD = cast(VD);
-  if (VarD->isStaticDataMember()) {
+  auto *VarD = dyn_cast(VD);
+  if (VarD && VarD->isStaticDataMember()) {
 auto *RD = cast(VarD->getDeclContext());
 getDeclContextDescriptor(VarD);
 // Ensure that the type is retained even though it's otherwise 
unreferenced.

Modified: cfe/trunk/test/CodeGenCXX/debug-info-enum.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-enum.cpp?rev=362166&r1=362165&r2=362166&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-enum.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-enum.cpp Thu May 30 15:04:11 2019
@@ -1,9 +1,15 @@
 // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm 
-debug-info-kind=limited %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-windows-msvc -emit-llvm -gcodeview 
-debug-info-kind=limited %s -o - | FileCheck --check-prefix MSVC %s
 
 // CHECK: !DICompileUnit(
 // CHECK-SAME:   enums: [[ENUMS:![0-9]*]]
 // CHECK: [[ENUMS]] = !{[[E1:![0-9]*]], [[E2:![0-9]*]], [[E3:![0-9]*]]}
 
+// In MSVC check that used enum values are emitted as globals.
+// MSVC: !DICompileUnit(
+// MSVC-SAME:   globals: [[GLOBALS:![0-9]*]]
+// MSVC: [[GLOBALS]] = !{[[G1:![0-9]*]], [[G2:![0-9]*]]}
+
 namespace test1 {
 // CHECK: [[E1]] = !DICompositeType(tag: DW_TAG_enumeration_type, name: "e"
 // CHECK-SAME:  scope: [[TEST1:![0-9]*]]
@@ -12,6 +18,10 @@ namespace test1 {
 // CHECK: [[TEST1]] = !DINamespace(name: "test1"
 // CHECK: [[TEST1_ENUMS]] = !{[[TEST1_E:![0-9]*]]}
 // CHECK: [[TEST1_E]] = !DIEnumerator(name: "E", value: 0, isUnsigned: true)
+
+// MSVC: [[G1]] = !DIGlobalVariableExpression(var: [[VAR1:![0-9]*]],
+// MSVC-SAME: expr: 
!DIExpression(DW_OP_constu, 0
+// MSVC: [[VAR1]] = distinct !DIGlobalVariable(name: "E"
 enum e { E };
 void foo() {
   int v = E;
@@ -25,6 +35,10 @@ namespace test2 {
 // CHECK-SAME:  elements: [[TEST1_ENUMS]]
 // CHECK-SAME:  identifier: "_ZTSN5test21eE"
 // CHECK: [[TEST2]] = !DINamespace(name: "test2"
+
+// MSVC: [[G2]] = !DIGlobalVariableExpression(var: [[VAR2:![0-9]*]],
+// MSVC-SAME: expr: 
!DIExpression(DW_OP_constu, 0
+// MSVC: [[VAR2]] = distinct !DIGlobalVariable(name: "E"
 enum e { E };
 bool func(int i) {
   return i == E;


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


[PATCH] D62635: Add enums as global variables in the IR metadata.

2019-05-30 Thread Amy Huang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362166: Add enums as global variables in the IR metadata. 
(authored by akhuang, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62635?vs=202079&id=202312#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62635

Files:
  cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
  cfe/trunk/test/CodeGenCXX/debug-info-enum.cpp
  llvm/trunk/test/DebugInfo/COFF/global-constants.ll

Index: llvm/trunk/test/DebugInfo/COFF/global-constants.ll
===
--- llvm/trunk/test/DebugInfo/COFF/global-constants.ll
+++ llvm/trunk/test/DebugInfo/COFF/global-constants.ll
@@ -2,26 +2,41 @@
 ; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s --check-prefix=OBJ
 
 ; C++ source to regenerate:
-; const int Test1 = 1;
-; struct Foo { static const int Test2 = 2; };
-; int main() {
-;   return Test1 + Foo::Test2;
+; const float TestConst1 = 3.14;
+; struct S {
+;   static const int TestConst2 = -10;
+; }
+; enum TestEnum : int {
+;ENUM_A = 214700,
+;ENUM_B = -214700,
+; };
+; void useConst(int);
+; void foo() {
+;   useConst(TestConst1);
+;   useConst(S::TestConst2);
+;   useConst(ENUM_B);
 ; }
 ; $ clang t.cpp -S -emit-llvm -g -gcodeview -o t.ll
 
-; ASM-LABEL:  .long 241 # Symbol subsection for globals
-
-; ASM:.short {{.*-.*}}  # Record length
-; ASM:.short 4359   # Record kind: S_CONSTANT
-; ASM-NEXT:   .long 4099# Type
-; ASM-NEXT:   .byte 0x01, 0x00  # Value
-; ASM-NEXT:   .asciz "Test1"# Name
-
-; ASM:.short {{.*-.*}}  # Record length
-; ASM:.short 4359   # Record kind: S_CONSTANT
-; ASM:.long 4099# Type
-; ASM:.byte 0x02, 0x00  # Value
-; ASM:.asciz "Foo::Test2"   # Name
+; ASM-LABEL:  .long 241 # Symbol subsection for globals
+; ASM:.short {{.*-.*}}  # Record length
+; ASM:.short 4359   # Record kind: S_CONSTANT
+; ASM-NEXT:   .long 4099# Type
+; ASM-NEXT:   .byte 0x04, 0x80, 0xc3, 0xf5  # Value
+; ASM-NEXT:   .byte 0x48, 0x40
+; ASM-NEXT:   .asciz "TestConst1"   # Name
+; ASM:.short {{.*-.*}}  # Record length
+; ASM:.short 4359   # Record kind: S_CONSTANT
+; ASM-NEXT:   .long 4100# Type
+; ASM-NEXT:   .byte 0x61, 0x00  # Value
+; ASM-NEXT:   .asciz "S::TestConst2"# Name
+; ASM:.short {{.*-.*}}  # Record length
+; ASM:.short 4359   # Record kind: S_CONSTANT
+; ASM-NEXT:   .long 4102# Type
+; ASM-NEXT:   .byte 0x0a, 0x80, 0x40, 0x61  # Value
+; ASM-NEXT:   .byte 0x07, 0x80, 0xff, 0xff
+; ASM-NEXT:   .byte 0xff, 0xff
+; ASM-NEXT:   .asciz "ENUM_B"   # Name
 
 ; OBJ:CodeViewDebugInfo [
 ; OBJ:  Section: .debug$S
@@ -30,56 +45,77 @@
 ; OBJ:SubSectionType: Symbols (0xF1)
 ; OBJ:ConstantSym {
 ; OBJ-NEXT: Kind: S_CONSTANT (0x1107)
-; OBJ-NEXT: Type: const int (0x1003)
-; OBJ-NEXT: Value: 1
-; OBJ-NEXT: Name: Test1
+; OBJ-NEXT: Type: const float (0x1003)
+; OBJ-NEXT: Value: 1078523331
+; OBJ-NEXT: Name: TestConst1
 ; OBJ-NEXT:   }
-; OBJ:ConstantSym {
+; OBJ-NEXT:   ConstantSym {
 ; OBJ-NEXT: Kind: S_CONSTANT (0x1107)
-; OBJ-NEXT: Type: const int (0x1003)
-; OBJ-NEXT: Value: 2
-; OBJ-NEXT: Name: Foo::Test2
+; OBJ-NEXT: Type: const char (0x1004)
+; OBJ-NEXT: Value: 97
+; OBJ-NEXT: Name: S::TestConst2
 ; OBJ-NEXT:   }
+; OBJ-NEXT:   ConstantSym {
+; OBJ-NEXT: Kind: S_CONSTANT (0x1107)
+; OBJ-NEXT: Type: TestEnum (0x1006)
+; OBJ-NEXT: Value: 18446744071562551616
+; OBJ-NEXT: Name: ENUM_B
+; OBJ-NEXT:   }
+
 
 ; ModuleID = 't.cpp'
 source_filename = "t.cpp"
 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-pc-windows-msvc"
+target triple = "x86_64-w64-windows-gnu"
 
-; Function Attrs: noinline norecurse nounwind optnone
-define dso_local i32 @main() #0 !dbg !19 {
+; Function Attrs: noinline nounwind optnone
+define dso_local void @_Z3foov() #0 !dbg !28 {
 entry:
-  %retval = alloca i32, align 4
-  store i32 0, i32* %retval, align 4
-  ret i32 3, !dbg !22
+  call void @_Z8useConsti(i32 3), !dbg !32
+  call void @_Z8useConsti(i32 97), !dbg !33
+  call void @_Z8useConsti(i32 -214700), !dbg !34
+  ret void, !dbg !35
 }
 
-attributes #0 = { noinline norecurse nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="false" "no-infs-fp-math

  1   2   >