[PATCH] D72829: Implement -fsemantic-interposition

2020-01-28 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon check-circle color=green} Unit tests: pass. 62286 tests passed, 0 failed 
and 827 were skipped.

{icon check-circle color=green} clang-tidy: pass.

{icon check-circle color=green} clang-format: pass.

Build artifacts 
: 
diff.json 
,
 clang-tidy.txt 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 


//Pre-merge checks is in beta. Report issue 
.
 Please join beta  or enable 
it for your project 
.//


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72829



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


[PATCH] D73547: [Analyzer] Split container modeling from iterator modeling

2020-01-28 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Ouch, whoops, i didn't notice the new test file. LGTM then!


Repository:
  rC Clang

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

https://reviews.llvm.org/D73547



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


[PATCH] D72829: Implement -fsemantic-interposition

2020-01-28 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 241055.
serge-sans-paille added a comment.

@arichardson doc updated, any other advice?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72829

Files:
  clang/docs/ClangCommandLineReference.rst
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/semantic-interposition.c
  clang/test/Driver/clang_f_opts.c
  llvm/include/llvm/IR/GlobalValue.h
  llvm/include/llvm/IR/Module.h
  llvm/lib/IR/Globals.cpp
  llvm/lib/IR/Module.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/test/Transforms/Inline/inline-semantic-interposition.ll
  llvm/test/Verifier/module-flags-semantic-interposition.ll

Index: llvm/test/Verifier/module-flags-semantic-interposition.ll
===
--- /dev/null
+++ llvm/test/Verifier/module-flags-semantic-interposition.ll
@@ -0,0 +1,12 @@
+; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
+
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+@foo = dso_local global i32 1, align 4
+
+!llvm.module.flags = !{!0}
+
+!0 = !{i32 1, !"SemanticInterposition", float 1.}
+
+; CHECK: SemanticInterposition metadata requires constant integer argument
Index: llvm/test/Transforms/Inline/inline-semantic-interposition.ll
===
--- /dev/null
+++ llvm/test/Transforms/Inline/inline-semantic-interposition.ll
@@ -0,0 +1,26 @@
+; Check that @callee1 gets inlined while @callee2 is not, because of
+; SemanticInterposition.
+
+; RUN: opt < %s -inline -S | FileCheck %s
+
+define internal i32 @callee1(i32 %A) {
+  ret i32 %A
+}
+
+define i32 @callee2(i32 %A) {
+  ret i32 %A
+}
+
+; CHECK-LABEL: @caller
+define i32 @caller(i32 %A) {
+; CHECK-NOT: call i32 @callee1(i32 %A)
+  %A1 = call i32 @callee1(i32 %A)
+; CHECK: %A2 = call i32 @callee2(i32 %A)
+  %A2 = call i32 @callee2(i32 %A)
+; CHECK: add i32 %A, %A2
+  %R = add i32 %A1, %A2
+  ret i32 %R
+}
+
+!llvm.module.flags = !{!0}
+!0 = !{i32 1, !"SemanticInterposition", i32 1}
Index: llvm/lib/IR/Verifier.cpp
===
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -1476,6 +1476,13 @@
"'Linker Options' named metadata no longer supported");
   }
 
+  if (ID->getString() == "SemanticInterposition") {
+ConstantInt *Value =
+mdconst::dyn_extract_or_null(Op->getOperand(2));
+Assert(Value,
+   "SemanticInterposition metadata requires constant integer argument");
+  }
+
   if (ID->getString() == "CG Profile") {
 for (const MDOperand  : cast(Op->getOperand(2))->operands())
   visitModuleFlagCGProfileEntry(MDO);
Index: llvm/lib/IR/Module.cpp
===
--- llvm/lib/IR/Module.cpp
+++ llvm/lib/IR/Module.cpp
@@ -554,6 +554,20 @@
: getModuleFlag("ProfileSummary"));
 }
 
+bool Module::getSemanticInterposition() const {
+  Metadata *MF = getModuleFlag("SemanticInterposition");
+
+  auto *Val = cast_or_null(MF);
+  if (!Val)
+return false;
+
+  return cast(Val->getValue())->getZExtValue();
+}
+
+void Module::setSemanticInterposition(bool SI) {
+  addModuleFlag(ModFlagBehavior::Error, "SemanticInterposition", SI);
+}
+
 void Module::setOwnedMemoryBuffer(std::unique_ptr MB) {
   OwnedMemoryBuffer = std::move(MB);
 }
Index: llvm/lib/IR/Globals.cpp
===
--- llvm/lib/IR/Globals.cpp
+++ llvm/lib/IR/Globals.cpp
@@ -94,6 +94,13 @@
   llvm_unreachable("not a global");
 }
 
