[PATCH] D79477: [clang-tidy] Add --use-color command line option and UseColor option to control colors in diagnostics

2020-05-08 Thread hyd-dev via Phabricator via cfe-commits
hyd-dev added a comment.

None of the clang-tidy command line options are prefixed with `-f`.
This command line option used to be `--color-diagnostics`, but I've followed 
@hokein's advice to change it to `--use-color`.
If you mean to use the `-fcolor-diagnostics` option from 
`compile_commands.json`, clang-tidy and clang are two separate tools. The users 
may not want them to share the same setting, because they may invoke them in 
different environments.


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

https://reviews.llvm.org/D79477



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


[PATCH] D46317: [clang-tidy] New check bugprone-map-subscript-operator-lookup

2020-05-08 Thread Louis Brandy via Phabricator via cfe-commits
lbrandy added a comment.

Someone pointed this patch/thread out to me so I wanted to give some background 
on what prompted the mention of this in my talk.

I think this particular bug is a _huge_ and _recurring_ problem (we've had yet 
more examples recently, internally) but I also believe that the legitimate uses 
of `map::operator[]` far outnumber the problematic cases. Data would sway me 
but my guess is that the false positive rate of this check would make it 
exceptionally difficult to ever enable this in anger. I don't think this is 
something we (facebook) could or would turn on, by default, in our codebase. I 
mentioned we'd had people seriously discuss banning it but none of those 
arguments actually turned into a consensus to act. I'd be super curious if 
anyone had experience actually trying to use a rule like this in their 
codebase. I just didn't want ya'll to have the impression that internal FB 
guidance and/or rules enforce this successfuly. We don't. And the reason we 
don't is the same reasons expressed above: that the signal-to-noise ratio seems 
way, way off. Obviously that doesn't mean a rule like this for clang-tidy 
wouldn't be useful, maybe it is, but it's a tough rule for me to believe would 
be a good idea to have enabled by default.


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

https://reviews.llvm.org/D46317



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


[clang] c90e198 - Fix parsing of enum-base to follow C++11 rules.

2020-05-08 Thread Richard Smith via cfe-commits

Author: Richard Smith
Date: 2020-05-08T19:32:00-07:00
New Revision: c90e198107431f64b73686bdce31c293e3380ac7

URL: 
https://github.com/llvm/llvm-project/commit/c90e198107431f64b73686bdce31c293e3380ac7
DIFF: 
https://github.com/llvm/llvm-project/commit/c90e198107431f64b73686bdce31c293e3380ac7.diff

LOG: Fix parsing of enum-base to follow C++11 rules.

Previously we implemented non-standard disambiguation rules to
distinguish an enum-base from a bit-field but otherwise treated a :
after an elaborated-enum-specifier as introducing an enum-base. That
misparses various examples (anywhere an elaborated-type-specifier can
appear followed by a colon, such as within a ternary operator or
_Generic).

We now implement the C++11 rules, with the old cases accepted as
extensions where that seemed reasonable. These amount to:
 * an enum-base must always be accompanied by an enum definition (except
   in a standalone declaration of the form 'enum E : T;')
 * in a member-declaration, 'enum E :' always introduces an enum-base,
   never a bit-field
 * in a type-specifier (or similar context), 'enum E :' is not
   permitted; the colon means whatever else it would mean in that
   context.

Fixed underlying types for enums are also permitted in Objective-C and
under MS extensions, plus as a language extension in all other modes.
The behavior in ObjC and MS extensions modes is unchanged (but the
bit-field disambiguation is a bit better); remaining language modes
follow the C++11 rules.

Fixes PR45726, PR39979, PR19810, PR44941, and most of PR24297, plus C++
core issues 1514 and 1966.

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticParseKinds.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Parse/Parser.h
clang/lib/Parse/ParseDecl.cpp
clang/lib/Parse/ParseDeclCXX.cpp
clang/lib/Parse/ParseTentative.cpp
clang/lib/Sema/SemaDecl.cpp
clang/test/CXX/drs/dr15xx.cpp
clang/test/CXX/drs/dr19xx.cpp
clang/test/CXX/drs/dr21xx.cpp
clang/test/CXX/expr/expr.prim/expr.prim.general/p8-0x.cpp
clang/test/Parser/c1x-generic-selection.c
clang/test/Parser/cxx0x-ambig.cpp
clang/test/Parser/cxx0x-decl.cpp
clang/test/SemaCXX/enum-bitfield.cpp
clang/test/SemaCXX/enum-scoped.cpp
clang/test/SemaObjC/enum-fixed-type.m
clang/www/cxx_dr_status.html

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticParseKinds.td 
b/clang/include/clang/Basic/DiagnosticParseKinds.td
index 552c9187e705..04014780615b 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -105,6 +105,14 @@ def ext_clang_c_enum_fixed_underlying_type : Extension<
 def warn_cxx98_compat_enum_fixed_underlying_type : Warning<
   "enumeration types with a fixed underlying type are incompatible with 
C++98">,
   InGroup, DefaultIgnore;
+def ext_enum_base_in_type_specifier : ExtWarn<
+  "non-defining declaration of enumeration with a fixed underlying type is "
+  "only permitted as a standalone declaration"
+  "%select{|; missing list of enumerators?}0">, 
InGroup>;
+def err_anonymous_enum_bitfield : Error<
+  "ISO C++ only allows ':' in member enumeration declaration to introduce "
+  "a fixed underlying type, not an anonymous bit-field">;
+
 def warn_cxx98_compat_alignof : Warning<
   "alignof expressions are incompatible with C++98">,
   InGroup, DefaultIgnore;

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index b3f6f66a8c56..5ca0982ce5c3 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -5484,6 +5484,8 @@ def err_bitfield_width_exceeds_type_width : Error<
 def err_anon_bitfield_width_exceeds_type_width : Error<
   "width of anonymous bit-field (%0 bits) exceeds %select{width|size}1 "
   "of its type (%2 bit%s2)">;
+def err_anon_bitfield_init : Error<
+  "anonymous bit-field cannot have a default member initializer">;
 def err_incorrect_number_of_vector_initializers : Error<
   "number of elements must be either one or match the size of the vector">;
 

diff  --git a/clang/include/clang/Parse/Parser.h 
b/clang/include/clang/Parse/Parser.h
index 4a8acf5cd196..cbdf9fede665 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -2181,6 +2181,68 @@ class Parser : public CodeCompletionHandler {
 llvm_unreachable("Missing DeclSpecContext case");
   }
 
+  /// Whether a defining-type-specifier is permitted in a given context.
+  enum class AllowDefiningTypeSpec {
+/// The grammar doesn't allow a defining-type-specifier here, and we must
+/// not parse one (eg, because a '{' could mean something else).
+No,
+/// The grammar doesn't allow a defining-type-specifier here, but we permit
+/// one for error recovery purposes. Sema will reject.
+

[PATCH] D62368: Add vendor identity check for Hygon Dhyana processor in Scudo

2020-05-08 Thread Jinke Fan via Phabricator via cfe-commits
fanjinke added a comment.

Hi Cryptoad,

Could you help me to commit the patch? Because I don't have access.

Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62368



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


[clang] 03cb328 - clang: Cleanup usage of CreateMemCpy

2020-05-08 Thread Matt Arsenault via cfe-commits

Author: Matt Arsenault
Date: 2020-05-08T20:57:56-04:00
New Revision: 03cb328d6f691bde88c754341ff3859d1c1ecc2f

URL: 
https://github.com/llvm/llvm-project/commit/03cb328d6f691bde88c754341ff3859d1c1ecc2f
DIFF: 
https://github.com/llvm/llvm-project/commit/03cb328d6f691bde88c754341ff3859d1c1ecc2f.diff

LOG: clang: Cleanup usage of CreateMemCpy

It handles the the pointee type casts in preparation for opaque
pointers.

Added: 


Modified: 
clang/lib/CodeGen/CGCall.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index e336741d9111..32a9ba499ecb 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -1262,11 +1262,9 @@ static llvm::Value *CreateCoercedLoad(Address Src, 
llvm::Type *Ty,
 
   // Otherwise do coercion through memory. This is stupid, but simple.
   Address Tmp = CreateTempAllocaForCoercion(CGF, Ty, Src.getAlignment());
-  Address Casted = CGF.Builder.CreateElementBitCast(Tmp,CGF.Int8Ty);
-  Address SrcCasted = CGF.Builder.CreateElementBitCast(Src,CGF.Int8Ty);
-  CGF.Builder.CreateMemCpy(Casted, SrcCasted,
-  llvm::ConstantInt::get(CGF.IntPtrTy, SrcSize),
-  false);
+  CGF.Builder.CreateMemCpy(Tmp.getPointer(), Tmp.getAlignment().getAsAlign(),
+   Src.getPointer(), Src.getAlignment().getAsAlign(),
+   llvm::ConstantInt::get(CGF.IntPtrTy, SrcSize));
   return CGF.Builder.CreateLoad(Tmp);
 }
 
@@ -1349,11 +1347,9 @@ static void CreateCoercedStore(llvm::Value *Src,
 // to that information.
 Address Tmp = CreateTempAllocaForCoercion(CGF, SrcTy, Dst.getAlignment());
 CGF.Builder.CreateStore(Src, Tmp);
-Address Casted = CGF.Builder.CreateElementBitCast(Tmp,CGF.Int8Ty);
-Address DstCasted = CGF.Builder.CreateElementBitCast(Dst,CGF.Int8Ty);
-CGF.Builder.CreateMemCpy(DstCasted, Casted,
-llvm::ConstantInt::get(CGF.IntPtrTy, DstSize),
-false);
+CGF.Builder.CreateMemCpy(Dst.getPointer(), Dst.getAlignment().getAsAlign(),
+ Tmp.getPointer(), Tmp.getAlignment().getAsAlign(),
+ llvm::ConstantInt::get(CGF.IntPtrTy, DstSize));
   }
 }
 
@@ -2404,10 +2400,10 @@ void CodeGenFunction::EmitFunctionProlog(const 
CGFunctionInfo ,
   // FIXME: We should have a common utility for generating an aggregate
   // copy.
   CharUnits Size = getContext().getTypeSizeInChars(Ty);
-  auto SizeVal = llvm::ConstantInt::get(IntPtrTy, Size.getQuantity());
-  Address Dst = Builder.CreateBitCast(AlignedTemp, Int8PtrTy);
-  Address Src = Builder.CreateBitCast(ParamAddr, Int8PtrTy);
-  Builder.CreateMemCpy(Dst, Src, SizeVal, false);
+  Builder.CreateMemCpy(
+  AlignedTemp.getPointer(), 
AlignedTemp.getAlignment().getAsAlign(),
+  ParamAddr.getPointer(), ParamAddr.getAlignment().getAsAlign(),
+  llvm::ConstantInt::get(IntPtrTy, Size.getQuantity()));
   V = AlignedTemp;
 }
 ArgVals.push_back(ParamValue::forIndirect(V));



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


[PATCH] D79655: [WebAssembly] Ignore exception specifications

2020-05-08 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin marked an inline comment as done.
aheejin added inline comments.



Comment at: clang/lib/CodeGen/CGException.cpp:23
 #include "clang/AST/StmtVisitor.h"
+#include "clang/Basic/DiagnosticSema.h"
 #include "clang/Basic/TargetBuiltins.h"

aheejin wrote:
> One thing I'm not sure about is if it is a good thing to include this in 
> CodeGen. Usually this header is used in Sema/ directory. This depends on 
> which .td file I add `warn_wasm_exception_spec_ignored`. 
> DiagnosticSemaKinds.td seemed to have a section in exception spec so I added 
> it there, but not entirely sure if that's the best location to add it.
Oh, and this warning message was requested by Adobe, but I think it's good to 
have in general.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79655



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


LLVM buildmaster will be updated and restarted after 7PM PST today

2020-05-08 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be updated and restarted after 7PM PST today.

Thanks

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


[PATCH] D79655: [WebAssembly] Ignore exception specifications

2020-05-08 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin marked an inline comment as done.
aheejin added inline comments.



Comment at: clang/lib/CodeGen/CGException.cpp:23
 #include "clang/AST/StmtVisitor.h"
+#include "clang/Basic/DiagnosticSema.h"
 #include "clang/Basic/TargetBuiltins.h"

One thing I'm not sure about is if it is a good thing to include this in 
CodeGen. Usually this header is used in Sema/ directory. This depends on which 
.td file I add `warn_wasm_exception_spec_ignored`. DiagnosticSemaKinds.td 
seemed to have a section in exception spec so I added it there, but not 
entirely sure if that's the best location to add it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79655



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


[clang] 9a11174 - [Driver] Add -fno-test-coverage

2020-05-08 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2020-05-08T17:01:53-07:00
New Revision: 9a11174287c78e6f807823fdfbdf4c27c0cad3d9

URL: 
https://github.com/llvm/llvm-project/commit/9a11174287c78e6f807823fdfbdf4c27c0cad3d9
DIFF: 
https://github.com/llvm/llvm-project/commit/9a11174287c78e6f807823fdfbdf4c27c0cad3d9.diff

LOG: [Driver] Add -fno-test-coverage

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/coverage.c

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index ef8ccb5b90e2..0d00e34040bc 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1875,6 +1875,7 @@ def foptimization_record_passes_EQ : Joined<["-"], 
"foptimization-record-passes=
   MetaVarName<"">;
 
 def ftest_coverage : Flag<["-"], "ftest-coverage">, Group;
+def fno_test_coverage : Flag<["-"], "fno-test-coverage">, Group;
 def fvectorize : Flag<["-"], "fvectorize">, Group,
   HelpText<"Enable the loop vectorization passes">;
 def fno_vectorize : Flag<["-"], "fno-vectorize">, Group;

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 7d52d7faa48f..42d5af71c23c 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -861,7 +861,8 @@ static void addPGOAndCoverageFlags(const ToolChain , 
Compilation ,
 }
   }
 
-  bool EmitCovNotes = Args.hasArg(options::OPT_ftest_coverage) ||
+  bool EmitCovNotes = Args.hasFlag(options::OPT_ftest_coverage,
+   options::OPT_fno_test_coverage, false) ||
   Args.hasArg(options::OPT_coverage);
   bool EmitCovData = TC.needsGCovInstrumentation(Args);
   if (EmitCovNotes)

diff  --git a/clang/test/Driver/coverage.c b/clang/test/Driver/coverage.c
index 4e1b49bd3a72..f8f493715581 100644
--- a/clang/test/Driver/coverage.c
+++ b/clang/test/Driver/coverage.c
@@ -1,3 +1,10 @@
+// RUN: %clang -### -S -ftest-coverage %s 2>&1 | FileCheck 
--check-prefix=TEST-COVERAGE %s
+// RUN: %clang -### -S -ftest-coverage -fno-test-coverage %s 2>&1 | FileCheck 
--check-prefix=NO-TEST-COVERAGE %s
+
+// TEST-COVERAGE: "-femit-coverage-notes"
+// TEST-COVERAGE: "-coverage-notes-file" "{{.*}}{{/|}}coverage.gcno"
+// NO-TEST-COVERAGE-NOT: "-coverage-notes-file"
+
 // RUN: %clang -### -S -fprofile-arcs %s 2>&1 | FileCheck 
--check-prefix=PROFILE-ARCS %s
 // RUN: %clang -### -S -fprofile-arcs -fno-profile-arcs %s 2>&1 | FileCheck 
--check-prefix=NO-PROFILE-ARCS %s
 



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


[PATCH] D78659: Add nomerge function attribute to supress tail merge optimization in simplifyCFG

2020-05-08 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 262977.
zequanwu added a comment.

add `nomerge` case in `CodeExtractor.cpp`


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

https://reviews.llvm.org/D78659

Files:
  llvm/docs/LangRef.rst
  llvm/include/llvm/Bitcode/LLVMBitCodes.h
  llvm/include/llvm/IR/Attributes.td
  llvm/include/llvm/IR/InstrTypes.h
  llvm/lib/AsmParser/LLLexer.cpp
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/AsmParser/LLToken.h
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/IR/Attributes.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Transforms/Utils/CodeExtractor.cpp
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp
  llvm/test/Transforms/SimplifyCFG/nomerge.ll

Index: llvm/test/Transforms/SimplifyCFG/nomerge.ll
===
--- /dev/null
+++ llvm/test/Transforms/SimplifyCFG/nomerge.ll
@@ -0,0 +1,71 @@
+; RUN: opt < %s -O1 -S | FileCheck %s
+
+; The attribute nomerge prevents the 3 bar() calls from being sunk/hoisted into 
+; one inside a function. Check that there are still 3 tail calls.
+
+; Test case for preventing sinking
+; CHECK-LABEL: define void @sink
+; CHECK: if.then:
+; CHECK-NEXT: tail call void @bar()
+; CHECK: if.then2:
+; CHECK-NEXT: tail call void @bar()
+; CHECK: if.end3:
+; CHECK-NEXT: tail call void @bar()
+define void @sink(i32 %i) {
+entry:
+  switch i32 %i, label %if.end3 [
+i32 5, label %if.then
+i32 7, label %if.then2
+  ]
+
+if.then:
+  tail call void @bar() #0
+  br label %if.end3
+
+if.then2:
+  tail call void @bar() #0
+  br label %if.end3
+
+if.end3:
+  tail call void @bar() #0
+  ret void
+}
+
+; Test case for preventing hoisting
+; CHECK-LABEL: define void @hoist
+; CHECK: if.then:
+; CHECK-NEXT: tail call void @bar()
+; CHECK: if.then2:
+; CHECK-NEXT: tail call void @bar()
+; CHECK: if.end:
+; CHECK-NEXT: tail call void @bar()
+define void @hoist(i32 %i) {
+entry:
+  %i.addr = alloca i32, align 4
+  store i32 %i, i32* %i.addr, align 4
+  %0 = load i32, i32* %i.addr, align 4
+  %cmp = icmp eq i32 %0, 5
+  br i1 %cmp, label %if.then, label %if.else
+
+if.then:
+  tail call void @bar() #1
+  unreachable
+
+if.else:
+  %1 = load i32, i32* %i.addr, align 4
+  %cmp1 = icmp eq i32 %i, 7
+  br i1 %cmp1, label %if.then2, label %if.end
+
+if.then2:
+  tail call void @bar() #1
+  unreachable
+
+if.end:
+  tail call void @bar() #1
+  unreachable
+}
+
+declare void @bar()
+
+attributes #0 = { nomerge }
+attributes #1 = { noreturn nomerge }
Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
===
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1300,6 +1300,14 @@
 if (!TTI.isProfitableToHoist(I1) || !TTI.isProfitableToHoist(I2))
   return Changed;
 
