[PATCH] D72959: Relative VTables ABI on Fuchsia

2020-04-27 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: clang/lib/CodeGen/CGVTables.cpp:623
+llvm::Constant *C, llvm::GlobalVariable *VTable, unsigned vtableIdx,
+unsigned lastAddrPoint) const {
+  // No need to get the offset of a nullptr.

leonardchan wrote:
> leonardchan wrote:
> > rjmccall wrote:
> > > There's already an `addRelativeOffset` on `ConstantArrayBuilder`; is that 
> > > insufficient for some reason?  I think that, if v-table building were 
> > > refactored so that the places that build components also add them to the 
> > > v-table, we'd end up with a lot more flexibility for the ABIs.  We needed 
> > > a similar sort of change for pointer authentication, which we haven't 
> > > upstreamed to LLVM yet, but which you can see here:
> > > 
> > > https://github.com/apple/llvm-project/blob/apple/master/clang/lib/CodeGen/CGVTables.cpp
> > > 
> > > 
> > I actually did not know about this method, but it does seem to boil down to 
> > the same arithmetic used here. Will update to see if I can use the existing 
> > builders instead.
> Ah, so it seems `addRelativeOffset` operates differently than I thought. 
> Initially I thought it just took the offset relative to the start of the 
> array being built, but it actually seems to be relative to the component that 
> would be added to the builder. This is slightly different from the current 
> implementation where the offset is instead taken relative to the address 
> point of the current vtable.
> 
> We could technically still achieve the desired effect of offsets in the 
> vtable if we were to use `addTaggedRelativeOffset` and subtract a constantaly 
> increasing offset as more virtual function components are added, although I'm 
> not sure how much more benefit that would offer.
> 
> An alternative approach could also be to just use `addRelativeOffset` for 
> offsets relative to the component slot and update instances we access the 
> vtable to adjust for this new arithmetic. I think this would just transform 
> instances of `llvm.load.relative(%vtable, %func_offset)` to 
> `llvm.load.relative(%vtable + %func_offset , 0)`, which seems differerent 
> from how it was intended to be used, but technically might work.
Interesting.  Yeah, it should be relatively straightforward to add a method 
that adds a pointer subtraction starting from a different base, and there's 
already a function for getting a constant that represents the address of the 
current position in the struct.

I take it you've taught LLVM that it can emit that subtraction with a normal 
relative-offset relocation by using an addend?  That must've been exciting.  
Or, yeah, we can add in that addend in the frontend.

I think I see the expected benefit: it should generally save an instruction 
from the call sequence, at least on targets like x86 that lack pre-incrementing 
addressing modes.  It does mean that the v-table entries can't be independently 
described — e.g. there's really no way you could write a C++ type that behaves 
like a v-table entry — but that's not too much of a loss.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72959



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


[clang] a58b62b - [IR] Replace all uses of CallBase::getCalledValue() with getCalledOperand().

2020-04-27 Thread Craig Topper via cfe-commits

Author: Craig Topper
Date: 2020-04-27T22:17:03-07:00
New Revision: a58b62b4a2b96c31b49338b262b609db746449e8

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

LOG: [IR] Replace all uses of CallBase::getCalledValue() with 
getCalledOperand().

This method has been commented as deprecated for a while. Remove
it and replace all uses with the equivalent getCalledOperand().

I also made a few cleanups in here. For example, to removes use
of getElementType on a pointer when we could just use getFunctionType
from the call.

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

Added: 


Modified: 
clang/lib/CodeGen/CGCall.cpp
clang/lib/CodeGen/CGObjC.cpp
clang/lib/CodeGen/CodeGenFunction.cpp
lldb/source/Expression/IRInterpreter.cpp
lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
llvm/include/llvm-c/Core.h
llvm/include/llvm/CodeGen/FastISel.h
llvm/include/llvm/IR/AbstractCallSite.h
llvm/include/llvm/IR/InstrTypes.h
llvm/lib/Analysis/AliasAnalysisEvaluator.cpp
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/lib/Analysis/Lint.cpp
llvm/lib/Analysis/MemorySSA.cpp
llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
llvm/lib/Analysis/StackSafetyAnalysis.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp
llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/lib/CodeGen/WasmEHPrepare.cpp
llvm/lib/CodeGen/WinEHPrepare.cpp
llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
llvm/lib/IR/AsmWriter.cpp
llvm/lib/IR/Core.cpp
llvm/lib/IR/Instructions.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64PromoteConstant.cpp
llvm/lib/Target/AMDGPU/AMDGPUAnnotateKernelFeatures.cpp
llvm/lib/Target/AMDGPU/AMDGPUFixFunctionBitcasts.cpp
llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
llvm/lib/Target/ARM/ARMFastISel.cpp
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp
llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp
llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86WinEHState.cpp
llvm/lib/Transforms/Coroutines/CoroSplit.cpp
llvm/lib/Transforms/IPO/CalledValuePropagation.cpp
llvm/lib/Transforms/IPO/GlobalOpt.cpp
llvm/lib/Transforms/IPO/PruneEH.cpp
llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
llvm/lib/Transforms/Instrumentation/ValueProfilePlugins.inc
llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
llvm/lib/Transforms/Utils/CallPromotionUtils.cpp
llvm/lib/Transforms/Utils/Evaluator.cpp
llvm/lib/Transforms/Utils/InlineFunction.cpp
llvm/lib/Transforms/Utils/Local.cpp
llvm/lib/Transforms/Utils/LowerInvoke.cpp
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/test/LTO/X86/type-mapping-bug3.ll
llvm/tools/llvm-diff/DiffConsumer.cpp
llvm/tools/llvm-diff/DifferenceEngine.cpp
mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index b3fda6bd4ea3..e0e895f202c2 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -2701,10 +2701,10 @@ static llvm::Value 
*tryEmitFusedAutoreleaseOfResult(CodeGenFunction ,
 
   bool doRetainAutorelease;
 
-  if (call->getCalledValue() == CGF.CGM.getObjCEntrypoints().objc_retain) {
+  if (call->getCalledOperand() == CGF.CGM.getObjCEntrypoints().objc_retain) {
 doRetainAutorelease = true;
-  } else if (call->getCalledValue() == CGF.CGM.getObjCEntrypoints()
-  .objc_retainAutoreleasedReturnValue) 
{
+  } else if (call->getCalledOperand() ==
+ 

[PATCH] D78982: [clang-format] Fix Microsoft style for enums

2020-04-27 Thread Aaron Smith via Phabricator via cfe-commits
asmith updated this revision to Diff 260542.

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

https://reviews.llvm.org/D78982

Files:
  clang/include/clang/Format/Format.h
  clang/lib/Format/Format.cpp
  clang/lib/Format/UnwrappedLineParser.cpp


Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -2280,9 +2280,17 @@
 return true;
   }
 
+  if (!Style.AllowEnumsOnASingleLine)
+addUnwrappedLine();
   // Parse enum body.
   nextToken();
+  if (!Style.AllowEnumsOnASingleLine) {
+addUnwrappedLine();
+Line->Level += 1;
+  }
   bool HasError = !parseBracedList(/*ContinueOnSemicolons=*/true);
+  if (!Style.AllowEnumsOnASingleLine)
+Line->Level -= 1;
   if (HasError) {
 if (FormatTok->is(tok::semi))
   nextToken();
Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -397,6 +397,8 @@
Style.AllowAllConstructorInitializersOnNextLine);
 IO.mapOptional("AllowAllParametersOfDeclarationOnNextLine",
Style.AllowAllParametersOfDeclarationOnNextLine);
+IO.mapOptional("AllowEnumsOnASingleLine",
+   Style.AllowEnumsOnASingleLine);
 IO.mapOptional("AllowShortBlocksOnASingleLine",
Style.AllowShortBlocksOnASingleLine);
 IO.mapOptional("AllowShortCaseLabelsOnASingleLine",
@@ -752,6 +754,7 @@
   LLVMStyle.AllowAllArgumentsOnNextLine = true;
   LLVMStyle.AllowAllConstructorInitializersOnNextLine = true;
   LLVMStyle.AllowAllParametersOfDeclarationOnNextLine = true;
+  LLVMStyle.AllowEnumsOnASingleLine = true;
   LLVMStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_All;
   LLVMStyle.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Never;
   LLVMStyle.AllowShortCaseLabelsOnASingleLine = false;
@@ -1137,6 +1140,7 @@
   Style.BraceWrapping.BeforeCatch = true;
   Style.BraceWrapping.BeforeElse = true;
   Style.PenaltyReturnTypeOnItsOwnLine = 1000;
+  Style.AllowEnumsOnASingleLine = false;
   Style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_None;
   Style.AllowShortCaseLabelsOnASingleLine = false;
   Style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never;
Index: clang/include/clang/Format/Format.h
===
--- clang/include/clang/Format/Format.h
+++ clang/include/clang/Format/Format.h
@@ -221,6 +221,20 @@
   /// \endcode
   bool AllowAllParametersOfDeclarationOnNextLine;
 
+  /// Allow enums on a single line.
+  /// \code
+  ///   true:
+  ///   enum { A, B } myEnum;
+  ///
+  ///   false:
+  ///   enum
+  ///   {
+  /// A,
+  /// B,
+  ///   } myEnum;
+  /// \endcode
+  bool AllowEnumsOnASingleLine;
+  
   /// Different styles for merging short blocks containing at most one
   /// statement.
   enum ShortBlockStyle {
@@ -2160,6 +2174,7 @@
R.AllowAllConstructorInitializersOnNextLine &&
AllowAllParametersOfDeclarationOnNextLine ==
R.AllowAllParametersOfDeclarationOnNextLine &&
+   AllowEnumsOnASingleLine == R.AllowEnumsOnASingleLine &&
AllowShortBlocksOnASingleLine == R.AllowShortBlocksOnASingleLine &&
AllowShortCaseLabelsOnASingleLine ==
R.AllowShortCaseLabelsOnASingleLine &&


Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -2280,9 +2280,17 @@
 return true;
   }
 
+  if (!Style.AllowEnumsOnASingleLine)
+addUnwrappedLine();
   // Parse enum body.
   nextToken();
+  if (!Style.AllowEnumsOnASingleLine) {
+addUnwrappedLine();
+Line->Level += 1;
+  }
   bool HasError = !parseBracedList(/*ContinueOnSemicolons=*/true);
+  if (!Style.AllowEnumsOnASingleLine)
+Line->Level -= 1;
   if (HasError) {
 if (FormatTok->is(tok::semi))
   nextToken();
Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -397,6 +397,8 @@
Style.AllowAllConstructorInitializersOnNextLine);
 IO.mapOptional("AllowAllParametersOfDeclarationOnNextLine",
Style.AllowAllParametersOfDeclarationOnNextLine);
+IO.mapOptional("AllowEnumsOnASingleLine",
+   Style.AllowEnumsOnASingleLine);
 IO.mapOptional("AllowShortBlocksOnASingleLine",
Style.AllowShortBlocksOnASingleLine);
 IO.mapOptional("AllowShortCaseLabelsOnASingleLine",
@@ -752,6 +754,7 @@
   LLVMStyle.AllowAllArgumentsOnNextLine = true;
   LLVMStyle.AllowAllConstructorInitializersOnNextLine = true;
   

[PATCH] D78982: [clang-format] Fix Microsoft style for enums

2020-04-27 Thread Aaron Smith via Phabricator via cfe-commits
asmith added a comment.

This change tries to fix this bug.
https://bugs.llvm.org/show_bug.cgi?id=32810


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78982



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


[PATCH] D78982: [clang-format] Fix Microsoft style for enums

2020-04-27 Thread Aaron Smith via Phabricator via cfe-commits
asmith created this revision.
asmith added reviewers: jbcoe, MyDeveloperDay.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
asmith added a reviewer: thakis.

Before this change enums were formatted incorrectly for the Microsoft style.

  

[Original Source]

  
  enum {
one,
two
  } three, four;


[Incorrectly Formatted]

  
  enum blah
  {
one,
two
  } three,
  four;


[Correct Format with Patch]

  
  enum blah
  {
one,
two
  } three, four;


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78982

Files:
  clang/lib/Format/UnwrappedLineParser.cpp


Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -2280,9 +2280,18 @@
 return true;
   }
 
+  if (Style.BraceWrapping.AfterEnum)
+addUnwrappedLine();
   // Parse enum body.
   nextToken();
+  if (Style.BraceWrapping.AfterEnum) {
+addUnwrappedLine();
+Line->Level += 1;
+  }
   bool HasError = !parseBracedList(/*ContinueOnSemicolons=*/true);
+  if (Style.BraceWrapping.AfterEnum)
+Line->Level -= 1;
+  
   if (HasError) {
 if (FormatTok->is(tok::semi))
   nextToken();


Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -2280,9 +2280,18 @@
 return true;
   }
 
+  if (Style.BraceWrapping.AfterEnum)
+addUnwrappedLine();
   // Parse enum body.
   nextToken();
+  if (Style.BraceWrapping.AfterEnum) {
+addUnwrappedLine();
+Line->Level += 1;
+  }
   bool HasError = !parseBracedList(/*ContinueOnSemicolons=*/true);
+  if (Style.BraceWrapping.AfterEnum)
+Line->Level -= 1;
+  
   if (HasError) {
 if (FormatTok->is(tok::semi))
   nextToken();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78900: [HIP][AMDGPU] Enable structurizer workarounds

2020-04-27 Thread Sameer Sahasrabuddhe via Phabricator via cfe-commits
sameerds added inline comments.



Comment at: clang/lib/Driver/ToolChains/HIP.cpp:158
   Args.MakeArgString(Twine("-filetype=") + (OutputIsAsm ? "asm" : "obj")));
+  LlcArgs.push_back("--amdgpu-enable-structurizer-workarounds");
 

arsenm wrote:
> We should just flip this in the backend. llc flags are not intended for 
> frontends to set options
Admittedly, this is a broken workflow. I am not even sure if Clang should be 
invoking llc at all. Ideally, we would want to eliminate this flag entirely. 
But flipping it is okay too if graphics workloads are sensitive to it. The 
priority right now is to enable the workarounds officially only for HIP and 
this seems to be most concise way to do it. We can flip the flag once other 
users of the AMDGPU are on board.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78900



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


[clang] be884b7 - Revert "build: use `find_package(Python3)` if available"

2020-04-27 Thread Saleem Abdulrasool via cfe-commits

Author: Saleem Abdulrasool
Date: 2020-04-27T20:03:32-07:00
New Revision: be884b79352de8917ad17fdb9bd70ec982ca8bdd

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

LOG: Revert "build: use `find_package(Python3)` if available"

This reverts commit cd84bfb8142bc7ff3a07a188ffb809f1d86d1fd7.  Although
this passed the CI in phabricator, some of the bots are missing python3
packages, revert it temporarily.

Added: 


Modified: 
clang-tools-extra/test/lit.site.cfg.py.in
clang/CMakeLists.txt
clang/bindings/python/tests/CMakeLists.txt
clang/test/lit.site.cfg.py.in
clang/utils/perf-training/CMakeLists.txt
clang/utils/perf-training/lit.site.cfg.in
clang/utils/perf-training/order-files.lit.site.cfg.in
llvm/CMakeLists.txt
llvm/cmake/config-ix.cmake
llvm/cmake/modules/AddLLVM.cmake
llvm/test/lit.site.cfg.py.in
llvm/tools/llvm-shlib/CMakeLists.txt

Removed: 




diff  --git a/clang-tools-extra/test/lit.site.cfg.py.in 
b/clang-tools-extra/test/lit.site.cfg.py.in
index 5dc112a56126..a970e7fafc1f 100644
--- a/clang-tools-extra/test/lit.site.cfg.py.in
+++ b/clang-tools-extra/test/lit.site.cfg.py.in
@@ -8,7 +8,7 @@ config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
 config.clang_tools_binary_dir = "@CLANG_TOOLS_BINARY_DIR@"
 config.clang_tools_dir = "@CLANG_TOOLS_DIR@"
 config.clang_libs_dir = "@SHLIBDIR@"
-config.python_executable = "@Python3_EXECUTABLE@"
+config.python_executable = "@PYTHON_EXECUTABLE@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
 

diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 7dadc5f6e917..88e556fd88a0 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -130,38 +130,16 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
   set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY 
${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
 
   if(LLVM_INCLUDE_TESTS)
-if(CMAKE_VERSION VERSION_LESS 3.12)
-  include(FindPythonInterp)
-  if(NOT PYTHONINTERP_FOUND)
-message(FATAL_ERROR
-  "Unable to find Python interpreter, required for builds and testing.
+include(FindPythonInterp)
+if(NOT PYTHONINTERP_FOUND)
+  message(FATAL_ERROR
+"Unable to find Python interpreter, required for builds and testing.
 
-  Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
-  endif()
-
-  if( ${PYTHON_VERSION_STRING} VERSION_LESS 2.7 )
-message(FATAL_ERROR "Python 2.7 or newer is required")
-  endif()
+Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
+endif()
 
-  add_executable(Python3::Interpreter IMPORTED)
-  set_target_properties(Python3::Interpreter PROPERTIES
-IMPORTED_LOCATION ${PYTHON_EXECUTABLE})
-  set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
-else()
-  find_package(Python3 COMPONENTS Interpreter)
-  if(NOT Python3_Interpreter_FOUND)
-message(WARNING "Python3 not found, using python2 as a fallback")
-find_package(Python2 COMPONENTS Interpreter REQUIRED)
-if(Python2_VERSION VERSION_LESS 2.7)
-  message(SEND_ERROR "Python 2.7 or newer is required")
-endif()
-
-# Treat python2 as python3
-add_executable(Python3::Interpreter IMPORTED)
-set_target_properties(Python3::Interpreter PROPERTIES
-  IMPORTED_LOCATION ${Python2_EXECUTABLE})
-set(Python3_EXECUTABLE ${Python2_EXECUTABLE})
-  endif()
+if( ${PYTHON_VERSION_STRING} VERSION_LESS 2.7 )
+  message(FATAL_ERROR "Python 2.7 or newer is required")
 endif()
 
 # Check prebuilt llvm/utils.

diff  --git a/clang/bindings/python/tests/CMakeLists.txt 
b/clang/bindings/python/tests/CMakeLists.txt
index 3f58c4bde8e7..626256af9c1b 100644
--- a/clang/bindings/python/tests/CMakeLists.txt
+++ b/clang/bindings/python/tests/CMakeLists.txt
@@ -3,7 +3,7 @@
 add_custom_target(check-clang-python
 COMMAND ${CMAKE_COMMAND} -E env
 CLANG_LIBRARY_PATH=$
-"${Python3_EXECUTABLE}" -m unittest discover
+${PYTHON_EXECUTABLE} -m unittest discover
 DEPENDS libclang
 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)
 

diff  --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index 4527ccadbb4a..daec694bd128 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -27,7 +27,7 @@ config.enable_backtrace = @ENABLE_BACKTRACES@
 config.enable_experimental_new_pass_manager = 
@ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER@
 config.enable_threads = @LLVM_ENABLE_THREADS@
 config.host_arch = "@HOST_ARCH@"
-config.python_executable = "@Python3_EXECUTABLE@"
+config.python_executable = "@PYTHON_EXECUTABLE@"
 config.use_z3_solver = lit_config.params.get('USE_Z3_SOLVER', 

[PATCH] D72959: Relative VTables ABI on Fuchsia

2020-04-27 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan marked an inline comment as done.
leonardchan added inline comments.



Comment at: clang/lib/CodeGen/CGVTables.cpp:623
+llvm::Constant *C, llvm::GlobalVariable *VTable, unsigned vtableIdx,
+unsigned lastAddrPoint) const {
+  // No need to get the offset of a nullptr.

leonardchan wrote:
> rjmccall wrote:
> > There's already an `addRelativeOffset` on `ConstantArrayBuilder`; is that 
> > insufficient for some reason?  I think that, if v-table building were 
> > refactored so that the places that build components also add them to the 
> > v-table, we'd end up with a lot more flexibility for the ABIs.  We needed a 
> > similar sort of change for pointer authentication, which we haven't 
> > upstreamed to LLVM yet, but which you can see here:
> > 
> > https://github.com/apple/llvm-project/blob/apple/master/clang/lib/CodeGen/CGVTables.cpp
> > 
> > 
> I actually did not know about this method, but it does seem to boil down to 
> the same arithmetic used here. Will update to see if I can use the existing 
> builders instead.
Ah, so it seems `addRelativeOffset` operates differently than I thought. 
Initially I thought it just took the offset relative to the start of the array 
being built, but it actually seems to be relative to the component that would 
be added to the builder. This is slightly different from the current 
implementation where the offset is instead taken relative to the address point 
of the current vtable.

We could technically still achieve the desired effect of offsets in the vtable 
if we were to use `addTaggedRelativeOffset` and subtract a constantaly 
increasing offset as more virtual function components are added, although I'm 
not sure how much more benefit that would offer.

An alternative approach could also be to just use `addRelativeOffset` for 
offsets relative to the component slot and update instances we access the 
vtable to adjust for this new arithmetic. I think this would just transform 
instances of `llvm.load.relative(%vtable, %func_offset)` to 
`llvm.load.relative(%vtable + %func_offset , 0)`, which seems differerent from 
how it was intended to be used, but technically might work.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72959



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


[PATCH] D78853: [Analysis] Fix null pointer dereference warnings [1/n]

2020-04-27 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added inline comments.



Comment at: clang/lib/Analysis/ThreadSafety.cpp:1938-1940
+// The default value for the argument VD to the current function is
+// nullptr. So we assert that VD is non null because we deref VD here.
+assert(VD && "!VD");

Doesn't seem like the most informative comment or assertion string - the 
invariant  "isScopedVar implies VD is non-null" is established earlier in the 
function, where isScopedVar only becomes true under the "VD is non-null" 
condition at 1809.

Would it be better to improve whatever static analysis you're using to be able 
to track that correlation, rather than adding lots of extra assertions to LLVM? 
(can the Clang Static Analyzer understand this code and avoid warning on it, 
for instance - that'd be a good existence proof for such "smarts" being 
reasonably possible for static analysis)


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

https://reviews.llvm.org/D78853



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


[PATCH] D78979: OpenCL: Include builtin header by default

2020-04-27 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

In D78979#2006847 , @arsenm wrote:

> I'm also wondering if using -nogpulib for the corresponding linker purpose 
> was correct, since in the OpenCL case it's not really an offload target. 
> Maybe this should switch to -nostdlib?


-nogpulib is fine since opencl compiler is in parallel with the device compiler 
of CUDA/HIP. The library it uses is the device library.




Comment at: clang/lib/Frontend/CompilerInvocation.cpp:2548
 
-  Opts.IncludeDefaultHeader = Args.hasArg(OPT_finclude_default_header);
+  Opts.IncludeDefaultHeader = !Args.hasArg(OPT_fno_include_default_header);
   Opts.DeclareOpenCLBuiltins = Args.hasArg(OPT_fdeclare_opencl_builtins);

should use hasFlag in case there are multiple occurrences of both options. 


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

https://reviews.llvm.org/D78979



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


[PATCH] D78853: [Analysis] Fix null pointer dereference warnings [1/n]

2020-04-27 Thread Mandeep Singh Grang via Phabricator via cfe-commits
mgrang updated this revision to Diff 260517.
mgrang retitled this revision from "[Sema] Fix null pointer dereference 
warnings [1/n]" to "[Analysis] Fix null pointer dereference warnings [1/n]".

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

https://reviews.llvm.org/D78853

Files:
  clang/lib/Analysis/ThreadSafety.cpp


Index: clang/lib/Analysis/ThreadSafety.cpp
===
--- clang/lib/Analysis/ThreadSafety.cpp
+++ clang/lib/Analysis/ThreadSafety.cpp
@@ -1935,6 +1935,10 @@
   CapDiagKind);
 
   if (isScopedVar) {
+// The default value for the argument VD to the current function is
+// nullptr. So we assert that VD is non null because we deref VD here.
+assert(VD && "!VD");
+
 // Add the managing object as a dummy mutex, mapped to the underlying 
mutex.
 SourceLocation MLoc = VD->getLocation();
 DeclRefExpr DRE(VD->getASTContext(), VD, false, VD->getType(), VK_LValue,


Index: clang/lib/Analysis/ThreadSafety.cpp
===
--- clang/lib/Analysis/ThreadSafety.cpp
+++ clang/lib/Analysis/ThreadSafety.cpp
@@ -1935,6 +1935,10 @@
   CapDiagKind);
 
   if (isScopedVar) {
+// The default value for the argument VD to the current function is
+// nullptr. So we assert that VD is non null because we deref VD here.
+assert(VD && "!VD");
+
 // Add the managing object as a dummy mutex, mapped to the underlying mutex.
 SourceLocation MLoc = VD->getLocation();
 DeclRefExpr DRE(VD->getASTContext(), VD, false, VD->getType(), VK_LValue,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78980: Elaborate more on --rocm-path flag.

2020-04-27 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added inline comments.



Comment at: clang/include/clang/Driver/Options.td:612
 def rocm_path_EQ : Joined<["--"], "rocm-path=">, Group,
-  HelpText<"ROCm installation path">;
+  HelpText<"ROCm installation path, used for finding and automatically linking 
required bitcode libraries.">;
 def hip_device_lib_path_EQ : Joined<["--"], "hip-device-lib-path=">, 
Group,

we also want to use this for adding include and library path for HIP.


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

https://reviews.llvm.org/D78980



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


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

2020-04-27 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 260529.
zequanwu added a comment.

Split the the original differential to 2 smaller ones. This one add nomerge 
function attribute in IR level. Another one will add the attribute to let 
frontend recognize it.


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

https://reviews.llvm.org/D78659

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

Index: llvm/test/Transforms/SimplifyCFG/nomerge.ll
===
--- /dev/null
+++ llvm/test/Transforms/SimplifyCFG/nomerge.ll
@@ -0,0 +1,30 @@
+; RUN: opt < %s -simplifycfg -S | FileCheck %s
+
+; The attribute nomerge prevents the 3 bar() calls from being merged into 
+; one inside foo. Check that there are still 3 tail calls.
+
+; CHECK-LABEL: define void @foo
+; CHECK: tail call void @bar()
+; CHECK: tail call void @bar()
+; CHECK: tail call void @bar()
+define void @foo(i32 %i) {
+entry:
+  switch i32 %i, label %if.end3 [
+i32 5, label %if.then
+i32 7, label %if.then2
+  ]
+
+if.then:
+  tail call void @bar() nomerge
+  br label %if.end3
+
+if.then2:
+  tail call void @bar() nomerge
+  br label %if.end3
+
+if.end3:
+  tail call void @bar() nomerge
+  ret void
+}
+
+declare void @bar()
\ No newline at end of file
Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
===
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1300,6 +1300,14 @@
 if (!TTI.isProfitableToHoist(I1) || !TTI.isProfitableToHoist(I2))
   return Changed;
 
+// If any of the two call sites has nomerge attribute, stop hoisting.
+if (const auto *CB1 = dyn_cast(I1))
+  if (CB1->cannotMerge())
+return Changed;
+if (const auto *CB2 = dyn_cast(I2))
+  if (CB2->cannotMerge())
+return Changed;
+
 if (isa(I1) || isa(I2)) {
   assert (isa(I1) && isa(I2));
   // The debug location is an integral part of a debug info intrinsic
@@ -1485,8 +1493,9 @@
 // Conservatively return false if I is an inline-asm instruction. Sinking
 // and merging inline-asm instructions can potentially create arguments
 // that cannot satisfy the inline-asm constraints.
+// If the instruction has nomerge attribute, return false.
 if (const auto *C = dyn_cast(I))
-  if (C->isInlineAsm())
+  if (C->isInlineAsm() || C->cannotMerge())
 return false;
 
 // Each instruction must have zero or one use.
Index: llvm/lib/IR/Verifier.cpp
===
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -1509,6 +1509,7 @@
 /// Return true if this attribute kind only applies to functions.
 static bool isFuncOnlyAttr(Attribute::AttrKind Kind) {
   switch (Kind) {
+  case Attribute::NoMerge:
   case Attribute::NoReturn:
   case Attribute::NoSync:
   case Attribute::WillReturn:
Index: llvm/lib/IR/Attributes.cpp
===
--- llvm/lib/IR/Attributes.cpp
+++ llvm/lib/IR/Attributes.cpp
@@ -372,6 +372,8 @@
 return "noinline";
   if (hasAttribute(Attribute::NonLazyBind))
 return "nonlazybind";
+  if (hasAttribute(Attribute::NoMerge))
+return "nomerge";
   if (hasAttribute(Attribute::NonNull))
 return "nonnull";
   if (hasAttribute(Attribute::NoRedZone))
Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
===
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -647,6 +647,8 @@
 return bitc::ATTR_KIND_NO_INLINE;
   case Attribute::NoRecurse:
 return bitc::ATTR_KIND_NO_RECURSE;
+  case Attribute::NoMerge:
+return bitc::ATTR_KIND_NO_MERGE;
   case Attribute::NonLazyBind:
 return bitc::ATTR_KIND_NON_LAZY_BIND;
   case Attribute::NonNull:
Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
===
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1306,6 +1306,9 @@
   case Attribute::Preallocated:
 llvm_unreachable("preallocated attribute not supported in raw format");
 break;
+  case Attribute::NoMerge:
+llvm_unreachable("nomerge attribute not supported in raw format");
+break;
   }
   llvm_unreachable("Unsupported attribute type");
 }
@@ -1318,7 +1321,7 @@
 if (I == Attribute::SanitizeMemTag || I == Attribute::Dereferenceable ||
 I == 

[PATCH] D78980: Elaborate more on --rocm-path flag.

2020-04-27 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm created this revision.
arsenm added reviewers: yaxunl, t-tye.
Herald added a subscriber: wdng.

I'm not sure what the conventions are for this documentation. The
format seems limiting. I don't see how to refer to other flags, or
mark flags as deprecated. The rst I believe these generate seems to be
in source, and out of date.


https://reviews.llvm.org/D78980

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


Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -609,9 +609,9 @@
   HelpText<"Use 32-bit pointers for accessing const/local/shared address 
spaces.">;
 def fno_cuda_short_ptr : Flag<["-"], "fno-cuda-short-ptr">;
 def rocm_path_EQ : Joined<["--"], "rocm-path=">, Group,
-  HelpText<"ROCm installation path">;
+  HelpText<"ROCm installation path, used for finding and automatically linking 
required bitcode libraries.">;
 def hip_device_lib_path_EQ : Joined<["--"], "hip-device-lib-path=">, 
Group,
-  HelpText<"HIP device library path">;
+  HelpText<"HIP device library path. Alternative to rocm-path.">;
 def hip_device_lib_EQ : Joined<["--"], "hip-device-lib=">, Group,
   HelpText<"HIP device library">;
 def fhip_dump_offload_linker_script : Flag<["-"], 
"fhip-dump-offload-linker-script">,


Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -609,9 +609,9 @@
   HelpText<"Use 32-bit pointers for accessing const/local/shared address spaces.">;
 def fno_cuda_short_ptr : Flag<["-"], "fno-cuda-short-ptr">;
 def rocm_path_EQ : Joined<["--"], "rocm-path=">, Group,
-  HelpText<"ROCm installation path">;
+  HelpText<"ROCm installation path, used for finding and automatically linking required bitcode libraries.">;
 def hip_device_lib_path_EQ : Joined<["--"], "hip-device-lib-path=">, Group,
-  HelpText<"HIP device library path">;
+  HelpText<"HIP device library path. Alternative to rocm-path.">;
 def hip_device_lib_EQ : Joined<["--"], "hip-device-lib=">, Group,
   HelpText<"HIP device library">;
 def fhip_dump_offload_linker_script : Flag<["-"], "fhip-dump-offload-linker-script">,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78762: build: use `find_package(Python3)` if available

2020-04-27 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

Is there more background on this somewhere? What's the advantage of using 
Python3_EXECUTABLE instead of just PYTHON_EXECUTABLE? Having Python3_EXECUTABLE 
be python 2 seems pretty surprising to me.

Also, this doesn't update some PYTHON_EXECUTABLEs, e.g. the one in lld/test. Is 
that intentional?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78762



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


[PATCH] D78890: [clang-tidy] Add check callee-namespace.

2020-04-27 Thread Paula Toth via Phabricator via cfe-commits
PaulkaToast added inline comments.



Comment at: clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp:22-23
+const DeclContext *getOutermostNamespace(const DeclContext *Decl) {
+  if (Decl->isTranslationUnit())
+return Decl;
+  if (Decl->getParent() && Decl->getParent()->isTranslationUnit())

aaron.ballman wrote:
> Under what circumstances could the translation unit be passed in as the 
> declaration? I think this code can just be removed.
Actually you are totally right. This case would never occur, thanks (:



Comment at: clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp:30-31
+void CalleeNamespaceCheck::registerMatchers(MatchFinder *Finder) {
+  Finder->addMatcher(
+  callExpr(callee(functionDecl().bind("func"))).bind("call-site"), this);
+}

aaron.ballman wrote:
> Do you also want to catch binding of function pointers? e.g.,
> ```
> float (*fp)(float) = sinf;
> ```
I hadn't considered function pointers, does seem like a good thing to catch 
though. Modified the matches to catch this case as well. Thank you!



Comment at: clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp:52-53
+
+  diag(FuncDecl->getLocation(),
+   "currently resolves to: ", clang::DiagnosticIDs::Note);
+}

aaron.ballman wrote:
> This diagnostic seems a bit strange -- I would expect some text after the 
> colon.
I was trying mimic the clang's previous definition diagnostic. e.g. : 
https://godbolt.org/z/V4tKr-
Although the colon does seem to confusing so I removed it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78890



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


[PATCH] D78762: build: use `find_package(Python3)` if available

2020-04-27 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd added a comment.

I was trying to do the minimal change to cover llvm.  I definitely care about 
LLD and will do that in a subsequent change.

As to the benefit of this, it is primarily that the detection here explicitly 
ensures that python3 is used rather than python2.  The fallback of aliasing is 
the easiest way to achieve this without having a lot of complicated logic at 
each site:

  if(NOT Python3_Interpreter_FOUND)
add_custom_command(...)
  else()
add_custom_command(...)
  endif()

which would be the way to handle that.  Creating another wrapper function is a 
terrible thing just to filter out incidental python usage would not only be 
extremely complicated but a large amount of logic that would also increase 
configure times unnecessarily.

The detection here is far more robust and precise.  `Python3_EXECUTABLE` is the 
CMake variable name, not something that I chose.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78762



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


[PATCH] D78890: [clang-tidy] Add check callee-namespace.

2020-04-27 Thread Paula Toth via Phabricator via cfe-commits
PaulkaToast updated this revision to Diff 260524.
PaulkaToast marked 8 inline comments as done.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78890

Files:
  clang-tools-extra/clang-tidy/llvmlibc/CMakeLists.txt
  clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp
  clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.h
  clang-tools-extra/clang-tidy/llvmlibc/LLVMLibcTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/checks/llvmlibc-callee-namespace.rst
  clang-tools-extra/test/clang-tidy/checkers/llvmlibc-callee-namespace.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/llvmlibc-callee-namespace.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/llvmlibc-callee-namespace.cpp
@@ -0,0 +1,42 @@
+// RUN: %check_clang_tidy %s llvmlibc-callee-namespace %t
+
+namespace __llvm_libc {
+namespace nested {
+void nested_func() {}
+} // namespace nested
+void libc_api_func() {}
+} // namespace __llvm_libc
+
+// Emulate a function from the public headers like string.h
+void libc_api_func() {}
+
+namespace __llvm_libc {
+void Test() {
+  // Allow calls with the fully qualified name.
+  __llvm_libc::libc_api_func();
+  __llvm_libc::nested::nested_func();
+  void (*qualifiedPtr)(void) = __llvm_libc::libc_api_func;
+  qualifiedPtr();
+
+  // Should not trigger on compiler provided function calls.
+  (void)__builtin_abs(-1);
+
+  // Bare calls are allowed as long as they resolve to the correct namespace.
+  libc_api_func();
+  nested::nested_func();
+  void (*barePtr)(void) = __llvm_libc::libc_api_func;
+  barePtr();
+
+  // Disallow calling into global namespace for implemented entrypoints.
+  ::libc_api_func();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'libc_api_func' must resolve to a function declared within the '__llvm_libc' namespace
+  // CHECK-MESSAGES: :11:6: note: currently resolves to
+
+  // Disallow indirect references to functions in global namespace.
+  void (*badPtr)(void) = ::libc_api_func;
+  badPtr();
+  // CHECK-MESSAGES: :[[@LINE-2]]:26: warning: 'libc_api_func' must resolve to a function declared within the '__llvm_libc' namespace
+  // CHECK-MESSAGES: :11:6: note: currently resolves to
+}
+
+} // namespace __llvm_libc
Index: clang-tools-extra/docs/clang-tidy/checks/llvmlibc-callee-namespace.rst
===
--- /dev/null
+++ clang-tools-extra/docs/clang-tidy/checks/llvmlibc-callee-namespace.rst
@@ -0,0 +1,24 @@
+.. title:: clang-tidy - llvmlibc-callee-namespace
+
+llvmlibc-callee-namespace
+
+
+Checks all calls resolve to functions within ``__llvm_libc`` namespace.
+
+.. code-block:: c++
+
+namespace __llvm_libc {
+
+// Allow calls with the fully qualified name.
+__llvm_libc::strlen("hello");
+
+// Allow calls to compiler provided functions.
+(void)__builtin_abs(-1);
+
+// Bare calls are allowed as long as they resolve to the correct namespace.
+strlen("world");
+
+// Disallow calling into functions in the global namespace.
+::strlen("!");
+
+} // namespace __llvm_libc
Index: clang-tools-extra/docs/clang-tidy/checks/list.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -188,6 +188,7 @@
`llvm-prefer-isa-or-dyn-cast-in-conditionals `_, "Yes"
`llvm-prefer-register-over-unsigned `_, "Yes"
`llvm-twine-local `_, "Yes"
+   `llvmlibc-callee-namespace `_,
`llvmlibc-implementation-in-namespace `_,
`llvmlibc-restrict-system-libc-headers `_, "Yes"
`misc-definitions-in-headers `_, "Yes"
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -113,6 +113,11 @@
   Flags use of the `C` standard library functions ``memset``, ``memcpy`` and
   ``memcmp`` and similar derivatives on non-trivial types.
 
+- New :doc:`llvmlibc-callee-namespace
+  ` check.
+
+  Checks all calls resolve to functions within ``__llvm_libc`` namespace.
+
 - New :doc:`llvmlibc-implementation-in-namespace
   ` check.
 
Index: clang-tools-extra/clang-tidy/llvmlibc/LLVMLibcTidyModule.cpp
===
--- clang-tools-extra/clang-tidy/llvmlibc/LLVMLibcTidyModule.cpp
+++ clang-tools-extra/clang-tidy/llvmlibc/LLVMLibcTidyModule.cpp
@@ -9,6 +9,7 @@
 #include "../ClangTidy.h"
 #include "../ClangTidyModule.h"
 #include "../ClangTidyModuleRegistry.h"
+#include "CalleeNamespaceCheck.h"
 #include "ImplementationInNamespaceCheck.h"
 #include "RestrictSystemLibcHeadersCheck.h"
 
@@ 

[PATCH] D78762: build: use `find_package(Python3)` if available

2020-04-27 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd closed this revision.
compnerd added a comment.

rGcd84bfb8142bc7ff3a07a188ffb809f1d86d1fd7 
 (with the 
Python2 fixes)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78762



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


[PATCH] D78979: OpenCL: Include builtin header by default

2020-04-27 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added a comment.

I'm also wondering if using -nogpulib for the corresponding linker purpose was 
correct, since in the OpenCL case it's not really an offload target. Maybe this 
should switch to -nostdlib?


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

https://reviews.llvm.org/D78979



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


[PATCH] D78979: OpenCL: Include builtin header by default

2020-04-27 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm created this revision.
arsenm added reviewers: Anastasia, yaxunl.
Herald added subscribers: kerbowa, nhaehnle, wdng, jvesely.
arsenm added a comment.

I'm also wondering if using -nogpulib for the corresponding linker purpose was 
correct, since in the OpenCL case it's not really an offload target. Maybe this 
should switch to -nostdlib?


Nonsensically, the default header is not included by default. Users
are using the cc1 flag to compile OpenCL programs, which should not be
required. Switch the default, and allow -nostdinc to disable the
include.

  

I'm somewhat confused by the way this is supposed to work, or why a
separate option exists for OpenCL. The other language flags seem to be
implemented in the driver, not cc1 like OpenCL. I'm not sure this is
the right set of flag naming decisions, or if we really need the
fno-include-default-header cc1 flag.


https://reviews.llvm.org/D78979

Files:
  clang/include/clang/Driver/CC1Options.td
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
  clang/test/CodeGenOpenCL/atomic-ops-libcall.cl
  clang/test/CodeGenOpenCL/atomic-ops.cl
  clang/test/CodeGenOpenCL/bool_cast.cl
  clang/test/CodeGenOpenCL/cl20-device-side-enqueue.cl
  clang/test/CodeGenOpenCL/enqueue-kernel-non-entry-block.cl
  clang/test/CodeGenOpenCL/ext-int-shift.cl
  clang/test/CodeGenOpenCL/fpmath.cl
  clang/test/CodeGenOpenCL/half.cl
  clang/test/CodeGenOpenCL/null_queue.cl
  clang/test/CodeGenOpenCL/overload.cl
  clang/test/Driver/nostdinc.cl
  clang/test/Parser/opencl-atomics-cl20.cl
  clang/test/SemaOpenCL/atomic-ops.cl
  clang/test/SemaOpenCL/cl20-device-side-enqueue.cl
  clang/test/SemaOpenCL/extensions.cl
  clang/test/SemaOpenCL/half.cl
  clang/test/SemaOpenCL/null_queue.cl
  clang/test/SemaOpenCL/sampler_t.cl
  clang/unittests/AST/MatchVerifier.h

Index: clang/unittests/AST/MatchVerifier.h
===
--- clang/unittests/AST/MatchVerifier.h
+++ clang/unittests/AST/MatchVerifier.h
@@ -117,6 +117,7 @@
 FileName = "input.cc";
 break;
   case Lang_OpenCL:
+Args.push_back("-nostdinc");
 FileName = "input.cl";
 break;
   case Lang_OBJCXX:
Index: clang/test/SemaOpenCL/sampler_t.cl
===
--- clang/test/SemaOpenCL/sampler_t.cl
+++ clang/test/SemaOpenCL/sampler_t.cl
@@ -1,9 +1,9 @@
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -DCHECK_SAMPLER_VALUE -Wspir-compat -triple amdgcn--amdhsa
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -DCHECK_SAMPLER_VALUE -triple spir-unknown-unknown
-// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only
-// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only -DCHECK_SAMPLER_VALUE -Wspir-compat -triple amdgcn--amdhsa
-// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only -DCHECK_SAMPLER_VALUE -triple spir-unknown-unknown
+// RUN: %clang_cc1 %s -fno-include-default-header -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -fno-include-default-header -verify -pedantic -fsyntax-only -DCHECK_SAMPLER_VALUE -Wspir-compat -triple amdgcn--amdhsa
+// RUN: %clang_cc1 %s -fno-include-default-header -verify -pedantic -fsyntax-only -DCHECK_SAMPLER_VALUE -triple spir-unknown-unknown
+// RUN: %clang_cc1 %s -fno-include-default-header -cl-std=CL2.0 -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -fno-include-default-header -cl-std=CL2.0 -verify -pedantic -fsyntax-only -DCHECK_SAMPLER_VALUE -Wspir-compat -triple amdgcn--amdhsa
+// RUN: %clang_cc1 %s -fno-include-default-header -cl-std=CL2.0 -verify -pedantic -fsyntax-only -DCHECK_SAMPLER_VALUE -triple spir-unknown-unknown
 
 #define CLK_ADDRESS_CLAMP_TO_EDGE   2
 #define CLK_NORMALIZED_COORDS_TRUE  1
Index: clang/test/SemaOpenCL/null_queue.cl
===
--- clang/test/SemaOpenCL/null_queue.cl
+++ clang/test/SemaOpenCL/null_queue.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -fno-include-default-header -cl-std=CL2.0 -verify -pedantic -fsyntax-only
 extern queue_t get_default_queue();
 
 void queue_arg(queue_t); // expected-note {{passing argument to parameter here}}
Index: clang/test/SemaOpenCL/half.cl
===
--- clang/test/SemaOpenCL/half.cl
+++ clang/test/SemaOpenCL/half.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-unused-value -triple spir-unknown-unknown
+// RUN: %clang_cc1 %s -fno-include-default-header -verify -pedantic -fsyntax-only -Wno-unused-value -triple spir-unknown-unknown
 
 #pragma OPENCL EXTENSION cl_khr_fp16 : disable
 constant float f = 1.0h; // expected-error{{half precision constant requires cl_khr_fp16}}
Index: 

[clang] cd84bfb - build: use `find_package(Python3)` if available

2020-04-27 Thread Saleem Abdulrasool via cfe-commits

Author: Saleem Abdulrasool
Date: 2020-04-28T01:33:10Z
New Revision: cd84bfb8142bc7ff3a07a188ffb809f1d86d1fd7

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

LOG: build: use `find_package(Python3)` if available

This is primarily motivated by the desire to move from Python2 to
Python3.  `PYTHON_EXECUTABLE` is ambiguous.  This explicitly identifies
the python interpreter in use.  Since the LLVM build seems to be able to
completed successfully with python3, use that across the build.  The old
path aliases `PYTHON_EXECUTABLE` to be treated as Python3.

Added: 


Modified: 
clang-tools-extra/test/lit.site.cfg.py.in
clang/CMakeLists.txt
clang/bindings/python/tests/CMakeLists.txt
clang/test/lit.site.cfg.py.in
clang/utils/perf-training/CMakeLists.txt
clang/utils/perf-training/lit.site.cfg.in
clang/utils/perf-training/order-files.lit.site.cfg.in
llvm/CMakeLists.txt
llvm/cmake/config-ix.cmake
llvm/cmake/modules/AddLLVM.cmake
llvm/test/lit.site.cfg.py.in
llvm/tools/llvm-shlib/CMakeLists.txt

Removed: 




diff  --git a/clang-tools-extra/test/lit.site.cfg.py.in 
b/clang-tools-extra/test/lit.site.cfg.py.in
index a970e7fafc1f..5dc112a56126 100644
--- a/clang-tools-extra/test/lit.site.cfg.py.in
+++ b/clang-tools-extra/test/lit.site.cfg.py.in
@@ -8,7 +8,7 @@ config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
 config.clang_tools_binary_dir = "@CLANG_TOOLS_BINARY_DIR@"
 config.clang_tools_dir = "@CLANG_TOOLS_DIR@"
 config.clang_libs_dir = "@SHLIBDIR@"
-config.python_executable = "@PYTHON_EXECUTABLE@"
+config.python_executable = "@Python3_EXECUTABLE@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
 

diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 88e556fd88a0..7dadc5f6e917 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -130,16 +130,38 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
   set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY 
${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
 
   if(LLVM_INCLUDE_TESTS)
-include(FindPythonInterp)
-if(NOT PYTHONINTERP_FOUND)
-  message(FATAL_ERROR
-"Unable to find Python interpreter, required for builds and testing.
+if(CMAKE_VERSION VERSION_LESS 3.12)
+  include(FindPythonInterp)
+  if(NOT PYTHONINTERP_FOUND)
+message(FATAL_ERROR
+  "Unable to find Python interpreter, required for builds and testing.
 
-Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
-endif()
+  Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
+  endif()
+
+  if( ${PYTHON_VERSION_STRING} VERSION_LESS 2.7 )
+message(FATAL_ERROR "Python 2.7 or newer is required")
+  endif()
 
-if( ${PYTHON_VERSION_STRING} VERSION_LESS 2.7 )
-  message(FATAL_ERROR "Python 2.7 or newer is required")
+  add_executable(Python3::Interpreter IMPORTED)
+  set_target_properties(Python3::Interpreter PROPERTIES
+IMPORTED_LOCATION ${PYTHON_EXECUTABLE})
+  set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
+else()
+  find_package(Python3 COMPONENTS Interpreter)
+  if(NOT Python3_Interpreter_FOUND)
+message(WARNING "Python3 not found, using python2 as a fallback")
+find_package(Python2 COMPONENTS Interpreter REQUIRED)
+if(Python2_VERSION VERSION_LESS 2.7)
+  message(SEND_ERROR "Python 2.7 or newer is required")
+endif()
+
+# Treat python2 as python3
+add_executable(Python3::Interpreter IMPORTED)
+set_target_properties(Python3::Interpreter PROPERTIES
+  IMPORTED_LOCATION ${Python2_EXECUTABLE})
+set(Python3_EXECUTABLE ${Python2_EXECUTABLE})
+  endif()
 endif()
 
 # Check prebuilt llvm/utils.

diff  --git a/clang/bindings/python/tests/CMakeLists.txt 
b/clang/bindings/python/tests/CMakeLists.txt
index 626256af9c1b..3f58c4bde8e7 100644
--- a/clang/bindings/python/tests/CMakeLists.txt
+++ b/clang/bindings/python/tests/CMakeLists.txt
@@ -3,7 +3,7 @@
 add_custom_target(check-clang-python
 COMMAND ${CMAKE_COMMAND} -E env
 CLANG_LIBRARY_PATH=$
-${PYTHON_EXECUTABLE} -m unittest discover
+"${Python3_EXECUTABLE}" -m unittest discover
 DEPENDS libclang
 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)
 

diff  --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index daec694bd128..4527ccadbb4a 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -27,7 +27,7 @@ config.enable_backtrace = @ENABLE_BACKTRACES@
 config.enable_experimental_new_pass_manager = 
@ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER@
 config.enable_threads = @LLVM_ENABLE_THREADS@
 config.host_arch = "@HOST_ARCH@"

[PATCH] D78938: Fixing all comparisons for C++20 compilation.

2020-04-27 Thread Barry Revzin via Phabricator via cfe-commits
BRevzin added a comment.

In D78938#2006758 , 
@hubert.reinterpretcast wrote:

> In D78938#2006715 , @BRevzin wrote:
>
> > Wtf, where'd my other changes go?
>
>
> I've hit this before, use `arc diff --update D78938 `.


Thanks Hubert!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78938



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


[PATCH] D78938: Fixing all comparisons for C++20 compilation.

2020-04-27 Thread Barry Revzin via Phabricator via cfe-commits
BRevzin updated this revision to Diff 260521.
BRevzin added a comment.

Trying this again.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78938

Files:
  clang/include/clang/AST/StmtIterator.h
  clang/lib/Parse/ParseOpenMP.cpp
  llvm/include/llvm/ADT/AllocatorList.h
  llvm/include/llvm/ADT/DenseMap.h
  llvm/include/llvm/ADT/DenseSet.h
  llvm/include/llvm/ADT/DirectedGraph.h
  llvm/include/llvm/ADT/STLExtras.h
  llvm/include/llvm/ADT/StringMap.h
  llvm/include/llvm/ADT/iterator.h
  llvm/include/llvm/CodeGen/LiveInterval.h
  llvm/include/llvm/IR/Attributes.h
  llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h
  llvm/include/llvm/ProfileData/InstrProfReader.h
  llvm/include/llvm/Support/BinaryStreamRef.h
  llvm/lib/CodeGen/MachineOutliner.cpp
  llvm/lib/CodeGen/PeepholeOptimizer.cpp
  llvm/lib/IR/Attributes.cpp
  llvm/lib/IR/DebugInfo.cpp
  llvm/lib/Transforms/Scalar/GVNHoist.cpp

Index: llvm/lib/Transforms/Scalar/GVNHoist.cpp
===
--- llvm/lib/Transforms/Scalar/GVNHoist.cpp
+++ llvm/lib/Transforms/Scalar/GVNHoist.cpp
@@ -149,8 +149,8 @@
   // The instruction (VN) which uses the values flowing out of CHI.
   Instruction *I;
 
-  bool operator==(const CHIArg ) { return VN == A.VN; }
-  bool operator!=(const CHIArg ) { return !(*this == A); }
+  bool operator==(const CHIArg ) const { return VN == A.VN; }
+  bool operator!=(const CHIArg ) const { return !(*this == A); }
 };
 
 using CHIIt = SmallVectorImpl::iterator;
Index: llvm/lib/IR/DebugInfo.cpp
===
--- llvm/lib/IR/DebugInfo.cpp
+++ llvm/lib/IR/DebugInfo.cpp
@@ -665,7 +665,7 @@
   if (auto *T = dyn_cast_or_null(Attachment.second))
 for (unsigned N = 0; N < T->getNumOperands(); ++N)
   if (auto *Loc = dyn_cast_or_null(T->getOperand(N)))
-if (Loc != DebugLoc())
+if (Loc != DebugLoc().get())
   T->replaceOperandWith(N, remapDebugLoc(Loc));
   }
 }
Index: llvm/lib/IR/Attributes.cpp
===
--- llvm/lib/IR/Attributes.cpp
+++ llvm/lib/IR/Attributes.cpp
@@ -1729,7 +1729,7 @@
   return Alignment != 0;
 }
 
-bool AttrBuilder::operator==(const AttrBuilder ) {
+bool AttrBuilder::operator==(const AttrBuilder ) const {
   if (Attrs != B.Attrs)
 return false;
 
Index: llvm/lib/CodeGen/PeepholeOptimizer.cpp
===
--- llvm/lib/CodeGen/PeepholeOptimizer.cpp
+++ llvm/lib/CodeGen/PeepholeOptimizer.cpp
@@ -330,7 +330,7 @@
   return RegSrcs[Idx].SubReg;
 }
 
-bool operator==(const ValueTrackerResult ) {
+bool operator==(const ValueTrackerResult ) const {
   if (Other.getInst() != getInst())
 return false;
 
Index: llvm/lib/CodeGen/MachineOutliner.cpp
===
--- llvm/lib/CodeGen/MachineOutliner.cpp
+++ llvm/lib/CodeGen/MachineOutliner.cpp
@@ -590,10 +590,10 @@
   return It;
 }
 
-bool operator==(const RepeatedSubstringIterator ) {
+bool operator==(const RepeatedSubstringIterator ) const {
   return N == Other.N;
 }
-bool operator!=(const RepeatedSubstringIterator ) {
+bool operator!=(const RepeatedSubstringIterator ) const {
   return !(*this == Other);
 }
 
Index: llvm/include/llvm/Support/BinaryStreamRef.h
===
--- llvm/include/llvm/Support/BinaryStreamRef.h
+++ llvm/include/llvm/Support/BinaryStreamRef.h
@@ -121,12 +121,12 @@
 
   bool valid() const { return BorrowedImpl != nullptr; }
 
-  bool operator==(const RefType ) const {
-if (BorrowedImpl != Other.BorrowedImpl)
+  friend bool operator==(const RefType , const RefType ) {
+if (Self.BorrowedImpl != Other.BorrowedImpl)
   return false;
-if (ViewOffset != Other.ViewOffset)
+if (Self.ViewOffset != Other.ViewOffset)
   return false;
-if (Length != Other.Length)
+if (Self.Length != Other.Length)
   return false;
 return true;
   }
Index: llvm/include/llvm/ProfileData/InstrProfReader.h
===
--- llvm/include/llvm/ProfileData/InstrProfReader.h
+++ llvm/include/llvm/ProfileData/InstrProfReader.h
@@ -50,8 +50,12 @@
   InstrProfIterator(InstrProfReader *Reader) : Reader(Reader) { Increment(); }
 
   InstrProfIterator ++() { Increment(); return *this; }
-  bool operator==(const InstrProfIterator ) { return Reader == RHS.Reader; }
-  bool operator!=(const InstrProfIterator ) { return Reader != RHS.Reader; }
+  bool operator==(const InstrProfIterator ) const {
+return Reader == RHS.Reader;
+  }
+  bool operator!=(const InstrProfIterator ) const {
+return Reader != RHS.Reader;
+  }
   value_type *() { 

[PATCH] D77954: [CUDA][HIP] Fix host/device based overload resolution

2020-04-27 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

In D77954#2005313 , @gribozavr2 wrote:

> Sorry -- this change broke overload resolution for `operator new`, as it is 
> declared in system headers. I'm reverting the patch.
>
>   $ cat /tmp/in.cu.cc
>   #define __device__ __attribute__((device))
>   void* operator new(__SIZE_TYPE__ size);
>   __device__ void *operator new(__SIZE_TYPE__ size);
>   void *x = new int;
>   $ clang -fsyntax-only --cuda-device-only --target=x86_64-grtev4-linux-gnu 
> -x cuda -nocudalib -nocudainc -std=gnu++17 /tmp/in.cu.cc
>   /tmp/in.cu.cc:4:11: error: call to 'operator new' is ambiguous
>   void *x = new int;
> ^
>   /tmp/in.cu.cc:2:7: note: candidate function
>   void* operator new(__SIZE_TYPE__ size);
> ^
>   /tmp/in.cu.cc:3:18: note: candidate function
>   __device__ void *operator new(__SIZE_TYPE__ size);
>^
>   1 error generated when compiling for sm_20.
>


Thanks. Fixed in https://reviews.llvm.org/D78970


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77954



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


[PATCH] D78762: build: use `find_package(Python3)` if available

2020-04-27 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd marked an inline comment as done.
compnerd added inline comments.



Comment at: llvm/CMakeLists.txt:696
+message(WARNING "Python3 not found, using python2 as a fallback")
+find_package(Python3 COMPONENTS Interpreter REQUIRED)
+if(Python2_VERSION VERSION_LESS 2.7)

smeenai wrote:
> Python2
Yeah, I have that fixed locally, there are 2 instances of it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78762



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


[PATCH] D78938: Fixing all comparisons for C++20 compilation.

2020-04-27 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added a comment.

In D78938#2006715 , @BRevzin wrote:

> Wtf, where'd my other changes go?


I've hit this before, use `arc diff --update D78938 `.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78938



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


[PATCH] D78938: Fixing all comparisons for C++20 compilation.

2020-04-27 Thread Barry Revzin via Phabricator via cfe-commits
BRevzin added a comment.

Wtf, where'd my other changes go?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78938



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


[PATCH] D78842: [SVE][NFC] Use ScalableVectorType in CGBuiltin

2020-04-27 Thread Christopher Tetreault via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGda8918f27e30: [SVE][NFC] Use ScalableVectorType in CGBuiltin 
(authored by ctetreau).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78842

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h

Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -3911,8 +3911,8 @@
   SmallVector getSVEOverloadTypes(SVETypeFlags TypeFlags,
ArrayRef Ops);
   llvm::Type *getEltType(SVETypeFlags TypeFlags);
-  llvm::VectorType *getSVEType(const SVETypeFlags );
-  llvm::VectorType *getSVEPredType(SVETypeFlags TypeFlags);
+  llvm::ScalableVectorType *getSVEType(const SVETypeFlags );
+  llvm::ScalableVectorType *getSVEPredType(SVETypeFlags TypeFlags);
   llvm::Value *EmitSVEDupX(llvm::Value *Scalar);
   llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred, llvm::VectorType *VTy);
   llvm::Value *EmitSVEGatherLoad(SVETypeFlags TypeFlags,
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7542,66 +7542,68 @@
 
 // Return the llvm predicate vector type corresponding to the specified element
 // TypeFlags.
-llvm::VectorType* CodeGenFunction::getSVEPredType(SVETypeFlags TypeFlags) {
+llvm::ScalableVectorType *
+CodeGenFunction::getSVEPredType(SVETypeFlags TypeFlags) {
   switch (TypeFlags.getEltType()) {
   default: llvm_unreachable("Unhandled SVETypeFlag!");
 
   case SVETypeFlags::EltTyInt8:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 16, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 16);
   case SVETypeFlags::EltTyInt16:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 8, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyInt32:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 4, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4);
   case SVETypeFlags::EltTyInt64:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 2, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 2);
 
   case SVETypeFlags::EltTyFloat16:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 8, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyFloat32:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 4, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4);
   case SVETypeFlags::EltTyFloat64:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 2, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 2);
   }
 }
 
 // Return the llvm vector type corresponding to the specified element TypeFlags.
-llvm::VectorType *CodeGenFunction::getSVEType(const SVETypeFlags ) {
+llvm::ScalableVectorType *
+CodeGenFunction::getSVEType(const SVETypeFlags ) {
   switch (TypeFlags.getEltType()) {
   default:
 llvm_unreachable("Invalid SVETypeFlag!");
 
   case SVETypeFlags::EltTyInt8:
-return llvm::VectorType::get(Builder.getInt8Ty(), {16, true});
+return llvm::ScalableVectorType::get(Builder.getInt8Ty(), 16);
   case SVETypeFlags::EltTyInt16:
-return llvm::VectorType::get(Builder.getInt16Ty(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getInt16Ty(), 8);
   case SVETypeFlags::EltTyInt32:
-return llvm::VectorType::get(Builder.getInt32Ty(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getInt32Ty(), 4);
   case SVETypeFlags::EltTyInt64:
-return llvm::VectorType::get(Builder.getInt64Ty(), {2, true});
+return llvm::ScalableVectorType::get(Builder.getInt64Ty(), 2);
 
   case SVETypeFlags::EltTyFloat16:
-return llvm::VectorType::get(Builder.getHalfTy(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getHalfTy(), 8);
   case SVETypeFlags::EltTyFloat32:
-return llvm::VectorType::get(Builder.getFloatTy(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getFloatTy(), 4);
   case SVETypeFlags::EltTyFloat64:
-return llvm::VectorType::get(Builder.getDoubleTy(), {2, true});
+return llvm::ScalableVectorType::get(Builder.getDoubleTy(), 2);
 
   case SVETypeFlags::EltTyBool8:
-return llvm::VectorType::get(Builder.getInt1Ty(), {16, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 16);
   case SVETypeFlags::EltTyBool16:
-return llvm::VectorType::get(Builder.getInt1Ty(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyBool32:
-return llvm::VectorType::get(Builder.getInt1Ty(), {4, true});
+return 

[PATCH] D78970: [CUDA][HIP] Fix ambiguity of new operator

2020-04-27 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.

This really has nothing to do with the `new` operator specifically, but it 
looks like a good fix.


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

https://reviews.llvm.org/D78970



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


[PATCH] D71227: [cuda][hip] Fix function overload resolution in the global initiailizer.

2020-04-27 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

LGTM. Can we get this in? There are other fixes depending on this. Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71227



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


[clang] da8918f - [SVE][NFC] Use ScalableVectorType in CGBuiltin

2020-04-27 Thread Christopher Tetreault via cfe-commits

Author: Christopher Tetreault
Date: 2020-04-27T16:29:45-07:00
New Revision: da8918f27e3020ea5d16c6e266f8916d022d41e0

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

LOG: [SVE][NFC] Use ScalableVectorType in CGBuiltin

Summary: * Upgrade some usages of VectorType to use ScalableVectorType

Reviewers: efriedma, david-arm, fpetrogalli, kmclaughlin

Reviewed By: efriedma

Subscribers: tschuett, rkruppe, psnobl, cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/CodeGen/CodeGenFunction.h

Removed: 




diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index b0e5eebe7b88..ee99e3523375 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -7542,66 +7542,68 @@ llvm::Type *CodeGenFunction::getEltType(SVETypeFlags 
TypeFlags) {
 
 // Return the llvm predicate vector type corresponding to the specified element
 // TypeFlags.
-llvm::VectorType* CodeGenFunction::getSVEPredType(SVETypeFlags TypeFlags) {
+llvm::ScalableVectorType *
+CodeGenFunction::getSVEPredType(SVETypeFlags TypeFlags) {
   switch (TypeFlags.getEltType()) {
   default: llvm_unreachable("Unhandled SVETypeFlag!");
 
   case SVETypeFlags::EltTyInt8:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 16, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 16);
   case SVETypeFlags::EltTyInt16:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 8, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyInt32:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 4, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4);
   case SVETypeFlags::EltTyInt64:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 2, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 2);
 
   case SVETypeFlags::EltTyFloat16:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 8, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyFloat32:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 4, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4);
   case SVETypeFlags::EltTyFloat64:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 2, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 2);
   }
 }
 
 // Return the llvm vector type corresponding to the specified element 
TypeFlags.
-llvm::VectorType *CodeGenFunction::getSVEType(const SVETypeFlags ) {
+llvm::ScalableVectorType *
+CodeGenFunction::getSVEType(const SVETypeFlags ) {
   switch (TypeFlags.getEltType()) {
   default:
 llvm_unreachable("Invalid SVETypeFlag!");
 
   case SVETypeFlags::EltTyInt8:
-return llvm::VectorType::get(Builder.getInt8Ty(), {16, true});
+return llvm::ScalableVectorType::get(Builder.getInt8Ty(), 16);
   case SVETypeFlags::EltTyInt16:
-return llvm::VectorType::get(Builder.getInt16Ty(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getInt16Ty(), 8);
   case SVETypeFlags::EltTyInt32:
-return llvm::VectorType::get(Builder.getInt32Ty(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getInt32Ty(), 4);
   case SVETypeFlags::EltTyInt64:
-return llvm::VectorType::get(Builder.getInt64Ty(), {2, true});
+return llvm::ScalableVectorType::get(Builder.getInt64Ty(), 2);
 
   case SVETypeFlags::EltTyFloat16:
-return llvm::VectorType::get(Builder.getHalfTy(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getHalfTy(), 8);
   case SVETypeFlags::EltTyFloat32:
-return llvm::VectorType::get(Builder.getFloatTy(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getFloatTy(), 4);
   case SVETypeFlags::EltTyFloat64:
-return llvm::VectorType::get(Builder.getDoubleTy(), {2, true});
+return llvm::ScalableVectorType::get(Builder.getDoubleTy(), 2);
 
   case SVETypeFlags::EltTyBool8:
-return llvm::VectorType::get(Builder.getInt1Ty(), {16, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 16);
   case SVETypeFlags::EltTyBool16:
-return llvm::VectorType::get(Builder.getInt1Ty(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyBool32:
-return llvm::VectorType::get(Builder.getInt1Ty(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4);
   case SVETypeFlags::EltTyBool64:
-return llvm::VectorType::get(Builder.getInt1Ty(), {2, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 2);
   }
 }
 
 constexpr unsigned SVEBitsPerBlock = 128;
 
-static llvm::VectorType* 

[PATCH] D78842: [SVE][NFC] Use ScalableVectorType in CGBuiltin

2020-04-27 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 260491.
ctetreau added a comment.

fix syntax error


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78842

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h

Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -3911,8 +3911,8 @@
   SmallVector getSVEOverloadTypes(SVETypeFlags TypeFlags,
ArrayRef Ops);
   llvm::Type *getEltType(SVETypeFlags TypeFlags);
-  llvm::VectorType *getSVEType(const SVETypeFlags );
-  llvm::VectorType *getSVEPredType(SVETypeFlags TypeFlags);
+  llvm::ScalableVectorType *getSVEType(const SVETypeFlags );
+  llvm::ScalableVectorType *getSVEPredType(SVETypeFlags TypeFlags);
   llvm::Value *EmitSVEDupX(llvm::Value *Scalar);
   llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred, llvm::VectorType *VTy);
   llvm::Value *EmitSVEGatherLoad(SVETypeFlags TypeFlags,
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7542,66 +7542,68 @@
 
 // Return the llvm predicate vector type corresponding to the specified element
 // TypeFlags.
-llvm::VectorType* CodeGenFunction::getSVEPredType(SVETypeFlags TypeFlags) {
+llvm::ScalableVectorType *
+CodeGenFunction::getSVEPredType(SVETypeFlags TypeFlags) {
   switch (TypeFlags.getEltType()) {
   default: llvm_unreachable("Unhandled SVETypeFlag!");
 
   case SVETypeFlags::EltTyInt8:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 16, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 16);
   case SVETypeFlags::EltTyInt16:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 8, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyInt32:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 4, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4);
   case SVETypeFlags::EltTyInt64:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 2, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 2);
 
   case SVETypeFlags::EltTyFloat16:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 8, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyFloat32:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 4, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4);
   case SVETypeFlags::EltTyFloat64:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 2, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 2);
   }
 }
 
 // Return the llvm vector type corresponding to the specified element TypeFlags.
-llvm::VectorType *CodeGenFunction::getSVEType(const SVETypeFlags ) {
+llvm::ScalableVectorType *
+CodeGenFunction::getSVEType(const SVETypeFlags ) {
   switch (TypeFlags.getEltType()) {
   default:
 llvm_unreachable("Invalid SVETypeFlag!");
 
   case SVETypeFlags::EltTyInt8:
-return llvm::VectorType::get(Builder.getInt8Ty(), {16, true});
+return llvm::ScalableVectorType::get(Builder.getInt8Ty(), 16);
   case SVETypeFlags::EltTyInt16:
-return llvm::VectorType::get(Builder.getInt16Ty(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getInt16Ty(), 8);
   case SVETypeFlags::EltTyInt32:
-return llvm::VectorType::get(Builder.getInt32Ty(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getInt32Ty(), 4);
   case SVETypeFlags::EltTyInt64:
-return llvm::VectorType::get(Builder.getInt64Ty(), {2, true});
+return llvm::ScalableVectorType::get(Builder.getInt64Ty(), 2);
 
   case SVETypeFlags::EltTyFloat16:
-return llvm::VectorType::get(Builder.getHalfTy(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getHalfTy(), 8);
   case SVETypeFlags::EltTyFloat32:
-return llvm::VectorType::get(Builder.getFloatTy(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getFloatTy(), 4);
   case SVETypeFlags::EltTyFloat64:
-return llvm::VectorType::get(Builder.getDoubleTy(), {2, true});
+return llvm::ScalableVectorType::get(Builder.getDoubleTy(), 2);
 
   case SVETypeFlags::EltTyBool8:
-return llvm::VectorType::get(Builder.getInt1Ty(), {16, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 16);
   case SVETypeFlags::EltTyBool16:
-return llvm::VectorType::get(Builder.getInt1Ty(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyBool32:
-return llvm::VectorType::get(Builder.getInt1Ty(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4);
   case SVETypeFlags::EltTyBool64:
-return 

[PATCH] D78970: [CUDA][HIP] Fix ambiguity of new operator

2020-04-27 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision.
yaxunl added reviewers: tra, rjmccall.

https://reviews.llvm.org/D77954 caused a regression about ambiguity of new 
operator
in file scope.

This patch recovered the previous behavior for comparison without a caller.

This is a workaround. For real fix we need D71227 



https://reviews.llvm.org/D78970

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


Index: clang/test/SemaCUDA/function-overload.cu
===
--- clang/test/SemaCUDA/function-overload.cu
+++ clang/test/SemaCUDA/function-overload.cu
@@ -449,3 +449,17 @@
 int test_constexpr_overload(C2 , C2 ) {
   return constexpr_overload(x, y);
 }
+
+// Verify no ambiguity for new operator.
+void *a = new int;
+__device__ void *b = new int;
+// expected-error@-1{{dynamic initialization is not supported for __device__, 
__constant__, and __shared__ variables.}}
+
+// Verify no ambiguity for new operator.
+template _Tp&& f();
+template()))>
+void __test();
+
+void foo() {
+  __test();
+}
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -9779,10 +9779,9 @@
   // If other rules cannot determine which is better, CUDA preference is used
   // to determine which is better.
   if (S.getLangOpts().CUDA && Cand1.Function && Cand2.Function) {
-if (FunctionDecl *Caller = dyn_cast(S.CurContext)) {
-  return S.IdentifyCUDAPreference(Caller, Cand1.Function) >
- S.IdentifyCUDAPreference(Caller, Cand2.Function);
-}
+FunctionDecl *Caller = dyn_cast(S.CurContext);
+return S.IdentifyCUDAPreference(Caller, Cand1.Function) >
+   S.IdentifyCUDAPreference(Caller, Cand2.Function);
   }
 
   return false;


Index: clang/test/SemaCUDA/function-overload.cu
===
--- clang/test/SemaCUDA/function-overload.cu
+++ clang/test/SemaCUDA/function-overload.cu
@@ -449,3 +449,17 @@
 int test_constexpr_overload(C2 , C2 ) {
   return constexpr_overload(x, y);
 }
+
+// Verify no ambiguity for new operator.
+void *a = new int;
+__device__ void *b = new int;
+// expected-error@-1{{dynamic initialization is not supported for __device__, __constant__, and __shared__ variables.}}
+
+// Verify no ambiguity for new operator.
+template _Tp&& f();
+template()))>
+void __test();
+
+void foo() {
+  __test();
+}
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -9779,10 +9779,9 @@
   // If other rules cannot determine which is better, CUDA preference is used
   // to determine which is better.
   if (S.getLangOpts().CUDA && Cand1.Function && Cand2.Function) {
-if (FunctionDecl *Caller = dyn_cast(S.CurContext)) {
-  return S.IdentifyCUDAPreference(Caller, Cand1.Function) >
- S.IdentifyCUDAPreference(Caller, Cand2.Function);
-}
+FunctionDecl *Caller = dyn_cast(S.CurContext);
+return S.IdentifyCUDAPreference(Caller, Cand1.Function) >
+   S.IdentifyCUDAPreference(Caller, Cand2.Function);
   }
 
   return false;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78958: [SVE] Update EmitSVEPredicateCast to take a ScalableVectorType

2020-04-27 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 260474.
ctetreau added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78958

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h


Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -3914,7 +3914,8 @@
   llvm::ScalableVectorType *getSVEType(const SVETypeFlags );
   llvm::ScalableVectorType *getSVEPredType(SVETypeFlags TypeFlags);
   llvm::Value *EmitSVEDupX(llvm::Value *Scalar);
-  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred, llvm::VectorType *VTy);
+  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred,
+llvm::ScalableVectorType *VTy);
   llvm::Value *EmitSVEGatherLoad(SVETypeFlags TypeFlags,
  llvm::SmallVectorImpl ,
  unsigned IntID);
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7609,15 +7609,14 @@
 // Reinterpret the input predicate so that it can be used to correctly isolate
 // the elements of the specified datatype.
 Value *CodeGenFunction::EmitSVEPredicateCast(Value *Pred,
- llvm::VectorType *VTy) {
-  llvm::VectorType *RTy = llvm::VectorType::get(
-  IntegerType::get(getLLVMContext(), 1), VTy->getElementCount());
+ llvm::ScalableVectorType *VTy) {
+  auto *RTy = llvm::VectorType::get(IntegerType::get(getLLVMContext(), 1), 
VTy);
   if (Pred->getType() == RTy)
 return Pred;
 
   unsigned IntID;
   llvm::Type *IntrinsicTy;
-  switch (VTy->getNumElements()) {
+  switch (VTy->getMinNumElements()) {
   default:
 llvm_unreachable("unsupported element count!");
   case 2:
@@ -7948,7 +7947,7 @@
 // Predicate results must be converted to svbool_t.
 if (auto PredTy = dyn_cast(Call->getType()))
   if (PredTy->getScalarType()->isIntegerTy(1))
-Call = EmitSVEPredicateCast(Call, cast(Ty));
+Call = EmitSVEPredicateCast(Call, cast(Ty));
 
 return Call;
   }


Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -3914,7 +3914,8 @@
   llvm::ScalableVectorType *getSVEType(const SVETypeFlags );
   llvm::ScalableVectorType *getSVEPredType(SVETypeFlags TypeFlags);
   llvm::Value *EmitSVEDupX(llvm::Value *Scalar);
-  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred, llvm::VectorType *VTy);
+  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred,
+llvm::ScalableVectorType *VTy);
   llvm::Value *EmitSVEGatherLoad(SVETypeFlags TypeFlags,
  llvm::SmallVectorImpl ,
  unsigned IntID);
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7609,15 +7609,14 @@
 // Reinterpret the input predicate so that it can be used to correctly isolate
 // the elements of the specified datatype.
 Value *CodeGenFunction::EmitSVEPredicateCast(Value *Pred,
- llvm::VectorType *VTy) {
-  llvm::VectorType *RTy = llvm::VectorType::get(
-  IntegerType::get(getLLVMContext(), 1), VTy->getElementCount());
+ llvm::ScalableVectorType *VTy) {
+  auto *RTy = llvm::VectorType::get(IntegerType::get(getLLVMContext(), 1), VTy);
   if (Pred->getType() == RTy)
 return Pred;
 
   unsigned IntID;
   llvm::Type *IntrinsicTy;
-  switch (VTy->getNumElements()) {
+  switch (VTy->getMinNumElements()) {
   default:
 llvm_unreachable("unsupported element count!");
   case 2:
@@ -7948,7 +7947,7 @@
 // Predicate results must be converted to svbool_t.
 if (auto PredTy = dyn_cast(Call->getType()))
   if (PredTy->getScalarType()->isIntegerTy(1))
-Call = EmitSVEPredicateCast(Call, cast(Ty));
+Call = EmitSVEPredicateCast(Call, cast(Ty));
 
 return Call;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78969: [clang][OpenMP] Fix getNDSWDS for aarch64.

2020-04-27 Thread Francesco Petrogalli via Phabricator via cfe-commits
fpetrogalli added a comment.

Hello reviewers,

I know this is not how the fix should be tested (`fprintf` in debug builds...).

This function would benefit of some unitests in the `unittests` folder of 
clang, but I don't have a way to export it there as it is private to this 
module.

I would like to lift it to some class (as a static function of 
`CodeGenFunction`, for example), but that would require exposing the  
`ParamAttrTy`. Are you OK with that? I'd rather use the `llvm::VFParameter` of 
`llvm/Analisys/VectorUtils.h` as I suggested in 
http://lists.llvm.org/pipermail/llvm-dev/2020-April/141057.html, but that would 
definitely require a first patch work to remove the uses of `ParamAttrTy` in 
favor of `llvm::VFParameter`.

I am open to alternative suggestions, of course!

Kind regards,

Francesco


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78969



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


[PATCH] D78969: [clang][OpenMP] Fix getNDSWDS for aarch64.

2020-04-27 Thread Francesco Petrogalli via Phabricator via cfe-commits
fpetrogalli created this revision.
fpetrogalli added a reviewer: ABataev.
Herald added subscribers: cfe-commits, danielkiss, guansong, kristof.beyls, 
yaxunl.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.
fpetrogalli added a comment.

Hello reviewers,

I know this is not how the fix should be tested (`fprintf` in debug builds...).

This function would benefit of some unitests in the `unittests` folder of 
clang, but I don't have a way to export it there as it is private to this 
module.

I would like to lift it to some class (as a static function of 
`CodeGenFunction`, for example), but that would require exposing the  
`ParamAttrTy`. Are you OK with that? I'd rather use the `llvm::VFParameter` of 
`llvm/Analisys/VectorUtils.h` as I suggested in 
http://lists.llvm.org/pipermail/llvm-dev/2020-April/141057.html, but that would 
definitely require a first patch work to remove the uses of `ParamAttrTy` in 
favor of `llvm::VFParameter`.

I am open to alternative suggestions, of course!

Kind regards,

Francesco


This change fixes an aarch64-specific bug in the generation of the NDS
and WDS values used to compute the signature of the vector functions
out of OpenMP directives like `declare simd`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78969

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/test/OpenMP/declare_simd_aarch64_ndswds.c


Index: clang/test/OpenMP/declare_simd_aarch64_ndswds.c
===
--- /dev/null
+++ clang/test/OpenMP/declare_simd_aarch64_ndswds.c
@@ -0,0 +1,20 @@
+// REQUIRES: aarch64-registered-target
+// REQUIRES: asserts
+// -fopemp and -fopenmp-simd behavior are expected to be the same.
+
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -fopenmp -x 
c -emit-llvm %s -o - -femit-all-decls 2>&1 | FileCheck %s --check-prefix=AARCH64
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon 
-fopenmp-simd -x c -emit-llvm %s -o - -femit-all-decls 2>&1 | FileCheck %s 
--check-prefix=AARCH64
+
+#pragma omp declare simd linear(sin) linear(cos) notinbranch
+void SineCosineWithFloat(float in, float *sin, float *cos);
+// AARCH64-DAG: getNDSWDS SineCosineWithFloat 32 32
+
+#pragma omp declare simd notinbranch
+void SineCosineNoLinear(float in, float *sin, float *cos);
+// AARCH64-DAG: getNDSWDS SineCosineNoLinear 32 64
+
+static float *F;
+void do_something() {
+  SineCosineWithFloat(*F, F, F);
+  SineCosineNoLinear(*F, F, F);
+}
Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp
===
--- clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -11086,7 +11086,7 @@
 /// as defined by `LS(P)` in 3.2.1 of the AAVFABI.
 /// TODO: Add support for references, section 3.2.1, item 1.
 static unsigned getAArch64LS(QualType QT, ParamKindTy Kind, ASTContext ) {
-  if (getAArch64MTV(QT, Kind) && QT.getCanonicalType()->isPointerType()) {
+  if (!getAArch64MTV(QT, Kind) && QT.getCanonicalType()->isPointerType()) {
 QualType PTy = QT.getCanonicalType()->getPointeeType();
 if (getAArch64PBV(PTy, C))
   return C.getTypeSize(PTy);
@@ -11129,9 +11129,15 @@
  }) &&
  "Invalid size");
 
-  return std::make_tuple(*std::min_element(std::begin(Sizes), std::end(Sizes)),
- *std::max_element(std::begin(Sizes), std::end(Sizes)),
- OutputBecomesInput);
+  const auto Ret =
+  std::make_tuple(*std::min_element(std::begin(Sizes), std::end(Sizes)),
+  *std::max_element(std::begin(Sizes), std::end(Sizes)),
+  OutputBecomesInput);
+#ifndef NDEBUG
+  fprintf(stderr, "getNDSWDS %s %d %d\n", FD->getNameAsString().c_str(),
+  std::get<0>(Ret), std::get<1>(Ret));
+#endif
+  return Ret;
 }
 
 /// Mangle the parameter part of the vector function name according to


Index: clang/test/OpenMP/declare_simd_aarch64_ndswds.c
===
--- /dev/null
+++ clang/test/OpenMP/declare_simd_aarch64_ndswds.c
@@ -0,0 +1,20 @@
+// REQUIRES: aarch64-registered-target
+// REQUIRES: asserts
+// -fopemp and -fopenmp-simd behavior are expected to be the same.
+
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -fopenmp -x c -emit-llvm %s -o - -femit-all-decls 2>&1 | FileCheck %s --check-prefix=AARCH64
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -fopenmp-simd -x c -emit-llvm %s -o - -femit-all-decls 2>&1 | FileCheck %s --check-prefix=AARCH64
+
+#pragma omp declare simd linear(sin) linear(cos) notinbranch
+void SineCosineWithFloat(float in, float *sin, float *cos);
+// AARCH64-DAG: getNDSWDS SineCosineWithFloat 32 32
+
+#pragma omp declare simd notinbranch
+void SineCosineNoLinear(float in, float *sin, float *cos);
+// AARCH64-DAG: getNDSWDS SineCosineNoLinear 32 64
+
+static float *F;
+void do_something() {
+  

[PATCH] D78938: Fixing all comparisons for C++20 compilation.

2020-04-27 Thread Barry Revzin via Phabricator via cfe-commits
BRevzin marked 2 inline comments as done.
BRevzin added inline comments.



Comment at: clang/lib/Parse/ParseOpenMP.cpp:69-70
+  }
   bool operator==(OpenMPDirectiveKind V) const { return Value == unsigned(V); }
   bool operator!=(OpenMPDirectiveKind V) const { return Value != unsigned(V); }
   bool operator<(OpenMPDirectiveKind V) const { return Value < unsigned(V); }

rsmith wrote:
> Do we still need these?
Yep. This type is compared to both itself and the enum, so both are necessary.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78938



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


[PATCH] D78938: Fixing all comparisons for C++20 compilation.

2020-04-27 Thread Barry Revzin via Phabricator via cfe-commits
BRevzin updated this revision to Diff 260477.
BRevzin added a comment.

More idiomatic comparison implementation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78938

Files:
  clang/lib/Parse/ParseOpenMP.cpp


Index: clang/lib/Parse/ParseOpenMP.cpp
===
--- clang/lib/Parse/ParseOpenMP.cpp
+++ clang/lib/Parse/ParseOpenMP.cpp
@@ -61,10 +61,10 @@
   OpenMPDirectiveKindExWrapper(unsigned Value) : Value(Value) {}
   OpenMPDirectiveKindExWrapper(OpenMPDirectiveKind DK) : Value(unsigned(DK)) {}
   bool operator==(OpenMPDirectiveKindExWrapper V) const {
-return Value == unsigned(V);
+return Value == V.Value;
   }
   bool operator!=(OpenMPDirectiveKindExWrapper V) const {
-return Value != unsigned(V);
+return Value != V.Value;
   }
   bool operator==(OpenMPDirectiveKind V) const { return Value == unsigned(V); }
   bool operator!=(OpenMPDirectiveKind V) const { return Value != unsigned(V); }


Index: clang/lib/Parse/ParseOpenMP.cpp
===
--- clang/lib/Parse/ParseOpenMP.cpp
+++ clang/lib/Parse/ParseOpenMP.cpp
@@ -61,10 +61,10 @@
   OpenMPDirectiveKindExWrapper(unsigned Value) : Value(Value) {}
   OpenMPDirectiveKindExWrapper(OpenMPDirectiveKind DK) : Value(unsigned(DK)) {}
   bool operator==(OpenMPDirectiveKindExWrapper V) const {
-return Value == unsigned(V);
+return Value == V.Value;
   }
   bool operator!=(OpenMPDirectiveKindExWrapper V) const {
-return Value != unsigned(V);
+return Value != V.Value;
   }
   bool operator==(OpenMPDirectiveKind V) const { return Value == unsigned(V); }
   bool operator!=(OpenMPDirectiveKind V) const { return Value != unsigned(V); }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78760: Check a class has a definition before iterating over its base classes

2020-04-27 Thread Jan Korous via Phabricator via cfe-commits
jkorous added a comment.

In D78760#2003118 , @rsmith wrote:

> If so, we'll need to make sure that all code that iterates over base classes 
> checks for this condition (I bet there are more cases than the two that you 
> found).


Just a potentially related thought: I was recently trying to understand under 
what circumstances should I expect `CXXBaseSpecifier::getType()` to return 
`QualType` instance for which `isNull()` could be `true`. I gave up and don't 
make any assumption.
Would the suggested change affect this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78760



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


[PATCH] D78842: [SVE][NFC] Use ScalableVectorType in CGBuiltin

2020-04-27 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 260472.
ctetreau added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78842

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h

Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -3911,8 +3911,8 @@
   SmallVector getSVEOverloadTypes(SVETypeFlags TypeFlags,
ArrayRef Ops);
   llvm::Type *getEltType(SVETypeFlags TypeFlags);
-  llvm::VectorType *getSVEType(const SVETypeFlags );
-  llvm::VectorType *getSVEPredType(SVETypeFlags TypeFlags);
+  llvm::ScalableVectorType *getSVEType(const SVETypeFlags );
+  llvm::ScalableVectorType *getSVEPredType(SVETypeFlags TypeFlags);
   llvm::Value *EmitSVEDupX(llvm::Value *Scalar);
   llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred, llvm::VectorType *VTy);
   llvm::Value *EmitSVEGatherLoad(SVETypeFlags TypeFlags,
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7542,66 +7542,68 @@
 
 // Return the llvm predicate vector type corresponding to the specified element
 // TypeFlags.
-llvm::VectorType* CodeGenFunction::getSVEPredType(SVETypeFlags TypeFlags) {
+llvm::ScalableVectorType *
+CodeGenFunction::getSVEPredType(SVETypeFlags TypeFlags) {
   switch (TypeFlags.getEltType()) {
   default: llvm_unreachable("Unhandled SVETypeFlag!");
 
   case SVETypeFlags::EltTyInt8:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 16, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 16);
   case SVETypeFlags::EltTyInt16:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 8, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyInt32:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 4, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4, );
   case SVETypeFlags::EltTyInt64:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 2, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 2);
 
   case SVETypeFlags::EltTyFloat16:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 8, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyFloat32:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 4, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4);
   case SVETypeFlags::EltTyFloat64:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 2, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 2);
   }
 }
 
 // Return the llvm vector type corresponding to the specified element TypeFlags.
-llvm::VectorType *CodeGenFunction::getSVEType(const SVETypeFlags ) {
+llvm::ScalableVectorType *
+CodeGenFunction::getSVEType(const SVETypeFlags ) {
   switch (TypeFlags.getEltType()) {
   default:
 llvm_unreachable("Invalid SVETypeFlag!");
 
   case SVETypeFlags::EltTyInt8:
-return llvm::VectorType::get(Builder.getInt8Ty(), {16, true});
+return llvm::ScalableVectorType::get(Builder.getInt8Ty(), 16);
   case SVETypeFlags::EltTyInt16:
-return llvm::VectorType::get(Builder.getInt16Ty(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getInt16Ty(), 8);
   case SVETypeFlags::EltTyInt32:
-return llvm::VectorType::get(Builder.getInt32Ty(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getInt32Ty(), 4);
   case SVETypeFlags::EltTyInt64:
-return llvm::VectorType::get(Builder.getInt64Ty(), {2, true});
+return llvm::ScalableVectorType::get(Builder.getInt64Ty(), 2);
 
   case SVETypeFlags::EltTyFloat16:
-return llvm::VectorType::get(Builder.getHalfTy(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getHalfTy(), 8);
   case SVETypeFlags::EltTyFloat32:
-return llvm::VectorType::get(Builder.getFloatTy(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getFloatTy(), 4);
   case SVETypeFlags::EltTyFloat64:
-return llvm::VectorType::get(Builder.getDoubleTy(), {2, true});
+return llvm::ScalableVectorType::get(Builder.getDoubleTy(), 2);
 
   case SVETypeFlags::EltTyBool8:
-return llvm::VectorType::get(Builder.getInt1Ty(), {16, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 16);
   case SVETypeFlags::EltTyBool16:
-return llvm::VectorType::get(Builder.getInt1Ty(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyBool32:
-return llvm::VectorType::get(Builder.getInt1Ty(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4);
   case SVETypeFlags::EltTyBool64:
-return 

[PATCH] D78762: build: use `find_package(Python3)` if available

2020-04-27 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

In D78762#2006406 , @JDevlieghere 
wrote:

> I talked to Saleem and he cleared up some of my concerns. Given that the 
> community seems to have agreed to support only Python 3, this change seems a 
> lot more reasonable. My earlier comment was made under the impression that we 
> were going to continue supporting Python 2. With that in mind, the burden 
> should fall on LLDB if we want to continue supporting it. Python 2 will be a 
> "special case" then, rather than another first class citizen. With all that 
> said, this LGTM.


To be clear, the plan is to support Python 2 till Jan 2021 or so. Given that 
this has the fallback though, it LGTM (with the comments addressed).

http://lists.llvm.org/pipermail/llvm-dev/2020-January/138730.html is the 
discussion for LLVM's Python 2/3 plans.




Comment at: llvm/CMakeLists.txt:696
+message(WARNING "Python3 not found, using python2 as a fallback")
+find_package(Python3 COMPONENTS Interpreter REQUIRED)
+if(Python2_VERSION VERSION_LESS 2.7)

Python2


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78762



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


[PATCH] D78953: [libcxx][docs][dfsan] Fix rst rendering related typos

2020-04-27 Thread Zola Bridges via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc750847e0c3b: [libcxx][docs][dfsan] Fix rst rendering 
related typos (authored by zbrid).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78953

Files:
  clang/docs/DataFlowSanitizer.rst


Index: clang/docs/DataFlowSanitizer.rst
===
--- clang/docs/DataFlowSanitizer.rst
+++ clang/docs/DataFlowSanitizer.rst
@@ -24,13 +24,14 @@
 ==
 
 DFSan requires either all of your code to be instrumented or for uninstrumented
-functions to be listed as``uninstrumented`` in the `ABI list`_.
+functions to be listed as ``uninstrumented`` in the `ABI list`_.
 
 If you'd like to have instrumented libc++ functions, then you need to build it
 with DFSan instrumentation from source. Here is an example of how to build
 libc++ and the libc++ ABI with data flow sanitizer instrumentation.
 
 .. code-block:: console
+
   cd libcxx-build
 
   # An example using ninja


Index: clang/docs/DataFlowSanitizer.rst
===
--- clang/docs/DataFlowSanitizer.rst
+++ clang/docs/DataFlowSanitizer.rst
@@ -24,13 +24,14 @@
 ==
 
 DFSan requires either all of your code to be instrumented or for uninstrumented
-functions to be listed as``uninstrumented`` in the `ABI list`_.
+functions to be listed as ``uninstrumented`` in the `ABI list`_.
 
 If you'd like to have instrumented libc++ functions, then you need to build it
 with DFSan instrumentation from source. Here is an example of how to build
 libc++ and the libc++ ABI with data flow sanitizer instrumentation.
 
 .. code-block:: console
+
   cd libcxx-build
 
   # An example using ninja
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] c750847 - [libcxx][docs][dfsan] Fix rst rendering related typos

2020-04-27 Thread Zola Bridges via cfe-commits

Author: Zola Bridges
Date: 2020-04-27T15:07:11-07:00
New Revision: c750847e0c3b07944f5ad6e18f2a37a523964c35

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

LOG: [libcxx][docs][dfsan] Fix rst rendering related typos

* Fix the code block disappearance problem by adding a new line
* Fix the typo where I forgot a space

Reviewed By: ldionne

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

Added: 


Modified: 
clang/docs/DataFlowSanitizer.rst

Removed: 




diff  --git a/clang/docs/DataFlowSanitizer.rst 
b/clang/docs/DataFlowSanitizer.rst
index cc9b8e6e1699..44956037490a 100644
--- a/clang/docs/DataFlowSanitizer.rst
+++ b/clang/docs/DataFlowSanitizer.rst
@@ -24,13 +24,14 @@ How to build libc++ with DFSan
 ==
 
 DFSan requires either all of your code to be instrumented or for uninstrumented
-functions to be listed as``uninstrumented`` in the `ABI list`_.
+functions to be listed as ``uninstrumented`` in the `ABI list`_.
 
 If you'd like to have instrumented libc++ functions, then you need to build it
 with DFSan instrumentation from source. Here is an example of how to build
 libc++ and the libc++ ABI with data flow sanitizer instrumentation.
 
 .. code-block:: console
+
   cd libcxx-build
 
   # An example using ninja



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


[PATCH] D78350: [AST] Build recovery expressions by default for C++.

2020-04-27 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added a comment.

In D78350#1988416 , @hokein wrote:

> @ebevhan, @hubert.reinterpretcast, the patch is based on 
> fd7a34186137168064ffe2ca536823559b92d939 
> , it 
> should contain all the fixes.
>  it would be nice if you can test it again in your downstream clang. Thanks!


Got it. I'll put together a build.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78350



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


[PATCH] D77621: ADT: SmallVector size/capacity use word-size integers when elements are small

2020-04-27 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

I guess this fixes https://bugs.llvm.org/show_bug.cgi?id=45289 as well


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77621



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


[PATCH] D78563: [AIX] Port power alignment rules to clang

2020-04-27 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L abandoned this revision.
Xiangling_L added a comment.

Current implementation conflicts with  __AlignOf  behavior as we discussed in 
[RFC] Adding AIX power alignment rule in clang front end 
(http://lists.llvm.org/pipermail/cfe-dev/2020-April/065324.html) . Drop this 
revision and a new implementation will be put on Phabricator when it's ready.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78563



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


[PATCH] D78842: [SVE][NFC] Use ScalableVectorType in CGBuiltin

2020-04-27 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/D78842/new/

https://reviews.llvm.org/D78842



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


[PATCH] D78762: build: use `find_package(Python3)` if available

2020-04-27 Thread Jonas Devlieghere via Phabricator via cfe-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

I talked to Saleem and he cleared up some of my concerns. Given that the 
community seems to have agreed to support only Python 3, this change seems a 
lot more reasonable. My earlier comment was made under the impression that we 
were going to continue supporting Python 2. With that in mind, the burden 
should fall on LLDB if we want to continue supporting it. Python 2 will be a 
"special case" then, rather than another first class citizen. With all that 
said, this LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78762



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


[PATCH] D77621: ADT: SmallVector size/capacity use word-size integers when elements are small

2020-04-27 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay closed this revision.
MaskRay added a comment.

@browneee Hi, it seems that you did not attach `Differential Revision: ` to the 
commit dda3c19a3618dce9492687f8e880e7a73486ee98 
 so the 
differential was not closed automatically.

In previous llvm-dev discussions, people agreed that `Reviewed-by:` and 
`Differential Revision: ` are useful and should be retained.

I usually do this when committing: `arcfilter; git fetch origin master && git 
rebase origin/master; last-minute-testing && git push origin HEAD:master`

where `arcfilter` is a shell function which drops unneeded Phabricator tags

  arcfilter () {
  arc amend
  git log -1 --pretty=%B | awk '/Reviewers:|Subscribers:/{p=1} 
/Reviewed By:|Differential Revision:/{p=0} !p && !/^Summary:$/ {sub(/^Summary: 
/,"");print}' | git commit --amend -F -
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77621



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


[PATCH] D78890: [clang-tidy] Add check callee-namespace.

2020-04-27 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp:22-23
+const DeclContext *getOutermostNamespace(const DeclContext *Decl) {
+  if (Decl->isTranslationUnit())
+return Decl;
+  if (Decl->getParent() && Decl->getParent()->isTranslationUnit())

Under what circumstances could the translation unit be passed in as the 
declaration? I think this code can just be removed.



Comment at: clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp:30-31
+void CalleeNamespaceCheck::registerMatchers(MatchFinder *Finder) {
+  Finder->addMatcher(
+  callExpr(callee(functionDecl().bind("func"))).bind("call-site"), this);
+}

Do you also want to catch binding of function pointers? e.g.,
```
float (*fp)(float) = sinf;
```



Comment at: clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp:43-46
+  const DeclContext *NS = getOutermostNamespace(cast(FuncDecl));
+  if (isa(NS) &&
+  cast(NS)->getName() == "__llvm_libc")
+return;

```
const auto *NS = dyn_cast(getOutermostNamespace(FuncDecl));
if (NS && NS->getName() == "__llvm_libc")
  return;
```



Comment at: clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp:48-49
+
+  diag(CallsiteExpr->getBeginLoc(), "function %0 must call to internal "
+"implementation in `__llvm_libc` 
namespace")
+  << FuncDecl;

How about: `%0 must resolve to a function declared within the '__llvm_libc' 
namespace`



Comment at: clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp:52-53
+
+  diag(FuncDecl->getLocation(),
+   "currently resolves to: ", clang::DiagnosticIDs::Note);
+}

This diagnostic seems a bit strange -- I would expect some text after the colon.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78890



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


[PATCH] D78965: [clang][OpenMP] Fix mangling of linear parameters.

2020-04-27 Thread Francesco Petrogalli via Phabricator via cfe-commits
fpetrogalli created this revision.
fpetrogalli added reviewers: ABataev, andwar.
Herald added subscribers: cfe-commits, guansong, yaxunl.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.

The linear parameter token in the mangling function must be multiplied
by the pointee size in bytes when the parameter is a pointer.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78965

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/test/OpenMP/declare_simd_aarch64.c
  clang/test/OpenMP/declare_simd_codegen.cpp

Index: clang/test/OpenMP/declare_simd_codegen.cpp
===
--- clang/test/OpenMP/declare_simd_codegen.cpp
+++ clang/test/OpenMP/declare_simd_codegen.cpp
@@ -136,14 +136,14 @@
 // CHECK-DAG: declare {{.+}}@_Z5add_2Pf(
 // CHECK-DAG: define {{.+}}@_Z11constlineari(
 
-// CHECK-DAG: "_ZGVbM4l8__Z5add_1Pf"
-// CHECK-DAG: "_ZGVbN4l8__Z5add_1Pf"
-// CHECK-DAG: "_ZGVcM8l8__Z5add_1Pf"
-// CHECK-DAG: "_ZGVcN8l8__Z5add_1Pf"
-// CHECK-DAG: "_ZGVdM8l8__Z5add_1Pf"
-// CHECK-DAG: "_ZGVdN8l8__Z5add_1Pf"
-// CHECK-DAG: "_ZGVeM16l8__Z5add_1Pf"
-// CHECK-DAG: "_ZGVeN16l8__Z5add_1Pf"
+// CHECK-DAG: "_ZGVbM4l32__Z5add_1Pf"
+// CHECK-DAG: "_ZGVbN4l32__Z5add_1Pf"
+// CHECK-DAG: "_ZGVcM8l32__Z5add_1Pf"
+// CHECK-DAG: "_ZGVcN8l32__Z5add_1Pf"
+// CHECK-DAG: "_ZGVdM8l32__Z5add_1Pf"
+// CHECK-DAG: "_ZGVdN8l32__Z5add_1Pf"
+// CHECK-DAG: "_ZGVeM16l32__Z5add_1Pf"
+// CHECK-DAG: "_ZGVeN16l32__Z5add_1Pf"
 // CHECK-DAG: "_ZGVbM32v__Z5add_1Pf"
 // CHECK-DAG: "_ZGVcM32v__Z5add_1Pf"
 // CHECK-DAG: "_ZGVdM32v__Z5add_1Pf"
@@ -180,14 +180,14 @@
 // CHECK-DAG: "_ZGVeM16uus1__ZN2VV3addEii"
 // CHECK-DAG: "_ZGVeN16uus1__ZN2VV3addEii"
 
-// CHECK-DAG: "_ZGVbM4lla16l4a4__ZN2VV6taddpfEPfRS0_"
-// CHECK-DAG: "_ZGVbN4lla16l4a4__ZN2VV6taddpfEPfRS0_"
-// CHECK-DAG: "_ZGVcM8lla16l4a4__ZN2VV6taddpfEPfRS0_"
-// CHECK-DAG: "_ZGVcN8lla16l4a4__ZN2VV6taddpfEPfRS0_"
-// CHECK-DAG: "_ZGVdM8lla16l4a4__ZN2VV6taddpfEPfRS0_"
-// CHECK-DAG: "_ZGVdN8lla16l4a4__ZN2VV6taddpfEPfRS0_"
-// CHECK-DAG: "_ZGVeM16lla16l4a4__ZN2VV6taddpfEPfRS0_"
-// CHECK-DAG: "_ZGVeN16lla16l4a4__ZN2VV6taddpfEPfRS0_"
+// CHECK-DAG: "_ZGVbM4ll4a16l4a4__ZN2VV6taddpfEPfRS0_"
+// CHECK-DAG: "_ZGVbN4ll4a16l4a4__ZN2VV6taddpfEPfRS0_"
+// CHECK-DAG: "_ZGVcM8ll4a16l4a4__ZN2VV6taddpfEPfRS0_"
+// CHECK-DAG: "_ZGVcN8ll4a16l4a4__ZN2VV6taddpfEPfRS0_"
+// CHECK-DAG: "_ZGVdM8ll4a16l4a4__ZN2VV6taddpfEPfRS0_"
+// CHECK-DAG: "_ZGVdN8ll4a16l4a4__ZN2VV6taddpfEPfRS0_"
+// CHECK-DAG: "_ZGVeM16ll4a16l4a4__ZN2VV6taddpfEPfRS0_"
+// CHECK-DAG: "_ZGVeN16ll4a16l4a4__ZN2VV6taddpfEPfRS0_"
 
 // CHECK-DAG: "_ZGVbM4vvl8__ZN2VV4taddERA_iRi"
 // CHECK-DAG: "_ZGVbN4vvl8__ZN2VV4taddERA_iRi"
@@ -293,23 +293,23 @@
 // CHECK-DAG: "_ZGVeM16vvv__Z3bax2VVPdi"
 // CHECK-DAG: "_ZGVeN16vvv__Z3bax2VVPdi"
 
-// CHECK-DAG: "_ZGVbM4ua16vl1__Z3fooPffi"
-// CHECK-DAG: "_ZGVbN4ua16vl1__Z3fooPffi"
-// CHECK-DAG: "_ZGVcM8ua16vl1__Z3fooPffi"
-// CHECK-DAG: "_ZGVcN8ua16vl1__Z3fooPffi"
-// CHECK-DAG: "_ZGVdM8ua16vl1__Z3fooPffi"
-// CHECK-DAG: "_ZGVdN8ua16vl1__Z3fooPffi"
-// CHECK-DAG: "_ZGVeM16ua16vl1__Z3fooPffi"
-// CHECK-DAG: "_ZGVeN16ua16vl1__Z3fooPffi"
-
-// CHECK-DAG: "_ZGVbM4l8__Z5add_2Pf"
-// CHECK-DAG: "_ZGVbN4l8__Z5add_2Pf"
-// CHECK-DAG: "_ZGVcM8l8__Z5add_2Pf"
-// CHECK-DAG: "_ZGVcN8l8__Z5add_2Pf"
-// CHECK-DAG: "_ZGVdM8l8__Z5add_2Pf"
-// CHECK-DAG: "_ZGVdN8l8__Z5add_2Pf"
-// CHECK-DAG: "_ZGVeM16l8__Z5add_2Pf"
-// CHECK-DAG: "_ZGVeN16l8__Z5add_2Pf"
+// CHECK-DAG: "_ZGVbM4ua16vl__Z3fooPffi"
+// CHECK-DAG: "_ZGVbN4ua16vl__Z3fooPffi"
+// CHECK-DAG: "_ZGVcM8ua16vl__Z3fooPffi"
+// CHECK-DAG: "_ZGVcN8ua16vl__Z3fooPffi"
+// CHECK-DAG: "_ZGVdM8ua16vl__Z3fooPffi"
+// CHECK-DAG: "_ZGVdN8ua16vl__Z3fooPffi"
+// CHECK-DAG: "_ZGVeM16ua16vl__Z3fooPffi"
+// CHECK-DAG: "_ZGVeN16ua16vl__Z3fooPffi"
+
+// CHECK-DAG: "_ZGVbM4l32__Z5add_2Pf"
+// CHECK-DAG: "_ZGVbN4l32__Z5add_2Pf"
+// CHECK-DAG: "_ZGVcM8l32__Z5add_2Pf"
+// CHECK-DAG: "_ZGVcN8l32__Z5add_2Pf"
+// CHECK-DAG: "_ZGVdM8l32__Z5add_2Pf"
+// CHECK-DAG: "_ZGVdN8l32__Z5add_2Pf"
+// CHECK-DAG: "_ZGVeM16l32__Z5add_2Pf"
+// CHECK-DAG: "_ZGVeN16l32__Z5add_2Pf"
 // CHECK-DAG: "_ZGVbM32v__Z5add_2Pf"
 // CHECK-DAG: "_ZGVcM32v__Z5add_2Pf"
 // CHECK-DAG: "_ZGVdM32v__Z5add_2Pf"
Index: clang/test/OpenMP/declare_simd_aarch64.c
===
--- clang/test/OpenMP/declare_simd_aarch64.c
+++ clang/test/OpenMP/declare_simd_aarch64.c
@@ -130,12 +130,12 @@
 /*/
 #pragma omp declare simd linear(sin) linear(cos)
 void sincos(double in, double *sin, double *cos);
-// AARCH64: "_ZGVnN2vll_sincos"
+// AARCH64: "_ZGVnN2vl8l8_sincos"
 // AARCH64-NOT: sincos
 
 #pragma omp declare simd linear(sin : 1) linear(cos : 2)
 void SinCos(double in, double *sin, double *cos);
-// AARCH64: "_ZGVnN2vll2_SinCos"
+// AARCH64: "_ZGVnN2vl8l16_SinCos"
 // AARCH64-NOT: SinCos
 
 // Selection of tests based on the examples provided in chapter 5 of
@@ -158,7 +158,7 @@
 // Listing 

[PATCH] D78223: [clang-tidy] performance-range-for-copy only for copy.

2020-04-27 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.

LGTM aside from some small nits




Comment at: clang-tools-extra/clang-tidy/performance/ForRangeCopyCheck.cpp:68
+// loop index because it's less clear than copying the temporary.
+static bool isCopyConstructedFromLValueArg(const VarDecl , ASTContext& 
Ctx) {
+  const auto *Init = dyn_cast_or_null(LoopVar.getInit());

Formatting is off here, so run through clang-format?



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/performance-for-range-copy.cpp:50
 
+
 struct Convertible {

Spurious whitespace change?


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D78223



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


[PATCH] D78900: [HIP][AMDGPU] Enable structurizer workarounds

2020-04-27 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added inline comments.



Comment at: clang/lib/Driver/ToolChains/HIP.cpp:158
   Args.MakeArgString(Twine("-filetype=") + (OutputIsAsm ? "asm" : "obj")));
+  LlcArgs.push_back("--amdgpu-enable-structurizer-workarounds");
 

We should just flip this in the backend. llc flags are not intended for 
frontends to set options


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78900



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


[PATCH] D78534: [libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON

2020-04-27 Thread Shoaib Meenai via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf8990feb125a: [libclang] Install both libclang.a and 
libclang.so when LIBCLANG_BUILD_STATIC=ON (authored by zhuhan0, committed by 
smeenai).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78534

Files:
  clang/cmake/modules/AddClang.cmake


Index: clang/cmake/modules/AddClang.cmake
===
--- clang/cmake/modules/AddClang.cmake
+++ clang/cmake/modules/AddClang.cmake
@@ -99,38 +99,40 @@
   endif()
   llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
 
-  if(TARGET ${name})
-target_link_libraries(${name} INTERFACE ${LLVM_COMMON_LIBS})
-
-if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)
-  set(export_to_clangtargets)
-  if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
-  "clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
-  NOT LLVM_DISTRIBUTION_COMPONENTS)
-set(export_to_clangtargets EXPORT ClangTargets)
-set_property(GLOBAL PROPERTY CLANG_HAS_EXPORTS True)
+  foreach(lib ${name} ${name}_static)
+if(TARGET ${lib})
+  target_link_libraries(${lib} INTERFACE ${LLVM_COMMON_LIBS})
+
+  if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)
+set(export_to_clangtargets)
+if(${lib} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+"clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+NOT LLVM_DISTRIBUTION_COMPONENTS)
+  set(export_to_clangtargets EXPORT ClangTargets)
+  set_property(GLOBAL PROPERTY CLANG_HAS_EXPORTS True)
+endif()
+
+install(TARGETS ${lib}
+  COMPONENT ${lib}
+  ${export_to_clangtargets}
+  LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+  ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+  RUNTIME DESTINATION bin)
+
+if (NOT LLVM_ENABLE_IDE)
+  add_llvm_install_targets(install-${lib}
+   DEPENDS ${lib}
+   COMPONENT ${lib})
+endif()
+
+set_property(GLOBAL APPEND PROPERTY CLANG_LIBS ${lib})
   endif()
-
-  install(TARGETS ${name}
-COMPONENT ${name}
-${export_to_clangtargets}
-LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
-ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
-RUNTIME DESTINATION bin)
-
-  if (NOT LLVM_ENABLE_IDE)
-add_llvm_install_targets(install-${name}
- DEPENDS ${name}
- COMPONENT ${name})
-  endif()
-
-  set_property(GLOBAL APPEND PROPERTY CLANG_LIBS ${name})
+  set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${lib})
+else()
+  # Add empty "phony" target
+  add_custom_target(${lib})
 endif()
-set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
-  else()
-# Add empty "phony" target
-add_custom_target(${name})
-  endif()
+  endforeach()
 
   set_target_properties(${name} PROPERTIES FOLDER "Clang libraries")
   set_clang_windows_version_resource_properties(${name})


Index: clang/cmake/modules/AddClang.cmake
===
--- clang/cmake/modules/AddClang.cmake
+++ clang/cmake/modules/AddClang.cmake
@@ -99,38 +99,40 @@
   endif()
   llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
 
-  if(TARGET ${name})
-target_link_libraries(${name} INTERFACE ${LLVM_COMMON_LIBS})
-
-if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)
-  set(export_to_clangtargets)
-  if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
-  "clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
-  NOT LLVM_DISTRIBUTION_COMPONENTS)
-set(export_to_clangtargets EXPORT ClangTargets)
-set_property(GLOBAL PROPERTY CLANG_HAS_EXPORTS True)
+  foreach(lib ${name} ${name}_static)
+if(TARGET ${lib})
+  target_link_libraries(${lib} INTERFACE ${LLVM_COMMON_LIBS})
+
+  if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)
+set(export_to_clangtargets)
+if(${lib} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+"clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+NOT LLVM_DISTRIBUTION_COMPONENTS)
+  set(export_to_clangtargets EXPORT ClangTargets)
+  set_property(GLOBAL PROPERTY CLANG_HAS_EXPORTS True)
+endif()
+
+install(TARGETS ${lib}
+  COMPONENT ${lib}
+  ${export_to_clangtargets}
+  LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+  ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+  RUNTIME DESTINATION bin)
+
+if (NOT LLVM_ENABLE_IDE)
+  add_llvm_install_targets(install-${lib}
+   DEPENDS ${lib}
+  

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

2020-04-27 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp:186-188
+  NameLookup(const NamedDecl *ND) : Data(ND, false) {}
+  NameLookup(llvm::NoneType) : Data(nullptr, true) {}
+  NameLookup(std::nullptr_t) : Data(nullptr, false) {}

Make these `explicit`?



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

I'd appreciate some comments here explaining when this should be overridden. 
I'd also like to understand why we need `storeOptions` and `storeCheckOptions` 
because the two names are so similar to one another.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73052



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


[PATCH] D78960: [SveEmitter] Add builtins for ternary ops (fmla, fmad, etc)

2020-04-27 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

For patches that only touch arm_sve.td, I trust that you've written it 
correctly; if there were any mistakes, it would be very hard to catch them in 
review anyway.  However you prefer to organize that is fine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78960



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


[PATCH] D78534: [libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON

2020-04-27 Thread Han Zhu via Phabricator via cfe-commits
zhuhan0 added a comment.

@smeenai Thank you!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78534



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


[PATCH] D78534: [libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON

2020-04-27 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

Committed. Please forward any buildbot failure emails to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78534



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


[PATCH] D78767: [Sema] Teach -Wcast-align to compute a more accurate alignment when the source expression has array subscript or pointer arithmetic operators

2020-04-27 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak planned changes to this revision.
ahatanak added a comment.

The method has to compute the correct alignment for variables captured by 
lambdas or blocks too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78767



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


[PATCH] D74846: fix -fcodegen-modules code when used with PCH (PR44953)

2020-04-27 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea added a comment.

@llunak : It seems @hans already reverted this in 
rG7ea9a6e0220da36ff2fd1fbc29c2755be23e5166 
, could 
you please ensure this patch is still relevant?


Repository:
  rC Clang

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

https://reviews.llvm.org/D74846



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


[clang] 612720d - [hip] Remove test using `hip_pinned_shadow` attribute. NFC.

2020-04-27 Thread Michael Liao via cfe-commits

Author: Michael Liao
Date: 2020-04-27T16:44:59-04:00
New Revision: 612720db874d06a50b793c301e5b3b857e3e7c70

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

LOG: [hip] Remove test using `hip_pinned_shadow` attribute. NFC.

Added: 


Modified: 


Removed: 
clang/test/CodeGenCUDA/hip-pinned-shadow.hip



diff  --git a/clang/test/CodeGenCUDA/hip-pinned-shadow.hip 
b/clang/test/CodeGenCUDA/hip-pinned-shadow.hip
deleted file mode 100644
index 7f0e7544d828..
--- a/clang/test/CodeGenCUDA/hip-pinned-shadow.hip
+++ /dev/null
@@ -1,27 +0,0 @@
-// REQUIRES: amdgpu-registered-target
-
-// RUN: %clang_cc1 -triple amdgcn -fcuda-is-device -std=c++11 -fvisibility 
hidden -fapply-global-visibility-to-externs \
-// RUN: -emit-llvm -o - %s | FileCheck -check-prefixes=HIPDEV %s
-// RUN: %clang_cc1 -triple x86_64 -std=c++11 \
-// RUN: -emit-llvm -o - %s | FileCheck -check-prefixes=HIPHOST %s
-// RUN: %clang_cc1 -triple amdgcn -fcuda-is-device -std=c++11 -fvisibility 
hidden -fapply-global-visibility-to-externs \
-// RUN: -O3 -emit-llvm -o - %s | FileCheck -check-prefixes=HIPDEVUNSED %s
-
-struct textureReference {
-  int a;
-};
-
-template 
-struct texture : public textureReference {
-texture() { a = 1; }
-};
-
-__attribute__((hip_pinned_shadow)) texture tex;
-// CUDADEV-NOT: @tex
-// CUDAHOST-NOT: call i32 @__hipRegisterVar{{.*}}@tex
-// HIPDEV: @tex = external addrspace(1) global %struct.texture
-// HIPDEV-NOT: declare{{.*}}void @_ZN7textureIfLi2ELi1EEC1Ev
-// HIPHOST:  define{{.*}}@_ZN7textureIfLi2ELi1EEC1Ev
-// HIPHOST:  call i32 @__hipRegisterVar{{.*}}@tex{{.*}}i32 0, i32 4, i32 0, 
i32 0)
-// HIPDEVUNSED: @tex = external addrspace(1) global %struct.texture
-// HIPDEVUNSED-NOT: declare{{.*}}void @_ZN7textureIfLi2ELi1EEC1Ev



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


[clang] f8990fe - [libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON

2020-04-27 Thread Shoaib Meenai via cfe-commits

Author: Han Zhu
Date: 2020-04-27T13:37:07-07:00
New Revision: f8990feb125a0f8d3f2892a589bc6fad3c430858

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

LOG: [libclang] Install both libclang.a and libclang.so when 
LIBCLANG_BUILD_STATIC=ON

When LIBCLANG_BUILD_STATIC=ON and LLVM_ENABLE_PIC=ON, PIC version of
libclang.a and libclang.so are built as expected. However libclang.a is
not installed. Looking at the macro llvm_add_library(), when both SHARED
and STATIC are set, it renames the static library to ${name}_static and
then adds it to targets. But when add_clang_library() calls install, it
only checks if ${name} is in targets.

To work around this issue, loop through both ${name} and ${name}_static
and install both of them if they're in targets. This is still correct if
only shared or static library is built. In those cases, only ${name} is
added to targets and cmake install will generate the right install
script depending on the library's type.

Test Plan:
cmake with LIBCLANG_BUILD_STATIC=ON and then ninja install, from master
and this diff. Compare the result directory trees. Confirm that only
difference is the added libclang.a.

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

Added: 


Modified: 
clang/cmake/modules/AddClang.cmake

Removed: 




diff  --git a/clang/cmake/modules/AddClang.cmake 
b/clang/cmake/modules/AddClang.cmake
index c1bb386de6f7..d68218eed073 100644
--- a/clang/cmake/modules/AddClang.cmake
+++ b/clang/cmake/modules/AddClang.cmake
@@ -99,38 +99,40 @@ macro(add_clang_library name)
   endif()
   llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
 
-  if(TARGET ${name})
-target_link_libraries(${name} INTERFACE ${LLVM_COMMON_LIBS})
-
-if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)
-  set(export_to_clangtargets)
-  if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
-  "clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
-  NOT LLVM_DISTRIBUTION_COMPONENTS)
-set(export_to_clangtargets EXPORT ClangTargets)
-set_property(GLOBAL PROPERTY CLANG_HAS_EXPORTS True)
+  foreach(lib ${name} ${name}_static)
+if(TARGET ${lib})
+  target_link_libraries(${lib} INTERFACE ${LLVM_COMMON_LIBS})
+
+  if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)
+set(export_to_clangtargets)
+if(${lib} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+"clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+NOT LLVM_DISTRIBUTION_COMPONENTS)
+  set(export_to_clangtargets EXPORT ClangTargets)
+  set_property(GLOBAL PROPERTY CLANG_HAS_EXPORTS True)
+endif()
+
+install(TARGETS ${lib}
+  COMPONENT ${lib}
+  ${export_to_clangtargets}
+  LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+  ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+  RUNTIME DESTINATION bin)
+
+if (NOT LLVM_ENABLE_IDE)
+  add_llvm_install_targets(install-${lib}
+   DEPENDS ${lib}
+   COMPONENT ${lib})
+endif()
+
+set_property(GLOBAL APPEND PROPERTY CLANG_LIBS ${lib})
   endif()
-
-  install(TARGETS ${name}
-COMPONENT ${name}
-${export_to_clangtargets}
-LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
-ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
-RUNTIME DESTINATION bin)
-
-  if (NOT LLVM_ENABLE_IDE)
-add_llvm_install_targets(install-${name}
- DEPENDS ${name}
- COMPONENT ${name})
-  endif()
-
-  set_property(GLOBAL APPEND PROPERTY CLANG_LIBS ${name})
+  set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${lib})
+else()
+  # Add empty "phony" target
+  add_custom_target(${lib})
 endif()
-set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
-  else()
-# Add empty "phony" target
-add_custom_target(${name})
-  endif()
+  endforeach()
 
   set_target_properties(${name} PROPERTIES FOLDER "Clang libraries")
   set_clang_windows_version_resource_properties(${name})



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


[PATCH] D78534: [libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON

2020-04-27 Thread Han Zhu via Phabricator via cfe-commits
zhuhan0 added a comment.

@smeenai Yes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78534



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


[PATCH] D78755: [SveEmitter] Add builtins for svlen

2020-04-27 Thread Sander de Smalen via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe4872d7f08a1: [SveEmitter] Add builtins for svlen (authored 
by sdesmalen).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78755

Files:
  clang/include/clang/Basic/arm_sve.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_len.c

Index: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_len.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_len.c
@@ -0,0 +1,110 @@
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
+
+#include 
+
+#ifdef SVE_OVERLOADED_FORMS
+// A simple used,unused... macro, long enough to represent any SVE builtin.
+#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
+#else
+#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
+#endif
+
+uint64_t test_svlen_s8(svint8_t op)
+{
+  // CHECK-LABEL: test_svlen_s8
+  // CHECK: %[[VSCALE:.*]] = call i64 @llvm.vscale.i64()
+  // CHECK: %[[SHL:.*]] = shl i64 %[[VSCALE]], 4
+  // CHECK: ret i64 %[[SHL]]
+  return SVE_ACLE_FUNC(svlen,_s8,,)(op);
+}
+
+uint64_t test_svlen_s16(svint16_t op)
+{
+  // CHECK-LABEL: test_svlen_s16
+  // CHECK: %[[VSCALE:.*]] = call i64 @llvm.vscale.i64()
+  // CHECK: %[[SHL:.*]] = shl i64 %[[VSCALE]], 3
+  // CHECK: ret i64 %[[SHL]]
+  return SVE_ACLE_FUNC(svlen,_s16,,)(op);
+}
+
+uint64_t test_svlen_s32(svint32_t op)
+{
+  // CHECK-LABEL: test_svlen_s32
+  // CHECK: %[[VSCALE:.*]] = call i64 @llvm.vscale.i64()
+  // CHECK: %[[SHL:.*]] = shl i64 %[[VSCALE]], 2
+  // CHECK: ret i64 %[[SHL]]
+  return SVE_ACLE_FUNC(svlen,_s32,,)(op);
+}
+
+uint64_t test_svlen_s64(svint64_t op)
+{
+  // CHECK-LABEL: test_svlen_s64
+  // CHECK: %[[VSCALE:.*]] = call i64 @llvm.vscale.i64()
+  // CHECK: %[[SHL:.*]] = shl i64 %[[VSCALE]], 1
+  // CHECK: ret i64 %[[SHL]]
+  return SVE_ACLE_FUNC(svlen,_s64,,)(op);
+}
+
+uint64_t test_svlen_u8(svuint8_t op)
+{
+  // CHECK-LABEL: test_svlen_u8
+  // CHECK: %[[VSCALE:.*]] = call i64 @llvm.vscale.i64()
+  // CHECK: %[[SHL:.*]] = shl i64 %[[VSCALE]], 4
+  // CHECK: ret i64 %[[SHL]]
+  return SVE_ACLE_FUNC(svlen,_u8,,)(op);
+}
+
+uint64_t test_svlen_u16(svuint16_t op)
+{
+  // CHECK-LABEL: test_svlen_u16
+  // CHECK: %[[VSCALE:.*]] = call i64 @llvm.vscale.i64()
+  // CHECK: %[[SHL:.*]] = shl i64 %[[VSCALE]], 3
+  // CHECK: ret i64 %[[SHL]]
+  return SVE_ACLE_FUNC(svlen,_u16,,)(op);
+}
+
+uint64_t test_svlen_u32(svuint32_t op)
+{
+  // CHECK-LABEL: test_svlen_u32
+  // CHECK: %[[VSCALE:.*]] = call i64 @llvm.vscale.i64()
+  // CHECK: %[[SHL:.*]] = shl i64 %[[VSCALE]], 2
+  // CHECK: ret i64 %[[SHL]]
+  return SVE_ACLE_FUNC(svlen,_u32,,)(op);
+}
+
+uint64_t test_svlen_u64(svuint64_t op)
+{
+  // CHECK-LABEL: test_svlen_u64
+  // CHECK: %[[VSCALE:.*]] = call i64 @llvm.vscale.i64()
+  // CHECK: %[[SHL:.*]] = shl i64 %[[VSCALE]], 1
+  // CHECK: ret i64 %[[SHL]]
+  return SVE_ACLE_FUNC(svlen,_u64,,)(op);
+}
+
+uint64_t test_svlen_f16(svfloat16_t op)
+{
+  // CHECK-LABEL: test_svlen_f16
+  // CHECK: %[[VSCALE:.*]] = call i64 @llvm.vscale.i64()
+  // CHECK: %[[SHL:.*]] = shl i64 %[[VSCALE]], 3
+  // CHECK: ret i64 %[[SHL]]
+  return SVE_ACLE_FUNC(svlen,_f16,,)(op);
+}
+
+uint64_t test_svlen_f32(svfloat32_t op)
+{
+  // CHECK-LABEL: test_svlen_f32
+  // CHECK: %[[VSCALE:.*]] = call i64 @llvm.vscale.i64()
+  // CHECK: %[[SHL:.*]] = shl i64 %[[VSCALE]], 2
+  // CHECK: ret i64 %[[SHL]]
+  return SVE_ACLE_FUNC(svlen,_f32,,)(op);
+}
+
+uint64_t test_svlen_f64(svfloat64_t op)
+{
+  // CHECK-LABEL: test_svlen_f64
+  // CHECK: %[[VSCALE:.*]] = call i64 @llvm.vscale.i64()
+  // CHECK: %[[SHL:.*]] = shl i64 %[[VSCALE]], 1
+  // CHECK: ret i64 %[[SHL]]
+  return SVE_ACLE_FUNC(svlen,_f64,,)(op);
+}
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7956,6 +7956,25 @@
 return nullptr;
   case SVE::BI__builtin_sve_svpfalse_b:
 return ConstantInt::getFalse(Ty);
+
+  case SVE::BI__builtin_sve_svlen_f16:
+  case SVE::BI__builtin_sve_svlen_f32:
+  case SVE::BI__builtin_sve_svlen_f64:
+  case SVE::BI__builtin_sve_svlen_s8:
+  case SVE::BI__builtin_sve_svlen_s16:
+  case SVE::BI__builtin_sve_svlen_s32:
+  case SVE::BI__builtin_sve_svlen_s64:
+  case SVE::BI__builtin_sve_svlen_u8:
+  case SVE::BI__builtin_sve_svlen_u16:
+  case SVE::BI__builtin_sve_svlen_u32:
+  case SVE::BI__builtin_sve_svlen_u64: {
+SVETypeFlags TF(Builtin->TypeModifier);
+auto VTy = 

[PATCH] D78534: [libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON

2020-04-27 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

@zhuhan0, do you need someone to commit this for you?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78534



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


[clang] e4872d7 - [SveEmitter] Add builtins for svlen

2020-04-27 Thread Sander de Smalen via cfe-commits

Author: Sander de Smalen
Date: 2020-04-27T21:27:32+01:00
New Revision: e4872d7f08a1d6f657aaf3bd83b2e3b65fccebd4

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

LOG: [SveEmitter] Add builtins for svlen

The svlen builtins return the number of elements in a vector
and are implemented using `llvm.vscale`.

Reviewed By: efriedma

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

Added: 
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_len.c

Modified: 
clang/include/clang/Basic/arm_sve.td
clang/lib/CodeGen/CGBuiltin.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/arm_sve.td 
b/clang/include/clang/Basic/arm_sve.td
index a5cacd2103a8..e77ec24634e9 100644
--- a/clang/include/clang/Basic/arm_sve.td
+++ b/clang/include/clang/Basic/arm_sve.td
@@ -851,6 +851,8 @@ def SVCNTH : SInst<"svcnth", "n", "", MergeNone, 
"aarch64_sve_cnth", [IsAppendSV
 def SVCNTW : SInst<"svcntw", "n", "", MergeNone, "aarch64_sve_cntw", 
[IsAppendSVALL, IsOverloadNone]>;
 def SVCNTD : SInst<"svcntd", "n", "", MergeNone, "aarch64_sve_cntd", 
[IsAppendSVALL, IsOverloadNone]>;
 
+def SVLEN  : SInst<"svlen[_{d}]", "nd",  "csilUcUsUiUlhfd", MergeNone>;
+
 

 // Saturating scalar arithmetic
 

diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index e11791a7a7df..b0e5eebe7b88 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -7956,6 +7956,25 @@ Value 
*CodeGenFunction::EmitAArch64SVEBuiltinExpr(unsigned BuiltinID,
 return nullptr;
   case SVE::BI__builtin_sve_svpfalse_b:
 return ConstantInt::getFalse(Ty);
+
+  case SVE::BI__builtin_sve_svlen_f16:
+  case SVE::BI__builtin_sve_svlen_f32:
+  case SVE::BI__builtin_sve_svlen_f64:
+  case SVE::BI__builtin_sve_svlen_s8:
+  case SVE::BI__builtin_sve_svlen_s16:
+  case SVE::BI__builtin_sve_svlen_s32:
+  case SVE::BI__builtin_sve_svlen_s64:
+  case SVE::BI__builtin_sve_svlen_u8:
+  case SVE::BI__builtin_sve_svlen_u16:
+  case SVE::BI__builtin_sve_svlen_u32:
+  case SVE::BI__builtin_sve_svlen_u64: {
+SVETypeFlags TF(Builtin->TypeModifier);
+auto VTy = cast(getSVEType(TF));
+auto NumEls = llvm::ConstantInt::get(Ty, VTy->getElementCount().Min);
+
+Function *F = CGM.getIntrinsic(Intrinsic::vscale, Ty);
+return Builder.CreateMul(NumEls, Builder.CreateCall(F));
+  }
   }
 
   /// Should not happen

diff  --git a/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_len.c 
b/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_len.c
new file mode 100644
index ..fc8ebaa18868
--- /dev/null
+++ b/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_len.c
@@ -0,0 +1,110 @@
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu 
-target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall 
-emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns 
-S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
+
+#include 
+
+#ifdef SVE_OVERLOADED_FORMS
+// A simple used,unused... macro, long enough to represent any SVE builtin.
+#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
+#else
+#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
+#endif
+
+uint64_t test_svlen_s8(svint8_t op)
+{
+  // CHECK-LABEL: test_svlen_s8
+  // CHECK: %[[VSCALE:.*]] = call i64 @llvm.vscale.i64()
+  // CHECK: %[[SHL:.*]] = shl i64 %[[VSCALE]], 4
+  // CHECK: ret i64 %[[SHL]]
+  return SVE_ACLE_FUNC(svlen,_s8,,)(op);
+}
+
+uint64_t test_svlen_s16(svint16_t op)
+{
+  // CHECK-LABEL: test_svlen_s16
+  // CHECK: %[[VSCALE:.*]] = call i64 @llvm.vscale.i64()
+  // CHECK: %[[SHL:.*]] = shl i64 %[[VSCALE]], 3
+  // CHECK: ret i64 %[[SHL]]
+  return SVE_ACLE_FUNC(svlen,_s16,,)(op);
+}
+
+uint64_t test_svlen_s32(svint32_t op)
+{
+  // CHECK-LABEL: test_svlen_s32
+  // CHECK: %[[VSCALE:.*]] = call i64 @llvm.vscale.i64()
+  // CHECK: %[[SHL:.*]] = shl i64 %[[VSCALE]], 2
+  // CHECK: ret i64 %[[SHL]]
+  return SVE_ACLE_FUNC(svlen,_s32,,)(op);
+}
+
+uint64_t test_svlen_s64(svint64_t op)
+{
+  // CHECK-LABEL: test_svlen_s64
+  // CHECK: %[[VSCALE:.*]] = call i64 @llvm.vscale.i64()
+  // CHECK: %[[SHL:.*]] = shl i64 %[[VSCALE]], 1
+  // CHECK: ret i64 %[[SHL]]
+  return SVE_ACLE_FUNC(svlen,_s64,,)(op);
+}
+
+uint64_t test_svlen_u8(svuint8_t op)
+{
+  // CHECK-LABEL: test_svlen_u8
+  // CHECK: %[[VSCALE:.*]] = call i64 @llvm.vscale.i64()
+  // CHECK: %[[SHL:.*]] = shl i64 %[[VSCALE]], 4
+  // CHECK: ret i64 %[[SHL]]
+  return SVE_ACLE_FUNC(svlen,_u8,,)(op);
+}
+
+uint64_t test_svlen_u16(svuint16_t op)
+{
+  // CHECK-LABEL: test_svlen_u16
+  // CHECK: %[[VSCALE:.*]] = call i64 

[PATCH] D78944: [libc++][test] Disable test for extension that's unsupportable in C++20

2020-04-27 Thread Casey Carter via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb4437992ecce: [libc++][test] Disable test for extension 
thats unsupportable in C++20 (authored by CaseyCarter).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78944

Files:
  libcxx/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
  
libcxx/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp


Index: 
libcxx/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp
===
--- 
libcxx/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp
+++ 
libcxx/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp
@@ -21,12 +21,11 @@
 std::multimap m;
 std::multimap::iterator i;
 std::multimap::const_iterator ci;
+#if TEST_STD_VER <= 17
+// These reverse_iterator specializations require X to be complete in 
C++20.
 std::multimap::reverse_iterator ri;
 std::multimap::const_reverse_iterator cri;
+#endif // TEST_STD_VER <= 17
 };
 
-int main(int, char**)
-{
-
-  return 0;
-}
+int main(int, char**) { return 0; }
Index: 
libcxx/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
===
--- 
libcxx/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
+++ 
libcxx/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
@@ -21,12 +21,11 @@
 std::map m;
 std::map::iterator i;
 std::map::const_iterator ci;
+#if TEST_STD_VER <= 17
+// These reverse_iterator specializations require X to be complete in 
C++20.
 std::map::reverse_iterator ri;
 std::map::const_reverse_iterator cri;
+#endif // TEST_STD_VER <= 17
 };
 
-int main(int, char**)
-{
-
-  return 0;
-}
+int main(int, char**) { return 0; }


Index: libcxx/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp
===
--- libcxx/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp
+++ libcxx/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp
@@ -21,12 +21,11 @@
 std::multimap m;
 std::multimap::iterator i;
 std::multimap::const_iterator ci;
+#if TEST_STD_VER <= 17
+// These reverse_iterator specializations require X to be complete in C++20.
 std::multimap::reverse_iterator ri;
 std::multimap::const_reverse_iterator cri;
+#endif // TEST_STD_VER <= 17
 };
 
-int main(int, char**)
-{
-
-  return 0;
-}
+int main(int, char**) { return 0; }
Index: libcxx/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
===
--- libcxx/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
+++ libcxx/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
@@ -21,12 +21,11 @@
 std::map m;
 std::map::iterator i;
 std::map::const_iterator ci;
+#if TEST_STD_VER <= 17
+// These reverse_iterator specializations require X to be complete in C++20.
 std::map::reverse_iterator ri;
 std::map::const_reverse_iterator cri;
+#endif // TEST_STD_VER <= 17
 };
 
-int main(int, char**)
-{
-
-  return 0;
-}
+int main(int, char**) { return 0; }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78958: [SVE] Update EmitSVEPredicateCast to take a ScalableVectorType

2020-04-27 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/D78958/new/

https://reviews.llvm.org/D78958



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


[PATCH] D75936: Add a Pass to X86 that builds a Condensed CFG for Load Value Injection (LVI) Gadgets [4/6]

2020-04-27 Thread Scott Constable via Phabricator via cfe-commits
sconstab updated this revision to Diff 260439.
sconstab added a comment.

Removed the `-x86-lvi-no-fixed` CLI flag. This change simplifies the code flow 
quite a bit.


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

https://reviews.llvm.org/D75936

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Arch/X86.cpp
  clang/test/Driver/x86-target-features.c
  llvm/lib/Target/X86/CMakeLists.txt
  llvm/lib/Target/X86/ImmutableGraph.h
  llvm/lib/Target/X86/X86.h
  llvm/lib/Target/X86/X86.td
  llvm/lib/Target/X86/X86LoadValueInjectionLoadHardening.cpp
  llvm/lib/Target/X86/X86Subtarget.h
  llvm/lib/Target/X86/X86TargetMachine.cpp
  llvm/test/CodeGen/X86/O0-pipeline.ll
  llvm/test/CodeGen/X86/O3-pipeline.ll
  llvm/test/CodeGen/X86/lvi-hardening-gadget-graph.ll

Index: llvm/test/CodeGen/X86/lvi-hardening-gadget-graph.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/lvi-hardening-gadget-graph.ll
@@ -0,0 +1,129 @@
+; RUN: llc -verify-machineinstrs -mtriple=x86_64-unknown -x86-lvi-load-dot-verify -o %t < %s | FileCheck %s
+
+; Function Attrs: noinline nounwind optnone uwtable
+define dso_local i32 @test(i32* %untrusted_user_ptr, i32* %secret, i32 %secret_size) #0 {
+entry:
+  %untrusted_user_ptr.addr = alloca i32*, align 8
+  %secret.addr = alloca i32*, align 8
+  %secret_size.addr = alloca i32, align 4
+  %ret_val = alloca i32, align 4
+  %i = alloca i32, align 4
+  store i32* %untrusted_user_ptr, i32** %untrusted_user_ptr.addr, align 8
+  store i32* %secret, i32** %secret.addr, align 8
+  store i32 %secret_size, i32* %secret_size.addr, align 4
+  store i32 0, i32* %ret_val, align 4
+  call void @llvm.x86.sse2.lfence()
+  store i32 0, i32* %i, align 4
+  br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+  %0 = load i32, i32* %i, align 4
+  %1 = load i32, i32* %secret_size.addr, align 4
+  %cmp = icmp slt i32 %0, %1
+  br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+  %2 = load i32, i32* %i, align 4
+  %rem = srem i32 %2, 2
+  %cmp1 = icmp eq i32 %rem, 0
+  br i1 %cmp1, label %if.then, label %if.else
+
+if.then:  ; preds = %for.body
+  %3 = load i32*, i32** %secret.addr, align 8
+  %4 = load i32, i32* %ret_val, align 4
+  %idxprom = sext i32 %4 to i64
+  %arrayidx = getelementptr inbounds i32, i32* %3, i64 %idxprom
+  %5 = load i32, i32* %arrayidx, align 4
+  %6 = load i32*, i32** %untrusted_user_ptr.addr, align 8
+  store i32 %5, i32* %6, align 4
+  br label %if.end
+
+if.else:  ; preds = %for.body
+  %7 = load i32*, i32** %secret.addr, align 8
+  %8 = load i32, i32* %ret_val, align 4
+  %idxprom2 = sext i32 %8 to i64
+  %arrayidx3 = getelementptr inbounds i32, i32* %7, i64 %idxprom2
+  store i32 42, i32* %arrayidx3, align 4
+  br label %if.end
+
+if.end:   ; preds = %if.else, %if.then
+  %9 = load i32*, i32** %untrusted_user_ptr.addr, align 8
+  %10 = load i32, i32* %9, align 4
+  store i32 %10, i32* %ret_val, align 4
+  br label %for.inc
+
+for.inc:  ; preds = %if.end
+  %11 = load i32, i32* %i, align 4
+  %inc = add nsw i32 %11, 1
+  store i32 %inc, i32* %i, align 4
+  br label %for.cond
+
+for.end:  ; preds = %for.cond
+  %12 = load i32, i32* %ret_val, align 4
+  ret i32 %12
+}
+
+; CHECK:  digraph "Speculative gadgets for \"test\" function" {
+; CHECK-NEXT: label="Speculative gadgets for \"test\" function";
+; CHECK:  Node0x{{[0-9a-f]+}} [shape=record,color = green,label="{LFENCE\n}"];
+; CHECK-NEXT: Node0x{{[0-9a-f]+}} -> Node0x{{[0-9a-f]+}}[label = 0];
+; CHECK-NEXT: Node0x{{[0-9a-f]+}} [shape=record,label="{renamable $eax = MOV32rm %stack.4.i, 1, $noreg, 0, $noreg :: (dereferenceable load 4 from %ir.i)\n}"];
+; CHECK-NEXT: Node0x{{[0-9a-f]+}} -> Node0x{{[0-9a-f]+}}[color = red, style = "dashed"];
+; CHECK-NEXT: Node0x{{[0-9a-f]+}} -> Node0x{{[0-9a-f]+}}[label = 1];
+; CHECK-NEXT: Node0x{{[0-9a-f]+}} [shape=record,label="{JCC_1 %bb.6, 13, implicit killed $eflags\n}"];
+; CHECK-NEXT: Node0x{{[0-9a-f]+}} -> Node0x{{[0-9a-f]+}}[label = 1];
+; CHECK-NEXT: Node0x{{[0-9a-f]+}} -> Node0x{{[0-9a-f]+}}[label = 1];
+; CHECK-NEXT: Node0x{{[0-9a-f]+}} [shape=record,label="{CMP32rm killed renamable $eax, %stack.2.secret_size.addr, 1, $noreg, 0, $noreg, implicit-def $eflags :: (dereferenceable load 4 from %ir.secret_size.addr)\n}"];
+; CHECK-NEXT: Node0x{{[0-9a-f]+}} -> Node0x{{[0-9a-f]+}}[color = red, style = "dashed"];
+; CHECK-NEXT: Node0x{{[0-9a-f]+}} -> Node0x{{[0-9a-f]+}}[label = 1];
+; CHECK-NEXT: Node0x{{[0-9a-f]+}} [shape=record,label="{renamable $eax = MOV32rm %stack.4.i, 1, $noreg, 0, $noreg :: (dereferenceable load 4 from %ir.i)\n}"];
+; CHECK-NEXT: Node0x{{[0-9a-f]+}} -> 

[PATCH] D76801: [AST] Print a> without extra spaces in C++11 or later.

2020-04-27 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D76801#2005264 , @labath wrote:

> In D76801#1997451 , @dblaikie wrote:
>
> > Yeah, points all taken - as for this actual issue... I'm kind of inclined 
> > to say "hey, our template names already diverge somewhat - and this 
> > divergence is in the realm of acceptable by gdb (without an index) so... 
> > *thumbs up*/let's stick with it"
>
>
> Another interesting aspect here is that the DW_AT_name outputs depend on the 
> c++ standard versions used.


Yeah, I find that at least "weird", though not necessarily wrong.

> This means we could get mismatches even with the same compiler if some 
> compile units use `-std=c++98`, and others `-std>=c++11` (hardly a 
> recommended practice but it does work if one knows what he is doing). 
> Compatibility with another compiler is one thing, but maybe 
> self-compatibility is more important (and easier to achieve) ?

Yeah, I don't disagree with that - again, not quite sure I'd say it goes as far 
as "wrong" (I mean, DWARF doesn't spec this - so wrongness in our own judgment, 
not any authoritative sense) but yeah, perhaps insufficiently motivated 
quirkiness.

> One way to  achieve that would be by printing all type names in c++98 mode, 
> which (IIUC) is the same thing as what the windows folks are requesting..

Fair enough - I wouldn't object to that change being made & just having it the 
same for MSVC and DWARF in this case. (it's a /bit/ less good for C++11 and 
above users to get names with the extra space, but seems minor enough perhaps 
not to bother trying to preserve it given the complicaitons)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76801



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


[PATCH] D78960: [SveEmitter] Add builtins for ternary ops (fmla, fmad, etc)

2020-04-27 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen added a comment.

Now that most of the functionality has been added to SveEmitter.cpp and 
CGBuiltin.cpp, the patches are becoming simpler and simpler. This patch is such 
an example, which is basically "builtin definitions + tests".

This is probably a good point to ask for some feedback how to best get these 
patches into Clang without spamming your inboxes too much :) I can choose to do 
this in individual patches for similar 'groups' of operations (like this patch 
does it). Alternatively I could collate them all into a single patch and put 
that up for review. Or I can  just commit such simple changes directly if you 
think there is little value in reviewing these (note that any patches that 
require code-changes or that add some macro in the arm_sve.h header file would 
still go through normal review process, the question is purely about 
structurally simple patches like this).

Do you have any preference/suggestions how to best approach this?

I'm also happy to add other reviewers, but I'm not sure who best to add. If you 
have suggestions, please let me know.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78960



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


[PATCH] D77621: ADT: SmallVector size/capacity use word-size integers when elements are small

2020-04-27 Thread David Blaikie via Phabricator via cfe-commits
dblaikie accepted this revision.
dblaikie added a comment.

Seems good to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77621



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


[PATCH] D78853: [Sema] Fix null pointer dereference warnings [1/n]

2020-04-27 Thread Mandeep Singh Grang via Phabricator via cfe-commits
mgrang added a comment.

In D78853#2003866 , @efriedma wrote:

> Please don't add null checks for pointers that can't be null.  It makes the 
> code slower and harder to understand.  And least one of the checks you added 
> is actively breaking the code.
>
> In some cases, the analysis is pointing to cases where the code could be made 
> more clear for both humans and machines with some refactoring or assertions.  
> Patches welcome, but please make sure any assertions properly explain the 
> invariant. And please split the patches up a bit more; adding assertions for 
> complex invariants in ten different unrelated places is more than I really 
> want to review at once.
>
> (Also, a reminder, please post patches with full context.)


Thanks @efriedma. Will split up the patches into smaller chunks and also post 
with full context.


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

https://reviews.llvm.org/D78853



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


[PATCH] D74846: fix -fcodegen-modules code when used with PCH (PR44953)

2020-04-27 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea added a comment.

If I understand correctly, this patch reverts the behavior to what it was 
before your changes, to only handle modules, but not PCH? Is that correct?


Repository:
  rC Clang

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

https://reviews.llvm.org/D74846



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


[clang] ce7eb72 - Thread safety analysis: Reword warning after D72635

2020-04-27 Thread Aaron Puchert via cfe-commits

Author: Aaron Puchert
Date: 2020-04-27T22:23:52+02:00
New Revision: ce7eb72a3c87a9d15ba4962fa7a23aad24f98156

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

LOG: Thread safety analysis: Reword warning after D72635

We allow arbitrary names for capabilities now, and the name didn't play
a role for this anyway.

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/test/SemaCXX/warn-thread-safety-parsing.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index c9aa49a31ed8..9c1b6c593857 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3336,7 +3336,7 @@ def warn_thread_attribute_argument_not_lockable : Warning<
   InGroup, DefaultIgnore;
 def warn_thread_attribute_decl_not_lockable : Warning<
   "%0 attribute can only be applied in a context annotated "
-  "with 'capability(\"mutex\")' attribute">,
+  "with 'capability' attribute">,
   InGroup, DefaultIgnore;
 def warn_thread_attribute_decl_not_pointer : Warning<
   "%0 only applies to pointer types; type here is %1">,

diff  --git a/clang/test/SemaCXX/warn-thread-safety-parsing.cpp 
b/clang/test/SemaCXX/warn-thread-safety-parsing.cpp
index 198d02e1f076..6ad0f877a11d 100644
--- a/clang/test/SemaCXX/warn-thread-safety-parsing.cpp
+++ b/clang/test/SemaCXX/warn-thread-safety-parsing.cpp
@@ -496,7 +496,7 @@ Mutex aa_var_arg_bad_3 ACQUIRED_AFTER(muDoublePointer); // \
 Mutex aa_var_arg_bad_4 ACQUIRED_AFTER(umu); // \
   // expected-warning {{'acquired_after' attribute requires arguments whose 
type is annotated with 'capability' attribute}}
 UnlockableMu aa_var_arg_bad_5 ACQUIRED_AFTER(mu_aa); // \
-  // expected-warning {{'acquired_after' attribute can only be applied in a 
context annotated with 'capability("mutex")' attribute}}
+  // expected-warning {{'acquired_after' attribute can only be applied in a 
context annotated with 'capability' attribute}}
 
 //-//
 //  Acquired Before (ab)
@@ -559,7 +559,7 @@ Mutex ab_var_arg_bad_3 ACQUIRED_BEFORE(muDoublePointer); // 
\
 Mutex ab_var_arg_bad_4 ACQUIRED_BEFORE(umu); // \
   // expected-warning {{'acquired_before' attribute requires arguments whose 
type is annotated with 'capability' attribute}}
 UnlockableMu ab_var_arg_bad_5 ACQUIRED_BEFORE(mu_ab); // \
-  // expected-warning {{'acquired_before' attribute can only be applied in a 
context annotated with 'capability("mutex")' attribute}}
+  // expected-warning {{'acquired_before' attribute can only be applied in a 
context annotated with 'capability' attribute}}
 
 
 //-//



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


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

2020-04-27 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

If your change causes a crash, please debug it. That's a completely normal 
thing that programmers do every day. Unfortunately, I can't afford to 
spoon-feed you the solution step-by-step.




Comment at: clang/lib/StaticAnalyzer/Core/SymbolManager.cpp:601-603
+if (LCtx->getAnalysis()->isLive(Loc,
+  PR->getOriginExpr()))
+  return true;

> I implemented the basic `isLive()` and `getBinding()` functions which reduced 
> the number of failing tests by `0`.

This line in particular is very incorrect. In fact, most of the time the result 
will be `false`.


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

https://reviews.llvm.org/D77229



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


[PATCH] D78909: [clang-format] NFC clang-format the clang-format sources

2020-04-27 Thread MyDeveloperDay via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf594e3d2ab92: [clang-format] NFC clang-format the 
clang-format sources (authored by MyDeveloperDay).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78909

Files:
  clang/lib/Format/ContinuationIndenter.cpp
  clang/lib/Format/TokenAnnotator.cpp
  clang/lib/Format/UnwrappedLineParser.cpp


Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -1726,7 +1726,7 @@
 bool UnwrappedLineParser::parseBracedList(bool ContinueOnSemicolons,
   tok::TokenKind ClosingBraceKind) {
   bool HasError = false;
-  
+
   // FIXME: Once we have an expression parser in the UnwrappedLineParser,
   // replace this by using parseAssigmentExpression() inside.
   do {
Index: clang/lib/Format/TokenAnnotator.cpp
===
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -395,7 +395,7 @@
 
 if (!AttrTok)
   return false;
-
+
 // Allow an attribute to be the only content of a file.
 AttrTok = AttrTok->Next;
 if (!AttrTok)
@@ -2837,9 +2837,10 @@
 //   operator std::Foo*()
 //   operator C::D*()
 // dependent on PointerAlignment style.
-if (Previous && (Previous->endsSequence(tok::kw_operator) ||
-   Previous->endsSequence(tok::kw_const, tok::kw_operator) ||
-   Previous->endsSequence(tok::kw_volatile, tok::kw_operator)))
+if (Previous &&
+(Previous->endsSequence(tok::kw_operator) ||
+ Previous->endsSequence(tok::kw_const, tok::kw_operator) ||
+ Previous->endsSequence(tok::kw_volatile, tok::kw_operator)))
   return (Style.PointerAlignment != FormatStyle::PAS_Left);
   }
   const auto SpaceRequiredForArrayInitializerLSquare =
@@ -3325,22 +3326,20 @@
   if (Tok.Children.size() != 1)
 return false;
   FormatToken *curElt = Tok.Children[0]->First;
-while (curElt) {
-  if (curElt->MustBreakBefore)
-return false;
-  curElt = curElt->Next;
-}
+  while (curElt) {
+if (curElt->MustBreakBefore)
+  return false;
+curElt = curElt->Next;
+  }
   return true;
 }
-static bool
-isAllmanLambdaBrace(const FormatToken ) {
+static bool isAllmanLambdaBrace(const FormatToken ) {
   return (Tok.is(tok::l_brace) && Tok.BlockKind == BK_Block &&
-  !Tok.isOneOf(TT_ObjCBlockLBrace, TT_DictLiteral));
+  !Tok.isOneOf(TT_ObjCBlockLBrace, TT_DictLiteral));
 }
 
-static bool
-isAllmanBraceIncludedBreakableLambda(const FormatToken ,
-FormatStyle::ShortLambdaStyle ShortLambdaOption) {
+static bool isAllmanBraceIncludedBreakableLambda(
+const FormatToken , FormatStyle::ShortLambdaStyle ShortLambdaOption) {
   if (!isAllmanLambdaBrace(Tok))
 return false;
 
@@ -3497,7 +3496,7 @@
   if (Style.BraceWrapping.BeforeLambdaBody &&
   (isAllmanBraceIncludedBreakableLambda(Left, ShortLambdaOption) ||
isAllmanBraceIncludedBreakableLambda(Right, ShortLambdaOption))) {
-  return true;
+return true;
   }
 
   if (isAllmanBrace(Left) || isAllmanBrace(Right))
Index: clang/lib/Format/ContinuationIndenter.cpp
===
--- clang/lib/Format/ContinuationIndenter.cpp
+++ clang/lib/Format/ContinuationIndenter.cpp
@@ -1466,10 +1466,11 @@
   ParenState(, NewIndent, LastSpace, AvoidBinPacking, 
NoLineBreak));
   State.Stack.back().NestedBlockIndent = NestedBlockIndent;
   State.Stack.back().BreakBeforeParameter = BreakBeforeParameter;
-  State.Stack.back().HasMultipleNestedBlocks = (Current.BlockParameterCount > 
1);
+  State.Stack.back().HasMultipleNestedBlocks =
+  (Current.BlockParameterCount > 1);
 
-  if (Style.BraceWrapping.BeforeLambdaBody &&
-  Current.Next != nullptr && Current.Tok.is(tok::l_paren)) {
+  if (Style.BraceWrapping.BeforeLambdaBody && Current.Next != nullptr &&
+  Current.Tok.is(tok::l_paren)) {
 // Search for any parameter that is a lambda
 FormatToken const *next = Current.Next;
 while (next != nullptr) {


Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -1726,7 +1726,7 @@
 bool UnwrappedLineParser::parseBracedList(bool ContinueOnSemicolons,
   tok::TokenKind ClosingBraceKind) {
   bool HasError = false;
-  
+
   // FIXME: Once we have an expression parser in the UnwrappedLineParser,
   // replace this by using parseAssigmentExpression() inside.
   do {
Index: clang/lib/Format/TokenAnnotator.cpp

[PATCH] D73846: [PCH] make sure to not warn about unused macros from -D

2020-04-27 Thread Luboš Luňák via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5c8c9905c249: make sure to not warn about unused macros from 
-D (authored by llunak).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73846

Files:
  clang/lib/Lex/PPDirectives.cpp
  clang/test/PCH/cli-macro.c


Index: clang/test/PCH/cli-macro.c
===
--- /dev/null
+++ clang/test/PCH/cli-macro.c
@@ -0,0 +1,12 @@
+// Test this without pch.
+// RUN: %clang_cc1 -Wunused-macros -Dunused=1 -fsyntax-only -verify %s
+
+// Test with pch.
+// RUN: %clang_cc1 -Wunused-macros -emit-pch -o %t %s
+// RUN: %clang_cc1 -Wunused-macros -Dunused=1 -include-pch %t -fsyntax-only 
-verify %s
+
+// expected-no-diagnostics
+
+// -Dunused=1 is intentionally not set for the pch.
+// There still should be no unused warning for a macro from the command line.
+
Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -2802,7 +2802,9 @@
   // warn-because-unused-macro set. If it gets used it will be removed from 
set.
   if (getSourceManager().isInMainFile(MI->getDefinitionLoc()) &&
   !Diags->isIgnored(diag::pp_macro_not_used, MI->getDefinitionLoc()) &&
-  !MacroExpansionInDirectivesOverride) {
+  !MacroExpansionInDirectivesOverride &&
+  getSourceManager().getFileID(MI->getDefinitionLoc()) !=
+  getPredefinesFileID()) {
 MI->setIsWarnIfUnused(true);
 WarnUnusedMacroLocs.insert(MI->getDefinitionLoc());
   }


Index: clang/test/PCH/cli-macro.c
===
--- /dev/null
+++ clang/test/PCH/cli-macro.c
@@ -0,0 +1,12 @@
+// Test this without pch.
+// RUN: %clang_cc1 -Wunused-macros -Dunused=1 -fsyntax-only -verify %s
+
+// Test with pch.
+// RUN: %clang_cc1 -Wunused-macros -emit-pch -o %t %s
+// RUN: %clang_cc1 -Wunused-macros -Dunused=1 -include-pch %t -fsyntax-only -verify %s
+
+// expected-no-diagnostics
+
+// -Dunused=1 is intentionally not set for the pch.
+// There still should be no unused warning for a macro from the command line.
+
Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -2802,7 +2802,9 @@
   // warn-because-unused-macro set. If it gets used it will be removed from set.
   if (getSourceManager().isInMainFile(MI->getDefinitionLoc()) &&
   !Diags->isIgnored(diag::pp_macro_not_used, MI->getDefinitionLoc()) &&
-  !MacroExpansionInDirectivesOverride) {
+  !MacroExpansionInDirectivesOverride &&
+  getSourceManager().getFileID(MI->getDefinitionLoc()) !=
+  getPredefinesFileID()) {
 MI->setIsWarnIfUnused(true);
 WarnUnusedMacroLocs.insert(MI->getDefinitionLoc());
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78958: [SVE] Update EmitSVEPredicateCast to take a ScalableVectorType

2020-04-27 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added subscribers: cfe-commits, psnobl, rkruppe, kristof.beyls, tschuett.
Herald added a reviewer: rengolin.
Herald added a reviewer: efriedma.
Herald added a project: clang.

Removes usage of VectorType::getNumElements identified by test located
at CodeGen/aarch64-sve-intrinsics/acle_sve_abs.c. Since the type is an
SVE predicate vector, it makes sense to specialize the code for scalable
vectors only.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78958

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h


Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -3914,7 +3914,8 @@
   llvm::ScalableVectorType *getSVEType(const SVETypeFlags );
   llvm::ScalableVectorType *getSVEPredType(SVETypeFlags TypeFlags);
   llvm::Value *EmitSVEDupX(llvm::Value *Scalar);
-  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred, llvm::VectorType *VTy);
+  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred,
+llvm::ScalableVectorType *VTy);
   llvm::Value *EmitSVEGatherLoad(SVETypeFlags TypeFlags,
  llvm::SmallVectorImpl ,
  unsigned IntID);
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7609,15 +7609,14 @@
 // Reinterpret the input predicate so that it can be used to correctly isolate
 // the elements of the specified datatype.
 Value *CodeGenFunction::EmitSVEPredicateCast(Value *Pred,
- llvm::VectorType *VTy) {
-  llvm::VectorType *RTy = llvm::VectorType::get(
-  IntegerType::get(getLLVMContext(), 1), VTy->getElementCount());
+ llvm::ScalableVectorType *VTy) {
+  auto *RTy = llvm::VectorType::get(IntegerType::get(getLLVMContext(), 1), 
VTy);
   if (Pred->getType() == RTy)
 return Pred;
 
   unsigned IntID;
   llvm::Type *IntrinsicTy;
-  switch (VTy->getNumElements()) {
+  switch (VTy->getMinNumElements()) {
   default:
 llvm_unreachable("unsupported element count!");
   case 2:
@@ -7948,7 +7947,7 @@
 // Predicate results must be converted to svbool_t.
 if (auto PredTy = dyn_cast(Call->getType()))
   if (PredTy->getScalarType()->isIntegerTy(1))
-Call = EmitSVEPredicateCast(Call, cast(Ty));
+Call = EmitSVEPredicateCast(Call, cast(Ty));
 
 return Call;
   }


Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -3914,7 +3914,8 @@
   llvm::ScalableVectorType *getSVEType(const SVETypeFlags );
   llvm::ScalableVectorType *getSVEPredType(SVETypeFlags TypeFlags);
   llvm::Value *EmitSVEDupX(llvm::Value *Scalar);
-  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred, llvm::VectorType *VTy);
+  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred,
+llvm::ScalableVectorType *VTy);
   llvm::Value *EmitSVEGatherLoad(SVETypeFlags TypeFlags,
  llvm::SmallVectorImpl ,
  unsigned IntID);
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7609,15 +7609,14 @@
 // Reinterpret the input predicate so that it can be used to correctly isolate
 // the elements of the specified datatype.
 Value *CodeGenFunction::EmitSVEPredicateCast(Value *Pred,
- llvm::VectorType *VTy) {
-  llvm::VectorType *RTy = llvm::VectorType::get(
-  IntegerType::get(getLLVMContext(), 1), VTy->getElementCount());
+ llvm::ScalableVectorType *VTy) {
+  auto *RTy = llvm::VectorType::get(IntegerType::get(getLLVMContext(), 1), VTy);
   if (Pred->getType() == RTy)
 return Pred;
 
   unsigned IntID;
   llvm::Type *IntrinsicTy;
-  switch (VTy->getNumElements()) {
+  switch (VTy->getMinNumElements()) {
   default:
 llvm_unreachable("unsupported element count!");
   case 2:
@@ -7948,7 +7947,7 @@
 // Predicate results must be converted to svbool_t.
 if (auto PredTy = dyn_cast(Call->getType()))
   if (PredTy->getScalarType()->isIntegerTy(1))
-Call = EmitSVEPredicateCast(Call, cast(Ty));
+Call = EmitSVEPredicateCast(Call, cast(Ty));
 
 return Call;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74846: fix -fcodegen-modules code when used with PCH (PR44953)

2020-04-27 Thread Luboš Luňák via Phabricator via cfe-commits
llunak added a comment.

Ping


Repository:
  rC Clang

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

https://reviews.llvm.org/D74846



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


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

2020-04-27 Thread Melanie Blower via Phabricator via cfe-commits
mibintc marked 5 inline comments as done.
mibintc added a comment.

A couple replies to @erichkeane




Comment at: clang/include/clang/AST/Expr.h:2251
+  /// allocated in Trailing Storage
+  void setHasStoredFPFeatures(bool B) { UnaryOperatorBits.HasFPFeatures = B; }
+  bool hasStoredFPFeatures() const { return UnaryOperatorBits.HasFPFeatures; }

erichkeane wrote:
> Is this really useful/usable at all?  It seems to me that since this would 
> require re-allocating this object that noone should be able to set this after 
> construction.
It's only used during serialization (ASTReader); I guess the node has already 
been allocated by then so it's superfluous, because the allocation point could 
set this field. 



Comment at: clang/include/clang/AST/Expr.h:2268
+  FPOptions getFPFeatures(const LangOptions ) const {
+if (UnaryOperatorBits.HasFPFeatures)
+  return getStoredFPFeatures();

erichkeane wrote:
> Is there use in having both this AND the get-stored, as opposed to just 
> making everyone access via the same function?  At least having 2 public 
> versions aren't very clear what the difference is to me.
John suggested the name getStored hasStored as "less tempting" names. The 
getStored and hasStored are only used during Serialization.  John suggested the 
getFPFeatures function as the public interface and it uses the LangOptions 
parameter.  The features are saved in the node if they can't be recreated from 
the command line floating point options (due to presence of floating point 
pragma)



Comment at: clang/include/clang/AST/Expr.h:2701
 
+  FPOptions FPFeatures;
+

erichkeane wrote:
> This type already has trailing-storage type stuff.  I think in the past 
> review @rjmccall encouraged you to put this in the fake-trailing-storage  
> like above.
whoops i meant that to go to the CallExprBits



Comment at: clang/include/clang/Basic/LangOptions.h:197
   static constexpr unsigned FPR_ToNearest =
-  static_cast(llvm::RoundingMode::NearestTiesToEven);
+  static_cast(RoundingMode::NearestTiesToEven);
 

erichkeane wrote:
> Is this an unrelated change?  What is the purpose for this?
it's a NFC the llvm:: prefix wasn't needed. maybe the clang formatter did that? 



Comment at: clang/lib/Serialization/ASTReaderStmt.cpp:684
 void ASTStmtReader::VisitUnaryOperator(UnaryOperator *E) {
+  bool hasFP_Features;
   VisitExpr(E);

erichkeane wrote:
> Rather than this variable, why not just ask 'E' below?
yes i could do that. it would be a function call


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72841



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


[PATCH] D78953: [libcxx][docs][dfsan] Fix rst rendering related typos

2020-04-27 Thread Zola Bridges via Phabricator via cfe-commits
zbrid created this revision.
zbrid added reviewers: ldionne, EricWF.
Herald added subscribers: cfe-commits, dexonsmith.
Herald added a project: clang.

- Fix the code block disappearance problem by adding a new line
- Fix the typo where I forgot a space


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78953

Files:
  clang/docs/DataFlowSanitizer.rst


Index: clang/docs/DataFlowSanitizer.rst
===
--- clang/docs/DataFlowSanitizer.rst
+++ clang/docs/DataFlowSanitizer.rst
@@ -24,13 +24,14 @@
 ==
 
 DFSan requires either all of your code to be instrumented or for uninstrumented
-functions to be listed as``uninstrumented`` in the `ABI list`_.
+functions to be listed as ``uninstrumented`` in the `ABI list`_.
 
 If you'd like to have instrumented libc++ functions, then you need to build it
 with DFSan instrumentation from source. Here is an example of how to build
 libc++ and the libc++ ABI with data flow sanitizer instrumentation.
 
 .. code-block:: console
+
   cd libcxx-build
 
   # An example using ninja


Index: clang/docs/DataFlowSanitizer.rst
===
--- clang/docs/DataFlowSanitizer.rst
+++ clang/docs/DataFlowSanitizer.rst
@@ -24,13 +24,14 @@
 ==
 
 DFSan requires either all of your code to be instrumented or for uninstrumented
-functions to be listed as``uninstrumented`` in the `ABI list`_.
+functions to be listed as ``uninstrumented`` in the `ABI list`_.
 
 If you'd like to have instrumented libc++ functions, then you need to build it
 with DFSan instrumentation from source. Here is an example of how to build
 libc++ and the libc++ ABI with data flow sanitizer instrumentation.
 
 .. code-block:: console
+
   cd libcxx-build
 
   # An example using ninja
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69585: Add option to instantiate templates already in the PCH

2020-04-27 Thread Luboš Luňák via Phabricator via cfe-commits
llunak added a comment.

Ping.


Repository:
  rC Clang

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

https://reviews.llvm.org/D69585



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


[clang] f594e3d - [clang-format] NFC clang-format the clang-format sources

2020-04-27 Thread via cfe-commits

Author: mydeveloperday
Date: 2020-04-27T20:41:37+01:00
New Revision: f594e3d2ab92fc4e00359d017a7ea3c8deb771ce

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

LOG: [clang-format] NFC clang-format the clang-format sources

Summary: In recent patches the clang-format code has become un-formatted, 
correct this before making additional changes

Reviewers: mitchell-stellar, sylvestre.ledru, Abpostelnicu, Wawha, jbcoe

Reviewed By: sylvestre.ledru, Abpostelnicu, jbcoe

Subscribers: cfe-commits

Tags: #clang, #clang-format

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

Added: 


Modified: 
clang/lib/Format/ContinuationIndenter.cpp
clang/lib/Format/TokenAnnotator.cpp
clang/lib/Format/UnwrappedLineParser.cpp

Removed: 




diff  --git a/clang/lib/Format/ContinuationIndenter.cpp 
b/clang/lib/Format/ContinuationIndenter.cpp
index e70ae7efb0c3..5fdb1dbc433c 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -1466,10 +1466,11 @@ void 
ContinuationIndenter::moveStatePastScopeOpener(LineState ,
   ParenState(, NewIndent, LastSpace, AvoidBinPacking, 
NoLineBreak));
   State.Stack.back().NestedBlockIndent = NestedBlockIndent;
   State.Stack.back().BreakBeforeParameter = BreakBeforeParameter;
-  State.Stack.back().HasMultipleNestedBlocks = (Current.BlockParameterCount > 
1);
+  State.Stack.back().HasMultipleNestedBlocks =
+  (Current.BlockParameterCount > 1);
 
-  if (Style.BraceWrapping.BeforeLambdaBody &&
-  Current.Next != nullptr && Current.Tok.is(tok::l_paren)) {
+  if (Style.BraceWrapping.BeforeLambdaBody && Current.Next != nullptr &&
+  Current.Tok.is(tok::l_paren)) {
 // Search for any parameter that is a lambda
 FormatToken const *next = Current.Next;
 while (next != nullptr) {

diff  --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 6532f8108f08..3e441100a2f0 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -395,7 +395,7 @@ class AnnotatingParser {
 
 if (!AttrTok)
   return false;
-
+
 // Allow an attribute to be the only content of a file.
 AttrTok = AttrTok->Next;
 if (!AttrTok)
@@ -2837,9 +2837,10 @@ bool TokenAnnotator::spaceRequiredBetween(const 
AnnotatedLine ,
 //   operator std::Foo*()
 //   operator C::D*()
 // dependent on PointerAlignment style.
-if (Previous && (Previous->endsSequence(tok::kw_operator) ||
-   Previous->endsSequence(tok::kw_const, tok::kw_operator) ||
-   Previous->endsSequence(tok::kw_volatile, tok::kw_operator)))
+if (Previous &&
+(Previous->endsSequence(tok::kw_operator) ||
+ Previous->endsSequence(tok::kw_const, tok::kw_operator) ||
+ Previous->endsSequence(tok::kw_volatile, tok::kw_operator)))
   return (Style.PointerAlignment != FormatStyle::PAS_Left);
   }
   const auto SpaceRequiredForArrayInitializerLSquare =
@@ -3325,22 +3326,20 @@ static bool isOneChildWithoutMustBreakBefore(const 
FormatToken ) {
   if (Tok.Children.size() != 1)
 return false;
   FormatToken *curElt = Tok.Children[0]->First;
-while (curElt) {
-  if (curElt->MustBreakBefore)
-return false;
-  curElt = curElt->Next;
-}
+  while (curElt) {
+if (curElt->MustBreakBefore)
+  return false;
+curElt = curElt->Next;
+  }
   return true;
 }
-static bool
-isAllmanLambdaBrace(const FormatToken ) {
+static bool isAllmanLambdaBrace(const FormatToken ) {
   return (Tok.is(tok::l_brace) && Tok.BlockKind == BK_Block &&
-  !Tok.isOneOf(TT_ObjCBlockLBrace, TT_DictLiteral));
+  !Tok.isOneOf(TT_ObjCBlockLBrace, TT_DictLiteral));
 }
 
-static bool
-isAllmanBraceIncludedBreakableLambda(const FormatToken ,
-FormatStyle::ShortLambdaStyle ShortLambdaOption) {
+static bool isAllmanBraceIncludedBreakableLambda(
+const FormatToken , FormatStyle::ShortLambdaStyle ShortLambdaOption) {
   if (!isAllmanLambdaBrace(Tok))
 return false;
 
@@ -3497,7 +3496,7 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine 
,
   if (Style.BraceWrapping.BeforeLambdaBody &&
   (isAllmanBraceIncludedBreakableLambda(Left, ShortLambdaOption) ||
isAllmanBraceIncludedBreakableLambda(Right, ShortLambdaOption))) {
-  return true;
+return true;
   }
 
   if (isAllmanBrace(Left) || isAllmanBrace(Right))

diff  --git a/clang/lib/Format/UnwrappedLineParser.cpp 
b/clang/lib/Format/UnwrappedLineParser.cpp
index c84c951fcaa8..fdae725d625b 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -1726,7 +1726,7 @@ bool UnwrappedLineParser::tryToParseBracedList() {
 bool UnwrappedLineParser::parseBracedList(bool 

[clang] 5c8c990 - make sure to not warn about unused macros from -D

2020-04-27 Thread Luboš Luňák via cfe-commits

Author: Luboš Luňák
Date: 2020-04-27T21:26:13+02:00
New Revision: 5c8c9905c2496a38a17f1b2a180601e790e45db9

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

LOG: make sure to not warn about unused macros from -D

If a PCH is used for compilation, SourceManager::isInMainFile()
returns true even for the "" predefines area. Using -D
only for the TU compilation may trigger -Wunused-macros for it.
It is admitedly a bit fishy to set a macro only for a TU and not
for the PCH, but this works fine if the PCH does not use the macro
(I couldn't find a statement on this for Clang, but GCC explicitly
allows this in the docs).

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

Added: 
clang/test/PCH/cli-macro.c

Modified: 
clang/lib/Lex/PPDirectives.cpp

Removed: 




diff  --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index d6b6f5695b6c..d8041aef08ac 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -2802,7 +2802,9 @@ void Preprocessor::HandleDefineDirective(
   // warn-because-unused-macro set. If it gets used it will be removed from 
set.
   if (getSourceManager().isInMainFile(MI->getDefinitionLoc()) &&
   !Diags->isIgnored(diag::pp_macro_not_used, MI->getDefinitionLoc()) &&
-  !MacroExpansionInDirectivesOverride) {
+  !MacroExpansionInDirectivesOverride &&
+  getSourceManager().getFileID(MI->getDefinitionLoc()) !=
+  getPredefinesFileID()) {
 MI->setIsWarnIfUnused(true);
 WarnUnusedMacroLocs.insert(MI->getDefinitionLoc());
   }

diff  --git a/clang/test/PCH/cli-macro.c b/clang/test/PCH/cli-macro.c
new file mode 100644
index ..bae8cc3ff0e7
--- /dev/null
+++ b/clang/test/PCH/cli-macro.c
@@ -0,0 +1,12 @@
+// Test this without pch.
+// RUN: %clang_cc1 -Wunused-macros -Dunused=1 -fsyntax-only -verify %s
+
+// Test with pch.
+// RUN: %clang_cc1 -Wunused-macros -emit-pch -o %t %s
+// RUN: %clang_cc1 -Wunused-macros -Dunused=1 -include-pch %t -fsyntax-only 
-verify %s
+
+// expected-no-diagnostics
+
+// -Dunused=1 is intentionally not set for the pch.
+// There still should be no unused warning for a macro from the command line.
+



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


[PATCH] D78909: [clang-format] NFC clang-format the clang-format sources

2020-04-27 Thread Francois JEAN via Phabricator via cfe-commits
Wawha accepted this revision.
Wawha added a comment.

Thank for the changes !


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78909



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


[PATCH] D72281: [Matrix] Add matrix type to Clang.

2020-04-27 Thread Florian Hahn via Phabricator via cfe-commits
fhahn updated this revision to Diff 260402.
fhahn added a comment.

Ping. Now that the draft specification is committed, I think it would be great 
if we could move on to review of the patches in detail.

I've split the implementation into a few distinct parts (initial type support, 
[][] operators, binary different binary operators, different builtins). The 
initial patch is the biggest, please let me know if there is anything left that 
could be sensibly split off.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72281

Files:
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeLoc.h
  clang/include/clang/AST/TypeProperties.td
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Basic/TypeNodes.td
  clang/include/clang/Driver/Options.td
  clang/include/clang/Sema/Sema.h
  clang/include/clang/Serialization/TypeBitCodes.def
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTStructuralEquivalence.cpp
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/ItaniumMangle.cpp
  clang/lib/AST/MicrosoftMangle.cpp
  clang/lib/AST/Type.cpp
  clang/lib/AST/TypePrinter.cpp
  clang/lib/Basic/Targets/OSTargets.cpp
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenTypes.cpp
  clang/lib/CodeGen/ItaniumCXXABI.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaLookup.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/CodeGen/matrix-type.c
  clang/test/CodeGenCXX/matrix-type.cpp
  clang/test/SemaCXX/matrix-type.cpp
  clang/tools/libclang/CIndex.cpp

Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -1787,6 +1787,8 @@
 DEFAULT_TYPELOC_IMPL(DependentSizedExtVector, Type)
 DEFAULT_TYPELOC_IMPL(Vector, Type)
 DEFAULT_TYPELOC_IMPL(ExtVector, VectorType)
+DEFAULT_TYPELOC_IMPL(Matrix, Type)
+DEFAULT_TYPELOC_IMPL(DependentSizedMatrix, Type)
 DEFAULT_TYPELOC_IMPL(FunctionProto, FunctionType)
 DEFAULT_TYPELOC_IMPL(FunctionNoProto, FunctionType)
 DEFAULT_TYPELOC_IMPL(Record, TagType)
Index: clang/test/SemaCXX/matrix-type.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/matrix-type.cpp
@@ -0,0 +1,61 @@
+// RUN: %clang_cc1 -fsyntax-only -pedantic -fenable-matrix -std=c++11 -verify -triple x86_64-apple-darwin %s
+
+using matrix_double_t = double __attribute__((matrix_type(6, 6)));
+using matrix_float_t = float __attribute__((matrix_type(6, 6)));
+using matrix_int_t = int __attribute__((matrix_type(6, 6)));
+
+void matrix_var_dimensions(int Rows, unsigned Columns, char C) {
+  using matrix1_t = int __attribute__((matrix_type(Rows, 1)));// expected-error{{matrix_type attribute requires an integer constant}}
+  using matrix2_t = int __attribute__((matrix_type(1, Columns))); // expected-error{{matrix_type attribute requires an integer constant}}
+  using matrix3_t = int __attribute__((matrix_type(C, C)));   // expected-error{{matrix_type attribute requires an integer constant}}
+  using matrix4_t = int __attribute__((matrix_type(-1, 1)));  // expected-error{{matrix row size too large}}
+  using matrix5_t = int __attribute__((matrix_type(1, -1)));  // expected-error{{matrix column size too large}}
+  using matrix6_t = int __attribute__((matrix_type(0, 1)));   // expected-error{{zero matrix size}}
+  using matrix7_t = int __attribute__((matrix_type(1, 0)));   // expected-error{{zero matrix size}}
+  using matrix7_t = int __attribute__((matrix_type(char, 0)));// expected-error{{expected '(' for function-style cast or type construction}}
+  using matrix8_t = int __attribute__((matrix_type(1048576, 1))); // expected-error{{matrix row size too large}}
+}
+
+struct S1 {};
+
+enum TestEnum {
+  A,
+  B
+};
+
+void matrix_unsupported_element_type() {
+  using matrix1_t = char *__attribute__((matrix_type(1, 1)));// expected-error{{invalid matrix element type 'char *'}}
+  using matrix2_t = S1 __attribute__((matrix_type(1, 1)));   // expected-error{{invalid matrix element type 'S1'}}
+  using matrix3_t = bool __attribute__((matrix_type(1, 1))); // expected-error{{invalid matrix element type 'bool'}}
+  using matrix4_t = TestEnum __attribute__((matrix_type(1, 1))); // expected-error{{invalid matrix element type 'TestEnum'}}
+}
+
+template  // expected-note{{declared 

[PATCH] D78827: Add support for #pragma clang fp allow_reassociation(on|off) -- floating point control of associative math transformations

2020-04-27 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: clang/include/clang/Basic/DiagnosticParseKinds.td:1336
+  "%select{invalid|missing}0 option%select{ %1|}0; expected contract or 
reassoc">;
+def err_pragma_fp_contract_invalid_argument : Error<
+  "unexpected argument '%0' to '#pragma clang fp contract'; "

I think we'd want this combined with the one below.  You can use a %select to 
enable/disable 'fast'.  Something like:

"unexpected argument '%0' to '#pragma clang fp %select{contract|OTHERS}1; 
expected 'on'%select{, 'fast'|}1 or off"


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78827



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


[PATCH] D78938: Fixing all comparisons for C++20 compilation.

2020-04-27 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: clang/lib/Parse/ParseOpenMP.cpp:64-67
+return Value == unsigned(V);
+  }
+  bool operator!=(OpenMPDirectiveKindExWrapper V) const {
+return Value != unsigned(V);

Comparing against `V.Value` here would seem more idiomatic than invoking 
`operator unsigned`.



Comment at: clang/lib/Parse/ParseOpenMP.cpp:69-70
+  }
   bool operator==(OpenMPDirectiveKind V) const { return Value == unsigned(V); }
   bool operator!=(OpenMPDirectiveKind V) const { return Value != unsigned(V); }
   bool operator<(OpenMPDirectiveKind V) const { return Value < unsigned(V); }

Do we still need these?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78938



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


[PATCH] D78939: Strip -showIncludes in getClangStripDependencyFileAdjuster()

2020-04-27 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdab1326a5ae3: Strip -showIncludes in 
getClangStripDependencyFileAdjuster() (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78939

Files:
  clang/lib/Tooling/ArgumentsAdjusters.cpp
  clang/unittests/Tooling/ToolingTest.cpp


Index: clang/unittests/Tooling/ToolingTest.cpp
===
--- clang/unittests/Tooling/ToolingTest.cpp
+++ clang/unittests/Tooling/ToolingTest.cpp
@@ -530,9 +530,11 @@
   EXPECT_TRUE(HasFlag("-w"));
 }
 
-// Check getClangStripDependencyFileAdjuster strips /showIncludes
+// Check getClangStripDependencyFileAdjuster strips /showIncludes and variants
 TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludes) {
-  FixedCompilationDatabase Compilations("/", {"/showIncludes", "-c"});
+  FixedCompilationDatabase Compilations(
+  "/", {"/showIncludes", "/showIncludes:user", "-showIncludes",
+"-showIncludes:user", "-c"});
 
   ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
   Tool.mapVirtualFile("/a.cc", "void a() {}");
@@ -555,34 +557,9 @@
 return llvm::find(FinalArgs, Flag) != FinalArgs.end();
   };
   EXPECT_FALSE(HasFlag("/showIncludes"));
-  EXPECT_TRUE(HasFlag("-c"));
-}
-
-// Check getClangStripDependencyFileAdjuster strips /showIncludes:user
-TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludesUser) {
-  FixedCompilationDatabase Compilations("/", {"/showIncludes:user", "-c"});
-
-  ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
-  Tool.mapVirtualFile("/a.cc", "void a() {}");
-
-  std::unique_ptr Action(
-  newFrontendActionFactory());
-
-  CommandLineArguments FinalArgs;
-  ArgumentsAdjuster CheckFlagsAdjuster =
-  [](const CommandLineArguments , StringRef /*unused*/) {
-FinalArgs = Args;
-return Args;
-  };
-  Tool.clearArgumentsAdjusters();
-  Tool.appendArgumentsAdjuster(getClangStripDependencyFileAdjuster());
-  Tool.appendArgumentsAdjuster(CheckFlagsAdjuster);
-  Tool.run(Action.get());
-
-  auto HasFlag = [](const std::string ) {
-return llvm::find(FinalArgs, Flag) != FinalArgs.end();
-  };
   EXPECT_FALSE(HasFlag("/showIncludes:user"));
+  EXPECT_FALSE(HasFlag("-showIncludes"));
+  EXPECT_FALSE(HasFlag("-showIncludes:user"));
   EXPECT_TRUE(HasFlag("-c"));
 }
 
Index: clang/lib/Tooling/ArgumentsAdjusters.cpp
===
--- clang/lib/Tooling/ArgumentsAdjusters.cpp
+++ clang/lib/Tooling/ArgumentsAdjusters.cpp
@@ -98,7 +98,8 @@
   StringRef Arg = Args[i];
   // All dependency-file options begin with -M. These include -MM,
   // -MF, -MG, -MP, -MT, -MQ, -MD, and -MMD.
-  if (!Arg.startswith("-M") && !Arg.startswith("/showIncludes")) {
+  if (!Arg.startswith("-M") && !Arg.startswith("/showIncludes") &&
+  !Arg.startswith("-showIncludes")) {
 AdjustedArgs.push_back(Args[i]);
 continue;
   }


Index: clang/unittests/Tooling/ToolingTest.cpp
===
--- clang/unittests/Tooling/ToolingTest.cpp
+++ clang/unittests/Tooling/ToolingTest.cpp
@@ -530,9 +530,11 @@
   EXPECT_TRUE(HasFlag("-w"));
 }
 
-// Check getClangStripDependencyFileAdjuster strips /showIncludes
+// Check getClangStripDependencyFileAdjuster strips /showIncludes and variants
 TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludes) {
-  FixedCompilationDatabase Compilations("/", {"/showIncludes", "-c"});
+  FixedCompilationDatabase Compilations(
+  "/", {"/showIncludes", "/showIncludes:user", "-showIncludes",
+"-showIncludes:user", "-c"});
 
   ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
   Tool.mapVirtualFile("/a.cc", "void a() {}");
@@ -555,34 +557,9 @@
 return llvm::find(FinalArgs, Flag) != FinalArgs.end();
   };
   EXPECT_FALSE(HasFlag("/showIncludes"));
-  EXPECT_TRUE(HasFlag("-c"));
-}
-
-// Check getClangStripDependencyFileAdjuster strips /showIncludes:user
-TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludesUser) {
-  FixedCompilationDatabase Compilations("/", {"/showIncludes:user", "-c"});
-
-  ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
-  Tool.mapVirtualFile("/a.cc", "void a() {}");
-
-  std::unique_ptr Action(
-  newFrontendActionFactory());
-
-  CommandLineArguments FinalArgs;
-  ArgumentsAdjuster CheckFlagsAdjuster =
-  [](const CommandLineArguments , StringRef /*unused*/) {
-FinalArgs = Args;
-return Args;
-  };
-  Tool.clearArgumentsAdjusters();
-  Tool.appendArgumentsAdjuster(getClangStripDependencyFileAdjuster());
-  Tool.appendArgumentsAdjuster(CheckFlagsAdjuster);
-  Tool.run(Action.get());
-
-  auto HasFlag = [](const std::string ) {
-return llvm::find(FinalArgs, Flag) != FinalArgs.end();
-  };
   

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

2020-04-27 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 260387.
baloghadamsoftware added a comment.

I implemented the basic `isLive()` and `getBinding()` functions which reduced 
the number of failing tests by `0`. I also implemented dynamic calculation of 
the type which increased the number of failing tests by `4`. The reason is 
probably that when `ParamRegion` is created in `Expr::VisitCommonDeclRefExpr()` 
we cannot retrieve information whether the call is a C++ member operator call. 
If it is, we should shift the index by `1`. Using the wrong index and thus 
returning the wrong type causes failing tests and crashes (assertions).


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

https://reviews.llvm.org/D77229

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

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

[PATCH] D78944: [libc++][test] Disable test for extension that's unsupportable in C++20

2020-04-27 Thread Casey Carter via Phabricator via cfe-commits
CaseyCarter updated this revision to Diff 260391.
CaseyCarter added a comment.

Review comments.


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

https://reviews.llvm.org/D78944

Files:
  libcxx/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
  
libcxx/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp


Index: 
libcxx/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp
===
--- 
libcxx/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp
+++ 
libcxx/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp
@@ -21,12 +21,11 @@
 std::multimap m;
 std::multimap::iterator i;
 std::multimap::const_iterator ci;
+#if TEST_STD_VER <= 17
+// These reverse_iterator specializations require X to be complete in 
C++20.
 std::multimap::reverse_iterator ri;
 std::multimap::const_reverse_iterator cri;
+#endif // TEST_STD_VER <= 17
 };
 
-int main(int, char**)
-{
-
-  return 0;
-}
+int main(int, char**) { return 0; }
Index: 
libcxx/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
===
--- 
libcxx/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
+++ 
libcxx/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
@@ -21,12 +21,11 @@
 std::map m;
 std::map::iterator i;
 std::map::const_iterator ci;
+#if TEST_STD_VER <= 17
+// These reverse_iterator specializations require X to be complete in 
C++20.
 std::map::reverse_iterator ri;
 std::map::const_reverse_iterator cri;
+#endif // TEST_STD_VER <= 17
 };
 
-int main(int, char**)
-{
-
-  return 0;
-}
+int main(int, char**) { return 0; }


Index: libcxx/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp
===
--- libcxx/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp
+++ libcxx/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp
@@ -21,12 +21,11 @@
 std::multimap m;
 std::multimap::iterator i;
 std::multimap::const_iterator ci;
+#if TEST_STD_VER <= 17
+// These reverse_iterator specializations require X to be complete in C++20.
 std::multimap::reverse_iterator ri;
 std::multimap::const_reverse_iterator cri;
+#endif // TEST_STD_VER <= 17
 };
 
-int main(int, char**)
-{
-
-  return 0;
-}
+int main(int, char**) { return 0; }
Index: libcxx/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
===
--- libcxx/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
+++ libcxx/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
@@ -21,12 +21,11 @@
 std::map m;
 std::map::iterator i;
 std::map::const_iterator ci;
+#if TEST_STD_VER <= 17
+// These reverse_iterator specializations require X to be complete in C++20.
 std::map::reverse_iterator ri;
 std::map::const_reverse_iterator cri;
+#endif // TEST_STD_VER <= 17
 };
 
-int main(int, char**)
-{
-
-  return 0;
-}
+int main(int, char**) { return 0; }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78760: Check a class has a definition before iterating over its base classes

2020-04-27 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

`TagDecl::isDependentType()` is returning true.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78760



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


[clang] dab1326 - Strip -showIncludes in getClangStripDependencyFileAdjuster()

2020-04-27 Thread Arthur Eubanks via cfe-commits

Author: Arthur Eubanks
Date: 2020-04-27T11:20:08-07:00
New Revision: dab1326a5ae32ffd2dc277027e1ae68d8b5124d5

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

LOG: Strip -showIncludes in getClangStripDependencyFileAdjuster()

Summary:
Follow-up to https://reviews.llvm.org/D78836.

Also consolidate some test cases.

Reviewers: thakis

Subscribers: cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/lib/Tooling/ArgumentsAdjusters.cpp
clang/unittests/Tooling/ToolingTest.cpp

Removed: 




diff  --git a/clang/lib/Tooling/ArgumentsAdjusters.cpp 
b/clang/lib/Tooling/ArgumentsAdjusters.cpp
index d8cd11efedd2..a857b57fbf7b 100644
--- a/clang/lib/Tooling/ArgumentsAdjusters.cpp
+++ b/clang/lib/Tooling/ArgumentsAdjusters.cpp
@@ -98,7 +98,8 @@ ArgumentsAdjuster getClangStripDependencyFileAdjuster() {
   StringRef Arg = Args[i];
   // All dependency-file options begin with -M. These include -MM,
   // -MF, -MG, -MP, -MT, -MQ, -MD, and -MMD.
-  if (!Arg.startswith("-M") && !Arg.startswith("/showIncludes")) {
+  if (!Arg.startswith("-M") && !Arg.startswith("/showIncludes") &&
+  !Arg.startswith("-showIncludes")) {
 AdjustedArgs.push_back(Args[i]);
 continue;
   }

diff  --git a/clang/unittests/Tooling/ToolingTest.cpp 
b/clang/unittests/Tooling/ToolingTest.cpp
index 782b3f6a2b44..5bd2864b5ba1 100644
--- a/clang/unittests/Tooling/ToolingTest.cpp
+++ b/clang/unittests/Tooling/ToolingTest.cpp
@@ -530,9 +530,11 @@ TEST(ClangToolTest, StripDependencyFileAdjuster) {
   EXPECT_TRUE(HasFlag("-w"));
 }
 
-// Check getClangStripDependencyFileAdjuster strips /showIncludes
+// Check getClangStripDependencyFileAdjuster strips /showIncludes and variants
 TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludes) {
-  FixedCompilationDatabase Compilations("/", {"/showIncludes", "-c"});
+  FixedCompilationDatabase Compilations(
+  "/", {"/showIncludes", "/showIncludes:user", "-showIncludes",
+"-showIncludes:user", "-c"});
 
   ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
   Tool.mapVirtualFile("/a.cc", "void a() {}");
@@ -555,34 +557,9 @@ TEST(ClangToolTest, 
StripDependencyFileAdjusterShowIncludes) {
 return llvm::find(FinalArgs, Flag) != FinalArgs.end();
   };
   EXPECT_FALSE(HasFlag("/showIncludes"));
-  EXPECT_TRUE(HasFlag("-c"));
-}
-
-// Check getClangStripDependencyFileAdjuster strips /showIncludes:user
-TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludesUser) {
-  FixedCompilationDatabase Compilations("/", {"/showIncludes:user", "-c"});
-
-  ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
-  Tool.mapVirtualFile("/a.cc", "void a() {}");
-
-  std::unique_ptr Action(
-  newFrontendActionFactory());
-
-  CommandLineArguments FinalArgs;
-  ArgumentsAdjuster CheckFlagsAdjuster =
-  [](const CommandLineArguments , StringRef /*unused*/) {
-FinalArgs = Args;
-return Args;
-  };
-  Tool.clearArgumentsAdjusters();
-  Tool.appendArgumentsAdjuster(getClangStripDependencyFileAdjuster());
-  Tool.appendArgumentsAdjuster(CheckFlagsAdjuster);
-  Tool.run(Action.get());
-
-  auto HasFlag = [](const std::string ) {
-return llvm::find(FinalArgs, Flag) != FinalArgs.end();
-  };
   EXPECT_FALSE(HasFlag("/showIncludes:user"));
+  EXPECT_FALSE(HasFlag("-showIncludes"));
+  EXPECT_FALSE(HasFlag("-showIncludes:user"));
   EXPECT_TRUE(HasFlag("-c"));
 }
 



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


[PATCH] D78755: [SveEmitter] Add builtins for svlen

2020-04-27 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/D78755/new/

https://reviews.llvm.org/D78755



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


[PATCH] D78903: [Driver] Add option -fproc-stat-report

2020-04-27 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea added inline comments.



Comment at: clang/docs/UsersManual.rst:770
+   $ cat abc
+   clang-11,"/tmp/foo-123456.o",92000,84000,87536
+   ld,"a.out",900,8000,53568

Please add a header to the output .CSV, specifying the units of measure where 
relevant.



Comment at: clang/docs/UsersManual.rst:786
+
+  $ clang -fproc-stat-report=- foo.c  
+  clang-11: output=/tmp/foo-123456.o, total=84000, user=76000, mem=87496

Why not just `-fproc-stat-report` in this case?



Comment at: clang/docs/UsersManual.rst:787
+  $ clang -fproc-stat-report=- foo.c  
+  clang-11: output=/tmp/foo-123456.o, total=84000, user=76000, mem=87496
+  ld: output=a.out, total=8000, user=8000, mem=53548

I think it is better if the units are specified along (and locale-formatted, if 
possible):
```
clang-11: output=/tmp/foo-123456.o  total=84,000 ms  user=76,000 ms  mem=87,496 
kb
```



Comment at: clang/include/clang/Driver/Job.h:78
+  /// Information on executable run provided by OS.
+  mutable llvm::sys::ProcessStatistics ProcStat;
+

`mutable Optional ProcStat;` and then you won't 
need `.isSet()`.



Comment at: clang/lib/Driver/Driver.cpp:3770
 
+  if (!StatReportFile.empty())
+C.setPostCallback([=](const Command , int Res) {

There is a large piece of code in the `if` statement, I would add curly 
brackets:
`if (!StatReportFile.empty()) { ... }`



Comment at: clang/lib/Driver/Driver.cpp:3772
+C.setPostCallback([=](const Command , int Res) {
+  const llvm::sys::ProcessStatistics  = 
Cmd.getProcessStatistics();
+  if (ProcStat.isSet()) {

Use `Optional<>` like state above, then the condition changes to:
`if (ProcStat)`

and then usage below becomes:
`<< ", total=" << ProcStat->TotalTime.count()`



Comment at: clang/lib/Driver/Driver.cpp:3774
+  if (ProcStat.isSet()) {
+if (StatReportFile.equals("-")) {
+  // Human readable output.

`if (StatReportFile.equals("-") || StatReportFile.empty()) {`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78903



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


[PATCH] D78534: [libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON

2020-04-27 Thread Petr Hosek via Phabricator via cfe-commits
phosek accepted this revision.
phosek 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/D78534/new/

https://reviews.llvm.org/D78534



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


[PATCH] D78915: [clang-format] Improved parser for C# properties

2020-04-27 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added inline comments.



Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1508
   bool HasGetOrSet = false;
+  bool IsTrivialPropertyAccessor = true;
   while (!eof()) {

Add a comment illustrating is what is a trivial property accessor.


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

https://reviews.llvm.org/D78915



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


[PATCH] D78915: [clang-format] Improved parser for C# properties

2020-04-27 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

I think if this code is only used by C# which the first if suggests,  we should 
be OK, just tidy up a bit with the old code and I think this is fine.

Thank you, so great to have other C#'ers doing this ;-)  "Clang format all the 
things..."




Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1513
  Keywords.kw_set)) {
-  if (Tok->isOneOf(Keywords.kw_get, Keywords.kw_set))
+  if (Tok->isOneOf(Keywords.kw_get, Keywords.kw_set)) {
 HasGetOrSet = true;

 the style in LLVM is to not have braces on single line if statements. (not my 
style but we need to keep to it)



Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1563
+  //  --Line->Level;
+  nextToken();
+  break;

you need to remove old code


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

https://reviews.llvm.org/D78915



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


  1   2   3   >