+bool GlobalValue::isInterposable() const {
+  if (isInterposableLinkage(getLinkage()))
+return true;
+  return getParent() && getParent()->getSemanticInterposition() &&
+ !isDSOLocal();
+}
+
 unsigned GlobalValue::getAlignment() const {
   if (auto *GA = dyn_cast(this)) {
 // In general we cannot compute this at the IR level, but we try.
Index: llvm/include/llvm/IR/Module.h
===
--- llvm/include/llvm/IR/Module.h
+++ llvm/include/llvm/IR/Module.h
@@ -848,6 +848,12 @@
   Metadata *getProfileSummary(bool IsCS);
   /// @}
 
+  /// Returns whether semantic interposition is to be respected.
+  bool getSemanticInterposition() const;
+
+  /// Set whether semantic interposition is to be respected.
+  void setSemanticInterposition(bool);
+
   /// Returns true if PLT should be avoided for RTLib calls.
   bool getRtLibUseGOT() const;
 
Index: llvm/include/llvm/IR/GlobalValue.h
===
--- llvm/include/llvm/IR/GlobalValue.h
+++ 

[PATCH] D73547: [Analyzer] Split container modeling from iterator modeling

2020-01-28 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment.

In D73547#1845339 , @NoQ wrote:

> This patch is simply moving code around, right? If so, why did tests need to 
> be removed?


All of the container begin- and end-tests were removed from 
`iterator-modeling.cpp` and moved to `container-modelin.cpp` except those which 
do not make sense at the moment: container ends are not touched in modeling 
`insert()` and `erase()` methods. This will probably change in the future but I 
cannot even add `FIXME` tests because I do not know every detail yet. If you 
which, I can add these tests back to `container-modeling.cpp` as they were in 
`iterator-modeling.cpp`.


Repository:
  rC Clang

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

https://reviews.llvm.org/D73547



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


[PATCH] D73464: [clang] Add TagDecl AST matcher

2020-01-28 Thread Karasev Nikita via Phabricator via cfe-commits
f00kat added a comment.

In D73464#1845511 , @aaron.ballman 
wrote:

> In D73464#1844402 , @f00kat wrote:
>
> > In D73464#1844310 , @aaron.ballman 
> > wrote:
> >
> > > LGTM! Do you need someone to commit on your behalf?
> >
> >
> > Yes, please. I don`t know how :)
>
>
> I'm happy to do so, but I'm not certain what email address you'd like me to 
> use for you (I can't quite suss it out from the phab emails). Can you let me 
> know what address you'd like me to use for the commit attribution?


Yeah, sure. "cc.t...@gmail.com".
I forget to verify email in Phabricator settings.
Thank you!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73464



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


[PATCH] D72304: [OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.

2020-01-28 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

In D72304#1846115 , @fghanim wrote:

> Thanks for trying.
>
> It compiles fine with me. How can I reproduce the problems you're getting? is 
> there a way to pack what you have and send it to me so I can have a look?


Did you rebase onto the newest llvm master?

> Also, a second question, how trustworthy is harbormaster when it says 
> something is buildable?

Honestly, I do not know.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72304



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


[PATCH] D72304: [OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.

2020-01-28 Thread Fady Ghanim via Phabricator via cfe-commits
fghanim added a comment.

Thanks for trying.

It compiles fine with me. How can I reproduce the problems you're getting? is 
there a way to pack what you have and send it to me so I can have a look?

Also, a second question, how trustworthy is harbormaster when it says something 
is buildable?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72304



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


[PATCH] D72304: [OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.

2020-01-28 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

I tried to push this today but the build failed:

  
/data/src/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:252:36: 
error: use of undeclared identifier 'BumpPtrAllocator'
StringMap, BumpPtrAllocator> InternalVars;
 ^
  /data/src/llvm-project/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp:832:10: 
error: no viable conversion from returned value of type 'llvm::StringRef' to 
function return type 'std::string' (aka 'basic_string')
return OS.str();
   ^~~~

Can you look into that please?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72304



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


[PATCH] D73603: Driver: Add gcc search path for RHEL devtoolset-9

2020-01-28 Thread Tom Stellard via Phabricator via cfe-commits
tstellar created this revision.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73603

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


Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -1975,6 +1975,7 @@
   // Non-Solaris is much simpler - most systems just go with "/usr".
   if (SysRoot.empty() && TargetTriple.getOS() == llvm::Triple::Linux) {
 // Yet, still look for RHEL devtoolsets.
+Prefixes.push_back("/opt/rh/devtoolset-9/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-8/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-7/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-6/root/usr");


Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -1975,6 +1975,7 @@
   // Non-Solaris is much simpler - most systems just go with "/usr".
   if (SysRoot.empty() && TargetTriple.getOS() == llvm::Triple::Linux) {
 // Yet, still look for RHEL devtoolsets.
+Prefixes.push_back("/opt/rh/devtoolset-9/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-8/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-7/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-6/root/usr");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73500: [driver] Add a -builtininc flag that lets Darwin driver include Clang builtin headers even with -nostdinc

2020-01-28 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D73500#1846036 , @arphaman wrote:

> In D73500#1846003 , @MaskRay wrote:
>
> > Should they use -nostdlibinc instead?
>
>
> Unfortunately they can't control the flag in this specific case, only add 
> flags for specific files.


To make sure I understand it correctly.

There is a project using `-nostdinc`. It still accesses intrinsics headers, so 
`-ibuiltininc` is added to make it work. The new option requires a new release 
of clang. Is it really more convenient adding a new option than teaching the 
project to use `-nostdlibinc` instead of `-nostdinc`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73500



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


[PATCH] D73500: [driver] Add a -builtininc flag that lets Darwin driver include Clang builtin headers even with -nostdinc

2020-01-28 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

In D73500#1846003 , @MaskRay wrote:

> Should they use -nostdlibinc instead?


Unfortunately they can't control the flag in this specific case, only add flags 
for specific files.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73500



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


[PATCH] D73500: [driver] Add a -builtininc flag that lets Darwin driver include Clang builtin headers even with -nostdinc

2020-01-28 Thread Alex Lorenz via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf96f64d0f279: [driver][Darwin] Add an -ibuiltininc flag that 
lets Darwin driver include Clang… (authored by arphaman).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73500

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Darwin.cpp
  clang/test/Driver/darwin-header-search-system.cpp

Index: clang/test/Driver/darwin-header-search-system.cpp
===
--- clang/test/Driver/darwin-header-search-system.cpp
+++ clang/test/Driver/darwin-header-search-system.cpp
@@ -101,3 +101,77 @@
 // CHECK-NOSYSROOT: "-internal-isystem" "/usr/local/include"
 // CHECK-NOSYSROOT: "-internal-isystem" "[[RESOURCE]]/include"
 // CHECK-NOSYSROOT: "-internal-externc-isystem" "/usr/include"
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -nostdinc -ibuiltininc \
+// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN:   -DRESOURCE=%S/Inputs/resource_dir \
+// RUN:   --check-prefix=CHECK-NOSTDINC-BUILTINC %s
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -ibuiltininc -nostdinc \
+// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN:   -DRESOURCE=%S/Inputs/resource_dir \
+// RUN:   --check-prefix=CHECK-NOSTDINC-BUILTINC %s
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -nostdinc -nobuiltininc -ibuiltininc \
+// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN:   -DRESOURCE=%S/Inputs/resource_dir \
+// RUN:   --check-prefix=CHECK-NOSTDINC-BUILTINC %s
+// CHECK-NOSTDINC-BUILTINC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-NOSTDINC-BUILTINC-NOT: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
+// CHECK-NOSTDINC-BUILTINC: "-internal-isystem" "[[RESOURCE]]/include"
+// CHECK-NOSTDINC-BUILTINC-NOT: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -nobuiltininc -ibuiltininc \
+// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN:   -DRESOURCE=%S/Inputs/resource_dir \
+// RUN:   --check-prefix=CHECK-NOBUILTININC-BUILTINC %s
+// CHECK-NOBUILTININC-BUILTINC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-NOBUILTININC-BUILTINC: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
+// CHECK-NOBUILTININC-BUILTINC: "-internal-isystem" "[[RESOURCE]]/include"
+// CHECK-NOBUILTININC-BUILTINC: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -nostdinc -ibuiltininc -nobuiltininc \
+// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN:   -DRESOURCE=%S/Inputs/resource_dir \
+// RUN:   --check-prefix=CHECK-NOSTDINC-NO-BUILTINC %s
+// CHECK-NOSTDINC-NO-BUILTINC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-NOSTDINC-NO-BUILTINC-NOT: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
+// CHECK-NOSTDINC-NO-BUILTINC-NOT: "-internal-isystem" "[[RESOURCE]]/include"
+// CHECK-NOSTDINC-NO-BUILTINC-NOT: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -isysroot 

[clang] f96f64d - [driver][Darwin] Add an -ibuiltininc flag that lets Darwin driver

2020-01-28 Thread Alex Lorenz via cfe-commits

Author: Alex Lorenz
Date: 2020-01-28T18:18:43-08:00
New Revision: f96f64d0f2793fe720bf847cac4a45d74a81c0ef

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

LOG: [driver][Darwin] Add an -ibuiltininc flag that lets Darwin driver
include Clang builtin headers even with -nostdinc

Some projects use -nostdinc, but need to access some intrinsics files when 
building specific files.
The new -ibuiltininc flag lets them use this flag when compiling these files to 
ensure they can
find Clang's builtin headers.

The use of -nobuiltininc after the -ibuiltininc flag does not add the builtin 
header
search path to the list of header search paths.

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

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Darwin.cpp
clang/test/Driver/darwin-header-search-system.cpp

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 650da3ae6462..4d5806154968 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -2081,6 +2081,10 @@ def gno_embed_source : Flag<["-"], "gno-embed-source">, 
Group,
 def headerpad__max__install__names : Joined<["-"], 
"headerpad_max_install_names">;
 def help : Flag<["-", "--"], "help">, Flags<[CC1Option,CC1AsOption]>,
   HelpText<"Display available options">;
+def ibuiltininc : Flag<["-"], "ibuiltininc">,
+  HelpText<"Enable builtin #include directories even when -nostdinc is used "
+   "before or after -ibuiltininc. "
+   "Using -nobuiltininc after the option disables it">;
 def index_header_map : Flag<["-"], "index-header-map">, Flags<[CC1Option]>,
   HelpText<"Make the next included directory (-I or -F) an indexer header 
map">;
 def idirafter : JoinedOrSeparate<["-"], "idirafter">, Group, 
Flags<[CC1Option]>,

diff  --git a/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index 5588f89a9bae..97f7905685c1 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -1870,7 +1870,10 @@ void DarwinClang::AddClangSystemIncludeArgs(const 
llvm::opt::ArgList 
 
   bool NoStdInc = DriverArgs.hasArg(options::OPT_nostdinc);
   bool NoStdlibInc = DriverArgs.hasArg(options::OPT_nostdlibinc);
-  bool NoBuiltinInc = DriverArgs.hasArg(options::OPT_nobuiltininc);
+  bool NoBuiltinInc = DriverArgs.hasFlag(
+  options::OPT_nobuiltininc, options::OPT_ibuiltininc, /*Default=*/false);
+  bool ForceBuiltinInc = DriverArgs.hasFlag(
+  options::OPT_ibuiltininc, options::OPT_nobuiltininc, /*Default=*/false);
 
   // Add /usr/local/include
   if (!NoStdInc && !NoStdlibInc) {
@@ -1880,7 +1883,7 @@ void DarwinClang::AddClangSystemIncludeArgs(const 
llvm::opt::ArgList 
   }
 
   // Add the Clang builtin headers (/include)
-  if (!NoStdInc && !NoBuiltinInc) {
+  if (!(NoStdInc && !ForceBuiltinInc) && !NoBuiltinInc) {
 SmallString<128> P(D.ResourceDir);
 llvm::sys::path::append(P, "include");
 addSystemInclude(DriverArgs, CC1Args, P);

diff  --git a/clang/test/Driver/darwin-header-search-system.cpp 
b/clang/test/Driver/darwin-header-search-system.cpp
index fa2ad0ec62b3..a8cd48755179 100644
--- a/clang/test/Driver/darwin-header-search-system.cpp
+++ b/clang/test/Driver/darwin-header-search-system.cpp
@@ -101,3 +101,77 @@
 // CHECK-NOSYSROOT: "-internal-isystem" "/usr/local/include"
 // CHECK-NOSYSROOT: "-internal-isystem" "[[RESOURCE]]/include"
 // CHECK-NOSYSROOT: "-internal-externc-isystem" "/usr/include"
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir 
%S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -nostdinc -ibuiltininc \
+// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN:   -DRESOURCE=%S/Inputs/resource_dir \
+// RUN:   --check-prefix=CHECK-NOSTDINC-BUILTINC %s
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir 
%S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -ibuiltininc -nostdinc \
+// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN:   -DRESOURCE=%S/Inputs/resource_dir \
+// RUN:   --check-prefix=CHECK-NOSTDINC-BUILTINC %s
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target 

[clang] bd31243 - Fix more implicit conversions. Getting closer to having clang working with gcc 5 again

2020-01-28 Thread Benjamin Kramer via cfe-commits

Author: Benjamin Kramer
Date: 2020-01-29T02:57:59+01:00
New Revision: bd31243a34da8a045c642ddc77b27b0a45a9bf1e

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

LOG: Fix more implicit conversions. Getting closer to having clang working with 
gcc 5 again

Added: 


Modified: 
clang/lib/ARCMigrate/ObjCMT.cpp
clang/lib/CodeGen/CGObjCGNU.cpp
clang/lib/Frontend/InitHeaderSearch.cpp
clang/lib/Frontend/TextDiagnosticBuffer.cpp
llvm/tools/llvm-cov/CodeCoverage.cpp

Removed: 




diff  --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp
index 6ef0786826f8..51c4a460cc25 100644
--- a/clang/lib/ARCMigrate/ObjCMT.cpp
+++ b/clang/lib/ARCMigrate/ObjCMT.cpp
@@ -2269,7 +2269,7 @@ bool arcmt::getFileRemappingsFromFileList(
   continue;
 }
 
-remap.emplace_back(I->first->getName(), TempFile);
+remap.emplace_back(std::string(I->first->getName()), TempFile);
   }
 
   return hasErrorOccurred;

diff  --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp
index e93aca00e97d..61801e0e815b 100644
--- a/clang/lib/CodeGen/CGObjCGNU.cpp
+++ b/clang/lib/CodeGen/CGObjCGNU.cpp
@@ -1946,7 +1946,8 @@ class CGObjCGNUstep2 : public CGObjCGNUstep {
 
   if (SuperClass) {
 std::pair v{classStruct, 1};
-EarlyInitList.emplace_back(SuperClass->getName(), std::move(v));
+EarlyInitList.emplace_back(std::string(SuperClass->getName()),
+   std::move(v));
   }
 
 }

diff  --git a/clang/lib/Frontend/InitHeaderSearch.cpp 
b/clang/lib/Frontend/InitHeaderSearch.cpp
index 6050ea09a9ec..851f5a4cc05c 100644
--- a/clang/lib/Frontend/InitHeaderSearch.cpp
+++ b/clang/lib/Frontend/InitHeaderSearch.cpp
@@ -65,7 +65,7 @@ class InitHeaderSearch {
   /// AddSystemHeaderPrefix - Add the specified prefix to the system header
   /// prefix list.
   void AddSystemHeaderPrefix(StringRef Prefix, bool IsSystemHeader) {
-SystemHeaderPrefixes.emplace_back(Prefix, IsSystemHeader);
+SystemHeaderPrefixes.emplace_back(std::string(Prefix), IsSystemHeader);
   }
 
   /// AddGnuCPlusPlusIncludePaths - Add the necessary paths to support a gnu

diff  --git a/clang/lib/Frontend/TextDiagnosticBuffer.cpp 
b/clang/lib/Frontend/TextDiagnosticBuffer.cpp
index b2497f56cbcd..90f273e65f88 100644
--- a/clang/lib/Frontend/TextDiagnosticBuffer.cpp
+++ b/clang/lib/Frontend/TextDiagnosticBuffer.cpp
@@ -32,20 +32,20 @@ void 
TextDiagnosticBuffer::HandleDiagnostic(DiagnosticsEngine::Level Level,
  "Diagnostic not handled during diagnostic 
buffering!");
   case DiagnosticsEngine::Note:
 All.emplace_back(Level, Notes.size());
-Notes.emplace_back(Info.getLocation(), Buf.str());
+Notes.emplace_back(Info.getLocation(), std::string(Buf.str()));
 break;
   case DiagnosticsEngine::Warning:
 All.emplace_back(Level, Warnings.size());
-Warnings.emplace_back(Info.getLocation(), Buf.str());
+Warnings.emplace_back(Info.getLocation(), std::string(Buf.str()));
 break;
   case DiagnosticsEngine::Remark:
 All.emplace_back(Level, Remarks.size());
-Remarks.emplace_back(Info.getLocation(), Buf.str());
+Remarks.emplace_back(Info.getLocation(), std::string(Buf.str()));
 break;
   case DiagnosticsEngine::Error:
   case DiagnosticsEngine::Fatal:
 All.emplace_back(Level, Errors.size());
-Errors.emplace_back(Info.getLocation(), Buf.str());
+Errors.emplace_back(Info.getLocation(), std::string(Buf.str()));
 break;
   }
 }

diff  --git a/llvm/tools/llvm-cov/CodeCoverage.cpp 
b/llvm/tools/llvm-cov/CodeCoverage.cpp
index fe6bc1af..52e9958e92da 100644
--- a/llvm/tools/llvm-cov/CodeCoverage.cpp
+++ b/llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -245,7 +245,8 @@ CodeCoverageTool::getSourceFile(StringRef SourceFile) {
 error(EC.message(), SourceFile);
 return EC;
   }
-  LoadedSourceFiles.emplace_back(SourceFile, std::move(Buffer.get()));
+  LoadedSourceFiles.emplace_back(std::string(SourceFile),
+ std::move(Buffer.get()));
   return *LoadedSourceFiles.back().second;
 }
 



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


[PATCH] D73596: [CodeComplete] WIP member completion for concept-constrained type parameters

2020-01-28 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon check-circle color=green} Unit tests: pass. 62281 tests passed, 0 failed 
and 827 were skipped.

{icon times-circle color=red} clang-tidy: fail. clang-tidy found 0 errors and 7 
warnings 
.
 0 of them are added as review comments below (why? 
).

{icon check-circle color=green} clang-format: pass.

Build artifacts 
: 
diff.json 
,
 clang-tidy.txt 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 


//Pre-merge checks is in beta. Report issue 
.
 Please join beta  or enable 
it for your project 
.//


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73596



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


[PATCH] D73500: [driver] Add a -builtininc flag that lets Darwin driver include Clang builtin headers even with -nostdinc

2020-01-28 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

Should they use -nostdlibinc instead?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73500



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


[clang] bb39b52 - Fix conversions in clang and examples

2020-01-28 Thread Benjamin Kramer via cfe-commits

Author: Benjamin Kramer
Date: 2020-01-29T02:48:15+01:00
New Revision: bb39b52950e77e650fbdd86f7d5e4b89ff0aac4d

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

LOG: Fix conversions in clang and examples

Added: 


Modified: 
clang/lib/Basic/Module.cpp
clang/lib/Frontend/CompilerInvocation.cpp
llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp
llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp
llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h
llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp
llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h
llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp
llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h
llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp
llvm/examples/Kaleidoscope/Chapter8/toy.cpp
llvm/examples/Kaleidoscope/Chapter9/toy.cpp
mlir/examples/toy/Ch2/include/toy/Parser.h
mlir/examples/toy/Ch3/include/toy/Parser.h
mlir/examples/toy/Ch4/include/toy/Parser.h
mlir/examples/toy/Ch5/include/toy/Parser.h
mlir/examples/toy/Ch6/include/toy/Parser.h
mlir/examples/toy/Ch7/include/toy/Parser.h

Removed: 




diff  --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp
index 541431dbbe7d..92835c9aca7d 100644
--- a/clang/lib/Basic/Module.cpp
+++ b/clang/lib/Basic/Module.cpp
@@ -276,7 +276,7 @@ bool Module::directlyUses(const Module *Requested) const {
 void Module::addRequirement(StringRef Feature, bool RequiredState,
 const LangOptions ,
 const TargetInfo ) {
-  Requirements.push_back(Requirement(Feature, RequiredState));
+  Requirements.push_back(Requirement(std::string(Feature), RequiredState));
 
   // If this feature is currently available, we're done.
   if (hasFeature(Feature, LangOpts, Target) == RequiredState)

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 14cbf39cee45..a8dfd8a97c8c 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -340,7 +340,8 @@ static bool ParseAnalyzerArgs(AnalyzerOptions , 
ArgList ,
 SmallVector CheckersAndPackages;
 CheckerAndPackageList.split(CheckersAndPackages, ",");
 for (const StringRef  : CheckersAndPackages)
-  Opts.CheckersAndPackages.emplace_back(CheckerOrPackage, IsEnabled);
+  Opts.CheckersAndPackages.emplace_back(std::string(CheckerOrPackage),
+IsEnabled);
   }
 
   // Go through the analyzer configuration options.

diff  --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp 
b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp
index b4605bae4ed9..ad942d1e45e7 100644
--- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp
+++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp
@@ -727,7 +727,7 @@ Function *getFunction(std::string Name) {
 /// CreateEntryBlockAlloca - Create an alloca instruction in the entry block of
 /// the function.  This is used for mutable variables etc.
 static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction,
-  const std::string ) {
+  StringRef VarName) {
   IRBuilder<> TmpB(>getEntryBlock(),
TheFunction->getEntryBlock().begin());
   return TmpB.CreateAlloca(Type::getDoubleTy(*TheContext), nullptr, VarName);
@@ -1076,7 +1076,7 @@ Function *FunctionAST::codegen() {
 Builder->CreateStore(, Alloca);
 
 // Add arguments to variable symbol table.
-NamedValues[Arg.getName()] = Alloca;
+NamedValues[std::string(Arg.getName())] = Alloca;
   }
 
   if (Value *RetVal = Body->codegen()) {

diff  --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp 
b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp
index 743d50829dc3..136ae9636c56 100644
--- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp
+++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp
@@ -727,7 +727,7 @@ Function *getFunction(std::string Name) {
 /// CreateEntryBlockAlloca - Create an alloca instruction in the entry block of
 /// the function.  This is used for mutable variables etc.
 static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction,
-  const std::string ) {
+  StringRef VarName) {
   IRBuilder<> TmpB(>getEntryBlock(),
TheFunction->getEntryBlock().begin());
   return TmpB.CreateAlloca(Type::getDoubleTy(*TheContext), nullptr, VarName);
@@ -1076,7 +1076,7 @@ Function *FunctionAST::codegen() {
 Builder->CreateStore(, Alloca);
 
 

[PATCH] D73500: [driver] Add a -builtininc flag that lets Darwin driver include Clang builtin headers even with -nostdinc

2020-01-28 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith accepted this revision.
dexonsmith added a comment.
This revision is now accepted and ready to land.

Okay, LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73500



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


[PATCH] D73570: [FPEnv][X86] Platform-specific builtin constrained FP enablement

2020-01-28 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: clang/test/CodeGen/fma-builtins-constrained.c:4
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin 
-target-feature +fma -S -o - | FileCheck --check-prefix=COMMON 
--check-prefix=CHECK-ASM %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin 
-target-feature +fma -ffp-exception-behavior=strict -S -o - | FileCheck 
--check-prefix=COMMON --check-prefix=CHECK-ASM %s
+

Technically the fmsub/fnmsub/fnmadd assembly requires optimizations to be 
enabled. If it appears to work without optimizations its only because fast-isel 
fell back to SelectionDAG and picked up optimizations due to that. Not 
something that should be relied on.



Comment at: clang/test/CodeGen/fma-builtins-constrained.c:6
+
+// FIXME: Several of these tests are broken when constrained.
+

Is this just referring to the FIXME-CHECK-ASM?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73570



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


[PATCH] D73596: [CodeComplete] WIP member completion for concept-constrained type parameters

2020-01-28 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision.
Herald added subscribers: cfe-commits, usaxena95, kadircet, mgrang, 
ilya-biryukov.
Herald added a project: clang.

see https://github.com/clangd/clangd/issues/261


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73596

Files:
  clang/include/clang/Sema/Scope.h
  clang/lib/Sema/SemaCodeComplete.cpp

Index: clang/lib/Sema/SemaCodeComplete.cpp
===
--- clang/lib/Sema/SemaCodeComplete.cpp
+++ clang/lib/Sema/SemaCodeComplete.cpp
@@ -16,8 +16,11 @@
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
+#include "clang/AST/ExprConcepts.h"
 #include "clang/AST/ExprObjC.h"
+#include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/QualTypeNames.h"
+#include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/AST/Type.h"
 #include "clang/Basic/CharInfo.h"
 #include "clang/Basic/Specifiers.h"
@@ -4746,6 +4749,281 @@
   return nullptr;
 }
 
+namespace {
+
+// Returns the DeclContext immediately enclosed by the template parameter scope.
+// For primary templates, this is the templated (e.g.) CXXRecordDecl.
+// For specializations, this is e.g. ClassTemplatPartialSpecializationDecl.
+DeclContext *getTemplatedEntity(const TemplateTypeParmDecl *D, Scope *S) {
+  if (D == nullptr)
+return nullptr;
+  Scope *Inner = nullptr;
+  while (S) {
+if (S->isTemplateParamScope() && S->isDeclScope(D))
+  return Inner->getEntity();
+Inner = S;
+S = S->getParent();
+  }
+  return nullptr;
+}
+
+llvm::SmallVector
+constraintsForTemplatedEntity(DeclContext *E) {
+  llvm::SmallVector Result;
+  if (E == nullptr)
+return Result;
+  llvm::cast(E)->dump();
+  // Primary templates can have constraints.
+  if (const auto *TD = llvm::cast(E)->getDescribedTemplate())
+TD->getAssociatedConstraints(Result);
+  // Partial specializations may have constraints.
+  if (const auto *CTPSD =
+  llvm::dyn_cast(E))
+CTPSD->getAssociatedConstraints(Result);
+  if (const auto *VTPSD =
+  llvm::dyn_cast(E))
+VTPSD->getAssociatedConstraints(Result);
+  return Result;
+}
+
+// Describes a likely member of a type, inferred by concept constraints.
+// Offered as a code completion for T. T-> and T:: contexts.
+struct ConceptMemberResult {
+  const IdentifierInfo *Name = nullptr;
+  llvm::Optional> ArgTypes; // For functions.
+  enum ResultKind {
+Function,
+Variable,
+Type,
+  } Kind = Variable;
+  enum AccessType {
+Dot,
+Arrow,
+Colons,
+  } Operator = Dot;
+
+  // For now we simply return these results as "pattern" strings.
+  CodeCompletionString *render(Sema , CodeCompletionAllocator ,
+   CodeCompletionTUInfo ) const {
+CodeCompletionBuilder B(Alloc, Info);
+B.AddTypedTextChunk(Alloc.CopyString(Name->getName()));
+if (ArgTypes) {
+  B.AddChunk(clang::CodeCompletionString::CK_LeftParen);
+  bool First = true;
+  for (QualType Arg : *ArgTypes) {
+if (First)
+  First = false;
+else {
+  B.AddChunk(clang::CodeCompletionString::CK_Comma);
+  B.AddChunk(clang::CodeCompletionString::CK_HorizontalSpace);
+}
+B.AddPlaceholderChunk(
+Alloc.CopyString(Arg.getAsString(getCompletionPrintingPolicy(S;
+  }
+  B.AddChunk(clang::CodeCompletionString::CK_RightParen);
+}
+return B.TakeString();
+  }
+};
+
+// Attempts to determine likely members of a concept-constrained type T
+// by examining the constraint expressions.
+//
+// For example, given:
+//   template  concept X = requires (T t) { t.foo(); };
+//   template  void foo(U u) { u.^ }
+// We should offer the completion 'foo()':
+// - u has type U
+// - so X holds
+// - X requires t.foo() to be valid, where t has type T.
+//
+// The design is very simple: we walk down each constraint looking for
+// expressions of the form T.foo().
+// If we're extra lucky, the return type is specified.
+// We don't do any clever handling of && or || in constraint expressions.
+//
+// FIXME: it some of this machinery could be used for non-concept tparms too,
+// enabling completion for type parameters based on other uses of that param.
+class ConceptMembers {
+  llvm::DenseMap Results;
+
+public:
+  ConceptMembers(const TemplateTypeParmType , Scope *S) {
+auto *TemplatedEntity = getTemplatedEntity(BaseType.getDecl(), S);
+for (const Expr *E : constraintsForTemplatedEntity(TemplatedEntity))
+  believe(E, );
+  }
+
+  std::vector results() {
+std::vector Results;
+for (const auto  : this->Results)
+  Results.push_back(E.second);
+llvm::sort(Results,
+   [](const ConceptMemberResult , const ConceptMemberResult ) {
+ return L.Name->getName() < R.Name->getName();
+   });
+return Results;
+  }
+
+  // Infer members of T, given that the expression E (dependent on T) is true.
+  void believe(const 

[clang] 2b36e85 - GCC5 buildbot made it to clang. Fix implicit conversions it found.

2020-01-28 Thread Benjamin Kramer via cfe-commits

Author: Benjamin Kramer
Date: 2020-01-29T02:19:49+01:00
New Revision: 2b36e85542d24161ff4460cb4f0da635e9f5ab62

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

LOG: GCC5 buildbot made it to clang. Fix implicit conversions it found.

Added: 


Modified: 
clang/include/clang/Lex/PreprocessorOptions.h
clang/lib/Basic/DiagnosticIDs.cpp

Removed: 




diff  --git a/clang/include/clang/Lex/PreprocessorOptions.h 
b/clang/include/clang/Lex/PreprocessorOptions.h
index abffbd03c3b4..c281cd51e266 100644
--- a/clang/include/clang/Lex/PreprocessorOptions.h
+++ b/clang/include/clang/Lex/PreprocessorOptions.h
@@ -192,15 +192,19 @@ class PreprocessorOptions {
 public:
   PreprocessorOptions() : PrecompiledPreambleBytes(0, false) {}
 
-  void addMacroDef(StringRef Name) { Macros.emplace_back(Name, false); }
-  void addMacroUndef(StringRef Name) { Macros.emplace_back(Name, true); }
+  void addMacroDef(StringRef Name) {
+Macros.emplace_back(std::string(Name), false);
+  }
+  void addMacroUndef(StringRef Name) {
+Macros.emplace_back(std::string(Name), true);
+  }
 
   void addRemappedFile(StringRef From, StringRef To) {
-RemappedFiles.emplace_back(From, To);
+RemappedFiles.emplace_back(std::string(From), std::string(To));
   }
 
   void addRemappedFile(StringRef From, llvm::MemoryBuffer *To) {
-RemappedFileBuffers.emplace_back(From, To);
+RemappedFileBuffers.emplace_back(std::string(From), To);
   }
 
   void clearRemappedFiles() {

diff  --git a/clang/lib/Basic/DiagnosticIDs.cpp 
b/clang/lib/Basic/DiagnosticIDs.cpp
index e30e3753d193..6f8b5440a4f3 100644
--- a/clang/lib/Basic/DiagnosticIDs.cpp
+++ b/clang/lib/Basic/DiagnosticIDs.cpp
@@ -289,7 +289,7 @@ namespace clang {
 
   unsigned getOrCreateDiagID(DiagnosticIDs::Level L, StringRef Message,
  DiagnosticIDs ) {
-DiagDesc D(L, Message);
+DiagDesc D(L, std::string(Message));
 // Check to see if it already exists.
 std::map::iterator I = DiagIDs.lower_bound(D);
 if (I != DiagIDs.end() && I->first == D)



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


[PATCH] D73500: [driver] Add a -builtininc flag that lets Darwin driver include Clang builtin headers even with -nostdinc

2020-01-28 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman updated this revision to Diff 241029.
arphaman marked 2 inline comments as done.
arphaman added a comment.

Add suggested changes. The `-ibuiltininc` flag now interacts with 
`-nobuiltininc` as well, i.e. it's cancelled out if `-nobuiltininc` comes after 
it, and vice-versa.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73500

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Darwin.cpp
  clang/test/Driver/darwin-header-search-system.cpp

Index: clang/test/Driver/darwin-header-search-system.cpp
===
--- clang/test/Driver/darwin-header-search-system.cpp
+++ clang/test/Driver/darwin-header-search-system.cpp
@@ -101,3 +101,77 @@
 // CHECK-NOSYSROOT: "-internal-isystem" "/usr/local/include"
 // CHECK-NOSYSROOT: "-internal-isystem" "[[RESOURCE]]/include"
 // CHECK-NOSYSROOT: "-internal-externc-isystem" "/usr/include"
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -nostdinc -ibuiltininc \
+// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN:   -DRESOURCE=%S/Inputs/resource_dir \
+// RUN:   --check-prefix=CHECK-NOSTDINC-BUILTINC %s
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -ibuiltininc -nostdinc \
+// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN:   -DRESOURCE=%S/Inputs/resource_dir \
+// RUN:   --check-prefix=CHECK-NOSTDINC-BUILTINC %s
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -nostdinc -nobuiltininc -ibuiltininc \
+// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN:   -DRESOURCE=%S/Inputs/resource_dir \
+// RUN:   --check-prefix=CHECK-NOSTDINC-BUILTINC %s
+// CHECK-NOSTDINC-BUILTINC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-NOSTDINC-BUILTINC-NOT: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
+// CHECK-NOSTDINC-BUILTINC: "-internal-isystem" "[[RESOURCE]]/include"
+// CHECK-NOSTDINC-BUILTINC-NOT: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -nobuiltininc -ibuiltininc \
+// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN:   -DRESOURCE=%S/Inputs/resource_dir \
+// RUN:   --check-prefix=CHECK-NOBUILTININC-BUILTINC %s
+// CHECK-NOBUILTININC-BUILTINC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-NOBUILTININC-BUILTINC: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
+// CHECK-NOBUILTININC-BUILTINC: "-internal-isystem" "[[RESOURCE]]/include"
+// CHECK-NOBUILTININC-BUILTINC: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN: -nostdinc -ibuiltininc -nobuiltininc \
+// RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \
+// RUN:   -DRESOURCE=%S/Inputs/resource_dir \
+// RUN:   --check-prefix=CHECK-NOSTDINC-NO-BUILTINC %s
+// CHECK-NOSTDINC-NO-BUILTINC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-NOSTDINC-NO-BUILTINC-NOT: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
+// CHECK-NOSTDINC-NO-BUILTINC-NOT: "-internal-isystem" "[[RESOURCE]]/include"
+// CHECK-NOSTDINC-NO-BUILTINC-NOT: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-apple-darwin \
+// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
+// RUN: 

[clang-tools-extra] 9a5c448 - [clangd] Fix null check in FindTarget.

2020-01-28 Thread Sam McCall via cfe-commits

Author: Sam McCall
Date: 2020-01-29T02:01:42+01:00
New Revision: 9a5c448a31bacc08e73fcae4636094f9b6e2be6a

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

LOG: [clangd] Fix null check in FindTarget.

I've hit this stack trace a few times but don't have a good reproducer.
The code is unsafe by inspection, though.

Added: 


Modified: 
clang-tools-extra/clangd/FindTarget.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/FindTarget.cpp 
b/clang-tools-extra/clangd/FindTarget.cpp
index 239258685cde..13e4819bec9b 100644
--- a/clang-tools-extra/clangd/FindTarget.cpp
+++ b/clang-tools-extra/clangd/FindTarget.cpp
@@ -231,7 +231,7 @@ struct TargetFinder {
   }
 
   void add(const Decl *Dcl, RelSet Flags) {
-const NamedDecl *D = llvm::dyn_cast(Dcl);
+const NamedDecl *D = llvm::dyn_cast_or_null(Dcl);
 if (!D)
   return;
 debug(*D, Flags);



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


[clang] 735f90f - Fix one round of implicit conversions found by g++5.

2020-01-28 Thread Benjamin Kramer via cfe-commits

Author: Benjamin Kramer
Date: 2020-01-29T01:52:48+01:00
New Revision: 735f90fe42e55935035d842752e01361b5216c11

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

LOG: Fix one round of implicit conversions found by g++5.

Added: 


Modified: 
clang/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp
clang/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp
clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
llvm/lib/TextAPI/MachO/InterfaceFile.cpp
llvm/tools/gold/gold-plugin.cpp

Removed: 




diff  --git 
a/clang/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp 
b/clang/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp
index a25ab116a75d..15671a99a3fc 100644
--- a/clang/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp
+++ b/clang/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp
@@ -66,7 +66,7 @@ void 
clang::EmitClangCommentHTMLNamedCharacterReferences(RecordKeeper ,
 }
 CLiteral.append(";");
 
-StringMatcher::StringPair Match(Spelling, CLiteral.str());
+StringMatcher::StringPair Match(Spelling, std::string(CLiteral.str()));
 NameToUTF8.push_back(Match);
   }
 

diff  --git a/clang/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp 
b/clang/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp
index 1c15029bbc41..78bbbd1cba57 100644
--- a/clang/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp
+++ b/clang/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp
@@ -23,7 +23,8 @@ void clang::EmitClangCommentHTMLTags(RecordKeeper , 
raw_ostream ) {
   std::vector Tags = Records.getAllDerivedDefinitions("Tag");
   std::vector Matches;
   for (Record *Tag : Tags) {
-Matches.emplace_back(Tag->getValueAsString("Spelling"), "return true;");
+Matches.emplace_back(std::string(Tag->getValueAsString("Spelling")),
+ "return true;");
   }
 
   emitSourceFileHeader("HTML tag name matcher", OS);

diff  --git a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp 
b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
index 41d33b550680..85933e6d3bd3 100644
--- a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
+++ b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
@@ -597,7 +597,8 @@ void BuiltinNameEmitter::EmitStringMatcher() {
   SS << "return std::make_pair(" << CumulativeIndex << ", " << Ovl.size()
  << ");";
   SS.flush();
-  ValidBuiltins.push_back(StringMatcher::StringPair(FctName, RetStmt));
+  ValidBuiltins.push_back(
+  StringMatcher::StringPair(std::string(FctName), RetStmt));
 }
 CumulativeIndex += Ovl.size();
   }

diff  --git a/llvm/lib/TextAPI/MachO/InterfaceFile.cpp 
b/llvm/lib/TextAPI/MachO/InterfaceFile.cpp
index 9f084560d5fe..aae5c231a62a 100644
--- a/llvm/lib/TextAPI/MachO/InterfaceFile.cpp
+++ b/llvm/lib/TextAPI/MachO/InterfaceFile.cpp
@@ -67,7 +67,7 @@ void InterfaceFile::addParentUmbrella(const Target _, 
StringRef Parent) {
 return;
   }
 
-  ParentUmbrellas.emplace(Iter, Target_, Parent);
+  ParentUmbrellas.emplace(Iter, Target_, std::string(Parent));
   return;
 }
 

diff  --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp
index f5d47d68a51d..d0d837fb0c79 100644
--- a/llvm/tools/gold/gold-plugin.cpp
+++ b/llvm/tools/gold/gold-plugin.cpp
@@ -279,11 +279,11 @@ namespace options {
 } else if (opt == "disable-verify") {
   DisableVerify = true;
 } else if (opt.startswith("sample-profile=")) {
-  sample_profile = opt.substr(strlen("sample-profile="));
+  sample_profile = std::string(opt.substr(strlen("sample-profile=")));
 } else if (opt == "cs-profile-generate") {
   cs_pgo_gen = true;
 } else if (opt.startswith("cs-profile-path=")) {
-  cs_profile_path = opt.substr(strlen("cs-profile-path="));
+  cs_profile_path = std::string(opt.substr(strlen("cs-profile-path=")));
 } else if (opt == "new-pass-manager") {
   new_pass_manager = true;
 } else if (opt == "debug-pass-manager") {
@@ -291,17 +291,18 @@ namespace options {
 } else if (opt == "whole-program-visibility") {
   whole_program_visibility = true;
 } else if (opt.startswith("dwo_dir=")) {
-  dwo_dir = opt.substr(strlen("dwo_dir="));
+  dwo_dir = std::string(opt.substr(strlen("dwo_dir=")));
 } else if (opt.startswith("opt-remarks-filename=")) {
-  RemarksFilename = opt.substr(strlen("opt-remarks-filename="));
+  RemarksFilename =
+  std::string(opt.substr(strlen("opt-remarks-filename=")));
 } else if (opt.startswith("opt-remarks-passes=")) {
-  RemarksPasses = opt.substr(strlen("opt-remarks-passes="));
+  RemarksPasses = std::string(opt.substr(strlen("opt-remarks-passes=")));
 } else if (opt == "opt-remarks-with-hotness") {
 

[clang-tools-extra] 0eb64fc - Fix clangd-xpc-test-client build after 777180a32b6107

2020-01-28 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2020-01-28T19:48:31-05:00
New Revision: 0eb64fcb89a5b236962b344cc506873ebbf734de

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

LOG: Fix clangd-xpc-test-client build after 777180a32b6107

Added: 


Modified: 
clang-tools-extra/clangd/xpc/test-client/ClangdXPCTestClient.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/xpc/test-client/ClangdXPCTestClient.cpp 
b/clang-tools-extra/clangd/xpc/test-client/ClangdXPCTestClient.cpp
index 1cddd06d1dd8..908544fec5f6 100644
--- a/clang-tools-extra/clangd/xpc/test-client/ClangdXPCTestClient.cpp
+++ b/clang-tools-extra/clangd/xpc/test-client/ClangdXPCTestClient.cpp
@@ -23,7 +23,7 @@ typedef const char 
*(*clangd_xpc_get_bundle_identifier_t)(void);
 using namespace llvm;
 using namespace clang;
 
-std::string getLibraryPath() {
+static std::string getLibraryPath() {
   Dl_info info;
   if (dladdr((void *)(uintptr_t)getLibraryPath, ) == 0)
 llvm_unreachable("Call to dladdr() failed");
@@ -32,7 +32,7 @@ std::string getLibraryPath() {
   llvm::sys::path::parent_path(info.dli_fname));
   llvm::sys::path::append(LibClangPath, "lib", "ClangdXPC.framework",
   "ClangdXPC");
-  return LibClangPath.str();
+  return std::string(LibClangPath.str());
 }
 
 static void dumpXPCObject(xpc_object_t Object, llvm::raw_ostream ) {



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


[PATCH] D73437: [mlir][spirv] Convert linalg.generic for reduction to SPIR-V ops

2020-01-28 Thread Mahesh Ravishankar via Phabricator via cfe-commits
mravishankar marked an inline comment as done.
mravishankar added inline comments.



Comment at: mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRV.cpp:73
+
+  using mlir::matchers::m_Val;
+  auto a = m_Val(block.getArgument(0));

antiagainst wrote:
> mravishankar wrote:
> > I feel like this is not required. If the linalg.generic operation says this 
> > is a reduction, we should not be checking the region to verify that it is. 
> > linalg as a contract is guaranteeing this is a reduction.
> I'm not sure I get your idea correctly; but this is checking we are doing the 
> expected kind of reduction (`BinaryOp`). 
That is what I am not sure we need to do. You have already checked the generic 
op is a 1D loop with reduction iterator type. So the body of the generic op is 
assumed to be a reduction right, i.e. a "binaryOp". Here you are checking 
whether its an operation which takes two operands, but not necessarily a binary 
operation that can be used for reduction. In some sense you dont need to check 
that since the generic op description already told you to assume that the 
region of the op represents a binary op that can be used for reduction (this is 
based on my understanding of "reduction" loops in linalg, but I need to double 
check).




Comment at: mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRV.cpp:182
+  // Perform the group reduction operation.
+  Value groupOperation = rewriter.create(
+  loc, originalInputType.getElementType(), spirv::Scope::Subgroup,

antiagainst wrote:
> mravishankar wrote:
> > This is hard-wiring to IAdd. We probably need to structure this 
> > differently. We need to have a pattern to lower the linalg.generic with 
> > reduction iterator into the kernel generated here, and then lower the 
> > operations within the region separately.
> It was intentional to only support IAdd. I've re-structured this a bit so 
> it's extensible to other binary op kinds.
The way I see this structured is

1) You check the "structure" of the linalg.generic op to see if it is a 1D 
reduction. You assume that the body of the generic op represents a binary 
operation that can be used for the reduction.
2) You write a separate pattern that converts the operations of the body itself 
into the spirv::GroupNonUniform*Op.

The dialect conversion will first convert the generic op, and then it will 
attempt to convert the body of the op. The way this is strucutred, it can only 
handle straight-forward binary operations. THere could be more complicated 
operations in the region of a generic op that implements the reduction, which 
would be hard to incorporate in this approach.

With your updated changes, it is easy to extend to other ops, but I think a 
more general solution is needed where we are not constrained in handling just 
simple reductions. It might need some more careful design though, which I dont 
have a full picture of right now. So for now this OK, but please leave a TODO 
to say something like "handle more general reductions".


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73437



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


[clang-tools-extra] 95cb22d - Fix xpc build after 777180a32b6107

2020-01-28 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2020-01-28T19:35:11-05:00
New Revision: 95cb22d0f9f3b01703f01baacec3ea6c6d5df22b

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

LOG: Fix xpc build after 777180a32b6107

Added: 


Modified: 
clang-tools-extra/clangd/xpc/XPCTransport.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/xpc/XPCTransport.cpp 
b/clang-tools-extra/clangd/xpc/XPCTransport.cpp
index dd4bb7028da9..02c1b083701e 100644
--- a/clang-tools-extra/clangd/xpc/XPCTransport.cpp
+++ b/clang-tools-extra/clangd/xpc/XPCTransport.cpp
@@ -37,7 +37,8 @@ json::Object encodeError(Error E) {
 }
 
 Error decodeError(const json::Object ) {
-  std::string Msg = O.getString("message").getValueOr("Unspecified error");
+  std::string Msg =
+  std::string(O.getString("message").getValueOr("Unspecified error"));
   if (auto Code = O.getInteger("code"))
 return make_error(std::move(Msg), ErrorCode(*Code));
   return make_error(std::move(Msg), inconvertibleErrorCode());



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


[PATCH] D57265: [PM/CC1] Add -f[no-]split-cold-code CC1 options to toggle splitting

2020-01-28 Thread Vedant Kumar via Phabricator via cfe-commits
vsk updated this revision to Diff 241019.
vsk marked 2 inline comments as done.
vsk edited the summary of this revision.
vsk added a comment.

Rebase, address Florian's feedback.

Apologies for the delay here. I haven't had time to push this forward, but I 
have also been waiting to get an additional lgtm specifically for the 
PassManager changes. My compile-time measurements are a year old (I'll work on 
getting fresh numbers), but as I remember the change was in the noise.


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

https://reviews.llvm.org/D57265

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/DiagnosticFrontendKinds.td
  clang/include/clang/Driver/CC1Options.td
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/split-cold-code.c
  clang/test/Frontend/split-cold-code.c
  llvm/include/llvm/Transforms/IPO/HotColdSplitting.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Transforms/IPO/HotColdSplitting.cpp
  llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
  llvm/test/Other/X86/lto-hot-cold-split.ll
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-pgo.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/opt-O2-pipeline.ll
  llvm/test/Other/opt-O3-pipeline.ll
  llvm/test/Other/opt-Os-pipeline.ll
  llvm/test/Other/opt-hot-cold-split.ll
  llvm/test/Other/pass-pipelines.ll
  llvm/test/Transforms/CodeExtractor/extract-assume.ll
  llvm/test/Transforms/HotColdSplit/X86/do-not-split.ll
  llvm/test/Transforms/HotColdSplit/addr-taken.ll
  llvm/test/Transforms/HotColdSplit/apply-noreturn-bonus.ll
  llvm/test/Transforms/HotColdSplit/apply-penalty-for-inputs.ll
  llvm/test/Transforms/HotColdSplit/apply-penalty-for-outputs.ll
  llvm/test/Transforms/HotColdSplit/apply-successor-penalty.ll
  llvm/test/Transforms/HotColdSplit/assumption-cache-invalidation.ll
  llvm/test/Transforms/HotColdSplit/coldentrycount.ll
  llvm/test/Transforms/HotColdSplit/delete-use-without-def-dbg-val.ll
  llvm/test/Transforms/HotColdSplit/duplicate-phi-preds-crash.ll
  llvm/test/Transforms/HotColdSplit/eh-pads.ll
  llvm/test/Transforms/HotColdSplit/eh-typeid-for.ll
  llvm/test/Transforms/HotColdSplit/forward-dfs-reaches-marked-block.ll
  llvm/test/Transforms/HotColdSplit/lifetime-markers-on-inputs-1.ll
  llvm/test/Transforms/HotColdSplit/lifetime-markers-on-inputs-2.ll
  llvm/test/Transforms/HotColdSplit/mark-the-whole-func-cold.ll
  llvm/test/Transforms/HotColdSplit/minsize.ll
  llvm/test/Transforms/HotColdSplit/multiple-exits.ll
  llvm/test/Transforms/HotColdSplit/noreturn.ll
  llvm/test/Transforms/HotColdSplit/outline-cold-asm.ll
  llvm/test/Transforms/HotColdSplit/outline-disjoint-diamonds.ll
  llvm/test/Transforms/HotColdSplit/outline-if-then-else.ll
  llvm/test/Transforms/HotColdSplit/outline-multiple-entry-region.ll
  llvm/test/Transforms/HotColdSplit/outline-while-loop.ll
  llvm/test/Transforms/HotColdSplit/phi-with-distinct-outlined-values.ll
  llvm/test/Transforms/HotColdSplit/region-overlap.ll
  llvm/test/Transforms/HotColdSplit/resume.ll
  llvm/test/Transforms/HotColdSplit/retain-section.ll
  llvm/test/Transforms/HotColdSplit/split-cold-2.ll
  llvm/test/Transforms/HotColdSplit/split-out-dbg-label.ll
  llvm/test/Transforms/HotColdSplit/split-out-dbg-val-of-arg.ll
  llvm/test/Transforms/HotColdSplit/split-phis-in-exit-blocks.ll
  llvm/test/Transforms/HotColdSplit/succ-block-with-self-edge.ll
  llvm/test/Transforms/HotColdSplit/swifterror.ll
  llvm/test/Transforms/HotColdSplit/transfer-debug-info.ll
  llvm/test/Transforms/HotColdSplit/unwind.ll
  llvm/test/Transforms/HotColdSplit/update-split-loop-metadata.ll

Index: llvm/test/Transforms/HotColdSplit/update-split-loop-metadata.ll
===
--- llvm/test/Transforms/HotColdSplit/update-split-loop-metadata.ll
+++ llvm/test/Transforms/HotColdSplit/update-split-loop-metadata.ll
@@ -14,7 +14,7 @@
 ; CHECK: [[LOOP_MD]] = distinct !{[[LOOP_MD]], [[LINE:![0-9]+]], [[LINE]]}
 ; CHECK: [[LINE]] = !DILocation(line: 1, column: 1, scope: [[SCOPE]])
 
-define void @basic(i32* %p, i32 %k) !dbg !6 {
+define void @basic(i32* %p, i32 %k) "hot-cold-split" !dbg !6 {
 entry:
   %cmp3 = icmp slt i32 0, %k
   br i1 %cmp3, label %for.body.lr.ph, label %for.end
Index: llvm/test/Transforms/HotColdSplit/unwind.ll
===
--- llvm/test/Transforms/HotColdSplit/unwind.ll
+++ llvm/test/Transforms/HotColdSplit/unwind.ll
@@ -11,7 +11,7 @@
 
 ; CHECK-NOT: noreturn
 
-define i32 @foo() personality i8 0 {
+define i32 @foo() "hot-cold-split" personality i8 0 {
 entry:
   invoke void @llvm.donothing() to label %normal unwind label %exception
 
Index: llvm/test/Transforms/HotColdSplit/transfer-debug-info.ll

[PATCH] D73562: [ASTMatchers] Add hasPlacementArg and hasAnyPlacementArg traversal matcher for CXXNewExpr

2020-01-28 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon times-circle color=red} Unit tests: fail. 62276 tests passed, 1 failed 
and 827 were skipped.

  failed: Clang.CodeGenOpenCL/amdgpu-features.cl

{icon check-circle color=green} clang-tidy: pass.

{icon check-circle color=green} clang-format: pass.

Build artifacts 
: 
diff.json 
,
 clang-tidy.txt 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 


//Pre-merge checks is in beta. Report issue 
.
 Please join beta  or enable 
it for your project 
.//


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73562



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


[clang] ddf77f1 - One more batch of things found by g++ 6

2020-01-28 Thread Benjamin Kramer via cfe-commits

Author: Benjamin Kramer
Date: 2020-01-29T00:50:34+01:00
New Revision: ddf77f10a301d04ab47ede3bed596b21cda44794

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

LOG: One more batch of things found by g++ 6

Added: 


Modified: 
clang/tools/driver/cc1as_main.cpp
clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp
llvm/lib/DebugInfo/Symbolize/Symbolize.cpp

Removed: 




diff  --git a/clang/tools/driver/cc1as_main.cpp 
b/clang/tools/driver/cc1as_main.cpp
index 87ba86758e5c..ce390b9f3b17 100644
--- a/clang/tools/driver/cc1as_main.cpp
+++ b/clang/tools/driver/cc1as_main.cpp
@@ -245,8 +245,11 @@ bool 
AssemblerInvocation::CreateFromArgs(AssemblerInvocation ,
   std::string(Args.getLastArgValue(OPT_fdebug_compilation_dir));
   Opts.MainFileName = std::string(Args.getLastArgValue(OPT_main_file_name));
 
-  for (const auto  : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ))
-Opts.DebugPrefixMap.insert(StringRef(Arg).split('='));
+  for (const auto  : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ)) {
+auto Split = StringRef(Arg).split('=');
+Opts.DebugPrefixMap.insert(
+{std::string(Split.first), std::string(Split.second)});
+  }
 
   // Frontend Options
   if (Args.hasArg(OPT_INPUT)) {

diff  --git a/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp 
b/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp
index d98e3195a74d..41ef0d848963 100644
--- a/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp
+++ b/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp
@@ -28,7 +28,7 @@ class MockSema : public Parser::Sema {
 // 'stmt()' to be all the same matcher.
 // Use a more complex expression to prevent that.
 ast_matchers::internal::Matcher M = stmt(stmt(), stmt());
-ExpectedMatchers.insert(std::make_pair(MatcherName, M));
+ExpectedMatchers.insert(std::make_pair(std::string(MatcherName), M));
 return M.getID().second;
   }
 

diff  --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp 
b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
index ed6f9088bb4d..d0948fd9ab8c 100644
--- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
@@ -511,8 +511,8 @@ LLVMSymbolizer::createModuleInfo(const ObjectFile *Obj,
   std::unique_ptr SymMod;
   if (InfoOrErr)
 SymMod = std::move(*InfoOrErr);
-  auto InsertResult =
-  Modules.insert(std::make_pair(ModuleName, std::move(SymMod)));
+  auto InsertResult = Modules.insert(
+  std::make_pair(std::string(ModuleName), std::move(SymMod)));
   assert(InsertResult.second);
   if (std::error_code EC = InfoOrErr.getError())
 return errorCodeToError(EC);



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


[clang] 0d401fa - Fix a couple more implicit conversions that Clang doesn't diagnose.

2020-01-28 Thread Benjamin Kramer via cfe-commits

Author: Benjamin Kramer
Date: 2020-01-29T00:42:56+01:00
New Revision: 0d401fa36b532b7d766fd51368b9afb88ad46d1a

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

LOG: Fix a couple more implicit conversions that Clang doesn't diagnose.

Added: 


Modified: 
clang/lib/Frontend/CompilerInvocation.cpp
llvm/utils/TableGen/CodeGenDAGPatterns.cpp

Removed: 




diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 194cbd32fc8d..14cbf39cee45 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -779,8 +779,11 @@ static bool ParseCodeGenArgs(CodeGenOptions , ArgList 
, InputKind IK,
   Opts.ForceDwarfFrameSection =
   Args.hasFlag(OPT_fforce_dwarf_frame, OPT_fno_force_dwarf_frame, false);
 
-  for (const auto  : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ))
-Opts.DebugPrefixMap.insert(StringRef(Arg).split('='));
+  for (const auto  : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ)) {
+auto Split = StringRef(Arg).split('=');
+Opts.DebugPrefixMap.insert(
+{std::string(Split.first), std::string(Split.second)});
+  }
 
   if (const Arg *A =
   Args.getLastArg(OPT_emit_llvm_uselists, OPT_no_emit_llvm_uselists))
@@ -2112,8 +2115,11 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions 
, ArgList ,
   // Only the -fmodule-file== form.
   for (const auto *A : Args.filtered(OPT_fmodule_file)) {
 StringRef Val = A->getValue();
-if (Val.find('=') != StringRef::npos)
-  Opts.PrebuiltModuleFiles.insert(Val.split('='));
+if (Val.find('=') != StringRef::npos){
+  auto Split = Val.split('=');
+  Opts.PrebuiltModuleFiles.insert(
+  {std::string(Split.first), std::string(Split.second)});
+}
   }
   for (const auto *A : Args.filtered(OPT_fprebuilt_module_path))
 Opts.AddPrebuiltModulePath(A->getValue());
@@ -3381,8 +3387,11 @@ static void ParsePreprocessorArgs(PreprocessorOptions 
, ArgList ,
   for (const auto *A : Args.filtered(OPT_error_on_deserialized_pch_decl))
 Opts.DeserializedPCHDeclsToErrorOn.insert(A->getValue());
 
-  for (const auto  : Args.getAllArgValues(OPT_fmacro_prefix_map_EQ))
-Opts.MacroPrefixMap.insert(StringRef(A).split('='));
+  for (const auto  : Args.getAllArgValues(OPT_fmacro_prefix_map_EQ)) {
+auto Split = StringRef(A).split('=');
+Opts.MacroPrefixMap.insert(
+{std::string(Split.first), std::string(Split.second)});
+  }
 
   if (const Arg *A = Args.getLastArg(OPT_preamble_bytes_EQ)) {
 StringRef Value(A->getValue());

diff  --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp 
b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index 043cb389ad8f..703cd515a071 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -3108,7 +3108,8 @@ void CodeGenDAGPatterns::ParseNodeTransforms() {
 Record *XFormNode = Xforms.back();
 Record *SDNode = XFormNode->getValueAsDef("Opcode");
 StringRef Code = XFormNode->getValueAsString("XFormFunction");
-SDNodeXForms.insert(std::make_pair(XFormNode, NodeXForm(SDNode, Code)));
+SDNodeXForms.insert(
+std::make_pair(XFormNode, NodeXForm(SDNode, std::string(Code;
 
 Xforms.pop_back();
   }



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


[PATCH] D73567: [NFC] Removing experimental designation for ninja in docs.

2020-01-28 Thread Nate Voorhies via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG84118fac3abe: [NFC] Removing experimental designation for 
ninja in docs. (authored by ncv).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73567

Files:
  clang/docs/HowToSetupToolingForLLVM.rst


Index: clang/docs/HowToSetupToolingForLLVM.rst
===
--- clang/docs/HowToSetupToolingForLLVM.rst
+++ clang/docs/HowToSetupToolingForLLVM.rst
@@ -140,7 +140,7 @@
   return new clang::ASTConsumer();
   }
 
-(Experimental) Using Ninja Build System
+Using Ninja Build System
 ===
 
 Optionally you can use the `Ninja `_
@@ -197,4 +197,3 @@
   $ ninja check-all
 
 Other target names can be used in the same way as with make.
-


Index: clang/docs/HowToSetupToolingForLLVM.rst
===
--- clang/docs/HowToSetupToolingForLLVM.rst
+++ clang/docs/HowToSetupToolingForLLVM.rst
@@ -140,7 +140,7 @@
   return new clang::ASTConsumer();
   }
 
-(Experimental) Using Ninja Build System
+Using Ninja Build System
 ===
 
 Optionally you can use the `Ninja `_
@@ -197,4 +197,3 @@
   $ ninja check-all
 
 Other target names can be used in the same way as with make.
-
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 43a1c80 - Fix another implicit conversion in the directory watcher

2020-01-28 Thread Jonas Devlieghere via cfe-commits

Author: Jonas Devlieghere
Date: 2020-01-28T15:28:22-08:00
New Revision: 43a1c80508d17fa42c78b690d426105eaa84c539

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

LOG: Fix another implicit conversion in the directory watcher

Added: 


Modified: 
clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp

Removed: 




diff  --git a/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp 
b/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
index 88bab18169a8..2cae847e7657 100644
--- a/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
+++ b/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
@@ -221,7 +221,7 @@ llvm::Expected> 
clang::DirectoryWatcher::creat
 
   // We need to copy the data so the lifetime is ok after a const copy is made
   // for the block.
-  const std::string CopiedPath = Path;
+  const std::string CopiedPath = Path.str();
 
   auto InitWork = ^{
 // We need to start watching the directory before we start scanning in 
order



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


[clang] 84118fa - [NFC] Removing experimental designation for ninja in docs.

2020-01-28 Thread Nate Voorhies via cfe-commits

Author: Nate Voorhies
Date: 2020-01-28T15:28:40-08:00
New Revision: 84118fac3abee44ba89a4cfe1c0c40b254e63830

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

LOG: [NFC] Removing experimental designation for ninja in docs.

Summary:
Ninja is no longer an experimental tool, documentation changed to
reflect this.

Reviewers: nikola

Reviewed By: nikola

Subscribers: cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/docs/HowToSetupToolingForLLVM.rst

Removed: 




diff  --git a/clang/docs/HowToSetupToolingForLLVM.rst 
b/clang/docs/HowToSetupToolingForLLVM.rst
index dfa199ec5951..58f10cfeffc1 100644
--- a/clang/docs/HowToSetupToolingForLLVM.rst
+++ b/clang/docs/HowToSetupToolingForLLVM.rst
@@ -140,7 +140,7 @@ Examples:
   return new clang::ASTConsumer();
   }
 
-(Experimental) Using Ninja Build System
+Using Ninja Build System
 ===
 
 Optionally you can use the `Ninja `_
@@ -197,4 +197,3 @@ Now you are ready to build and test LLVM using Ninja:
   $ ninja check-all
 
 Other target names can be used in the same way as with make.
-



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


[clang] b1a8189 - [NFC] Fix comment typo

2020-01-28 Thread Francis Visoiu Mistrih via cfe-commits

Author: Francis Visoiu Mistrih
Date: 2020-01-28T15:23:28-08:00
New Revision: b1a8189d7d7584ca22251a94948457b6cad19421

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

LOG: [NFC] Fix comment typo

Added: 


Modified: 
clang/lib/CodeGen/CGCall.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index d633b3dd7d32..3f132a0a62aa 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -1842,7 +1842,7 @@ static void addNoBuiltinAttributes(llvm::AttrBuilder 
,
 FuncAttrs.addAttribute(AttributeName);
   };
 
-  // First, handle the language options passed through -fno-builtin[-]
+  // First, handle the language options passed through -fno-builtin.
   if (LangOpts.NoBuiltin) {
 // -fno-builtin disables them all.
 FuncAttrs.addAttribute("no-builtins");



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


[PATCH] D73562: [ASTMatchers] Add hasPlacementArg and hasAnyPlacementArg traversal matcher for CXXNewExpr

2020-01-28 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 241012.
njames93 added a comment.

- Changed isPlacement to hasPlacementArg and hasAnyPlacementArg


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73562

Files:
  clang-tools-extra/clang-tidy/cert/DefaultOperatorNewAlignmentCheck.cpp
  clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp
  clang/docs/LibASTMatchersReference.html
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/lib/ASTMatchers/Dynamic/Registry.cpp
  clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

Index: clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
@@ -3124,5 +3124,45 @@
   EXPECT_TRUE(notMatches("template class A {};", Matcher));
 }
 
+TEST(CXXNewExpr, Array) {
+  StatementMatcher NewArray = cxxNewExpr(isArray());
+
+  EXPECT_TRUE(matches("void foo() { int *Ptr = new int[10]; }", NewArray));
+  EXPECT_TRUE(notMatches("void foo() { int *Ptr = new int; }", NewArray));
+
+  StatementMatcher NewArraySize10 =
+  cxxNewExpr(hasArraySize(integerLiteral(equals(10;
+  EXPECT_TRUE(
+  matches("void foo() { int *Ptr = new int[10]; }", NewArraySize10));
+  EXPECT_TRUE(
+  notMatches("void foo() { int *Ptr = new int[20]; }", NewArraySize10));
+}
+
+TEST(CXXNewExpr, PlacementArgs) {
+  StatementMatcher IsPlacementNew = cxxNewExpr(hasAnyPlacementArg(anything()));
+
+  EXPECT_TRUE(matches(R"(
+void* operator new(decltype(sizeof(void*)), void*); 
+int *foo(void* Storage) {
+  return new (Storage) int; 
+})",
+  IsPlacementNew));
+
+  EXPECT_TRUE(matches(R"(
+void* operator new(decltype(sizeof(void*)), void*, unsigned); 
+int *foo(void* Storage) {
+  return new (Storage, 16) int; 
+})",
+  cxxNewExpr(hasPlacementArg(
+  1, ignoringImpCasts(integerLiteral(equals(16)));
+
+  EXPECT_TRUE(notMatches(R"(
+void* operator new(decltype(sizeof(void*)), void*); 
+int *foo(void* Storage) {
+  return new int; 
+})",
+ IsPlacementNew));
+}
+
 } // namespace ast_matchers
 } // namespace clang
Index: clang/lib/ASTMatchers/Dynamic/Registry.cpp
===
--- clang/lib/ASTMatchers/Dynamic/Registry.cpp
+++ clang/lib/ASTMatchers/Dynamic/Registry.cpp
@@ -243,6 +243,7 @@
   REGISTER_MATCHER(hasAnyDeclaration);
   REGISTER_MATCHER(hasAnyName);
   REGISTER_MATCHER(hasAnyParameter);
+  REGISTER_MATCHER(hasAnyPlacementArg);
   REGISTER_MATCHER(hasAnySelector);
   REGISTER_MATCHER(hasAnySubstatement);
   REGISTER_MATCHER(hasAnyTemplateArgument);
@@ -304,6 +305,7 @@
   REGISTER_MATCHER(hasReceiverType);
   REGISTER_MATCHER(hasReplacementType);
   REGISTER_MATCHER(hasReturnValue);
+  REGISTER_MATCHER(hasPlacementArg);
   REGISTER_MATCHER(hasSelector);
   REGISTER_MATCHER(hasSingleDecl);
   REGISTER_MATCHER(hasSize);
Index: clang/include/clang/ASTMatchers/ASTMatchers.h
===
--- clang/include/clang/ASTMatchers/ASTMatchers.h
+++ clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -6752,6 +6752,35 @@
   return Node.isArray();
 }
 
+/// Matches placement new expression arguments.
+///
+/// Given:
+/// \code
+///   MyClass *p1 = new (Storage, 16) MyClass();
+/// \endcode
+/// cxxNewExpr(hasPlacementArg(1, integerLiteral(equals(16
+///   matches the expression 'new (Storage, 16) MyClass()'.
+AST_MATCHER_P2(CXXNewExpr, hasPlacementArg, unsigned, Index,
+   internal::Matcher, InnerMatcher) {
+  return Node.getNumPlacementArgs() > Index &&
+ InnerMatcher.matches(*Node.getPlacementArg(Index), Finder, Builder);
+}
+
+/// Matches any placement new expression arguments.
+///
+/// Given:
+/// \code
+///   MyClass *p1 = new (Storage) MyClass();
+/// \endcode
+/// cxxNewExpr(hasAnyPlacementArg(anything()))
+///   matches the expression 'new (Storage, 16) MyClass()'.
+AST_MATCHER_P(CXXNewExpr, hasAnyPlacementArg, internal::Matcher,
+  InnerMatcher) {
+  return llvm::any_of(Node.placement_arguments(), [&](const Expr *Arg) {
+return InnerMatcher.matches(*Arg, Finder, Builder);
+  });
+}
+
 /// Matches array new expressions with a given array size.
 ///
 /// Given:
Index: clang/docs/LibASTMatchersReference.html
===
--- clang/docs/LibASTMatchersReference.html
+++ clang/docs/LibASTMatchersReference.html
@@ -5283,6 +5283,16 @@
 
 
 
+Matcherhttps://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html;>CXXNewExprhasAnyPlacementArgMatcherhttps://clang.llvm.org/doxygen/classclang_1_1Expr.html;>Expr InnerMatcher
+Matches any placement new expression arguments.
+
+Given:
+  MyClass *p1 = new 

[clang] 00d834e - Fix more implicit conversions

2020-01-28 Thread Jonas Devlieghere via cfe-commits

Author: Jonas Devlieghere
Date: 2020-01-28T15:19:27-08:00
New Revision: 00d834e08719c994f12b216c7eb17bbc0c976714

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

LOG: Fix more implicit conversions

Added: 


Modified: 
clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
llvm/tools/dsymutil/SymbolMap.cpp

Removed: 




diff  --git a/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp 
b/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
index 7a60369a4da0..88bab18169a8 100644
--- a/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
+++ b/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
@@ -173,7 +173,7 @@ FSEventStreamRef createFSEventStream(
   if (::realpath(P.begin(), Buffer) != nullptr)
 RealPath = Buffer;
   else
-RealPath = Path;
+RealPath = Path.str();
 }
 
 FSEventStreamContext Context;

diff  --git a/llvm/tools/dsymutil/SymbolMap.cpp 
b/llvm/tools/dsymutil/SymbolMap.cpp
index 7ee078cd9f93..6a13efdf8e95 100644
--- a/llvm/tools/dsymutil/SymbolMap.cpp
+++ b/llvm/tools/dsymutil/SymbolMap.cpp
@@ -96,7 +96,7 @@ SymbolMapTranslator SymbolMapLoader::Load(StringRef InputFile,
   StringRef UUID(CFStringGetCStringPtr(OldUUID, 
kCFStringEncodingUTF8));
   SmallString<256> BCSymbolMapPath(SymbolMapPath);
   sys::path::append(BCSymbolMapPath, UUID.str() + ".bcsymbolmap");
-  SymbolMapPath = BCSymbolMapPath.str();
+  SymbolMapPath = BCSymbolMapPath.str().str();
 }
 CFRelease(plist);
   }



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


[clang] a153d78 - [Driver] Fix implicit conversion guarded by #ifdef _WIN32

2020-01-28 Thread Benjamin Kramer via cfe-commits

Author: Benjamin Kramer
Date: 2020-01-29T00:18:45+01:00
New Revision: a153d78c7eb079bcba5ebb37fc1ab9b3c82b99a4

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

LOG: [Driver] Fix implicit conversion guarded by #ifdef _WIN32

Added: 


Modified: 
clang/lib/Driver/ToolChains/MSVC.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/MSVC.cpp 
b/clang/lib/Driver/ToolChains/MSVC.cpp
index 83e37be83f2a..b7dd6793efea 100644
--- a/clang/lib/Driver/ToolChains/MSVC.cpp
+++ b/clang/lib/Driver/ToolChains/MSVC.cpp
@@ -261,7 +261,7 @@ static bool findVCToolChainViaSetupConfig(std::string ,
   if (!llvm::sys::fs::is_directory(ToolchainPath))
 return false;
 
-  Path = ToolchainPath.str();
+  Path = std::string(ToolchainPath.str());
   VSLayout = MSVCToolChain::ToolsetLayout::VS2017OrNewer;
   return true;
 #endif



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


[PATCH] D73282: Fix debug-info generation for block invocations so that we set the LinkageName instead of the Name

2020-01-28 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

Yeah, in general I think special casing a particular name mangling is probably 
not a great idea (what about in Microsoft mode with a different mangling 
scheme?), so I'm somewhat inclined towards doing this in general as @aprantl 
was suggesting.


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

https://reviews.llvm.org/D73282



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


[PATCH] D73543: [clang] Add support for __builtin_memcpy_inline

2020-01-28 Thread Alexander Richardson via Phabricator via cfe-commits
arichardson added inline comments.



Comment at: clang/docs/LanguageExtensions.rst:2259
+``__builtin_memcpy_inline(dst, src, size)`` is identical to
+``__builtin_memcpy(dst, src, size)`` expect that the generated code is
+guaranteed not to call any external functions. See [LLVM IR 
‘llvm.memcpy.inline’

Typo: except



Comment at: clang/test/Sema/builtins-memcpy-inline.c:23
+}
+
+void test_memcpy_inline_null_buffer_is_ok_if_size_is_zero(void *ptr) {

Size can only be a constant right? Should there be a test for the error 
reported in that case?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73543



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


[PATCH] D72829: Implement -fsemantic-interposition

2020-01-28 Thread Alexander Richardson via Phabricator via cfe-commits
arichardson added inline comments.



Comment at: clang/docs/ClangCommandLineReference.rst:907
+
+.. option:: -fsemantic-interposition, -fno-semantic-interposition
+

This looks like it should be reordered?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72829



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


[PATCH] D73282: Fix debug-info generation for block invocations so that we set the LinkageName instead of the Name

2020-01-28 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added a comment.

Example as requested, using the same code from 
`clang/test/CodeGenCXX/debug-info-block-invocation-linkage-name.cpp` the DWARF 
for block created in `f()` and passed to `g()` as an argument changes from:

  0x0052:   DW_TAG_subprogram
  DW_AT_low_pc  (0x0060)
  DW_AT_high_pc (0x0089)
  DW_AT_frame_base  (DW_OP_reg6 RBP)
  DW_AT_name("___Z1fU13block_pointerFviE_block_invoke")
  DW_AT_decl_file   ("block_demangle_3.cpp")
  DW_AT_decl_line   (4)

to

  0x0056:   DW_TAG_subprogram
  DW_AT_low_pc  (0x0060)
  DW_AT_high_pc (0x008c)
  DW_AT_frame_base  (DW_OP_reg6 RBP)
  DW_AT_linkage_name
("___Z1fU13block_pointerFviE_block_invoke")
  DW_AT_decl_file   ("block_demangle_3.cpp")
  DW_AT_decl_line   (4)

With the only change being that the mangled name 
`___Z1fU13block_pointerFviE_block_invoke` instead of ended up in `DW_AT_name` 
end up in `DW_AT_linkage_name`


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

https://reviews.llvm.org/D73282



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


[PATCH] D73285: [OpenMP][OMPIRBuilder][BugFix] Handle Unreachable Finalization blocks in `parallel` generation

2020-01-28 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added inline comments.



Comment at: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp:661
+AfterIP = InsertPointTy(ForkBB, ForkBB->end());
+  }
 

fghanim wrote:
> jdoerfert wrote:
> > Why do we need all of this? Can't we just *not do it* instead? This is code 
> > complexity that we should avoid.
> Depends. 
> If we want to conform with the way things are done in clang; namely, not have 
> unreachable blocks, then yes we need to do this. If not, then no, nothing 
> needs to change. An optimization pass will be executed at some point later 
> that should clean all that up.
> 
> However, we should be careful, for example, The lit test for `critical` 
> checks that no basic blocks were generated from the rest of the body that 
> comes after the infinite loop. So if the choice is to not conform with clang, 
> then we should keep an eye on these lit tests, and disable such checks for 
> the OMPBuilder.
> If we want to conform with the way things are done in clang;

It's not like we introduce much extra code, break anything, or make the final 
result different.


>  If not, then no, nothing needs to change. An optimization pass will be 
> executed at some point later that should clean all that up.

Let's go with that solution and keep this code here simple, less error prone, 
and easier to manage.


> However, we should be careful, for example, The lit test for critical checks 
> that no basic blocks were generated from the rest of the body that comes 
> after the infinite loop. So if the choice is to not conform with clang, then 
> we should keep an eye on these lit tests, and disable such checks for the 
> OMPBuilder.

We already do things different and that will only become more evident 
(TRegions!). For example, to simplify this code we do *not* cache runtime calls 
(anymore). That is we emit a new get_thread_id call every time. (We know the 
OpenMPOpt pass will clean it up eventually.) I get that the tests change and 
for a while we will have clang and OMPBuilder check lines. Though, once the 
clang CG is gone there is arguably no difference anymore because the OMPBuilder 
behavior is then the default. As soon as we have the privatization parts 
properly hooked up we can even start running the OMPBuilder by default and soon 
after removing clang CG parts. If anything, we should modernize the clang tests 
as they are a constant critique point that hinders outside involvement. We 
could start using the llvm/utils/update__checks scripts for example. We 
could also minimize the check lines and focus on the most important bits only. 
(I prefer the update scripts with the pending extensions, e.g., D69701)



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73285



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


[PATCH] D72531: Set traversal explicitly where needed in tests

2020-01-28 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added a comment.

I was looking at the changes to `ASTImporterTest.cpp` and it not obvious to me 
how you determined where it was needed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72531



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


[PATCH] D73495: [CodeGen] Attach no-builtin attributes to function definitions with no Decl

2020-01-28 Thread Guillaume Chatelet via Phabricator via cfe-commits
gchatelet added a comment.

Thx for the fix @thegameg




Comment at: clang/lib/CodeGen/CGCall.cpp:1845
+
+  // First, handle the language options passed through -fno-builtin[-]
+  if (LangOpts.NoBuiltin) {

Can you remove the trailing `[-]`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73495



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


[PATCH] D44609: [clang-format] New option BeforeLambdaBody to manage lambda line break inside function parameter call (in Allman style)

2020-01-28 Thread Michael via Phabricator via cfe-commits
Alundra added a comment.

@Wawha In the same style of this missing feature, I think you are also aware of 
the miss of clang-format about struct/array initializer like: 
https://bugs.llvm.org/show_bug.cgi?id=40411
Basically to have the break for braces after the '=' of the struct/array 
initializer like this example:

  const FMOD_3D_ATTRIBUTES Attributes =
  {
  { WorldPosition.x, WorldPosition.y, WorldPosition.z },
  { 0.0f, 0.0f, 0.0f },
  { 0.0f, 0.0f, 1.0f },
  { 0.0f, 1.0f, 0.0f }};

Actually with the indent configured you end with something like:

  const FMOD_3D_ATTRIBUTES Attributes =
  {
  { WorldPosition.x, WorldPosition.y, WorldPosition.z },
  { 0.0f, 0.0f, 0.0f },
  { 0.0f, 0.0f, 1.0f },
  { 0.0f, 1.0f, 0.0f }};

The only way right now is to have the '{' after the '=' but that breaks your 
coding style:

  const FMOD_3D_ATTRIBUTES Attributes = {
  { WorldPosition.x, WorldPosition.y, WorldPosition.z },
  { 0.0f, 0.0f, 0.0f },
  { 0.0f, 0.0f, 1.0f },
  { 0.0f, 1.0f, 0.0f }};

That looks like on the same topic about braces controls missing feature.
Since you look very familiar, it can be for you a next challenge to add that in 
clang format?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D44609



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


[PATCH] D73580: [clang-tidy] rename_check.py: maintain alphabetical order in Renamed checks section

2020-01-28 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko created this revision.
Eugene.Zelenko added reviewers: alexfh, hokein, aaron.ballman, njames93, 
MyDeveloperDay.
Eugene.Zelenko added a project: clang-tools-extra.
Herald added a subscriber: xazax.hun.
Herald added a project: clang.

Also use //check// in add_new_check.py for terminology consistency.

PS

My GitHub ID is EugeneZelenko , if it's 
necessary for attribution.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73580

Files:
  clang-tools-extra/clang-tidy/add_new_check.py
  clang-tools-extra/clang-tidy/rename_check.py
  clang-tools-extra/docs/ReleaseNotes.rst


Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -113,7 +113,6 @@
 Renamed checks
 ^^
 
-
 Improvements to include-fixer
 -
 
Index: clang-tools-extra/clang-tidy/rename_check.py
===
--- clang-tools-extra/clang-tidy/rename_check.py
+++ clang-tools-extra/clang-tidy/rename_check.py
@@ -169,21 +169,45 @@
   with open(filename, 'r') as f:
 lines = f.readlines()
 
+  lineMatcher = re.compile('Renamed checks')
+  nextSectionMatcher = re.compile('Improvements to include-fixer')
+  checkMatcher = re.compile('- The \'(.*)')
+
   print('Updating %s...' % filename)
   with open(filename, 'wb') as f:
 note_added = False
 header_found = False
+next_header_found = False
+add_note_here = False
 
 for line in lines:
   if not note_added:
-match = re.search('Renamed checks', line)
+match = lineMatcher.match(line)
+match_next = nextSectionMatcher.match(line)
+match_check = checkMatcher.match(line)
+if match_check:
+  last_check = match_check.group(1)
+  if last_check > old_check_name:
+add_note_here = True
+
+if match_next:
+  next_header_found = True
+  add_note_here = True
+
 if match:
   header_found = True
-elif header_found:
+  f.write(line)
+  continue
+
+if line.startswith(''):
+  f.write(line)
+  continue
+
+if header_found and add_note_here:
   if not line.startswith(''):
-f.write("""
-- The '%s' check was renamed to :doc:`%s
+f.write("""- The '%s' check was renamed to :doc:`%s
   `
+
 """ % (old_check_name, new_check_name, new_check_name))
 note_added = True
 
Index: clang-tools-extra/clang-tidy/add_new_check.py
===
--- clang-tools-extra/clang-tidy/add_new_check.py
+++ clang-tools-extra/clang-tidy/add_new_check.py
@@ -221,7 +221,7 @@
 
   lineMatcher = re.compile('New checks')
   nextSectionMatcher = re.compile('New check aliases')
-  checkerMatcher = re.compile('- New :doc:`(.*)')
+  checkMatcher = re.compile('- New :doc:`(.*)')
 
   print('Updating %s...' % filename)
   with open(filename, 'w') as f:
@@ -234,10 +234,10 @@
   if not note_added:
 match = lineMatcher.match(line)
 match_next = nextSectionMatcher.match(line)
-match_checker = checkerMatcher.match(line)
-if match_checker:
-  last_checker = match_checker.group(1)
-  if last_checker > check_name_dashes:
+match_check = checkMatcher.match(line)
+if match_check:
+  last_check = match_check.group(1)
+  if last_check > check_name_dashes:
 add_note_here = True
 
 if match_next:


Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -113,7 +113,6 @@
 Renamed checks
 ^^
 
-
 Improvements to include-fixer
 -
 
Index: clang-tools-extra/clang-tidy/rename_check.py
===
--- clang-tools-extra/clang-tidy/rename_check.py
+++ clang-tools-extra/clang-tidy/rename_check.py
@@ -169,21 +169,45 @@
   with open(filename, 'r') as f:
 lines = f.readlines()
 
+  lineMatcher = re.compile('Renamed checks')
+  nextSectionMatcher = re.compile('Improvements to include-fixer')
+  checkMatcher = re.compile('- The \'(.*)')
+
   print('Updating %s...' % filename)
   with open(filename, 'wb') as f:
 note_added = False
 header_found = False
+next_header_found = False
+add_note_here = False
 
 for line in lines:
   if not note_added:
-match = re.search('Renamed checks', line)
+match = lineMatcher.match(line)
+match_next = nextSectionMatcher.match(line)
+match_check = checkMatcher.match(line)
+if match_check:
+  last_check = match_check.group(1)
+  if last_check > 

[PATCH] D65270: [CMake] Fix source path generation for install in multi-config (MSBuild)

2020-01-28 Thread Richard Musil via Phabricator via cfe-commits
risa2000 added a comment.

I wonder if someone could explain what happened and if this has been dropped 
because of the comment from @beanz? I am not using XCode so I cannot comment on 
its requirements nor fix the code for it.

Someone has subscribed to this bug on 
https://bugs.llvm.org/show_bug.cgi?id=41030 so I got an urge to check on the 
bug again and possibly get to some conclusion.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65270



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


[PATCH] D73495: [CodeGen] Attach no-builtin attributes to function definitions with no Decl

2020-01-28 Thread Francis Visoiu Mistrih via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4e799ada5860: [CodeGen] Attach no-builtin attributes to 
function definitions with no Decl (authored by thegameg).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73495

Files:
  clang/lib/CodeGen/CGCall.cpp
  clang/test/CodeGenCXX/global-init.cpp

Index: clang/test/CodeGenCXX/global-init.cpp
===
--- clang/test/CodeGenCXX/global-init.cpp
+++ clang/test/CodeGenCXX/global-init.cpp
@@ -2,6 +2,8 @@
 // RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm %s -o - |FileCheck -check-prefix CHECK-NOEXC %s
 // RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm -mframe-pointer=non-leaf %s -o - \
 // RUN:   | FileCheck -check-prefix CHECK-FP %s
+// RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm %s -o - -fno-builtin \
+// RUN:   | FileCheck -check-prefix CHECK-NOBUILTIN %s
 
 struct A {
   A();
@@ -202,9 +204,12 @@
 
 // rdar://problem/8090834: this should be nounwind
 // CHECK-NOEXC: define internal void @_GLOBAL__sub_I_global_init.cpp() [[NUW:#[0-9]+]] section "__TEXT,__StaticInit,regular,pure_instructions" {
-
 // CHECK-NOEXC: attributes [[NUW]] = { noinline nounwind{{.*}} }
 
+// Make sure we mark global initializers with the no-builtins attribute.
+// CHECK-NOBUILTIN: define internal void @_GLOBAL__sub_I_global_init.cpp() [[NUW:#[0-9]+]] section "__TEXT,__StaticInit,regular,pure_instructions" {
+// CHECK-NOBUILTIN: attributes [[NUW]] = { noinline nounwind{{.*}}"no-builtins"{{.*}} }
+
 // PR21811: attach the appropriate attribute to the global init function
 // CHECK-FP: define internal void @_GLOBAL__sub_I_global_init.cpp() [[NUX:#[0-9]+]] section "__TEXT,__StaticInit,regular,pure_instructions" {
 // CHECK-FP: attributes [[NUX]] = { noinline nounwind {{.*}}"frame-pointer"="non-leaf"{{.*}} }
Index: clang/lib/CodeGen/CGCall.cpp
===
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -1832,6 +1832,42 @@
   F.addAttributes(llvm::AttributeList::FunctionIndex, FuncAttrs);
 }
 
+static void addNoBuiltinAttributes(llvm::AttrBuilder ,
+   const LangOptions ,
+   const NoBuiltinAttr *NBA = nullptr) {
+  auto AddNoBuiltinAttr = [](StringRef BuiltinName) {
+SmallString<32> AttributeName;
+AttributeName += "no-builtin-";
+AttributeName += BuiltinName;
+FuncAttrs.addAttribute(AttributeName);
+  };
+
+  // First, handle the language options passed through -fno-builtin[-]
+  if (LangOpts.NoBuiltin) {
+// -fno-builtin disables them all.
+FuncAttrs.addAttribute("no-builtins");
+return;
+  }
+
+  // Then, add attributes for builtins specified through -fno-builtin-.
+  llvm::for_each(LangOpts.NoBuiltinFuncs, AddNoBuiltinAttr);
+
+  // Now, let's check the __attribute__((no_builtin("...")) attribute added to
+  // the source.
+  if (!NBA)
+return;
+
+  // If there is a wildcard in the builtin names specified through the
+  // attribute, disable them all.
+  if (llvm::is_contained(NBA->builtinNames(), "*")) {
+FuncAttrs.addAttribute("no-builtins");
+return;
+  }
+
+  // And last, add the rest of the builtin names.
+  llvm::for_each(NBA->builtinNames(), AddNoBuiltinAttr);
+}
+
 void CodeGenModule::ConstructAttributeList(
 StringRef Name, const CGFunctionInfo , CGCalleeInfo CalleeInfo,
 llvm::AttributeList , unsigned , bool AttrOnCallSite) {
@@ -1850,6 +1886,8 @@
   const Decl *TargetDecl = CalleeInfo.getCalleeDecl().getDecl();
 
   bool HasOptnone = false;
+  // The NoBuiltinAttr attached to a TargetDecl (only allowed on FunctionDecls).
+  const NoBuiltinAttr *NBA = nullptr;
   // FIXME: handle sseregparm someday...
   if (TargetDecl) {
 if (TargetDecl->hasAttr())
@@ -1875,22 +1913,7 @@
   if (!(AttrOnCallSite && IsVirtualCall)) {
 if (Fn->isNoReturn())
   FuncAttrs.addAttribute(llvm::Attribute::NoReturn);
-
-const auto *NBA = Fn->getAttr();
-bool HasWildcard = NBA && llvm::is_contained(NBA->builtinNames(), "*");
-if (getLangOpts().NoBuiltin || HasWildcard)
-  FuncAttrs.addAttribute("no-builtins");
-else {
-  auto AddNoBuiltinAttr = [](StringRef BuiltinName) {
-SmallString<32> AttributeName;
-AttributeName += "no-builtin-";
-AttributeName += BuiltinName;
-FuncAttrs.addAttribute(AttributeName);
-  };
-  llvm::for_each(getLangOpts().NoBuiltinFuncs, AddNoBuiltinAttr);
-  if (NBA)
-llvm::for_each(NBA->builtinNames(), AddNoBuiltinAttr);
-}
+NBA = Fn->getAttr();
   }
 }
 
@@ -1925,6 +1948,14 @@
 }
   }
 
+  // Attach "no-builtins" attributes to:
+  // * call sites: both `nobuiltin` and "no-builtins" or 

[clang] 4e799ad - [CodeGen] Attach no-builtin attributes to function definitions with no Decl

2020-01-28 Thread Francis Visoiu Mistrih via cfe-commits

Author: Francis Visoiu Mistrih
Date: 2020-01-28T13:59:08-08:00
New Revision: 4e799ada5860d1029ea89226b9b867302e792251

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

LOG: [CodeGen] Attach no-builtin attributes to function definitions with no Decl

When using -fno-builtin[-], we don't attach the IR attributes to
function definitions with no Decl, like the ones created through
`CreateGlobalInitOrDestructFunction`.

This results in projects using -fno-builtin or -ffreestanding to start
seeing symbols like _memset_pattern16.

The fix changes the behavior to always add the attribute if LangOptions
requests it.

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

Added: 


Modified: 
clang/lib/CodeGen/CGCall.cpp
clang/test/CodeGenCXX/global-init.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 3a50e2b103f6..d633b3dd7d32 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -1832,6 +1832,42 @@ void CodeGenModule::AddDefaultFnAttrs(llvm::Function ) 
{
   F.addAttributes(llvm::AttributeList::FunctionIndex, FuncAttrs);
 }
 
+static void addNoBuiltinAttributes(llvm::AttrBuilder ,
+   const LangOptions ,
+   const NoBuiltinAttr *NBA = nullptr) {
+  auto AddNoBuiltinAttr = [](StringRef BuiltinName) {
+SmallString<32> AttributeName;
+AttributeName += "no-builtin-";
+AttributeName += BuiltinName;
+FuncAttrs.addAttribute(AttributeName);
+  };
+
+  // First, handle the language options passed through -fno-builtin[-]
+  if (LangOpts.NoBuiltin) {
+// -fno-builtin disables them all.
+FuncAttrs.addAttribute("no-builtins");
+return;
+  }
+
+  // Then, add attributes for builtins specified through -fno-builtin-.
+  llvm::for_each(LangOpts.NoBuiltinFuncs, AddNoBuiltinAttr);
+
+  // Now, let's check the __attribute__((no_builtin("...")) attribute added to
+  // the source.
+  if (!NBA)
+return;
+
+  // If there is a wildcard in the builtin names specified through the
+  // attribute, disable them all.
+  if (llvm::is_contained(NBA->builtinNames(), "*")) {
+FuncAttrs.addAttribute("no-builtins");
+return;
+  }
+
+  // And last, add the rest of the builtin names.
+  llvm::for_each(NBA->builtinNames(), AddNoBuiltinAttr);
+}
+
 void CodeGenModule::ConstructAttributeList(
 StringRef Name, const CGFunctionInfo , CGCalleeInfo CalleeInfo,
 llvm::AttributeList , unsigned , bool AttrOnCallSite) 
{
@@ -1850,6 +1886,8 @@ void CodeGenModule::ConstructAttributeList(
   const Decl *TargetDecl = CalleeInfo.getCalleeDecl().getDecl();
 
   bool HasOptnone = false;
+  // The NoBuiltinAttr attached to a TargetDecl (only allowed on 
FunctionDecls).
+  const NoBuiltinAttr *NBA = nullptr;
   // FIXME: handle sseregparm someday...
   if (TargetDecl) {
 if (TargetDecl->hasAttr())
@@ -1875,22 +1913,7 @@ void CodeGenModule::ConstructAttributeList(
   if (!(AttrOnCallSite && IsVirtualCall)) {
 if (Fn->isNoReturn())
   FuncAttrs.addAttribute(llvm::Attribute::NoReturn);
-
-const auto *NBA = Fn->getAttr();
-bool HasWildcard = NBA && llvm::is_contained(NBA->builtinNames(), "*");
-if (getLangOpts().NoBuiltin || HasWildcard)
-  FuncAttrs.addAttribute("no-builtins");
-else {
-  auto AddNoBuiltinAttr = [](StringRef BuiltinName) {
-SmallString<32> AttributeName;
-AttributeName += "no-builtin-";
-AttributeName += BuiltinName;
-FuncAttrs.addAttribute(AttributeName);
-  };
-  llvm::for_each(getLangOpts().NoBuiltinFuncs, AddNoBuiltinAttr);
-  if (NBA)
-llvm::for_each(NBA->builtinNames(), AddNoBuiltinAttr);
-}
+NBA = Fn->getAttr();
   }
 }
 
@@ -1925,6 +1948,14 @@ void CodeGenModule::ConstructAttributeList(
 }
   }
 
+  // Attach "no-builtins" attributes to:
+  // * call sites: both `nobuiltin` and "no-builtins" or "no-builtin-".
+  // * definitions: "no-builtins" or "no-builtin-" only.
+  // The attributes can come from:
+  // * LangOpts: -ffreestanding, -fno-builtin, -fno-builtin-
+  // * FunctionDecl attributes: __attribute__((no_builtin(...)))
+  addNoBuiltinAttributes(FuncAttrs, getLangOpts(), NBA);
+
   ConstructDefaultFnAttrList(Name, HasOptnone, AttrOnCallSite, FuncAttrs);
 
   // This must run after constructing the default function attribute list

diff  --git a/clang/test/CodeGenCXX/global-init.cpp 
b/clang/test/CodeGenCXX/global-init.cpp
index 1970de8825e2..eaa37456774a 100644
--- a/clang/test/CodeGenCXX/global-init.cpp
+++ b/clang/test/CodeGenCXX/global-init.cpp
@@ -2,6 +2,8 @@
 // RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm %s -o - |FileCheck 

[PATCH] D72829: Implement -fsemantic-interposition

2020-01-28 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon check-circle color=green} Unit tests: pass. 62281 tests passed, 0 failed 
and 827 were skipped.

{icon check-circle color=green} clang-tidy: pass.

{icon check-circle color=green} clang-format: pass.

Build artifacts 
: 
diff.json 
,
 clang-tidy.txt 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 


//Pre-merge checks is in beta. Report issue 
.
 Please join beta  or enable 
it for your project 
.//


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72829



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


[PATCH] D52136: [clang-tidy] Add modernize-concat-nested-namespaces check

2020-01-28 Thread Wojtek Gumuła via Phabricator via cfe-commits
wgml added a comment.

In D52136#1844384 , @grandinj wrote:

> Hi
>
> Thanks a lot for this checker - would it be possible to enhance it to also 
> update stuff in associated header files?
>
> Thanks


Check out D61989 ,


Repository:
  rL LLVM

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

https://reviews.llvm.org/D52136



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


[PATCH] D73548: [clang-tidy] Added option for disabling const qualifiers in readability-qualified-auto

2020-01-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/readability-qualified-auto.rst:41
+   auto *const Bar = cast(Baz2);
+   auto *volatile FooBar = cast(Baz3);
+

njames93 wrote:
> Quuxplusone wrote:
> > Is it worth adding an example of a double pointer?
> > 
> > auto BarN = cast(FooN);
> > 
> > Does that become `auto*` or `auto**` (and why)? My wild guess is that it 
> > becomes `auto*` (and because nobody cares about double pointers), but I 
> > could be wrong.
> Double pointers are just resolved to `auto *`.
They resolve to `auto *` today but I could see a real argument that they should 
resolve to `auto **` instead based on the same logic of: don't make the reader 
infer pointer/references and qualifiers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73548



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


[PATCH] D73495: [CodeGen] Attach no-builtin attributes to function definitions with no Decl

2020-01-28 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM

There's maybe some argument that we should be calling getNonClosureContext() or 
something like that to find the parent function, at least for some attributes.  
But that seems less critical, and I don't really want to think about which 
attributes should/should not apply right now.


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

https://reviews.llvm.org/D73495



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


[PATCH] D73285: [OpenMP][OMPIRBuilder][BugFix] Handle Unreachable Finalization blocks in `parallel` generation

2020-01-28 Thread Fady Ghanim via Phabricator via cfe-commits
fghanim marked an inline comment as done.
fghanim added inline comments.



Comment at: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp:661
+AfterIP = InsertPointTy(ForkBB, ForkBB->end());
+  }
 