+// If any of the two call sites has nomerge attribute, stop hoisting.
+if (const auto *CB1 = dyn_cast(I1))
+  if (CB1->cannotMerge())
+return Changed;
+if (const auto *CB2 = dyn_cast(I2))
+  if (CB2->cannotMerge())
+return Changed;
+
 if (isa(I1) || isa(I2)) {
   assert (isa(I1) && isa(I2));
   // The debug location is an integral part of a debug info intrinsic
@@ -1485,8 +1493,9 @@
 // Conservatively return false if I is an inline-asm instruction. Sinking
 // and merging inline-asm instructions can potentially create arguments
 // that cannot satisfy the inline-asm constraints.
+// If the instruction has nomerge attribute, return false.
 if (const auto *C = dyn_cast(I))
-  if (C->isInlineAsm())
+  if (C->cannotMerge())
 return false;
 
 // Each instruction must have zero or one use.
Index: llvm/lib/Transforms/Utils/CodeExtractor.cpp
===
--- llvm/lib/Transforms/Utils/CodeExtractor.cpp
+++ llvm/lib/Transforms/Utils/CodeExtractor.cpp
@@ -874,6 +874,7 @@
   case Attribute::NoAlias:
   case Attribute::NoBuiltin:
   case Attribute::NoCapture:
+  case Attribute::NoMerge:
   case Attribute::NoReturn:
   case Attribute::NoSync:
   case Attribute::None:
Index: llvm/lib/IR/Verifier.cpp
===
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -1509,6 +1509,7 @@
 /// Return true if this attribute kind only applies to functions.
 static bool isFuncOnlyAttr(Attribute::AttrKind Kind) {
   switch (Kind) {
+  case Attribute::NoMerge:
   case Attribute::NoReturn:
   case Attribute::NoSync:
   case Attribute::WillReturn:
Index: llvm/lib/IR/Attributes.cpp
===
--- llvm/lib/IR/Attributes.cpp
+++ llvm/lib/IR/Attributes.cpp
@@ -372,6 +372,8 @@
 return "noinline";
   if (hasAttribute(Attribute::NonLazyBind))
 return "nonlazybind";
+  if (hasAttribute(Attribute::NoMerge))
+return "nomerge";
   if 

[PATCH] D79655: [WebAssembly] Ignore exception specifications

2020-05-08 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin created this revision.
aheejin added a reviewer: dschuff.
Herald added subscribers: cfe-commits, sunfish, jgravelle-google, sbc100.
Herald added a project: clang.

Wasm does not currently handle exception specifications such as
`throw()` or `throw(int)`. We have a plan to correctly implement this
later, but for usability at the moment, we simplify ignore them for a
temporary measure. A warning message will be printed. You can use
`noexcept` as a substitute for `throw()` from C++11.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79655

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/CodeGen/CGException.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/CodeGenCXX/wasm-eh.cpp


Index: clang/test/CodeGenCXX/wasm-eh.cpp
===
--- clang/test/CodeGenCXX/wasm-eh.cpp
+++ clang/test/CodeGenCXX/wasm-eh.cpp
@@ -1,7 +1,6 @@
 // REQUIRES: webassembly-registered-target
 // RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fms-extensions 
-fexceptions -fcxx-exceptions -fwasm-exceptions -target-feature 
+exception-handling -emit-llvm -o - -std=c++11 | FileCheck %s
 // RUN: %clang_cc1 %s -triple wasm64-unknown-unknown -fms-extensions 
-fexceptions -fcxx-exceptions -fwasm-exceptions -target-feature 
+exception-handling -emit-llvm -o - -std=c++11 | FileCheck %s
-// RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fms-extensions 
-fexceptions -fcxx-exceptions -fwasm-exceptions -target-feature 
+exception-handling -S -o - -std=c++11 | FileCheck %s --check-prefix=ASSEMBLY
 
 void may_throw();
 void dont_throw() noexcept;
@@ -385,9 +384,20 @@
 
 // CHECK:   unreachable
 
+// Wasm ignores exception specifications at the moment. Checks if a warning
+// message is printed.
+void test9() throw() {
+}
+
+// RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fms-extensions 
-fexceptions -fcxx-exceptions -fwasm-exceptions -target-feature 
+exception-handling -emit-llvm -std=c++11 2>&1 | FileCheck %s 
--check-prefix=WARNING
+
+// WARNING: warning: exception specifications are currently ignored in wasm
+
 // Here we only check if the command enables wasm exception handling in the
 // backend so that exception handling instructions can be generated in .s file.
 
+// RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fms-extensions 
-fexceptions -fcxx-exceptions -fwasm-exceptions -target-feature 
+exception-handling -S -o - -std=c++11 | FileCheck %s --check-prefix=ASSEMBLY
+
 // ASSEMBLY: try
 // ASSEMBLY: catch
 // ASSEMBLY: rethrow
Index: clang/lib/Sema/SemaDeclCXX.cpp
===
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -17537,6 +17537,7 @@
  ArrayRef DynamicExceptions,
  ArrayRef DynamicExceptionRanges,
  Expr *NoexceptExpr) {
+  Diag(SpecificationRange.getBegin(), diag::warn_wasm_exception_spec_ignored);
   if (!MethodD)
 return;
 
Index: clang/lib/CodeGen/CGException.cpp
===
--- clang/lib/CodeGen/CGException.cpp
+++ clang/lib/CodeGen/CGException.cpp
@@ -20,6 +20,7 @@
 #include "clang/AST/StmtCXX.h"
 #include "clang/AST/StmtObjC.h"
 #include "clang/AST/StmtVisitor.h"
+#include "clang/Basic/DiagnosticSema.h"
 #include "clang/Basic/TargetBuiltins.h"
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/Intrinsics.h"
@@ -468,6 +469,12 @@
 // encode these in an object file but MSVC doesn't do anything with it.
 if (getTarget().getCXXABI().isMicrosoft())
   return;
+// TODO Correctly handle exception specification in wasm
+if (getTarget().getCXXABI() == TargetCXXABI::WebAssembly) {
+  CGM.getDiags().Report(D->getLocation(),
+diag::warn_wasm_exception_spec_ignored);
+  return;
+}
 unsigned NumExceptions = Proto->getNumExceptions();
 EHFilterScope *Filter = EHStack.pushFilter(NumExceptions);
 
@@ -544,6 +551,9 @@
 // encode these in an object file but MSVC doesn't do anything with it.
 if (getTarget().getCXXABI().isMicrosoft())
   return;
+// TODO Correctly handle exception specification in wasm
+if (getTarget().getCXXABI() == TargetCXXABI::WebAssembly)
+  return;
 EHFilterScope  = cast(*EHStack.begin());
 emitFilterDispatchBlock(*this, filterScope);
 EHStack.popFilter();
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -1590,6 +1590,8 @@
   "exception specification of %0 uses itself">;
 def err_exception_spec_incomplete_type : Error<
   "exception specification needed for member of incomplete class %0">;
+def warn_wasm_exception_spec_ignored : Warning<
+  "exception specifications are currently ignored in wasm">;
 
 // C++ access checking
 def 

[clang] 0d4a33b - [Driver] Don't warn -Wunused-command-line-argument for --coverage -ftest-coverage -fprofile-arcs

2020-05-08 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2020-05-08T16:31:15-07:00
New Revision: 0d4a33ba61b7f1622eda4ec60c74a7eb7b1fcbcf

URL: 
https://github.com/llvm/llvm-project/commit/0d4a33ba61b7f1622eda4ec60c74a7eb7b1fcbcf
DIFF: 
https://github.com/llvm/llvm-project/commit/0d4a33ba61b7f1622eda4ec60c74a7eb7b1fcbcf.diff

LOG: [Driver] Don't warn -Wunused-command-line-argument for --coverage 
-ftest-coverage -fprofile-arcs

Added: 


Modified: 
clang/lib/Driver/ToolChain.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/coverage.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index a6bc953d6a51..c8f6207ec584 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -512,9 +512,9 @@ bool ToolChain::needsProfileRT(const ArgList ) {
 }
 
 bool ToolChain::needsGCovInstrumentation(const llvm::opt::ArgList ) {
-  return Args.hasFlag(options::OPT_fprofile_arcs, 
options::OPT_fno_profile_arcs,
-  false) ||
- Args.hasArg(options::OPT_coverage);
+  return Args.hasArg(options::OPT_coverage) ||
+ Args.hasFlag(options::OPT_fprofile_arcs, 
options::OPT_fno_profile_arcs,
+  false);
 }
 
 Tool *ToolChain::SelectTool(const JobAction ) const {

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 04c05a8f53e3..7d52d7faa48f 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -863,9 +863,7 @@ static void addPGOAndCoverageFlags(const ToolChain , 
Compilation ,
 
   bool EmitCovNotes = Args.hasArg(options::OPT_ftest_coverage) ||
   Args.hasArg(options::OPT_coverage);
-  bool EmitCovData = Args.hasFlag(options::OPT_fprofile_arcs,
-  options::OPT_fno_profile_arcs, false) ||
- Args.hasArg(options::OPT_coverage);
+  bool EmitCovData = TC.needsGCovInstrumentation(Args);
   if (EmitCovNotes)
 CmdArgs.push_back("-femit-coverage-notes");
   if (EmitCovData)

diff  --git a/clang/test/Driver/coverage.c b/clang/test/Driver/coverage.c
index 24e8ac9d888b..4e1b49bd3a72 100644
--- a/clang/test/Driver/coverage.c
+++ b/clang/test/Driver/coverage.c
@@ -12,6 +12,9 @@
 // GCNO-LOCATION: "-coverage-notes-file" "{{.*}}/foo/bar.gcno"
 // GCNO-LOCATION-REL: "-coverage-notes-file" "{{.*}}{{/|}}foo/bar.gcno"
 
+/// Don't warn -Wunused-command-line-argument.
+// RUN: %clang -E -Werror --coverage -ftest-coverage -fprofile-arcs %s
+
 /// Test -fprofile-dir=
 // RUN: not %clang -S -Werror -fprofile-dir=abc %s
 // RUN: not %clang -S -Werror -ftest-coverage -fprofile-dir=abc %s



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


[PATCH] D79121: Add nomerge function attribute to clang

2020-05-08 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 262971.
zequanwu marked an inline comment as done.
zequanwu added a comment.

use `ConstEvaluatedExprVisitor` to recursively looking up for call expr


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

https://reviews.llvm.org/D79121

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CGStmt.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/SemaStmtAttr.cpp
  clang/test/CodeGen/attr-nomerge.cpp
  clang/test/Sema/attr-nomerge.cpp

Index: clang/test/Sema/attr-nomerge.cpp
===
--- /dev/null
+++ clang/test/Sema/attr-nomerge.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -verify -fsyntax-only %s
+
+void bar();
+
+void foo() {
+  [[clang::nomerge]] bar();
+  [[clang::nomerge(1, 2)]] bar(); // expected-error {{'nomerge' attribute takes no arguments}}
+  int x;
+  [[clang::nomerge]] x = 10; // expected-warning {{nomerge attribute is ignored because there exists no call expression inside the statement}}
+
+  [[clang::nomerge]] label: bar(); // expected-error {{'nomerge' attribute cannot be applied to a declaration}}
+
+}
+
+int f();
+
+[[clang::nomerge]] static int i = f(); // expected-error {{'nomerge' attribute cannot be applied to a declaration}}
Index: clang/test/CodeGen/attr-nomerge.cpp
===
--- /dev/null
+++ clang/test/CodeGen/attr-nomerge.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -S -emit-llvm %s -o - | FileCheck %s
+
+bool bar();
+void f(bool, bool);
+
+void foo(int i) {
+  [[clang::nomerge]] bar();
+  [[clang::nomerge]] (i = 4, bar());
+  [[clang::nomerge]] (void)(bar());
+  [[clang::nomerge]] f(bar(), bar());
+  [[clang::nomerge]] [] { bar(); bar(); }(); // nomerge only applies to the anonymous function call
+  [[clang::nomerge]] for (bar(); bar(); bar()) {}
+  bar();
+}
+// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR:[0-9]+]]
+// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR]]
+// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR]]
+// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR]]
+// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR]]
+// CHECK: call void @_Z1fbb({{.*}}) #[[NOMERGEATTR]]
+// CHECK: call void @"_ZZ3fooiENK3$_0clEv"(%class.anon* %ref.tmp) #[[NOMERGEATTR]]
+// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR]]
+// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR]]
+// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR]]
+// CHECK: call zeroext i1 @_Z3barv()
+// CHECK: attributes #[[NOMERGEATTR]] = { nomerge }
Index: clang/lib/Sema/SemaStmtAttr.cpp
===
--- clang/lib/Sema/SemaStmtAttr.cpp
+++ clang/lib/Sema/SemaStmtAttr.cpp
@@ -10,6 +10,7 @@
 //
 //===--===//
 
+#include "clang/AST/EvaluatedExprVisitor.h"
 #include "clang/Sema/SemaInternal.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/Basic/SourceManager.h"
@@ -170,6 +171,45 @@
   return LoopHintAttr::CreateImplicit(S.Context, Option, State, ValueExpr, A);
 }
 
+namespace {
+class CallExprFinder : public ConstEvaluatedExprVisitor {
+  bool FoundCallExpr = false;
+
+public:
+  typedef ConstEvaluatedExprVisitor Inherited;
+
+  CallExprFinder(Sema , const Stmt* St) : Inherited(S.Context) {
+Visit(St);
+  }
+
+  bool foundCallExpr() { return FoundCallExpr; }
+
+  void VisitCallExpr(const CallExpr *E) { FoundCallExpr = true; }
+
+  void Visit(const Stmt *St) {
+if (!St) return;
+ConstEvaluatedExprVisitor::Visit(St);
+  }
+};
+} // namespace
+
+static Attr *handleNoMergeAttr(Sema , Stmt *St, const ParsedAttr ,
+   SourceRange Range) {
+  NoMergeAttr NMA(S.Context, A);
+  if (S.CheckAttrNoArgs(A))
+return nullptr;
+  
+  CallExprFinder CEF(S, St);
+
+  if (!CEF.foundCallExpr()) {
+S.Diag(St->getBeginLoc(), diag::warn_nomerge_attribute_ignored_in_stmt)
+<< NMA.getSpelling();
+return nullptr;
+  }
+
+  return ::new (S.Context) NoMergeAttr(S.Context, A);
+}
+
 static void
 CheckForIncompatibleAttributes(Sema ,
const SmallVectorImpl ) {
@@ -335,6 +375,8 @@
 return handleOpenCLUnrollHint(S, St, A, Range);
   case ParsedAttr::AT_Suppress:
 return handleSuppressAttr(S, St, A, Range);
+  case ParsedAttr::AT_NoMerge:
+return handleNoMergeAttr(S, St, A, Range);
   default:
 // if we're here, then we parsed a known attribute, but didn't recognize
 // it as a statement attribute => it is declaration attribute
Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -595,6 +595,9 @@
   /// region.
   bool IsInPreservedAIRegion = false;
 
+  /// True if the 

[PATCH] D79344: [cuda] Start diagnosing variables with bad target.

2020-05-08 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

This triggers an assertion:

  clang: /usr/local/google/home/tra/work/llvm/repo/clang/lib/AST/Decl.cpp:2697: 
clang::Expr *clang::ParmVarDecl::getDefaultArg(): Assertion 
`!hasUninstantiatedDefaultArg() && "Default argument is not yet instantiated!"' 
failed.



  #2  0x7fffeb8ae40f in __assert_fail_base (fmt=0x7fffeba106e0 "%s%s%s:%u: 
%s%sAssertion `%s' failed.\n%n",
  assertion=0x7fffe7d2e909 "!hasUninstantiatedDefaultArg() && \"Default 
argument is not yet instantiated!\"",
  file=0x7fffe7d22e5c 
"/usr/local/google/home/tra/work/llvm/repo/clang/lib/AST/Decl.cpp", line=2697, 
function=) at assert.c:92
  #3  0x7fffeb8bbb92 in __GI___assert_fail (
  assertion=0x7fffe7d2e909 "!hasUninstantiatedDefaultArg() && \"Default 
argument is not yet instantiated!\"",
  file=0x7fffe7d22e5c 
"/usr/local/google/home/tra/work/llvm/repo/clang/lib/AST/Decl.cpp", line=2697,
  function=0x7fffe7dda0fb "clang::Expr 
*clang::ParmVarDecl::getDefaultArg()") at assert.c:101
  #4  0x7fffe8460aec in clang::ParmVarDecl::getDefaultArg (this=0x112f560) 
at /usr/local/google/home/tra/work/llvm/repo/clang/lib/AST/Decl.cpp:2696
  #5  0x7fffe618a5a6 in clang::Sema::checkCUDAParamWithInvalidDefaultArg 
(this=0x392450, Loc=..., FD=0x112f678, PVD=0x112f560)
  at 
/usr/local/google/home/tra/work/llvm/repo/clang/lib/Sema/SemaCUDA.cpp:729
  #6  0x7fffe62ed89a in clang::Sema::CheckCXXDefaultArguments 
(this=0x392450, FD=0x112f678)
  at 
/usr/local/google/home/tra/work/llvm/repo/clang/lib/Sema/SemaDeclCXX.cpp:1551
  #7  0x7fffe61c9443 in clang::Sema::CheckFunctionDeclaration 
(this=0x392450, S=0x0, NewFD=0x112f678, Previous=..., 
IsMemberSpecialization=false)
  at 
/usr/local/google/home/tra/work/llvm/repo/clang/lib/Sema/SemaDecl.cpp:10765
  #8  0x7fffe6d5f0b7 in clang::TemplateDeclInstantiator::VisitCXXMethodDecl 
(this=0x7ffe7f20, D=0x111b198, TemplateParams=0x0,
  ClassScopeSpecializationArgs=llvm::Optional is not initialized, 
FunctionRewriteKind=clang::TemplateDeclInstantiator::RewriteKind::None)
  at 
/usr/local/google/home/tra/work/llvm/repo/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:2424
  #9  0x7fffe6d62f10 in clang::TemplateDeclInstantiator::VisitCXXMethodDecl 
(this=0x7ffe7f20, D=0x111b198)
  at 
/usr/local/google/home/tra/work/llvm/repo/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:3410
  #10 0x7fffe6d62ead in 
clang::TemplateDeclInstantiator::VisitCXXConstructorDecl (this=0x7ffe7f20, 
D=0x111b198)
  at 
/usr/local/google/home/tra/work/llvm/repo/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:2498


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79344



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


[clang] e1815eb - [Driver] Reorganize --coverage -ftest-coverage -fprofile-arcs related tests

2020-05-08 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2020-05-08T16:06:33-07:00
New Revision: e1815eb2e1016d74ed8f8e2f459182886cacf733

URL: 
https://github.com/llvm/llvm-project/commit/e1815eb2e1016d74ed8f8e2f459182886cacf733
DIFF: 
https://github.com/llvm/llvm-project/commit/e1815eb2e1016d74ed8f8e2f459182886cacf733.diff

LOG: [Driver] Reorganize --coverage -ftest-coverage -fprofile-arcs related tests

And fix a comment about __llvm_profile_runtime

Added: 


Modified: 
clang/lib/Driver/ToolChains/Linux.cpp
clang/test/Driver/clang_f_opts.c
clang/test/Driver/coverage-ld.c
clang/test/Driver/coverage.c

Removed: 
clang/test/Driver/coverage_no_integrated_as.c



diff  --git a/clang/lib/Driver/ToolChains/Linux.cpp 
b/clang/lib/Driver/ToolChains/Linux.cpp
index a272c47e7145..5c63998ce94f 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -869,7 +869,7 @@ void Linux::addProfileRTLibs(const llvm::opt::ArgList ,
  llvm::opt::ArgStringList ) const {
   if (!needsProfileRT(Args)) return;
 
-  // Add linker option -u__llvm_runtime_variable to cause runtime
+  // Add linker option -u__llvm_profile_runtime to cause runtime
   // initialization module to be linked in.
   if ((!Args.hasArg(options::OPT_coverage)) &&
   (!Args.hasArg(options::OPT_ftest_coverage)))

diff  --git a/clang/test/Driver/clang_f_opts.c 
b/clang/test/Driver/clang_f_opts.c
index 180d4713dcb4..f1355cee650f 100644
--- a/clang/test/Driver/clang_f_opts.c
+++ b/clang/test/Driver/clang_f_opts.c
@@ -68,30 +68,6 @@
 // RUN: %clang -### -S -fauto-profile=%S/Inputs/file.prof 
-fno-profile-sample-use -fauto-profile %s 2>&1 | FileCheck 
-check-prefix=CHECK-AUTO-PROFILE %s
 // RUN: %clang -### -S -fauto-profile=%S/Inputs/file.prof -fno-auto-profile 
-fprofile-sample-use %s 2>&1 | FileCheck -check-prefix=CHECK-AUTO-PROFILE %s
 
-// RUN: %clang -### -S -fprofile-arcs %s 2>&1 | FileCheck 
-check-prefix=CHECK-PROFILE-ARCS %s
-// RUN: %clang -### -S -fno-profile-arcs -fprofile-arcs %s 2>&1 | FileCheck 
-check-prefix=CHECK-PROFILE-ARCS %s
-// RUN: %clang -### -S -fno-profile-arcs %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-PROFILE-ARCS %s
-// RUN: %clang -### -S -fprofile-arcs -fno-profile-arcs %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-PROFILE-ARCS %s
-// CHECK-PROFILE-ARCS: "-femit-coverage-data"
-// CHECK-NO-PROFILE-ARCS-NOT: "-femit-coverage-data"
-
-// RUN: %clang -### -S -fprofile-dir=abc %s 2>&1 | FileCheck 
-check-prefix=CHECK-PROFILE-DIR-UNUSED %s
-// RUN: %clang -### -S -ftest-coverage -fprofile-dir=abc %s 2>&1 | FileCheck 
-check-prefix=CHECK-PROFILE-DIR-UNUSED %s
-// RUN: %clang -### -S -fprofile-arcs -fprofile-dir=abc %s 2>&1 | FileCheck 
-check-prefix=CHECK-PROFILE-DIR %s
-// RUN: %clang -### -S --coverage -fprofile-dir=abc %s 2>&1 | FileCheck 
-check-prefix=CHECK-PROFILE-DIR %s
-// RUN: %clang -### -S -fprofile-arcs -fno-profile-arcs -fprofile-dir=abc %s 
2>&1 | FileCheck -check-prefix=CHECK-PROFILE-DIR-NEITHER %s
-// CHECK-PROFILE-DIR: "-coverage-data-file" "abc
-// CHECK-PROFILE-DIR-UNUSED: argument unused
-// CHECK-PROFILE-DIR-UNUSED-NOT: "-coverage-data-file" "abc
-// CHECK-PROFILE-DIR-NEITHER-NOT: argument unused
-
-// RUN: %clang_cl -### /c --coverage /Fo/foo/bar.obj -- %s 2>&1 | FileCheck 
-check-prefix=CHECK-GCNO-LOCATION %s
-// CHECK-GCNO-LOCATION: "-coverage-notes-file" "{{.*}}/foo/bar.gcno"
-
-// RUN: %clang -### -fprofile-arcs -ftest-coverage %s 2>&1 | FileCheck 
-check-prefix=CHECK-u %s
-// RUN: %clang -### --coverage %s 2>&1 | FileCheck -check-prefix=CHECK-u %s
-// CHECK-u-NOT: "-u{{.*}}"
-
 // RUN: %clang -### -S -fprofile-generate %s 2>&1 | FileCheck 
-check-prefix=CHECK-PROFILE-GENERATE-LLVM %s
 // RUN: %clang -### -S -fprofile-instr-generate %s 2>&1 | FileCheck 
-check-prefix=CHECK-PROFILE-GENERATE %s
 // RUN: %clang -### -S -fprofile-generate=/some/dir %s 2>&1 | FileCheck 
-check-prefix=CHECK-PROFILE-GENERATE-DIR %s

diff  --git a/clang/test/Driver/coverage-ld.c b/clang/test/Driver/coverage-ld.c
index 206d9abec6fd..282fcb65145c 100644
--- a/clang/test/Driver/coverage-ld.c
+++ b/clang/test/Driver/coverage-ld.c
@@ -7,7 +7,9 @@
 // RUN:   | FileCheck --check-prefix=CHECK-LINUX-I386 %s
 //
 // CHECK-LINUX-I386: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-LINUX-I386-NOT: "-u__llvm_profile_runtime"
 // CHECK-LINUX-I386: 
"{{.*}}/Inputs/resource_dir{{/|}}lib{{/|}}linux{{/|}}libclang_rt.profile-i386.a"
 {{.*}} "-lc"
+// CHECK-LINUX-I386-NOT: "-u__llvm_profile_runtime"
 //
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: -target x86_64-unknown-linux --coverage -fuse-ld=ld \

diff  --git a/clang/test/Driver/coverage.c b/clang/test/Driver/coverage.c
index f6bfbfb5f63b..24e8ac9d888b 100644
--- a/clang/test/Driver/coverage.c
+++ b/clang/test/Driver/coverage.c
@@ -1,8 +1,27 @@
-// Test coverage flag.
-// REQUIRES: system-windows
-//
-// RUN: 

[PATCH] D79653: [sanitizer] Enable whitelist/blacklist in new PM

2020-05-08 Thread Jinsong Ji via Phabricator via cfe-commits
jsji created this revision.
jsji added reviewers: tuktuk, vitalybuka, morehouse, kcc.
Herald added subscribers: llvm-commits, Sanitizers, cfe-commits, hiraditya.
Herald added projects: clang, Sanitizers, LLVM.

https://reviews.llvm.org/D63616 added `-fsanitize-coverage-whitelist`
and `-fsanitize-coverage-blacklist` for clang.

However, it was done only for legacy pass manager.
This patch enable it for new pass manager as well.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79653

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  
compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_whitelist_blacklist.cpp
  llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
  llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp


Index: llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
===
--- llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
+++ llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
@@ -322,7 +322,8 @@
 
 PreservedAnalyses ModuleSanitizerCoveragePass::run(Module ,
ModuleAnalysisManager ) 
{
-  ModuleSanitizerCoverage ModuleSancov(Options);
+  ModuleSanitizerCoverage ModuleSancov(Options, Whitelist.get(),
+   Blacklist.get());
   auto  = 
MAM.getResult(M).getManager();
   auto DTCallback = [](Function ) -> const DominatorTree * {
 return (F);
Index: llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
===
--- llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
+++ llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
@@ -18,6 +18,7 @@
 
 #include "llvm/IR/Module.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/SpecialCaseList.h"
 #include "llvm/Transforms/Instrumentation.h"
 
 namespace llvm {
@@ -30,12 +31,26 @@
 : public PassInfoMixin {
 public:
   explicit ModuleSanitizerCoveragePass(
-  SanitizerCoverageOptions Options = SanitizerCoverageOptions())
-  : Options(Options) {}
+  SanitizerCoverageOptions Options = SanitizerCoverageOptions(),
+  const std::vector  =
+  std::vector(),
+  const std::vector  =
+  std::vector())
+  : Options(Options) {
+if (WhitelistFiles.size() > 0)
+  Whitelist = SpecialCaseList::createOrDie(WhitelistFiles,
+   *vfs::getRealFileSystem());
+if (BlacklistFiles.size() > 0)
+  Blacklist = SpecialCaseList::createOrDie(BlacklistFiles,
+   *vfs::getRealFileSystem());
+  }
   PreservedAnalyses run(Module , ModuleAnalysisManager );
 
 private:
   SanitizerCoverageOptions Options;
+
+  std::unique_ptr Whitelist;
+  std::unique_ptr Blacklist;
 };
 
 // Insert SanitizerCoverage instrumentation.
Index: 
compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_whitelist_blacklist.cpp
===
--- 
compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_whitelist_blacklist.cpp
+++ 
compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_whitelist_blacklist.cpp
@@ -51,6 +51,13 @@
 // RUN: %clangxx -O0 %s -S -o - -emit-llvm 
-fsanitize-coverage=inline-8bit-counters,indirect-calls,trace-cmp,pc-table 
-fsanitize-coverage-whitelist=wl_foo.txt  
-fsanitize-coverage-blacklist=bl_all.txt   2>&1 | not grep -f patterns.txt
 // RUN: %clangxx -O0 %s -S -o - -emit-llvm 
-fsanitize-coverage=inline-8bit-counters,indirect-calls,trace-cmp,pc-table 
-fsanitize-coverage-whitelist=wl_bar.txt  
-fsanitize-coverage-blacklist=bl_all.txt   2>&1 | not grep -f patterns.txt
 
+// RUN: %clangxx -O0 %s -S -o - -emit-llvm 
-fsanitize-coverage=inline-8bit-counters,indirect-calls,trace-cmp,pc-table 
-fexperimental-new-pass-manager   
-fsanitize-coverage-blacklist=bl_all.txt   2>&1 | not grep -f patterns.txt
+// RUN: %clangxx -O0 %s -S -o - -emit-llvm 
-fsanitize-coverage=inline-8bit-counters,indirect-calls,trace-cmp,pc-table 
-fexperimental-new-pass-manager -fsanitize-coverage-whitelist=wl_all.txt  
-fsanitize-coverage-blacklist=bl_all.txt   2>&1 | not grep -f patterns.txt
+// RUN: %clangxx -O0 %s -S -o - -emit-llvm 
-fsanitize-coverage=inline-8bit-counters,indirect-calls,trace-cmp,pc-table 
-fexperimental-new-pass-manager -fsanitize-coverage-whitelist=wl_none.txt 
-fsanitize-coverage-blacklist=bl_all.txt   2>&1 | not grep -f patterns.txt
+// RUN: %clangxx -O0 %s -S -o - -emit-llvm 
-fsanitize-coverage=inline-8bit-counters,indirect-calls,trace-cmp,pc-table 
-fexperimental-new-pass-manager -fsanitize-coverage-whitelist=wl_file.txt 
-fsanitize-coverage-blacklist=bl_all.txt   2>&1 | not grep -f patterns.txt
+// RUN: %clangxx -O0 %s -S -o - -emit-llvm 
-fsanitize-coverage=inline-8bit-counters,indirect-calls,trace-cmp,pc-table 

[PATCH] D72841: Add support for pragma float_control, to control precision and exception behavior at the source level

2020-05-08 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi added a comment.

Hi @rjmccall, I am also seeing similar failures. It is failing on apple's 
master (and the swift branches as well) because ParseLangArgs and 
ParseCodeGenArgs are getting called in the opposite order in apple/master from 
the order they are called in llvm/master. I posted a PR to fix those failures 
here: https://github.com/apple/llvm-project/pull/1202

but I don't know if this is the most correct approach.

In D72841#2023058 , @rjmccall wrote:

> We're also seeing test failures in Apple's Clang fork, e.g.
>
>   test/CodeGen/finite-math.c:12:10: error: NSZ: expected string not found in 
> input
>// NSZ: fadd nsz
>^
>   :11:20: note: scanning from here
>   define void @foo() #0 {
>  ^
>   :15:9: note: possible intended match here
>%add = fadd float %0, %1
>   ^
>
>
> I haven't checked yet whether we can reproduce upstream.





Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72841



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


[PATCH] D79035: [clang][AIX] Implement ABIInfo and TargetCodeGenInfo for AIX

2020-05-08 Thread Jason Liu via Phabricator via cfe-commits
jasonliu added inline comments.



Comment at: clang/lib/CodeGen/TargetInfo.cpp:1547
 
   // Otherwise, if the type contains an SSE vector type, the alignment is 16.
+  if (Align >= 16 && (isSIMDVectorType(getContext(), Ty) ||

Xiangling_L wrote:
> Also update the comment?
I think the comment is fine. It's still SSE vector type even if we changed the 
query to SIMD. SSE is for x86 and altivec is for Power, but they are both SIMD 
vectors.



Comment at: clang/lib/CodeGen/TargetInfo.cpp:4684
 return false;
   case CodeGenOptions::SRCK_InRegs: // -msvr4-struct-return
 return true;

Xiangling_L wrote:
> I noticed that in patch https://reviews.llvm.org/D76360, Zarko added a check 
> to emit an error for using this option within cc1. But in your patch, this 
> option only emit error when invoked by the driver. Does that mean we are 
> pretty sure this option is doing what we want on AIX?
Are you able to set this CodeGen option when it is disabled in the 
Frontend/CompilerInvocation.cpp?


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

https://reviews.llvm.org/D79035



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


[PATCH] D79035: [clang][AIX] Implement ABIInfo and TargetCodeGenInfo for AIX

2020-05-08 Thread Jason Liu via Phabricator via cfe-commits
jasonliu updated this revision to Diff 262964.
jasonliu marked 5 inline comments as done.
jasonliu added a comment.

Address Xiangling's comment.


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

https://reviews.llvm.org/D79035

Files:
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGen/aix-complex.c
  clang/test/CodeGen/aix-return.c
  clang/test/CodeGen/aix-struct-arg.c
  clang/test/CodeGen/aix-vaargs.c
  clang/test/CodeGen/aix-vector.c
  clang/test/CodeGen/ppc32-and-aix-struct-return.c
  clang/test/CodeGen/ppc32-dwarf.c
  clang/test/CodeGen/ppc32-struct-return.c
  clang/test/CodeGen/ppc64-dwarf.c
  clang/test/Driver/ppc-unsupported.c

Index: clang/test/Driver/ppc-unsupported.c
===
--- clang/test/Driver/ppc-unsupported.c
+++ clang/test/Driver/ppc-unsupported.c
@@ -7,4 +7,12 @@
 // RUN:   -c %s 2>&1 | FileCheck %s
 // RUN: not %clang -target powerpc64le-unknown-linux -msvr4-struct-return \
 // RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc-unknown-aix -maix-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc-unknown-aix -msvr4-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc64-unknown-aix -maix-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc64-unknown-aix -msvr4-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
 // CHECK: unsupported option
Index: clang/test/CodeGen/ppc64-dwarf.c
===
--- clang/test/CodeGen/ppc64-dwarf.c
+++ clang/test/CodeGen/ppc64-dwarf.c
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-aix -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,PPC64
 static unsigned char dwarf_reg_size_table[1024];
 
 int test() {
@@ -119,10 +120,10 @@
 // CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 108), align 1
 // CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 109), align 1
 // CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 110), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 111), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 112), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 113), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 114), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 115), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 116), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 111), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 112), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 113), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 114), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 115), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 116), align 1
 // CHECK-NEXT: ret i32 1
Index: clang/test/CodeGen/ppc32-struct-return.c
===
--- clang/test/CodeGen/ppc32-struct-return.c
+++ /dev/null
@@ -1,88 +0,0 @@
-// REQUIRES: powerpc-registered-target
-// RUN: %clang_cc1 -triple powerpc-unknown-freebsd \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
-// RUN: %clang_cc1 -triple powerpc-unknown-linux \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
-// RUN: %clang_cc1 -triple powerpc-unknown-linux -maix-struct-return \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
-// RUN: %clang_cc1 -triple powerpc-unknown-linux -msvr4-struct-return \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
-// RUN: %clang_cc1 -triple powerpc-unknown-netbsd \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
-// RUN: %clang_cc1 -triple 

[PATCH] D79526: [CUDA][HIP] Workaround for resolving host device function against wrong-sided function

2020-05-08 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

This one is just a FYI. I've managed to reduce the failure in the first version 
of this patch and it looks rather odd because the reduced test case has nothing 
to do with CUDA. Instead it appears to introduce a difference in compilation of 
regular host-only C++ code with `-x cuda` vs -x `c++`. I'm not sure how/why 
first version caused this and why the latest one fixes it. It may be worth 
double checking that we're not missing something here.

  template  a b;
  auto c(...);
  template  constexpr auto c(d) -> decltype(0);
  struct e {
template  static auto g(ad, f...) {
  h)...>;
}
struct i {
  template  static constexpr auto j(f... k) { c(k...); }
};
template  static auto h() { i::j; }
  };
  class l {
l() {
  e::g([] {}, this);
}
  };

The latest version of this patch works, but previous one failed with an error, 
when the example was compiled as CUDA, but not, when it was compiled as C++:

  $ bin/clang++ -x cuda argmax.cc -ferror-limit=1 -fsyntax-only 
--cuda-host-only -nocudalib -nocudainc -fsized-deallocation -std=c++17
  
  argmax.cc:9:68: error: function 'c' with deduced return type cannot be used 
before it is defined
  template  static constexpr auto j(f... k) { c(k...); }
 ^
  argmax.cc:11:53: note: in instantiation of function template specialization 
'e::i::j' requested here
template  static auto h() { i::j; }
  ^
  argmax.cc:6:5: note: in instantiation of function template specialization 
'e::h' requested here
  h)...>;
  ^
  argmax.cc:15:8: note: in instantiation of function template specialization 
'e::g<(lambda at argmax.cc:15:10), l *>' requested here
  e::g([] {}, this);
 ^
  argmax.cc:2:6: note: 'c' declared here
  auto c(...);
   ^
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  2 errors generated when compiling for host.



  $ bin/clang++ -x c++ argmax.cc -ferror-limit=1 -fsyntax-only --cuda-host-only 
-nocudalib -nocudainc -fsized-deallocation -std=c++17
  
  clang-11: warning: argument unused during compilation: '-nocudainc' 
[-Wunused-command-line-argument]
  argmax.cc:11:50: warning: expression result unused [-Wunused-value]
template  static auto h() { i::j; }
   ^~~
  argmax.cc:6:5: note: in instantiation of function template specialization 
'e::h' requested here
  h)...>;
  ^
  argmax.cc:15:8: note: in instantiation of function template specialization 
'e::g<(lambda at argmax.cc:15:10), l *>' requested here
  e::g([] {}, this);
 ^
  argmax.cc:6:5: warning: expression result unused [-Wunused-value]
  h)...>;
  ^~~
  argmax.cc:15:8: note: in instantiation of function template specialization 
'e::g<(lambda at argmax.cc:15:10), l *>' requested here
  e::g([] {}, this);
 ^
  argmax.cc:3:35: warning: inline function 'c' is not defined 
[-Wundefined-inline]
  template  constexpr auto c(d) -> decltype(0);
^
  argmax.cc:9:68: note: used here
  template  static constexpr auto j(f... k) { c(k...); }
 ^
  3 warnings generated.




Comment at: clang/include/clang/Sema/Sema.h:11663
+bool IgnoreImplicitHDAttr = false,
+bool *IsImplicitHDAttr = nullptr);
   CUDAFunctionTarget IdentifyCUDATarget(const ParsedAttributesView );

Plumbing an optional output argument it through multiple levels of callers as 
an output argument is rather hard to follow, especially considering that it's 
not set in all code paths. Perhaps we can turn IsImplicitHDAttr into a separate 
function and call it from isBetterOverloadCandidate().


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

https://reviews.llvm.org/D79526



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


[PATCH] D79035: [clang][AIX] Implement ABIInfo and TargetCodeGenInfo for AIX

2020-05-08 Thread Jason Liu via Phabricator via cfe-commits
jasonliu updated this revision to Diff 262958.
jasonliu marked 2 inline comments as done.
jasonliu added a comment.

Address Zarko's comment.


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

https://reviews.llvm.org/D79035

Files:
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGen/aix-complex.c
  clang/test/CodeGen/aix-return.c
  clang/test/CodeGen/aix-struct-arg.c
  clang/test/CodeGen/aix-vaargs.c
  clang/test/CodeGen/aix-vector.c
  clang/test/CodeGen/ppc32-and-aix-struct-return.c
  clang/test/CodeGen/ppc32-dwarf.c
  clang/test/CodeGen/ppc32-struct-return.c
  clang/test/CodeGen/ppc64-dwarf.c
  clang/test/Driver/ppc-unsupported.c

Index: clang/test/Driver/ppc-unsupported.c
===
--- clang/test/Driver/ppc-unsupported.c
+++ clang/test/Driver/ppc-unsupported.c
@@ -7,4 +7,12 @@
 // RUN:   -c %s 2>&1 | FileCheck %s
 // RUN: not %clang -target powerpc64le-unknown-linux -msvr4-struct-return \
 // RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc-unknown-aix -maix-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc-unknown-aix -msvr4-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc64-unknown-aix -maix-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc64-unknown-aix -msvr4-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
 // CHECK: unsupported option
Index: clang/test/CodeGen/ppc64-dwarf.c
===
--- clang/test/CodeGen/ppc64-dwarf.c
+++ clang/test/CodeGen/ppc64-dwarf.c
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-aix -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,PPC64
 static unsigned char dwarf_reg_size_table[1024];
 
 int test() {
@@ -119,10 +120,10 @@
 // CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 108), align 1
 // CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 109), align 1
 // CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 110), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 111), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 112), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 113), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 114), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 115), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 116), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 111), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 112), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 113), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 114), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 115), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 116), align 1
 // CHECK-NEXT: ret i32 1
Index: clang/test/CodeGen/ppc32-struct-return.c
===
--- clang/test/CodeGen/ppc32-struct-return.c
+++ /dev/null
@@ -1,88 +0,0 @@
-// REQUIRES: powerpc-registered-target
-// RUN: %clang_cc1 -triple powerpc-unknown-freebsd \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
-// RUN: %clang_cc1 -triple powerpc-unknown-linux \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
-// RUN: %clang_cc1 -triple powerpc-unknown-linux -maix-struct-return \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
-// RUN: %clang_cc1 -triple powerpc-unknown-linux -msvr4-struct-return \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
-// RUN: %clang_cc1 -triple powerpc-unknown-netbsd \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
-// RUN: %clang_cc1 -triple 

[PATCH] D79035: [clang][AIX] Implement ABIInfo and TargetCodeGenInfo for AIX

2020-05-08 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L added inline comments.



Comment at: clang/lib/CodeGen/TargetInfo.cpp:1547
 
   // Otherwise, if the type contains an SSE vector type, the alignment is 16.
+  if (Align >= 16 && (isSIMDVectorType(getContext(), Ty) ||

Also update the comment?



Comment at: clang/lib/CodeGen/TargetInfo.cpp:4365
+
+  Ty = useFirstFieldIfTransparentUnion(Ty);
+

As in doc says [[ 
https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.0/com.ibm.xlc131.aix.doc/language_ref/type_attr_transp_union.html
 | The transparent_union type attribute ]]:
 `float _Complex, double _Complex or vector types can be members of a 
transparent union, but they cannot be the first member. `  That means the first 
field still could be something like Integral Complex etc., which falls into the 
category `isAnyComplexType`.

So I guess `Ty = useFirstFieldIfTransparentUnion(Ty);` should be at the first 
line.



Comment at: clang/lib/CodeGen/TargetInfo.cpp:4374
+CharUnits ABIAlign = getParamTypeAlignment(Ty);
+CharUnits TyAlign = getContext().getTypeAlignInChars(Ty);
+

If we want to be consistent with other part of alignment implementation, 
`getContext().getTypeAlignInChars(Ty)` gives `ABIAlign`. I would suggest we 
name `ABIAlign` here to something like `CCAlign` or `ArgumentAlign`.



Comment at: clang/lib/CodeGen/TargetInfo.cpp:4684
 return false;
   case CodeGenOptions::SRCK_InRegs: // -msvr4-struct-return
 return true;

I noticed that in patch https://reviews.llvm.org/D76360, Zarko added a check to 
emit an error for using this option within cc1. But in your patch, this option 
only emit error when invoked by the driver. Does that mean we are pretty sure 
this option is doing what we want on AIX?


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

https://reviews.llvm.org/D79035



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


[PATCH] D79219: [CMake] Simplify CMake handling for zlib

2020-05-08 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added inline comments.



Comment at: lld/test/lit.site.cfg.py.in:16
 config.target_triple = "@TARGET_TRIPLE@"
-config.python_executable = "@Python3_EXECUTABLE@"
-config.have_zlib = @HAVE_LIBZ@
+config.python_executable = "@PYTHON_EXECUTABLE@"
+config.have_zlib = @LLVM_ENABLE_ZLIB@

This seems like an unintended/unrelated change.



Comment at: llvm/cmake/config-ix.cmake:506
 
-if (LLVM_ENABLE_ZLIB )
-  # Check if zlib is available in the system.
-  if ( NOT HAVE_ZLIB_H OR NOT HAVE_LIBZ )
-set(LLVM_ENABLE_ZLIB 0)
+if(LLVM_ENABLE_ZLIB)
+  if(LLVM_ENABLE_ZLIB STREQUAL FORCE_ON)

How come you're moving this out of the MSan check block? Isn't that a behavior 
change?



Comment at: llvm/lib/Support/CMakeLists.txt:207
+  get_filename_component(zlib_library ${zlib_library} NAME)
+  if(CMAKE_STATIC_LIBRARY_PREFIX AND
+ zlib_library MATCHES 
"^${CMAKE_STATIC_LIBRARY_PREFIX}.*${CMAKE_STATIC_LIBRARY_SUFFIX}$")

Even if there's no prefix, wouldn't you still wanna strip the suffix?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79219



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


[PATCH] D79534: [clang][WebAssembly] Only expose wait and notify builtins with atomics

2020-05-08 Thread Thomas Lively via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGebb69b8bafad: [clang][WebAssembly] Only expose wait and 
notify builtins with atomics (authored by tlively).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79534

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


Index: clang/test/CodeGen/builtins-wasm.c
===
--- clang/test/CodeGen/builtins-wasm.c
+++ clang/test/CodeGen/builtins-wasm.c
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -triple wasm32-unknown-unknown -target-feature 
+unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature 
+exception-handling -target-feature +bulk-memory -flax-vector-conversions=none 
-O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY32
-// RUN: %clang_cc1 -triple wasm64-unknown-unknown -target-feature 
+unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature 
+exception-handling -target-feature +bulk-memory -flax-vector-conversions=none 
-O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY64
-// RUN: not %clang_cc1 -triple wasm64-unknown-unknown -target-feature 
+nontrapping-fptoint -target-feature +exception-handling -target-feature 
+bulk-memory -flax-vector-conversions=none -O3 -emit-llvm -o - %s 2>&1 | 
FileCheck %s -check-prefixes MISSING-SIMD
+// RUN: %clang_cc1 -triple wasm32-unknown-unknown -target-feature 
+unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature 
+exception-handling -target-feature +bulk-memory -target-feature +atomics 
-flax-vector-conversions=none -O3 -emit-llvm -o - %s | FileCheck %s 
-check-prefixes WEBASSEMBLY,WEBASSEMBLY32
+// RUN: %clang_cc1 -triple wasm64-unknown-unknown -target-feature 
+unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature 
+exception-handling -target-feature +bulk-memory -target-feature +atomics 
-flax-vector-conversions=none -O3 -emit-llvm -o - %s | FileCheck %s 
-check-prefixes WEBASSEMBLY,WEBASSEMBLY64
+// RUN: not %clang_cc1 -triple wasm64-unknown-unknown -target-feature 
+nontrapping-fptoint -target-feature +exception-handling -target-feature 
+bulk-memory -target-feature +atomics -flax-vector-conversions=none -O3 
-emit-llvm -o - %s 2>&1 | FileCheck %s -check-prefixes MISSING-SIMD
 
 // SIMD convenience types
 typedef char i8x16 __attribute((vector_size(16)));
Index: clang/include/clang/Basic/BuiltinsWebAssembly.def
===
--- clang/include/clang/Basic/BuiltinsWebAssembly.def
+++ clang/include/clang/Basic/BuiltinsWebAssembly.def
@@ -45,9 +45,9 @@
 TARGET_BUILTIN(__builtin_wasm_rethrow_in_catch, "v", "r", "exception-handling")
 
 // Atomic wait and notify.
-BUILTIN(__builtin_wasm_atomic_wait_i32, "ii*iLLi", "n")
-BUILTIN(__builtin_wasm_atomic_wait_i64, "iLLi*LLiLLi", "n")
-BUILTIN(__builtin_wasm_atomic_notify, "Uii*Ui", "n")
+TARGET_BUILTIN(__builtin_wasm_atomic_wait_i32, "ii*iLLi", "n", "atomics")
+TARGET_BUILTIN(__builtin_wasm_atomic_wait_i64, "iLLi*LLiLLi", "n", "atomics")
+TARGET_BUILTIN(__builtin_wasm_atomic_notify, "Uii*Ui", "n", "atomics")
 
 // Trapping fp-to-int conversions
 BUILTIN(__builtin_wasm_trunc_s_i32_f32, "if", "nc")


Index: clang/test/CodeGen/builtins-wasm.c
===
--- clang/test/CodeGen/builtins-wasm.c
+++ clang/test/CodeGen/builtins-wasm.c
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -triple wasm32-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -flax-vector-conversions=none -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY32
-// RUN: %clang_cc1 -triple wasm64-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -flax-vector-conversions=none -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY64
-// RUN: not %clang_cc1 -triple wasm64-unknown-unknown -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -flax-vector-conversions=none -O3 -emit-llvm -o - %s 2>&1 | FileCheck %s -check-prefixes MISSING-SIMD
+// RUN: %clang_cc1 -triple wasm32-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -target-feature +atomics -flax-vector-conversions=none -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY32
+// RUN: %clang_cc1 -triple wasm64-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -target-feature 

[PATCH] D79044: [AIX] Avoid structor alias; die before bad alias codegen

2020-05-08 Thread Hubert Tong via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb116ded57da3: [AIX] Avoid structor alias; die before bad 
alias codegen (authored by hubert.reinterpretcast).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79044

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/aix-constructor-alias.c
  llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
  llvm/test/CodeGen/PowerPC/aix-alias.ll


Index: llvm/test/CodeGen/PowerPC/aix-alias.ll
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/aix-alias.ll
@@ -0,0 +1,10 @@
+; RUN: not --crash llc < %s -mtriple powerpc-ibm-aix-xcoff 2>&1 | FileCheck %s
+; RUN: not --crash llc < %s -mtriple powerpc64-ibm-aix-xcoff 2>&1 | FileCheck 
%s
+
+; Check that, while generation of aliases on AIX remains unimplemented, llc 
dies
+; with an appropriate message instead of generating incorrect output when an
+; alias is encountered.
+
+define i32 @a() { ret i32 0 }
+; CHECK: ERROR: module has aliases
+@b = internal alias i32 (), i32 ()* @a
Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
===
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -155,6 +155,14 @@
 
   StringRef getPassName() const override { return "AIX PPC Assembly Printer"; }
 
+  bool doInitialization(Module ) override {
+if (M.alias_size() > 0u)
+  report_fatal_error(
+  "module has aliases, which LLVM does not yet support for AIX");
+
+return PPCAsmPrinter::doInitialization(M);
+  }
+
   void SetupMachineFunction(MachineFunction ) override;
 
   void emitGlobalVariable(const GlobalVariable *GV) override;
Index: clang/test/Driver/aix-constructor-alias.c
===
--- /dev/null
+++ clang/test/Driver/aix-constructor-alias.c
@@ -0,0 +1,7 @@
+// Check that we don't pass -mconstructor-aliases when compiling for AIX.
+
+// RUN: %clang -### -target powerpc-ibm-aix7.1.0.0 %s -c -o %t.o 2>&1 \
+// RUN:   | FileCheck %s
+// RUN: %clang -### -target powerpc64-ibm-aix7.1.0.0 %s -c -o %t.o 2>&1 \
+// RUN:   | FileCheck %s
+// CHECK-NOT: "-mconstructor-aliases"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4675,8 +4675,8 @@
 
   // Enable -mconstructor-aliases except on darwin, where we have to work 
around
   // a linker bug (see ), and CUDA device code, where
-  // aliases aren't supported.
-  if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX())
+  // aliases aren't supported. Similarly, aliases aren't yet supported for AIX.
+  if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX() && !RawTriple.isOSAIX())
 CmdArgs.push_back("-mconstructor-aliases");
 
   // Darwin's kernel doesn't support guard variables; just die if we


Index: llvm/test/CodeGen/PowerPC/aix-alias.ll
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/aix-alias.ll
@@ -0,0 +1,10 @@
+; RUN: not --crash llc < %s -mtriple powerpc-ibm-aix-xcoff 2>&1 | FileCheck %s
+; RUN: not --crash llc < %s -mtriple powerpc64-ibm-aix-xcoff 2>&1 | FileCheck %s
+
+; Check that, while generation of aliases on AIX remains unimplemented, llc dies
+; with an appropriate message instead of generating incorrect output when an
+; alias is encountered.
+
+define i32 @a() { ret i32 0 }
+; CHECK: ERROR: module has aliases
+@b = internal alias i32 (), i32 ()* @a
Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
===
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -155,6 +155,14 @@
 
   StringRef getPassName() const override { return "AIX PPC Assembly Printer"; }
 
+  bool doInitialization(Module ) override {
+if (M.alias_size() > 0u)
+  report_fatal_error(
+  "module has aliases, which LLVM does not yet support for AIX");
+
+return PPCAsmPrinter::doInitialization(M);
+  }
+
   void SetupMachineFunction(MachineFunction ) override;
 
   void emitGlobalVariable(const GlobalVariable *GV) override;
Index: clang/test/Driver/aix-constructor-alias.c
===
--- /dev/null
+++ clang/test/Driver/aix-constructor-alias.c
@@ -0,0 +1,7 @@
+// Check that we don't pass -mconstructor-aliases when compiling for AIX.
+
+// RUN: %clang -### -target powerpc-ibm-aix7.1.0.0 %s -c -o %t.o 2>&1 \
+// RUN:   | FileCheck %s
+// RUN: %clang -### -target powerpc64-ibm-aix7.1.0.0 %s -c -o %t.o 2>&1 \
+// RUN:   | FileCheck %s
+// CHECK-NOT: "-mconstructor-aliases"
Index: clang/lib/Driver/ToolChains/Clang.cpp

[PATCH] D79121: Add nomerge function attribute to clang

2020-05-08 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: clang/lib/Sema/SemaStmtAttr.cpp:178
+return true;
+  return llvm::any_of(S->children(), hasCallExpr);
+}

zequanwu wrote:
> rsmith wrote:
> > This will recurse into too much (eg, the bodies of lambdas and blocks, and 
> > unevaluated operands). It would be better to make this a 
> > `ConstEvaluatedExprVisitor` instead (see 
> > include/clang/AST/EvaluatedExprVisitor.h).
> Do you mean to create a subclass of `ConstEvaluatedExprVisitor` to find if 
> the statement has call expression?
This is still recursing into unevaluated operands (eg. the operand of 
`sizeof`). Please use `ConstEvaluatedExprVisitor` instead of `ConstStmtVisitor`.


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

https://reviews.llvm.org/D79121



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


[clang] ebb69b8 - [clang][WebAssembly] Only expose wait and notify builtins with atomics

2020-05-08 Thread Thomas Lively via cfe-commits

Author: Thomas Lively
Date: 2020-05-08T13:54:29-07:00
New Revision: ebb69b8bafad6948ee6a14b4087fb7b440c73d0d

URL: 
https://github.com/llvm/llvm-project/commit/ebb69b8bafad6948ee6a14b4087fb7b440c73d0d
DIFF: 
https://github.com/llvm/llvm-project/commit/ebb69b8bafad6948ee6a14b4087fb7b440c73d0d.diff

LOG: [clang][WebAssembly] Only expose wait and notify builtins with atomics

Summary:
Since the underlying wait and notify instructions are only available
when the atomics feature is enabled, it only makes sense to expose
their builtin functions when atomics are enabled.

Reviewers: aheejin, sunfish

Subscribers: dschuff, sbc100, jgravelle-google, jfb, cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/include/clang/Basic/BuiltinsWebAssembly.def
clang/test/CodeGen/builtins-wasm.c

Removed: 




diff  --git a/clang/include/clang/Basic/BuiltinsWebAssembly.def 
b/clang/include/clang/Basic/BuiltinsWebAssembly.def
index 0d66535fa8ec..cbdb33c0c352 100644
--- a/clang/include/clang/Basic/BuiltinsWebAssembly.def
+++ b/clang/include/clang/Basic/BuiltinsWebAssembly.def
@@ -45,9 +45,9 @@ TARGET_BUILTIN(__builtin_wasm_throw, "vIUiv*", "r", 
"exception-handling")
 TARGET_BUILTIN(__builtin_wasm_rethrow_in_catch, "v", "r", "exception-handling")
 
 // Atomic wait and notify.
-BUILTIN(__builtin_wasm_atomic_wait_i32, "ii*iLLi", "n")
-BUILTIN(__builtin_wasm_atomic_wait_i64, "iLLi*LLiLLi", "n")
-BUILTIN(__builtin_wasm_atomic_notify, "Uii*Ui", "n")
+TARGET_BUILTIN(__builtin_wasm_atomic_wait_i32, "ii*iLLi", "n", "atomics")
+TARGET_BUILTIN(__builtin_wasm_atomic_wait_i64, "iLLi*LLiLLi", "n", "atomics")
+TARGET_BUILTIN(__builtin_wasm_atomic_notify, "Uii*Ui", "n", "atomics")
 
 // Trapping fp-to-int conversions
 BUILTIN(__builtin_wasm_trunc_s_i32_f32, "if", "nc")

diff  --git a/clang/test/CodeGen/builtins-wasm.c 
b/clang/test/CodeGen/builtins-wasm.c
index 7e823c92a256..729a677c2485 100644
--- a/clang/test/CodeGen/builtins-wasm.c
+++ b/clang/test/CodeGen/builtins-wasm.c
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -triple wasm32-unknown-unknown -target-feature 
+unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature 
+exception-handling -target-feature +bulk-memory -flax-vector-conversions=none 
-O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY32
-// RUN: %clang_cc1 -triple wasm64-unknown-unknown -target-feature 
+unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature 
+exception-handling -target-feature +bulk-memory -flax-vector-conversions=none 
-O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY64
-// RUN: not %clang_cc1 -triple wasm64-unknown-unknown -target-feature 
+nontrapping-fptoint -target-feature +exception-handling -target-feature 
+bulk-memory -flax-vector-conversions=none -O3 -emit-llvm -o - %s 2>&1 | 
FileCheck %s -check-prefixes MISSING-SIMD
+// RUN: %clang_cc1 -triple wasm32-unknown-unknown -target-feature 
+unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature 
+exception-handling -target-feature +bulk-memory -target-feature +atomics 
-flax-vector-conversions=none -O3 -emit-llvm -o - %s | FileCheck %s 
-check-prefixes WEBASSEMBLY,WEBASSEMBLY32
+// RUN: %clang_cc1 -triple wasm64-unknown-unknown -target-feature 
+unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature 
+exception-handling -target-feature +bulk-memory -target-feature +atomics 
-flax-vector-conversions=none -O3 -emit-llvm -o - %s | FileCheck %s 
-check-prefixes WEBASSEMBLY,WEBASSEMBLY64
+// RUN: not %clang_cc1 -triple wasm64-unknown-unknown -target-feature 
+nontrapping-fptoint -target-feature +exception-handling -target-feature 
+bulk-memory -target-feature +atomics -flax-vector-conversions=none -O3 
-emit-llvm -o - %s 2>&1 | FileCheck %s -check-prefixes MISSING-SIMD
 
 // SIMD convenience types
 typedef char i8x16 __attribute((vector_size(16)));



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


[clang] b116ded - [AIX] Avoid structor alias; die before bad alias codegen

2020-05-08 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2020-05-08T16:51:34-04:00
New Revision: b116ded57da3530e661f871f4191c59cd9e091cd

URL: 
https://github.com/llvm/llvm-project/commit/b116ded57da3530e661f871f4191c59cd9e091cd
DIFF: 
https://github.com/llvm/llvm-project/commit/b116ded57da3530e661f871f4191c59cd9e091cd.diff

LOG: [AIX] Avoid structor alias; die before bad alias codegen

Summary:
`AsmPrinter::emitGlobalIndirectSymbol` is dependent on
`MCStreamer::emitAssignment` to produce `.set` directives for alias
symbols; however, the `.set` pseudo-op on AIX is documented as not
usable with external relocatable terms or expressions, which limits its
applicability in generating alias symbols.

Disable generating aliases on AIX until a different implementation
strategy is available.

Reviewers: cebowleratibm, jasonliu, sfertile, daltenty, DiggerLin

Reviewed By: jasonliu

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

Added: 
clang/test/Driver/aix-constructor-alias.c
llvm/test/CodeGen/PowerPC/aix-alias.ll

Modified: 
clang/lib/Driver/ToolChains/Clang.cpp
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 3fc1ef49d1f7..04c05a8f53e3 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4675,8 +4675,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
 
   // Enable -mconstructor-aliases except on darwin, where we have to work 
around
   // a linker bug (see ), and CUDA device code, where
-  // aliases aren't supported.
-  if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX())
+  // aliases aren't supported. Similarly, aliases aren't yet supported for AIX.
+  if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX() && !RawTriple.isOSAIX())
 CmdArgs.push_back("-mconstructor-aliases");
 
   // Darwin's kernel doesn't support guard variables; just die if we

diff  --git a/clang/test/Driver/aix-constructor-alias.c 
b/clang/test/Driver/aix-constructor-alias.c
new file mode 100644
index ..18c5f5b5b877
--- /dev/null
+++ b/clang/test/Driver/aix-constructor-alias.c
@@ -0,0 +1,7 @@
+// Check that we don't pass -mconstructor-aliases when compiling for AIX.
+
+// RUN: %clang -### -target powerpc-ibm-aix7.1.0.0 %s -c -o %t.o 2>&1 \
+// RUN:   | FileCheck %s
+// RUN: %clang -### -target powerpc64-ibm-aix7.1.0.0 %s -c -o %t.o 2>&1 \
+// RUN:   | FileCheck %s
+// CHECK-NOT: "-mconstructor-aliases"

diff  --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp 
b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 2651b683bd0d..241a19d48027 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -155,6 +155,14 @@ class PPCAIXAsmPrinter : public PPCAsmPrinter {
 
   StringRef getPassName() const override { return "AIX PPC Assembly Printer"; }
 
+  bool doInitialization(Module ) override {
+if (M.alias_size() > 0u)
+  report_fatal_error(
+  "module has aliases, which LLVM does not yet support for AIX");
+
+return PPCAsmPrinter::doInitialization(M);
+  }
+
   void SetupMachineFunction(MachineFunction ) override;
 
   void emitGlobalVariable(const GlobalVariable *GV) override;

diff  --git a/llvm/test/CodeGen/PowerPC/aix-alias.ll 
b/llvm/test/CodeGen/PowerPC/aix-alias.ll
new file mode 100644
index ..2183c2e8c557
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/aix-alias.ll
@@ -0,0 +1,10 @@
+; RUN: not --crash llc < %s -mtriple powerpc-ibm-aix-xcoff 2>&1 | FileCheck %s
+; RUN: not --crash llc < %s -mtriple powerpc64-ibm-aix-xcoff 2>&1 | FileCheck 
%s
+
+; Check that, while generation of aliases on AIX remains unimplemented, llc 
dies
+; with an appropriate message instead of generating incorrect output when an
+; alias is encountered.
+
+define i32 @a() { ret i32 0 }
+; CHECK: ERROR: module has aliases
+@b = internal alias i32 (), i32 ()* @a



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


[PATCH] D79526: [CUDA][HIP] Workaround for resolving host device function against wrong-sided function

2020-05-08 Thread Artem Belevich via Phabricator via cfe-commits
tra added a subscriber: wash.
tra added a comment.

In D79526#2027470 , @yaxunl wrote:

> For implicit host device functions, since they are not guaranteed to work in 
> device compilation, we can only resolve them as if they are host functions. 
> This causes asymmetry but implicit host device functions are originally host 
> functions so it is biased toward host compilation in the beginning.


I don't think that the assertion that `implicit host device functions are 
originally host functions` is always true. While in practice most such 
functions may indeed come from the existing host code (e.g. the standard 
library), I don't see any inherent reason why they can't come from the code 
written for GPU. E.g. thrust is likely to have some implicitly HD functions in 
the code that was not intended for CPUs and your assumption will be wrong. Even 
if such case may not exist now, it would not be unreasonable for users to have 
such code on device. 
This overload resolution difference is observable and it will likely create new 
corner cases in convoluted enough C++ code.

I think we need something more principled than "happens to work for existing 
code".

> Only the original resolution guarantees no other issues.  For example, in the 
> failed compilation in TF, some ctor of std::atomic becomes implicit host 
> device function because it is constexpr. We should treated as wrong-sided in 
> device compilation, but we should treated as same-sided in host compilation, 
> otherwise it changes the resolution in host compilation and causes other 
> issues.

It may be true for atomic, where we do need to have GPU-specific 
implementation. However, I can also see classes with constexpr constructors 
that are prefectly usable on both sides and do not have to be treated as the 
wrong-side.

TBH, I do not see any reasonable way to deal with this with the current 
implementation of how HD functions are treated. This patch and its base do 
improve things somewhat, but it all comes at the cost of further complexity and 
potentially paints us even deeper into a corner. Current behavior is already 
rather hard to explain.

Some time back @wash from NVIDIA was asking about improving HD function 
handling. Maybe it's time for all interested parties to figure out whether it's 
time to come up with a better solution. Not in this patch, obviously.




Comment at: clang/test/SemaCUDA/function-overload.cu:471-477
+inline double callee(double x);
+#pragma clang force_cuda_host_device begin
+inline void callee(int x);
+inline double implicit_hd_caller() {
+  return callee(1.0);
+}
+#pragma clang force_cuda_host_device end

These tests only veryfy that the code compiled, but it does not guarantee that 
we've picked the correct overload.
You should give callees different return types and assign the result to a 
variable of intended type.  See `test_host_device_calls_hd_template() ` on line 
341 for an example.


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

https://reviews.llvm.org/D79526



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


[PATCH] D78129: Add Marvell ThunderX3T110 support

2020-05-08 Thread Wei Zhao via Phabricator via cfe-commits
wxz2020 added a comment.

Sure I will add Joel's suggestion and other fixes later.

Thanks,


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78129



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


[PATCH] D78659: Add nomerge function attribute to supress tail merge optimization in simplifyCFG

2020-05-08 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 262933.
zequanwu marked an inline comment as done.
zequanwu added a comment.

update comment.


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

https://reviews.llvm.org/D78659

Files:
  llvm/docs/LangRef.rst
  llvm/include/llvm/Bitcode/LLVMBitCodes.h
  llvm/include/llvm/IR/Attributes.td
  llvm/include/llvm/IR/InstrTypes.h
  llvm/lib/AsmParser/LLLexer.cpp
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/AsmParser/LLToken.h
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/IR/Attributes.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp
  llvm/test/Transforms/SimplifyCFG/nomerge.ll

Index: llvm/test/Transforms/SimplifyCFG/nomerge.ll
===
--- /dev/null
+++ llvm/test/Transforms/SimplifyCFG/nomerge.ll
@@ -0,0 +1,71 @@
+; RUN: opt < %s -O1 -S | FileCheck %s
+
+; The attribute nomerge prevents the 3 bar() calls from being sunk/hoisted into 
+; one inside a function. Check that there are still 3 tail calls.
+
+; Test case for preventing sinking
+; CHECK-LABEL: define void @sink
+; CHECK: if.then:
+; CHECK-NEXT: tail call void @bar()
+; CHECK: if.then2:
+; CHECK-NEXT: tail call void @bar()
+; CHECK: if.end3:
+; CHECK-NEXT: tail call void @bar()
+define void @sink(i32 %i) {
+entry:
+  switch i32 %i, label %if.end3 [
+i32 5, label %if.then
+i32 7, label %if.then2
+  ]
+
+if.then:
+  tail call void @bar() #0
+  br label %if.end3
+
+if.then2:
+  tail call void @bar() #0
+  br label %if.end3
+
+if.end3:
+  tail call void @bar() #0
+  ret void
+}
+
+; Test case for preventing hoisting
+; CHECK-LABEL: define void @hoist
+; CHECK: if.then:
+; CHECK-NEXT: tail call void @bar()
+; CHECK: if.then2:
+; CHECK-NEXT: tail call void @bar()
+; CHECK: if.end:
+; CHECK-NEXT: tail call void @bar()
+define void @hoist(i32 %i) {
+entry:
+  %i.addr = alloca i32, align 4
+  store i32 %i, i32* %i.addr, align 4
+  %0 = load i32, i32* %i.addr, align 4
+  %cmp = icmp eq i32 %0, 5
+  br i1 %cmp, label %if.then, label %if.else
+
+if.then:
+  tail call void @bar() #1
+  unreachable
+
+if.else:
+  %1 = load i32, i32* %i.addr, align 4
+  %cmp1 = icmp eq i32 %i, 7
+  br i1 %cmp1, label %if.then2, label %if.end
+
+if.then2:
+  tail call void @bar() #1
+  unreachable
+
+if.end:
+  tail call void @bar() #1
+  unreachable
+}
+
+declare void @bar()
+
+attributes #0 = { nomerge }
+attributes #1 = { noreturn nomerge }
Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
===
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1300,6 +1300,14 @@
 if (!TTI.isProfitableToHoist(I1) || !TTI.isProfitableToHoist(I2))
   return Changed;
 
+// If any of the two call sites has nomerge attribute, stop hoisting.
+if (const auto *CB1 = dyn_cast(I1))
+  if (CB1->cannotMerge())
+return Changed;
+if (const auto *CB2 = dyn_cast(I2))
+  if (CB2->cannotMerge())
+return Changed;
+
 if (isa(I1) || isa(I2)) {
   assert (isa(I1) && isa(I2));
   // The debug location is an integral part of a debug info intrinsic
@@ -1485,8 +1493,9 @@
 // Conservatively return false if I is an inline-asm instruction. Sinking
 // and merging inline-asm instructions can potentially create arguments
 // that cannot satisfy the inline-asm constraints.
+// If the instruction has nomerge attribute, return false.
 if (const auto *C = dyn_cast(I))
-  if (C->isInlineAsm())
+  if (C->cannotMerge())
 return false;
 
 // Each instruction must have zero or one use.
Index: llvm/lib/IR/Verifier.cpp
===
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -1509,6 +1509,7 @@
 /// Return true if this attribute kind only applies to functions.
 static bool isFuncOnlyAttr(Attribute::AttrKind Kind) {
   switch (Kind) {
+  case Attribute::NoMerge:
   case Attribute::NoReturn:
   case Attribute::NoSync:
   case Attribute::WillReturn:
Index: llvm/lib/IR/Attributes.cpp
===
--- llvm/lib/IR/Attributes.cpp
+++ llvm/lib/IR/Attributes.cpp
@@ -372,6 +372,8 @@
 return "noinline";
   if (hasAttribute(Attribute::NonLazyBind))
 return "nonlazybind";
+  if (hasAttribute(Attribute::NoMerge))
+return "nomerge";
   if (hasAttribute(Attribute::NonNull))
 return "nonnull";
   if (hasAttribute(Attribute::NoRedZone))
Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
===
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -647,6 +647,8 @@
 return bitc::ATTR_KIND_NO_INLINE;
   case Attribute::NoRecurse:
 return bitc::ATTR_KIND_NO_RECURSE;
+  case Attribute::NoMerge:
+return 

[PATCH] D79526: [CUDA][HIP] Workaround for resolving host device function against wrong-sided function

2020-05-08 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

In D79526#2027242 , @tra wrote:

> The latest version of the patch works well enough to compile tensorflow. 
> That's the good news.
>
> In D79526#2026857 , @yaxunl wrote:
>
> > Looks like we went overboard to treat implicit host device candidate as 
> > inferior. They should be treated
> >  as inferior in device compilation, not in host compilation. Here because 
> > they are treated as inferior
> >  to same-sided candidate in host compilation, they changed overload 
> > resolution in host compilation
> >  therefore caused the failure in host compilation.
> >
> > I have updated the patch to treat implicit host device candidate as 
> > inferior in device compilation.
>
>
> I'm concerned that this creates inconsistency in how overload resolution 
> works during host and device compilation.
>  In general they should behave the same. I.e. a test where this change is 
> needed during device-side compilation will require the same change on the 
> host side, if you swap H and D attributes on the functions in the test.
>
> Speaking of tests, it would be great to add a test illustrating this scenario.


I added a test at line 483 for the situation.

For implicit host device functions, since they are not guaranteed to work in 
device compilation, we can only resolve them as if they are host functions. 
This causes asymmetry but implicit host device functions are originally host 
functions so it is biased toward host compilation in the beginning. Only the 
original resolution guarantees no other issues.  For example, in the failed 
compilation in TF, some ctor of std::atomic becomes implicit host device 
function because it is constexpr. We should treated as wrong-sided in device 
compilation, but we should treated as same-sided in host compilation, otherwise 
it changes the resolution in host compilation and causes other issues.


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

https://reviews.llvm.org/D79526



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


[PATCH] D72959: Relative VTables ABI on Fuchsia

2020-05-08 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: clang/include/clang/Basic/LangOptions.def:357
+"allow use of clang's relative C++ ABI "
+"for classes with vtables on targets that support this")
 

"Use an ABI-incompatible v-table layout that uses relative references"



Comment at: clang/include/clang/CodeGen/ConstantInitBuilder.h:230
+  /// Same as addRelativeOffset(), but instead relative to a position in the
+  /// aggregate being constructed.
+  void addRelativeOffsetToPosition(llvm::IntegerType *type,

"relative to an element in this aggregate, identified by its index".



Comment at: clang/include/clang/CodeGen/ConstantInitBuilder.h:317
+  /// The returned pointer will have type T*, where T is the given
+  /// position.
+  llvm::Constant *getAddrOfPosition(llvm::Type *type, size_t position);

Hmm, you've borrowed the last sentence from `getAddrOfCurrentPosition`, but it 
actually doesn't make any sense (in either place).  I think it would be better 
to say something like "The returned pointer will have type `T*`, where `T` is 
the given type.  This type can differ from the type of the actual element."



Comment at: clang/lib/CodeGen/CGVTables.cpp:638
+  // Examples where there would bo no symbol emitted are available_externally
+  // and private linkages.
+  auto StubLinkage = VTableHasLocalLinkage ? llvm::GlobalValue::InternalLinkage

Lots of typos



Comment at: clang/lib/CodeGen/CGVTables.cpp:646
+
+// Take offset from stub to the vtable component.
+llvm::Function *HiddenFunc = M.getFunction(StubName);

That's not what this block is doing.

I think it would make sense to build this stub in a helper function.

Can you just avoid making the stub entirely if the function is known to be 
defined in this translation unit (which will include all the internal-linkage 
cases, but also things like `hidden linkonce_odr`)?



Comment at: clang/lib/CodeGen/CGVTables.cpp:649
+if (!HiddenFunc) {
+  // Make the stub private.
+  llvm::Function *Stub = llvm::Function::Create(Func->getFunctionType(),

`private` is a specific linkage that you're not actually using.



Comment at: clang/lib/CodeGen/CGVTables.cpp:653
+
+  // Propogate byval attributes.
+  Stub->setAttributes(Func->getAttributes());

You're propagating *all* the attributes (which is good, but the comment should 
be clearer).



Comment at: clang/lib/CodeGen/CGVTables.cpp:722
+unsigned componentIdx, llvm::Constant *rtti, unsigned 
,
+unsigned lastAddrPoint, bool VTableHasLocalLinkage) {
+  auto  = layout.vtable_components()[componentIdx];

`lastAddrPoint` is a confusing name for this.



Comment at: clang/lib/CodeGen/CGVTables.cpp:728
+  auto addOffsetConstant =
+  UseRelativeLayout ? AddRelativeOffsetConstant : AddOffsetConstant;
 

Relying on a capitalization difference for this is not a good idea for 
readability.



Comment at: clang/lib/CodeGen/CGVTables.cpp:789
+  // symbol's module. A result of this ABI would make __cxa_pure_virtual
+  // (and it's destructor equivalent) local symbols, and depending on
+  // link order, the comdat groups would resolve to the one with the

It's not a "destructor" equivalent, it's when the virtual function is defined 
as deleted.



Comment at: clang/lib/CodeGen/CGVTables.cpp:795
+  if (UseRelativeLayout)
+return llvm::Constant::getNullValue(CGM.Int8PtrTy);
+

Prefer `llvm::ConstantPointerNull::get`.



Comment at: clang/lib/CodeGen/CGVTables.cpp:868
+  else
+ComponentType = CGM.Int8PtrTy;
   for (unsigned i = 0, e = layout.getNumVTables(); i != e; ++i) {

Can we make a helper function for this?



Comment at: clang/lib/CodeGen/CGVTables.cpp:895
+size_t thisIndex = layout.getVTableOffset(VTableIdx);
+size_t nextIndex = thisIndex + layout.getVTableSize(VTableIdx);
+unsigned LastAddressPoint = thisIndex;

Please use the same local-variable capitalization conventions as the existing 
code, and please don't recompute `getNumVTables()` each time through the loop.

I agree that `vtableIndex` is a clearer name than `i`, but if you're going to 
rename locals for readability, please also rename `thisIndex` and `nextIndex`.



Comment at: clang/lib/CodeGen/CGVTables.cpp:899
+ ++ComponentIdx) {
+  // We want to point to the first function in the vtable. This will come
+  // after the typeinfo component, so we can just check if the previous

"Relative offsets should be relative to the v-table address point, which is the 
first entry after the RTTI pointer."

Can we just do 

[PATCH] D79219: [CMake] Simplify CMake handling for zlib

2020-05-08 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

Ping?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79219



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


[PATCH] D73052: [clang-tidy] RenamerClangTidy now renames dependent member expr when the member can be resolved

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

LGTM, thank you for this!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73052



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


[PATCH] D46317: [clang-tidy] New check bugprone-map-subscript-operator-lookup

2020-05-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D46317#2027330 , @khuttun wrote:

> In D46317#2027071 , @aaron.ballman 
> wrote:
>
> > In D46317#2023406 , @khuttun wrote:
> >
> > > Any comments on this? Is this checker something that could be part of 
> > > clang-tidy?
> >
> >
> > Thank you for posting some of the diagnostics found by the check, that was 
> > really helpful information! I spot-checked ~10 of the issues it reported 
> > and all of them were false positives. Were you able to find any true 
> > positives from that list? I think 1200 reports without any true positives 
> > indicates that the check may be too chatty to include (it may also suggest 
> > that `bugprone` is the wrong place for the check).
>
>
> It's difficult to spot actual functionality bugs without knowing the code 
> better, but there's plenty of unnecessary double-lookups (count()/find() + 
> operator[]) reported, for example:


Definitely agreed that it's labor-intensive. :-)

> clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp:75:30
>  
> clang-tools-extra/clang-tidy/bugprone/ForwardDeclarationNamespaceCheck.cpp:157:33
>  clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp:106:29

I hadn't spot checked those, but did see at least one similar case with what I 
checked. However, I consider those false positives because none of these are 
cases where the code gives wrong results. It is possible they are performance 
concerns (though I'd be curious whether these patterns optimize well or not), 
so if the check was specific to finding that scenario, that would be pretty 
useful (though it likely requires codeflow analysis).


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

https://reviews.llvm.org/D46317



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


[PATCH] D78659: Add nomerge function attribute to supress tail merge optimization in simplifyCFG

2020-05-08 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added inline comments.



Comment at: llvm/include/llvm/IR/Attributes.td:106
 
+/// Disable tail merge for this function
+def NoMerge : EnumAttr<"nomerge">;

Elsewhere we seem to be preventing any kind of movement,
not just disabling inlining of such functions if the call is a tailcall.


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

https://reviews.llvm.org/D78659



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


[PATCH] D79035: [clang][AIX] Implement ABIInfo and TargetCodeGenInfo for AIX

2020-05-08 Thread Zarko Todorovski via Phabricator via cfe-commits
ZarkoCA added inline comments.



Comment at: clang/lib/CodeGen/TargetInfo.cpp:5244
 llvm::Value *Address) const {
-
-  return PPC64_initDwarfEHRegSizeTable(CGF, Address);
+  return PPC_initDwarfEHRegSizeTable(CGF, Address, /* Is64Bit*/ true,
+ /*IsAIX*/ false);

Missed to point out the extra space in `/* Is64Bit*/` previously. 



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:4541
options::OPT_msvr4_struct_return)) {
-if (TC.getArch() != llvm::Triple::ppc) {
+// TODO: We might want to consider enable these two options on AIX in the
+// future.

s/enable/enabling/


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

https://reviews.llvm.org/D79035



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


[PATCH] D79121: Add nomerge function attribute to clang

2020-05-08 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 262922.
zequanwu added a comment.

use `ConstStmtVisitor` to do recursive lookup for call expression.


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

https://reviews.llvm.org/D79121

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CGStmt.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/SemaStmtAttr.cpp
  clang/test/CodeGen/attr-nomerge.cpp
  clang/test/Sema/attr-nomerge.cpp

Index: clang/test/Sema/attr-nomerge.cpp
===
--- /dev/null
+++ clang/test/Sema/attr-nomerge.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -verify -fsyntax-only %s
+
+void bar();
+
+void foo() {
+  [[clang::nomerge]] bar();
+  [[clang::nomerge(1, 2)]] bar(); // expected-error {{'nomerge' attribute takes no arguments}}
+  int x;
+  [[clang::nomerge]] x = 10; // expected-warning {{nomerge attribute is ignored because there exists no call expression inside the statement}}
+
+  [[clang::nomerge]] label: bar(); // expected-error {{'nomerge' attribute cannot be applied to a declaration}}
+
+}
+
+int f();
+
+[[clang::nomerge]] static int i = f(); // expected-error {{'nomerge' attribute cannot be applied to a declaration}}
Index: clang/test/CodeGen/attr-nomerge.cpp
===
--- /dev/null
+++ clang/test/CodeGen/attr-nomerge.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -S -emit-llvm %s -o - | FileCheck %s
+
+bool bar();
+void f(bool, bool);
+
+void foo(int i) {
+  [[clang::nomerge]] bar();
+  [[clang::nomerge]] (i = 4, bar());
+  [[clang::nomerge]] (void)(bar());
+  [[clang::nomerge]] f(bar(), bar());
+  [[clang::nomerge]] [] { bar(); bar(); }(); // nomerge only applies to the anonymous function call
+  [[clang::nomerge]] for (bar(); bar(); bar()) {}
+  bar();
+}
+// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR:[0-9]+]]
+// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR]]
+// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR]]
+// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR]]
+// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR]]
+// CHECK: call void @_Z1fbb({{.*}}) #[[NOMERGEATTR]]
+// CHECK: call void @"_ZZ3fooiENK3$_0clEv"(%class.anon* %ref.tmp) #[[NOMERGEATTR]]
+// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR]]
+// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR]]
+// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR]]
+// CHECK: call zeroext i1 @_Z3barv()
+// CHECK: attributes #[[NOMERGEATTR]] = { nomerge }
Index: clang/lib/Sema/SemaStmtAttr.cpp
===
--- clang/lib/Sema/SemaStmtAttr.cpp
+++ clang/lib/Sema/SemaStmtAttr.cpp
@@ -12,6 +12,7 @@
 
 #include "clang/Sema/SemaInternal.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/StmtVisitor.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Sema/DelayedDiagnostic.h"
 #include "clang/Sema/Lookup.h"
@@ -170,6 +171,44 @@
   return LoopHintAttr::CreateImplicit(S.Context, Option, State, ValueExpr, A);
 }
 
+namespace {
+class CallExprFinder : public ConstStmtVisitor {
+  bool FoundCallExpr = false;
+
+public:
+  bool foundCallExpr() { return FoundCallExpr; }
+
+  void VisitCallExpr(const CallExpr *E) { FoundCallExpr = true; }
+
+  void VisitStmt(const Stmt *S) {
+for (const Stmt *SubStmt : S->children())
+  Visit(SubStmt);
+  }
+
+  void Visit(const Stmt *S) {
+if (!S) return;
+ConstStmtVisitor::Visit(S);
+  }
+};
+} // namespace
+
+static Attr *handleNoMergeAttr(Sema , Stmt *St, const ParsedAttr ,
+   SourceRange Range) {
+  NoMergeAttr NMA(S.Context, A);
+  if (S.CheckAttrNoArgs(A))
+return nullptr;
+  
+  CallExprFinder CEF;
+  CEF.Visit(St);
+  if (!CEF.foundCallExpr()) {
+S.Diag(St->getBeginLoc(), diag::warn_nomerge_attribute_ignored_in_stmt)
+<< NMA.getSpelling();
+return nullptr;
+  }
+
+  return ::new (S.Context) NoMergeAttr(S.Context, A);
+}
+
 static void
 CheckForIncompatibleAttributes(Sema ,
const SmallVectorImpl ) {
@@ -335,6 +374,8 @@
 return handleOpenCLUnrollHint(S, St, A, Range);
   case ParsedAttr::AT_Suppress:
 return handleSuppressAttr(S, St, A, Range);
+  case ParsedAttr::AT_NoMerge:
+return handleNoMergeAttr(S, St, A, Range);
   default:
 // if we're here, then we parsed a known attribute, but didn't recognize
 // it as a statement attribute => it is declaration attribute
Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -595,6 +595,9 @@
   /// region.
   bool IsInPreservedAIRegion = false;
 
+  /// True if the current statement has nomerge attribute.
+  bool InNoMergeAttributedStmt = false;
+
   const 

[PATCH] D79639: [SveEmitter] Builtins for SVE matrix multiply `mmla`.

2020-05-08 Thread Francesco Petrogalli via Phabricator via cfe-commits
fpetrogalli updated this revision to Diff 262923.
fpetrogalli added a comment.

I replaced the lines `Signed = !Signed` in the tablegen emitter with `Signed = 
false`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79639

Files:
  clang/include/clang/Basic/arm_sve.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_matmul_fp32.c
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_matmul_fp64.c
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_mmla.c
  clang/utils/TableGen/SveEmitter.cpp

Index: clang/utils/TableGen/SveEmitter.cpp
===
--- clang/utils/TableGen/SveEmitter.cpp
+++ clang/utils/TableGen/SveEmitter.cpp
@@ -513,6 +513,11 @@
   case 'q':
 ElementBitwidth /= 4;
 break;
+  case 'b':
+Signed = false;
+Float = false;
+ElementBitwidth /= 4;
+break;
   case 'o':
 ElementBitwidth *= 4;
 break;
Index: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_mmla.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_mmla.c
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE_MATMUL_INT8 \
+// RUN:-triple aarch64-none-linux-gnu -target-feature +sve \
+// RUN:-fallow-half-arguments-and-returns -S -O1 -Werror -Wall \
+// RUN:-emit-llvm -o - %s | FileCheck %s
+
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE_MATMUL_INT8 \
+// RUN:-triple aarch64-none-linux-gnu -target-feature +sve \
+// RUN:-fallow-half-arguments-and-returns -S -O1 -Werror -Wall \
+// RUN:-emit-llvm -o - %s -DSVE_OVERLOADED_FORMS| FileCheck %s
+
+#include 
+
+#ifdef SVE_OVERLOADED_FORMS
+// A simple used,unused... macro, long enough to represent any SVE builtin.
+#define SVE_ACLE_FUNC(A1, A2_UNUSED, A3, A4_UNUSED) A1##A3
+#else
+#define SVE_ACLE_FUNC(A1, A2, A3, A4) A1##A2##A3##A4
+#endif
+
+svint32_t test_svmmla_s32(svint32_t x, svint8_t y, svint8_t z) {
+  // CHECK-LABEL: test_svmmla_s32
+  // CHECK: %[[RET:.*]] = call  @llvm.aarch64.sve.smmla.nxv4i32( %x,  %y,  %z)
+  // CHECK: ret  %[[RET]]
+  return SVE_ACLE_FUNC(svmmla, _s32, , )(x, y, z);
+}
+
+svuint32_t test_svmmla_u32(svuint32_t x, svuint8_t y, svuint8_t z) {
+  // CHECK-LABEL: test_svmmla_u32
+  // CHECK: %[[RET:.*]] = call  @llvm.aarch64.sve.ummla.nxv4i32( %x,  %y,  %z)
+  // CHECK: ret  %[[RET]]
+  return SVE_ACLE_FUNC(svmmla, _u32, , )(x, y, z);
+}
+
+svint32_t test_svusmmla_s32(svint32_t x, svuint8_t y, svint8_t z) {
+  // CHECK-LABEL: test_svusmmla_s32
+  // CHECK: %[[RET:.*]] = call  @llvm.aarch64.sve.usmmla.nxv4i32( %x,  %y,  %z)
+  // CHECK: ret  %[[RET]]
+  return SVE_ACLE_FUNC(svusmmla, _s32, , )(x, y, z);
+}
Index: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_matmul_fp64.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_matmul_fp64.c
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE_MATMUL_FP64 \
+// RUN:-triple aarch64-none-linux-gnu -target-feature +sve \
+// RUN:-fallow-half-arguments-and-returns -S -O1 -Werror -Wall \
+// RUN:-emit-llvm -o - %s | FileCheck %s
+
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE_MATMUL_FP64 \
+// RUN:-triple aarch64-none-linux-gnu -target-feature +sve \
+// RUN:-fallow-half-arguments-and-returns -S -O1 -Werror -Wall \
+// RUN:-emit-llvm -o - %s -DSVE_OVERLOADED_FORMS | FileCheck %s
+
+#include 
+
+#ifdef SVE_OVERLOADED_FORMS
+// A simple used,unused... macro, long enough to represent any SVE builtin.
+#define SVE_ACLE_FUNC(A1, A2_UNUSED, A3, A4_UNUSED) A1##A3
+#else
+#define SVE_ACLE_FUNC(A1, A2, A3, A4) A1##A2##A3##A4
+#endif
+
+svfloat64_t test_svmmla_f64(svfloat64_t x, svfloat64_t y, svfloat64_t z) {
+  // CHECK-LABEL: test_svmmla_f64
+  // CHECK: %[[RET:.*]] = call  @llvm.aarch64.sve.mmla.nxv2f64( %x,  %y,  %z)
+  // CHECK: ret  %[[RET]]
+  return SVE_ACLE_FUNC(svmmla, _f64, , )(x, y, z);
+}
Index: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_matmul_fp32.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_matmul_fp32.c
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE_MATMUL_FP32 \
+// RUN:-triple aarch64-none-linux-gnu -target-feature +sve \
+// RUN:-fallow-half-arguments-and-returns -S -O1 -Werror -Wall \
+// RUN:-emit-llvm -o - %s | FileCheck %s
+
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE_MATMUL_FP32 \
+// RUN:-triple aarch64-none-linux-gnu -target-feature +sve \
+// RUN:-fallow-half-arguments-and-returns -S -O1 -Werror -Wall \
+// 

[PATCH] D79477: [clang-tidy] Add --use-color command line option and UseColor option to control colors in diagnostics

2020-05-08 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment.

Could this not use the `-fcolor-diagnostics` and `fno-color-diagnostics` 
command line flags that clang uses for its diagnostics to keep everything the 
same?


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

https://reviews.llvm.org/D79477



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


[PATCH] D79636: [LangRef] Clarify the semantics of the `byval` attribute

2020-05-08 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments.



Comment at: llvm/docs/LangRef.rst:1050
+the call site argument and function argument are associated with the
+original and copied memory respectively. The copy is considered to be local
+memory of the callee. That means, a callee can wrtie a ``byval`` parameter

"Attributes on the call site argument and function argument are associated with 
the original and copied memory respectively"

This seems to fly in the face of existing practice, which is that function 
attributes are copied to each callsite.  I'd strongly prefer to keep the 
meaning of the attributes consistent, even if it leads to a weird result like 
writing to an argument marked "readonly".



Comment at: llvm/docs/LangRef.rst:1051
+original and copied memory respectively. The copy is considered to be local
+memory of the callee. That means, a callee can wrtie a ``byval`` parameter
+and still be ``readonly`` or ``readnone`` because the write is, similar to

"wrtie "


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79636



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


[PATCH] D73052: [clang-tidy] RenamerClangTidy now renames dependent member expr when the member can be resolved

2020-05-08 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 262920.
njames93 marked 3 inline comments as done.
njames93 added a comment.

- Tweaked options to remove second virtual method


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73052

Files:
  clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp
  clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
  clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
  clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst
  
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-member-decl-usage.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-member-decl-usage.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-member-decl-usage.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-member-decl-usage.cpp
@@ -1,7 +1,9 @@
 // RUN: %check_clang_tidy %s readability-identifier-naming %t -- \
 // RUN:   -config='{CheckOptions: [ \
 // RUN: {key: readability-identifier-naming.MemberCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.ParameterCase, value: CamelCase} \
+// RUN: {key: readability-identifier-naming.ParameterCase, value: CamelCase}, \
+// RUN: {key: readability-identifier-naming.MethodCase, value: camelBack}, \
+// RUN: {key: readability-identifier-naming.AggressiveDependentMemberLookup, value: 1} \
 // RUN:  ]}' -- -fno-delayed-template-parsing
 
 int set_up(int);
@@ -63,32 +65,23 @@
   // CHECK-FIXES: {{^}}  int getBar2() const { return this->BarBaz; } // comment-9
 };
 
-TempTest x; //force an instantiation
-
-int blah() {
-  return x.getBar2(); // gotta have a reference to the getBar2 so that the
-  // compiler will generate the function and resolve
-  // the DependantScopeMemberExpr
-}
-
 namespace Bug41122 {
 namespace std {
 
 // for this example we aren't bothered about how std::vector is treated
-template  //NOLINT
-class vector { //NOLINT
-public:
-  void push_back(bool); //NOLINT
-  void pop_back(); //NOLINT
-}; //NOLINT
-}; // namespace std
+template// NOLINT
+struct vector { // NOLINT
+  void push_back(bool); // NOLINT
+  void pop_back();  // NOLINT
+};  // NOLINT
+};  // namespace std
 
-class Foo { 
+class Foo {
   std::vector 
   // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: invalid case style for member 'stack' [readability-identifier-naming]
 public:
   Foo(std::vector )
-  // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: invalid case style for parameter 'stack' [readability-identifier-naming]
+  // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: invalid case style for parameter 'stack' [readability-identifier-naming]
   // CHECK-FIXES: {{^}}  Foo(std::vector )
   : stack(stack) {
 // CHECK-FIXES: {{^}}  : Stack(Stack) {
@@ -134,4 +127,92 @@
 void foo() {
   Container container;
 }
-}; // namespace CtorInits
+} // namespace CtorInits
+
+namespace resolved_dependance {
+template 
+struct A0 {
+  int value;
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for member 'value'
+  A0 =(const A0 ) {
+value = Other.value;   // A0
+this->value = Other.value; // A0
+// CHECK-FIXES:  {{^}}Value = Other.Value;   // A0
+// CHECK-FIXES-NEXT: {{^}}this->Value = Other.Value; // A0
+return *this;
+  }
+  void outOfLineReset();
+};
+
+template 
+void A0::outOfLineReset() {
+  this->value -= value; // A0
+  // CHECK-FIXES: {{^}}  this->Value -= Value; // A0
+}
+
+template 
+struct A1 {
+  int value; // A1
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for member 'value'
+  // CHECK-FIXES: {{^}}  int Value; // A1
+  int GetValue() const { return value; } // A1
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for method 'GetValue'
+  // CHECK-FIXES {{^}}  int getValue() const { return Value; } // A1
+  void SetValue(int Value) { this->value = Value; } // A1
+  // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for method 'SetValue'
+  // CHECK-FIXES {{^}}  void setValue(int Value) { this->Value = Value; } // A1
+  A1 =(const A1 ) {
+this->SetValue(Other.GetValue()); // A1
+this->value = Other.value;// A1
+// CHECK-FIXES:  {{^}}this->setValue(Other.getValue()); // A1
+// CHECK-FIXES-NEXT: {{^}}this->Value = Other.Value;// A1
+return *this;
+  }
+  void outOfLineReset();
+};
+
+template 
+void A1::outOfLineReset() {
+  this->value -= value; // A1
+  // CHECK-FIXES: {{^}}  this->Value -= Value; // A1
+}
+
+template 
+struct A2 {
+  int value; // A2
+  // CHECK-MESSAGES: 

[PATCH] D78129: Add Marvell ThunderX3T110 support

2020-05-08 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer added a comment.

In D78129#2023772 , @joelkevinjones 
wrote:

> I don't think it makes sense to combine two unrelated things SVE and PA 
> support into a combined thing. Since we already have UnsupportedFeatures in 
> every sub-target .td file, I think it would be better to instead have:
>
>   def PAUnsupported : AArch64Unsupported {
> let F = [HasPA];
>   }
>
>
> and modify each .td file to have
>
>   list UnsupportedFeatures = !listconcat(SVEUnsupported.F, 
> PAUnsupported.F);
>


Can you add what Joel suggested? I don't see the point of doing this as a 
follow up. This very simple thing is done half right here, so is best fixed 
here as there is no reason to leave this for another time; following up on this 
and talking about this is more work than just doing it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78129



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


[PATCH] D79631: #pragma float_control should be permitted at namespace scope

2020-05-08 Thread Melanie Blower via Phabricator via cfe-commits
mibintc added a comment.

No this patch isn't ready yet. i see an assertion if try to instantiate a 
template function when the template has enabled floating point settings


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79631



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


[PATCH] D79639: [SveEmitter] Builtins for SVE matrix multiply `mmla`.

2020-05-08 Thread Francesco Petrogalli via Phabricator via cfe-commits
fpetrogalli created this revision.
fpetrogalli added reviewers: sdesmalen, kmclaughlin, efriedma.
Herald added subscribers: cfe-commits, kristof.beyls, tschuett.
Herald added a reviewer: rengolin.
Herald added a project: clang.
fpetrogalli added a parent revision: D79638: [llvm][SVE] IR intrinscs for 
matrix multiplication instructions..
fpetrogalli updated this revision to Diff 262923.
fpetrogalli added a comment.

I replaced the lines `Signed = !Signed` in the tablegen emitter with `Signed = 
false`.


Guarded by __ARM_FEATURE_SVE_MATMUL_INT8:

- svmmla_u32
- svmmla_s32
- svusmmla_s32

Guarded by __ARM_FEATURE_SVE_MATMUL_FP32:

- svmmla_f32

Guarded by __ARM_FEATURE_SVE_MATMUL_FP64:

- svmmla_f64

Extra change: replace one use of auto with the type returned by the
function (NFC).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79639

Files:
  clang/include/clang/Basic/arm_sve.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_matmul_fp32.c
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_matmul_fp64.c
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_mmla.c
  clang/utils/TableGen/SveEmitter.cpp

Index: clang/utils/TableGen/SveEmitter.cpp
===
--- clang/utils/TableGen/SveEmitter.cpp
+++ clang/utils/TableGen/SveEmitter.cpp
@@ -513,6 +513,11 @@
   case 'q':
 ElementBitwidth /= 4;
 break;
+  case 'b':
+Signed = false;
+Float = false;
+ElementBitwidth /= 4;
+break;
   case 'o':
 ElementBitwidth *= 4;
 break;
Index: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_mmla.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_mmla.c
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE_MATMUL_INT8 \
+// RUN:-triple aarch64-none-linux-gnu -target-feature +sve \
+// RUN:-fallow-half-arguments-and-returns -S -O1 -Werror -Wall \
+// RUN:-emit-llvm -o - %s | FileCheck %s
+
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE_MATMUL_INT8 \
+// RUN:-triple aarch64-none-linux-gnu -target-feature +sve \
+// RUN:-fallow-half-arguments-and-returns -S -O1 -Werror -Wall \
+// RUN:-emit-llvm -o - %s -DSVE_OVERLOADED_FORMS| FileCheck %s
+
+#include 
+
+#ifdef SVE_OVERLOADED_FORMS
+// A simple used,unused... macro, long enough to represent any SVE builtin.
+#define SVE_ACLE_FUNC(A1, A2_UNUSED, A3, A4_UNUSED) A1##A3
+#else
+#define SVE_ACLE_FUNC(A1, A2, A3, A4) A1##A2##A3##A4
+#endif
+
+svint32_t test_svmmla_s32(svint32_t x, svint8_t y, svint8_t z) {
+  // CHECK-LABEL: test_svmmla_s32
+  // CHECK: %[[RET:.*]] = call  @llvm.aarch64.sve.smmla.nxv4i32( %x,  %y,  %z)
+  // CHECK: ret  %[[RET]]
+  return SVE_ACLE_FUNC(svmmla, _s32, , )(x, y, z);
+}
+
+svuint32_t test_svmmla_u32(svuint32_t x, svuint8_t y, svuint8_t z) {
+  // CHECK-LABEL: test_svmmla_u32
+  // CHECK: %[[RET:.*]] = call  @llvm.aarch64.sve.ummla.nxv4i32( %x,  %y,  %z)
+  // CHECK: ret  %[[RET]]
+  return SVE_ACLE_FUNC(svmmla, _u32, , )(x, y, z);
+}
+
+svint32_t test_svusmmla_s32(svint32_t x, svuint8_t y, svint8_t z) {
+  // CHECK-LABEL: test_svusmmla_s32
+  // CHECK: %[[RET:.*]] = call  @llvm.aarch64.sve.usmmla.nxv4i32( %x,  %y,  %z)
+  // CHECK: ret  %[[RET]]
+  return SVE_ACLE_FUNC(svusmmla, _s32, , )(x, y, z);
+}
Index: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_matmul_fp64.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_matmul_fp64.c
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE_MATMUL_FP64 \
+// RUN:-triple aarch64-none-linux-gnu -target-feature +sve \
+// RUN:-fallow-half-arguments-and-returns -S -O1 -Werror -Wall \
+// RUN:-emit-llvm -o - %s | FileCheck %s
+
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE_MATMUL_FP64 \
+// RUN:-triple aarch64-none-linux-gnu -target-feature +sve \
+// RUN:-fallow-half-arguments-and-returns -S -O1 -Werror -Wall \
+// RUN:-emit-llvm -o - %s -DSVE_OVERLOADED_FORMS | FileCheck %s
+
+#include 
+
+#ifdef SVE_OVERLOADED_FORMS
+// A simple used,unused... macro, long enough to represent any SVE builtin.
+#define SVE_ACLE_FUNC(A1, A2_UNUSED, A3, A4_UNUSED) A1##A3
+#else
+#define SVE_ACLE_FUNC(A1, A2, A3, A4) A1##A2##A3##A4
+#endif
+
+svfloat64_t test_svmmla_f64(svfloat64_t x, svfloat64_t y, svfloat64_t z) {
+  // CHECK-LABEL: test_svmmla_f64
+  // CHECK: %[[RET:.*]] = call  @llvm.aarch64.sve.mmla.nxv2f64( %x,  %y,  %z)
+  // CHECK: ret  %[[RET]]
+  return SVE_ACLE_FUNC(svmmla, _f64, , )(x, y, z);
+}
Index: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_matmul_fp32.c
===
--- /dev/null
+++ 

[PATCH] D46317: [clang-tidy] New check bugprone-map-subscript-operator-lookup

2020-05-08 Thread Kalle Huttunen via Phabricator via cfe-commits
khuttun added a comment.

In D46317#2027071 , @aaron.ballman 
wrote:

> In D46317#2023406 , @khuttun wrote:
>
> > Any comments on this? Is this checker something that could be part of 
> > clang-tidy?
>
>
> Thank you for posting some of the diagnostics found by the check, that was 
> really helpful information! I spot-checked ~10 of the issues it reported and 
> all of them were false positives. Were you able to find any true positives 
> from that list? I think 1200 reports without any true positives indicates 
> that the check may be too chatty to include (it may also suggest that 
> `bugprone` is the wrong place for the check).


It's difficult to spot actual functionality bugs without knowing the code 
better, but there's plenty of unnecessary double-lookups (count()/find() + 
operator[]) reported, for example:

clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp:75:30
clang-tools-extra/clang-tidy/bugprone/ForwardDeclarationNamespaceCheck.cpp:157:33
clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp:106:29


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

https://reviews.llvm.org/D46317



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


[PATCH] D78862: [IR] Convert null-pointer-is-valid into an enum attribute

2020-05-08 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added a comment.

In D78862#2012560 , @jdoerfert wrote:

> I think this is an improvement over the status quo and it looks fine to me.
>
> @arsenm I agree that we should tie this to the data layout (or at least 
> should try) but I guess there are open questions to answer and code to write.
>  I propose to accept this and work on the DL patch after. WDYT?


Seems ok, but it's still burning an enum value which I guess isn't super 
important. With the datalayout property, we might really want the inverse 
attribute

> 
> 
> In D78862#2008831 , @manojgupta 
> wrote:
> 
>> @nikic Thanks for the work.
>>
>> In D78862#2003684 , @arsenm wrote:
>>
>> > FWIW I think this attribute should be replaced with a data layout 
>> > property, so this would eventually be removed
>>
>>
>> @arsenm  Is there any work planned on moving to data layout? Moving to data 
>> layout may affect cross TU inlining e.g. LTO where 1 TU is compiled with 
>> `-fno-delete-null-pointer-checks` and other TU is not. There might be other 
>> potential impact that we might not know yet.
> 
> 
> If we link modules with mismatching data layouts we can/should deal with this 
> by utilizing more address spaces. That is, change the address space in one 
> module to a fresh one to keep the properties alive. There need to be rules 
> for this and infrastructure but something similar might be needed for 
> heterogeneous IR modules soon. Different story though. We can also combine 
> the attribute and the data layout if necessary, though I'm not a fan.

This sounds really problematic and would require way more knowledge of target 
address spaces. I don't think this will work


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78862



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


[PATCH] D76793: [Matrix] Implement + and - operators for MatrixType.

2020-05-08 Thread Florian Hahn via Phabricator via cfe-commits
fhahn updated this revision to Diff 262901.
fhahn added a comment.

Rebase on top of the final version of D72281 .

I think this patch is now ready for review.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76793

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/test/CodeGen/matrix-type-operators.c
  clang/test/CodeGenCXX/matrix-type-operators.cpp
  clang/test/Sema/matrix-type-operators.c
  clang/test/SemaCXX/matrix-type-operators.cpp
  llvm/include/llvm/IR/MatrixBuilder.h

Index: llvm/include/llvm/IR/MatrixBuilder.h
===
--- llvm/include/llvm/IR/MatrixBuilder.h
+++ llvm/include/llvm/IR/MatrixBuilder.h
@@ -127,6 +127,16 @@
   /// Add matrixes \p LHS and \p RHS. Support both integer and floating point
   /// matrixes.
   Value *CreateAdd(Value *LHS, Value *RHS) {
+assert(LHS->getType()->isVectorTy() || RHS->getType()->isVectorTy());
+if (LHS->getType()->isVectorTy() && !RHS->getType()->isVectorTy())
+  RHS = B.CreateVectorSplat(
+  cast(LHS->getType())->getNumElements(), RHS,
+  "scalar.splat");
+else if (!LHS->getType()->isVectorTy() && RHS->getType()->isVectorTy())
+  LHS = B.CreateVectorSplat(
+  cast(RHS->getType())->getNumElements(), LHS,
+  "scalar.splat");
+
 return cast(LHS->getType())
->getElementType()
->isFloatingPointTy()
@@ -137,6 +147,16 @@
   /// Subtract matrixes \p LHS and \p RHS. Support both integer and floating
   /// point matrixes.
   Value *CreateSub(Value *LHS, Value *RHS) {
+assert(LHS->getType()->isVectorTy() || RHS->getType()->isVectorTy());
+if (LHS->getType()->isVectorTy() && !RHS->getType()->isVectorTy())
+  RHS = B.CreateVectorSplat(
+  cast(LHS->getType())->getNumElements(), RHS,
+  "scalar.splat");
+else if (!LHS->getType()->isVectorTy() && RHS->getType()->isVectorTy())
+  LHS = B.CreateVectorSplat(
+  cast(RHS->getType())->getNumElements(), LHS,
+  "scalar.splat");
+
 return cast(LHS->getType())
->getElementType()
->isFloatingPointTy()
Index: clang/test/SemaCXX/matrix-type-operators.cpp
===
--- clang/test/SemaCXX/matrix-type-operators.cpp
+++ clang/test/SemaCXX/matrix-type-operators.cpp
@@ -66,3 +66,66 @@
   a[2] = f;
   // expected-error@-1 {{single subscript expressions are not allowed for matrix values}}
 }
+
+template 
+struct MyMatrix {
+  using matrix_t = EltTy __attribute__((matrix_type(Rows, Columns)));
+
+  matrix_t value;
+};
+
+template 
+typename MyMatrix::matrix_t add(MyMatrix , MyMatrix ) {
+  char *v1 = A.value + B.value;
+  // expected-error@-1 {{cannot initialize a variable of type 'char *' with an rvalue of type 'MyMatrix::matrix_t' (aka 'unsigned int __attribute__((matrix_type(2, 2)))')}}
+  // expected-error@-2 {{invalid operands to binary expression ('MyMatrix::matrix_t' (aka 'unsigned int __attribute__((matrix_type(3, 3)))') and 'MyMatrix::matrix_t' (aka 'float __attribute__((matrix_type(2, 2)))'))}}
+  // expected-error@-3 {{invalid operands to binary expression ('MyMatrix::matrix_t' (aka 'unsigned int __attribute__((matrix_type(2, 2)))') and 'MyMatrix::matrix_t' (aka 'unsigned int __attribute__((matrix_type(3, 3)))'))}}
+
+  return A.value + B.value;
+  // expected-error@-1 {{invalid operands to binary expression ('MyMatrix::matrix_t' (aka 'unsigned int __attribute__((matrix_type(3, 3)))') and 'MyMatrix::matrix_t' (aka 'float __attribute__((matrix_type(2, 2)))'))}}
+  // expected-error@-2 {{invalid operands to binary expression ('MyMatrix::matrix_t' (aka 'unsigned int __attribute__((matrix_type(2, 2)))') and 'MyMatrix::matrix_t' (aka 'unsigned int __attribute__((matrix_type(3, 3)))'))}}
+}
+
+void test_add_template(unsigned *Ptr1, float *Ptr2) {
+  MyMatrix Mat1;
+  MyMatrix Mat2;
+  MyMatrix Mat3;
+  Mat1.value = *((decltype(Mat1)::matrix_t *)Ptr1);
+  unsigned v1 = add(Mat1, Mat1);
+  // expected-error@-1 {{cannot initialize a variable of type 'unsigned int' with an rvalue of type 'typename MyMatrix::matrix_t' (aka 'unsigned int __attribute__((matrix_type(2, 2)))')}}
+  // expected-note@-2 {{in instantiation of function template specialization 'add' requested here}}
+
+  Mat1.value = add(Mat1, Mat2);
+  // expected-note@-1 {{in instantiation of function template specialization 'add' requested here}}
+
+  Mat1.value = add(Mat2, Mat3);
+  // expected-note@-1 {{in instantiation of function template specialization 'add' requested here}}
+}
+
+template 
+typename MyMatrix::matrix_t subtract(MyMatrix , MyMatrix ) {
+  char *v1 = A.value - B.value;
+  // expected-error@-1 {{cannot initialize a variable of type 'char *' with an rvalue of type 

[PATCH] D79636: [LangRef] Clarify the semantics of the `byval` attribute

2020-05-08 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert created this revision.
jdoerfert added reviewers: arsenm, spatel, efriedma, lebedev.ri, fhahn, rnk, 
hfinkel, regehr, nlopes.
Herald added subscribers: dmgreen, bollu, wdng.
Herald added a project: LLVM.

After the discussion in D79454  it seemed 
clear we need to clarify the
`byval` attribute semantics. This is an attempt to make it consistent
with the de-facto behavior and expectations of different LLVM passes.

The clarified rules are phrased such that:

- an empty function with a `byval` argument is correctly classified as 
`readnone` (which it is today: https://godbolt.org/z/nePXM6).
- a call of a `readnone` function with a `byval` argument is not classified as 
`readnone` (which it is today: https://godbolt.org/z/dDfQ5r)
- we can eliminate the Clang rules that prevent the effect of `pure` or `const` 
on functions that take a `byval` argument (as they are circumvented by the 
middle-end anyway)

I doubt this will break existing backends or other parts but actually
avoid us creating (temporary) broken IR during the middle-end
optimizations.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79636

Files:
  llvm/docs/LangRef.rst


Index: llvm/docs/LangRef.rst
===
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -1043,10 +1043,18 @@
 is unable to modify the value in the caller. This attribute is only
 valid on LLVM pointer arguments. It is generally used to pass
 structs and arrays by value, but is also valid on pointers to
-scalars. The copy is considered to belong to the caller not the
-callee (for example, ``readonly`` functions should not write to
-``byval`` parameters). This is not a valid attribute for return
-values.
+scalars The copy is conceptually made on the call edge. This means that
+the pointer argument at the call site refers to the original memmory and
+the pointer argument in the callee is refering to the copy. Attributes on
+the call site argument and function argument are associated with the
+original and copied memory respectively. The copy is considered to be local
+memory of the callee. That means, a callee can wrtie a ``byval`` parameter
+and still be ``readonly`` or ``readnone`` because the write is, similar to
+a write to an ``alloca``, not visible from the outside. To create the copy
+the original memory, thus the call site argument, is always read. This
+effect is also associated with the call site, thus it cannot be `readnone`
+or `writeonly` regardless of the callee. This is not a valid attribute for
+return values.
 
 The byval attribute also supports an optional type argument, which must be
 the same as the pointee type of the argument.


Index: llvm/docs/LangRef.rst
===
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -1043,10 +1043,18 @@
 is unable to modify the value in the caller. This attribute is only
 valid on LLVM pointer arguments. It is generally used to pass
 structs and arrays by value, but is also valid on pointers to
-scalars. The copy is considered to belong to the caller not the
-callee (for example, ``readonly`` functions should not write to
-``byval`` parameters). This is not a valid attribute for return
-values.
+scalars The copy is conceptually made on the call edge. This means that
+the pointer argument at the call site refers to the original memmory and
+the pointer argument in the callee is refering to the copy. Attributes on
+the call site argument and function argument are associated with the
+original and copied memory respectively. The copy is considered to be local
+memory of the callee. That means, a callee can wrtie a ``byval`` parameter
+and still be ``readonly`` or ``readnone`` because the write is, similar to
+a write to an ``alloca``, not visible from the outside. To create the copy
+the original memory, thus the call site argument, is always read. This
+effect is also associated with the call site, thus it cannot be `readnone`
+or `writeonly` regardless of the callee. This is not a valid attribute for
+return values.
 
 The byval attribute also supports an optional type argument, which must be
 the same as the pointee type of the argument.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79526: [CUDA][HIP] Workaround for resolving host device function against wrong-sided function

2020-05-08 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

The latest version of the patch works well enough to compile tensorflow. That's 
the good news.

In D79526#2026857 , @yaxunl wrote:

> Looks like we went overboard to treat implicit host device candidate as 
> inferior. They should be treated
>  as inferior in device compilation, not in host compilation. Here because 
> they are treated as inferior
>  to same-sided candidate in host compilation, they changed overload 
> resolution in host compilation
>  therefore caused the failure in host compilation.
>
> I have updated the patch to treat implicit host device candidate as inferior 
> in device compilation.


I'm concerned that this creates inconsistency in how overload resolution works 
during host and device compilation.
In general they should behave the same. I.e. a test where this change is needed 
during device-side compilation will require the same change on the host side, 
if you swap H and D attributes on the functions in the test.

Speaking of tests, it would be great to add a test illustrating this scenario.


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

https://reviews.llvm.org/D79526



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


[PATCH] D79595: Fix bugs when an included file name is typo corrected.

2020-05-08 Thread Nico Weber via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG51d938bc9443: Fix bugs when an included file name is typo 
corrected. (authored by thakis).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79595

Files:
  clang/include/clang/Lex/Preprocessor.h
  clang/lib/Lex/PPDirectives.cpp
  clang/test/Lexer/case-insensitive-include-pr31836.sh
  clang/test/Lexer/case-insensitive-include-win.c

Index: clang/test/Lexer/case-insensitive-include-win.c
===
--- clang/test/Lexer/case-insensitive-include-win.c
+++ clang/test/Lexer/case-insensitive-include-win.c
@@ -5,6 +5,6 @@
 // REQUIRES: system-windows
 // RUN: mkdir -p %t.dir
 // RUN: touch %t.dir/foo.h
-// RUN: not %clang_cl /FI\\?\%t.dir\FOO.h /WX -Xclang -verify -fsyntax-only %s 2>&1 | FileCheck %s
+// RUN: not %clang_cl /FI\\?\%t.dir\FOO.h /WX -fsyntax-only %s 2>&1 | FileCheck %s
 
 // CHECK: non-portable path to file '"\\?\
Index: clang/test/Lexer/case-insensitive-include-pr31836.sh
===
--- clang/test/Lexer/case-insensitive-include-pr31836.sh
+++ clang/test/Lexer/case-insensitive-include-pr31836.sh
@@ -2,7 +2,8 @@
 
 // RUN: mkdir -p %t
 // RUN: touch %t/case-insensitive-include-pr31836.h
-// RUN: echo "#include \"%t/Case-Insensitive-Include-Pr31836.h\"" | %clang_cc1 -E - 2>&1 | FileCheck %s
+// RUN: echo "#include \"?%t/Case-Insensitive-Include-Pr31836.h\"" | not %clang_cc1 -E - 2>&1 | FileCheck %s
 
+// CHECK: error: {{.*}}file not found, did you mean
 // CHECK: warning: non-portable path to file
 // CHECK-SAME: /case-insensitive-include-pr31836.h
Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -1716,11 +1716,11 @@
 }
 
 Optional Preprocessor::LookupHeaderIncludeOrImport(
-const DirectoryLookup *, StringRef Filename,
+const DirectoryLookup *, StringRef& Filename,
 SourceLocation FilenameLoc, CharSourceRange FilenameRange,
 const Token , bool , bool IsImportDecl,
 bool , const DirectoryLookup *LookupFrom,
-const FileEntry *LookupFromFile, StringRef LookupFilename,
+const FileEntry *LookupFromFile, StringRef& LookupFilename,
 SmallVectorImpl , SmallVectorImpl ,
 ModuleMap::KnownHeader , bool isAngled) {
   Optional File = LookupFile(
@@ -1789,21 +1789,10 @@
   return Filename;
 };
 StringRef TypoCorrectionName = CorrectTypoFilename(Filename);
-
-#ifndef _WIN32
-// Normalize slashes when compiling with -fms-extensions on non-Windows.
-// This is unnecessary on Windows since the filesystem there handles
-// backslashes.
-SmallString<128> NormalizedTypoCorrectionPath;
-if (LangOpts.MicrosoftExt) {
-  NormalizedTypoCorrectionPath = TypoCorrectionName;
-  llvm::sys::path::native(NormalizedTypoCorrectionPath);
-  TypoCorrectionName = NormalizedTypoCorrectionPath;
-}
-#endif
+StringRef TypoCorrectionLookupName = CorrectTypoFilename(LookupFilename);
 
 Optional File = LookupFile(
-FilenameLoc, TypoCorrectionName, isAngled, LookupFrom, LookupFromFile,
+FilenameLoc, TypoCorrectionLookupName, isAngled, LookupFrom, LookupFromFile,
 CurDir, Callbacks ?  : nullptr,
 Callbacks ?  : nullptr, , ,
 /*IsFrameworkFound=*/nullptr);
@@ -1818,6 +1807,7 @@
   // We found the file, so set the Filename to the name after typo
   // correction.
   Filename = TypoCorrectionName;
+  LookupFilename = TypoCorrectionLookupName;
   return File;
 }
   }
@@ -2074,8 +2064,6 @@
   if (Callbacks && !IsImportDecl) {
 // Notify the callback object that we've seen an inclusion directive.
 // FIXME: Use a different callback for a pp-import?
-// FIXME: Passes wrong filename if LookupHeaderIncludeOrImport() did
-// typo correction.
 Callbacks->InclusionDirective(
 HashLoc, IncludeTok, LookupFilename, isAngled, FilenameRange,
 File ? >getFileEntry() : nullptr, SearchPath, RelativePath,
@@ -2102,7 +2090,6 @@
   !IsMapped && !File->getFileEntry().tryGetRealPathName().empty();
 
   if (CheckIncludePathPortability) {
-// FIXME: Looks at the wrong filename if we did typo correction.
 StringRef Name = LookupFilename;
 StringRef NameWithoriginalSlashes = Filename;
 #if defined(_WIN32)
Index: clang/include/clang/Lex/Preprocessor.h
===
--- clang/include/clang/Lex/Preprocessor.h
+++ clang/include/clang/Lex/Preprocessor.h
@@ -2242,11 +2242,11 @@
   };
 
   Optional LookupHeaderIncludeOrImport(
-  const DirectoryLookup *, StringRef Filename,
+  const DirectoryLookup *, StringRef ,
   SourceLocation FilenameLoc, 

[PATCH] D76791: [Matrix] Implement matrix index expressions ([][]).

2020-05-08 Thread Florian Hahn via Phabricator via cfe-commits
fhahn updated this revision to Diff 262893.
fhahn added a comment.

Rebase on top of the latest version of D72281 
. Refactor code to re-use new address 
conversion helper.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76791

Files:
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/BuiltinTypes.def
  clang/include/clang/AST/Expr.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Serialization/ASTBitCodes.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/Expr.cpp
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/NSAPI.cpp
  clang/lib/AST/Type.cpp
  clang/lib/AST/TypeLoc.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGValue.h
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Serialization/ASTCommon.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/test/CodeGen/matrix-type-operators.c
  clang/test/CodeGenCXX/matrix-type-operators.cpp
  clang/test/Sema/matrix-type-operators.c
  clang/test/SemaCXX/matrix-type-operators.cpp

Index: clang/test/SemaCXX/matrix-type-operators.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/matrix-type-operators.cpp
@@ -0,0 +1,68 @@
+// RUN: %clang_cc1 %s -fenable-matrix -pedantic -std=c++11 -verify -triple=x86_64-apple-darwin9
+
+typedef float sx5x10_t __attribute__((matrix_type(5, 10)));
+
+void insert(sx5x10_t a, float f) {
+  // Non integer indexes.
+  a[3][f] = 0;
+  // expected-error@-1 {{matrix column index is not an integer}}
+  a[f][9] = 0;
+  // expected-error@-1 {{matrix row index is not an integer}}
+  a[f][f] = 0;
+  // expected-error@-1 {{matrix row index is not an integer}}
+
+  // Invalid element type.
+  a[3][4] = 
+  // expected-error@-1 {{assigning to 'float' from incompatible type 'float *'; remove &}}
+
+  // Indexes outside allowed dimensions.
+  a[-1][3] = 10.0;
+  // expected-error@-1 {{matrix row index is outside the allowed range [0, 5)}}
+  a[3][-1] = 10.0;
+  // expected-error@-1 {{matrix column index is outside the allowed range [0, 10)}}
+  a[3][-1u] = 10.0;
+  // expected-error@-1 {{matrix column index is outside the allowed range [0, 10)}}
+  a[-1u][3] = 10.0;
+  // expected-error@-1 {{matrix row index is outside the allowed range [0, 5)}}
+  a[5][2] = 10.0;
+  // expected-error@-1 {{matrix row index is outside the allowed range [0, 5)}}
+  a[4][10] = 10.0;
+  // expected-error@-1 {{matrix column index is outside the allowed range [0, 10)}}
+  a[5][10.0] = f;
+  // expected-error@-1 {{matrix row index is outside the allowed range [0, 5)}}
+}
+
+void extract(sx5x10_t a, float f) {
+  // Non integer indexes.
+  float v1 = a[3][f];
+  // expected-error@-1 {{matrix column index is not an integer}}
+  float v2 = a[f][9];
+  // expected-error@-1 {{matrix row index is not an integer}}
+  float v3 = a[f][f];
+  // expected-error@-1 {{matrix row index is not an integer}}
+
+  // Invalid element type.
+  char *v4 = a[3][4];
+  // expected-error@-1 {{cannot initialize a variable of type 'char *' with an lvalue of type 'float'}}
+
+  // Indexes outside allowed dimensions.
+  float v5 = a[-1][3];
+  // expected-error@-1 {{matrix row index is outside the allowed range [0, 5)}}
+  float v6 = a[3][-1];
+  // expected-error@-1 {{matrix column index is outside the allowed range [0, 10)}}
+  float v8 = a[-1u][3];
+  // expected-error@-1 {{matrix row index is outside the allowed range [0, 5)}}
+  float v9 = a[5][2];
+  // expected-error@-1 {{matrix row index is outside the allowed range [0, 5)}}
+  float v10 = a[4][10];
+  // expected-error@-1 {{matrix column index is outside the allowed range [0, 10)}}
+  float v11 = a[5][10.0];
+  // expected-error@-1 {{matrix row index is outside the allowed range [0, 5)}}
+}
+
+void incomplete_matrix_index_expr(sx5x10_t a, float f) {
+  float x = a[3];
+  // expected-error@-1 {{single subscript expressions are not allowed for matrix values}}
+  a[2] = f;
+  // expected-error@-1 {{single subscript expressions are not allowed for matrix values}}
+}
Index: clang/test/Sema/matrix-type-operators.c
===
--- /dev/null
+++ clang/test/Sema/matrix-type-operators.c
@@ -0,0 +1,67 @@
+// RUN: %clang_cc1 %s -fenable-matrix -pedantic -verify -triple=x86_64-apple-darwin9
+
+typedef float sx5x10_t __attribute__((matrix_type(5, 10)));
+
+void insert(sx5x10_t a, float f) {
+  // Non integer indexes.
+  a[3][f] = 0;
+  // expected-error@-1 {{matrix column index is not an integer}}
+  a[f][9] = 0;
+  // expected-error@-1 {{matrix row index is not an integer}}
+  a[f][f] = 0;
+  // expected-error@-1 {{matrix row index is not an integer}}
+
+  // Invalid element type.
+  a[3][4] = 
+  // expected-error@-1 {{assigning to 'float' from incompatible type 'float *'; remove &}}
+
+  // Indexes outside allowed dimensions.
+  a[-1][3] = 10.0;
+  // expected-error@-1 {{matrix row index 

[clang] 51d938b - Fix bugs when an included file name is typo corrected.

2020-05-08 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2020-05-08T13:33:39-04:00
New Revision: 51d938bc94433b03cfbe60758642dbe70269ae3b

URL: 
https://github.com/llvm/llvm-project/commit/51d938bc94433b03cfbe60758642dbe70269ae3b
DIFF: 
https://github.com/llvm/llvm-project/commit/51d938bc94433b03cfbe60758642dbe70269ae3b.diff

LOG: Fix bugs when an included file name is typo corrected.

D52774 fixed a bug with typo correction of includes, but didn't add
a test.

D65907 then broke recovery of typo correction of includes again,
because it extracted the code that writes to Filename to a separate
function that took the parameter not by reference.

Fix that, and also don't repeat the slash normalization computation
and fix both lookup and regular file name after recovery.

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

Added: 


Modified: 
clang/include/clang/Lex/Preprocessor.h
clang/lib/Lex/PPDirectives.cpp
clang/test/Lexer/case-insensitive-include-pr31836.sh
clang/test/Lexer/case-insensitive-include-win.c

Removed: 




diff  --git a/clang/include/clang/Lex/Preprocessor.h 
b/clang/include/clang/Lex/Preprocessor.h
index 7d358bded6e7..5cd017fa925f 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -2242,11 +2242,11 @@ class Preprocessor {
   };
 
   Optional LookupHeaderIncludeOrImport(
-  const DirectoryLookup *, StringRef Filename,
+  const DirectoryLookup *, StringRef ,
   SourceLocation FilenameLoc, CharSourceRange FilenameRange,
   const Token , bool , bool IsImportDecl,
   bool , const DirectoryLookup *LookupFrom,
-  const FileEntry *LookupFromFile, StringRef LookupFilename,
+  const FileEntry *LookupFromFile, StringRef ,
   SmallVectorImpl , SmallVectorImpl ,
   ModuleMap::KnownHeader , bool isAngled);
 

diff  --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 84c13b286e68..db249126d393 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -1716,11 +1716,11 @@ void 
Preprocessor::HandleIncludeDirective(SourceLocation HashLoc,
 }
 
 Optional Preprocessor::LookupHeaderIncludeOrImport(
-const DirectoryLookup *, StringRef Filename,
+const DirectoryLookup *, StringRef& Filename,
 SourceLocation FilenameLoc, CharSourceRange FilenameRange,
 const Token , bool , bool IsImportDecl,
 bool , const DirectoryLookup *LookupFrom,
-const FileEntry *LookupFromFile, StringRef LookupFilename,
+const FileEntry *LookupFromFile, StringRef& LookupFilename,
 SmallVectorImpl , SmallVectorImpl ,
 ModuleMap::KnownHeader , bool isAngled) {
   Optional File = LookupFile(
@@ -1789,21 +1789,10 @@ Optional 
Preprocessor::LookupHeaderIncludeOrImport(
   return Filename;
 };
 StringRef TypoCorrectionName = CorrectTypoFilename(Filename);
-
-#ifndef _WIN32
-// Normalize slashes when compiling with -fms-extensions on non-Windows.
-// This is unnecessary on Windows since the filesystem there handles
-// backslashes.
-SmallString<128> NormalizedTypoCorrectionPath;
-if (LangOpts.MicrosoftExt) {
-  NormalizedTypoCorrectionPath = TypoCorrectionName;
-  llvm::sys::path::native(NormalizedTypoCorrectionPath);
-  TypoCorrectionName = NormalizedTypoCorrectionPath;
-}
-#endif
+StringRef TypoCorrectionLookupName = CorrectTypoFilename(LookupFilename);
 
 Optional File = LookupFile(
-FilenameLoc, TypoCorrectionName, isAngled, LookupFrom, LookupFromFile,
+FilenameLoc, TypoCorrectionLookupName, isAngled, LookupFrom, 
LookupFromFile,
 CurDir, Callbacks ?  : nullptr,
 Callbacks ?  : nullptr, , ,
 /*IsFrameworkFound=*/nullptr);
@@ -1818,6 +1807,7 @@ Optional 
Preprocessor::LookupHeaderIncludeOrImport(
   // We found the file, so set the Filename to the name after typo
   // correction.
   Filename = TypoCorrectionName;
+  LookupFilename = TypoCorrectionLookupName;
   return File;
 }
   }
@@ -2074,8 +2064,6 @@ Preprocessor::ImportAction 
Preprocessor::HandleHeaderIncludeOrImport(
   if (Callbacks && !IsImportDecl) {
 // Notify the callback object that we've seen an inclusion directive.
 // FIXME: Use a 
diff erent callback for a pp-import?
-// FIXME: Passes wrong filename if LookupHeaderIncludeOrImport() did
-// typo correction.
 Callbacks->InclusionDirective(
 HashLoc, IncludeTok, LookupFilename, isAngled, FilenameRange,
 File ? >getFileEntry() : nullptr, SearchPath, RelativePath,
@@ -2102,7 +2090,6 @@ Preprocessor::ImportAction 
Preprocessor::HandleHeaderIncludeOrImport(
   !IsMapped && !File->getFileEntry().tryGetRealPathName().empty();
 
   if (CheckIncludePathPortability) {
-// FIXME: Looks at the wrong filename if we did typo correction.
 StringRef Name = LookupFilename;
 StringRef NameWithoriginalSlashes = Filename;
 #if 

[PATCH] D41720: [clang-tidy] Add a -show-color flag.

2020-05-08 Thread Leo via Phabricator via cfe-commits
leoleoasd added a comment.

Any update on this?


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

https://reviews.llvm.org/D41720



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


[PATCH] D74387: [SYCL] Defer __float128 type usage diagnostics

2020-05-08 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

In D74387#2026844 , @Fznamznon wrote:

> I'm not sure that I've discovered all examples and problems, but I have a 
> couple of ones. I started with adapting current implementation for OpenMP and 
> right now I'm analyzing corresponding OpenMP test fails (i.e. 
> `clang/test/OpenMP/nvptx_unsupported_type_messages.cpp` and 
> `clang/test/OpenMP/nvptx_unsupported_type_codegen.cpp`). There are a lot of 
> differences between the old approach and new one, which I'm working on. The 
> new diagnostic triggers more errors than the old one, so I'd like to 
> understand in which concrete cases we shouldn't emit diagnostic. For example 
> you mentioned that memcopy-like operations should be ok in device code.


You can reach me here or via email to discuss more. We also can do it over 
openmp-dev if you like :)

> Right now the current implementation of the diagnostic also emits errors for 
> sample like this:
> 
>   struct T {
> char a;
> __float128 f;
> char c;
>   };
>   
>   #pragma omp declare target
>   T a;
>   T b = a; // The diagnostic is triggered here, because implicit copy 
> constructor uses unavailable field
>   #pragma omp end declare target
>   
> 
> 
> Should we emit errors in such case too?

Preferably, I would allow the above case, or in general trivial copies of 
unavailable basic types. What I would like to happen is that we memcpy the 
unavailable field.
I guess if we could "simply" replace the unavailable types in the device code 
right away with the byte array replacement, most things should fall into place. 
Basically,
we could provide even provide the replacements in a header that we include 
automatically:

`clang/lib/Headers/OpenMP/typedefs.h`:

  #ifdef __DEFINE_FLOAT128__
  typedef char __float128[__FLOAT128_SIZE__] alignas(__FLOAT128_ALIGNMENT__);
  
  #undef __DEFINE_FLOAT128__
  #undef __FLOAT128_SIZE__
  #undef __FLOAT128_ALIGNMENT__
  #endif

Now copy constructors (and other "OK" uses) should work fine. If people use the 
member in anything that actually doesn't work on a char array, they get a 
(probably ugly) error.
Preferably we would intercept the diagnose messages or at least issue a note if 
we see __float128 used, maybe along the lines of:

  Note: The target does not support operations on `__float128` types. Values of 
this type are consequently represented by character arrays of appropriate size 
and alignment.




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74387



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


[PATCH] D79477: [clang-tidy] Add --use-color command line option and UseColor option to control colors in diagnostics

2020-05-08 Thread hyd-dev via Phabricator via cfe-commits
hyd-dev updated this revision to Diff 262887.
hyd-dev marked an inline comment as done.
hyd-dev added a comment.

Change incorrect `detect` to `detected` in the comment of `UseColor` option.


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

https://reviews.llvm.org/D79477

Files:
  clang-tools-extra/clang-tidy/ClangTidy.cpp
  clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
  clang-tools-extra/clang-tidy/ClangTidyOptions.h
  clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
  clang-tools-extra/test/clang-tidy/infrastructure/use-color.cpp
  clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp

Index: clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
===
--- clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
+++ clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
@@ -76,6 +76,7 @@
   User: user1
   ExtraArgs: ['arg1', 'arg2']
   ExtraArgsBefore: ['arg-before1', 'arg-before2']
+  UseColor: false
   )");
   ASSERT_TRUE(!!Options1);
   llvm::ErrorOr Options2 = parseConfiguration(R"(
@@ -85,6 +86,7 @@
   User: user2
   ExtraArgs: ['arg3', 'arg4']
   ExtraArgsBefore: ['arg-before3', 'arg-before4']
+  UseColor: true
   )");
   ASSERT_TRUE(!!Options2);
   ClangTidyOptions Options = Options1->mergeWith(*Options2, 0);
@@ -98,6 +100,8 @@
   EXPECT_EQ("arg-before1,arg-before2,arg-before3,arg-before4",
 llvm::join(Options.ExtraArgsBefore->begin(),
Options.ExtraArgsBefore->end(), ","));
+  ASSERT_TRUE(Options.UseColor.hasValue());
+  EXPECT_TRUE(*Options.UseColor);
 }
 
 class TestCheck : public ClangTidyCheck {
Index: clang-tools-extra/test/clang-tidy/infrastructure/use-color.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/infrastructure/use-color.cpp
@@ -0,0 +1,28 @@
+// RUN: clang-tidy -dump-config | FileCheck %s
+// RUN: clang-tidy -dump-config -use-color | FileCheck -check-prefix=CHECK-CONFIG-COLOR %s
+// RUN: clang-tidy -dump-config -use-color=false | FileCheck -check-prefix=CHECK-CONFIG-NO-COLOR %s
+// RUN: clang-tidy -config='UseColor: true' -dump-config | FileCheck -check-prefix=CHECK-CONFIG-COLOR %s
+// RUN: clang-tidy -config='UseColor: false' -dump-config | FileCheck -check-prefix=CHECK-CONFIG-NO-COLOR %s
+// RUN: clang-tidy -help | FileCheck -check-prefix=CHECK-OPT-PRESENT %s
+
+// REQUIRES: ansi-escape-sequences
+// RUN: clang-tidy -checks='-*, modernize-use-override' -extra-arg=-std=c++11 -use-color=false %s | FileCheck -check-prefix=CHECK-NO-COLOR %s
+// RUN: clang-tidy -checks='-*, modernize-use-override' -extra-arg=-std=c++11 %s | FileCheck -check-prefix=CHECK-NO-COLOR %s
+// RUN: clang-tidy -checks='-*, modernize-use-override' -extra-arg=-std=c++11 -use-color %s | FileCheck -check-prefix=CHECK-COLOR %s
+
+// CHECK-NOT: UseColor
+// CHECK-CONFIG-NO-COLOR: UseColor: false
+// CHECK-CONFIG-COLOR: UseColor: true
+// CHECK-OPT-PRESENT: --use-color
+
+class Base {
+public:
+  virtual ~Base() = 0;
+};
+
+class Delivered : public Base {
+public:
+  virtual ~Delivered() = default;
+  // CHECK-NO-COLOR: warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [modernize-use-override]
+  // CHECK-COLOR: {{.\[0;1;35m}}warning: {{.\[0m}}{{.\[1m}}prefer using 'override' or (rarely) 'final' instead of 'virtual' [modernize-use-override]
+};
Index: clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
===
--- clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
+++ clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
@@ -229,6 +229,15 @@
cl::value_desc("filename"),
cl::cat(ClangTidyCategory));
 
+static cl::opt UseColor("use-color", cl::desc(R"(
+Use colors in diagnostics. If not set, colors
+will be used if the terminal connected to
+standard output supports colors.
+This option overrides the 'UseColor' option in
+.clang-tidy file, if any.
+)"),
+  cl::init(false), cl::cat(ClangTidyCategory));
+
 namespace clang {
 namespace tidy {
 
@@ -291,6 +300,8 @@
 OverrideOptions.SystemHeaders = SystemHeaders;
   if (FormatStyle.getNumOccurrences() > 0)
 OverrideOptions.FormatStyle = FormatStyle;
+  if (UseColor.getNumOccurrences() > 0)
+OverrideOptions.UseColor = UseColor;
 
   if (!Config.empty()) {
 if (llvm::ErrorOr ParsedConfig =
Index: clang-tools-extra/clang-tidy/ClangTidyOptions.h
===
--- clang-tools-extra/clang-tidy/ClangTidyOptions.h
+++ clang-tools-extra/clang-tidy/ClangTidyOptions.h
@@ -126,6 +126,9 @@
   /// apply this config file on top of the parent one. If false or missing,
   /// only this configuration file will be used.
   llvm::Optional InheritParentConfig;
+
+  /// Use 

[clang-tools-extra] e20fcf0 - Unbreak clang-tidy tests after D79599 / e9b4113902850.

2020-05-08 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2020-05-08T12:37:33-04:00
New Revision: e20fcf0504e598c4f9f6ee77ca56d7431f9194c3

URL: 
https://github.com/llvm/llvm-project/commit/e20fcf0504e598c4f9f6ee77ca56d7431f9194c3
DIFF: 
https://github.com/llvm/llvm-project/commit/e20fcf0504e598c4f9f6ee77ca56d7431f9194c3.diff

LOG: Unbreak clang-tidy tests after D79599 / e9b4113902850.

Added: 
llvm/utils/gn/secondary/clang/tools/libclang/include_clang_tools_extra.gni

Modified: 
clang-tools-extra/test/CMakeLists.txt
clang-tools-extra/test/clang-tidy/infrastructure/basic.cpp
clang-tools-extra/test/clang-tidy/infrastructure/nolint-plugin.cpp
clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline-plugin.cpp
clang-tools-extra/test/lit.site.cfg.py.in
llvm/utils/gn/secondary/clang-tools-extra/test/BUILD.gn
llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn

Removed: 




diff  --git a/clang-tools-extra/test/CMakeLists.txt 
b/clang-tools-extra/test/CMakeLists.txt
index a2cedeaaa53a..60217b8c50cd 100644
--- a/clang-tools-extra/test/CMakeLists.txt
+++ b/clang-tools-extra/test/CMakeLists.txt
@@ -15,7 +15,10 @@ endif ()
 
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR 
${LLVM_RUNTIME_OUTPUT_INTDIR})
 
-llvm_canonicalize_cmake_booleans(CLANG_ENABLE_STATIC_ANALYZER)
+llvm_canonicalize_cmake_booleans(
+  CLANG_ENABLE_STATIC_ANALYZER
+  LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA
+  )
 
 configure_lit_site_cfg(
   ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
@@ -58,8 +61,6 @@ set(CLANG_TOOLS_TEST_DEPS
   # Unit tests
   ExtraToolsUnitTests
 
-  # For the clang-tidy libclang integration test.
-  c-index-test
   # clang-tidy tests require it.
   clang-resource-headers
 
@@ -67,6 +68,10 @@ set(CLANG_TOOLS_TEST_DEPS
   # Clang-tidy tests need clang for building modules.
   clang
 )
+if (LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA)
+  # For the clang-tidy libclang integration test.
+  set(CLANG_TOOLS_TEST_DEPS ${CLANG_TOOLS_TEST_DEPS} "c-index-test")
+endif ()
 
 # Add lit test dependencies.
 set(LLVM_UTILS_DEPS

diff  --git a/clang-tools-extra/test/clang-tidy/infrastructure/basic.cpp 
b/clang-tools-extra/test/clang-tidy/infrastructure/basic.cpp
index 12eb6febbacf..e57350289c25 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/basic.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/basic.cpp
@@ -1,5 +1,4 @@
 // RUN: clang-tidy %s -checks='-*,llvm-namespace-comment' -- | FileCheck %s
-// RUN: c-index-test -test-load-source-reparse 2 all %s -Xclang -add-plugin 
-Xclang clang-tidy -Xclang -plugin-arg-clang-tidy -Xclang 
-checks='-*,llvm-namespace-comment' 2>&1 | FileCheck %s
 
 namespace i {
 }

diff  --git 
a/clang-tools-extra/test/clang-tidy/infrastructure/nolint-plugin.cpp 
b/clang-tools-extra/test/clang-tidy/infrastructure/nolint-plugin.cpp
index 671c350828b2..d10c16620749 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/nolint-plugin.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/nolint-plugin.cpp
@@ -1,4 +1,4 @@
-// REQUIRES: static-analyzer
+// REQUIRES: static-analyzer, libclang_include_clang_tools_extra
 // RUN: c-index-test -test-load-source-reparse 2 all %s -Xclang -add-plugin 
-Xclang clang-tidy -Xclang -plugin-arg-clang-tidy -Xclang 
-checks='-*,google-explicit-constructor,clang-diagnostic-unused-variable,clang-analyzer-core.UndefinedBinaryOperatorResult'
 -Wunused-variable -I%S/Inputs/nolint 2>&1 | FileCheck %s
 
 #include "trigger_warning.h"

diff  --git 
a/clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline-plugin.cpp 
b/clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline-plugin.cpp
index 0c84b9340aa3..4835f4c52a45 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline-plugin.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline-plugin.cpp
@@ -1,3 +1,4 @@
+// REQUIRES: libclang_include_clang_tools_extra
 // RUN: c-index-test -test-load-source-reparse 2 all %s -Xclang -add-plugin 
-Xclang clang-tidy -Xclang -plugin-arg-clang-tidy -Xclang 
-checks='-*,google-explicit-constructor' 2>&1 | FileCheck %s
 
 class A { A(int i); };

diff  --git a/clang-tools-extra/test/lit.site.cfg.py.in 
b/clang-tools-extra/test/lit.site.cfg.py.in
index 5dc112a56126..31ce2eaa27d0 100644
--- a/clang-tools-extra/test/lit.site.cfg.py.in
+++ b/clang-tools-extra/test/lit.site.cfg.py.in
@@ -11,6 +11,7 @@ config.clang_libs_dir = "@SHLIBDIR@"
 config.python_executable = "@Python3_EXECUTABLE@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
+config.libclang_include_clang_tools_extra = 
@LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA@
 
 # Support substitution of the tools and libs dirs with user parameters. This is
 # used when we can't determine the tool dir at configuration time.

diff  --git a/llvm/utils/gn/secondary/clang-tools-extra/test/BUILD.gn 

[PATCH] D79599: Add a flag that controls if clang-tidy and clang-include-fixer are built into libclang.

2020-05-08 Thread Nico Weber via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
thakis marked an inline comment as done.
Closed by commit rGe9b411390285: Add a flag that controls if clang-tidy and 
clang-include-fixer are built into… (authored by thakis).
Herald added a project: clang.

Changed prior to commit:
  https://reviews.llvm.org/D79599?vs=262758=262885#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79599

Files:
  clang/docs/ReleaseNotes.rst
  clang/tools/libclang/CMakeLists.txt
  llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn


Index: llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
===
--- llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
+++ llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
@@ -9,6 +9,11 @@
 #   in the CMake build), so libclang is always a static library on linux
 # - the GN build doesn't have LIBCLANG_BUILD_STATIC
 
+declare_args() {
+  # Whether to include code from clang-tools-extra in libclang.
+  libclang_include_clang_tools_extra = false
+}
+
 libclang_target_type = "shared_library"
 if (host_os != "win" && host_os != "mac") {
   # ELF targets need -fPIC to build shared libs but they aren't on by default.
@@ -41,9 +46,7 @@
 
   # FIXME: Once the GN build has a way to select which bits to build,
   # only include this dependency if clang-tools-extra is part of the build.
-  # FIXME: libclang depending on anything in clang-tools-extra seems like
-  # a layering violation.
-  if (true) {
+  if (libclang_include_clang_tools_extra) {
 defines += [ "CLANG_TOOL_EXTRA_BUILD" ]
 deps += [
   "//clang-tools-extra/clang-include-fixer/plugin",
Index: clang/tools/libclang/CMakeLists.txt
===
--- clang/tools/libclang/CMakeLists.txt
+++ clang/tools/libclang/CMakeLists.txt
@@ -50,13 +50,20 @@
   list(APPEND LIBS clangARCMigrate)
 endif ()
 
-if (TARGET clangTidyPlugin)
-  add_definitions(-DCLANG_TOOL_EXTRA_BUILD)
-  list(APPEND LIBS clangTidyPlugin)
-  list(APPEND LIBS clangIncludeFixerPlugin)
-  if(LLVM_ENABLE_MODULES)
-list(APPEND LLVM_COMPILE_FLAGS 
"-fmodules-ignore-macro=CLANG_TOOL_EXTRA_BUILD")
-  endif()
+option(LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA
+  "Include code from clang-tools-extra in libclang." OFF)
+
+if (LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA)
+  if (TARGET clangTidyPlugin)
+add_definitions(-DCLANG_TOOL_EXTRA_BUILD)
+list(APPEND LIBS clangTidyPlugin)
+list(APPEND LIBS clangIncludeFixerPlugin)
+if(LLVM_ENABLE_MODULES)
+  list(APPEND LLVM_COMPILE_FLAGS 
"-fmodules-ignore-macro=CLANG_TOOL_EXTRA_BUILD")
+endif()
+  else ()
+message(FATAL_ERROR "LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA needs 
clang-tools-extra in LLVM_ENABLE_PROJECTS")
+  endif ()
 endif ()
 
 find_library(DL_LIBRARY_PATH dl)
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -240,7 +240,11 @@
 These are major changes to the build system that have happened since the 10.0.0
 release of Clang. Users of the build system should adjust accordingly.
 
-- ...
+- clang-tidy and clang-include-fixer are no longer compiled into libclang by
+  default. You can set ``LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA=ON`` to undo that,
+  but it's expected that that setting will go away eventually. If this is
+  something you need, please reach out to the mailing list to discuss possible
+  ways forward.
 
 AST Matchers
 


Index: llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
===
--- llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
+++ llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
@@ -9,6 +9,11 @@
 #   in the CMake build), so libclang is always a static library on linux
 # - the GN build doesn't have LIBCLANG_BUILD_STATIC
 
+declare_args() {
+  # Whether to include code from clang-tools-extra in libclang.
+  libclang_include_clang_tools_extra = false
+}
+
 libclang_target_type = "shared_library"
 if (host_os != "win" && host_os != "mac") {
   # ELF targets need -fPIC to build shared libs but they aren't on by default.
@@ -41,9 +46,7 @@
 
   # FIXME: Once the GN build has a way to select which bits to build,
   # only include this dependency if clang-tools-extra is part of the build.
-  # FIXME: libclang depending on anything in clang-tools-extra seems like
-  # a layering violation.
-  if (true) {
+  if (libclang_include_clang_tools_extra) {
 defines += [ "CLANG_TOOL_EXTRA_BUILD" ]
 deps += [
   "//clang-tools-extra/clang-include-fixer/plugin",
Index: clang/tools/libclang/CMakeLists.txt
===
--- clang/tools/libclang/CMakeLists.txt
+++ clang/tools/libclang/CMakeLists.txt
@@ -50,13 +50,20 @@
   

[PATCH] D78124: [analyzer][ObjCGenerics] Don't emit diagnostics under the name core.DynamicTypePropagation

2020-05-08 Thread Balázs Kéri via Phabricator via cfe-commits
balazske accepted this revision.
balazske added a comment.
This revision is now accepted and ready to land.

Did not found problems.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78124



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


[PATCH] D46317: [clang-tidy] New check bugprone-map-subscript-operator-lookup

2020-05-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D46317#2023406 , @khuttun wrote:

> Any comments on this? Is this checker something that could be part of 
> clang-tidy?


Thank you for posting some of the diagnostics found by the check, that was 
really helpful information! I spot-checked ~10 of the issues it reported and 
all of them were false positives. Were you able to find any true positives from 
that list? I think 1200 reports without any true positives indicates that the 
check may be too chatty to include (it may also suggest that `bugprone` is the 
wrong place for the check).


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

https://reviews.llvm.org/D46317



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


[PATCH] D79599: Add a flag that controls if clang-tidy and clang-include-fixer are built into libclang.

2020-05-08 Thread Nico Weber via Phabricator via cfe-commits
thakis marked 2 inline comments as done.
thakis added a comment.

Thanks! Added a release note. I had cc'd everyone who had commented on D55415 
 -- did I miss anyone?




Comment at: clang/tools/libclang/CMakeLists.txt:65
+  else ()
+message(FATAL_ERROR "LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA needs 
clang-tools-extra in LLVM_BUILD_PROJECTS")
+  endif ()

hans wrote:
> Isn't it LLVM_ENABLE_PROJECTS?
Err, yes. Done.


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

https://reviews.llvm.org/D79599



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


[PATCH] D79595: Fix bugs when an included file name is typo corrected.

2020-05-08 Thread Hans Wennborg via Phabricator via cfe-commits
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

lgtm


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

https://reviews.llvm.org/D79595



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


[clang] e9b4113 - Add a flag that controls if clang-tidy and clang-include-fixer are built into libclang.

2020-05-08 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2020-05-08T11:41:45-04:00
New Revision: e9b4113902850667e4e96b0aabe158b87670d051

URL: 
https://github.com/llvm/llvm-project/commit/e9b4113902850667e4e96b0aabe158b87670d051
DIFF: 
https://github.com/llvm/llvm-project/commit/e9b4113902850667e4e96b0aabe158b87670d051.diff

LOG: Add a flag that controls if clang-tidy and clang-include-fixer are built 
into libclang.

Based on the discussion on D55415, also make the flag default to false.
Having libclang depend on clang-tools-extra means check-clang builds all
of clang-tools-extra, which besides being a layering violation takes
quite some time, since clang-tools-extra has many files that are slow
to compile.

Longer term, we likely will want to remove this flag completely. If
people need this functionality, maybe there could be a
libclang-tools-extra that's libclang + clang-tidy and
clang-includes-fixer linked in.

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

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/tools/libclang/CMakeLists.txt
llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index a35c966a8b4f..20d2240a6078 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -240,7 +240,11 @@ Build System Changes
 These are major changes to the build system that have happened since the 10.0.0
 release of Clang. Users of the build system should adjust accordingly.
 
-- ...
+- clang-tidy and clang-include-fixer are no longer compiled into libclang by
+  default. You can set ``LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA=ON`` to undo that,
+  but it's expected that that setting will go away eventually. If this is
+  something you need, please reach out to the mailing list to discuss possible
+  ways forward.
 
 AST Matchers
 

diff  --git a/clang/tools/libclang/CMakeLists.txt 
b/clang/tools/libclang/CMakeLists.txt
index 4f0eec9e6016..ba286b672772 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -50,13 +50,20 @@ if (CLANG_ENABLE_ARCMT)
   list(APPEND LIBS clangARCMigrate)
 endif ()
 
-if (TARGET clangTidyPlugin)
-  add_definitions(-DCLANG_TOOL_EXTRA_BUILD)
-  list(APPEND LIBS clangTidyPlugin)
-  list(APPEND LIBS clangIncludeFixerPlugin)
-  if(LLVM_ENABLE_MODULES)
-list(APPEND LLVM_COMPILE_FLAGS 
"-fmodules-ignore-macro=CLANG_TOOL_EXTRA_BUILD")
-  endif()
+option(LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA
+  "Include code from clang-tools-extra in libclang." OFF)
+
+if (LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA)
+  if (TARGET clangTidyPlugin)
+add_definitions(-DCLANG_TOOL_EXTRA_BUILD)
+list(APPEND LIBS clangTidyPlugin)
+list(APPEND LIBS clangIncludeFixerPlugin)
+if(LLVM_ENABLE_MODULES)
+  list(APPEND LLVM_COMPILE_FLAGS 
"-fmodules-ignore-macro=CLANG_TOOL_EXTRA_BUILD")
+endif()
+  else ()
+message(FATAL_ERROR "LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA needs 
clang-tools-extra in LLVM_ENABLE_PROJECTS")
+  endif ()
 endif ()
 
 find_library(DL_LIBRARY_PATH dl)

diff  --git a/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn 
b/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
index 42f4945cf85c..04c82ebdba29 100644
--- a/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
@@ -9,6 +9,11 @@ import("//llvm/version.gni")
 #   in the CMake build), so libclang is always a static library on linux
 # - the GN build doesn't have LIBCLANG_BUILD_STATIC
 
+declare_args() {
+  # Whether to include code from clang-tools-extra in libclang.
+  libclang_include_clang_tools_extra = false
+}
+
 libclang_target_type = "shared_library"
 if (host_os != "win" && host_os != "mac") {
   # ELF targets need -fPIC to build shared libs but they aren't on by default.
@@ -41,9 +46,7 @@ target(libclang_target_type, "libclang") {
 
   # FIXME: Once the GN build has a way to select which bits to build,
   # only include this dependency if clang-tools-extra is part of the build.
-  # FIXME: libclang depending on anything in clang-tools-extra seems like
-  # a layering violation.
-  if (true) {
+  if (libclang_include_clang_tools_extra) {
 defines += [ "CLANG_TOOL_EXTRA_BUILD" ]
 deps += [
   "//clang-tools-extra/clang-include-fixer/plugin",



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


[PATCH] D73052: [clang-tidy] RenamerClangTidy now renames dependent member expr when the member can be resolved

2020-05-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.h:44
 
+  virtual void storeCheckOptions(ClangTidyOptions::OptionMap ) {}
+

njames93 wrote:
> aaron.ballman wrote:
> > I'd appreciate some comments here explaining when this should be 
> > overridden. I'd also like to understand why we need `storeOptions` and 
> > `storeCheckOptions` because the two names are so similar to one another.
> I'm still unsure what the best approach here is. 
> `RenamerClangTidyCheck::storeOptions` needs to be called to store the 
> `AggressiveDependentMemberLookup` Option (as well as any other renaming 
> specific option that may be added down the line). However derived classes 
> need to also store their respective options at the same time. Due to how c++ 
> works there isn't a nice way to ensure base methods are called at the same 
> time as derived methods.
> Anyway that's the reason the names are similar they do a very similar job 
> only one is meant for the `RenamerClangTidyCheck` class and the other for 
> derived classes.
> I agree a comment is needed to explain why so I'll add that in for now
I think it's reasonable to expect developers to call `Base::storeOptions()` 
from within `Derived::storeOptions()` and we don't need a second method to 
override. You're correct that there's not a good way to ensure the base method 
is called, but test cases should exist for the options in a check and so I 
would imagine that a developer who forgets to call the base class function will 
have failing test cases to help alert them to the issue. WDYT?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73052



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


[PATCH] D78121: [analyzer][DirectIvarAssignment] Turn DirectIvarAssignmentForAnnotatedFunctions into a checker option

2020-05-08 Thread Balázs Kéri via Phabricator via cfe-commits
balazske accepted this revision.
balazske 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/D78121/new/

https://reviews.llvm.org/D78121



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


[PATCH] D79477: [clang-tidy] Add --use-color command line option and UseColor option to control colors in diagnostics

2020-05-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang-tools-extra/clang-tidy/ClangTidyOptions.h:130
+
+  /// Use colors in diagnostics. If missing, colors will be used if standard
+  /// output is connected to a terminal.

hokein wrote:
> nit: ... wil be used if the terminal connected to standard output supports 
> colors, or even simple `if missing, it will be auto detect`.
detect -> detected


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

https://reviews.llvm.org/D79477



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


[PATCH] D72841: Add support for pragma float_control, to control precision and exception behavior at the source level

2020-05-08 Thread Melanie Blower via Phabricator via cfe-commits
mibintc added a comment.

I got a report that this patch was causing a problem with Windows  
header because #pragma float_control should be supported in namespace context.  
I've posted a patch for review here https://reviews.llvm.org/D79631


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72841



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


[PATCH] D79631: #pragma float_control should be permitted at namespace scope

2020-05-08 Thread Melanie Blower via Phabricator via cfe-commits
mibintc created this revision.
mibintc added reviewers: rjmccall, erichkeane.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

I got a  bug report from Intel that https://reviews.llvm.org/D72841 was causing 
a crash on Windows in vs2017  header in /std:c++17 mode, because 
#pragma float_control is used in a namespace. This patch allows float_control 
to be in a namespace. I checked the Microsoft compiler to see if the namespace 
caused the effectiveness of the pragma to be scoped (i.e. a pragma in the 
namespace would not be effective after the namespace closed) and the pragma is 
still effective after the namespace. I added the test case that I used for the 
investigation to the LIT tests. I used this compile line and checked the 
assembly. cl -c test.cpp -Fatest.asm /arch:AVX2 -O2 ; when the pragma is in 
effect the div instruction is not eliminated.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79631

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaAttr.cpp
  clang/test/CodeGen/fp-floatcontrol-pragma.cpp
  clang/test/Parser/fp-floatcontrol-syntax.cpp


Index: clang/test/Parser/fp-floatcontrol-syntax.cpp
===
--- clang/test/Parser/fp-floatcontrol-syntax.cpp
+++ clang/test/Parser/fp-floatcontrol-syntax.cpp
@@ -10,10 +10,10 @@
 #pragma float_control(pop)
 #pragma float_control(precise, on, push)
 void check_stack() {
-#pragma float_control(push)   // expected-error {{can only 
appear at file scope}}
-#pragma float_control(pop)// expected-error {{can only 
appear at file scope}}
-#pragma float_control(precise, on, push)  // expected-error {{can only 
appear at file scope}}
-#pragma float_control(except, on, push)   // expected-error {{can only 
appear at file scope}}
+#pragma float_control(push)   // expected-error {{can only 
appear at file scope or namespace scope}}
+#pragma float_control(pop)// expected-error {{can only 
appear at file scope or namespace scope}}
+#pragma float_control(precise, on, push)  // expected-error {{can only 
appear at file scope or namespace scope}}
+#pragma float_control(except, on, push)   // expected-error {{can only 
appear at file scope or namespace scope}}
 #pragma float_control(except, on, push, junk) // expected-error 
{{float_control is malformed}}
   return;
 }
Index: clang/test/CodeGen/fp-floatcontrol-pragma.cpp
===
--- clang/test/CodeGen/fp-floatcontrol-pragma.cpp
+++ clang/test/CodeGen/fp-floatcontrol-pragma.cpp
@@ -1,3 +1,4 @@
+// RUN: %clang_cc1 -DEXCEPT=1 -fcxx-exceptions -triple x86_64-linux-gnu 
-emit-llvm -o - %s | FileCheck -check-prefix=CHECK-NS %s
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -verify -DFENV_ON=1 -triple x86_64-linux-gnu -emit-llvm -o 
- %s | FileCheck %s
 
@@ -59,3 +60,38 @@
   z = z * z;
 //CHECK: = fmul float
 }
+
+#if EXCEPT
+namespace ns {
+// Check that pragma float_control can appear in namespace.
+#pragma float_control(except, on, push)
+float exc_on(double x, float zero) {
+// CHECK-NS: define {{.*}}exc_on{{.*}}
+  {} try {
+x = 1.0 / zero; /* division by zero, the result unused */
+//CHECK-NS: llvm.experimental.constrained.fdiv{{.*}}
+  } catch (...) {}
+  return zero;
+}
+}
+
+// Check pragma is still effective after namespace closes
+float exc_still_on(double x, float zero) {
+// CHECK-NS: define {{.*}}exc_still_on{{.*}}
+  {} try {
+x = 1.0 / zero; /* division by zero, the result unused */
+//CHECK-NS: llvm.experimental.constrained.fdiv{{.*}}
+  } catch (...) {}
+  return zero;
+}
+
+#pragma float_control(pop)
+float exc_off(double x, float zero) {
+// CHECK-NS: define {{.*}}exc_off{{.*}}
+  {} try {
+x = 1.0 / zero; /* division by zero, the result unused */
+//CHECK-NS: fdiv contract double
+  } catch (...) {}
+  return zero;
+}
+#endif // EXCEPT
Index: clang/lib/Sema/SemaAttr.cpp
===
--- clang/lib/Sema/SemaAttr.cpp
+++ clang/lib/Sema/SemaAttr.cpp
@@ -413,8 +413,8 @@
   auto NewValue = FpPragmaStack.CurrentValue;
   FPOptions NewFPFeatures(NewValue);
   if ((Action == PSK_Push_Set || Action == PSK_Push || Action == PSK_Pop) &&
-  !CurContext->isTranslationUnit()) {
-// Push and pop can only occur at file scope.
+  !(CurContext->isTranslationUnit()) && !CurContext->isNamespace()) {
+// Push and pop can only occur at file or namespace scope.
 Diag(Loc, diag::err_pragma_fc_pp_scope);
 return;
   }
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -860,7 +860,7 @@
 def warn_pragma_pop_failed : Warning<"#pragma 

[PATCH] D79035: [clang][AIX] Implement ABIInfo and TargetCodeGenInfo for AIX

2020-05-08 Thread Jason Liu via Phabricator via cfe-commits
jasonliu updated this revision to Diff 262878.

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

https://reviews.llvm.org/D79035

Files:
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGen/aix-complex.c
  clang/test/CodeGen/aix-return.c
  clang/test/CodeGen/aix-struct-arg.c
  clang/test/CodeGen/aix-vaargs.c
  clang/test/CodeGen/aix-vector.c
  clang/test/CodeGen/ppc32-and-aix-struct-return.c
  clang/test/CodeGen/ppc32-dwarf.c
  clang/test/CodeGen/ppc32-struct-return.c
  clang/test/CodeGen/ppc64-dwarf.c
  clang/test/Driver/ppc-unsupported.c

Index: clang/test/Driver/ppc-unsupported.c
===
--- clang/test/Driver/ppc-unsupported.c
+++ clang/test/Driver/ppc-unsupported.c
@@ -7,4 +7,12 @@
 // RUN:   -c %s 2>&1 | FileCheck %s
 // RUN: not %clang -target powerpc64le-unknown-linux -msvr4-struct-return \
 // RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc-unknown-aix -maix-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc-unknown-aix -msvr4-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc64-unknown-aix -maix-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc64-unknown-aix -msvr4-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
 // CHECK: unsupported option
Index: clang/test/CodeGen/ppc64-dwarf.c
===
--- clang/test/CodeGen/ppc64-dwarf.c
+++ clang/test/CodeGen/ppc64-dwarf.c
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-aix -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,PPC64
 static unsigned char dwarf_reg_size_table[1024];
 
 int test() {
@@ -119,10 +120,10 @@
 // CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 108), align 1
 // CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 109), align 1
 // CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 110), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 111), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 112), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 113), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 114), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 115), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 116), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 111), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 112), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 113), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 114), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 115), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 116), align 1
 // CHECK-NEXT: ret i32 1
Index: clang/test/CodeGen/ppc32-struct-return.c
===
--- clang/test/CodeGen/ppc32-struct-return.c
+++ /dev/null
@@ -1,88 +0,0 @@
-// REQUIRES: powerpc-registered-target
-// RUN: %clang_cc1 -triple powerpc-unknown-freebsd \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
-// RUN: %clang_cc1 -triple powerpc-unknown-linux \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
-// RUN: %clang_cc1 -triple powerpc-unknown-linux -maix-struct-return \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
-// RUN: %clang_cc1 -triple powerpc-unknown-linux -msvr4-struct-return \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
-// RUN: %clang_cc1 -triple powerpc-unknown-netbsd \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
-// RUN: %clang_cc1 -triple powerpc-unknown-openbsd \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4

[PATCH] D79599: Add a flag that controls if clang-tidy and clang-include-fixer are built into libclang.

2020-05-08 Thread Hans Wennborg via Phabricator via cfe-commits
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

Looks very reasonable to be. Maybe worth a release note in case this is 
surprising to any libclang users? And maybe cc the other folks from D55415 
?




Comment at: clang/tools/libclang/CMakeLists.txt:65
+  else ()
+message(FATAL_ERROR "LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA needs 
clang-tools-extra in LLVM_BUILD_PROJECTS")
+  endif ()

Isn't it LLVM_ENABLE_PROJECTS?


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

https://reviews.llvm.org/D79599



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


[PATCH] D78129: Add Marvell ThunderX3T110 support

2020-05-08 Thread Wei Zhao via Phabricator via cfe-commits
wxz2020 added a comment.

I think I made all the changes mentioned in the feedbacks. Please take sometime 
to review the current version. We are eager to get the first thunderx3t110 
checked in.

There are a few things we plan to do after the 1st version:

1. add more tests as suggested in the review
2. make changes to the predicate for clarity and easy readability
3. solve the PA instruction issue

Let me know if there is anything missing. Thanks,


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78129



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


[PATCH] D79160: [AST] Preserve the type in RecoveryExprs for broken function calls.

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



Comment at: clang/test/SemaCXX/enable_if.cpp:417
 
-constexpr int B = 10 + // the carat for the error should be pointing to the 
problematic call (on the next line), not here.
-callTemplated<0>(); // expected-error{{initialized by a constant 
expression}} expected-error@-3{{no matching function for call to 'templated'}} 
expected-note{{in instantiation of function template}} 
expected-note@-10{{candidate disabled}}
+constexpr int B = 10 + // expected-error {{initialized by a constant 
expression}}
+callTemplated<0>(); // expected-error@-3{{no matching function for call to 
'templated'}} expected-note{{in instantiation of function template}} 
expected-note@-10{{candidate disabled}} expected-note {{in call to 
'callTemplated()'}} expected-note@-3 {{subexpression not valid in a constant 
expression}}

hokein wrote:
> sammccall wrote:
> > hokein wrote:
> > > this diagnostic is changed slightly (without `-frecovery-ast-type`). I 
> > > think this is acceptable.
> > > 
> > > before this patch:
> > > 
> > > ```
> > > /tmp/t5.cpp:7:10: error: no matching function for call to 'templated'
> > >   return templated();  // expected-error {{no matching function for 
> > > call to 'templated'}} 
> > >  ^~~~
> > > /tmp/t5.cpp:13:5: note: in instantiation of function template 
> > > specialization 'enable_if_diags::callTemplated<0>' requested here
> > > callTemplated<0>(); // expected-note {{in call to 'callTemplated()'}} 
> > > expected-note@-6 {{subexpression not valid in a constant expression}}
> > > ^
> > > /tmp/t5.cpp:2:32: note: candidate disabled: 
> > > template  constexpr int templated() __attribute__((enable_if(N, 
> > > ""))) {
> > >^~
> > > /tmp/t5.cpp:13:5: error: constexpr variable 'B' must be initialized by a 
> > > constant expression
> > > callTemplated<0>(); // expected-note {{in call to 'callTemplated()'}} 
> > > expected-note@-6 {{subexpression not valid in a constant expression}}
> > > ^~
> > > 2 errors generated.
> > > ```
> > > 
> > > vs after this patch:
> > > 
> > > ```
> > > /tmp/t5.cpp:7:10: error: no matching function for call to 'templated'
> > >   return templated();  // expected-error {{no matching function for 
> > > call to 'templated'}} 
> > >  ^~~~
> > > /tmp/t5.cpp:13:5: note: in instantiation of function template 
> > > specialization 'enable_if_diags::callTemplated<0>' requested here
> > > callTemplated<0>(); // expected-note {{in call to 'callTemplated()'}} 
> > > expected-note@-6 {{subexpression not valid in a constant expression}}
> > > ^
> > > /tmp/t5.cpp:2:32: note: candidate disabled: 
> > > template  constexpr int templated() __attribute__((enable_if(N, 
> > > ""))) {
> > >^~
> > > /tmp/t5.cpp:12:15: error: constexpr variable 'B' must be initialized by a 
> > > constant expression
> > > constexpr int B = 10 +  // expected-error {{constexpr variable 'B' must 
> > > be initialized by a constant expression}}
> > >   ^   
> > > ~~~
> > > /tmp/t5.cpp:7:10: note: subexpression not valid in a constant expression
> > >   return templated();  // expected-error {{no matching function for 
> > > call to 'templated'}} 
> > >  ^
> > > /tmp/t5.cpp:13:5: note: in call to 'callTemplated()'
> > > callTemplated<0>(); // expected-note {{in call to 'callTemplated()'}} 
> > > expected-note@-6 {{subexpression not valid in a constant expression}}
> > > ^
> > > 2 errors generated.
> > > ```
> > > 
> > > 
> > Yeah, this is noisier but seems OK.
> > Can you take a look at the blame for the split-line test and see if there 
> > was any special code to support it that can be cleaned up?
> `git blame` showed 
> https://github.com/llvm/llvm-project/commit/c7d3e609fbf05d1a1236f99efd1e2fd344554f4b,
>  but I didn't see any special code that we need clean up.
actually we don't need this change if we land this patch before the 
enable-recovery-expr patch, defer this change to D78350.



Comment at: clang/test/SemaTemplate/instantiate-function-params.cpp:1
 // RUN: %clang_cc1 -triple i686-unknown-unknown -fsyntax-only -verify %s
 

sammccall wrote:
> hokein wrote:
> > this test is very tricky, and hard for human to understand. It was added to 
> > test clang not crashing.
> > 
> > Different compilers (gcc, msvc) emit different diagnostics, with this 
> > patch, clang emits 3 more errs `no type named 'type'...`, it seems 
> > reasonable, and gcc also emits them.
> Ugh, I remember this test. It's partially reduced from boost IIRC.
the same to this file, defer it to D78350.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  

[PATCH] D78129: Add Marvell ThunderX3T110 support

2020-05-08 Thread Wei Zhao via Phabricator via cfe-commits
wxz2020 updated this revision to Diff 262876.
wxz2020 added a comment.

Removed the PA related instructions from the .md file as suggested.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78129

Files:
  llvm/include/llvm/Support/AArch64TargetParser.def
  llvm/lib/Target/AArch64/AArch64.td
  llvm/lib/Target/AArch64/AArch64SchedThunderX3T110.td
  llvm/lib/Target/AArch64/AArch64Subtarget.cpp
  llvm/lib/Target/AArch64/AArch64Subtarget.h
  llvm/test/CodeGen/AArch64/aarch64-combine-fmul-fsub.mir
  llvm/test/CodeGen/AArch64/cpus.ll
  llvm/test/CodeGen/AArch64/machine-combiner-madd.ll
  llvm/test/CodeGen/AArch64/preferred-function-alignment.ll
  llvm/test/CodeGen/AArch64/remat.ll

Index: llvm/test/CodeGen/AArch64/remat.ll
===
--- llvm/test/CodeGen/AArch64/remat.ll
+++ llvm/test/CodeGen/AArch64/remat.ll
@@ -19,6 +19,7 @@
 ; RUN: llc -mtriple=aarch64-linux-gnuabi -mcpu=thunderx2t99 -o - %s | FileCheck %s
 ; RUN: llc -mtriple=aarch64-linux-gnuabi -mcpu=tsv110 -o - %s | FileCheck %s
 ; RUN: llc -mtriple=aarch64-linux-gnuabi -mattr=+custom-cheap-as-move -o - %s | FileCheck %s
+; RUN: llc -mtriple=aarch64-linux-gnuabi -mcpu=thunderx3t110 -o - %s | FileCheck %s
 
 %X = type { i64, i64, i64 }
 declare void @f(%X*)
Index: llvm/test/CodeGen/AArch64/preferred-function-alignment.ll
===
--- llvm/test/CodeGen/AArch64/preferred-function-alignment.ll
+++ llvm/test/CodeGen/AArch64/preferred-function-alignment.ll
@@ -19,6 +19,7 @@
 ; RUN: llc -mtriple=aarch64-unknown-linux -mcpu=thunderxt83 < %s | FileCheck --check-prefixes=ALIGN3,CHECK %s
 ; RUN: llc -mtriple=aarch64-unknown-linux -mcpu=thunderxt88 < %s | FileCheck --check-prefixes=ALIGN3,CHECK %s
 ; RUN: llc -mtriple=aarch64-unknown-linux -mcpu=thunderx2t99 < %s | FileCheck --check-prefixes=ALIGN3,CHECK %s
+; RUN: llc -mtriple=aarch64-unknown-linux -mcpu=thunderx3t110 < %s | FileCheck --check-prefixes=ALIGN4,CHECK %s
 ; RUN: llc -mtriple=aarch64-unknown-linux -mcpu=exynos-m3 < %s | FileCheck --check-prefixes=ALIGN5,CHECK %s
 
 define void @test() {
Index: llvm/test/CodeGen/AArch64/machine-combiner-madd.ll
===
--- llvm/test/CodeGen/AArch64/machine-combiner-madd.ll
+++ llvm/test/CodeGen/AArch64/machine-combiner-madd.ll
@@ -6,6 +6,7 @@
 ; RUN: llc -mtriple=aarch64-linux-gnu -mcpu=exynos-m3  < %s | FileCheck %s
 ; RUN: llc -mtriple=aarch64-linux-gnu -mcpu=kryo   < %s | FileCheck %s
 ; RUN: llc -mtriple=aarch64-linux-gnu -mcpu=thunderx2t99 < %s | FileCheck %s
+; RUN: llc -mtriple=aarch64-linux-gnu -mcpu=thunderx3t110 < %s | FileCheck %s
 
 ; Make sure that inst-combine fuses the multiply add in the addressing mode of
 ; the load.
Index: llvm/test/CodeGen/AArch64/cpus.ll
===
--- llvm/test/CodeGen/AArch64/cpus.ll
+++ llvm/test/CodeGen/AArch64/cpus.ll
@@ -24,6 +24,7 @@
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=saphira 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=kryo 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=thunderx2t99 2>&1 | FileCheck %s
+; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=thunderx3t110 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=tsv110 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=apple-latest 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=a64fx 2>&1 | FileCheck %s
Index: llvm/test/CodeGen/AArch64/aarch64-combine-fmul-fsub.mir
===
--- llvm/test/CodeGen/AArch64/aarch64-combine-fmul-fsub.mir
+++ llvm/test/CodeGen/AArch64/aarch64-combine-fmul-fsub.mir
@@ -2,6 +2,7 @@
 # RUN: llc -run-pass=machine-combiner -o - -mtriple=aarch64-unknown-linux -mcpu=falkor -enable-unsafe-fp-math %s -machine-combiner-verify-pattern-order=true | FileCheck --check-prefixes=PROFITABLE,ALL %s
 # RUN: llc -run-pass=machine-combiner -o - -mtriple=aarch64-unknown-linux -mcpu=exynos-m3 -enable-unsafe-fp-math -machine-combiner-verify-pattern-order=true %s | FileCheck --check-prefixes=PROFITABLE,ALL %s
 # RUN: llc -run-pass=machine-combiner -o - -mtriple=aarch64-unknown-linux -mcpu=thunderx2t99 -enable-unsafe-fp-math -machine-combiner-verify-pattern-order=true %s | FileCheck --check-prefixes=PROFITABLE,ALL %s
+# RUN: llc -run-pass=machine-combiner -o - -mtriple=aarch64-unknown-linux -mcpu=thunderx3t110 -enable-unsafe-fp-math -machine-combiner-verify-pattern-order=true %s | FileCheck --check-prefixes=PROFITABLE,ALL %s
 #
 name:f1_2s
 registers:
Index: llvm/lib/Target/AArch64/AArch64Subtarget.h
===
--- llvm/lib/Target/AArch64/AArch64Subtarget.h
+++ 

[PATCH] D79629: [Clang][Driver]Pass LLVM options to lld in case of LTO

2020-05-08 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay requested changes to this revision.
MaskRay added a comment.
This revision now requires changes to proceed.

`-mllvm,foobar` is for compilation (.c/.cc -> .o)

`-Wl,-mllvm,foobar` for LTO options. For linking, `-mllvm,foobar` is not used 
and thus warned.




Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:363
+ llvm::sys::path::stem(Linker) == "ld.lld");
+  if (UseLLD) {
 // Tell the linker to load the plugin. This has to come before

This is wrong. The intention is not to pass -plugin when the linker is clearly 
lld. lld does not need -plugin for LTO.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79629



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


[PATCH] D79160: [AST] Preserve the type in RecoveryExprs for broken function calls.

2020-05-08 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 262874.
hokein marked an inline comment as done.
hokein added a comment.

add a missing test file during the rebase.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79160

Files:
  clang/include/clang/AST/Expr.h
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/CC1Options.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ComputeDependence.cpp
  clang/lib/AST/Expr.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/AST/ast-dump-recovery.cpp
  clang/test/CodeCompletion/member-access.cpp
  clang/test/Index/getcursor-recovery.cpp

Index: clang/test/Index/getcursor-recovery.cpp
===
--- clang/test/Index/getcursor-recovery.cpp
+++ clang/test/Index/getcursor-recovery.cpp
@@ -2,15 +2,24 @@
 int foo(int, double);
 int x;
 
-void testTypedRecoveryExpr() {
-  // Inner foo() is a RecoveryExpr, outer foo() is an overloaded call.
-  foo(x, foo(x));
+void testTypedRecoveryExpr1() {
+  // Inner bar() is an unresolved overloaded call, outer foo() is an overloaded call.
+  foo(x, bar(x));
 }
-// RUN: c-index-test -cursor-at=%s:7:3 %s -Xclang -frecovery-ast | FileCheck -check-prefix=OUTER-FOO %s
+// RUN: c-index-test -cursor-at=%s:7:3 %s -Xclang -frecovery-ast -Xclang -frecovery-ast-type | FileCheck -check-prefix=OUTER-FOO %s
 // OUTER-FOO: OverloadedDeclRef=foo[2:5, 1:5]
-// RUN: c-index-test -cursor-at=%s:7:7 %s -Xclang -frecovery-ast | FileCheck -check-prefix=OUTER-X %s
+// RUN: c-index-test -cursor-at=%s:7:7 %s -Xclang -frecovery-ast -Xclang -frecovery-ast-type | FileCheck -check-prefix=OUTER-X %s
 // OUTER-X: DeclRefExpr=x:3:5
-// RUN: c-index-test -cursor-at=%s:7:10 %s -Xclang -frecovery-ast | FileCheck -check-prefix=INNER-FOO %s
-// INNER-FOO: OverloadedDeclRef=foo[2:5, 1:5]
-// RUN: c-index-test -cursor-at=%s:7:14 %s -Xclang -frecovery-ast | FileCheck -check-prefix=INNER-X %s
+// RUN: c-index-test -cursor-at=%s:7:10 %s -Xclang -frecovery-ast -Xclang -frecovery-ast-type | FileCheck -check-prefix=INNER-FOO %s
+// INNER-FOO: OverloadedDeclRef=bar
+// RUN: c-index-test -cursor-at=%s:7:14 %s -Xclang -frecovery-ast -Xclang -frecovery-ast-type | FileCheck -check-prefix=INNER-X %s
 // INNER-X: DeclRefExpr=x:3:5
+
+void testTypedRecoveryExpr2() {
+  // Inner foo() is a RecoveryExpr (with int type), outer foo() is a valid "foo(int, int)" call.
+  foo(x, foo(x));
+}
+// RUN: c-index-test -cursor-at=%s:20:3 %s -Xclang -frecovery-ast -Xclang -frecovery-ast-type | FileCheck -check-prefix=TEST2-OUTER %s
+// TEST2-OUTER: DeclRefExpr=foo:1:5
+// RUN: c-index-test -cursor-at=%s:20:10 %s -Xclang -frecovery-ast -Xclang -frecovery-ast-type | FileCheck -check-prefix=TEST2-INNER %s
+// TEST2-INNER: OverloadedDeclRef=foo[2:5, 1:5]
Index: clang/test/CodeCompletion/member-access.cpp
===
--- clang/test/CodeCompletion/member-access.cpp
+++ clang/test/CodeCompletion/member-access.cpp
@@ -273,3 +273,12 @@
 // RUN: --implicit-check-not="[#char#]operator=("
 // CHECK-OPER: [#int#]operator=(
 
+struct S { int member; };
+S overloaded(int);
+S overloaded(double);
+void foo() {
+  // No overload matches, but we have recovery-expr with the correct type.
+  overloaded().
+}
+// RUN: not %clang_cc1 -fsyntax-only -frecovery-ast -frecovery-ast-type -code-completion-at=%s:281:16 %s -o - | FileCheck -check-prefix=CHECK-RECOVERY %s
+// CHECK-RECOVERY: [#int#]member
Index: clang/test/AST/ast-dump-recovery.cpp
===
--- clang/test/AST/ast-dump-recovery.cpp
+++ clang/test/AST/ast-dump-recovery.cpp
@@ -1,12 +1,13 @@
-// RUN: not %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -fcxx-exceptions -std=gnu++17 -frecovery-ast -ast-dump %s | FileCheck -strict-whitespace %s
+// RUN: not %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -fcxx-exceptions -std=gnu++17 -frecovery-ast -frecovery-ast-type -ast-dump %s | FileCheck -strict-whitespace %s
 // RUN: not %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -fcxx-exceptions -std=gnu++17 -fno-recovery-ast -ast-dump %s | FileCheck --check-prefix=DISABLED -strict-whitespace %s
 
 int some_func(int *);
 
 // CHECK: VarDecl {{.*}} invalid_call
-// CHECK-NEXT:`-RecoveryExpr {{.*}} contains-errors
-// CHECK-NEXT:  |-UnresolvedLookupExpr {{.*}} 'some_func'
-// CHECK-NEXT:  `-IntegerLiteral {{.*}} 123
+// CHECK-NEXT: `-ImplicitCastExpr {{.*}} 'int' contains-errors
+// CHECK-NEXT:  `-RecoveryExpr {{.*}} 'int' contains-errors
+// CHECK-NEXT:|-UnresolvedLookupExpr {{.*}} 'some_func'
+// CHECK-NEXT:`-IntegerLiteral {{.*}} 123
 // DISABLED-NOT: -RecoveryExpr {{.*}} contains-errors
 int invalid_call = some_func(123);
 