jdoerfert wrote:
> Why do we need all of this? Can't we just *not do it* instead? This is code 
> complexity that we should avoid.
Depends. 
If we want to conform with the way things are done in clang; namely, not have 
unreachable blocks, then yes we need to do this. If not, then no, nothing needs 
to change. An optimization pass will be executed at some point later that 
should clean all that up.

However, we should be careful, for example, The lit test for `critical` checks 
that no basic blocks were generated from the rest of the body that comes after 
the infinite loop. So if the choice is to not conform with clang, then we 
should keep an eye on these lit tests, and disable such checks for the 
OMPBuilder.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73285



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


[clang] eaabaf7 - Revert "[MS] Overhaul how clang passes overaligned args on x86_32"

2020-01-28 Thread Hans Wennborg via cfe-commits

Author: Hans Wennborg
Date: 2020-01-28T22:25:07+01:00
New Revision: eaabaf7e04fe98990a8177a3e053346395efde1c

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

LOG: Revert "[MS] Overhaul how clang passes overaligned args on x86_32"

It broke some Chromium tests, so let's revert until it can be fixed; see
https://crbug.com/1046362

This reverts commit 2af74e27ed7d0832cbdde9cb969aaca7a42e99f9.

Added: 


Modified: 
clang/include/clang/CodeGen/CGFunctionInfo.h
clang/lib/CodeGen/CGCall.cpp
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGen/x86_32-arguments-win32.c

Removed: 
clang/test/CodeGenCXX/inalloca-overaligned.cpp
clang/test/CodeGenCXX/inalloca-vector.cpp



diff  --git a/clang/include/clang/CodeGen/CGFunctionInfo.h 
b/clang/include/clang/CodeGen/CGFunctionInfo.h
index 588c96afe402..2a41ab9eece7 100644
--- a/clang/include/clang/CodeGen/CGFunctionInfo.h
+++ b/clang/include/clang/CodeGen/CGFunctionInfo.h
@@ -88,7 +88,6 @@ class ABIArgInfo {
   Kind TheKind;
   bool PaddingInReg : 1;
   bool InAllocaSRet : 1;// isInAlloca()
-  bool InAllocaIndirect : 1;// isInAlloca()
   bool IndirectByVal : 1;   // isIndirect()
   bool IndirectRealign : 1; // isIndirect()
   bool SRetAfterThis : 1;   // isIndirect()
@@ -111,8 +110,8 @@ class ABIArgInfo {
 
 public:
   ABIArgInfo(Kind K = Direct)
-  : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0), TheKind(K),
-PaddingInReg(false), InAllocaSRet(false), InAllocaIndirect(false),
+  : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+TheKind(K), PaddingInReg(false), InAllocaSRet(false),
 IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
 InReg(false), CanBeFlattened(false), SignExt(false) {}
 
@@ -186,10 +185,9 @@ class ABIArgInfo {
 AI.setInReg(true);
 return AI;
   }
-  static ABIArgInfo getInAlloca(unsigned FieldIndex, bool Indirect = false) {
+  static ABIArgInfo getInAlloca(unsigned FieldIndex) {
 auto AI = ABIArgInfo(InAlloca);
 AI.setInAllocaFieldIndex(FieldIndex);
-AI.setInAllocaIndirect(Indirect);
 return AI;
   }
   static ABIArgInfo getExpand() {
@@ -382,15 +380,6 @@ class ABIArgInfo {
 AllocaFieldIndex = FieldIndex;
   }
 
-  unsigned getInAllocaIndirect() const {
-assert(isInAlloca() && "Invalid kind!");
-return InAllocaIndirect;
-  }
-  void setInAllocaIndirect(bool Indirect) {
-assert(isInAlloca() && "Invalid kind!");
-InAllocaIndirect = Indirect;
-  }
-
   /// Return true if this field of an inalloca struct should be returned
   /// to implement a struct return calling convention.
   bool getInAllocaSRet() const {

diff  --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 5b03f37f4498..3a50e2b103f6 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -2339,9 +2339,6 @@ void CodeGenFunction::EmitFunctionProlog(const 
CGFunctionInfo ,
   auto FieldIndex = ArgI.getInAllocaFieldIndex();
   Address V =
   Builder.CreateStructGEP(ArgStruct, FieldIndex, Arg->getName());
-  if (ArgI.getInAllocaIndirect())
-V = Address(Builder.CreateLoad(V),
-getContext().getTypeAlignInChars(Ty));
   ArgVals.push_back(ParamValue::forIndirect(V));
   break;
 }
@@ -4041,39 +4038,18 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo 
,
   assert(NumIRArgs == 0);
   assert(getTarget().getTriple().getArch() == llvm::Triple::x86);
   if (I->isAggregate()) {
+// Replace the placeholder with the appropriate argument slot GEP.
 Address Addr = I->hasLValue()
? I->getKnownLValue().getAddress(*this)
: I->getKnownRValue().getAggregateAddress();
 llvm::Instruction *Placeholder =
 cast(Addr.getPointer());
-
-if (!ArgInfo.getInAllocaIndirect()) {
-  // Replace the placeholder with the appropriate argument slot GEP.
-  CGBuilderTy::InsertPoint IP = Builder.saveIP();
-  Builder.SetInsertPoint(Placeholder);
-  Addr = Builder.CreateStructGEP(ArgMemory,
- ArgInfo.getInAllocaFieldIndex());
-  Builder.restoreIP(IP);
-} else {
-  // For indirect things such as overaligned structs, replace the
-  // placeholder with a regular aggregate temporary alloca. Store the
-  // address of this alloca into the struct.
-  Addr = CreateMemTemp(info_it->type, "inalloca.indirect.tmp");
-  Address ArgSlot = Builder.CreateStructGEP(
-  ArgMemory, ArgInfo.getInAllocaFieldIndex());
-  Builder.CreateStore(Addr.getPointer(), ArgSlot);
-}
-deferPlaceholderReplacement(Placeholder, 

[PATCH] D73464: [clang] Add TagDecl AST matcher

2020-01-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D73464#1844402 , @f00kat wrote:

> In D73464#1844310 , @aaron.ballman 
> wrote:
>
> > LGTM! Do you need someone to commit on your behalf?
>
>
> Yes, please. I don`t know how :)


I'm happy to do so, but I'm not certain what email address you'd like me to use 
for you (I can't quite suss it out from the phab emails). Can you let me know 
what address you'd like me to use for the commit attribution?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73464



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


[PATCH] D73457: [Clang] Warn about 'z' printf modifier in old MSVC.

2020-01-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D73457#1844475 , @thakis wrote:

> Since we auto-detect -fmsc-version if it's not explicitly installed and since 
> this warning is on by default, it makes the test suite depend on the 
> environment a good bit. Given how old 2015 is by now, I'm not sure this 
> complexity and subtlety is worth the benefit?


I think it's worth the benefit -- the point to the check is to help catch 
buffer overflows, and getting the length calculation correct for that is 
important.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73457



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


[PATCH] D73562: [ASTMatchers] Add isPlacement traversal matcher for CXXNewExpr

2020-01-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:6763
+///   matches the expression 'new (Storage) MyClass()'.
+AST_MATCHER(CXXNewExpr, isPlacement) { return Node.getNumPlacementArgs() > 0; }
+

I think a better design would be something like `hasPlacementExpr()` as a 
traversal matcher. Then `isPlacement()` can be trivially done in the project as 
`hasPlacementExpr(anything())` (we could still consider adding it as a 
dedicated matcher, but it doesn't seem critical to me), but this would also 
allow people to check for specific placement new argument expressions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73562



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


[PATCH] D71920: [AST] Refactor propagation of dependency bits. NFC

2020-01-28 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon times-circle color=red} Unit tests: fail. 61841 tests passed, 5 failed 
and 780 were skipped.

  failed: libc++.std/language_support/cmp/cmp_partialord/partialord.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_strongeq/cmp.strongeq.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_strongord/strongord.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_weakeq/cmp.weakeq.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_weakord/weakord.pass.cpp

{icon times-circle color=red} clang-tidy: fail. clang-tidy found 0 errors and 4 
warnings 
.
 0 of them are added as review comments below (why? 
).

{icon check-circle color=green} clang-format: pass.

Build artifacts 
: 
diff.json 
,
 clang-tidy.txt 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 


//Pre-merge checks is in beta. Report issue 
.
 Please join beta  or enable 
it for your project 
.//


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71920



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


[PATCH] D71469: [AArch64] Add IR intrinsics for sq(r)dmulh_lane(q)

2020-01-28 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71469



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


[PATCH] D72829: Implement -fsemantic-interposition

2020-01-28 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added a comment.

In D72829#1845396 , @serge-sans-paille 
wrote:

> > I suppose you mean whether "SemanticInterposition" should be invalidated 
> > when "PIC Level" does not exist or "PIE Level" exists. I am a bit inclined 
> > to make it more flexible/orthogonal in the backend, i.e. 
> > SemanticInterposition is in affect even if "PIE Level" is set.
>
> OK, looks good as is, then?


Yes!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72829



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


[PATCH] D72829: Implement -fsemantic-interposition

2020-01-28 Thread serge via Phabricator via cfe-commits
serge-sans-paille marked an inline comment as done.
serge-sans-paille added a comment.

> I suppose you mean whether "SemanticInterposition" should be invalidated when 
> "PIC Level" does not exist or "PIE Level" exists. I am a bit inclined to make 
> it more flexible/orthogonal in the backend, i.e. SemanticInterposition is in 
> affect even if "PIE Level" is set.

OK, looks good as is, then?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72829



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


[PATCH] D72829: Implement -fsemantic-interposition

2020-01-28 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 240966.
serge-sans-paille marked an inline comment as done.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72829

Files:
  clang/docs/ClangCommandLineReference.rst
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/semantic-interposition.c
  clang/test/Driver/clang_f_opts.c
  llvm/include/llvm/IR/GlobalValue.h
  llvm/include/llvm/IR/Module.h
  llvm/lib/IR/Globals.cpp
  llvm/lib/IR/Module.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/test/Transforms/Inline/inline-semantic-interposition.ll
  llvm/test/Verifier/module-flags-semantic-interposition.ll

Index: llvm/test/Verifier/module-flags-semantic-interposition.ll
===
--- /dev/null
+++ llvm/test/Verifier/module-flags-semantic-interposition.ll
@@ -0,0 +1,12 @@
+; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
+
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+@foo = dso_local global i32 1, align 4
+
+!llvm.module.flags = !{!0}
+
+!0 = !{i32 1, !"SemanticInterposition", float 1.}
+
+; CHECK: SemanticInterposition metadata requires constant integer argument
Index: llvm/test/Transforms/Inline/inline-semantic-interposition.ll
===
--- /dev/null
+++ llvm/test/Transforms/Inline/inline-semantic-interposition.ll
@@ -0,0 +1,26 @@
+; Check that @callee1 gets inlined while @callee2 is not, because of
+; SemanticInterposition.
+
+; RUN: opt < %s -inline -S | FileCheck %s
+
+define internal i32 @callee1(i32 %A) {
+  ret i32 %A
+}
+
+define i32 @callee2(i32 %A) {
+  ret i32 %A
+}
+
+; CHECK-LABEL: @caller
+define i32 @caller(i32 %A) {
+; CHECK-NOT: call i32 @callee1(i32 %A)
+  %A1 = call i32 @callee1(i32 %A)
+; CHECK: %A2 = call i32 @callee2(i32 %A)
+  %A2 = call i32 @callee2(i32 %A)
+; CHECK: add i32 %A, %A2
+  %R = add i32 %A1, %A2
+  ret i32 %R
+}
+
+!llvm.module.flags = !{!0}
+!0 = !{i32 1, !"SemanticInterposition", i32 1}
Index: llvm/lib/IR/Verifier.cpp
===
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -1476,6 +1476,13 @@
"'Linker Options' named metadata no longer supported");
   }
 
+  if (ID->getString() == "SemanticInterposition") {
+ConstantInt *Value =
+mdconst::dyn_extract_or_null(Op->getOperand(2));
+Assert(Value,
+   "SemanticInterposition metadata requires constant integer argument");
+  }
+
   if (ID->getString() == "CG Profile") {
 for (const MDOperand  : cast(Op->getOperand(2))->operands())
   visitModuleFlagCGProfileEntry(MDO);
Index: llvm/lib/IR/Module.cpp
===
--- llvm/lib/IR/Module.cpp
+++ llvm/lib/IR/Module.cpp
@@ -554,6 +554,20 @@
: getModuleFlag("ProfileSummary"));
 }
 
+bool Module::getSemanticInterposition() const {
+  Metadata *MF = getModuleFlag("SemanticInterposition");
+
+  auto *Val = cast_or_null(MF);
+  if (!Val)
+return false;
+
+  return cast(Val->getValue())->getZExtValue();
+}
+
+void Module::setSemanticInterposition(bool SI) {
+  addModuleFlag(ModFlagBehavior::Error, "SemanticInterposition", SI);
+}
+
 void Module::setOwnedMemoryBuffer(std::unique_ptr MB) {
   OwnedMemoryBuffer = std::move(MB);
 }
Index: llvm/lib/IR/Globals.cpp
===
--- llvm/lib/IR/Globals.cpp
+++ llvm/lib/IR/Globals.cpp
@@ -94,6 +94,13 @@
   llvm_unreachable("not a global");
 }
 
+bool GlobalValue::isInterposable() const {
+  if (isInterposableLinkage(getLinkage()))
+return true;
+  return getParent() && getParent()->getSemanticInterposition() &&
+ !isDSOLocal();
+}
+
 unsigned GlobalValue::getAlignment() const {
   if (auto *GA = dyn_cast(this)) {
 // In general we cannot compute this at the IR level, but we try.
Index: llvm/include/llvm/IR/Module.h
===
--- llvm/include/llvm/IR/Module.h
+++ llvm/include/llvm/IR/Module.h
@@ -848,6 +848,12 @@
   Metadata *getProfileSummary(bool IsCS);
   /// @}
 
+  /// Returns whether semantic interposition is to be respected.
+  bool getSemanticInterposition() const;
+
+  /// Set whether semantic interposition is to be respected.
+  void setSemanticInterposition(bool);
+
   /// Returns true if PLT should be avoided for RTLib calls.
   bool getRtLibUseGOT() const;
 
Index: llvm/include/llvm/IR/GlobalValue.h
===
--- llvm/include/llvm/IR/GlobalValue.h
+++ llvm/include/llvm/IR/GlobalValue.h
@@ -426,7 +426,7 @@
   

[PATCH] D73354: clang-format: insert trailing commas into containers.

2020-01-28 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments.



Comment at: clang/lib/Format/Format.cpp:2531
+});
+
   auto Env =

Ok, this comment is more a discussion point rather than a review comment. Was 
there a reason you needed to put the TrailingCommaInserter pass after the 
Formatter pass? (maybe you needed the Tokens annotated?)

From my understanding of some of the other conversations, it seemed the reason 
for ignoring the Column limit was because the "," insertion came after it had 
been formatted (is that correct?)

If there was a good reason that's also fine, I was just interested to learn if 
there was some part of the Formatter that perhaps needs to be pulled out into 
its own separate pass.




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73354



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


[PATCH] D72326: [clang-format] Rebased on master: Add option to specify explicit config file

2020-01-28 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

Nit: please add a release note and regenerate the ClangFormatStyleOptions.rst 
(if there are any changes because you modified Format.h).


Repository:
  rC Clang

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

https://reviews.llvm.org/D72326



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


[PATCH] D73547: [Analyzer] Split container modeling from iterator modeling

2020-01-28 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

This patch is simply moving code around, right? If so, why did tests need to be 
removed?


Repository:
  rC Clang

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

https://reviews.llvm.org/D73547



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


[PATCH] D71920: [AST] Refactor propagation of dependency bits. NFC

2020-01-28 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment.

I've opted for duplicating the common flags across all the introduced enums 
(contains-unexpanded-pack, instantiation-dependent) , this is somewhat ugly, 
but everything else is even more complicated to use.
Less enums would also be a good idea probably, see the relevant comment.

Other than that, this should be ready for the next round.

In D71920#1843488 , @rsmith wrote:

> I don't like the name `getDependencies`, because the function is not getting 
> a list of dependencies, it's getting flags that indicate whether certain 
> properties of the construct are dependent. Maybe `getDependence` or 
> `getDependenceFlags` would be a better name? Likewise, instead of 
> `addDependencies`, perhaps `addDependence`?


Good point. I've opted for `getDependence`, but didn't have enough time today 
to change `addDependencies`, will make sure to do it in the next iteration.




Comment at: clang/include/clang/AST/DependencyFlags.h:17-28
+enum class DependencyFlags : uint8_t {
+  Type = 1,
+  Value = 2,
+  Instantiation = 4,
+  UnexpandedPack = 8,
+
+  // Shorthands for commonly used combinations.

ilya-biryukov wrote:
> rsmith wrote:
> > Hmm. We have a different set of propagated flags for types (dependent / 
> > instantiation dependent / unexpanded pack / variably-modified) and for (eg) 
> > template arguments and nested name specifiers (dependent / instantiation 
> > dependent / unexpanded pack). It would be nice to use the same machinery 
> > everywhere without introducing the possibility of meaningless states and 
> > giving the wrong names to some states.
> > 
> > I think we should aim for something more type-safe than this: use a 
> > different type for each different family of AST nodes, so we don't conflate 
> > "dependent" for template arguments with one or both of "type-dependent" and 
> > "value-dependent" for expressions, which mean different things.
> Yep, sounds good, probably the types would end up being more complicated, but 
> I also like more type-safe approach.
> Let me try to come up with something, I'll send a patch today.
I've introduced a separate enum for each of the AST classes, but that looks 
like an overkill.
We could probably merge the three for template arguments, template names and 
nested name specifiers into one.
(Would allow to get rid of macros too).

Note that `TypeDependence` is missing variably-modified bit, was't sure if it's 
part of the dependency propagation (don't have enough context to understand 
what it does and didn't look into it). From you message, I assume you would 
prefer to have it in the enum too?

WDYT about the approach in general?



Comment at: clang/include/clang/AST/DependencyFlags.h:32-59
+constexpr inline DependencyFlags operator~(DependencyFlags F) {
+  return static_cast(
+  ~static_cast(F) & static_cast(DependencyFlags::All));
+}
+
+constexpr inline DependencyFlags operator|(DependencyFlags L,
+   DependencyFlags R) {

rsmith wrote:
> You can use LLVM's `BitmaskEnum` mechanism in place of these operators. 
> (`#include "clang/Basic/BitmaskEnum.h"` and add 
> `LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/UnexpandedPack)` to the end of 
> the enum.)
Thanks, that does look better. I've used this and also switched to 
non-strongly-typed enums to allow simple conversions to bool (and code like 
`bool IsTypeDependent = D & ExprDependence::Type`).

There's a catch, though. We can't use `LLVM_MARK_AS_BITMASK_ENUM` on two enums 
inside the same namespace, it results in redeclaration of the same enumerator.

So I had to put them into structs (to introduce a scope). Might be a bit weird, 
let me know what you think, changing back to strongly-typed enums should not be 
too hard. That would mean we need helpers like `isTypeDependent` or checks like 
`(D & Flags::Type) != Flags::None`, both don't look good.



Comment at: clang/include/clang/AST/DependencyFlags.h:81-85
+inline DependencyFlags turnTypeToValueDependency(DependencyFlags F) {
+  if (!isTypeDependent(F))
+return F;
+  return (F & ~DependencyFlags::Type) | DependencyFlags::Value;
+}

ilya-biryukov wrote:
> rsmith wrote:
> > This whole function should be equivalent to just `F & 
> > ~DependencyFlags::Type`. Any type-dependent expression must also be 
> > value-dependent, so you should never need to set the `::Value` bit. Perhaps 
> > we could assert this somewhere.
> Good point, I'll try to find a place to assert this with multiple types for 
> different AST categories.
Was thinking about the best place for assert.
Putting it into headers means introducing possibly ODR violations, we do care 
about keeping those off LLVM, right?
Putting it into the .cpp files means we're loosing optimization opportunities 
in non-LTO builds (those functions should really be inlined).

Decided to not put the 

[PATCH] D71920: [AST] Refactor propagation of dependency bits. NFC

2020-01-28 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 240958.
ilya-biryukov marked an inline comment as done and an inline comment as not 
done.
ilya-biryukov added a comment.

- Use different types for different AST categories
- Rename to getDependence


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71920

Files:
  clang-tools-extra/clang-tidy/hicpp/ExceptionBaseclassCheck.cpp
  clang/include/clang/AST/DependencyFlags.h
  clang/include/clang/AST/Expr.h
  clang/include/clang/AST/NestedNameSpecifier.h
  clang/include/clang/AST/Stmt.h
  clang/include/clang/AST/TemplateBase.h
  clang/include/clang/AST/TemplateName.h
  clang/include/clang/AST/Type.h
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/Expr.cpp
  clang/lib/AST/ExprCXX.cpp
  clang/lib/AST/ExprObjC.cpp
  clang/lib/AST/NestedNameSpecifier.cpp
  clang/lib/AST/TemplateBase.cpp
  clang/lib/AST/TemplateName.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Serialization/ASTReaderStmt.cpp

Index: clang/lib/Serialization/ASTReaderStmt.cpp
===
--- clang/lib/Serialization/ASTReaderStmt.cpp
+++ clang/lib/Serialization/ASTReaderStmt.cpp
@@ -11,7 +11,6 @@
 //
 //===--===//
 
-#include "clang/Serialization/ASTRecordReader.h"
 #include "clang/AST/ASTConcept.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/AttrIterator.h"
@@ -22,6 +21,7 @@
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/DeclarationName.h"
+#include "clang/AST/DependencyFlags.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ExprObjC.h"
@@ -49,6 +49,7 @@
 #include "clang/Basic/TypeTraits.h"
 #include "clang/Lex/Token.h"
 #include "clang/Serialization/ASTBitCodes.h"
+#include "clang/Serialization/ASTRecordReader.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
@@ -511,10 +512,23 @@
 void ASTStmtReader::VisitExpr(Expr *E) {
   VisitStmt(E);
   E->setType(Record.readType());
-  E->setTypeDependent(Record.readInt());
-  E->setValueDependent(Record.readInt());
-  E->setInstantiationDependent(Record.readInt());
-  E->ExprBits.ContainsUnexpandedParameterPack = Record.readInt();
+
+  // FIXME: write and read all DependentFlags with a single call.
+  bool TypeDependent = Record.readInt();
+  bool ValueDependent = Record.readInt();
+  bool InstantiationDependent = Record.readInt();
+  bool ContainsUnexpandedTemplateParameters = Record.readInt();
+  auto Deps = ExprDependence::None;
+  if (TypeDependent)
+Deps |= ExprDependence::Type;
+  if (ValueDependent)
+Deps |= ExprDependence::Value;
+  if (InstantiationDependent)
+Deps |= ExprDependence::Instantiation;
+  if (ContainsUnexpandedTemplateParameters)
+Deps |= ExprDependence::UnexpandedPack;
+  E->setDependencies(Deps);
+
   E->setValueKind(static_cast(Record.readInt()));
   E->setObjectKind(static_cast(Record.readInt()));
   assert(Record.getIdx() == NumExprFields &&
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -10,10 +10,10 @@
 //
 //===--===//
 
-#include "clang/Sema/Overload.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/CXXInheritance.h"
 #include "clang/AST/DeclObjC.h"
+#include "clang/AST/DependencyFlags.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ExprObjC.h"
@@ -24,6 +24,7 @@
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Sema/Initialization.h"
 #include "clang/Sema/Lookup.h"
+#include "clang/Sema/Overload.h"
 #include "clang/Sema/SemaInternal.h"
 #include "clang/Sema/Template.h"
 #include "clang/Sema/TemplateDeduction.h"
@@ -12694,9 +12695,7 @@
   // base classes.
   CallExpr *CE = CallExpr::Create(Context, Fn, Args, Context.DependentTy,
   VK_RValue, RParenLoc);
-  CE->setTypeDependent(true);
-  CE->setValueDependent(true);
-  CE->setInstantiationDependent(true);
+  CE->addDependencies(ExprDependence::TypeValueInstantiation);
   *Result = CE;
   return true;
 }
Index: clang/lib/AST/TemplateName.cpp
===
--- clang/lib/AST/TemplateName.cpp
+++ clang/lib/AST/TemplateName.cpp
@@ -13,6 +13,7 @@
 #include "clang/AST/TemplateName.h"
 #include "clang/AST/DeclBase.h"
 #include "clang/AST/DeclTemplate.h"
+#include "clang/AST/DependencyFlags.h"
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/PrettyPrinter.h"
 #include "clang/AST/TemplateBase.h"
@@ -168,52 +169,48 @@
   return TemplateName(Decl);
 }
 
-bool TemplateName::isDependent() const {
+TemplateNameDependence 

[PATCH] D73570: [FPEnv][X86] Platform-specific builtin constrained FP enablement

2020-01-28 Thread Kevin P. Neal via Phabricator via cfe-commits
kpn created this revision.
kpn added reviewers: craig.topper, andrew.w.kaylor.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

[FPEnv][X86] Platform-specific builtin constrained FP enablement

When constrained floating point is enabled the X86-specific builtins don't use 
constrained intrinsics in some cases. Fix that.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73570

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/avx512f-builtins-constrained.c
  clang/test/CodeGen/fma-builtins-constrained.c
  clang/test/CodeGen/sse-builtins-constrained.c

Index: clang/test/CodeGen/sse-builtins-constrained.c
===
--- /dev/null
+++ clang/test/CodeGen/sse-builtins-constrained.c
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=UNCONSTRAINED --check-prefix=COMMON --check-prefix=COMMONIR
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse -ffp-exception-behavior=strict -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=CONSTRAINED --check-prefix=COMMON --check-prefix=COMMONIR
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse -S %s -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK-ASM --check-prefix=COMMON
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse -ffp-exception-behavior=strict -S %s -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK-ASM --check-prefix=COMMON
+
+
+#include 
+
+__m128 test_mm_sqrt_ps(__m128 x) {
+  // COMMON-LABEL: test_mm_sqrt_ps
+  // UNCONSTRAINED: call <4 x float> @llvm.sqrt.v4f32(<4 x float> {{.*}})
+  // CONSTRAINED: call <4 x float> @llvm.experimental.constrained.sqrt.v4f32(<4 x float> {{.*}}, metadata !{{.*}})
+  // CHECK-ASM: sqrtps
+  return _mm_sqrt_ps(x);
+}
+
+__m128 test_sqrt_ss(__m128 x) {
+  // COMMON-LABEL: test_sqrt_ss
+  // COMMONIR: extractelement <4 x float> {{.*}}, i64 0
+  // UNCONSTRAINED: call float @llvm.sqrt.f32(float {{.*}})
+  // CONSTRAINED: call float @llvm.experimental.constrained.sqrt.f32(float {{.*}}, metadata !{{.*}})
+  // CHECK-ASM: sqrtss
+  // COMMONIR: insertelement <4 x float> {{.*}}, float {{.*}}, i64 0
+  return _mm_sqrt_ss(x);
+}
+
Index: clang/test/CodeGen/fma-builtins-constrained.c
===
--- /dev/null
+++ clang/test/CodeGen/fma-builtins-constrained.c
@@ -0,0 +1,352 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +fma -emit-llvm -o - | FileCheck --check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=UNCONSTRAINED %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +fma -ffp-exception-behavior=strict -emit-llvm -o - | FileCheck --check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=CONSTRAINED %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +fma -S -o - | FileCheck --check-prefix=COMMON --check-prefix=CHECK-ASM %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +fma -ffp-exception-behavior=strict -S -o - | FileCheck --check-prefix=COMMON --check-prefix=CHECK-ASM %s
+
+// FIXME: Several of these tests are broken when constrained.
+
+#include 
+
+__m128 test_mm_fmadd_ps(__m128 a, __m128 b, __m128 c) {
+  // COMMON-LABEL: test_mm_fmadd_ps
+  // UNCONSTRAINED: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}})
+  // CONSTRAINED: call <4 x float> @llvm.experimental.constrained.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}, metadata !{{.*}})
+  // CHECK-ASM: vfmadd213ps
+  return _mm_fmadd_ps(a, b, c);
+}
+
+__m128d test_mm_fmadd_pd(__m128d a, __m128d b, __m128d c) {
+  // COMMON-LABEL: test_mm_fmadd_pd
+  // UNCONSTRAINED: call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}})
+  // CONSTRAINED: call <2 x double> @llvm.experimental.constrained.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}}, metadata !{{.*}})
+  // CHECK-ASM: vfmadd213pd
+  return _mm_fmadd_pd(a, b, c);
+}
+
+__m128 test_mm_fmadd_ss(__m128 a, __m128 b, __m128 c) {
+  // COMMON-LABEL: test_mm_fmadd_ss
+  // COMMONIR: extractelement <4 x float> %{{.*}}, i64 0
+  // COMMONIR: extractelement <4 x float> %{{.*}}, i64 0
+  // COMMONIR: extractelement <4 x float> %{{.*}}, i64 0
+  // UNCONSTRAINED: call float @llvm.fma.f32(float %{{.*}}, float %{{.*}}, float %{{.*}})
+  // CONSTRAINED: call float @llvm.experimental.constrained.fma.f32(float %{{.*}}, float %{{.*}}, float %{{.*}}, metadata !{{.*}})
+  // CHECK-ASM: vfmadd213ss
+  // COMMONIR: insertelement <4 x float> %{{.*}}, float %{{.*}}, i64 0
+  return _mm_fmadd_ss(a, b, c);
+}
+
+__m128d test_mm_fmadd_sd(__m128d a, __m128d b, __m128d c) {
+ 

[PATCH] D73282: Fix debug-info generation for block invocations so that we set the LinkageName instead of the Name

2020-01-28 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added inline comments.



Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:3659
 // Use llvm function name.
-Name = Fn->getName();
+if (Fn->getName().startswith("___Z"))
+  LinkageName = Fn->getName();

shafik wrote:
> dblaikie wrote:
> > aprantl wrote:
> > > aprantl wrote:
> > > > Could you please add a comment that Clang Blocks are generated as raw 
> > > > llvm::Functions but do have a mangled name and that is handling this 
> > > > case? Otherwise this would look suspicious.
> > > Should *all* raw LLVM functions have their name as the linkage name? 
> > > Perhaps a raw LLVM function should only have a linkage name and no 
> > > human-readable name?
> > Seems plausible to me - do we have any data on other types of functions 
> > that hit this codepath? 
> So it was not obvious to me what other cases would this branch so I added an 
> assert and ran `check-clang` and from that I saw four cases that ended up 
> here:
> 
> `GenerateCapturedStmtFunction`
> `GenerateOpenMPCapturedStmtFunction`
> `GenerateBlockFunction`
> `generateDestroyHelper`
> 
> It is not obvious to me we want to alter the behavior of any of the other 
> cases.
Could you show any small source examples & their corresponding DWARF & how that 
DWARF would change? (what names are we using, what names would we end up 
using/what sort of things are they naming)


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

https://reviews.llvm.org/D73282



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


[PATCH] D73282: Fix debug-info generation for block invocations so that we set the LinkageName instead of the Name

2020-01-28 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik marked an inline comment as done.
shafik added inline comments.



Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:3659
 // Use llvm function name.
-Name = Fn->getName();
+if (Fn->getName().startswith("___Z"))
+  LinkageName = Fn->getName();

dblaikie wrote:
> aprantl wrote:
> > aprantl wrote:
> > > Could you please add a comment that Clang Blocks are generated as raw 
> > > llvm::Functions but do have a mangled name and that is handling this 
> > > case? Otherwise this would look suspicious.
> > Should *all* raw LLVM functions have their name as the linkage name? 
> > Perhaps a raw LLVM function should only have a linkage name and no 
> > human-readable name?
> Seems plausible to me - do we have any data on other types of functions that 
> hit this codepath? 
So it was not obvious to me what other cases would this branch so I added an 
assert and ran `check-clang` and from that I saw four cases that ended up here:

`GenerateCapturedStmtFunction`
`GenerateOpenMPCapturedStmtFunction`
`GenerateBlockFunction`
`generateDestroyHelper`

It is not obvious to me we want to alter the behavior of any of the other cases.


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

https://reviews.llvm.org/D73282



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


[PATCH] D73285: [OpenMP][OMPIRBuilder][BugFix] Handle Unreachable Finalization blocks in `parallel` generation

2020-01-28 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added inline comments.



Comment at: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp:661
+AfterIP = InsertPointTy(ForkBB, ForkBB->end());
+  }
 

Why do we need all of this? Can't we just *not do it* instead? This is code 
complexity that we should avoid.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73285



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


[PATCH] D73567: [NFC] Removing experimental designation for ninja in docs.

2020-01-28 Thread Nate Voorhies via Phabricator via cfe-commits
ncv created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
ncv added a reviewer: nikola.

Ninja is no longer an experimental tool, documentation changed to
reflect this.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73567

Files:
  clang/docs/HowToSetupToolingForLLVM.rst


Index: clang/docs/HowToSetupToolingForLLVM.rst
===
--- clang/docs/HowToSetupToolingForLLVM.rst
+++ clang/docs/HowToSetupToolingForLLVM.rst
@@ -140,7 +140,7 @@
   return new clang::ASTConsumer();
   }
 
-(Experimental) Using Ninja Build System
+Using Ninja Build System
 ===
 
 Optionally you can use the `Ninja `_
@@ -197,4 +197,3 @@
   $ ninja check-all
 
 Other target names can be used in the same way as with make.
-


Index: clang/docs/HowToSetupToolingForLLVM.rst
===
--- clang/docs/HowToSetupToolingForLLVM.rst
+++ clang/docs/HowToSetupToolingForLLVM.rst
@@ -140,7 +140,7 @@
   return new clang::ASTConsumer();
   }
 
-(Experimental) Using Ninja Build System
+Using Ninja Build System
 ===
 
 Optionally you can use the `Ninja `_
@@ -197,4 +197,3 @@
   $ ninja check-all
 
 Other target names can be used in the same way as with make.
-
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73285: [OpenMP][OMPIRBuilder][BugFix] Handle Unreachable Finalization blocks in `parallel` generation

2020-01-28 Thread Fady Ghanim via Phabricator via cfe-commits
fghanim updated this revision to Diff 240949.
fghanim added a comment.

- Squashing all the commits


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73285

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
  llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp

Index: llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
===
--- llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
+++ llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
@@ -400,6 +400,78 @@
   EXPECT_EQ(ForkCI->getArgOperand(3), F->arg_begin());
 }
 
+TEST_F(OpenMPIRBuilderTest, ParallelEndless) {
+  using InsertPointTy = OpenMPIRBuilder::InsertPointTy;
+  OpenMPIRBuilder OMPBuilder(*M);
+  OMPBuilder.initialize();
+  F->setName("func");
+  IRBuilder<> Builder(BB);
+
+  OpenMPIRBuilder::LocationDescription Loc({Builder.saveIP(), DL});
+
+  unsigned NumBodiesGenerated = 0;
+  unsigned NumPrivatizedVars = 0;
+  unsigned NumFinalizationPoints = 0;
+
+  BasicBlock *OutlinedBodyBB = nullptr;
+  auto BodyGenCB = [&](InsertPointTy AllocaIP, InsertPointTy CodeGenIP,
+   BasicBlock ) {
+++NumBodiesGenerated;
+
+auto *OldBB = OutlinedBodyBB = CodeGenIP.getBlock();
+
+// Create an endless loop.
+OldBB->getTerminator()->eraseFromParent();
+BranchInst::Create(OldBB, OldBB);
+
+Builder.ClearInsertionPoint();
+  };
+
+  auto PrivCB = [&](InsertPointTy AllocaIP, InsertPointTy CodeGenIP,
+Value , Value *) -> InsertPointTy {
+++NumPrivatizedVars;
+return CodeGenIP;
+  };
+
+  auto FiniCB = [&](InsertPointTy CodeGenIP) { ++NumFinalizationPoints; };
+
+  IRBuilder<>::InsertPoint AfterIP =
+  OMPBuilder.CreateParallel(Loc, BodyGenCB, PrivCB, FiniCB, nullptr,
+nullptr, OMP_PROC_BIND_default, false);
+
+  EXPECT_EQ(NumBodiesGenerated, 1U);
+  EXPECT_EQ(NumPrivatizedVars, 0U);
+  EXPECT_EQ(NumFinalizationPoints, 0U);
+
+  Builder.restoreIP(AfterIP);
+  Builder.CreateRetVoid();
+
+  ASSERT_NE(OutlinedBodyBB, nullptr);
+  Function *OutlinedFn = OutlinedBodyBB->getParent();
+  EXPECT_NE(F, OutlinedFn);
+  EXPECT_FALSE(verifyModule(*M));
+  EXPECT_TRUE(OutlinedFn->hasFnAttribute(Attribute::NoUnwind));
+  EXPECT_TRUE(OutlinedFn->hasFnAttribute(Attribute::NoRecurse));
+  EXPECT_TRUE(OutlinedFn->hasParamAttribute(0, Attribute::NoAlias));
+  EXPECT_TRUE(OutlinedFn->hasParamAttribute(1, Attribute::NoAlias));
+
+  EXPECT_TRUE(OutlinedFn->hasInternalLinkage());
+  EXPECT_EQ(OutlinedFn->arg_size(), 2U);
+
+  EXPECT_EQ(OutlinedFn->getNumUses(), 1U);
+  User *Usr = OutlinedFn->user_back();
+  ASSERT_TRUE(isa(Usr));
+  CallInst *ForkCI = dyn_cast(Usr->user_back());
+  ASSERT_NE(ForkCI, nullptr);
+
+  EXPECT_EQ(ForkCI->getCalledFunction()->getName(), "__kmpc_fork_call");
+  EXPECT_EQ(ForkCI->getNumArgOperands(), 3U);
+  EXPECT_TRUE(isa(ForkCI->getArgOperand(0)));
+  EXPECT_EQ(ForkCI->getArgOperand(1),
+ConstantInt::get(Type::getInt32Ty(Ctx), 0U));
+  EXPECT_EQ(ForkCI->getArgOperand(2), Usr);
+}
+
 TEST_F(OpenMPIRBuilderTest, ParallelIfCond) {
   using InsertPointTy = OpenMPIRBuilder::InsertPointTy;
   OpenMPIRBuilder OMPBuilder(*M);
Index: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
===
--- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -439,6 +439,18 @@
 Worklist.push_back(SuccBB);
   }
 
+  // If we didn't emit a branch to FiniBB during body generation, it means
+  // FiniBB is unreachable (e.g. while(1);). stop generating all the
+  // unreachable blocks, and remove anything we are not going to use.
+  // Check to see if PRegPreFiniBB is reachable from PRegionBodyBB.
+  bool FoundPreFiniBB = false;
+  for (auto BI : ParallelRegionBlocks) {
+if (BI == PRegPreFiniBB) {
+  FoundPreFiniBB = true;
+  break;
+}
+  }
+
   CodeExtractorAnalysisCache CEAC(*OuterFn);
   CodeExtractor Extractor(ParallelRegionBlocks, /* DominatorTree */ nullptr,
   /* AggregateArgs */ false,
@@ -564,7 +576,7 @@
 }
   }
 
-  Builder.CreateCall(RTLFn, RealArgs);
+  CallInst *ForkCall = Builder.CreateCall(RTLFn, RealArgs);
 
   LLVM_DEBUG(dbgs() << "With fork_call placed: "
 << *Builder.GetInsertBlock()->getParent() << "\n");
@@ -583,7 +595,6 @@
   if (!ElseTI) {
 CI->eraseFromParent();
   } else {
-
 // If an "if" clause was present we are now generating the serialized
 // version into the "else" branch.
 Builder.SetInsertPoint(ElseTI);
@@ -608,22 +619,46 @@
   << *Builder.GetInsertBlock()->getParent() << "\n");
   }
 
-  // Adjust the finalization stack, verify the adjustment, and call the
-  // finalize function a last time to finalize values between the pre-fini block
-  

[PATCH] D73299: [HIP] Fix environment variable HIP_DEVICE_LIB_PATH

2020-01-28 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

In D73299#1845162 , @thakis wrote:

> This breaks check-clang on Windows: http://45.33.8.238/win/6843/step_7.txt
>
> You probably want "env FOO=bar" instead of "FOO=bar" in the test file.


Fixed. Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73299



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


[clang] b8d9ac0 - Fix test hip-device-libs.hip

2020-01-28 Thread Yaxun Liu via cfe-commits

Author: Yaxun (Sam) Liu
Date: 2020-01-28T13:58:18-05:00
New Revision: b8d9ac08703b1ae9c3cd721c39774053786a9980

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

LOG: Fix test hip-device-libs.hip

Added: 


Modified: 
clang/test/Driver/hip-device-libs.hip

Removed: 




diff  --git a/clang/test/Driver/hip-device-libs.hip 
b/clang/test/Driver/hip-device-libs.hip
index d546645a9d0b..97e76525dde8 100644
--- a/clang/test/Driver/hip-device-libs.hip
+++ b/clang/test/Driver/hip-device-libs.hip
@@ -21,7 +21,7 @@
 
 // Test environment variable HIP_DEVICE_LIB_PATH
 
-// RUN: HIP_DEVICE_LIB_PATH=%S/Inputs/hip_dev_lib \
+// RUN: env HIP_DEVICE_LIB_PATH=%S/Inputs/hip_dev_lib \
 // RUN:   %clang -### -target x86_64-linux-gnu \
 // RUN:   -x hip --cuda-gpu-arch=gfx900 \
 // RUN:   %S/Inputs/hip_multiple_inputs/b.hip \



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


[PATCH] D73299: [HIP] Fix environment variable HIP_DEVICE_LIB_PATH

2020-01-28 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

This breaks check-clang on Windows: http://45.33.8.238/win/6843/step_7.txt

You probably want "env FOO=bar" instead of "FOO=bar" in the test file.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73299



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


[PATCH] D73562: [ASTMatchers] Add isPlacement traversal matcher for CXXNewExpr

2020-01-28 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon times-circle color=red} Unit tests: fail. 62272 tests passed, 1 failed 
and 827 were skipped.

  failed: Clang.CodeGenOpenCL/amdgpu-features.cl