@@ -14,14 +15,15 @@
 int 

[PATCH] D79160: [AST] Preserve the type in RecoveryExprs for broken function calls.

2020-05-08 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 262872.
hokein added a comment.

rebase to master (not the D78350 )


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79160

Files:
  clang/include/clang/AST/Expr.h
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/CC1Options.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ComputeDependence.cpp
  clang/lib/AST/Expr.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/AST/ast-dump-recovery.cpp
  clang/test/CodeCompletion/member-access.cpp
  clang/test/Index/getcursor-recovery.cpp

Index: clang/test/Index/getcursor-recovery.cpp
===
--- clang/test/Index/getcursor-recovery.cpp
+++ clang/test/Index/getcursor-recovery.cpp
@@ -2,15 +2,24 @@
 int foo(int, double);
 int x;
 
-void testTypedRecoveryExpr() {
-  // Inner foo() is a RecoveryExpr, outer foo() is an overloaded call.
-  foo(x, foo(x));
+void testTypedRecoveryExpr1() {
+  // Inner bar() is an unresolved overloaded call, outer foo() is an overloaded call.
+  foo(x, bar(x));
 }
-// RUN: c-index-test -cursor-at=%s:7:3 %s -Xclang -frecovery-ast | FileCheck -check-prefix=OUTER-FOO %s
+// RUN: c-index-test -cursor-at=%s:7:3 %s -Xclang -frecovery-ast -Xclang -frecovery-ast-type | FileCheck -check-prefix=OUTER-FOO %s
 // OUTER-FOO: OverloadedDeclRef=foo[2:5, 1:5]
-// RUN: c-index-test -cursor-at=%s:7:7 %s -Xclang -frecovery-ast | FileCheck -check-prefix=OUTER-X %s
+// RUN: c-index-test -cursor-at=%s:7:7 %s -Xclang -frecovery-ast -Xclang -frecovery-ast-type | FileCheck -check-prefix=OUTER-X %s
 // OUTER-X: DeclRefExpr=x:3:5
-// RUN: c-index-test -cursor-at=%s:7:10 %s -Xclang -frecovery-ast | FileCheck -check-prefix=INNER-FOO %s
-// INNER-FOO: OverloadedDeclRef=foo[2:5, 1:5]
-// RUN: c-index-test -cursor-at=%s:7:14 %s -Xclang -frecovery-ast | FileCheck -check-prefix=INNER-X %s
+// RUN: c-index-test -cursor-at=%s:7:10 %s -Xclang -frecovery-ast -Xclang -frecovery-ast-type | FileCheck -check-prefix=INNER-FOO %s
+// INNER-FOO: OverloadedDeclRef=bar
+// RUN: c-index-test -cursor-at=%s:7:14 %s -Xclang -frecovery-ast -Xclang -frecovery-ast-type | FileCheck -check-prefix=INNER-X %s
 // INNER-X: DeclRefExpr=x:3:5
+
+void testTypedRecoveryExpr2() {
+  // Inner foo() is a RecoveryExpr (with int type), outer foo() is a valid "foo(int, int)" call.
+  foo(x, foo(x));
+}
+// RUN: c-index-test -cursor-at=%s:20:3 %s -Xclang -frecovery-ast -Xclang -frecovery-ast-type | FileCheck -check-prefix=TEST2-OUTER %s
+// TEST2-OUTER: DeclRefExpr=foo:1:5
+// RUN: c-index-test -cursor-at=%s:20:10 %s -Xclang -frecovery-ast -Xclang -frecovery-ast-type | FileCheck -check-prefix=TEST2-INNER %s
+// TEST2-INNER: OverloadedDeclRef=foo[2:5, 1:5]
Index: clang/test/CodeCompletion/member-access.cpp
===
--- clang/test/CodeCompletion/member-access.cpp
+++ clang/test/CodeCompletion/member-access.cpp
@@ -273,3 +273,12 @@
 // RUN: --implicit-check-not="[#char#]operator=("
 // CHECK-OPER: [#int#]operator=(
 
+struct S { int member; };
+S overloaded(int);
+S overloaded(double);
+void foo() {
+  // No overload matches, but we have recovery-expr with the correct type.
+  overloaded().
+}
+// RUN: not %clang_cc1 -fsyntax-only -frecovery-ast -frecovery-ast-type -code-completion-at=%s:281:16 %s -o - | FileCheck -check-prefix=CHECK-RECOVERY %s
+// CHECK-RECOVERY: [#int#]member
Index: clang/test/AST/ast-dump-recovery.cpp
===
--- clang/test/AST/ast-dump-recovery.cpp
+++ clang/test/AST/ast-dump-recovery.cpp
@@ -1,12 +1,13 @@
-// RUN: not %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -fcxx-exceptions -std=gnu++17 -frecovery-ast -ast-dump %s | FileCheck -strict-whitespace %s
+// RUN: not %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -fcxx-exceptions -std=gnu++17 -frecovery-ast -frecovery-ast-type -ast-dump %s | FileCheck -strict-whitespace %s
 // RUN: not %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -fcxx-exceptions -std=gnu++17 -fno-recovery-ast -ast-dump %s | FileCheck --check-prefix=DISABLED -strict-whitespace %s
 
 int some_func(int *);
 
 // CHECK: VarDecl {{.*}} invalid_call
-// CHECK-NEXT:`-RecoveryExpr {{.*}} contains-errors
-// CHECK-NEXT:  |-UnresolvedLookupExpr {{.*}} 'some_func'
-// CHECK-NEXT:  `-IntegerLiteral {{.*}} 123
+// CHECK-NEXT: `-ImplicitCastExpr {{.*}} 'int' contains-errors
+// CHECK-NEXT:  `-RecoveryExpr {{.*}} 'int' contains-errors
+// CHECK-NEXT:|-UnresolvedLookupExpr {{.*}} 'some_func'
+// CHECK-NEXT:`-IntegerLiteral {{.*}} 123
 // DISABLED-NOT: -RecoveryExpr {{.*}} contains-errors
 int invalid_call = some_func(123);
 
@@ -14,14 +15,15 @@
 int ambig_func(float);
 
 // CHECK:  

[PATCH] D79629: [Clang][Driver]Pass LLVM options to lld in case of LTO

2020-05-08 Thread bin via Phabricator via cfe-commits
bin.narwal created this revision.
bin.narwal added a reviewer: MaskRay.
bin.narwal added a project: clang.
Herald added subscribers: cfe-commits, dexonsmith, inglorion.

Hi,
When debugging ThinLTO with clang -mllvm -debug-only=function-import -flto=thin 
-fuse-ld=lld ..., it gives me below warning message:
warning: argument unused during compilation: '-mllvm 
-debug-only=function-import' [-Wunused-command-line-argument]

Actually lld already supports passing arguments to llvm using -mllvm, it would 
be easier for debug if driver passes it along to lld.

This simple patch does this.  Note it also silently eats up such options if 
other linkers (ld.bfd, gold) are used.

Any comments?  Thanks


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79629

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp


Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -358,8 +358,9 @@
   ArgStringList , const InputInfo ,
   const InputInfo , bool IsThinLTO) {
   const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath());