{icon check-circle color=green} clang-tidy: pass.

{icon check-circle color=green} clang-format: pass.

Build artifacts 
: 
diff.json 
,
 clang-tidy.txt 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 


//Pre-merge checks is in beta. Report issue 
.
 Please join beta  or enable 
it for your project 
.//


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73562



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


[PATCH] D72723: Built-in functions for AMDGPU MFMA instructions.

2020-01-28 Thread Konstantin Pyzhov via Phabricator via cfe-commits
kpyzhov added a comment.

I've pushed the fix already. Is something still broken?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72723



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


[PATCH] D72829: Implement -fsemantic-interposition

2020-01-28 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added inline comments.



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:3011
+  if (Args.hasArg(OPT_fsemantic_interposition) && Opts.PICLevel && !Opts.PIE)
+Opts.SemanticInterposition = 1;
+

`Opts.SemanticInterposition` is initialized to 0 and is not assigned elsewhere.

`Opts.SemanticInterposition = ...` should be possible.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72829



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


[clang] 987aa34 - Corrected clang amdgpu-features.cl test for 6d614a82a4230ea69e322f56dc18dcbd815ed37b (AMDGPU MFMA built-ins)

2020-01-28 Thread Konstantin Pyzhov via cfe-commits

Author: Konstantin Pyzhov
Date: 2020-01-28T05:41:42-05:00
New Revision: 987aa3435f4517d663f776e261683b1620eb8101

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