-  if (llvm::sys::path::filename(Linker) != "ld.lld" &&
-  llvm::sys::path::stem(Linker) != "ld.lld") {
+  bool UseLLD = (llvm::sys::path::filename(Linker) == "ld.lld" ||
+ llvm::sys::path::stem(Linker) == "ld.lld");
+  if (UseLLD) {
 // Tell the linker to load the plugin. This has to come before
 // AddLinkerInputs as gold requires -plugin to come before any -plugin-opt
 // that -Wl might forward.
@@ -381,6 +382,22 @@
 CmdArgs.push_back(Args.MakeArgString(Plugin));
   }
 
+  // Silence warning for "clang -mllvm ...".
+  for (const Arg *A : Args.filtered(options::OPT_mllvm)) {
+A->claim();
+
+// Pass llvm options to lld.
+if (!UseLLD)
+  continue;
+
+// FIXME: This is now deprecated and should be removed.
+if (StringRef(A->getValue(0)) == "-disable-llvm-optzns") {
+  CmdArgs.push_back("-disable-llvm-optzns");
+} else {
+  A->render(Args, CmdArgs);
+}
+  }
+
   // Try to pass driver level flags relevant to LTO code generation down to
   // the plugin.
 


Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -358,8 +358,9 @@
   ArgStringList , const InputInfo ,
   const InputInfo , bool IsThinLTO) {
   const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath());
-  if (llvm::sys::path::filename(Linker) != "ld.lld" &&
-  llvm::sys::path::stem(Linker) != "ld.lld") {
+  bool UseLLD = (llvm::sys::path::filename(Linker) == "ld.lld" ||
+ llvm::sys::path::stem(Linker) == "ld.lld");
+  if (UseLLD) {
 // Tell the linker to load the plugin. This has to come before
 // AddLinkerInputs as gold requires -plugin to come before any -plugin-opt
 // that -Wl might forward.
@@ -381,6 +382,22 @@
 CmdArgs.push_back(Args.MakeArgString(Plugin));
   }
 
+  // Silence warning for "clang -mllvm ...".
+  for (const Arg *A : Args.filtered(options::OPT_mllvm)) {
+A->claim();
+
+// Pass llvm options to lld.
+if (!UseLLD)
+  continue;
+
+// FIXME: This is now deprecated and should be removed.
+if (StringRef(A->getValue(0)) == "-disable-llvm-optzns") {
+  CmdArgs.push_back("-disable-llvm-optzns");
+} else {
+  A->render(Args, CmdArgs);
+}
+  }
+
   // Try to pass driver level flags relevant to LTO code generation down to
   // the plugin.
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79035: [clang][AIX] Implement ABIInfo and TargetCodeGenInfo for AIX

2020-05-08 Thread Jason Liu via Phabricator via cfe-commits
jasonliu updated this revision to Diff 262869.
jasonliu added a comment.

Address comments.
Add in over aligned structure and structure containing vector type handling for 
argument on AIX.


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

https://reviews.llvm.org/D79035

Files:
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGen/aix-complex.c
  clang/test/CodeGen/aix-return.c
  clang/test/CodeGen/aix-struct-arg.c
  clang/test/CodeGen/aix-vaargs.c
  clang/test/CodeGen/aix-vector.c
  clang/test/CodeGen/ppc32-and-aix-struct-return.c
  clang/test/CodeGen/ppc32-dwarf.c
  clang/test/CodeGen/ppc32-struct-return.c
  clang/test/CodeGen/ppc64-dwarf.c
  clang/test/Driver/ppc-unsupported.c

Index: clang/test/Driver/ppc-unsupported.c
===
--- clang/test/Driver/ppc-unsupported.c
+++ clang/test/Driver/ppc-unsupported.c
@@ -7,4 +7,12 @@
 // RUN:   -c %s 2>&1 | FileCheck %s
 // RUN: not %clang -target powerpc64le-unknown-linux -msvr4-struct-return \
 // RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc-unknown-aix -maix-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc-unknown-aix -msvr4-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc64-unknown-aix -maix-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc64-unknown-aix -msvr4-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
 // CHECK: unsupported option
Index: clang/test/CodeGen/ppc64-dwarf.c
===
--- clang/test/CodeGen/ppc64-dwarf.c
+++ clang/test/CodeGen/ppc64-dwarf.c
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-aix -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,PPC64
 static unsigned char dwarf_reg_size_table[1024];
 
 int test() {
@@ -119,10 +120,10 @@
 // CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 108), align 1
 // CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 109), align 1
 // CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 110), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 111), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 112), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 113), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 114), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 115), align 1
-// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 116), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 111), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 112), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 113), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 114), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 115), align 1
+// PPC64-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i64 0, i64 116), align 1
 // CHECK-NEXT: ret i32 1
Index: clang/test/CodeGen/ppc32-struct-return.c
===
--- clang/test/CodeGen/ppc32-struct-return.c
+++ /dev/null
@@ -1,88 +0,0 @@
-// REQUIRES: powerpc-registered-target
-// RUN: %clang_cc1 -triple powerpc-unknown-freebsd \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
-// RUN: %clang_cc1 -triple powerpc-unknown-linux \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
-// RUN: %clang_cc1 -triple powerpc-unknown-linux -maix-struct-return \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
-// RUN: %clang_cc1 -triple powerpc-unknown-linux -msvr4-struct-return \
-// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
-// RUN: %clang_cc1 -triple powerpc-unknown-netbsd \
-// RUN:   -emit-llvm -o - %s | FileCheck %s 

[PATCH] D79628: [Clang][Driver] Add Bounds and Thread to SupportsCoverage list

2020-05-08 Thread Marco Elver via Phabricator via cfe-commits
melver created this revision.
melver added a reviewer: vitalybuka.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This permits combining -fsanitize-coverage with -fsanitize=bounds or
-fsanitize=thread. Note that, GCC already supports combining these.

Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=45831


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79628

Files:
  clang/lib/Driver/SanitizerArgs.cpp
  clang/test/Driver/fsanitize-coverage.c


Index: clang/test/Driver/fsanitize-coverage.c
===
--- clang/test/Driver/fsanitize-coverage.c
+++ clang/test/Driver/fsanitize-coverage.c
@@ -12,8 +12,10 @@
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=kernel-memory 
-fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=leak 
-fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined 
-fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=bounds 
-fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=bool 
-fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=dataflow 
-fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread 
-fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
 // RUN: %clang -target %itanium_abi_triple -fsanitize=float-divide-by-zero 
-fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
 // RUN: %clang -target x86_64-linux-gnu 
-fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
 // CHECK-SANITIZE-COVERAGE-FUNC: fsanitize-coverage-type=1
Index: clang/lib/Driver/SanitizerArgs.cpp
===
--- clang/lib/Driver/SanitizerArgs.cpp
+++ clang/lib/Driver/SanitizerArgs.cpp
@@ -43,11 +43,12 @@
 SanitizerKind::KernelAddress | SanitizerKind::KernelHWAddress |
 SanitizerKind::MemTag | SanitizerKind::Memory |
 SanitizerKind::KernelMemory | SanitizerKind::Leak |
-SanitizerKind::Undefined | SanitizerKind::Integer |
+SanitizerKind::Undefined | SanitizerKind::Integer | SanitizerKind::Bounds |
 SanitizerKind::ImplicitConversion | SanitizerKind::Nullability |
 SanitizerKind::DataFlow | SanitizerKind::Fuzzer |
 SanitizerKind::FuzzerNoLink | SanitizerKind::FloatDivideByZero |
-SanitizerKind::SafeStack | SanitizerKind::ShadowCallStack;
+SanitizerKind::SafeStack | SanitizerKind::ShadowCallStack |
+SanitizerKind::Thread;
 static const SanitizerMask RecoverableByDefault =
 SanitizerKind::Undefined | SanitizerKind::Integer |
 SanitizerKind::ImplicitConversion | SanitizerKind::Nullability |


Index: clang/test/Driver/fsanitize-coverage.c
===
--- clang/test/Driver/fsanitize-coverage.c
+++ clang/test/Driver/fsanitize-coverage.c
@@ -12,8 +12,10 @@
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=kernel-memory -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=leak -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=bounds -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=bool -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=dataflow -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
 // RUN: %clang -target %itanium_abi_triple -fsanitize=float-divide-by-zero -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
 // RUN: %clang -target x86_64-linux-gnu 

[PATCH] D73052: [clang-tidy] RenamerClangTidy now renames dependent member expr when the member can be resolved

2020-05-08 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 262865.
njames93 added a comment.

- Address nits


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73052

Files:
  clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.h
  clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
  clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
  clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
  clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst
  
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-member-decl-usage.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-member-decl-usage.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-member-decl-usage.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-member-decl-usage.cpp
@@ -1,7 +1,9 @@
 // RUN: %check_clang_tidy %s readability-identifier-naming %t -- \
 // RUN:   -config='{CheckOptions: [ \
 // RUN: {key: readability-identifier-naming.MemberCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.ParameterCase, value: CamelCase} \
+// RUN: {key: readability-identifier-naming.ParameterCase, value: CamelCase}, \
+// RUN: {key: readability-identifier-naming.MethodCase, value: camelBack}, \
+// RUN: {key: readability-identifier-naming.AggressiveDependentMemberLookup, value: 1} \
 // RUN:  ]}' -- -fno-delayed-template-parsing
 
 int set_up(int);
@@ -63,32 +65,23 @@
   // CHECK-FIXES: {{^}}  int getBar2() const { return this->BarBaz; } // comment-9
 };
 
-TempTest x; //force an instantiation
-
-int blah() {
-  return x.getBar2(); // gotta have a reference to the getBar2 so that the
-  // compiler will generate the function and resolve
-  // the DependantScopeMemberExpr
-}
-
 namespace Bug41122 {
 namespace std {
 
 // for this example we aren't bothered about how std::vector is treated
-template  //NOLINT
-class vector { //NOLINT
-public:
-  void push_back(bool); //NOLINT
-  void pop_back(); //NOLINT
-}; //NOLINT
-}; // namespace std
+template// NOLINT
+struct vector { // NOLINT
+  void push_back(bool); // NOLINT
+  void pop_back();  // NOLINT
+};  // NOLINT
+};  // namespace std
 
-class Foo { 
+class Foo {
   std::vector 
   // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: invalid case style for member 'stack' [readability-identifier-naming]
 public:
   Foo(std::vector )
-  // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: invalid case style for parameter 'stack' [readability-identifier-naming]
+  // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: invalid case style for parameter 'stack' [readability-identifier-naming]
   // CHECK-FIXES: {{^}}  Foo(std::vector )
   : stack(stack) {
 // CHECK-FIXES: {{^}}  : Stack(Stack) {
@@ -134,4 +127,92 @@
 void foo() {
   Container container;
 }
-}; // namespace CtorInits
+} // namespace CtorInits
+
+namespace resolved_dependance {
+template 
+struct A0 {
+  int value;
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for member 'value'
+  A0 =(const A0 ) {
+value = Other.value;   // A0
+this->value = Other.value; // A0
+// CHECK-FIXES:  {{^}}Value = Other.Value;   // A0
+// CHECK-FIXES-NEXT: {{^}}this->Value = Other.Value; // A0
+return *this;
+  }
+  void outOfLineReset();
+};
+
+template 
+void A0::outOfLineReset() {
+  this->value -= value; // A0
+  // CHECK-FIXES: {{^}}  this->Value -= Value; // A0
+}
+
+template 
+struct A1 {
+  int value; // A1
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for member 'value'
+  // CHECK-FIXES: {{^}}  int Value; // A1
+  int GetValue() const { return value; } // A1
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for method 'GetValue'
+  // CHECK-FIXES {{^}}  int getValue() const { return Value; } // A1
+  void SetValue(int Value) { this->value = Value; } // A1
+  // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for method 'SetValue'
+  // CHECK-FIXES {{^}}  void setValue(int Value) { this->Value = Value; } // A1
+  A1 =(const A1 ) {
+this->SetValue(Other.GetValue()); // A1
+this->value = Other.value;// A1
+// CHECK-FIXES:  {{^}}this->setValue(Other.getValue()); // A1
+// CHECK-FIXES-NEXT: {{^}}this->Value = Other.Value;// A1
+return *this;
+  }
+  void outOfLineReset();
+};
+
+template 
+void A1::outOfLineReset() {
+  this->value -= value; // A1
+  // CHECK-FIXES: {{^}}  this->Value -= Value; // A1
+}
+
+template 

[PATCH] D79627: [AST] Fix an assertion violation in FieldDecl::getParent.

2020-05-08 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision.
hokein added a reviewer: sammccall.
Herald added subscribers: usaxena95, kadircet, arphaman, jkorous.
Herald added a project: clang.

FieldDecl::getParent assumes that the FiledDecl::getDeclContext returns a
RecordDecl, this is true for C/C++, but not for ObjCIvarDecl:

The Decls hierarchy is like following

FieldDecl <-- ObjCIvarDecl

DeclContext <-- ObjCContainerDecl <-- ObjCInterfaceDecl

  ^
  |- TagDecl <-- RecordDecl

calling getParent() on ObjCIvarDecl will:

1. invoke getDeclContext(), which returns a DeclContext*, which points to an 
ObjCInterfaceDecl;
2. then downcast the "DeclContext" pointer to a RecordDecl*, and we will hit

the "is_a" assertion in llvm::cast (undefined behavior
in release build without assertion enabled);


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79627

Files:
  clang-tools-extra/clangd/Hover.cpp
  clang-tools-extra/clangd/unittests/HoverTests.cpp
  clang/include/clang/AST/Decl.h


Index: clang/include/clang/AST/Decl.h
===
--- clang/include/clang/AST/Decl.h
+++ clang/include/clang/AST/Decl.h
@@ -2920,12 +2920,15 @@
 
   /// Returns the parent of this field declaration, which
   /// is the struct in which this field is defined.
+  ///
+  /// Returns null if this is not a normal class/struct field declaration, e.g.
+  /// ObjCAtDefsFieldDecl, ObjCIvarDecl.
   const RecordDecl *getParent() const {
-return cast(getDeclContext());
+return dyn_cast(getDeclContext());
   }
 
   RecordDecl *getParent() {
-return cast(getDeclContext());
+return dyn_cast(getDeclContext());
   }
 
   SourceRange getSourceRange() const override LLVM_READONLY;
Index: clang-tools-extra/clangd/unittests/HoverTests.cpp
===
--- clang-tools-extra/clangd/unittests/HoverTests.cpp
+++ clang-tools-extra/clangd/unittests/HoverTests.cpp
@@ -1737,6 +1737,19 @@
 HI.Definition = "template <> void foo(const int &)";
 HI.NamespaceScope = "";
   }},
+  {
+  R"cpp(// should not crash
+   @interface ObjC {
+ char [[da^ta]];
+   }@end
+  )cpp",
+  [](HoverInfo ) {
+HI.Name = "data";
+HI.Type = "char";
+HI.Kind = index::SymbolKind::Field;
+HI.NamespaceScope = "ObjC::"; // FIXME: fix it
+HI.Definition = "char data";
+  }},
   };
 
   // Create a tiny index, so tests above can verify documentation is fetched.