LOG: Corrected clang amdgpu-features.cl test for 
6d614a82a4230ea69e322f56dc18dcbd815ed37b (AMDGPU MFMA built-ins)

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

Added: 


Modified: 
clang/test/CodeGenOpenCL/amdgpu-features.cl

Removed: 




diff  --git a/clang/test/CodeGenOpenCL/amdgpu-features.cl 
b/clang/test/CodeGenOpenCL/amdgpu-features.cl
index f3ed26494831..d8eb2d26b0e3 100644
--- a/clang/test/CodeGenOpenCL/amdgpu-features.cl
+++ b/clang/test/CodeGenOpenCL/amdgpu-features.cl
@@ -16,7 +16,7 @@
 
 // GFX904: 
"target-features"="+16-bit-insts,+ci-insts,+dpp,+flat-address-space,+fp64-fp16-denormals,+gfx8-insts,+gfx9-insts,+s-memrealtime,-fp32-denormals"
 // GFX906: 
"target-features"="+16-bit-insts,+ci-insts,+dl-insts,+dot1-insts,+dot2-insts,+dpp,+flat-address-space,+fp64-fp16-denormals,+gfx8-insts,+gfx9-insts,+s-memrealtime,-fp32-denormals"
-// GFX908: 
"target-features"="+16-bit-insts,+ci-insts,+dl-insts,+dot1-insts,+dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dpp,+flat-address-space,+fp64-fp16-denormals,+gfx8-insts,+gfx9-insts,+s-memrealtime,-fp32-denormals"
+// GFX908: 
"target-features"="+16-bit-insts,+ci-insts,+dl-insts,+dot1-insts,+dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dpp,+flat-address-space,+fp64-fp16-denormals,+gfx8-insts,+gfx9-insts,+mai-insts,+s-memrealtime,-fp32-denormals"
 // GFX1010: 