@@ -1753,6 +1766,8 @@
 Annotations T(Case.Code);
 TestTU TU = TestTU::withCode(T.code());
 TU.ExtraArgs.push_back("-std=c++17");
+TU.ExtraArgs.push_back("-xobjective-c++");
+
 TU.ExtraArgs.push_back("-Wno-gnu-designator");
 // Types might be different depending on the target triplet, we chose a
 // fixed one to make sure tests passes on different platform.
Index: clang-tools-extra/clangd/Hover.cpp
===
--- clang-tools-extra/clangd/Hover.cpp
+++ clang-tools-extra/clangd/Hover.cpp
@@ -662,7 +662,9 @@
   }
 
   if (const auto *FD = llvm::dyn_cast()) {
-const auto *Record = FD->getParent()->getDefinition();
+const auto *Record = FD->getParent();
+if (Record)
+  Record = Record->getDefinition();
 if (Record && !Record->isDependentType()) {
   uint64_t OffsetBits = Ctx.getFieldOffset(FD);
   if (auto Size = Ctx.getTypeSizeInCharsIfKnown(FD->getType())) {


Index: clang/include/clang/AST/Decl.h
===
--- clang/include/clang/AST/Decl.h
+++ clang/include/clang/AST/Decl.h
@@ -2920,12 +2920,15 @@
 
   /// Returns the parent of this field declaration, which
   /// is the struct in which this field is defined.
+  ///
+  /// Returns null if this is not a normal class/struct field declaration, e.g.
+  /// ObjCAtDefsFieldDecl, ObjCIvarDecl.
   const RecordDecl *getParent() const {
-return cast(getDeclContext());
+return dyn_cast(getDeclContext());
   }
 
   RecordDecl *getParent() {
-return cast(getDeclContext());
+return dyn_cast(getDeclContext());
   }
 
   SourceRange getSourceRange() const override LLVM_READONLY;
Index: clang-tools-extra/clangd/unittests/HoverTests.cpp
===
--- clang-tools-extra/clangd/unittests/HoverTests.cpp
+++ clang-tools-extra/clangd/unittests/HoverTests.cpp
@@ -1737,6 +1737,19 @@
 HI.Definition = "template <> void foo(const int &)";
 HI.NamespaceScope = "";
   }},
+  {
+  R"cpp(// should not crash
+   @interface ObjC {
+ char [[da^ta]];
+   }@end
+  )cpp",
+  [](HoverInfo ) {
+HI.Name = "data";
+HI.Type = "char";
+HI.Kind = index::SymbolKind::Field;
+HI.NamespaceScope = 

[clang-tools-extra] ad811a2 - [clangd] Update the new clangd url, NFC.

2020-05-08 Thread Haojian Wu via cfe-commits

Author: Haojian Wu
Date: 2020-05-08T15:11:44+02:00
New Revision: ad811a27283c6e39d42499d6564f84c224f4d29e

URL: 
https://github.com/llvm/llvm-project/commit/ad811a27283c6e39d42499d6564f84c224f4d29e
DIFF: 
https://github.com/llvm/llvm-project/commit/ad811a27283c6e39d42499d6564f84c224f4d29e.diff

LOG: [clangd] Update the new clangd url, NFC.

Added: 


Modified: 
clang-tools-extra/clangd/tool/ClangdMain.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp 
b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index 575722e232c9..566430167a51 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -482,7 +482,7 @@ int main(int argc, char *argv[]) {
   R"(clangd is a language server that provides IDE-like features to 
editors.
 
 It should be used via an editor plugin rather than invoked directly. For more 
information, see:
-   https://clang.llvm.org/extra/clangd/
+   https://clangd.llvm.org/
https://microsoft.github.io/language-server-protocol/
 
 clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment 
variable.



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


[PATCH] D76083: [clang-tidy] Expand the list of functions in bugprone-unused-return-value

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

In D76083#2026375 , 
@jranieri-grammatech wrote:

> Ping? It sounds like the consensus is to commit this as-is and, if there's a 
> negative fallout for users of clang-tidy, either split out the functions or 
> pare the list down later?


That is my understanding of the consensus position.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76083



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


[PATCH] D79582: [clangd] Fix crash in AddUsing tweak due to non-identifier DeclName

2020-05-08 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8e7bb37dfb00: [clangd] Fix crash in AddUsing tweak due to 
non-identifier DeclName (authored by adamcz, committed by hokein).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79582

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


Index: clang-tools-extra/clangd/unittests/TweakTests.cpp
===
--- clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -2444,6 +2444,7 @@
 public:
   struct st {};
   static void mm() {}
+  cc operator|(const cc& x) const { return x; }
 };
 }
 })cpp";
@@ -2463,6 +2464,9 @@
   // test that we don't crash.
   EXPECT_UNAVAILABLE(Header +
  "template using foo = one::tt;");
+  // Test that we don't crash or misbehave on unnamed DeclRefExpr.
+  EXPECT_UNAVAILABLE(Header +
+ "void fun() { one::two::cc() ^| one::two::cc(); }");
 
   // Check that we do not trigger in header files.
   FileName = "test.h";
Index: clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
===
--- clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
@@ -210,8 +210,10 @@
 return false;
 
   if (auto *D = Node->ASTNode.get()) {
-QualifierToRemove = D->getQualifierLoc();
-Name = D->getDecl()->getName();
+if (auto *II = D->getDecl()->getIdentifier()) {
+  QualifierToRemove = D->getQualifierLoc();
+  Name = II->getName();
+}
   } else if (auto *T = Node->ASTNode.get()) {
 if (auto E = T->getAs()) {
   if (auto *BaseTypeIdentifier =


Index: clang-tools-extra/clangd/unittests/TweakTests.cpp
===
--- clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -2444,6 +2444,7 @@
 public:
   struct st {};
   static void mm() {}
+  cc operator|(const cc& x) const { return x; }
 };
 }
 })cpp";
@@ -2463,6 +2464,9 @@
   // test that we don't crash.
   EXPECT_UNAVAILABLE(Header +
  "template using foo = one::tt;");
+  // Test that we don't crash or misbehave on unnamed DeclRefExpr.
+  EXPECT_UNAVAILABLE(Header +
+ "void fun() { one::two::cc() ^| one::two::cc(); }");
 
   // Check that we do not trigger in header files.
   FileName = "test.h";
Index: clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
===
--- clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
@@ -210,8 +210,10 @@
 return false;
 
   if (auto *D = Node->ASTNode.get()) {
-QualifierToRemove = D->getQualifierLoc();
-Name = D->getDecl()->getName();
+if (auto *II = D->getDecl()->getIdentifier()) {
+  QualifierToRemove = D->getQualifierLoc();
+  Name = II->getName();
+}
   } else if (auto *T = Node->ASTNode.get()) {
 if (auto E = T->getAs()) {
   if (auto *BaseTypeIdentifier =
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] 8e7bb37 - [clangd] Fix crash in AddUsing tweak due to non-identifier DeclName

2020-05-08 Thread Haojian Wu via cfe-commits

Author: Adam Czachorowski
Date: 2020-05-08T14:26:21+02:00
New Revision: 8e7bb37dfb00bddd12cb44b75d57548330d32527

URL: 
https://github.com/llvm/llvm-project/commit/8e7bb37dfb00bddd12cb44b75d57548330d32527
DIFF: 
https://github.com/llvm/llvm-project/commit/8e7bb37dfb00bddd12cb44b75d57548330d32527.diff

LOG: [clangd] Fix crash in AddUsing tweak due to non-identifier DeclName

Patch by Adam Czachorowski!

Reviewers: hokein

Reviewed By: hokein

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

Tags: #clang

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

Added: 


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

Removed: 




diff  --git a/clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp 
b/clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
index af063ba273dc..9e64ceeeaead 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
@@ -210,8 +210,10 @@ bool AddUsing::prepare(const Selection ) {
 return false;
 
   if (auto *D = Node->ASTNode.get()) {
-QualifierToRemove = D->getQualifierLoc();
-Name = D->getDecl()->getName();
+if (auto *II = D->getDecl()->getIdentifier()) {
+  QualifierToRemove = D->getQualifierLoc();
+  Name = II->getName();
+}
   } else if (auto *T = Node->ASTNode.get()) {
 if (auto E = T->getAs()) {
   if (auto *BaseTypeIdentifier =

diff  --git a/clang-tools-extra/clangd/unittests/TweakTests.cpp 
b/clang-tools-extra/clangd/unittests/TweakTests.cpp
index cda31b5f068d..95f086f77386 100644
--- a/clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ b/clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -2444,6 +2444,7 @@ class cc {
 public:
   struct st {};
   static void mm() {}
+  cc operator|(const cc& x) const { return x; }
 };
 }
 })cpp";
@@ -2463,6 +2464,9 @@ class cc {
   // test that we don't crash.
   EXPECT_UNAVAILABLE(Header +
  "template using foo = one::tt;");
+  // Test that we don't crash or misbehave on unnamed DeclRefExpr.
+  EXPECT_UNAVAILABLE(Header +
+ "void fun() { one::two::cc() ^| one::two::cc(); }");
 
   // Check that we do not trigger in header files.
   FileName = "test.h";



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


[PATCH] D79582: [clangd] Fix crash in AddUsing tweak due to non-identifier DeclName

2020-05-08 Thread Adam Czachorowski via Phabricator via cfe-commits
adamcz updated this revision to Diff 262857.
adamcz marked an inline comment as done.
adamcz added a comment.

Addressed review comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79582

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


Index: clang-tools-extra/clangd/unittests/TweakTests.cpp
===
--- clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -2444,6 +2444,7 @@
 public:
   struct st {};
   static void mm() {}
+  cc operator|(const cc& x) const { return x; }
 };
 }
 })cpp";
@@ -2463,6 +2464,9 @@
   // test that we don't crash.
   EXPECT_UNAVAILABLE(Header +
  "template using foo = one::tt;");
+  // Test that we don't crash or misbehave on unnamed DeclRefExpr.
+  EXPECT_UNAVAILABLE(Header +
+ "void fun() { one::two::cc() ^| one::two::cc(); }");
 
   // Check that we do not trigger in header files.
   FileName = "test.h";