"target-features"="+16-bit-insts,+ci-insts,+dl-insts,+dpp,+flat-address-space,+fp64-fp16-denormals,+gfx10-insts,+gfx8-insts,+gfx9-insts,+s-memrealtime,-fp32-denormals"
 // GFX1011: 
"target-features"="+16-bit-insts,+ci-insts,+dl-insts,+dot1-insts,+dot2-insts,+dot5-insts,+dot6-insts,+dpp,+flat-address-space,+fp64-fp16-denormals,+gfx10-insts,+gfx8-insts,+gfx9-insts,+s-memrealtime,-fp32-denormals"
 // GFX1012: 
"target-features"="+16-bit-insts,+ci-insts,+dl-insts,+dot1-insts,+dot2-insts,+dot5-insts,+dot6-insts,+dpp,+flat-address-space,+fp64-fp16-denormals,+gfx10-insts,+gfx8-insts,+gfx9-insts,+s-memrealtime,-fp32-denormals"



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


[PATCH] D72829: Implement -fsemantic-interposition

2020-01-28 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D72829#1844050 , @serge-sans-paille 
wrote:

> @MaskRay should we add a verifier step to check that 
> pie/pic/semanticinterposition module flags are consistent, or leave that to 
> clang ?


I suppose you mean whether "SemanticInterposition" should be invalidated when 
`"PIC Level"` does not exist or `"PIE Level"` exists. I am a bit inclined to 
make it more flexible/orthogonal in the backend, i.e. SemanticInterposition is 
in affect even if "PIE Level" is set.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72829



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


[PATCH] D73231: [CUDA] Assume the latest known CUDA version if we've found an unknown one.

2020-01-28 Thread Artem Belevich via Phabricator via cfe-commits
tra added a subscriber: hans.
tra added a comment.

@hans : that's another candidate for 10.x cherry-pick, if you're OK with it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73231



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


[PATCH] D72527: [clang-tidy] adjust scripts to subsubsections in Release Notes

2020-01-28 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment.

In D72527#1845009 , @Eugene.Zelenko 
wrote:

> Rebase from master.


Committed, I still not 100% sure on landing on behalf of someone else so I 
think it hasn't credited you unfortunately, arc should have better docs...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72527



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


[PATCH] D73231: [CUDA] Assume the latest known CUDA version if we've found an unknown one.

2020-01-28 Thread Artem Belevich via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG12fefeef203a: [CUDA] Assume the latest known CUDA version if 
weve found an unknown one. (authored by tra).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73231

Files:
  clang/include/clang/Basic/Cuda.h
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/lib/Basic/Cuda.cpp
  clang/lib/Driver/ToolChains/Cuda.cpp
  clang/lib/Headers/__clang_cuda_runtime_wrapper.h
  clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/bin/.keep
  clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/include/.keep
  clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/lib/.keep
  clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/lib64/.keep
  
clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/nvvm/libdevice/libdevice.10.bc
  clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/version.txt
  clang/test/Driver/cuda-version-check.cu

Index: clang/test/Driver/cuda-version-check.cu
===
--- clang/test/Driver/cuda-version-check.cu
+++ clang/test/Driver/cuda-version-check.cu
@@ -8,6 +8,8 @@
 // RUN:FileCheck %s --check-prefix=OK
 // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda 2>&1 %s | \
 // RUN:FileCheck %s --check-prefix=OK
+// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA-unknown/usr/local/cuda 2>&1 %s | \
+// RUN:FileCheck %s --check-prefix=UNKNOWN_VERSION
 
 // The installation at Inputs/CUDA is CUDA 7.0, which doesn't support sm_60.
 // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \
@@ -58,3 +60,5 @@
 
 // ERR_SM61: error: GPU arch sm_61 {{.*}}
 // ERR_SM61-NOT: error: GPU arch sm_61
+
+// UNKNOWN_VERSION: Unknown CUDA version 999.999. Assuming the latest supported version
Index: clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/version.txt
===
--- /dev/null
+++ clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/version.txt
@@ -0,0 +1 @@
+CUDA Version 999.999.999
Index: clang/lib/Headers/__clang_cuda_runtime_wrapper.h
===
--- clang/lib/Headers/__clang_cuda_runtime_wrapper.h
+++ clang/lib/Headers/__clang_cuda_runtime_wrapper.h
@@ -48,7 +48,7 @@
 #include "cuda.h"
 #if !defined(CUDA_VERSION)
 #error "cuda.h did not define CUDA_VERSION"
-#elif CUDA_VERSION < 7000 || CUDA_VERSION > 10010
+#elif CUDA_VERSION < 7000
 #error "Unsupported CUDA version!"
 #endif
 
Index: clang/lib/Driver/ToolChains/Cuda.cpp
===
--- clang/lib/Driver/ToolChains/Cuda.cpp
+++ clang/lib/Driver/ToolChains/Cuda.cpp
@@ -33,37 +33,24 @@
 
 // Parses the contents of version.txt in an CUDA installation.  It should
 // contain one line of the from e.g. "CUDA Version 7.5.2".