Index: clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
===
--- clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
@@ -210,8 +210,10 @@
 return false;
 
   if (auto *D = Node->ASTNode.get()) {
-QualifierToRemove = D->getQualifierLoc();
-Name = D->getDecl()->getName();
+if (auto *II = D->getDecl()->getIdentifier()) {
+  QualifierToRemove = D->getQualifierLoc();
+  Name = II->getName();
+}
   } else if (auto *T = Node->ASTNode.get()) {
 if (auto E = T->getAs()) {
   if (auto *BaseTypeIdentifier =


Index: clang-tools-extra/clangd/unittests/TweakTests.cpp
===
--- clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -2444,6 +2444,7 @@
 public:
   struct st {};
   static void mm() {}
+  cc operator|(const cc& x) const { return x; }
 };
 }
 })cpp";
@@ -2463,6 +2464,9 @@
   // test that we don't crash.
   EXPECT_UNAVAILABLE(Header +
  "template using foo = one::tt;");
+  // Test that we don't crash or misbehave on unnamed DeclRefExpr.
+  EXPECT_UNAVAILABLE(Header +
+ "void fun() { one::two::cc() ^| one::two::cc(); }");
 
   // Check that we do not trigger in header files.
   FileName = "test.h";
Index: clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
===
--- clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
@@ -210,8 +210,10 @@
 return false;
 
   if (auto *D = Node->ASTNode.get()) {
-QualifierToRemove = D->getQualifierLoc();
-Name = D->getDecl()->getName();
+if (auto *II = D->getDecl()->getIdentifier()) {
+  QualifierToRemove = D->getQualifierLoc();
+  Name = II->getName();
+}
   } else if (auto *T = Node->ASTNode.get()) {
 if (auto E = T->getAs()) {
   if (auto *BaseTypeIdentifier =
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79526: [CUDA][HIP] Workaround for resolving host device function against wrong-sided function

2020-05-08 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

In D79526#2025761 , @tra wrote:

> I've tested the patch on our sources and it still breaks tensorflow 
> compilation, though in a different way:
>
>   In file included from 
> third_party/tensorflow/core/kernels/slice_op_gpu.cu.cc:22:
>   In file included from 
> ./third_party/tensorflow/core/framework/register_types.h:20:
>   In file included from 
> ./third_party/tensorflow/core/framework/numeric_types.h:28:
>   In file included from ./third_party/tensorflow/core/platform/types.h:22:
>   In file included from ./third_party/tensorflow/core/platform/tstring.h:24:
>   In file included from ./third_party/tensorflow/core/platform/cord.h:23:
>   In file included from 
> ./third_party/tensorflow/core/platform/google/cord.h:19:
>   In file included from ./third_party/absl/strings/cord.h:89:
>   ./third_party/absl/strings/internal/cord_internal.h:34:16: error: no 
> matching constructor for initialization of 'std::atomic' (aka 
> 'atomic')
> Refcount() : count_{1} {}
>  ^ ~~~
>   
> third_party/crosstool/v18/llvm_unstable/toolchain/bin/../include/c++/v1/atomic:1778:8:
>  note: candidate constructor (the implicit copy constructor) not viable: no 
> known conversion from 'int' to 'const std::__u::atomic' for 1st argument
>   struct atomic
>  ^
>   
> third_party/crosstool/v18/llvm_unstable/toolchain/bin/../include/c++/v1/atomic:1784:5:
>  note: candidate constructor not viable: requires 0 arguments, but 1 was 
> provided
>   atomic() _NOEXCEPT _LIBCPP_DEFAULT
>   ^
>   
> third_party/crosstool/v18/llvm_unstable/toolchain/bin/../include/c++/v1/atomic:1807:52:
>  error: call to deleted constructor of 
> '__atomic_base'
>   _LIBCPP_CONSTEXPR atomic(_Tp* __d) _NOEXCEPT : __base(__d) {}
>  ^  ~~~
>   ./third_party/absl/base/internal/thread_identity.h:162:66: note: in 
> instantiation of member function 
> 'std::__u::atomic::atomic' requested here
>   std::atomic bound_schedulable{nullptr};
>^
>   
> third_party/crosstool/v18/llvm_unstable/toolchain/bin/../include/c++/v1/atomic:1675:5:
>  note: '__atomic_base' has been explicitly marked deleted here
>   __atomic_base(const __atomic_base&) = delete;
>   ^
>   
> third_party/crosstool/v18/llvm_unstable/toolchain/bin/../include/c++/v1/atomic:1786:51:
>  error: call to implicitly-deleted copy constructor of '__atomic_base'
>   _LIBCPP_CONSTEXPR atomic(_Tp __d) _NOEXCEPT : __base(__d) {}
> ^  ~~~
>   ./third_party/absl/synchronization/mutex.h:927:25: note: in instantiation 
> of member function 'std::__u::atomic::atomic' requested here
>   inline Mutex::Mutex() : mu_(0) {
>   ^
>   
> third_party/crosstool/v18/llvm_unstable/toolchain/bin/../include/c++/v1/atomic:1698:7:
>  note: copy constructor of '__atomic_base' is implicitly deleted 
> because base class '__atomic_base' has a deleted copy constructor
>   : public __atomic_base<_Tp, false>
> ^
>   
> third_party/crosstool/v18/llvm_unstable/toolchain/bin/../include/c++/v1/atomic:1675:5:
>  note: '__atomic_base' has been explicitly marked deleted here
>   __atomic_base(const __atomic_base&) = delete;
>   ^
>  
>


Looks like we went overboard to treat implicit host device candidate as 
inferior. They should be treated
as inferior in device compilation, not in host compilation. Here because they 
are treated as inferior
to same-sided candidate in host compilation, they changed overload resolution 
in host compilation
therefore caused the failure in host compilation.

I have updated the patch to treat implicit host device candidate as inferior in 
device compilation.


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

https://reviews.llvm.org/D79526



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


[PATCH] D79526: [CUDA][HIP] Workaround for resolving host device function against wrong-sided function

2020-05-08 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 262858.
yaxunl edited the summary of this revision.
yaxunl added a comment.

fix regression. only treat implicit host device candidate inferior in device 
compilation.


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

https://reviews.llvm.org/D79526

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaCUDA.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/SemaCUDA/function-overload.cu

Index: clang/test/SemaCUDA/function-overload.cu
===
--- clang/test/SemaCUDA/function-overload.cu
+++ clang/test/SemaCUDA/function-overload.cu
@@ -463,3 +463,43 @@
 void foo() {
   __test();
 }
+
+// Test resolving implicit host device candidate vs wrong-sided candidate.
+// In device compilation, implicit host device caller choose implicit host
+// device candidate and wrong-sided candidate with equal preference.
+namespace ImplicitHostDeviceVsWrongSided {
+inline double callee(double x);
+#pragma clang force_cuda_host_device begin
+inline void callee(int x);
+inline double implicit_hd_caller() {
+  return callee(1.0);
+}
+#pragma clang force_cuda_host_device end
+}
+
+// Test resolving implicit host device candidate vs wrong-sided candidate.
+// In host compilation, implicit host device caller choose implicit host
+// device candidate and same-sided candidate with equal preference.
+namespace ImplicitHostDeviceVsWrongSided2 {
+inline void callee(int x);
+#pragma clang force_cuda_host_device begin
+inline double callee(double x);
+inline double implicit_hd_caller() {
+  return callee(1.0);
+}
+#pragma clang force_cuda_host_device end
+}
+
+// Test resolving explicit host device candidate vs. wrong-sided candidate.
+// Explicit host device caller favors host device candidate against wrong-sided
+// candidate.
+namespace ExplicitHostDeviceVsWrongSided {
+inline double callee(double x);
+inline __host__ __device__ void callee(int x);
+inline __host__ __device__ double explicit_hd_caller() {
+  return callee(1.0);
+#if __CUDA_ARCH__
+  // expected-error@-2 {{cannot initialize return object of type 'double' with an rvalue of type 'void'}}
+#endif
+}
+}
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -9517,11 +9517,29 @@
   // in global variable initializers once proper context is added.
   if (S.getLangOpts().CUDA && Cand1.Function && Cand2.Function) {
 if (FunctionDecl *Caller = dyn_cast(S.CurContext)) {
-  auto P1 = S.IdentifyCUDAPreference(Caller, Cand1.Function);
-  auto P2 = S.IdentifyCUDAPreference(Caller, Cand2.Function);
+  bool IsCallerImplicitHD = false;
+  bool IsCand1ImplicitHD = false;
+  bool IsCand2ImplicitHD = false;
+  S.IdentifyCUDATarget(Caller, /*IgnoreImplicitHD=*/false,
+   );
+  auto P1 =
+  S.IdentifyCUDAPreference(Caller, Cand1.Function, );
+  auto P2 =
+  S.IdentifyCUDAPreference(Caller, Cand2.Function, );
   assert(P1 != Sema::CFP_Never && P2 != Sema::CFP_Never);
-  auto Cand1Emittable = P1 > Sema::CFP_WrongSide;
-  auto Cand2Emittable = P2 > Sema::CFP_WrongSide;
+  // The implicit HD function may be a function in a system header which
+  // is forced by pragma. In device compilation, if we prefer HD candidates
+  // over wrong-sided candidates, overloading resolution may change, which
+  // may result in non-deferrable diagnostics. As a workaround, we let
+  // implicit HD candidates take equal preference as wrong-sided candidates.
+  // This will preserve the overloading resolution.
+  auto EmitThreshold =
+  (S.getLangOpts().CUDAIsDevice && IsCallerImplicitHD &&
+   (IsCand1ImplicitHD || IsCand2ImplicitHD))
+  ? Sema::CFP_HostDevice
+  : Sema::CFP_WrongSide;
+  auto Cand1Emittable = P1 > EmitThreshold;
+  auto Cand2Emittable = P2 > EmitThreshold;
   if (Cand1Emittable && !Cand2Emittable)
 return true;
   if (!Cand1Emittable && Cand2Emittable)
Index: clang/lib/Sema/SemaCUDA.cpp
===
--- clang/lib/Sema/SemaCUDA.cpp
+++ clang/lib/Sema/SemaCUDA.cpp
@@ -95,17 +95,25 @@
   return CFT_Host;
 }
 
-template 
-static bool hasAttr(const FunctionDecl *D, bool IgnoreImplicitAttr) {
-  return D->hasAttrs() && llvm::any_of(D->getAttrs(), [&](Attr *Attribute) {
-   return isa(Attribute) &&
-  !(IgnoreImplicitAttr && Attribute->isImplicit());
- });
+template 
+static bool hasAttr(const FunctionDecl *D, bool IgnoreImplicitAttr,
+bool *IsImplicitHDAttr = nullptr) {
+  if (auto *A = D->getAttr()) {
+if (A->isImplicit()) {
+  if (IsImplicitHDAttr)
+*IsImplicitHDAttr = true;
+  if (IgnoreImplicitAttr)
+return false;
+}
+return true;
+  }

[PATCH] D75430: [analyzer][NFC] Introduce CXXDeallocatorCall, deploy it in MallocChecker

2020-05-08 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus marked 5 inline comments as done.
Szelethus added inline comments.



Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:59
 enum CallEventKind {
+  CE_CXXDeallocator,
   CE_Function,

xazax.hun wrote:
> Szelethus wrote:
> > I need to move this below `CE_Function`, as its not in the range of 
> > `CE_BEG_FUNCTION_CALLS` and `CE_END_FUNCTION_CALLS`.
> This is marked as done. If the conclusion is that you do not need to move it 
> I think it would be worth to add a comment why :)
Marked done automatically, I'll address this before commiting :)



Comment at: 
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:1052
+/// This is a call to "operator delete".
+// FIXME: CXXDeleteExpr isn't present for custom delete operators, or even for
+// some those that are in the standard library, like the no-throw or align_val

xazax.hun wrote:
> How important and hard it is to fix this? If you did not find the reason why 
> those CXXDeleteExprs are missing you can do two things:
> 1. Look at how such AST is consumed by CodeGen
> 2. Ask around on the mailing list with a minimal example.
Fair point, but it surely is a thing to keep in mind because it could, or more 
probably //will// cause surprises. A `TODO` or a `NOTE` would be more 
appropriate. In any case, I'd prefer to address these in a followup patch.



Comment at: 
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:1083
+
+  const Expr *getArgExpr(unsigned Index = 0) const override {
+return getOriginExpr()->getArgument();

xazax.hun wrote:
> Is the index unused on purpose? If yes, wouldn't this trigger a warning on 
> build bots? Adding a maybe unused annotation and/or a comment would be 
> welcome.
Unused argument warnings are disabled by the build system, but a comment 
wouldn't hurt. `CXXDeleteExpr`s can only have a single argument, but as earlier 
inlines suggests, we will need to mind custom deletes later on. 


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

https://reviews.llvm.org/D75430



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


[PATCH] D78933: [analyzer] RangeConstraintManager optimizations in comparison expressions

2020-05-08 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun marked an inline comment as done.
xazax.hun added a comment.

Thanks!

I still have some nits inline, but overall the implementation looks good to me.
I think, however, that we should not only focus on the implementation but on 
the high-level questions. 
Is this the way forward we want? Can we do it more efficiently? What is the 
performance penalty of this solution?

The measurements I mentioned earlier about runtimes, node count and so on could 
help answer some of those questions.




Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:587
+  // !=|1 |1 |* |* |0 |1 |0|
+  // Columns stands for a preceding operator.
+  // Rows stands for a current operator.

I think it would be better to use slightly different terminology. Instead of 
preceding operator I would say something like "previously known fact". 



Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:597
+  static constexpr size_t CmpOpCount = BO_NE - BO_LT + 1;
+  static const TriState CmpOpTable[CmpOpCount][CmpOpCount + 1] = {
+  // <  >  <= >= == !=UnknownX2

I think this table together with the operations that transform between indices 
and operators could be factored out into a separate class. That would make this 
method slightly cleaner.



Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:613
+
+  auto OP = SSE->getOpcode();
+

In LLVM we usually only use `auto` for iterators and to avoid repeating the 
type twice. Auto is ok above with the `dynamic_cast`, but here and some other 
places the type should be spelled out.



Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:668
+
+auto BranchState = CmpOpTable[IndexSymOP][IndexPrevOP];
+

I think `IndexPrevOP` is confusing as the "previous" operation is not 
necessarily the previous operation we evaluated. In fact `IndexPrevOP` could 
have been evaluated any time in the past. We query the known facts that are 
known for the current state, I think this is what the names should reflect. I 
suggest to use `CurrentOP` and `QueriedOP`.



Comment at: clang/test/Analysis/constraint_manager_conditions.cpp:184
+}
\ No newline at end of file


ASDenysPetrov wrote:
> xazax.hun wrote:
> > Nit: please add new line at the end of the file.
> I've added a new line and checked twice before creating a patch. But it 
> didn't appear.
This looks good now. If it misses the new line there is a message saying that 
explicitly.


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

https://reviews.llvm.org/D78933



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


[PATCH] D74387: [SYCL] Defer __float128 type usage diagnostics

2020-05-08 Thread Mariya Podchishchaeva via Phabricator via cfe-commits
Fznamznon added a comment.

In D74387#2023200 , @jdoerfert wrote:

> In D74387#1992682 , @Fznamznon wrote:
>
> > Okay, seems like OpenMP needs unsupported types diagnosing as well. I'm 
> > trying to adapt this patch for OpenMP, but it doesn't work out of the box 
> > because it diagnoses memcpy like operations, so with the current patch the 
> > code like this will cause diagnostics:
> >
> >struct T {
> >  char a;
> >  __float128 f;
> >  char c;
> >  T() : a(12), f(15) {}
> >   }
> >  
> >   #pragma omp declare target
> >   T a = T();
> >   #pragma omp end declare target
> >
> >
> > It happens because member initialization in the constructor is still usage 
> > of `f` field which is marked unavailable because of type. I'm not sure that 
> > it is possible to understand how the unavailable declaration is used in the 
> > place where diagnostic about usage of unavailable declaration is actually 
> > emitted, so I will probably need some other place/solution for it.
> >
> > @jdoerfert , could you please help to understand how the diagnostic should 
> > work for OpenMP cases? Or you probably have some spec/requirements for it?
> >  Understanding what exactly is needed will help with the implementation, I 
> > guess.
>
>
> I missed this update, sorry.
>
> I don't think we have a spec wording for this, it is up to the 
> implementations.
>
> In the example, a diagnostic is actually fine (IMHO). You cannot assign 15 to 
> the __float128 on the device. It doesn't work. The following code however 
> should go through without diagnostic:
>
>   struct T {
>  char a;
>  __float128 f;
>  char c;
>  T() : a(12), c(15) {}
>   }
>
>
> and it should translate to
>
>   struct T {
>  char a;
>  alignas(host_float128_alignment) char[16] __unavailable_f;
>  char c;
>  T() : a(12), c(15) {}
>   }
>
>
> Do you have other questions or examples we should discuss?


I'm not sure that I've discovered all examples and problems, but I have a 
couple of ones. I started with adapting current implementation for OpenMP and 
right now I'm analyzing corresponding OpenMP test fails (i.e. 
`clang/test/OpenMP/nvptx_unsupported_type_messages.cpp` and 
`clang/test/OpenMP/nvptx_unsupported_type_codegen.cpp`). There are a lot of 
differences between the old approach and new one, which I'm working on. The new 
diagnostic triggers more errors than the old one, so I'd like to understand in 
which concrete cases we shouldn't emit diagnostic. For example you mentioned 
that memcopy-like operations should be ok in device code.
Right now the current implementation of the diagnostic also emits errors for 
sample like this:

  struct T {
char a;
__float128 f;
char c;
  };
  
  #pragma omp declare target
  T a;
  T b = a; // The diagnostic is triggered here, because implicit copy 
constructor uses unavailable field
  #pragma omp end declare target

Should we emit errors in such case too?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74387



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


[PATCH] D75430: [analyzer][NFC] Introduce CXXDeallocatorCall, deploy it in MallocChecker

2020-05-08 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment.

Overall looks good to me some questions and nits inline.




Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:59
 enum CallEventKind {
+  CE_CXXDeallocator,
   CE_Function,

Szelethus wrote:
> I need to move this below `CE_Function`, as its not in the range of 
> `CE_BEG_FUNCTION_CALLS` and `CE_END_FUNCTION_CALLS`.
This is marked as done. If the conclusion is that you do not need to move it I 
think it would be worth to add a comment why :)



Comment at: 
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:1052
+/// This is a call to "operator delete".
+// FIXME: CXXDeleteExpr isn't present for custom delete operators, or even for
+// some those that are in the standard library, like the no-throw or align_val

How important and hard it is to fix this? If you did not find the reason why 
those CXXDeleteExprs are missing you can do two things:
1. Look at how such AST is consumed by CodeGen
2. Ask around on the mailing list with a minimal example.



Comment at: 
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:1083
+
+  const Expr *getArgExpr(unsigned Index = 0) const override {
+return getOriginExpr()->getArgument();

Is the index unused on purpose? If yes, wouldn't this trigger a warning on 
build bots? Adding a maybe unused annotation and/or a comment would be welcome.



Comment at: 
clang/lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp:95
   ExplodedNode *N = C.generateNonFatalErrorNode();
+  if (!N)
+return;

I think this change might be a better fit for a separate commit. I think you 
don't even need to have such a small change reviewed. You could just commit it 
as is. Just do not forget to describe that these cases are really hard to have 
a test for but this is the idiomatic way of doing this in checkers.


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

https://reviews.llvm.org/D75430



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


[PATCH] D79500: [clangd] Refactor code completion signal's utility properties.

2020-05-08 Thread UTKARSH SAXENA via Phabricator via cfe-commits
usaxena95 updated this revision to Diff 262852.
usaxena95 added a comment.

- Added DerivedSignals struct containing all the derived signals.
- Added NameMatchesContext and proximtiy signals to this struct.
- We need to call computeDerivedSignals() before calling evaluate() if we set 
non-concrete utilites (e.g. ContextWords and Name).
- This is logically equivalent to the previous version (both when the utilites 
are explicitly set and when the default signals are used).
- The utilites are not marked as null in computeDerivedSignals. This is due to 
2 reasons:
  - Current scoring function checks whether `ScopeProximityMatch` is set or not 
to decide whether to multiply with scopeProxitiyScore. Possible solutions:
- Have scopeProxitiyScore as a derived signal itself.
- Or have a different derived signal `HasScopeProximityMatch`.
  - Having these utilities available for debug purposes is great. We can try to 
compute other derived signals (e.g. ContextMatchesName) and test out it's value 
without even adding them concretely to clangd. Once their value is justified, 
we can add it to Quality/Relevance signals.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79500

Files:
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/FindSymbols.cpp
  clang-tools-extra/clangd/Quality.cpp
  clang-tools-extra/clangd/Quality.h
  clang-tools-extra/clangd/Quality.h.rej
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/index/dex/Dex.cpp
  clang-tools-extra/clangd/unittests/QualityTests.cpp

Index: clang-tools-extra/clangd/unittests/QualityTests.cpp
===
--- clang-tools-extra/clangd/unittests/QualityTests.cpp
+++ clang-tools-extra/clangd/unittests/QualityTests.cpp
@@ -268,9 +268,11 @@
   ProxSources.try_emplace(testPath("foo/baz.h"));
   URIDistance Distance(ProxSources);
   IndexProximate.FileProximityMatch = 
+  IndexProximate.calculateDerivedSignals();
   EXPECT_GT(IndexProximate.evaluate(), Default.evaluate());
   SymbolRelevanceSignals IndexDistant = IndexProximate;
   IndexDistant.SymbolURI = "unittest:/elsewhere/path.h";
+  IndexDistant.calculateDerivedSignals();
   EXPECT_GT(IndexProximate.evaluate(), IndexDistant.evaluate())
   << IndexProximate << IndexDistant;
   EXPECT_GT(IndexDistant.evaluate(), Default.evaluate());
@@ -294,13 +296,17 @@
   EXPECT_LT(InBaseClass.evaluate(), Default.evaluate());
 
   llvm::StringSet<> Words = {"one", "two", "three"};
+
   SymbolRelevanceSignals WithoutMatchingWord;
   WithoutMatchingWord.ContextWords = 
   WithoutMatchingWord.Name = "four";
+  WithoutMatchingWord.calculateDerivedSignals();
   EXPECT_EQ(WithoutMatchingWord.evaluate(), Default.evaluate());
+
   SymbolRelevanceSignals WithMatchingWord;
   WithMatchingWord.ContextWords = 
   WithMatchingWord.Name = "TheTwoTowers";
+  WithMatchingWord.calculateDerivedSignals();
   EXPECT_GT(WithMatchingWord.evaluate(), Default.evaluate());
 }
 
@@ -310,25 +316,31 @@
   Relevance.ScopeProximityMatch = 
 
   Relevance.SymbolScope = "other::";
+  Relevance.calculateDerivedSignals();
   float NotMatched = Relevance.evaluate();
 
   Relevance.SymbolScope = "";
+  Relevance.calculateDerivedSignals();
   float Global = Relevance.evaluate();
   EXPECT_GT(Global, NotMatched);
 
   Relevance.SymbolScope = "llvm::";
+  Relevance.calculateDerivedSignals();
   float NonParent = Relevance.evaluate();
   EXPECT_GT(NonParent, Global);
 
   Relevance.SymbolScope = "x::";
+  Relevance.calculateDerivedSignals();
   float GrandParent = Relevance.evaluate();
   EXPECT_GT(GrandParent, Global);
 
   Relevance.SymbolScope = "x::y::";
+  Relevance.calculateDerivedSignals();
   float Parent = Relevance.evaluate();
   EXPECT_GT(Parent, GrandParent);
 
   Relevance.SymbolScope = "x::y::z::";
+  Relevance.calculateDerivedSignals();
   float Enclosing = Relevance.evaluate();
   EXPECT_GT(Enclosing, Parent);
 }
Index: clang-tools-extra/clangd/index/dex/Dex.cpp
===
--- clang-tools-extra/clangd/index/dex/Dex.cpp
+++ clang-tools-extra/clangd/index/dex/Dex.cpp
@@ -126,7 +126,6 @@
   // DistanceCalculator will find the shortest distance from ProximityPaths to
   // any URI extracted from the ProximityPaths.
   URIDistance DistanceCalculator(Sources);
-  PathProximitySignals.FileProximityMatch = 
   // Try to build BOOST iterator for each Proximity Path provided by
   // ProximityPaths. Boosting factor should depend on the distance to the
   // Proximity Path: the closer processed path is, the higher boosting factor.
@@ -134,7 +133,9 @@
 // FIXME(kbobyrev): Append LIMIT on top of every BOOST iterator.
 auto It = iterator(Token(Token::Kind::ProximityURI, ParentURI));
 if (It->kind() != Iterator::Kind::False) {
+  PathProximitySignals.FileProximityMatch = 
   PathProximitySignals.SymbolURI = ParentURI;

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-05-08 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 262845.
baloghadamsoftware added a comment.

Added support for `ParamRegions` as original region for captured variables by 
blocks and lambdas. Only 2 failing tests left.


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

https://reviews.llvm.org/D77229

Files:
  clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/Regions.def
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
  clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/InvalidatedIteratorChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/Iterator.cpp
  clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/IteratorRangeChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/MismatchedIteratorChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
  
clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
  clang/lib/StaticAnalyzer/Checkers/STLAlgorithmModeling.cpp
  clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
  clang/lib/StaticAnalyzer/Core/CallEvent.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
  clang/lib/StaticAnalyzer/Core/MemRegion.cpp
  clang/lib/StaticAnalyzer/Core/RegionStore.cpp
  clang/lib/StaticAnalyzer/Core/Store.cpp
  clang/lib/StaticAnalyzer/Core/SymbolManager.cpp
  clang/test/Analysis/container-modeling.cpp
  clang/test/Analysis/explain-svals.cpp
  clang/test/Analysis/iterator-modeling.cpp
  clang/test/Analysis/temporaries.cpp

Index: clang/test/Analysis/temporaries.cpp
===
--- clang/test/Analysis/temporaries.cpp
+++ clang/test/Analysis/temporaries.cpp
@@ -56,7 +56,7 @@
 }
 
 namespace rdar13265460 {
-  struct TrivialSubclass : public Trivial {
+struct TrivialSubclass : public Trivial {
 TrivialSubclass(int x) : Trivial(x), anotherValue(-x) {}
 int anotherValue;
   };
@@ -890,12 +890,9 @@
 public:
   ~C() {
 glob = 1;
-// FIXME: Why is destructor not inlined in C++17
 clang_analyzer_checkInlined(true);
 #ifdef TEMPORARY_DTORS
-#if __cplusplus < 201703L
-// expected-warning@-3{{TRUE}}
-#endif
+// expected-warning@-2{{TRUE}}
 #endif
   }
 };
@@ -914,16 +911,11 @@
   // temporaries returned from functions, so we took the wrong branch.
   coin && is(get()); // no-crash
   if (coin) {
-// FIXME: Why is destructor not inlined in C++17
 clang_analyzer_eval(glob);
 #ifdef TEMPORARY_DTORS
-#if __cplusplus < 201703L
-// expected-warning@-3{{TRUE}}
+// expected-warning@-2{{TRUE}}
 #else
-// expected-warning@-5{{UNKNOWN}}
-#endif
-#else
-// expected-warning@-8{{UNKNOWN}}
+// expected-warning@-4{{UNKNOWN}}
 #endif
   } else {
 // The destructor is not called on this branch.
@@ -1237,7 +1229,7 @@
 struct S {
   S() {}
   S(const S &) {}
-};
+  };
 
 void test() {
   int x = 0;
Index: clang/test/Analysis/iterator-modeling.cpp
===
--- clang/test/Analysis/iterator-modeling.cpp
+++ clang/test/Analysis/iterator-modeling.cpp
@@ -1862,7 +1862,7 @@
 void clang_analyzer_printState();
 
 void print_state(std::vector ) {
-  const auto i0 = V.cbegin();
+  auto i0 = V.cbegin();
   clang_analyzer_printState();
 
 // CHECK:  "checker_messages": [
@@ -1871,7 +1871,8 @@
 // CHECK-NEXT: "i0 : Valid ; Container == SymRegion{reg_$[[#]] & V>} ; Offset == conj_$[[#]]{long, LC[[#]], S[[#]], #[[#]]}"
 // CHECK-NEXT:   ]}
 
-  const auto i1 = V.cend();
+  ++i0;
+  auto i1 = V.cend();
   clang_analyzer_printState();
   
 // CHECK:  "checker_messages": [
@@ -1879,4 +1880,6 @@
 // CHECK-NEXT: "Iterator Positions :",
 // CHECK-NEXT: "i1 : Valid ; Container == SymRegion{reg_$[[#]] & V>} ; Offset == conj_$[[#]]{long, LC[[#]], S[[#]], #[[#]]}"
 // CHECK-NEXT:   ]}
+
+  --i1;
 }
Index: clang/test/Analysis/explain-svals.cpp
===
--- clang/test/Analysis/explain-svals.cpp
+++ clang/test/Analysis/explain-svals.cpp
@@ -93,6 +93,6 @@
 } // end of anonymous namespace
 
 void test_6() {
-  clang_analyzer_explain(conjure_S()); // expected-warning-re^lazily frozen compound value of temporary object constructed at statement 'conjure_S\(\)'$
+  clang_analyzer_explain(conjure_S()); // 

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

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



Comment at: clang/lib/StaticAnalyzer/Core/Store.cpp:472
+  break;
+}
+

baloghadamsoftware wrote:
> baloghadamsoftware wrote:
> > Probably this loop could be written better, without `break` at the end, but 
> > for now it des what it should do. For captured parameters of functions and 
> > blocks we must look for the original `CallExpr` and `LocationContext`. If 
> > it does not exist (we analyze the block of the lambda top-level) we revert 
> > to `VarRegion` since the captured parameters are simple variales for the 
> > block or lambda. However, we cannot do this if the block or lambda is not 
> > analyzed top-level, thus the approach I use above seems to be the correct 
> > one. However, this completely breaks the test `objc-radar17039661.m`. Even 
> > order of the `postCall()` hooks is changed and the test fails because it 
> > cannot find the bug. I try to attach the two different outputs annotated by 
> > debug printouts. @NoQ, do you have an idea what could be wrong here? First 
> > I thought on `BlockDataRegion`s where it seems I have to duplicate lots of 
> > code and also change the capture interface to also enable `ParamRegions` 
> > for the captures. However, in this case it does not seem to play a role.
> The really strange thing is that I originally used a recoursive approach 
> here, instead of the loop, which I still believe is the right one. However, 
> in that case the test failed even if I removed all creations of 
> `ParamRegion`s. The only difference then was that the `LocationContext` of 
> the captured region was the top-level `LocationContext`. This alone changed 
> the calling order of the checker hooks and this happens here as well. It is 
> not the `VarRegion` vs `ParamRegion` problem but the `LocationContext` of the 
> region. I still do not see why this influences the calling order of these 
> hooks. I am already debugging it for almost 15 hours without any clue.
Problem solved. Captured variables are always variables, even if they were 
paramseters originally. I added support for binding the old values to the new 
regions upon capture for `ParamRegion`s as well. This solved the failing test.


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

https://reviews.llvm.org/D77229



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


[PATCH] D77846: [analyzer][CallAndMessage][NFC] Split up checkPreCall

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



Comment at: clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp:27
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"

Are these new includes needed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77846



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


[PATCH] D77846: [analyzer][CallAndMessage][NFC] Split up checkPreCall

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



Comment at: clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp:481
+  ProgramStateRef State = C.getState();
+  if (isa(Call) || isa(Call)) {
+

The one thing where I am not sure is if this condition is really needed for 
every case (for example can `checkFunctionPointerCall` be moved outside this 
`if`?). I see only that `checkParameterCount` has to be in this `if` block.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77846



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


[PATCH] D79487: [clangd] NFC: Use deprecated grpc++ headers for compatibility

2020-05-08 Thread Kirill Bobyrev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9c198b550ebb: [clangd] NFC: Use deprecated grpc++ headers 
for compatibility (authored by kbobyrev).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79487

Files:
  clang-tools-extra/clangd/index/remote/Client.cpp
  clang-tools-extra/clangd/index/remote/server/Server.cpp


Index: clang-tools-extra/clangd/index/remote/server/Server.cpp
===
--- clang-tools-extra/clangd/index/remote/server/Server.cpp
+++ clang-tools-extra/clangd/index/remote/server/Server.cpp
@@ -13,8 +13,8 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Signals.h"
 
-#include 
-#include 
+#include 
+#include 
 
 #include "Index.grpc.pb.h"
 
Index: clang-tools-extra/clangd/index/remote/Client.cpp
===
--- clang-tools-extra/clangd/index/remote/Client.cpp
+++ clang-tools-extra/clangd/index/remote/Client.cpp
@@ -6,7 +6,7 @@
 //
 
//===--===//
 
-#include 
+#include 
 
 #include "Client.h"
 #include "Index.grpc.pb.h"


Index: clang-tools-extra/clangd/index/remote/server/Server.cpp
===
--- clang-tools-extra/clangd/index/remote/server/Server.cpp
+++ clang-tools-extra/clangd/index/remote/server/Server.cpp
@@ -13,8 +13,8 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Signals.h"
 
-#include 
-#include 
+#include 
+#include 
 
 #include "Index.grpc.pb.h"
 
Index: clang-tools-extra/clangd/index/remote/Client.cpp
===
--- clang-tools-extra/clangd/index/remote/Client.cpp
+++ clang-tools-extra/clangd/index/remote/Client.cpp
@@ -6,7 +6,7 @@
 //
 //===--===//
 
-#include 
+#include 
 
 #include "Client.h"
 #include "Index.grpc.pb.h"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79504: [Clang] Wrong return type of atomic_is_lock_free

2020-05-08 Thread kamlesh kumar via Phabricator via cfe-commits
kamleshbhalui added a comment.

I do not have commit access.


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

https://reviews.llvm.org/D79504



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


  1   2   >