-static CudaVersion ParseCudaVersionFile(llvm::StringRef V) {
+static CudaVersion ParseCudaVersionFile(const Driver , llvm::StringRef V) {
   if (!V.startswith("CUDA Version "))
 return CudaVersion::UNKNOWN;
   V = V.substr(strlen("CUDA Version "));
-  int Major = -1, Minor = -1;
-  auto First = V.split('.');
-  auto Second = First.second.split('.');
-  if (First.first.getAsInteger(10, Major) ||
-  Second.first.getAsInteger(10, Minor))
+  SmallVector VersionParts;
+  V.split(VersionParts, '.');
+  if (VersionParts.size() < 2)
 return CudaVersion::UNKNOWN;
-
-  if (Major == 7 && Minor == 0) {
-// This doesn't appear to ever happen -- version.txt doesn't exist in the
-// CUDA 7 installs I've seen.  But no harm in checking.
-return CudaVersion::CUDA_70;
-  }
-  if (Major == 7 && Minor == 5)
-return CudaVersion::CUDA_75;
-  if (Major == 8 && Minor == 0)
-return CudaVersion::CUDA_80;
-  if (Major == 9 && Minor == 0)
-return CudaVersion::CUDA_90;
-  if (Major == 9 && Minor == 1)
-return CudaVersion::CUDA_91;
-  if (Major == 9 && Minor == 2)
-return CudaVersion::CUDA_92;
-  if (Major == 10 && Minor == 0)
-return CudaVersion::CUDA_100;
-  if (Major == 10 && Minor == 1)
-return CudaVersion::CUDA_101;
-  return CudaVersion::UNKNOWN;
+  std::string MajorMinor = join_items(".", VersionParts[0], VersionParts[1]);
+  CudaVersion Version = CudaStringToVersion(MajorMinor);
+  if (Version != CudaVersion::UNKNOWN)
+return Version;
+
+  // Issue a warning and assume that the version we've found is compatible with
+  // the latest version we support.
+  D.Diag(diag::warn_drv_unknown_cuda_version)
+  << MajorMinor << CudaVersionToString(CudaVersion::LATEST);
+  return CudaVersion::LATEST;
 }
 
 CudaInstallationDetector::CudaInstallationDetector(
@@ -161,7 +148,7 @@
   // 

[PATCH] D73184: [CodeGen] Emit IR for compound assignment with fixed-point operands.

2020-01-28 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Please test the cases where the result is used; this should be handled for you 
automatically, but still.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73184



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


[PATCH] D72723: Built-in functions for AMDGPU MFMA instructions.

2020-01-28 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

Things have been broken for 1.5 hours now. Time to revert?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72723



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


[clang] 12fefee - [CUDA] Assume the latest known CUDA version if we've found an unknown one.

2020-01-28 Thread Artem Belevich via cfe-commits

Author: Artem Belevich
Date: 2020-01-28T10:11:42-08:00
New Revision: 12fefeef203ab4ef52d19bcdbd4180608a4deae1

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

LOG: [CUDA] Assume the latest known CUDA version if we've found an unknown one.

This makes clang somewhat forward-compatible with new CUDA releases
without having to patch it for every minor release without adding
any new function.

If an unknown version is found, clang issues a warning (can be disabled
with -Wno-cuda-unknown-version) and assumes that it has detected
the latest known version. CUDA releases are usually supersets
of older ones feature-wise, so it should be sufficient to keep
released clang versions working with minor CUDA updates without
having to upgrade clang, too.

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

Added: 
clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/bin/.keep
clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/include/.keep
clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/lib/.keep
clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/lib64/.keep

clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/nvvm/libdevice/libdevice.10.bc
clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/version.txt

Modified: 
clang/include/clang/Basic/Cuda.h
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/include/clang/Basic/DiagnosticGroups.td
clang/lib/Basic/Cuda.cpp
clang/lib/Driver/ToolChains/Cuda.cpp
clang/lib/Headers/__clang_cuda_runtime_wrapper.h
clang/test/Driver/cuda-version-check.cu

Removed: 




diff  --git a/clang/include/clang/Basic/Cuda.h 
b/clang/include/clang/Basic/Cuda.h
index ef5d24dcf888..da572957d10d 100644
--- a/clang/include/clang/Basic/Cuda.h
+++ b/clang/include/clang/Basic/Cuda.h
@@ -11,6 +11,7 @@
 
 namespace llvm {
 class StringRef;
+class Twine;
 class VersionTuple;
 } // namespace llvm
 
@@ -30,7 +31,7 @@ enum class CudaVersion {
 };
 const char *CudaVersionToString(CudaVersion V);
 // Input is "Major.Minor"
-CudaVersion CudaStringToVersion(llvm::StringRef S);
+CudaVersion CudaStringToVersion(const llvm::Twine );
 
 enum class CudaArch {
   UNKNOWN,

diff  --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td 
b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 2da41bef2669..ecd871e36ee8 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -60,6 +60,9 @@ def err_drv_cuda_version_unsupported : Error<
   "but installation at %3 is %4.  Use --cuda-path to specify a 
diff erent CUDA "
   "install, pass a 
diff erent GPU arch with --cuda-gpu-arch, or pass "
   "--no-cuda-version-check.">;
+def warn_drv_unknown_cuda_version: Warning<
+  "Unknown CUDA version %0. Assuming the latest supported version %1">,
+  InGroup;
 def err_drv_cuda_host_arch : Error<"unsupported architecture '%0' for host 
compilation.">;
 def err_drv_mix_cuda_hip : Error<"Mixed Cuda and HIP compilation is not 
supported.">;
 def err_drv_invalid_thread_model_for_target : Error<

diff  --git a/clang/include/clang/Basic/DiagnosticGroups.td 
b/clang/include/clang/Basic/DiagnosticGroups.td
index d98ca36b22c7..f11a69d5f2cd 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -1113,6 +1113,9 @@ def SerializedDiagnostics : 
DiagGroup<"serialized-diagnostics">;
 // compiling CUDA C/C++ but which is not compatible with the CUDA spec.
 def CudaCompat : DiagGroup<"cuda-compat">;
 
+// Warning about unknown CUDA SDK version.
+def CudaUnknownVersion: DiagGroup<"unknown-cuda-version">;
+
 // A warning group for warnings about features supported by HIP but
 // ignored by CUDA.
 def HIPOnly : DiagGroup<"hip-only">;

diff  --git a/clang/lib/Basic/Cuda.cpp b/clang/lib/Basic/Cuda.cpp
index f2b6c8cd3ee9..e06d120c58bf 100644
--- a/clang/lib/Basic/Cuda.cpp
+++ b/clang/lib/Basic/Cuda.cpp
@@ -2,6 +2,7 @@
 
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSwitch.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/VersionTuple.h"
 
@@ -31,8 +32,8 @@ const char *CudaVersionToString(CudaVersion V) {
   llvm_unreachable("invalid enum");
 }
 
-CudaVersion CudaStringToVersion(llvm::StringRef S) {
-  return llvm::StringSwitch(S)
+CudaVersion CudaStringToVersion(const llvm::Twine ) {
+  return llvm::StringSwitch(S.str())
   .Case("7.0", CudaVersion::CUDA_70)
   .Case("7.5", CudaVersion::CUDA_75)
   .Case("8.0", CudaVersion::CUDA_80)
@@ -40,7 +41,8 @@ CudaVersion CudaStringToVersion(llvm::StringRef S) {
   .Case("9.1", CudaVersion::CUDA_91)
   .Case("9.2", CudaVersion::CUDA_92)
   .Case("10.0", CudaVersion::CUDA_100)
-  .Case("10.1", 

[PATCH] D72527: [clang-tidy] adjust scripts to subsubsections in Release Notes

2020-01-28 Thread Nathan James via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG66e47a57205b: [clang-tidy] adjust scripts to subsubsections 
in Release Notes (authored by njames93).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72527

Files:
  clang-tools-extra/clang-tidy/add_new_check.py
  clang-tools-extra/clang-tidy/rename_check.py
  clang-tools-extra/docs/ReleaseNotes.rst


Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -88,8 +88,8 @@
   Flags use of the `C` standard library functions ``memset``, ``memcpy`` and
   ``memcmp`` and similar derivatives on non-trivial types.
 
-New aliases
-^^^
+New check aliases
+^
 
 - New alias :doc:`cert-dcl37-c
   ` to
Index: clang-tools-extra/clang-tidy/rename_check.py
===
--- clang-tools-extra/clang-tidy/rename_check.py
+++ clang-tools-extra/clang-tidy/rename_check.py
@@ -176,11 +176,11 @@
 
 for line in lines:
   if not note_added:
-match = re.search('Improvements to clang-tidy', line)
+match = re.search('Renamed checks', line)
 if match:
   header_found = True
 elif header_found:
-  if not line.startswith(''):
+  if not line.startswith(''):
 f.write("""
 - The '%s' check was renamed to :doc:`%s
   `
Index: clang-tools-extra/clang-tidy/add_new_check.py
===
--- clang-tools-extra/clang-tidy/add_new_check.py
+++ clang-tools-extra/clang-tidy/add_new_check.py
@@ -219,8 +219,8 @@
   with open(filename, 'r') as f:
 lines = f.readlines()
 
-  lineMatcher = re.compile('Improvements to clang-tidy')
-  nextSectionMatcher = re.compile('Improvements to clang-include-fixer')
+  lineMatcher = re.compile('New checks')
+  nextSectionMatcher = re.compile('New check aliases')
   checkerMatcher = re.compile('- New :doc:`(.*)')
 
   print('Updating %s...' % filename)
@@ -249,12 +249,12 @@
   f.write(line)
   continue
 
-if line.startswith(''):
+if line.startswith(''):
   f.write(line)
   continue
 
 if header_found and add_note_here:
-  if not line.startswith(''):
+  if not line.startswith(''):
 f.write("""- New :doc:`%s
   ` check.
 


Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -88,8 +88,8 @@
   Flags use of the `C` standard library functions ``memset``, ``memcpy`` and
   ``memcmp`` and similar derivatives on non-trivial types.
 
-New aliases
-^^^
+New check aliases
+^
 
 - New alias :doc:`cert-dcl37-c
   ` to
Index: clang-tools-extra/clang-tidy/rename_check.py
===
--- clang-tools-extra/clang-tidy/rename_check.py
+++ clang-tools-extra/clang-tidy/rename_check.py
@@ -176,11 +176,11 @@
 
 for line in lines:
   if not note_added:
-match = re.search('Improvements to clang-tidy', line)
+match = re.search('Renamed checks', line)
 if match:
   header_found = True
 elif header_found:
-  if not line.startswith(''):
+  if not line.startswith(''):
 f.write("""
 - The '%s' check was renamed to :doc:`%s
   `
Index: clang-tools-extra/clang-tidy/add_new_check.py
===
--- clang-tools-extra/clang-tidy/add_new_check.py
+++ clang-tools-extra/clang-tidy/add_new_check.py
@@ -219,8 +219,8 @@
   with open(filename, 'r') as f:
 lines = f.readlines()
 
-  lineMatcher = re.compile('Improvements to clang-tidy')
-  nextSectionMatcher = re.compile('Improvements to clang-include-fixer')
+  lineMatcher = re.compile('New checks')
+  nextSectionMatcher = re.compile('New check aliases')
   checkerMatcher = re.compile('- New :doc:`(.*)')
 
   print('Updating %s...' % filename)
@@ -249,12 +249,12 @@
   f.write(line)
   continue
 
-if line.startswith(''):
+if line.startswith(''):
   f.write(line)
   continue
 
 if header_found and add_note_here:
-  if not line.startswith(''):
+  if not line.startswith(''):
 f.write("""- New :doc:`%s
   ` check.
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2020-01-28 Thread Melanie Blower via Phabricator via cfe-commits
mibintc marked 6 inline comments as done.
mibintc added a comment.

In D72841#1842772 , @andrew.w.kaylor 
wrote:

> It's not clear to me from reading this how the "precise" control is going to 
> work with relation to the fast math flags. I don't think MSVC allows the 
> granularity of control over these flags that we have in clang, so maybe they 
> don't have this problem.


You're right, MSVC only allows the pragma at file scope.

> Consider this code: https://godbolt.org/z/mHiLCm
> 
> With the options "-ffp-model=precise -fno-honor-infinities -fno-honor-nans" 
> the math operations here are generated with the "nnan ninf contract" flags. 
> That's correct. What will happen when I use the pragma to turn precise off? 
> Does it enable all fast math flags? Will the subsequent "pop" leave the "ninf 
> nnan" fast math flags enabled?

This patch doesn't have support for turning precise off, that's a bug, I will 
revisit.  This is my plan for how to handle enabling/disabling fast math: 
IRBuilder.h has settings FMF, and also supplies clearFastMathFlags, 
setFastMathFlags(flags) and FastMathFlagGuard. When the expression is walked 
that alters the FMF, use FastMathFlagGuard to save the current state of FMF, 
modify the settings using the clear or set functions, walk the expression. 
After the expression is walked, the FMF settings will be restored to previous 
state by the FastMathFlagGuard destructor.

> As I said, I don't think you can get into this situation with MSVC. I believe 
> that icc will go into full fast math mode with the "precise, off, push" 
> pragma but will go back to "nnan ninf contract" mode with the pop. At least, 
> that's what the design docs say. I haven't looked at the code to verify this. 
> It seems like the correct behavior in any case. I think the clang FPOptions 
> needs individual entries for all of the fast math flags to handle this case.

Thanks I'll investigate this and add test cases.  I think possibly since 
IRBuilder has the FMF like I described above it might work with current 
support. Is there currently a way to modify nan and inf at the source level or 
only by compiler option?  BTW I've been asked to implement a pragma to control 
fp "reassoc" at the source level. I'm planning to do that after this patch is 
complete.




Comment at: clang/docs/LanguageExtensions.rst:3042
+by the pragma behaves as though the command-line option ``ffp-model=precise``
+is enabled.  That is, fast-math is disabled and fp-contract=on (fused
+multiple add) is enabled.

andrew.w.kaylor wrote:
> Re  "fp-contraction=on": I agree that this is what it should do, but I don't 
> think that's what fp-model=precise currently does. I think it's setting 
> fp-contraction=fast.
Oh, I looked back at the patch for -ffp-model and precise is documented to set 
ffp-contract=fast. Not sure why I thought that was right. I'll have to redo it.



Comment at: clang/docs/LanguageExtensions.rst:3050
+
+The full syntax this pragma supports is ``float_control(except|precise, 
on|off, [push])`` and ``float_control(push|pop)``.  The ``push`` and ``pop`` 
forms can only occur at file scope.
+

andrew.w.kaylor wrote:
> andrew.w.kaylor wrote:
> > Looks like you need a line break here.
> Are the precise and except stacks independent?
No, the stack that tracks the float control pragma settings is a pair, roughly 
(IsPreciseEnabled, IsExceptEnabled)



Comment at: clang/include/clang/Basic/LangOptions.h:363
+exceptions(LangOptions::FPE_Ignore),
+fp_precise(false)
 {}

andrew.w.kaylor wrote:
> It seems like fp_precise describes too many things to be a single option. 
> Even within this set of options it overlaps with fp_contract.
I see your point.  I wanted it to reflect the current pragma setting that's why 
I kept it intact.  I'll rethink this.



Comment at: clang/test/CodeGen/fp-floatcontrol-stack.cpp:124
+#if DEFAULT
+//CHECK-DDEFAULT: fmul float
+//CHECK-DDEFAULT: fadd float

andrew.w.kaylor wrote:
> Are there also fast-math flags set here? If not, why not?
that's a bug. thanks 



Comment at: clang/test/CodeGen/fp-floatcontrol-stack.cpp:2
+// RUN: %clang_cc1 -DDEFAULT=1 -emit-llvm -o - %s | FileCheck 
--check-prefix=CHECK-DDEFAULT %s
+// RUN: %clang_cc1 -DEBSTRICT=1 -ffp-exception-behavior=strict -emit-llvm -o - 
%s | FileCheck --check-prefix=CHECK-DEBSTRICT %s
+

andrew.w.kaylor wrote:
> Can you add run lines for -ffast-math and (separately) "-fno-honor-nans 
> -fno-honor-infinities"?
OK. i'll add pragma's to set precise off too.



Comment at: clang/test/CodeGen/fp-floatcontrol-stack.cpp:17
+// for exception behavior and rounding mode.
+//CHECK-DEBSTRICT: 
llvm.experimental.constrained.fmul{{.*}}tonearest{{.*}}strict
+#endif

andrew.w.kaylor wrote:
> 

[PATCH] D73183: [CodeGen] Emit IR for fixed-point unary operators.

2020-01-28 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Please test prefix increment/decrement as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73183



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


[PATCH] D73545: Fix a crash when casting _Complex and ignoring the results

2020-01-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

Committed in 554791928088d6139e0fb3480d79cd76ea59198f 



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

https://reviews.llvm.org/D73545



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


[PATCH] D73536: [analyser][taint] Remove taint from symbolic expressions if used in comparisons

2020-01-28 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ requested changes to this revision.
NoQ added a comment.
This revision now requires changes to proceed.

> Describing value constraints in the taint config file is unfeasible.

This is the only correct way to go, because, as you yourself point out, every 
sink function (or other use of tainted value) does indeed have different 
constraint requirements. Checking the wrong requirements is a very common 
source of security issues and we cannot afford destroying our ability to catch 
them.

Like, checking that the tainted value is non-zero is a good idea before 
dividing by that value, but it's clearly not sufficient before using the same 
value as an array index.

What exactly is preventing you from describing value constraints in the config 
file? Like, i get it that the generic case may get pretty rough (given that 
constraints may be potentially arbitrary algebraic expressions over function 
argument values and possibly other values), and i guess you could do a "poor 
man's" wildcard suppression for some sinks ("the constraint for this sink is so 
complicated that let's see if it was checked at all and think of it as fine if 
it was), but we definitely should be able to try harder when it matters.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73536



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


[clang-tools-extra] 66e47a5 - [clang-tidy] adjust scripts to subsubsections in Release Notes

2020-01-28 Thread Nathan James via cfe-commits

Author: Nathan James
Date: 2020-01-28T18:10:22Z
New Revision: 66e47a57205b1c2a6be3c89413ae9d47b747ed38

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

LOG: [clang-tidy] adjust scripts to subsubsections in Release Notes

Summary:
I added subsubsections for typical Clang-tidy entries in Release Notes, so now 
scripts are aware of this changes.

I don't have GitHub commit access, so please commit changes.

Reviewers: aaron.ballman, alexfh, hokein

Reviewed By: alexfh

Subscribers: njames93, xazax.hun, cfe-commits

Tags: #clang-tools-extra, #clang

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

Added: 


Modified: 
clang-tools-extra/clang-tidy/add_new_check.py
clang-tools-extra/clang-tidy/rename_check.py
clang-tools-extra/docs/ReleaseNotes.rst

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/add_new_check.py 
b/clang-tools-extra/clang-tidy/add_new_check.py
index 4406efc1b0f5..1ef7165a12c9 100755
--- a/clang-tools-extra/clang-tidy/add_new_check.py
+++ b/clang-tools-extra/clang-tidy/add_new_check.py
@@ -219,8 +219,8 @@ def add_release_notes(module_path, module, check_name):
   with open(filename, 'r') as f:
 lines = f.readlines()
 
-  lineMatcher = re.compile('Improvements to clang-tidy')
-  nextSectionMatcher = re.compile('Improvements to clang-include-fixer')
+  lineMatcher = re.compile('New checks')
+  nextSectionMatcher = re.compile('New check aliases')
   checkerMatcher = re.compile('- New :doc:`(.*)')
 
   print('Updating %s...' % filename)
@@ -249,12 +249,12 @@ def add_release_notes(module_path, module, check_name):
   f.write(line)
   continue
 
-if line.startswith(''):
+if line.startswith(''):
   f.write(line)
   continue
 
 if header_found and add_note_here:
-  if not line.startswith(''):
+  if not line.startswith(''):
 f.write("""- New :doc:`%s
   ` check.
 

diff  --git a/clang-tools-extra/clang-tidy/rename_check.py 
b/clang-tools-extra/clang-tidy/rename_check.py
index d5f24073496c..2dde9734ed54 100755
--- a/clang-tools-extra/clang-tidy/rename_check.py
+++ b/clang-tools-extra/clang-tidy/rename_check.py
@@ -176,11 +176,11 @@ def add_release_notes(clang_tidy_path, old_check_name, 
new_check_name):
 
 for line in lines:
   if not note_added:
-match = re.search('Improvements to clang-tidy', line)
+match = re.search('Renamed checks', line)
 if match:
   header_found = True
 elif header_found:
-  if not line.startswith(''):
+  if not line.startswith(''):
 f.write("""
 - The '%s' check was renamed to :doc:`%s
   `

diff  --git a/clang-tools-extra/docs/ReleaseNotes.rst 
b/clang-tools-extra/docs/ReleaseNotes.rst
index 58dbe08343cb..f9dbcd0220d1 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -88,8 +88,8 @@ New checks
   Flags use of the `C` standard library functions ``memset``, ``memcpy`` and
   ``memcmp`` and similar derivatives on non-trivial types.
 
-New aliases
-^^^
+New check aliases
+^
 
 - New alias :doc:`cert-dcl37-c
   ` to



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


[clang] 5547919 - Fix a crash when casting _Complex and ignoring the results.

2020-01-28 Thread Aaron Ballman via cfe-commits

Author: Aaron Ballman
Date: 2020-01-28T13:05:56-05:00
New Revision: 554791928088d6139e0fb3480d79cd76ea59198f

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

LOG: Fix a crash when casting _Complex and ignoring the results.

Performing a cast where the result is ignored caused Clang to crash when
performing codegen for the conversion:

  _Complex int a;
  void fn1() { (_Complex double) a; }

This patch addresses the crash by not trying to emit the scalar conversions,
causing it to be a noop. Fixes PR44624.

Added: 


Modified: 
clang/lib/CodeGen/CGExprComplex.cpp
clang/test/CodeGen/complex-convert.c

Removed: 




diff  --git a/clang/lib/CodeGen/CGExprComplex.cpp 
b/clang/lib/CodeGen/CGExprComplex.cpp
index f7a4e9e94712..4c527867bb9f 100644
--- a/clang/lib/CodeGen/CGExprComplex.cpp
+++ b/clang/lib/CodeGen/CGExprComplex.cpp
@@ -431,8 +431,10 @@ ComplexPairTy 
ComplexExprEmitter::EmitComplexToComplexCast(ComplexPairTy Val,
   // C99 6.3.1.6: When a value of complex type is converted to another
   // complex type, both the real and imaginary parts follow the conversion
   // rules for the corresponding real types.
-  Val.first = CGF.EmitScalarConversion(Val.first, SrcType, DestType, Loc);
-  Val.second = CGF.EmitScalarConversion(Val.second, SrcType, DestType, Loc);
+  if (Val.first)
+Val.first = CGF.EmitScalarConversion(Val.first, SrcType, DestType, Loc);
+  if (Val.second)
+Val.second = CGF.EmitScalarConversion(Val.second, SrcType, DestType, Loc);
   return Val;
 }
 

diff  --git a/clang/test/CodeGen/complex-convert.c 
b/clang/test/CodeGen/complex-convert.c
index 5d2e9d706bdc..6d0291aa4274 100644
--- a/clang/test/CodeGen/complex-convert.c
+++ b/clang/test/CodeGen/complex-convert.c
@@ -722,3 +722,8 @@ void foo(signed char sc, unsigned char uc, signed long long 
sll,
   // CHECK-NEXT: store i[[LLSIZE]] %[[VAR441]], i[[LLSIZE]]* %[[VAR443]]
 }
 
+// This code used to cause a crash; test that it no longer does so.
+_Complex int a;
+void pr44624(void) {
+  (_Complex double) a;
+}



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


[PATCH] D71460: [OpenCL] Fix support for cl_khr_mipmap_image_writes

2020-01-28 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh added a comment.

In D71460#1844959 , @Anastasia wrote:

> Adding @svenvh mainly to check if any fix is needed for the TableGen BIFs too?


Yes I believe we should also update `clang/lib/Sema/OpenCLBuiltins.td`.


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

https://reviews.llvm.org/D71460



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


[PATCH] D72527: [clang-tidy] adjust scripts to subsubsections in Release Notes

2020-01-28 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko updated this revision to Diff 240922.
Eugene.Zelenko added a comment.

Rebase from master.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72527

Files:
  clang-tools-extra/clang-tidy/add_new_check.py
  clang-tools-extra/clang-tidy/rename_check.py
  clang-tools-extra/docs/ReleaseNotes.rst


Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -88,8 +88,8 @@
   Flags use of the `C` standard library functions ``memset``, ``memcpy`` and
   ``memcmp`` and similar derivatives on non-trivial types.
 
-New aliases
-^^^
+New check aliases
+^
 
 - New alias :doc:`cert-dcl37-c
   ` to
Index: clang-tools-extra/clang-tidy/rename_check.py
===
--- clang-tools-extra/clang-tidy/rename_check.py
+++ clang-tools-extra/clang-tidy/rename_check.py
@@ -176,11 +176,11 @@
 
 for line in lines:
   if not note_added:
-match = re.search('Improvements to clang-tidy', line)
+match = re.search('Renamed checks', line)
 if match:
   header_found = True
 elif header_found:
-  if not line.startswith(''):
+  if not line.startswith(''):
 f.write("""
 - The '%s' check was renamed to :doc:`%s
   `
Index: clang-tools-extra/clang-tidy/add_new_check.py
===
--- clang-tools-extra/clang-tidy/add_new_check.py
+++ clang-tools-extra/clang-tidy/add_new_check.py
@@ -219,8 +219,8 @@
   with open(filename, 'r') as f:
 lines = f.readlines()
 
-  lineMatcher = re.compile('Improvements to clang-tidy')
-  nextSectionMatcher = re.compile('Improvements to clang-include-fixer')
+  lineMatcher = re.compile('New checks')
+  nextSectionMatcher = re.compile('New check aliases')
   checkerMatcher = re.compile('- New :doc:`(.*)')
 
   print('Updating %s...' % filename)
@@ -249,12 +249,12 @@
   f.write(line)
   continue
 
-if line.startswith(''):
+if line.startswith(''):
   f.write(line)
   continue
 
 if header_found and add_note_here:
-  if not line.startswith(''):
+  if not line.startswith(''):
 f.write("""- New :doc:`%s
   ` check.
 


Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -88,8 +88,8 @@
   Flags use of the `C` standard library functions ``memset``, ``memcpy`` and
   ``memcmp`` and similar derivatives on non-trivial types.
 
-New aliases
-^^^
+New check aliases
+^
 
 - New alias :doc:`cert-dcl37-c
   ` to
Index: clang-tools-extra/clang-tidy/rename_check.py
===
--- clang-tools-extra/clang-tidy/rename_check.py
+++ clang-tools-extra/clang-tidy/rename_check.py
@@ -176,11 +176,11 @@
 
 for line in lines:
   if not note_added:
-match = re.search('Improvements to clang-tidy', line)
+match = re.search('Renamed checks', line)
 if match:
   header_found = True
 elif header_found:
-  if not line.startswith(''):
+  if not line.startswith(''):
 f.write("""
 - The '%s' check was renamed to :doc:`%s
   `
Index: clang-tools-extra/clang-tidy/add_new_check.py
===
--- clang-tools-extra/clang-tidy/add_new_check.py
+++ clang-tools-extra/clang-tidy/add_new_check.py
@@ -219,8 +219,8 @@
   with open(filename, 'r') as f:
 lines = f.readlines()
 
-  lineMatcher = re.compile('Improvements to clang-tidy')
-  nextSectionMatcher = re.compile('Improvements to clang-include-fixer')
+  lineMatcher = re.compile('New checks')
+  nextSectionMatcher = re.compile('New check aliases')
   checkerMatcher = re.compile('- New :doc:`(.*)')
 
   print('Updating %s...' % filename)
@@ -249,12 +249,12 @@
   f.write(line)
   continue
 
-if line.startswith(''):
+if line.startswith(''):
   f.write(line)
   continue
 
 if header_found and add_note_here:
-  if not line.startswith(''):
+  if not line.startswith(''):
 f.write("""- New :doc:`%s
   ` check.
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73360: [OpenCL] Restrict address space conversions in nested pointers

2020-01-28 Thread John McCall via Phabricator via cfe-commits
rjmccall requested changes to this revision.
rjmccall added inline comments.
This revision now requires changes to proceed.



Comment at: clang/test/Misc/warning-flags.c:41
 CHECK-NEXT:   warn_asm_label_on_auto_decl
+CHECK-NEXT:   warn_bad_cxx_cast_nested_pointer_addr_space
 CHECK-NEXT:   warn_c_kext

Please give this warning  a warning group rather than changing this test.



Comment at: clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl:521
+#else
+// expected-error@-5 {{assigning to '__generic int *__generic *' from 
incompatible type '__local int *__local *__private'}}
 #endif

Can we specialize the diagnostic here so that we get the good diagnostic in 
both language modes?


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

https://reviews.llvm.org/D73360



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


[PATCH] D73545: Fix a crash when casting _Complex and ignoring the results

2020-01-28 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

LGTM


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

https://reviews.llvm.org/D73545



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


  1   2   3   >