Re: [PATCH] D17983: Eliminate many benign instances of "potentially uninitialized local variable" warnings

2016-03-09 Thread Alexander Riccio via cfe-commits
ariccio updated this revision to Diff 50241.
ariccio added a comment.

For some reason, this smaller diff was harder to upload than the first diff.


http://reviews.llvm.org/D17983

Files:
  llvm/lib/Analysis/DependenceAnalysis.cpp
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/CodeGen/AtomicExpandPass.cpp
  llvm/lib/CodeGen/LiveInterval.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/MC/MCAsmStreamer.cpp
  llvm/lib/MC/MachObjectWriter.cpp
  llvm/lib/Support/Windows/Path.inc
  llvm/lib/Support/YAMLParser.cpp
  llvm/lib/Target/AArch64/AArch64AdvSIMDScalarPass.cpp
  llvm/lib/Target/AArch64/AArch64FastISel.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
  llvm/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp
  llvm/lib/Target/AMDGPU/R600InstrInfo.cpp
  llvm/lib/Target/ARM/ARMFastISel.cpp
  llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
  llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
  llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCShuffler.cpp
  llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
  llvm/lib/Target/Mips/MipsAsmPrinter.cpp
  llvm/lib/Target/TargetRecip.cpp
  llvm/lib/Target/X86/X86FastISel.cpp
  llvm/lib/Target/X86/X86FixupLEAs.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86InstrInfo.cpp
  llvm/lib/Target/X86/X86WinEHState.cpp
  llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
  llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
  llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/lib/Transforms/Utils/MemorySSA.cpp
  llvm/tools/clang/include/clang/Sema/Lookup.h
  llvm/tools/clang/lib/AST/ExprConstant.cpp
  llvm/tools/clang/lib/AST/MicrosoftMangle.cpp
  llvm/tools/clang/lib/CodeGen/CGCleanup.h
  llvm/tools/clang/lib/CodeGen/CGExprScalar.cpp
  llvm/tools/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp
  llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp
  llvm/tools/clang/lib/CodeGen/TargetInfo.cpp
  llvm/tools/clang/lib/Driver/ToolChain.cpp
  llvm/tools/clang/lib/Lex/Preprocessor.cpp
  llvm/tools/clang/lib/Parse/ParseObjc.cpp
  llvm/tools/clang/lib/Sema/SemaDecl.cpp
  llvm/tools/clang/lib/Sema/SemaDeclAttr.cpp
  llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp
  llvm/tools/clang/lib/Sema/SemaInit.cpp
  llvm/tools/clang/lib/Sema/SemaLambda.cpp
  llvm/tools/clang/lib/Sema/SemaLookup.cpp
  llvm/tools/clang/lib/Sema/SemaStmtAttr.cpp
  llvm/tools/clang/lib/Serialization/ASTReader.cpp
  llvm/tools/clang/lib/Serialization/ASTReaderStmt.cpp
  llvm/tools/clang/lib/StaticAnalyzer/Checkers/ObjCContainersASTChecker.cpp
  llvm/tools/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
  llvm/tools/clang/lib/StaticAnalyzer/Core/SymbolManager.cpp

Index: llvm/lib/MC/MCAsmStreamer.cpp
===
--- llvm/lib/MC/MCAsmStreamer.cpp
+++ llvm/lib/MC/MCAsmStreamer.cpp
@@ -990,7 +990,7 @@
   if (PrologueEnd)
 OS << " prologue_end";
 
-  unsigned OldIsStmt = getContext().getCurrentCVLoc().isStmt();
+  bool OldIsStmt = getContext().getCurrentCVLoc().isStmt();
   if (IsStmt != OldIsStmt) {
 OS << " is_stmt ";
 
Index: llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
===
--- llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -2712,7 +2712,10 @@
   unsigned ZeroSrcOpcode, ZeroTrgOpcode;
   bool ReverseOrderSLT, IsUnsigned, IsLikely, AcceptsEquality;
 
-  unsigned TrgReg;
+  // TrgReg should never normally be assigned NUM_TARGET_REGS.
+  // If you end up with NUM_TARGET_REGS, you have a bug.
+  // FIXME: is there a better way to ensure TrgReg is assigned something?
+  unsigned TrgReg = Mips::NUM_TARGET_REGS;
   if (TrgOp.isReg())
 TrgReg = TrgOp.getReg();
   else if (TrgOp.isImm()) {
Index: llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCShuffler.cpp
===
--- llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCShuffler.cpp
+++ llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCShuffler.cpp
@@ -170,7 +170,7 @@
   }
 
   bool doneShuffling = false;
-  unsigned shuffleError;
+  unsigned shuffleError = HexagonShuffler::SHUFFLE_ERROR_UNKNOWN;
   while (possibleDuplexes.size() > 0 && (!doneShuffling)) {
 // case of Duplex Found
 DuplexCandidate duplexToTry = possibleDuplexes.pop_back_val();
Index: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
===
--- llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -930,7 +930,7 @@
   if (LHSCC == ICmpInst::ICMP_EQ && LHSCC == RHSCC &&
   LHS->hasOneUse() && RHS->hasOneUse()) {
 Value *V;
-ConstantInt 

Re: [PATCH] D5896: Emit minnum / maxnum for __builtin_fmin/fmax

2016-03-09 Thread Matt Arsenault via cfe-commits
arsenm added a comment.

ping since there seems to be a consensus now that intrinsics should be preferred


http://reviews.llvm.org/D5896



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


Re: [PATCH] D4507: R600: Define device name macros.

2016-03-09 Thread Matt Arsenault via cfe-commits
arsenm abandoned this revision.
arsenm added a comment.

Going to redo this with simplified names


http://reviews.llvm.org/D4507



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


r263093 - ARM: fix arm_neon_intrinsics.c and re-enable.

2016-03-09 Thread Tim Northover via cfe-commits
Author: tnorthover
Date: Wed Mar  9 22:39:45 2016
New Revision: 263093

URL: http://llvm.org/viewvc/llvm-project?rev=263093=rev
Log:
ARM: fix arm_neon_intrinsics.c and re-enable.

It turns out I'd never actually tested my recent change because it was
gated on long-tests. Failure ensued.

Modified:
cfe/trunk/test/CodeGen/arm_neon_intrinsics.c

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


Re: [PATCH] D17877: [OpenMP] Base support for target directive codegen on NVPTX device.

2016-03-09 Thread Alexey Bataev via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


http://reviews.llvm.org/D17877



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


r263091 - Disable failing test and fix RUN line.

2016-03-09 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Wed Mar  9 22:04:12 2016
New Revision: 263091

URL: http://llvm.org/viewvc/llvm-project?rev=263091=rev
Log:
Disable failing test and fix RUN line.

See https://llvm.org/bugs/show_bug.cgi?id=26894 for details.  This change
fixes the incorrect flags to Clang and the piping issue.  It also disables
the FileCheck portion of the test, which is currently failing.

Modified:
cfe/trunk/test/CodeGen/arm_neon_intrinsics.c

Modified: cfe/trunk/test/CodeGen/arm_neon_intrinsics.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm_neon_intrinsics.c?rev=263091=263090=263091=diff
==
--- cfe/trunk/test/CodeGen/arm_neon_intrinsics.c (original)
+++ cfe/trunk/test/CodeGen/arm_neon_intrinsics.c Wed Mar  9 22:04:12 2016
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple thumbv7s-apple-darwin -target-abi apcs-gnu\
-// RUN:  -target-cpu swift -ffreestanding -emit-llvm -S -o - %s\
-// RUN:  opt -S -mem2reg | FileCheck %s
+// RUN:  -target-cpu swift -ffreestanding -emit-llvm -o - %s\
+// RUN:  | opt -S -mem2reg > /dev/null
+// RxUN:  | FileCheck %s
 
 // REQUIRES: long_tests
 


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


Re: [PATCH] D17412: PR19957: [OpenCL] incorrectly accepts implicit address space conversion with ternary operator

2016-03-09 Thread Xiuli PAN via cfe-commits
pxli168 added a comment.

The logic is still to complex and I hope it can be optimized.



Comment at: lib/Sema/SemaExpr.cpp:6222-6227
@@ -6188,1 +6221,8 @@
+auto ResultAddrSpace = ResultTy.getQualifiers().getAddressSpace();
+LHSCastKind = lhQual.getAddressSpace() == ResultAddrSpace
+  ? CK_BitCast
+  : CK_AddressSpaceConversion;
+RHSCastKind = rhQual.getAddressSpace() == ResultAddrSpace
+  ? CK_BitCast
+  : CK_AddressSpaceConversion;
 ResultTy = S.Context.getPointerType(ResultTy);

What will mergetypes return?
It seems the LHS and RHS are compatibel here, and may be they did not need 
bitcast?


Repository:
  rL LLVM

http://reviews.llvm.org/D17412



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


Re: [PATCH] D17877: [OpenMP] Base support for target directive codegen on NVPTX device.

2016-03-09 Thread Arpith Jacob via cfe-commits
arpith-jacob marked an inline comment as done.


Comment at: lib/CodeGen/CGOpenMPRuntime.h:69
@@ +68,3 @@
+  /// evaluates to false.
+  virtual void emitTargetOutlinedFunctionHelper(const OMPExecutableDirective 
,
+StringRef ParentName,

ABataev wrote:
> arpith-jacob wrote:
> > Do we need 'virtual'?  This function needs to be called by the NVPTX 
> > implementation (in emitTargetOutlinedFunction) but doesn't need to be 
> > overridden.
> I we don't need it in 'CGOpenMPRuntime', then why it is here?
Alexey, both CGOpenMPRuntime and CGOpenMPRuntimeNVPTX call 
emitTargetOutlinedFunctionHelper().

CGOpenMPRuntime::emitTargetOutlinedFunction() sets up the 'codegen' lambda and 
then calls CGOpenMPRuntime::emitTargetOutlinedFunctionHelper() to do the work.

In the same way, CGOpenMPRuntimeNVPTX::emitTargetOutlinedFunction() sets up the 
'codegen' lambda for the GPU and then calls 
CGOpenMPRuntime::emitTargetOutlinedFunctionHelper().

Does that make sense?


http://reviews.llvm.org/D17877



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


Re: [PATCH] D17963: [OPENMP] Codegen for teams directive for NVPTX

2016-03-09 Thread Carlo Bertolli via cfe-commits
carlo.bertolli added a comment.

Support for global variables in a target region requires the global to be 
placed in a pragma declare target region. Pragma declare target region is not 
currently available in Clang (no parsing, sema, or codegen). I will add a check 
for this in the regression test once the support becomes available. Thanks!


Repository:
  rL LLVM

http://reviews.llvm.org/D17963



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


Re: [PATCH] D17877: [OpenMP] Base support for target directive codegen on NVPTX device.

2016-03-09 Thread Alexey Bataev via cfe-commits
ABataev added inline comments.


Comment at: lib/CodeGen/CGOpenMPRuntime.h:69
@@ +68,3 @@
+  /// evaluates to false.
+  virtual void emitTargetOutlinedFunctionHelper(const OMPExecutableDirective 
,
+StringRef ParentName,

arpith-jacob wrote:
> Do we need 'virtual'?  This function needs to be called by the NVPTX 
> implementation (in emitTargetOutlinedFunction) but doesn't need to be 
> overridden.
I we don't need it in 'CGOpenMPRuntime', then why it is here?


http://reviews.llvm.org/D17877



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


Re: [PATCH] D17976: Add attributes for preserve_mostcc/preserve_allcc calling conventions to the C/C++ front-end

2016-03-09 Thread Roman Levenstein via cfe-commits
I resubmitted the patch as http://reviews.llvm.org/D18025 
 and included the mailing list as a subscriber, 
so that the replies are not getting lost.
Sorry for the inconvenience.

-Roman

> On Mar 8, 2016, at 5:44 PM, Roman Levenstein via cfe-commits 
>  wrote:
> 
> Forgot to add the mailing list when I created a patch.
> 
>> Begin forwarded message:
>> 
>> From: Roman Levenstein >
>> Subject: [PATCH] D17976: Add attributes for preserve_mostcc/preserve_allcc 
>> calling conventions to the C/C++ front-end
>> Date: March 8, 2016 at 5:17:02 PM PST
>> To: rlevenst...@apple.com , juer...@apple.com 
>> 
>> Cc: amara.emer...@arm.com 
>> Reply-To: reviews+d17976+public+93264263cdbda...@reviews.llvm.org 
>> 
>> 
>> swiftix created this revision.
>> swiftix added a reviewer: ributzka.
>> Herald added a subscriber: aemerson.
>> 
>> Till now, preserve_mostcc/preserve_allcc calling convention attributes were 
>> only available at the LLVM IR level. This patch adds attributes for 
>> preserve_mostcc/preserve_allcc calling conventions to the C/C++ front-end.
>> 
>> The code was mostly written by Juergen Ributzka. I just added support for 
>> the AArch64 target.
>> 
>> http://reviews.llvm.org/D17976 
>> 
>> Files:
>>  include/clang-c/Index.h
>>  include/clang/AST/Type.h
>>  include/clang/Basic/Attr.td
>>  include/clang/Basic/Specifiers.h
>>  lib/AST/ItaniumMangle.cpp
>>  lib/AST/Type.cpp
>>  lib/AST/TypePrinter.cpp
>>  lib/Basic/Targets.cpp
>>  lib/CodeGen/CGCall.cpp
>>  lib/Sema/SemaDeclAttr.cpp
>>  lib/Sema/SemaType.cpp
>>  test/CodeGen/preserve_all.c
>>  test/CodeGen/preserve_most.c
>>  tools/libclang/CXType.cpp
>> 
> 
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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


[PATCH] D18025: Add attributes for preserve_mostcc/preserve_allcc calling conventions to the C/C++ front-end

2016-03-09 Thread Roman Levenstein via cfe-commits
swiftix created this revision.
swiftix added reviewers: ributzka, aaron.ballman.
swiftix added a subscriber: cfe-commits.
Herald added a subscriber: aemerson.

Till now, preserve_mostcc/preserve_allcc calling convention attributes were 
only available at the LLVM IR level. This patch adds attributes for 
preserve_mostcc/preserve_allcc calling conventions to the C/C++ front-end.

The code was mostly written by Juergen Ributzka. I just added support for the 
AArch64 target and tests.

http://reviews.llvm.org/D18025

Files:
  include/clang-c/Index.h
  include/clang/AST/Type.h
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/Specifiers.h
  lib/AST/ItaniumMangle.cpp
  lib/AST/Type.cpp
  lib/AST/TypePrinter.cpp
  lib/Basic/Targets.cpp
  lib/CodeGen/CGCall.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaType.cpp
  test/CodeGen/preserve_all.c
  test/CodeGen/preserve_most.c
  test/Sema/preserve_all-call-conv.c
  test/Sema/preserve_most-call-conv.c
  tools/libclang/CXType.cpp

Index: tools/libclang/CXType.cpp
===
--- tools/libclang/CXType.cpp
+++ tools/libclang/CXType.cpp
@@ -534,6 +534,8 @@
   TCALLINGCONV(AAPCS_VFP);
   TCALLINGCONV(IntelOclBicc);
   TCALLINGCONV(Swift);
+  TCALLINGCONV(PreserveMost);
+  TCALLINGCONV(PreserveAll);
 case CC_SpirFunction: return CXCallingConv_Unexposed;
 case CC_SpirKernel: return CXCallingConv_Unexposed;
   break;
Index: test/Sema/preserve_most-call-conv.c
===
--- test/Sema/preserve_most-call-conv.c
+++ test/Sema/preserve_most-call-conv.c
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 %s -fsyntax-only -triple x86_64-unknown-unknown -verify
+// RUN: %clang_cc1 %s -fsyntax-only -triple arm64-unknown-unknown -verify
+
+void __attribute__((preserve_most)) foo(void *ptr) {
+}
+
+void __attribute__((preserve_most(1))) baz(void *ptr) { // expected-error {{'preserve_most' attribute takes no arguments}}
+}
+
+void (__attribute__((preserve_most)) *pfoo1)(void *) = foo;
+
+void (__attribute__((cdecl)) *pfoo2)(void *) = foo; // expected-warning {{incompatible pointer types initializing 'void (*)(void *) __attribute__((cdecl))' with an expression of type 'void (void *) __attribute__((preserve_most))'}}
+void (*pfoo3)(void *) = foo; // expected-warning {{incompatible pointer types initializing 'void (*)(void *)' with an expression of type 'void (void *) __attribute__((preserve_most))'}}
+
+typedef void typedef_fun_t(int);
+typedef_fun_t typedef_fun; // expected-note {{previous declaration is here}}
+void __attribute__((preserve_most)) typedef_fun(int x) { } // expected-error {{function declared 'preserve_most' here was previously declared without calling convention}}
+
+struct type_test {} __attribute__((preserve_most));  // expected-warning {{'preserve_most' attribute only applies to functions and methods}}
Index: test/Sema/preserve_all-call-conv.c
===
--- test/Sema/preserve_all-call-conv.c
+++ test/Sema/preserve_all-call-conv.c
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 %s -fsyntax-only -triple x86_64-unknown-unknown -verify
+// RUN: %clang_cc1 %s -fsyntax-only -triple arm64-unknown-unknown -verify
+
+void __attribute__((preserve_all)) foo(void *ptr) {
+}
+
+void __attribute__((preserve_all(1))) baz(void *ptr) { // expected-error {{'preserve_all' attribute takes no arguments}}
+}
+
+void (__attribute__((preserve_all)) *pfoo1)(void *) = foo;
+
+void (__attribute__((cdecl)) *pfoo2)(void *) = foo; // expected-warning {{incompatible pointer types initializing 'void (*)(void *) __attribute__((cdecl))' with an expression of type 'void (void *) __attribute__((preserve_all))'}}
+void (*pfoo3)(void *) = foo; // expected-warning {{incompatible pointer types initializing 'void (*)(void *)' with an expression of type 'void (void *) __attribute__((preserve_all))'}}
+
+typedef void typedef_fun_t(int);
+typedef_fun_t typedef_fun; // expected-note {{previous declaration is here}}
+void __attribute__((preserve_all)) typedef_fun(int x) { } // expected-error {{function declared 'preserve_all' here was previously declared without calling convention}}
+
+struct type_test {} __attribute__((preserve_all));  // expected-warning {{'preserve_all' attribute only applies to functions and methods}}
Index: test/CodeGen/preserve_most.c
===
--- test/CodeGen/preserve_most.c
+++ test/CodeGen/preserve_most.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm < %s | FileCheck %s
+// RUN: %clang_cc1 -triple arm64-unknown-unknown -emit-llvm < %s | FileCheck %s
+
+// Check that the preserve_most calling convention attribute at the source level
+// is lowered to the corresponding calling convention attrribute at the LLVM IR
+// level.
+void foo() __attribute__((preserve_most)) {
+  // CHECK-LABEL: 

Re: [PATCH] D17963: [OPENMP] Codegen for teams directive for NVPTX

2016-03-09 Thread Alexey Bataev via cfe-commits
ABataev added a comment.

Add tests with captured globals to check that this problem is resolved


Repository:
  rL LLVM

http://reviews.llvm.org/D17963



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


[PATCH] D18024: Remove compile time PreserveName switch based on NDEBUG

2016-03-09 Thread Mehdi AMINI via cfe-commits
joker.eph created this revision.
joker.eph added a reviewer: chandlerc.
joker.eph added a subscriber: cfe-commits.

Following r263086, we are now relying on a flag on the Context to
discard Value names in release builds.

http://reviews.llvm.org/D18024

Files:
  lib/CodeGen/CGBuilder.h
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CodeGenAction.cpp
  lib/CodeGen/CodeGenFunction.cpp

Index: lib/CodeGen/CodeGenFunction.cpp
===
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -747,9 +747,7 @@
   // later.  Don't create this with the builder, because we don't want it
   // folded.
   llvm::Value *Undef = llvm::UndefValue::get(Int32Ty);
-  AllocaInsertPt = new llvm::BitCastInst(Undef, Int32Ty, "", EntryBB);
-  if (Builder.isNamePreserving())
-AllocaInsertPt->setName("allocapt");
+  AllocaInsertPt = new llvm::BitCastInst(Undef, Int32Ty, "allocapt", EntryBB);
 
   ReturnBlock = getJumpDestInCurrentScope("return");
 
@@ -1862,26 +1860,14 @@
 CGM.getSanitizerMetadata()->disableSanitizerForInstruction(I);
 }
 
-template 
-void CGBuilderInserter::InsertHelper(
+void CGBuilderInserter::InsertHelper(
 llvm::Instruction *I, const llvm::Twine , llvm::BasicBlock *BB,
 llvm::BasicBlock::iterator InsertPt) const {
-  llvm::IRBuilderDefaultInserter::InsertHelper(I, Name, BB,
-  InsertPt);
+  llvm::IRBuilderDefaultInserter::InsertHelper(I, Name, BB, InsertPt);
   if (CGF)
 CGF->InsertHelper(I, Name, BB, InsertPt);
 }
 
-#ifdef NDEBUG
-#define PreserveNames false
-#else
-#define PreserveNames true
-#endif
-template void CGBuilderInserter::InsertHelper(
-llvm::Instruction *I, const llvm::Twine , llvm::BasicBlock *BB,
-llvm::BasicBlock::iterator InsertPt) const;
-#undef PreserveNames
-
 static bool hasRequiredFeatures(const SmallVectorImpl ,
 CodeGenModule , const FunctionDecl *FD,
 std::string ) {
Index: lib/CodeGen/CodeGenAction.cpp
===
--- lib/CodeGen/CodeGenAction.cpp
+++ lib/CodeGen/CodeGenAction.cpp
@@ -656,7 +656,11 @@
 
 CodeGenAction::CodeGenAction(unsigned _Act, LLVMContext *_VMContext)
 : Act(_Act), VMContext(_VMContext ? _VMContext : new LLVMContext),
-  OwnsVMContext(!_VMContext) {}
+  OwnsVMContext(!_VMContext) {
+#ifdef NDEBUG
+  _VMContext.setDiscardValueNames(true);
+#endif
+}
 
 CodeGenAction::~CodeGenAction() {
   TheModule.reset();
Index: lib/CodeGen/CGExpr.cpp
===
--- lib/CodeGen/CGExpr.cpp
+++ lib/CodeGen/CGExpr.cpp
@@ -66,8 +66,6 @@
 /// block.
 llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(llvm::Type *Ty,
 const Twine ) {
-  if (!Builder.isNamePreserving())
-return new llvm::AllocaInst(Ty, nullptr, "", AllocaInsertPt);
   return new llvm::AllocaInst(Ty, nullptr, Name, AllocaInsertPt);
 }
 
Index: lib/CodeGen/CGCall.cpp
===
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -3605,7 +3605,7 @@
   }
 
   llvm::Instruction *CI = CS.getInstruction();
-  if (Builder.isNamePreserving() && !CI->getType()->isVoidTy())
+  if (!CI->getType()->isVoidTy())
 CI->setName("call");
 
   // Emit any writebacks immediately.  Arguably this should happen
Index: lib/CodeGen/CGBuilder.h
===
--- lib/CodeGen/CGBuilder.h
+++ lib/CodeGen/CGBuilder.h
@@ -22,9 +22,7 @@
 /// \brief This is an IRBuilder insertion helper that forwards to
 /// CodeGenFunction::InsertHelper, which adds necessary metadata to
 /// instructions.
-template 
-class CGBuilderInserter
-: protected llvm::IRBuilderDefaultInserter {
+class CGBuilderInserter : protected llvm::IRBuilderDefaultInserter {
 public:
   CGBuilderInserter() = default;
   explicit CGBuilderInserter(CodeGenFunction *CGF) : CGF(CGF) {}
@@ -38,17 +36,10 @@
   CodeGenFunction *CGF = nullptr;
 };
 
-// Don't preserve names on values in an optimized build.
-#ifdef NDEBUG
-#define PreserveNames false
-#else
-#define PreserveNames true
-#endif
-
-typedef CGBuilderInserter CGBuilderInserterTy;
+typedef CGBuilderInserter CGBuilderInserterTy;
 
-typedef llvm::IRBuilder CGBuilderBaseTy;
+typedef llvm::IRBuilder
+CGBuilderBaseTy;
 
 class CGBuilderTy : public CGBuilderBaseTy {
   /// Storing a reference to the type cache here makes it a lot easier
@@ -298,8 +289,6 @@
   }
 };
 
-#undef PreserveNames
-
 }  // end namespace CodeGen
 }  // end namespace clang
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org

r263087 - Fix false positives for for-loop-analysis warning

2016-03-09 Thread Steven Wu via cfe-commits
Author: steven_wu
Date: Wed Mar  9 20:02:48 2016
New Revision: 263087

URL: http://llvm.org/viewvc/llvm-project?rev=263087=rev
Log:
Fix false positives for for-loop-analysis warning

Summary:
For PseudoObjectExpr, the DeclMatcher need to search only all the semantics
but also need to search pass OpaqueValueExpr for all potential uses for the
Decl.

Reviewers: thakis, rtrieu, rjmccall, doug.gregor

Subscribers: xazax.hun, rjmccall, doug.gregor, cfe-commits

Differential Revision: http://reviews.llvm.org/D17627

Added:
cfe/trunk/test/SemaObjC/warn-loop-analysis.m
Modified:
cfe/trunk/lib/Sema/SemaStmt.cpp

Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=263087=263086=263087=diff
==
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Wed Mar  9 20:02:48 2016
@@ -1440,6 +1440,18 @@ namespace {
   FoundDecl = true;
 }
 
+void VisitPseudoObjectExpr(PseudoObjectExpr *POE) {
+  // Only need to visit the semantics for POE.
+  // SyntaticForm doesn't really use the Decal.
+  for (auto *S : POE->semantics()) {
+if (auto *OVE = dyn_cast(S))
+  // Look past the OVE into the expression it binds.
+  Visit(OVE->getSourceExpr());
+else
+  Visit(S);
+  }
+}
+
 bool FoundDeclInUse() { return FoundDecl; }
 
   };  // end class DeclMatcher

Added: cfe/trunk/test/SemaObjC/warn-loop-analysis.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/warn-loop-analysis.m?rev=263087=auto
==
--- cfe/trunk/test/SemaObjC/warn-loop-analysis.m (added)
+++ cfe/trunk/test/SemaObjC/warn-loop-analysis.m Wed Mar  9 20:02:48 2016
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -Wloop-analysis -verify %s
+// expected-no-diagnostics
+
+@interface MyArray
+- (id)objectAtIndexedSubscript:(unsigned int)idx;
+@end
+
+// Do not warn on objc classes has objectAtIndexedSubscript method.
+MyArray *test;
+void foo()
+{
+  unsigned int i;
+  for (i = 42; i > 0;) // No warnings here
+(void)test[--i];
+}


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


Re: [PATCH] D17627: Fix false positives for for-loop-analysis warning

2016-03-09 Thread Steven Wu via cfe-commits
This revision was automatically updated to reflect the committed changes.
steven_wu marked 2 inline comments as done.
Closed by commit rL263087: Fix false positives for for-loop-analysis warning 
(authored by steven_wu).

Changed prior to commit:
  http://reviews.llvm.org/D17627?vs=50212=50221#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17627

Files:
  cfe/trunk/lib/Sema/SemaStmt.cpp
  cfe/trunk/test/SemaObjC/warn-loop-analysis.m

Index: cfe/trunk/test/SemaObjC/warn-loop-analysis.m
===
--- cfe/trunk/test/SemaObjC/warn-loop-analysis.m
+++ cfe/trunk/test/SemaObjC/warn-loop-analysis.m
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -Wloop-analysis -verify %s
+// expected-no-diagnostics
+
+@interface MyArray
+- (id)objectAtIndexedSubscript:(unsigned int)idx;
+@end
+
+// Do not warn on objc classes has objectAtIndexedSubscript method.
+MyArray *test;
+void foo()
+{
+  unsigned int i;
+  for (i = 42; i > 0;) // No warnings here
+(void)test[--i];
+}
Index: cfe/trunk/lib/Sema/SemaStmt.cpp
===
--- cfe/trunk/lib/Sema/SemaStmt.cpp
+++ cfe/trunk/lib/Sema/SemaStmt.cpp
@@ -1440,6 +1440,18 @@
   FoundDecl = true;
 }
 
+void VisitPseudoObjectExpr(PseudoObjectExpr *POE) {
+  // Only need to visit the semantics for POE.
+  // SyntaticForm doesn't really use the Decal.
+  for (auto *S : POE->semantics()) {
+if (auto *OVE = dyn_cast(S))
+  // Look past the OVE into the expression it binds.
+  Visit(OVE->getSourceExpr());
+else
+  Visit(S);
+  }
+}
+
 bool FoundDeclInUse() { return FoundDecl; }
 
   };  // end class DeclMatcher


Index: cfe/trunk/test/SemaObjC/warn-loop-analysis.m
===
--- cfe/trunk/test/SemaObjC/warn-loop-analysis.m
+++ cfe/trunk/test/SemaObjC/warn-loop-analysis.m
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -Wloop-analysis -verify %s
+// expected-no-diagnostics
+
+@interface MyArray
+- (id)objectAtIndexedSubscript:(unsigned int)idx;
+@end
+
+// Do not warn on objc classes has objectAtIndexedSubscript method.
+MyArray *test;
+void foo()
+{
+  unsigned int i;
+  for (i = 42; i > 0;) // No warnings here
+(void)test[--i];
+}
Index: cfe/trunk/lib/Sema/SemaStmt.cpp
===
--- cfe/trunk/lib/Sema/SemaStmt.cpp
+++ cfe/trunk/lib/Sema/SemaStmt.cpp
@@ -1440,6 +1440,18 @@
   FoundDecl = true;
 }
 
+void VisitPseudoObjectExpr(PseudoObjectExpr *POE) {
+  // Only need to visit the semantics for POE.
+  // SyntaticForm doesn't really use the Decal.
+  for (auto *S : POE->semantics()) {
+if (auto *OVE = dyn_cast(S))
+  // Look past the OVE into the expression it binds.
+  Visit(OVE->getSourceExpr());
+else
+  Visit(S);
+  }
+}
+
 bool FoundDeclInUse() { return FoundDecl; }
 
   };  // end class DeclMatcher
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17627: Fix false positives for for-loop-analysis warning

2016-03-09 Thread John McCall via cfe-commits
rjmccall added a comment.

Thanks, LGTM.


http://reviews.llvm.org/D17627



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


Re: [PATCH] D17999: Rewrite ARM & AArch64 tests to check LLVM IR rather than assembly

2016-03-09 Thread Renato Golin via cfe-commits
rengolin added a comment.

Great work, Tim! Thank you!


http://reviews.llvm.org/D17999



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


Re: [PATCH] D17993: [CodeGen] Apply 'nonnull' to 'this' pointer arguments.

2016-03-09 Thread Hal Finkel via cfe-commits
hfinkel added a comment.

In http://reviews.llvm.org/D17993#371459, @chandlerc wrote:

> In http://reviews.llvm.org/D17993#371454, @hfinkel wrote:
>
> > In http://reviews.llvm.org/D17993#370793, @chandlerc wrote:
> >
> > > If we're not going to fully implement "fdelete-null-pointer-checks" we 
> > > shouldn't claim to... I'm really worried about us accepting that flag and 
> > > not actually honoring it.
> > >
> > > However, I *do* think this should be guarded by a flag, and it should be 
> > > specific to the 'this' pointer. And I'm also sufficiently terrified of 
> > > this that I think the flag should be off to start with so that folks can 
> > > find out how bad this is really going to be...
> >
> >
> > I agree with you, but I don't really understand why this particular use of 
> > nonnull is scary. Do you really think we have people calling member 
> > functions on null pointers on purpose and checking for a null this pointer 
> > in their code?
>
>
> Yes, we saw an astonishing number of instances of this when turning on the 
> warning.
>
> I don't have any real sympathy for the pattern or principle of the code -- it 
> is *really* bad. But at the same time, I do have sympathy for the users of 
> Clang who often inherited that code and would have to make substantial plans 
> to fix all of it before this kind of thing could be rolled out.


Interesting.  Then, indeed, we at least need a flag. Not sure we need nonnull 
this disabled by default, however.


http://reviews.llvm.org/D17993



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


Re: [PATCH] D17993: [CodeGen] Apply 'nonnull' to 'this' pointer arguments.

2016-03-09 Thread Hal Finkel via cfe-commits
hfinkel added a comment.

In http://reviews.llvm.org/D17993#370790, @rjmccall wrote:

> Hal, I think you're talking about a slightly different thing.  This patch is 
> adding an assumption that C++ this pointers are non-null, but only when 
> -fno-delete-null-pointer-checks is not passed.  The flag is therefore at 
> least somewhat functional.  (I would argue that it should also cover the 
> other cases where we add non-null assumptions, e.g. with reference arguments. 
>  It's less clear whether it should change the code-generation of, say, 
> non-trivial l-value derived-to-base casts, where there's a null check that's 
> implicitly elided in the frontend.)


We certainly can use a separate flag to control just this use of nonnull (and 
you're right, we should probably also have a corresponding way to turn off the 
nonnull reference assumptions). I'm just very afraid of incomplete 
implementations of -fno-delete-null-pointer-checks (seems like we're all on the 
same page about this now).

> If you're saying that GCC's interpretation of this flag is more aggressive 
> than that — e.g. if it also changes how aggressively the optimizer will 
> decide that a pointer is non-null due to (say) it having been previously used 
> as a load/store argument, as in the infamous Linux kernel bug that GCC got 
> heat over — then I agree that we should probably avoid saying that we support 
> the attribute until we find a way to emulate that.  That, I assume, would 
> have to be an attribute on the Function that weakens that analysis.


Yes, this is my understanding, and I think a function attribute would be 
appropriate here.

> I hope GCC's interpretation of this flag doesn't completely disable 
> null-check elimination, e.g. when the pointer is obviously the address of a 
> local or global variable.


I don't know; but we should certainly find out.


http://reviews.llvm.org/D17993



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


Re: [PATCH] D17993: [CodeGen] Apply 'nonnull' to 'this' pointer arguments.

2016-03-09 Thread Chandler Carruth via cfe-commits
chandlerc added a comment.

In http://reviews.llvm.org/D17993#371454, @hfinkel wrote:

> In http://reviews.llvm.org/D17993#370793, @chandlerc wrote:
>
> > If we're not going to fully implement "fdelete-null-pointer-checks" we 
> > shouldn't claim to... I'm really worried about us accepting that flag and 
> > not actually honoring it.
> >
> > However, I *do* think this should be guarded by a flag, and it should be 
> > specific to the 'this' pointer. And I'm also sufficiently terrified of this 
> > that I think the flag should be off to start with so that folks can find 
> > out how bad this is really going to be...
>
>
> I agree with you, but I don't really understand why this particular use of 
> nonnull is scary. Do you really think we have people calling member functions 
> on null pointers on purpose and checking for a null this pointer in their 
> code?


Yes, we saw an astonishing number of instances of this when turning on the 
warning.

I don't have any real sympathy for the pattern or principle of the code -- it 
is *really* bad. But at the same time, I do have sympathy for the users of 
Clang who often inherited that code and would have to make substantial plans to 
fix all of it before this kind of thing could be rolled out.


http://reviews.llvm.org/D17993



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


Re: r262851 - Module Debugging: Fix a crash when emitting debug info for nested tag types

2016-03-09 Thread David Blaikie via cfe-commits
Is this bug only reachable with modules debug info?
Could you describe the nature of the fix (not quite clear to me just by
looking at it)

On Mon, Mar 7, 2016 at 12:58 PM, Adrian Prantl via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: adrian
> Date: Mon Mar  7 14:58:52 2016
> New Revision: 262851
>
> URL: http://llvm.org/viewvc/llvm-project?rev=262851=rev
> Log:
> Module Debugging: Fix a crash when emitting debug info for nested tag types
> whose DeclContext is not yet complete by deferring their emission.
>
> rdar://problem/24918680
>
> Modified:
> cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
> cfe/trunk/test/Modules/Inputs/DebugCXX.h
> cfe/trunk/test/Modules/ModuleDebugInfo.cpp
>
> Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=262851=262850=262851=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)
> +++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Mon Mar  7
> 14:58:52 2016
> @@ -201,6 +201,15 @@ public:
>  if (D->getName().empty())
>return;
>
> +// Defer tag decls until their declcontext is complete.
> +auto *DeclCtx = D->getDeclContext();
> +while (DeclCtx) {
> +  if (auto *D = dyn_cast(DeclCtx))
> +if (!D->isCompleteDefinition())
> +  return;
> +  DeclCtx = DeclCtx->getParent();
> +}
> +
>  DebugTypeVisitor DTV(*Builder->getModuleDebugInfo(), *Ctx);
>  DTV.TraverseDecl(D);
>  Builder->UpdateCompletedType(D);
>
> Modified: cfe/trunk/test/Modules/Inputs/DebugCXX.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/DebugCXX.h?rev=262851=262850=262851=diff
>
> ==
> --- cfe/trunk/test/Modules/Inputs/DebugCXX.h (original)
> +++ cfe/trunk/test/Modules/Inputs/DebugCXX.h Mon Mar  7 14:58:52 2016
> @@ -72,3 +72,14 @@ namespace {
>  struct InAnonymousNamespace { int i; };
>}
>  }
> +
> +class Base;
> +class A {
> +  virtual Base *getParent() const;
> +};
> +class Base {};
> +class Derived : Base {
> +  class B : A {
> +Derived *getParent() const override;
> +  };
> +};
>
> Modified: cfe/trunk/test/Modules/ModuleDebugInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.cpp?rev=262851=262850=262851=diff
>
> ==
> --- cfe/trunk/test/Modules/ModuleDebugInfo.cpp (original)
> +++ cfe/trunk/test/Modules/ModuleDebugInfo.cpp Mon Mar  7 14:58:52 2016
> @@ -71,6 +71,13 @@
>  // CHECK-NOT:  name:
>  // CHECK-SAME: identifier: "_ZTS13TypedefStruct")
>
> +// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "Derived",
> +// CHECK-SAME: identifier: "_ZTS7Derived")
> +// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "B", scope:
> !"_ZTS7Derived",
> +// CHECK-SAME: elements: ![[B_MBRS:.*]], vtableHolder:
> !"_ZTS1A"
> +// CHECK: ![[B_MBRS]] = !{{{.*}}, ![[GET_PARENT:.*]]}
> +// CHECK: ![[GET_PARENT]] = !DISubprogram(name: "getParent"
> +
>  // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "FloatInstatiation"
>  // no mangled name here yet.
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17993: [CodeGen] Apply 'nonnull' to 'this' pointer arguments.

2016-03-09 Thread Hal Finkel via cfe-commits
hfinkel added a comment.

In http://reviews.llvm.org/D17993#370793, @chandlerc wrote:

> If we're not going to fully implement "fdelete-null-pointer-checks" we 
> shouldn't claim to... I'm really worried about us accepting that flag and not 
> actually honoring it.
>
> However, I *do* think this should be guarded by a flag, and it should be 
> specific to the 'this' pointer. And I'm also sufficiently terrified of this 
> that I think the flag should be off to start with so that folks can find out 
> how bad this is really going to be...


I agree with you, but I don't really understand why this particular use of 
nonnull is scary. Do you really think we have people calling member functions 
on null pointers on purpose and checking for a null this pointer in their code?


http://reviews.llvm.org/D17993



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


Re: [PATCH] D17983: Eliminate many benign instances of "potentially uninitialized local variable" warnings

2016-03-09 Thread David Blaikie via cfe-commits
On Wed, Mar 9, 2016 at 11:58 AM, Alexander Riccio via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> ariccio added a comment.
>
> In http://reviews.llvm.org/D17983#370717, @dblaikie wrote:
>
> > Initializations we never expect to use (eg because we have a covered
> switch
> >  that initializes in all cases, or some slightly complex control flow the
> >  compiler can't see through) hinder our ability to find uses of those
> with
> >  tools like msan.
>
>
> Too bad... Maybe msan should have a way to specify that you're default
> initializing a variable, and treat it as if you're not initializing it at
> all?
>

Maybe - could be worth discussing (I'd start a more general thread for that
if I were you, with some msan devs and llvm-dev)


> That said, I'm not sure that I agree with keeping `Potentially
> uninitialized local pointer variable 'name' used` off (//that's C4703 <
> https://msdn.microsoft.com/en-us/library/jj851030.aspx>, not C4701 <
> https://msdn.microsoft.com/en-us/library/1wea5zwe.aspx>//), because
> uninitialized local pointer bugs are more dangerous (I'm thinking <
> http://googleprojectzero.blogspot.com/2015/08/one-font-vulnerability-to-rule-them-all_21.html>
> of write-what-where <
> http://thesprawl.org/research/ost-introduction-software-exploits-uninit-overflow/>
> uninitialized pointer vulnerabilities <
> http://ioctl.ir/index.php/2016/02/13/cve-2016-0040-story-of-uninitialized-pointer/>),
> and I'd rather crash on a nullptr deref than some undefined behavior.
>

That being the problem - UB is what allows us to check these things and
have confidence we're finding bugs. (& not all the code, of course, would
deref into null - some places might use null as a valid state that is only
established after initialization (eg: int *x; if (a) { x = nullptr; } - so
we could still catch use of uninitialized in addition to null pointer
handling)


> I will drop the `default` cases as @dsanders noted, but should I drop all
> the local variable inits too? In several cases (which I didn't specifically
> note) I chose default initialization values that would trigger pre-existing
> `assert`s if nobody assigned anything else to them.
>

I'm not sure how valuable that is - again, we have msan to catch these and
broader issues.


> Regarding the 33 warnings I noted, i couldn't tell whether they're
> obviously false positives, which I think warrants someone other than me
> carefully looking through it.


These are 33 warnings you don't have fixes for? Sorry, I haven't looked
closely at the warning list compared to the proposed patch.


> Some of the warnings are caused by assigning to a variable inside of a
> loop with a dynamically sized bound; for those, I'd much rather (a)
> `assert` that the bound is nonzero/loop will be executed at least once, or
> (b) assign the variable some sentinel value, and then assert it before the
> variable is actually used. Thoughts?
>

I'd be happy to see an assertion for a loop like that, generally. (though I
haven't looked at the specific cases you're referring to)

- Dave


>
>
> http://reviews.llvm.org/D17983
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17983: Eliminate many benign instances of "potentially uninitialized local variable" warnings

2016-03-09 Thread David Blaikie via cfe-commits
On Wed, Mar 9, 2016 at 12:06 PM, Alexander Riccio via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> ariccio added a comment.
>
> Oh, and by the way, what's the policy on using `enum class`es instead of C
> style enums? I bet the compiler would have fewer false positives with
> strongly typed enums?
>

Don't think we have a policy - a discussion on llvm-dev (+cfe-dev) might be
worth getting buy in before you start writing patches to do widescale
changes to enum classes (probably first thing is to check all the supported
compilers support that feature, though)

- Dave


>
>
> http://reviews.llvm.org/D17983
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18014: Allows to build libc++ with -DLLVM_USE_SANITIZER="Address;Undefined" on OSX

2016-03-09 Thread Mehdi Amini via cfe-commits
Thanks, that's a lot cleaner indeed.  I'll update.

-- 
Mehdi

> On Mar 9, 2016, at 4:02 PM, Chris Bieneman  wrote:
> 
> beanz added inline comments.
> 
> 
> Comment at: lib/CMakeLists.txt:51
> @@ -50,2 +50,3 @@
> if (APPLE AND LLVM_USE_SANITIZER)
> -  if ("${LLVM_USE_SANITIZER}" STREQUAL "Address")
> +  if ("${LLVM_USE_SANITIZER}" STREQUAL "Address" OR
> +  "${LLVM_USE_SANITIZER}" STREQUAL "Address;Undefined" OR
> 
> Rather than doing this as a STREQUAL where you have to check both possible 
> orders, maybe we should iterate over the list?
> 
> Something more like:
> 
> 
> ```
> foreach(sanitizer in ${LLVM_USE_SANITIZER})
>  if(sanitizer STREQUAL "Address")
>set(enable_address On)
>  endif()
>  if(sanitizer STREQUAL "Undefined")
>set(enable_ub On)
>  endif()
>  ... 
> endforeach()
> 
> if(enable_address and enable_undefined)
> ...
> elseif(...)
> endif()
> ```
> 
> I think doing it this way makes the code more adaptable to future changes.
> 
> Alternatively you can get rid of needing to check both orders by using the 
> list(FIND ...) CMake command, which might be cleaner too.
> 
> 
> Repository:
>  rL LLVM
> 
> http://reviews.llvm.org/D18014
> 
> 
> 

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


Re: [PATCH] D17976: Add attributes for preserve_mostcc/preserve_allcc calling conventions to the C/C++ front-end

2016-03-09 Thread Michael Zolotukhin via cfe-commits

> On Mar 8, 2016, at 5:44 PM, Roman Levenstein via cfe-commits 
>  wrote:
> 
> Forgot to add the mailing list when I created a patch.
You don’t have cfe-commits in phabricator subscribers, so you probably won’t 
get notifications when someone replies there. It might make sense to resubmit 
the patch.

Michael
> 
>> Begin forwarded message:
>> 
>> From: Roman Levenstein >
>> Subject: [PATCH] D17976: Add attributes for preserve_mostcc/preserve_allcc 
>> calling conventions to the C/C++ front-end
>> Date: March 8, 2016 at 5:17:02 PM PST
>> To: rlevenst...@apple.com , juer...@apple.com 
>> 
>> Cc: amara.emer...@arm.com 
>> Reply-To: reviews+d17976+public+93264263cdbda...@reviews.llvm.org 
>> 
>> 
>> swiftix created this revision.
>> swiftix added a reviewer: ributzka.
>> Herald added a subscriber: aemerson.
>> 
>> Till now, preserve_mostcc/preserve_allcc calling convention attributes were 
>> only available at the LLVM IR level. This patch adds attributes for 
>> preserve_mostcc/preserve_allcc calling conventions to the C/C++ front-end.
>> 
>> The code was mostly written by Juergen Ributzka. I just added support for 
>> the AArch64 target.
>> 
>> http://reviews.llvm.org/D17976 
>> 
>> Files:
>>  include/clang-c/Index.h
>>  include/clang/AST/Type.h
>>  include/clang/Basic/Attr.td
>>  include/clang/Basic/Specifiers.h
>>  lib/AST/ItaniumMangle.cpp
>>  lib/AST/Type.cpp
>>  lib/AST/TypePrinter.cpp
>>  lib/Basic/Targets.cpp
>>  lib/CodeGen/CGCall.cpp
>>  lib/Sema/SemaDeclAttr.cpp
>>  lib/Sema/SemaType.cpp
>>  test/CodeGen/preserve_all.c
>>  test/CodeGen/preserve_most.c
>>  tools/libclang/CXType.cpp
>> 
> 
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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


Re: [PATCH] D17993: [CodeGen] Apply 'nonnull' to 'this' pointer arguments.

2016-03-09 Thread Richard Smith via cfe-commits
rsmith added a comment.

`-f(no-)strict-nonnull-this` maybe?


http://reviews.llvm.org/D17993



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


r263081 - EmitCXXStructorCall -> EmitCXXDestructorCall. NFC.

2016-03-09 Thread Alexey Samsonov via cfe-commits
Author: samsonov
Date: Wed Mar  9 18:20:37 2016
New Revision: 263081

URL: http://llvm.org/viewvc/llvm-project?rev=263081=rev
Log:
EmitCXXStructorCall -> EmitCXXDestructorCall. NFC.

This function is only used in Microsoft ABI and only to emit
destructors. Rename/simplify it accordingly.

Modified:
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=263081=263080=263081=diff
==
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Wed Mar  9 18:20:37 2016
@@ -82,15 +82,15 @@ RValue CodeGenFunction::EmitCXXMemberOrO
   Callee, ReturnValue, Args, MD);
 }
 
-RValue CodeGenFunction::EmitCXXStructorCall(
-const CXXMethodDecl *MD, llvm::Value *Callee, ReturnValueSlot ReturnValue,
-llvm::Value *This, llvm::Value *ImplicitParam, QualType ImplicitParamTy,
-const CallExpr *CE, StructorType Type) {
+RValue CodeGenFunction::EmitCXXDestructorCall(
+const CXXDestructorDecl *DD, llvm::Value *Callee, llvm::Value *This,
+llvm::Value *ImplicitParam, QualType ImplicitParamTy, const CallExpr *CE,
+StructorType Type) {
   CallArgList Args;
-  commonEmitCXXMemberOrOperatorCall(*this, MD, This, ImplicitParam,
+  commonEmitCXXMemberOrOperatorCall(*this, DD, This, ImplicitParam,
 ImplicitParamTy, CE, Args);
-  return EmitCall(CGM.getTypes().arrangeCXXStructorDeclaration(MD, Type),
-  Callee, ReturnValue, Args, MD);
+  return EmitCall(CGM.getTypes().arrangeCXXStructorDeclaration(DD, Type),
+  Callee, ReturnValueSlot(), Args, DD);
 }
 
 static CXXRecordDecl *getCXXRecord(const Expr *E) {

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=263081=263080=263081=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Wed Mar  9 18:20:37 2016
@@ -2710,11 +2710,10 @@ public:
   ReturnValueSlot ReturnValue, llvm::Value *This,
   llvm::Value *ImplicitParam,
   QualType ImplicitParamTy, const CallExpr *E);
-  RValue EmitCXXStructorCall(const CXXMethodDecl *MD, llvm::Value *Callee,
- ReturnValueSlot ReturnValue, llvm::Value *This,
- llvm::Value *ImplicitParam,
- QualType ImplicitParamTy, const CallExpr *E,
- StructorType Type);
+  RValue EmitCXXDestructorCall(const CXXDestructorDecl *DD, llvm::Value 
*Callee,
+   llvm::Value *This, llvm::Value *ImplicitParam,
+   QualType ImplicitParamTy, const CallExpr *E,
+   StructorType Type);
   RValue EmitCXXMemberCallExpr(const CXXMemberCallExpr *E,
ReturnValueSlot ReturnValue);
   RValue EmitCXXMemberOrOperatorMemberCallExpr(const CallExpr *CE,

Modified: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp?rev=263081=263080=263081=diff
==
--- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Wed Mar  9 18:20:37 2016
@@ -1494,10 +1494,10 @@ void MicrosoftCXXABI::EmitDestructorCall
 This, false);
   }
 
-  CGF.EmitCXXStructorCall(DD, Callee, ReturnValueSlot(), This.getPointer(),
-  /*ImplicitParam=*/nullptr,
-  /*ImplicitParamTy=*/QualType(), nullptr,
-  getFromDtorType(Type));
+  CGF.EmitCXXDestructorCall(DD, Callee, This.getPointer(),
+/*ImplicitParam=*/nullptr,
+/*ImplicitParamTy=*/QualType(), nullptr,
+getFromDtorType(Type));
 }
 
 void MicrosoftCXXABI::emitVTableBitSetEntries(VPtrInfo *Info,
@@ -1849,10 +1849,9 @@ llvm::Value *MicrosoftCXXABI::EmitVirtua
   DtorType == Dtor_Deleting);
 
   This = adjustThisArgumentForVirtualFunctionCall(CGF, GD, This, true);
-  RValue RV = CGF.EmitCXXStructorCall(Dtor, Callee, ReturnValueSlot(),
-  This.getPointer(),
-  ImplicitParam, Context.IntTy, CE,
-  StructorType::Deleting);
+  RValue RV =
+  CGF.EmitCXXDestructorCall(Dtor, Callee, This.getPointer(), ImplicitParam,
+

r263080 - Remove unused function arguments. NFC.

2016-03-09 Thread Alexey Samsonov via cfe-commits
Author: samsonov
Date: Wed Mar  9 18:20:33 2016
New Revision: 263080

URL: http://llvm.org/viewvc/llvm-project?rev=263080=rev
Log:
Remove unused function arguments. NFC.

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

Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=263080=263079=263080=diff
==
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Wed Mar  9 18:20:33 2016
@@ -24,10 +24,11 @@
 using namespace clang;
 using namespace CodeGen;
 
-static RequiredArgs commonEmitCXXMemberOrOperatorCall(
-CodeGenFunction , const CXXMethodDecl *MD, llvm::Value *Callee,
-ReturnValueSlot ReturnValue, llvm::Value *This, llvm::Value *ImplicitParam,
-QualType ImplicitParamTy, const CallExpr *CE, CallArgList ) {
+static RequiredArgs
+commonEmitCXXMemberOrOperatorCall(CodeGenFunction , const CXXMethodDecl 
*MD,
+  llvm::Value *This, llvm::Value 
*ImplicitParam,
+  QualType ImplicitParamTy, const CallExpr *CE,
+  CallArgList ) {
   assert(CE == nullptr || isa(CE) ||
  isa(CE));
   assert(MD->isInstance() &&
@@ -76,8 +77,7 @@ RValue CodeGenFunction::EmitCXXMemberOrO
   const FunctionProtoType *FPT = MD->getType()->castAs();
   CallArgList Args;
   RequiredArgs required = commonEmitCXXMemberOrOperatorCall(
-  *this, MD, Callee, ReturnValue, This, ImplicitParam, ImplicitParamTy, CE,
-  Args);
+  *this, MD, This, ImplicitParam, ImplicitParamTy, CE, Args);
   return EmitCall(CGM.getTypes().arrangeCXXMethodCall(Args, FPT, required),
   Callee, ReturnValue, Args, MD);
 }
@@ -87,8 +87,8 @@ RValue CodeGenFunction::EmitCXXStructorC
 llvm::Value *This, llvm::Value *ImplicitParam, QualType ImplicitParamTy,
 const CallExpr *CE, StructorType Type) {
   CallArgList Args;
-  commonEmitCXXMemberOrOperatorCall(*this, MD, Callee, ReturnValue, This,
-ImplicitParam, ImplicitParamTy, CE, Args);
+  commonEmitCXXMemberOrOperatorCall(*this, MD, This, ImplicitParam,
+ImplicitParamTy, CE, Args);
   return EmitCall(CGM.getTypes().arrangeCXXStructorDeclaration(MD, Type),
   Callee, ReturnValue, Args, MD);
 }


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


Re: [PATCH] D18014: Allows to build libc++ with -DLLVM_USE_SANITIZER="Address; Undefined" on OSX

2016-03-09 Thread Chris Bieneman via cfe-commits
beanz added inline comments.


Comment at: lib/CMakeLists.txt:51
@@ -50,2 +50,3 @@
 if (APPLE AND LLVM_USE_SANITIZER)
-  if ("${LLVM_USE_SANITIZER}" STREQUAL "Address")
+  if ("${LLVM_USE_SANITIZER}" STREQUAL "Address" OR
+  "${LLVM_USE_SANITIZER}" STREQUAL "Address;Undefined" OR

Rather than doing this as a STREQUAL where you have to check both possible 
orders, maybe we should iterate over the list?

Something more like:


```
foreach(sanitizer in ${LLVM_USE_SANITIZER})
  if(sanitizer STREQUAL "Address")
set(enable_address On)
  endif()
  if(sanitizer STREQUAL "Undefined")
set(enable_ub On)
  endif()
  ... 
endforeach()

if(enable_address and enable_undefined)
...
elseif(...)
endif()
```

I think doing it this way makes the code more adaptable to future changes.

Alternatively you can get rid of needing to check both orders by using the 
list(FIND ...) CMake command, which might be cleaner too.


Repository:
  rL LLVM

http://reviews.llvm.org/D18014



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


Re: [PATCH] D15314: Fix a bug in unavailable checking

2016-03-09 Thread Doug Gregor via cfe-commits
doug.gregor accepted this revision.
doug.gregor added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D15314



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


Re: [PATCH] D17627: Fix false positives for for-loop-analysis warning

2016-03-09 Thread Steven Wu via cfe-commits
steven_wu updated this revision to Diff 50212.
steven_wu updated the summary for this revision.
steven_wu added a comment.

Update according to feedback. I agree that OVE should never be null as semantics
of PseudoObjectExpr.


http://reviews.llvm.org/D17627

Files:
  lib/Sema/SemaStmt.cpp
  test/SemaObjC/warn-loop-analysis.m

Index: test/SemaObjC/warn-loop-analysis.m
===
--- /dev/null
+++ test/SemaObjC/warn-loop-analysis.m
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -Wloop-analysis -verify %s
+// expected-no-diagnostics
+
+@interface MyArray
+- (id)objectAtIndexedSubscript:(unsigned int)idx;
+@end
+
+// Do not warn on objc classes has objectAtIndexedSubscript method.
+MyArray *test;
+void foo()
+{
+  unsigned int i;
+  for (i = 42; i > 0;) // No warnings here
+(void)test[--i];
+}
Index: lib/Sema/SemaStmt.cpp
===
--- lib/Sema/SemaStmt.cpp
+++ lib/Sema/SemaStmt.cpp
@@ -1440,6 +1440,18 @@
   FoundDecl = true;
 }
 
+void VisitPseudoObjectExpr(PseudoObjectExpr *POE) {
+  // Only need to visit the semantics for POE.
+  // SyntaticForm doesn't really use the Decal.
+  for (auto *S : POE->semantics()) {
+if (auto *OVE = dyn_cast(S))
+  // Look past the OVE into the expression it binds.
+  Visit(OVE->getSourceExpr());
+else
+  Visit(S);
+  }
+}
+
 bool FoundDeclInUse() { return FoundDecl; }
 
   };  // end class DeclMatcher


Index: test/SemaObjC/warn-loop-analysis.m
===
--- /dev/null
+++ test/SemaObjC/warn-loop-analysis.m
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -Wloop-analysis -verify %s
+// expected-no-diagnostics
+
+@interface MyArray
+- (id)objectAtIndexedSubscript:(unsigned int)idx;
+@end
+
+// Do not warn on objc classes has objectAtIndexedSubscript method.
+MyArray *test;
+void foo()
+{
+  unsigned int i;
+  for (i = 42; i > 0;) // No warnings here
+(void)test[--i];
+}
Index: lib/Sema/SemaStmt.cpp
===
--- lib/Sema/SemaStmt.cpp
+++ lib/Sema/SemaStmt.cpp
@@ -1440,6 +1440,18 @@
   FoundDecl = true;
 }
 
+void VisitPseudoObjectExpr(PseudoObjectExpr *POE) {
+  // Only need to visit the semantics for POE.
+  // SyntaticForm doesn't really use the Decal.
+  for (auto *S : POE->semantics()) {
+if (auto *OVE = dyn_cast(S))
+  // Look past the OVE into the expression it binds.
+  Visit(OVE->getSourceExpr());
+else
+  Visit(S);
+  }
+}
+
 bool FoundDeclInUse() { return FoundDecl; }
 
   };  // end class DeclMatcher
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r262881 - P0188R1: add support for standard [[fallthrough]] attribute. This is almost

2016-03-09 Thread Nico Weber via cfe-commits
On Tue, Mar 8, 2016 at 12:18 PM, Nico Weber  wrote:

> On Tue, Mar 8, 2016 at 2:10 PM, Richard Smith 
> wrote:
>
>> On Tue, Mar 8, 2016 at 11:04 AM, Nico Weber  wrote:
>> > On Tue, Mar 8, 2016 at 1:49 PM, Richard Smith 
>> wrote:
>> >>
>> >> On Tue, Mar 8, 2016 at 9:05 AM, Nico Weber 
>> wrote:
>> >> > This causes clang to warn on
>> >> >
>> >> >   default: assert (false); HB_FALLTHROUGH;
>> >>
>> >> What follows this? (A case label?) What warning is being produced?
>> >
>> >
>> > A case label. Full snippet:
>> >
>> https://code.google.com/p/chromium/codesearch#chromium/src/third_party/harfbuzz-ng/src/hb-ot-shape-complex-thai.cc=142
>> >
>> > Full warning (from
>> >
>> https://build.chromium.org/p/chromium.fyi/builders/ClangToTMac%20%28dbg%29/builds/4497/steps/compile/logs/stdio
>> ):
>> >
>> > ../../third_party/harfbuzz-ng/src/hb-ot-shape-complex-thai.cc:142:30:
>> error:
>> > fallthrough annotation in unreachable code
>> [-Werror,-Wimplicit-fallthrough]
>> > default: assert (false); HB_FALLTHROUGH;
>> >  ^
>> > ../../third_party/harfbuzz-ng/src/hb-private.hh:140:26: note: expanded
>> from
>> > macro 'HB_FALLTHROUGH'
>> > #  define HB_FALLTHROUGH [[clang::fallthrough]]
>> >
>> > As far as I know, we don't opt in to -Wimplicit-fallthrough (and I
>> don't see
>> > a flag on the commandline of the failing compile; also available at the
>> > above link.)
>>
>> OK, I see what's going wrong. Half of -Wimplicit-fallthrough is off by
>> default, half of it is on by default. We used to do the CFG-based
>> analysis only if the warning was enabled (because otherwise it would
>> never produce any messages), and this change makes us also do the
>> analysis when the warning is disabled but there are [[fallthrough]];
>> statements in the function (it promotes the "misplaced
>> [[fallthrough]];" diagnostic from warning to error, so we need the
>> analysis if the attribute is present). This change should have had no
>> impact on -Wimplicit-fallthrough (either the warning was disabled so
>> no diagnostics are produced before and after, or the warning was
>> enabled so the same diagnostics are produced before and after), but
>> apparently when we ask "is this warning enabled?" and the warning
>> group contains multiple diagnostics, we don't check them all...
>>
>> There's an easy fix for clang: warn_fallthrough_attr_unreachable
>> should be marked DefaultIgnore.
>
>
> Sounds good. Are you doing that? Want me to do that?
>

^ ping


>
>
>> (Though that chromium code would still
>> produce diagnostics -- with or without this change -- if you build
>> with -Wimplicit-fallthrough and -DNDEBUG, so maybe you do need a
>> different macro for that case regardless.)
>>
>> >> > The fallthrough needs to be there for release builds, but now it must
>> >> > not be
>> >> > there for debug builds. I suppose this means projects now need an
>> >> > UNREACHED_CASE macro that expands to assert(false) in debug and to
>> >> > fallthrough in release (with clang; and to something else with other
>> >> > compilers)?
>> >> >
>> >> > On Mon, Mar 7, 2016 at 7:32 PM, Richard Smith via cfe-commits
>> >> >  wrote:
>> >> >>
>> >> >> Author: rsmith
>> >> >> Date: Mon Mar  7 18:32:55 2016
>> >> >> New Revision: 262881
>> >> >>
>> >> >> URL: http://llvm.org/viewvc/llvm-project?rev=262881=rev
>> >> >> Log:
>> >> >> P0188R1: add support for standard [[fallthrough]] attribute. This is
>> >> >> almost
>> >> >> exactly the same as clang's existing [[clang::fallthrough]]
>> attribute,
>> >> >> which
>> >> >> has been updated to have the same semantics. The one significant
>> >> >> difference
>> >> >> is that [[fallthrough]] is ill-formed if it's not used immediately
>> >> >> before
>> >> >> a
>> >> >> switch label (even when -Wimplicit-fallthrough is disabled). To
>> support
>> >> >> that,
>> >> >> we now build a CFG of any function that uses a '[[fallthrough]];'
>> >> >> statement
>> >> >> to check.
>> >> >>
>> >> >> In passing, fix some bugs with our support for statement attributes
>> --
>> >> >> in
>> >> >> particular, diagnose their use on declarations, rather than
>> asserting.
>> >> >>
>> >> >> Modified:
>> >> >> cfe/trunk/include/clang/AST/Attr.h
>> >> >> cfe/trunk/include/clang/Basic/Attr.td
>> >> >> cfe/trunk/include/clang/Basic/AttrDocs.td
>> >> >> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> >> >> cfe/trunk/include/clang/Sema/AttributeList.h
>> >> >> cfe/trunk/include/clang/Sema/ScopeInfo.h
>> >> >> cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
>> >> >> cfe/trunk/lib/Sema/AttributeList.cpp
>> >> >> cfe/trunk/lib/Sema/SemaDeclAttr.cpp
>> >> >> cfe/trunk/lib/Sema/SemaStmtAttr.cpp
>> >> >> cfe/trunk/test/Analysis/cxx11-crashes.cpp
>> >> >> cfe/trunk/test/PCH/Inputs/cxx11-statement-attributes.h
>> >> >> 

Re: [PATCH] D18011: [modules] Diagnose insufficient privileges when trying to load the modulemap

2016-03-09 Thread Sean Silva via cfe-commits
silvas added a comment.

Isn't there a `read` call or something that fails down the road? How can it be 
silent?


http://reviews.llvm.org/D18011



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


r263076 - [Modules] Add stdatomic to the list of builtin headers

2016-03-09 Thread Ben Langmuir via cfe-commits
Author: benlangmuir
Date: Wed Mar  9 17:31:34 2016
New Revision: 263076

URL: http://llvm.org/viewvc/llvm-project?rev=263076=rev
Log:
[Modules] Add stdatomic to the list of builtin headers

Since it's provided by the compiler. This allows a system module map
file to declare a module for it.

No test change for cstd.m, since stdatomic.h doesn't function without a
relatively complete stdint.h and stddef.h, which tests using this module
don't provide.

rdar://problem/24931246

Modified:
cfe/trunk/lib/Lex/ModuleMap.cpp

Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=263076=263075=263076=diff
==
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Wed Mar  9 17:31:34 2016
@@ -151,6 +151,7 @@ static bool isBuiltinHeader(StringRef Fi
.Case("limits.h", true)
.Case("stdalign.h", true)
.Case("stdarg.h", true)
+   .Case("stdatomic.h", true)
.Case("stdbool.h", true)
.Case("stddef.h", true)
.Case("stdint.h", true)


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


Re: [PATCH] D17627: Fix false positives for for-loop-analysis warning

2016-03-09 Thread John McCall via cfe-commits
rjmccall added inline comments.


Comment at: lib/Sema/SemaStmt.cpp:1448
@@ +1447,3 @@
+if (auto *OVE = dyn_cast(S)) {
+  // Look pass OVE for Decl.
+  if (Expr *E = OVE->getSourceExpr())

"Look past the OVE into the expression it binds."


Comment at: lib/Sema/SemaStmt.cpp:1449
@@ +1448,3 @@
+  // Look pass OVE for Decl.
+  if (Expr *E = OVE->getSourceExpr())
+Visit(E);

I believe this is never null.


http://reviews.llvm.org/D17627



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


[PATCH] D18014: Allows to build libc++ with -DLLVM_USE_SANITIZER="Address; Undefined" on OSX

2016-03-09 Thread Mehdi AMINI via cfe-commits
joker.eph created this revision.
joker.eph added a reviewer: beanz.
joker.eph added a subscriber: cfe-commits.
joker.eph set the repository for this revision to rL LLVM.

It seems some cases were missing to the configuration.

Repository:
  rL LLVM

http://reviews.llvm.org/D18014

Files:
  lib/CMakeLists.txt

Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -48,7 +48,9 @@
 add_library_flags_if(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "-Wl,-Bdynamic" 
"-Wl,--no-whole-archive")
 
 if (APPLE AND LLVM_USE_SANITIZER)
-  if ("${LLVM_USE_SANITIZER}" STREQUAL "Address")
+  if ("${LLVM_USE_SANITIZER}" STREQUAL "Address" OR
+  "${LLVM_USE_SANITIZER}" STREQUAL "Address;Undefined" OR
+  "${LLVM_USE_SANITIZER}" STREQUAL "Undefined;Address")
 set(LIBFILE "libclang_rt.asan_osx_dynamic.dylib")
   elseif("${LLVM_USE_SANITIZER}" STREQUAL "Undefined")
 set(LIBFILE "libclang_rt.ubsan_osx_dynamic.dylib")


Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -48,7 +48,9 @@
 add_library_flags_if(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "-Wl,-Bdynamic" "-Wl,--no-whole-archive")
 
 if (APPLE AND LLVM_USE_SANITIZER)
-  if ("${LLVM_USE_SANITIZER}" STREQUAL "Address")
+  if ("${LLVM_USE_SANITIZER}" STREQUAL "Address" OR
+  "${LLVM_USE_SANITIZER}" STREQUAL "Address;Undefined" OR
+  "${LLVM_USE_SANITIZER}" STREQUAL "Undefined;Address")
 set(LIBFILE "libclang_rt.asan_osx_dynamic.dylib")
   elseif("${LLVM_USE_SANITIZER}" STREQUAL "Undefined")
 set(LIBFILE "libclang_rt.ubsan_osx_dynamic.dylib")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r263051 - [PPC] FE support for generating VSX [negated] absolute value instructions

2016-03-09 Thread Eric Christopher via cfe-commits
On Wed, Mar 9, 2016 at 11:33 AM Kit Barton via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: kbarton
> Date: Wed Mar  9 13:28:31 2016
> New Revision: 263051
>
> URL: http://llvm.org/viewvc/llvm-project?rev=263051=rev
> Log:
> [PPC] FE support for generating VSX [negated] absolute value instructions
>
> Includes new built-in, conversion of built-in to target-independent
> intrinsic
> and update in the header file. Tests are also updated. There is a second
> part in
> the backend for which I will post a separate code-review. BACKEND PART
> SHOULD BE
> COMMITTED FIRST.
>
>
Did you mean to commit this? Or just forget to edit your commit message?

-eric


> Phabricator: http://reviews.llvm.org/D17816
>
> Modified:
> cfe/trunk/include/clang/Basic/BuiltinsPPC.def
> cfe/trunk/lib/CodeGen/CGBuiltin.cpp
> cfe/trunk/lib/Headers/altivec.h
> cfe/trunk/test/CodeGen/builtins-ppc-altivec.c
> cfe/trunk/test/CodeGen/builtins-ppc-p8vector.c
> cfe/trunk/test/CodeGen/builtins-ppc-vsx.c
>
> Modified: cfe/trunk/include/clang/Basic/BuiltinsPPC.def
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsPPC.def?rev=263051=263050=263051=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/BuiltinsPPC.def (original)
> +++ cfe/trunk/include/clang/Basic/BuiltinsPPC.def Wed Mar  9 13:28:31 2016
> @@ -336,6 +336,9 @@ BUILTIN(__builtin_vsx_xxleqv, "V4UiV4UiV
>  BUILTIN(__builtin_vsx_xvcpsgndp, "V2dV2dV2d", "")
>  BUILTIN(__builtin_vsx_xvcpsgnsp, "V4fV4fV4f", "")
>
> +BUILTIN(__builtin_vsx_xvabssp, "V4fV4f", "")
> +BUILTIN(__builtin_vsx_xvabsdp, "V2dV2d", "")
> +
>  // HTM builtins
>  BUILTIN(__builtin_tbegin, "UiUIi", "")
>  BUILTIN(__builtin_tend, "UiUIi", "")
>
> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=263051=263050=263051=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Wed Mar  9 13:28:31 2016
> @@ -6992,6 +6992,16 @@ Value *CodeGenFunction::EmitPPCBuiltinEx
>  llvm::Function *F = CGM.getIntrinsic(ID, ResultType);
>  return Builder.CreateCall(F, X);
>}
> +
> +  // Absolute value
> +  case PPC::BI__builtin_vsx_xvabsdp:
> +  case PPC::BI__builtin_vsx_xvabssp: {
> +llvm::Type *ResultType = ConvertType(E->getType());
> +Value *X = EmitScalarExpr(E->getArg(0));
> +llvm::Function *F = CGM.getIntrinsic(Intrinsic::fabs, ResultType);
> +return Builder.CreateCall(F, X);
> +  }
> +
>// FMA variations
>case PPC::BI__builtin_vsx_xvmaddadp:
>case PPC::BI__builtin_vsx_xvmaddasp:
>
> Modified: cfe/trunk/lib/Headers/altivec.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/altivec.h?rev=263051=263050=263051=diff
>
> ==
> --- cfe/trunk/lib/Headers/altivec.h (original)
> +++ cfe/trunk/lib/Headers/altivec.h Wed Mar  9 13:28:31 2016
> @@ -124,16 +124,18 @@ vec_abs(vector signed long long __a) {
>  #endif
>
>  static vector float __ATTRS_o_ai vec_abs(vector float __a) {
> +#ifdef __VSX__
> +  return __builtin_vsx_xvabssp(__a);
> +#else
>vector unsigned int __res =
>(vector unsigned int)__a & (vector unsigned int)(0x7FFF);
>return (vector float)__res;
> +#endif
>  }
>
>  #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
>  static vector double __ATTRS_o_ai vec_abs(vector double __a) {
> -  vector unsigned long long __res = { 0x7FFF,
> 0x7FFF };
> -  __res &= (vector unsigned int)__a;
> -  return (vector double)__res;
> +  return __builtin_vsx_xvabsdp(__a);
>  }
>  #endif
>
>
> Modified: cfe/trunk/test/CodeGen/builtins-ppc-altivec.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-ppc-altivec.c?rev=263051=263050=263051=diff
>
> ==
> --- cfe/trunk/test/CodeGen/builtins-ppc-altivec.c (original)
> +++ cfe/trunk/test/CodeGen/builtins-ppc-altivec.c Wed Mar  9 13:28:31 2016
> @@ -1,7 +1,13 @@
>  // REQUIRES: powerpc-registered-target
> -// RUN: %clang_cc1 -faltivec -triple powerpc-unknown-unknown -emit-llvm
> %s -o - | FileCheck %s
> -// RUN: %clang_cc1 -faltivec -triple powerpc64-unknown-unknown -emit-llvm
> %s -o - | FileCheck %s
> -// RUN: %clang_cc1 -faltivec -triple powerpc64le-unknown-unknown
> -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-LE
> +// RUN: %clang_cc1 -faltivec -triple powerpc-unknown-unknown -emit-llvm
> %s \
> +// RUN:-o - | FileCheck %s
> +// RUN: %clang_cc1 -faltivec -triple powerpc64-unknown-unknown -emit-llvm
> %s \
> +// RUN:-o - | FileCheck %s
> +// RUN: %clang_cc1 -faltivec -triple powerpc64le-unknown-unknown
> -emit-llvm %s \
> +// RUN:-o - | FileCheck 

Re: r263048 - ARM & AArch64: convert asm tests to LLVM IR and restrict optimizations.

2016-03-09 Thread Eric Christopher via cfe-commits
On Wed, Mar 9, 2016 at 1:32 PM Tim Northover via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On 9 March 2016 at 13:20, David Blaikie via cfe-commits
>  wrote:
> > If we are touching these tests at all, as a cleanup, why aren't we
> adjusting
> > them to not pass through the llvm optimizers/code generators at all?
> > Generally we are pretty clear that any test in Clang looking at llvms
> > generated assembly is an anachronism to be removed eventually
>
> This patch should remove all checking (and generation) of assembly.
> But as I said, I think banning all optimizations is going too far and
> leads to unreadable tests (with excess loads and stores being a
> particular problem).
>
>
I still think we should avoid the optimizer, but as (at least) an
intermediate step this seemed like a good compromise.

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


Re: r263048 - ARM & AArch64: convert asm tests to LLVM IR and restrict optimizations.

2016-03-09 Thread Tim Northover via cfe-commits
On 9 March 2016 at 13:20, David Blaikie via cfe-commits
 wrote:
> If we are touching these tests at all, as a cleanup, why aren't we adjusting
> them to not pass through the llvm optimizers/code generators at all?
> Generally we are pretty clear that any test in Clang looking at llvms
> generated assembly is an anachronism to be removed eventually

This patch should remove all checking (and generation) of assembly.
But as I said, I think banning all optimizations is going too far and
leads to unreadable tests (with excess loads and stores being a
particular problem).

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


r263060 - [modules] Simplify code logic. NFC.

2016-03-09 Thread Davide Italiano via cfe-commits
Author: davide
Date: Wed Mar  9 15:09:51 2016
New Revision: 263060

URL: http://llvm.org/viewvc/llvm-project?rev=263060=rev
Log:
[modules] Simplify code logic. NFC.

Modified:
cfe/trunk/lib/Basic/Module.cpp

Modified: cfe/trunk/lib/Basic/Module.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Module.cpp?rev=263060=263059=263060=diff
==
--- cfe/trunk/lib/Basic/Module.cpp (original)
+++ cfe/trunk/lib/Basic/Module.cpp Wed Mar  9 15:09:51 2016
@@ -418,12 +418,8 @@ void Module::print(raw_ostream , unsi
 OS.indent(Indent + 2);
 OS << "export ";
 printModuleId(OS, UnresolvedExports[I].Id);
-if (UnresolvedExports[I].Wildcard) {
-  if (UnresolvedExports[I].Id.empty())
-OS << "*";
-  else
-OS << ".*";
-}
+if (UnresolvedExports[I].Wildcard)
+  OS << (UnresolvedExports[I].Id.empty() ? "*" : ".*");
 OS << "\n";
   }
 


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


Re: [PATCH] D17963: [OPENMP] Codegen for teams directive for NVPTX

2016-03-09 Thread Carlo Bertolli via cfe-commits
carlo.bertolli updated this revision to Diff 50187.
carlo.bertolli added a comment.

[OPENMP] This new version of the patch uses the inlining machinery of 
CGOpenMPRuntime.cpp instead of just dumping the teams body statement using 
EmitStmt.


Repository:
  rL LLVM

http://reviews.llvm.org/D17963

Files:
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGOpenMPRuntime.h
  lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
  lib/CodeGen/CGOpenMPRuntimeNVPTX.h
  lib/CodeGen/CGStmtOpenMP.cpp
  test/OpenMP/nvptx_teams_codegen.cpp

Index: test/OpenMP/nvptx_teams_codegen.cpp
===
--- /dev/null
+++ test/OpenMP/nvptx_teams_codegen.cpp
@@ -0,0 +1,116 @@
+// Test target codegen - host bc file has to be created first.
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -omptargets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -omptargets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -omp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple i386-unknown-unknown -omptargets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple nvptx-unknown-unknown -omptargets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device -omp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+#ifdef CK1
+
+template 
+int tmain(T argc) {
+#pragma omp target
+#pragma omp teams
+  argc = 0;
+  return 0;
+}
+
+int main (int argc, char **argv) {
+#pragma omp target
+#pragma omp teams
+  argc = 0;
+  return tmain(argv);
+}
+
+// only nvptx side: do not outline teams region and do not call fork_teams
+// CK1:  define {{.*}}void @{{[^,]+}}(i{{.+}} [[ARGC:%.+]])
+// CK1:  [[ARGCADDR:%.+]] = alloca i{{[0-9]+}},
+// CK1:  store i{{[0-9]+}} [[ARGC]], i{{[0-9]+}}* [[ARGCADDR]],
+// CK1-64: [[CONV:%.+]] = bitcast i64* [[ARGCADDR]] to i32*
+// CK1-64: store i{{[0-9]+}} 0, i{{[0-9]+}}* [[CONV]],
+// CK1-32: store i{{[0-9]+}} 0, i{{[0-9]+}}* [[ARGCADDR]],
+// CK1-NOT: call {{.*}}void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_teams(
+// CK1:  ret void
+// CK1-NEXT: }
+
+// target region in template
+// CK1: define {{.*}}void @{{[^,]+}}(i{{.+}}***{{.+}} [[ARGC:%.+]])
+// CK1: [[ARGCADDR:%.+]] = alloca i{{.+}}***,
+// CK1: store i{{.+}}*** [[ARGC]], i{{.+}} [[ARGCADDR]]
+// CK1: [[ARGCADDR_REF:%.+]] = load i{{.+}}***, i{{.+}} [[ARGCADDR]],
+// CK1: store i{{[0-9]+}}** null, i{{[0-9]+}}*** [[ARGCADDR_REF]],
+// CK1-NOT: call {{.*}}void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_teams(
+// CK1:  ret void
+// CK1-NEXT: }
+
+
+#endif // CK1
+
+// Test target codegen - host bc file has to be created first.
+// RUN: %clang_cc1 -DCK2 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -omptargets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -DCK2 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -omptargets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -omp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-64
+// RUN: %clang_cc1 -DCK2 -verify -fopenmp -x c++ -triple i386-unknown-unknown -omptargets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc
+// RUN: %clang_cc1 -DCK2 -verify -fopenmp -x c++ -triple nvptx-unknown-unknown -omptargets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device -omp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-32
+// expected-no-diagnostics
+#ifdef CK2
+
+template 
+int tmain(T argc) {
+  int a = 10;
+  int b = 5;
+#pragma omp target
+#pragma omp teams num_teams(a) thread_limit(b)
+  {
+  argc = 0;
+  }
+  return 0;
+}
+
+int main (int argc, char **argv) {
+  int a = 20;
+  int b = 5;
+#pragma omp target
+#pragma omp teams num_teams(a) thread_limit(b)
+  {
+  argc = 0;
+  }
+  return tmain(argv);
+}
+
+// CK2: define {{.*}}void @{{[^,]+}}(i{{[0-9]+}} [[A_IN:%.+]], i{{[0-9]+}} [[B_IN:%.+]], i{{[0-9]+}} [[ARGC_IN:.+]])
+// CK2: [[AADDR:%.+]] = alloca i{{[0-9]+}},
+// CK2: [[BADDR:%.+]] = alloca i{{[0-9]+}},
+// CK2: [[ARGCADDR:%.+]] = alloca i{{[0-9]+}},
+// CK2-NOT:  {{%.+}} = call i32 @__kmpc_global_thread_num(
+// CK2: store i{{[0-9]+}} [[A_IN]], i{{[0-9]+}}* [[AADDR]],
+// CK2: store i{{[0-9]+}} [[B_IN]], i{{[0-9]+}}* [[BADDR]],
+// CK2: store i{{[0-9]+}} [[ARGC_IN]], i{{[0-9]+}}* [[ARGCADDR]],
+// CK2-64: [[ACONV:%.+]] = bitcast i64* [[AADDR]] to i32*
+// CK2-64: [[BCONV:%.+]] = bitcast i64* [[BADDR]] to i32*
+// CK2-64: [[CONV:%.+]] = bitcast i64* [[ARGCADDR]] to i32*
+// CK2-64: store i{{[0-9]+}} 0, i{{[0-9]+}}* [[CONV]],
+// CK2-32: store i{{[0-9]+}} 0, i{{[0-9]+}}* [[ARGCADDR]],
+// CK2-NOT:  {{.+}} = call i32 

Re: [PATCH] D17963: [OPENMP] Codegen for teams directive for NVPTX

2016-03-09 Thread Carlo Bertolli via cfe-commits
carlo.bertolli marked an inline comment as done.
carlo.bertolli added a comment.

Addressed comment in new version of diff.


Repository:
  rL LLVM

http://reviews.llvm.org/D17963



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


Re: [PATCH] D17627: Fix false positives for for-loop-analysis warning

2016-03-09 Thread Steven Wu via cfe-commits
steven_wu updated this revision to Diff 50186.
steven_wu added a comment.

Update the patch to address John's feedback. We shouldn't even checking
ObjCSubscript but looking at the Semantics for PseudoObjectExpr only.


http://reviews.llvm.org/D17627

Files:
  lib/Sema/SemaStmt.cpp
  test/SemaObjC/warn-loop-analysis.m

Index: test/SemaObjC/warn-loop-analysis.m
===
--- /dev/null
+++ test/SemaObjC/warn-loop-analysis.m
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -Wloop-analysis -verify %s
+// expected-no-diagnostics
+
+@interface MyArray
+- (id)objectAtIndexedSubscript:(unsigned int)idx;
+@end
+
+// Do not warn on objc classes has objectAtIndexedSubscript method.
+MyArray *test;
+void foo()
+{
+  unsigned int i;
+  for (i = 42; i > 0;) // No warnings here
+(void)test[--i];
+}
Index: lib/Sema/SemaStmt.cpp
===
--- lib/Sema/SemaStmt.cpp
+++ lib/Sema/SemaStmt.cpp
@@ -1440,6 +1440,19 @@
   FoundDecl = true;
 }
 
+void VisitPseudoObjectExpr(PseudoObjectExpr *POE) {
+  // Only need to visit the semantics for POE.
+  // SyntaticForm doesn't really use the Decal.
+  for (auto *S : POE->semantics()) {
+if (auto *OVE = dyn_cast(S)) {
+  // Look pass OVE for Decl.
+  if (Expr *E = OVE->getSourceExpr())
+Visit(E);
+} else
+  Visit(S);
+  }
+}
+
 bool FoundDeclInUse() { return FoundDecl; }
 
   };  // end class DeclMatcher


Index: test/SemaObjC/warn-loop-analysis.m
===
--- /dev/null
+++ test/SemaObjC/warn-loop-analysis.m
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -Wloop-analysis -verify %s
+// expected-no-diagnostics
+
+@interface MyArray
+- (id)objectAtIndexedSubscript:(unsigned int)idx;
+@end
+
+// Do not warn on objc classes has objectAtIndexedSubscript method.
+MyArray *test;
+void foo()
+{
+  unsigned int i;
+  for (i = 42; i > 0;) // No warnings here
+(void)test[--i];
+}
Index: lib/Sema/SemaStmt.cpp
===
--- lib/Sema/SemaStmt.cpp
+++ lib/Sema/SemaStmt.cpp
@@ -1440,6 +1440,19 @@
   FoundDecl = true;
 }
 
+void VisitPseudoObjectExpr(PseudoObjectExpr *POE) {
+  // Only need to visit the semantics for POE.
+  // SyntaticForm doesn't really use the Decal.
+  for (auto *S : POE->semantics()) {
+if (auto *OVE = dyn_cast(S)) {
+  // Look pass OVE for Decl.
+  if (Expr *E = OVE->getSourceExpr())
+Visit(E);
+} else
+  Visit(S);
+  }
+}
+
 bool FoundDeclInUse() { return FoundDecl; }
 
   };  // end class DeclMatcher
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17865: Add replacement = "xxx" to DeprecatedAttr.

2016-03-09 Thread Bob Wilson via cfe-commits
bob.wilson added a comment.

> I do like the explicit nature of this approach, but I'm worried about it 
> being too novel. For instance, would this compel GCC to implement a similar 
> parsing feature since they also support the deprecated attribute, that sort 
> of thing. Also, it feels like a bit of an odd design in C and C++ since 
> nothing else in the language supports argument passing by name like that (and 
> I would really hate to see us use = blah only to find out that C++ someday 
> standardizes on something different).


This makes sense to me. We also want to add this to the "availability" 
attribute, and since that already uses named arguments, I think we should use 
the "replacement=" syntax there.


http://reviews.llvm.org/D17865



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


Re: [PATCH] D16044: getDescriptiveName() for MemRegion

2016-03-09 Thread Alexander Droste via cfe-commits
Alexander_Droste added a comment.

Thanks for pointing this out. What's actually the best way to test the 
function? 
If I test this function with an integration test, I need to rely on a checker 
which uses the function to output diagnostics.
Is it possible to test this with a unit test? My assumption is that parts of 
the MemRegion would then need to be mocked.


http://reviews.llvm.org/D16044



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


Re: [PATCH] D17999: Rewrite ARM & AArch64 tests to check LLVM IR rather than assembly

2016-03-09 Thread Tim Northover via cfe-commits
On 9 March 2016 at 11:12, Sanjay Patel  wrote:
> Nothing to do with the patch itself (although it looks great and thanks!) - 
> is the CHECK line generator script available somewhere? I'd love to be able 
> to use that.

It's horribly hacky and fragile, but what I've got should be attached
here. Particular issues are:

  * Spotting where to put CHECK lines in the C file is bad and relies
on '{' being on the same line as the definition.
  * If a function argument name is an extension of a definition, the
2-pass substitution will go wrong. It really should actually look for
%-based tokens rather than just text.
  * No handling of basic blocks as values.

But, it mostly did the trick so it's not useless.

Cheers.

Tim.
import re, sys

C_FUNC_DEF = re.compile(r'([_a-zA-Z][_a-zA-Z0-9]*)\(.*{')
LL_FUNC_DEF = re.compile(r'define.*@(.*)\(')
VALUE_DEF = re.compile(r'\s+%(.*) =')

def get_value_name(var):
if var.isdigit():
var = 'TMP' + var
var = var.replace('.', '_')
return var.upper()

def get_value_definition(var):
return '[[' + get_value_name(var) + ':%.*]]'

def get_value_use(var):
return '[[' + get_value_name(var) + ']]'

def genericize_function(lines):
lines_with_def = []
vars_seen = []
for line in lines:
if line == 'entry:':
# Can't branch to %entry or really do anything useful with it, so
# skip the clutter.
continue

m = VALUE_DEF.match(line)
if m:
vars_seen.append(m.group(1))
line = line.replace('%' + m.group(1), get_value_definition(m.group(1)))

lines_with_def.append(line)

output_lines = []
vars_seen.sort(key=len, reverse=True)
for line in lines_with_def:
if not LL_FUNC_DEF.match(line):
for var in vars_seen:
line = line.replace('%' + var, get_value_use(var))
output_lines.append(line)

return output_lines

def add_checks(lines):
check_lines = ['// CHECK-LABEL: ' + lines[0]]
check_lines.extend('// CHECK: ' + line for line in lines[1:])
return check_lines

def create_test_dictionary(ll_file):
tests = {}
func_lines = []
in_func = ''
for line in ll_file:
if line == '}':
tests[in_func] = add_checks(genericize_function(func_lines))
continue

m = LL_FUNC_DEF.match(line)
if m:
func_lines = []
in_func = m.group(1)

func_lines.append(line)

return tests

def apply_test_dictionary(c_file, tests):
output_lines = []

for line in c_file:
m = C_FUNC_DEF.search(line)
if m and m.group(1) in tests:
for test_line in tests[m.group(1)]:
output_lines.append(test_line)
output_lines.append(line)
return output_lines

def main():
c_name = sys.argv[1]
ll_name = sys.argv[2]
out_name = sys.argv[3]

with open(sys.argv[2], 'r') as f:
ll_lines = f.read().split('\n')

tests = create_test_dictionary(ll_lines)

with open(sys.argv[1], 'r') as f:
c_lines = f.read().split('\n')

output_lines = apply_test_dictionary(c_lines, tests)

with open(sys.argv[3], 'w') as f:
f.write('\n'.join(output_lines))


if __name__ == '__main__':
main()


make_test.sh
Description: Bourne shell script
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18011: [modules] Diagnose insufficient privileges when trying to load the modulemap

2016-03-09 Thread Davide Italiano via cfe-commits
davide updated this revision to Diff 50181.
davide added a comment.

Typo.


http://reviews.llvm.org/D18011

Files:
  include/clang/Basic/DiagnosticFrontendKinds.td
  lib/Frontend/FrontendActions.cpp
  test/Modules/Inputs/insufficient-privileges.modulemap

Index: lib/Frontend/FrontendActions.cpp
===
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -272,7 +272,23 @@
   << Filename;
 return false;
   }
-  
+
+  // Emit a diagnostic if we can't read the module map.
+  vfs::Status Result;
+  bool S = CI.getFileManager().getNoncachedStatValue(Filename, Result);
+  if (!S) {
+llvm::sys::fs::perms P = Result.getPermissions();
+if (!(P & llvm::sys::fs::perms::all_read)) {
+  CI.getDiagnostics().Report(diag::err_module_map_wrong_perms)
+<< Filename;
+  return false;
+}
+  } else {
+CI.getDiagnostics().Report(diag::err_module_map_missing_stat)
+  << Filename;
+return false;
+  }
+
   // Set up embedding for any specified files. Do this before we load any
   // source files, including the primary module map for the compilation.
   for (const auto  : CI.getFrontendOpts().ModulesEmbedFiles) {
Index: include/clang/Basic/DiagnosticFrontendKinds.td
===
--- include/clang/Basic/DiagnosticFrontendKinds.td
+++ include/clang/Basic/DiagnosticFrontendKinds.td
@@ -179,6 +179,10 @@
   "compilation">, InGroup>, 
DefaultError;
 def err_module_map_not_found : Error<"module map file '%0' not found">, 
   DefaultFatal;
+def err_module_map_wrong_perms : Error<"insufficient privileges to read file 
'%0'">,
+  DefaultFatal;
+def err_module_map_missing_stat : Error<"cannot retrieve status infos for file 
'%0'">,
+  DefaultFatal;
 def err_missing_module_name : Error<
   "no module name provided; specify one with -fmodule-name=">, 
   DefaultFatal;


Index: lib/Frontend/FrontendActions.cpp
===
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -272,7 +272,23 @@
   << Filename;
 return false;
   }
-  
+
+  // Emit a diagnostic if we can't read the module map.
+  vfs::Status Result;
+  bool S = CI.getFileManager().getNoncachedStatValue(Filename, Result);
+  if (!S) {
+llvm::sys::fs::perms P = Result.getPermissions();
+if (!(P & llvm::sys::fs::perms::all_read)) {
+  CI.getDiagnostics().Report(diag::err_module_map_wrong_perms)
+<< Filename;
+  return false;
+}
+  } else {
+CI.getDiagnostics().Report(diag::err_module_map_missing_stat)
+  << Filename;
+return false;
+  }
+
   // Set up embedding for any specified files. Do this before we load any
   // source files, including the primary module map for the compilation.
   for (const auto  : CI.getFrontendOpts().ModulesEmbedFiles) {
Index: include/clang/Basic/DiagnosticFrontendKinds.td
===
--- include/clang/Basic/DiagnosticFrontendKinds.td
+++ include/clang/Basic/DiagnosticFrontendKinds.td
@@ -179,6 +179,10 @@
   "compilation">, InGroup>, DefaultError;
 def err_module_map_not_found : Error<"module map file '%0' not found">, 
   DefaultFatal;
+def err_module_map_wrong_perms : Error<"insufficient privileges to read file '%0'">,
+  DefaultFatal;
+def err_module_map_missing_stat : Error<"cannot retrieve status infos for file '%0'">,
+  DefaultFatal;
 def err_missing_module_name : Error<
   "no module name provided; specify one with -fmodule-name=">, 
   DefaultFatal;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D18011: [modules] Diagnose insufficient privileges when trying to load the modulemap

2016-03-09 Thread Davide Italiano via cfe-commits
davide created this revision.
davide added reviewers: rsmith, silvas, doug.gregor.
davide added a subscriber: cfe-commits.

I stumbled upon this yesterday. Without this patch in palce, the module map 
load is silently ignored, and this might cause subtle breakages.

http://reviews.llvm.org/D18011

Files:
  include/clang/Basic/DiagnosticFrontendKinds.td
  lib/Frontend/FrontendActions.cpp
  test/Modules/Inputs/insufficient-privileges.modulemap

Index: lib/Frontend/FrontendActions.cpp
===
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -272,7 +272,23 @@
   << Filename;
 return false;
   }
-  
+
+  // Emit a diagnostic if we can't read the source map.
+  vfs::Status Result;
+  bool S = CI.getFileManager().getNoncachedStatValue(Filename, Result);
+  if (!S) {
+llvm::sys::fs::perms P = Result.getPermissions();
+if (!(P & llvm::sys::fs::perms::all_read)) {
+  CI.getDiagnostics().Report(diag::err_module_map_wrong_perms)
+<< Filename;
+  return false;
+}
+  } else {
+CI.getDiagnostics().Report(diag::err_module_map_missing_stat)
+  << Filename;
+return false;
+  }
+
   // Set up embedding for any specified files. Do this before we load any
   // source files, including the primary module map for the compilation.
   for (const auto  : CI.getFrontendOpts().ModulesEmbedFiles) {
Index: include/clang/Basic/DiagnosticFrontendKinds.td
===
--- include/clang/Basic/DiagnosticFrontendKinds.td
+++ include/clang/Basic/DiagnosticFrontendKinds.td
@@ -179,6 +179,10 @@
   "compilation">, InGroup>, 
DefaultError;
 def err_module_map_not_found : Error<"module map file '%0' not found">, 
   DefaultFatal;
+def err_module_map_wrong_perms : Error<"insufficient privileges to read file 
'%0'">,
+  DefaultFatal;
+def err_module_map_missing_stat : Error<"cannot retrieve status infos for file 
'%0'">,
+  DefaultFatal;
 def err_missing_module_name : Error<
   "no module name provided; specify one with -fmodule-name=">, 
   DefaultFatal;


Index: lib/Frontend/FrontendActions.cpp
===
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -272,7 +272,23 @@
   << Filename;
 return false;
   }
-  
+
+  // Emit a diagnostic if we can't read the source map.
+  vfs::Status Result;
+  bool S = CI.getFileManager().getNoncachedStatValue(Filename, Result);
+  if (!S) {
+llvm::sys::fs::perms P = Result.getPermissions();
+if (!(P & llvm::sys::fs::perms::all_read)) {
+  CI.getDiagnostics().Report(diag::err_module_map_wrong_perms)
+<< Filename;
+  return false;
+}
+  } else {
+CI.getDiagnostics().Report(diag::err_module_map_missing_stat)
+  << Filename;
+return false;
+  }
+
   // Set up embedding for any specified files. Do this before we load any
   // source files, including the primary module map for the compilation.
   for (const auto  : CI.getFrontendOpts().ModulesEmbedFiles) {
Index: include/clang/Basic/DiagnosticFrontendKinds.td
===
--- include/clang/Basic/DiagnosticFrontendKinds.td
+++ include/clang/Basic/DiagnosticFrontendKinds.td
@@ -179,6 +179,10 @@
   "compilation">, InGroup>, DefaultError;
 def err_module_map_not_found : Error<"module map file '%0' not found">, 
   DefaultFatal;
+def err_module_map_wrong_perms : Error<"insufficient privileges to read file '%0'">,
+  DefaultFatal;
+def err_module_map_missing_stat : Error<"cannot retrieve status infos for file '%0'">,
+  DefaultFatal;
 def err_missing_module_name : Error<
   "no module name provided; specify one with -fmodule-name=">, 
   DefaultFatal;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17983: Eliminate many benign instances of "potentially uninitialized local variable" warnings

2016-03-09 Thread Alexander Riccio via cfe-commits
ariccio added a comment.

Oh, and by the way, what's the policy on using `enum class`es instead of C 
style enums? I bet the compiler would have fewer false positives with strongly 
typed enums?


http://reviews.llvm.org/D17983



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


Re: [PATCH] D17983: Eliminate many benign instances of "potentially uninitialized local variable" warnings

2016-03-09 Thread Alexander Riccio via cfe-commits
ariccio added a comment.

In http://reviews.llvm.org/D17983#370717, @dblaikie wrote:

> Initializations we never expect to use (eg because we have a covered switch
>  that initializes in all cases, or some slightly complex control flow the
>  compiler can't see through) hinder our ability to find uses of those with
>  tools like msan.


Too bad... Maybe msan should have a way to specify that you're default 
initializing a variable, and treat it as if you're not initializing it at all?

That said, I'm not sure that I agree with keeping `Potentially uninitialized 
local pointer variable 'name' used` off (//that's C4703 
, not C4701 
//), because 
uninitialized local pointer bugs are more dangerous (I'm thinking 

 of write-what-where 

 uninitialized pointer vulnerabilities 
),
 and I'd rather crash on a nullptr deref than some undefined behavior.

I will drop the `default` cases as @dsanders noted, but should I drop all the 
local variable inits too? In several cases (which I didn't specifically note) I 
chose default initialization values that would trigger pre-existing `assert`s 
if nobody assigned anything else to them.

Regarding the 33 warnings I noted, i couldn't tell whether they're obviously 
false positives, which I think warrants someone other than me carefully looking 
through it. Some of the warnings are caused by assigning to a variable inside 
of a loop with a dynamically sized bound; for those, I'd much rather (a) 
`assert` that the bound is nonzero/loop will be executed at least once, or (b) 
assign the variable some sentinel value, and then assert it before the variable 
is actually used. Thoughts?


http://reviews.llvm.org/D17983



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


Re: [PATCH] D17865: Add replacement = "xxx" to DeprecatedAttr.

2016-03-09 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

In http://reviews.llvm.org/D17865#370912, @manmanren wrote:

> Hi Aaron,
>
> Thanks for the review!
>
> > I like the idea of a potential fixit being provided by the attribute, but I 
> > do not agree with the way the feature is surfaced in this patch.
>
> > 
>
> > For the GNU-style attribute, the named argument functionality is 
> > sufficiently novel syntax that I would strongly like to avoid it, 
> > especially since __attribute__((deprecated)) is supported by multiple 
> > compilers.
>
>
> I suggested `replacement = ""` mostly for its explicitness, especially when 
> we already have an optional message argument "".
>  If a user only want to specify replacement without a message, we can say 
> deprecated(replacement = "xxx")
>  With 'replacement =`, the user will need to specify an empty message.


I do like the explicit nature of this approach, but I'm worried about it being 
too novel. For instance, would this compel GCC to implement a similar parsing 
feature since they also support the deprecated attribute, that sort of thing. 
Also, it feels like a bit of an odd design in C and C++ since nothing else in 
the language supports argument passing by name like that (and I would really 
hate to see us use = blah only to find out that C++ someday standardizes on 
something different).

> But your concern makes sense too. We can support the following:

>  deprecated("xxx") --> a message

>  deprecated("xxx, "fixit") --> a message and a fixit


I think this is the correct approach, even with multiple optional arguments.

> > We should not be adding this functionality to the C++-style attribute in 
> > the gnu namespace; that's not our vendor namespace to modify.

> 

> 

> I believe the patch currently does not change the C++-style attribute. Of 
> course, I should add testing cases to verify.


I believe the patch does change the C++-style attribute in the gnu namespace, 
as best I can tell. e.g., it would now allow: ``[[gnu::deprecated("something", 
"a fixit")]]``. We need to be careful not to allow this unless GCC allows the 
same syntax, otherwise we are hijacking their vendor attribute namespace with 
something incompatible.

>   I wouldn't be opposed to adding a clang namespace where we support this 
> feature, however.

> 

> > We definitely need to make sure we are not modifying the functionality for 
> > the C++ standards-based attribute

> 

> 

> Is this ("the C++ standards-based attribute") the same as "the C++-style 
> attribute" you mentioned above?


This is talking about the C++14 [[deprecated]] attribute. We want to make sure 
we don't allow [[deprecated("foo", "fixit")]], which I don't think your patch 
does (but we should have tests ensuring it).

> , or the __declspec based attribute (for pretty printing, as well as parsing, 
> etc).

>  Yes, I should add testing cases to make sure __declspec is not changed at 
> all with this patch.

> 

> > So this change is missing a lot of tests to make sure we do not support 
> > this feature in places where it doesn't belong.

> 





http://reviews.llvm.org/D17865



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


r263052 - NFC fix documentation build by rL263015

2016-03-09 Thread Dmitry Polukhin via cfe-commits
Author: dpolukhin
Date: Wed Mar  9 13:39:16 2016
New Revision: 263052

URL: http://llvm.org/viewvc/llvm-project?rev=263052=rev
Log:
NFC fix documentation build by rL263015

This time I hope it will fix the build for real.

Modified:
cfe/trunk/docs/ItaniumMangleAbiTags.rst
cfe/trunk/docs/index.rst

Modified: cfe/trunk/docs/ItaniumMangleAbiTags.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ItaniumMangleAbiTags.rst?rev=263052=263051=263052=diff
==
--- cfe/trunk/docs/ItaniumMangleAbiTags.rst (original)
+++ cfe/trunk/docs/ItaniumMangleAbiTags.rst Wed Mar  9 13:39:16 2016
@@ -33,15 +33,18 @@ the same  the  ::= *   # sort by name
  ::= B 
 
 Example:
 
+.. code-block:: c++
+
 __attribute__((abi_tag("test")))
 void Func();
-
-gets mangled as: _Z4FuncB4testv (prettified as `Func[abi:test]()`)
+// gets mangled as: _Z4FuncB4testv (prettified as `Func[abi:test]()`)
 
 Active tags
 ===
@@ -52,6 +55,8 @@ enum), the explicit tags are the active
 For variables and functions, the active tags are the explicit tags plus any
 "required tags" which are not in the "available tags" set:
 
+.. code-block:: none
+
 derived-tags := (required-tags - available-tags)
 active-tags := explicit-tags + derived-tags
 
@@ -68,15 +73,16 @@ Otherwise the function requires any impl
 for the return type.
 
 Example:
+
+.. code-block:: c++
+
 namespace A {
   inline namespace B __attribute__((abi_tag)) {
 struct C { int x; };
   }
 }
 
-A::C foo();
-
-gets mangled as: _Z3fooB1Bv (prettified as `foo[abi:B]()`)
+A::C foo(); // gets mangled as: _Z3fooB1Bv (prettified as `foo[abi:B]()`)
 
 Required tags for a variable
 
@@ -99,4 +105,3 @@ in the type of a cast operator) are NOT
 Example: a cast operator to std::string (which is
 std::__cxx11::basic_string<...>) will use 'cxx11' as an active tag, as it is
 required from the return type `std::string` but not available.
-

Modified: cfe/trunk/docs/index.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/index.rst?rev=263052=263051=263052=diff
==
--- cfe/trunk/docs/index.rst (original)
+++ cfe/trunk/docs/index.rst Wed Mar  9 13:39:16 2016
@@ -76,6 +76,7 @@ Design Documents
DriverInternals
PTHInternals
PCHInternals
+   ItaniumMangleAbiTags
 
 
 Indices and tables


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


Re: [PATCH] D17816: [PPC] FE support for generating VSX [negated] absolute value instructions

2016-03-09 Thread Kit Barton via cfe-commits
kbarton closed this revision.
kbarton added a comment.

Committed r263051


http://reviews.llvm.org/D17816



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


r263051 - [PPC] FE support for generating VSX [negated] absolute value instructions

2016-03-09 Thread Kit Barton via cfe-commits
Author: kbarton
Date: Wed Mar  9 13:28:31 2016
New Revision: 263051

URL: http://llvm.org/viewvc/llvm-project?rev=263051=rev
Log:
[PPC] FE support for generating VSX [negated] absolute value instructions

Includes new built-in, conversion of built-in to target-independent intrinsic
and update in the header file. Tests are also updated. There is a second part in
the backend for which I will post a separate code-review. BACKEND PART SHOULD BE
COMMITTED FIRST.

Phabricator: http://reviews.llvm.org/D17816

Modified:
cfe/trunk/include/clang/Basic/BuiltinsPPC.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Headers/altivec.h
cfe/trunk/test/CodeGen/builtins-ppc-altivec.c
cfe/trunk/test/CodeGen/builtins-ppc-p8vector.c
cfe/trunk/test/CodeGen/builtins-ppc-vsx.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsPPC.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsPPC.def?rev=263051=263050=263051=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsPPC.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsPPC.def Wed Mar  9 13:28:31 2016
@@ -336,6 +336,9 @@ BUILTIN(__builtin_vsx_xxleqv, "V4UiV4UiV
 BUILTIN(__builtin_vsx_xvcpsgndp, "V2dV2dV2d", "")
 BUILTIN(__builtin_vsx_xvcpsgnsp, "V4fV4fV4f", "")
 
+BUILTIN(__builtin_vsx_xvabssp, "V4fV4f", "")
+BUILTIN(__builtin_vsx_xvabsdp, "V2dV2d", "")
+
 // HTM builtins
 BUILTIN(__builtin_tbegin, "UiUIi", "")
 BUILTIN(__builtin_tend, "UiUIi", "")

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=263051=263050=263051=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Wed Mar  9 13:28:31 2016
@@ -6992,6 +6992,16 @@ Value *CodeGenFunction::EmitPPCBuiltinEx
 llvm::Function *F = CGM.getIntrinsic(ID, ResultType);
 return Builder.CreateCall(F, X);
   }
+
+  // Absolute value
+  case PPC::BI__builtin_vsx_xvabsdp:
+  case PPC::BI__builtin_vsx_xvabssp: {
+llvm::Type *ResultType = ConvertType(E->getType());
+Value *X = EmitScalarExpr(E->getArg(0));
+llvm::Function *F = CGM.getIntrinsic(Intrinsic::fabs, ResultType);
+return Builder.CreateCall(F, X);
+  }
+
   // FMA variations
   case PPC::BI__builtin_vsx_xvmaddadp:
   case PPC::BI__builtin_vsx_xvmaddasp:

Modified: cfe/trunk/lib/Headers/altivec.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/altivec.h?rev=263051=263050=263051=diff
==
--- cfe/trunk/lib/Headers/altivec.h (original)
+++ cfe/trunk/lib/Headers/altivec.h Wed Mar  9 13:28:31 2016
@@ -124,16 +124,18 @@ vec_abs(vector signed long long __a) {
 #endif
 
 static vector float __ATTRS_o_ai vec_abs(vector float __a) {
+#ifdef __VSX__
+  return __builtin_vsx_xvabssp(__a);
+#else
   vector unsigned int __res =
   (vector unsigned int)__a & (vector unsigned int)(0x7FFF);
   return (vector float)__res;
+#endif
 }
 
 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
 static vector double __ATTRS_o_ai vec_abs(vector double __a) {
-  vector unsigned long long __res = { 0x7FFF, 0x7FFF };
-  __res &= (vector unsigned int)__a;
-  return (vector double)__res;
+  return __builtin_vsx_xvabsdp(__a);
 }
 #endif
 

Modified: cfe/trunk/test/CodeGen/builtins-ppc-altivec.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-ppc-altivec.c?rev=263051=263050=263051=diff
==
--- cfe/trunk/test/CodeGen/builtins-ppc-altivec.c (original)
+++ cfe/trunk/test/CodeGen/builtins-ppc-altivec.c Wed Mar  9 13:28:31 2016
@@ -1,7 +1,13 @@
 // REQUIRES: powerpc-registered-target
-// RUN: %clang_cc1 -faltivec -triple powerpc-unknown-unknown -emit-llvm %s -o 
- | FileCheck %s
-// RUN: %clang_cc1 -faltivec -triple powerpc64-unknown-unknown -emit-llvm %s 
-o - | FileCheck %s
-// RUN: %clang_cc1 -faltivec -triple powerpc64le-unknown-unknown -emit-llvm %s 
-o - | FileCheck %s -check-prefix=CHECK-LE
+// RUN: %clang_cc1 -faltivec -triple powerpc-unknown-unknown -emit-llvm %s \
+// RUN:-o - | FileCheck %s
+// RUN: %clang_cc1 -faltivec -triple powerpc64-unknown-unknown -emit-llvm %s \
+// RUN:-o - | FileCheck %s
+// RUN: %clang_cc1 -faltivec -triple powerpc64le-unknown-unknown -emit-llvm %s 
\
+// RUN:-o - | FileCheck %s -check-prefix=CHECK-LE
+// RUN: not %clang_cc1 -triple powerpc64le-unknown-unknown -emit-llvm %s \
+// RUN:-ferror-limit 0 -o - 2>&1 \
+// RUN:| FileCheck %s -check-prefix=CHECK-NOALTIVEC
 
 vector bool char vbc = { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 };
 vector signed char vsc = { 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, 
-14, 15, -16 };
@@ -27,6 +33,8 @@ 

Re: [PATCH] D17627: Fix false positives for for-loop-analysis warning

2016-03-09 Thread John McCall via cfe-commits
rjmccall added a comment.

The right fix is probably at the PseudoObjectExpr level; you should probably be 
looking at the semantic expressions instead of the syntactic.


http://reviews.llvm.org/D17627



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


Re: [PATCH] D17993: [CodeGen] Apply 'nonnull' to 'this' pointer arguments.

2016-03-09 Thread John McCall via cfe-commits
rjmccall added a comment.

Well, no, we can do it under a different flag and just ensure that 
-fno-delete-null-pointer-checks *also* has the effect of disabling the 
optimization.

But you are not inspiring to disagree with Chandler about whether this 
optimization should be enabled by default.


http://reviews.llvm.org/D17993



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


Re: [PATCH] D17993: [CodeGen] Apply 'nonnull' to 'this' pointer arguments.

2016-03-09 Thread John McCall via cfe-commits
rjmccall added a comment.

Er, sorry.  You are not inspiring *me* to disagree with Chandler.


http://reviews.llvm.org/D17993



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


Re: [PATCH] D17999: Rewrite ARM & AArch64 tests to check LLVM IR rather than assembly

2016-03-09 Thread Sanjay Patel via cfe-commits
spatel added a subscriber: spatel.
spatel added a comment.

Nothing to do with the patch itself (although it looks great and thanks!) - is 
the CHECK line generator script available somewhere? I'd love to be able to use 
that.


http://reviews.llvm.org/D17999



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


Re: [PATCH] D17865: Add replacement = "xxx" to DeprecatedAttr.

2016-03-09 Thread Manman Ren via cfe-commits
manmanren added a comment.

Hi Aaron,

Thanks for the review!

> I like the idea of a potential fixit being provided by the attribute, but I 
> do not agree with the way the feature is surfaced in this patch.

> 

> For the GNU-style attribute, the named argument functionality is sufficiently 
> novel syntax that I would strongly like to avoid it, especially since 
> __attribute__((deprecated)) is supported by multiple compilers.


I suggested `replacement = ""` mostly for its explicitness, especially when we 
already have an optional message argument "".
If a user only want to specify replacement without a message, we can say 
deprecated(replacement = "xxx")
With 'replacement =`, the user will need to specify an empty message.
But your concern makes sense too. We can support the following:
deprecated("xxx") --> a message
deprecated("xxx, "fixit") --> a message and a fixit

> We should not be adding this functionality to the C++-style attribute in the 
> gnu namespace; that's not our vendor namespace to modify.


I believe the patch currently does not change the C++-style attribute. Of 
course, I should add testing cases to verify.

I wouldn't be opposed to adding a clang namespace where we support this 
feature, however.

> We definitely need to make sure we are not modifying the functionality for 
> the C++ standards-based attribute


Is this ("the C++ standards-based attribute") the same as "the C++-style 
attribute" you mentioned above?

, or the __declspec based attribute (for pretty printing, as well as parsing, 
etc).
Yes, I should add testing cases to make sure __declspec is not changed at all 
with this patch.

> So this change is missing a lot of tests to make sure we do not support this 
> feature in places where it doesn't belong.




Comment at: include/clang/Basic/Attr.td:716
@@ -715,2 +715,3 @@
+  StringArgument<"Replacement", 1>];
   let Documentation = [Undocumented];
 }

aaron.ballman wrote:
> Would you mind adding some documentation to the attribute since we're 
> changing it?
Yes, I should.


Comment at: lib/Parse/ParseDecl.cpp:1048
@@ +1047,3 @@
+/// \brief Parse the contents of the "deprecated" attribute.
+unsigned Parser::ParseDeprecatedAttribute(IdentifierInfo ,
+  SourceLocation DeprecatedLoc,

aaron.ballman wrote:
> This also gets called for attributes parsed in the gnu:: namespace, which 
> means that you are modifying the behavior of gnu::deprecated(), which we 
> should not do unless GCC also supports this feature.
Yes, I will fix this.


Comment at: lib/Parse/ParseDecl.cpp:1068
@@ +1067,3 @@
+if (Keyword != Ident_replacement) {
+}
+

aaron.ballman wrote:
> I assume this was meant to do something useful?
Yes, I should emit a diagnostic.


Comment at: lib/Sema/SemaDeclAttr.cpp:5074
@@ +5073,3 @@
+  StringRef Str, Replacement;
+  if ((Attr.isArgExpr(0) && Attr.getArgAsExpr(0) &&
+   !S.checkStringLiteralArgumentAttr(Attr, 0, Str))||

aaron.ballman wrote:
> This check should be moved above the extension warning above -- we only want 
> to diagnose the extension if the attribute is actually applied.
Agree.


Comment at: test/SemaCXX/cxx11-attr-print.cpp:16
@@ -15,3 +15,3 @@
 
-// CHECK: int b {{\[}}[gnu::deprecated("warning")]];
+// CHECK: int b {{\[}}[gnu::deprecated("warning", "")]];
 int b [[gnu::deprecated("warning")]];

aaron.ballman wrote:
> This is a bug; we should not be hijacking the gnu attribute space.
Yes, I will fix this.


Comment at: test/SemaCXX/cxx11-attr-print.cpp:18
@@ -17,2 +17,3 @@
 int b [[gnu::deprecated("warning")]];
 
+// CHECK: __attribute__((deprecated("", "")));

aaron.ballman wrote:
> I would like a test that verifies we don't print an empty fixit literal when 
> using the C++14 `[[deprecated]]` attribute. Same for `__declspec(deprecated)`.
Will do.


http://reviews.llvm.org/D17865



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


Re: [PATCH] D17999: Rewrite ARM & AArch64 tests to check LLVM IR rather than assembly

2016-03-09 Thread Tim Northover via cfe-commits
t.p.northover closed this revision.
t.p.northover added a comment.

Thanks Eric. Committed as r263048.


http://reviews.llvm.org/D17999



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


r263048 - ARM & AArch64: convert asm tests to LLVM IR and restrict optimizations.

2016-03-09 Thread Tim Northover via cfe-commits
Modified: cfe/trunk/test/CodeGen/builtins-arm-exclusive.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-arm-exclusive.c?rev=263048=263047=263048=diff
==
--- cfe/trunk/test/CodeGen/builtins-arm-exclusive.c (original)
+++ cfe/trunk/test/CodeGen/builtins-arm-exclusive.c Wed Mar  9 12:54:42 2016
@@ -1,32 +1,6 @@
-// REQUIRES: arm-registered-target
-// RUN: %clang_cc1 -Wall -Werror -triple thumbv8-linux-gnueabi 
-fno-signed-char -O3 -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -Wall -Werror -triple arm64-apple-ios7.0 -O3 -emit-llvm -o 
- %s | FileCheck %s --check-prefix=CHECK-ARM64
-
-// Make sure the canonical use works before going into smaller details:
-int atomic_inc(int *addr) {
-  int Failure, OldVal;
-  do {
-OldVal = __builtin_arm_ldrex(addr);
-Failure = __builtin_arm_strex(OldVal + 1, addr);
-  } while (Failure);
+// RUN: %clang_cc1 -Wall -Werror -triple thumbv8-linux-gnueabi 
-fno-signed-char -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
+// RUN: %clang_cc1 -Wall -Werror -triple arm64-apple-ios7.0 -emit-llvm -o - %s 
| opt -S -mem2reg | FileCheck %s --check-prefix=CHECK-ARM64
 
-  return OldVal;
-}
-
-// CHECK-LABEL: @atomic_inc
-// CHECK:   [[OLDVAL:%.*]] = tail call i32 @llvm.arm.ldrex.p0i32(i32* %addr)
-// CHECK:   [[INC:%.*]] = add nsw i32 [[OLDVAL]], 1
-// CHECK:   [[FAILURE:%.*]] = tail call i32 @llvm.arm.strex.p0i32(i32 [[INC]], 
i32* %addr)
-// CHECK:   [[TST:%.*]] = icmp eq i32 [[FAILURE]], 0
-// CHECK:   br i1 [[TST]], label {{%[a-zA-Z0-9.]+}}, label {{%[a-zA-Z0-9.]+}}
-
-// CHECK-ARM64-LABEL: @atomic_inc
-// CHECK-ARM64:   [[OLDVAL:%.*]] = tail call i64 @llvm.aarch64.ldxr.p0i32(i32* 
%addr)
-// CHECK-ARM64:   [[INC:%.*]] = add i64 [[OLDVAL]], 1
-// CHECK-ARM64:   [[TRUNC:%.*]] = and i64 [[INC]], 4294967295
-// CHECK-ARM64:   [[FAILURE:%.*]] = tail call i32 @llvm.aarch64.stxr.p0i32(i64 
[[TRUNC]], i32* %addr)
-// CHECK-ARM64:   [[TST:%.*]] = icmp eq i32 [[FAILURE]], 0
-// CHECK-ARM64:   br i1 [[TST]], label {{%[a-zA-Z0-9.]+}}, label 
{{%[a-zA-Z0-9.]+}}
 
 struct Simple {
   char a, b;
@@ -37,36 +11,33 @@ int test_ldrex(char *addr, long long *ad
 // CHECK-ARM64-LABEL: @test_ldrex
   int sum = 0;
   sum += __builtin_arm_ldrex(addr);
-// CHECK: [[INTRES:%.*]] = tail call i32 @llvm.arm.ldrex.p0i8(i8* %addr)
-// CHECK: and i32 [[INTRES]], 255
+// CHECK: [[INTRES:%.*]] = call i32 @llvm.arm.ldrex.p0i8(i8* %addr)
+// CHECK: trunc i32 [[INTRES]] to i8
 
-// CHECK-ARM64: [[INTRES:%.*]] = tail call i64 @llvm.aarch64.ldxr.p0i8(i8* 
%addr)
-// CHECK-ARM64: [[TRUNCRES:%.*]] = trunc i64 [[INTRES]] to i32
-// CHECK-ARM64: [[SEXTTMP:%.*]] = shl i32 [[TRUNCRES]], 24
-// CHECK-ARM64: ashr exact i32 [[SEXTTMP]], 24
+// CHECK-ARM64: [[INTRES:%.*]] = call i64 @llvm.aarch64.ldxr.p0i8(i8* %addr)
+// CHECK-ARM64: trunc i64 [[INTRES]] to i8
 
   sum += __builtin_arm_ldrex((short *)addr);
 // CHECK: [[ADDR16:%.*]] = bitcast i8* %addr to i16*
-// CHECK: [[INTRES:%.*]] = tail call i32 @llvm.arm.ldrex.p0i16(i16* [[ADDR16]])
-// CHECK: [[TMPSEXT:%.*]] = shl i32 [[INTRES]], 16
-// CHECK: ashr exact i32 [[TMPSEXT]], 16
+// CHECK: [[INTRES:%.*]] = call i32 @llvm.arm.ldrex.p0i16(i16* [[ADDR16]])
+// CHECK: trunc i32 [[INTRES]] to i16
 
 // CHECK-ARM64: [[ADDR16:%.*]] = bitcast i8* %addr to i16*
-// CHECK-ARM64: [[INTRES:%.*]] = tail call i64 @llvm.aarch64.ldxr.p0i16(i16* 
[[ADDR16]])
-// CHECK-ARM64: [[TRUNCRES:%.*]] = trunc i64 [[INTRES]] to i32
-// CHECK-ARM64: [[TMPSEXT:%.*]] = shl i32 [[TRUNCRES]], 16
-// CHECK-ARM64: ashr exact i32 [[TMPSEXT]], 16
+// CHECK-ARM64: [[INTRES:%.*]] = call i64 @llvm.aarch64.ldxr.p0i16(i16* 
[[ADDR16]])
+// CHECK-ARM64: trunc i64 [[INTRES]] to i16
 
   sum += __builtin_arm_ldrex((int *)addr);
 // CHECK: [[ADDR32:%.*]] = bitcast i8* %addr to i32*
-// CHECK:  call i32 @llvm.arm.ldrex.p0i32(i32* [[ADDR32]])
+// CHECK: call i32 @llvm.arm.ldrex.p0i32(i32* [[ADDR32]])
 
 // CHECK-ARM64: [[ADDR32:%.*]] = bitcast i8* %addr to i32*
-// CHECK-ARM64: [[INTRES:%.*]] = tail call i64 @llvm.aarch64.ldxr.p0i32(i32* 
[[ADDR32]])
+// CHECK-ARM64: [[INTRES:%.*]] = call i64 @llvm.aarch64.ldxr.p0i32(i32* 
[[ADDR32]])
 // CHECK-ARM64: trunc i64 [[INTRES]] to i32
 
   sum += __builtin_arm_ldrex((long long *)addr);
-// CHECK: call { i32, i32 } @llvm.arm.ldrexd(i8* %addr)
+// CHECK: [[TMP4:%.*]] = bitcast i8* %addr to i64*
+// CHECK: [[TMP5:%.*]] = bitcast i64* [[TMP4]] to i8*
+// CHECK: call { i32, i32 } @llvm.arm.ldrexd(i8* [[TMP5]])
 
 // CHECK-ARM64: [[ADDR64:%.*]] = bitcast i8* %addr to i64*
 // CHECK-ARM64: call i64 @llvm.aarch64.ldxr.p0i64(i64* [[ADDR64]])
@@ -79,16 +50,18 @@ int test_ldrex(char *addr, long long *ad
 
   sum += __builtin_arm_ldrex(addrfloat);
 // CHECK: [[INTADDR:%.*]] = bitcast float* %addrfloat to i32*
-// CHECK: [[INTRES:%.*]] = tail call i32 @llvm.arm.ldrex.p0i32(i32* 
[[INTADDR]])
+// CHECK: [[INTRES:%.*]] = call i32 @llvm.arm.ldrex.p0i32(i32* [[INTADDR]])
 // 

Re: [PATCH] D17861: [OpenCL] Accept __attribute__((nosvm))

2016-03-09 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: include/clang/Basic/Attr.td:701
@@ -699,1 +700,3 @@
 
+def OpenCLNoSVM : Attr {
+  let Spellings = [GNU<"nosvm">];

yaxunl wrote:
> aaron.ballman wrote:
> > Since the attribute is ignored by clang, you should inherit from 
> > IgnoredAttr.
> I tried that from beginning. If I inherit from IgnoredAttr, it seems to be 
> ignored by the parser and won't reach the sema check part, and I cannot emit 
> error msg based on OpenCL version.
Ah. so it isn't *totally* ignored. Okay, in that case, you should set ASTNode = 
0 and SemaHandler = 0.


Repository:
  rL LLVM

http://reviews.llvm.org/D17861



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


Re: [PATCH] D17999: Rewrite ARM & AArch64 tests to check LLVM IR rather than assembly

2016-03-09 Thread Eric Christopher via cfe-commits
echristo added a subscriber: echristo.
echristo accepted this revision.
echristo added a reviewer: echristo.
echristo added a comment.
This revision is now accepted and ready to land.

This is a compromise I can live with :)

Thanks for doing this Tim.

-eric


http://reviews.llvm.org/D17999



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


Re: [PATCH] D17993: [CodeGen] Apply 'nonnull' to 'this' pointer arguments.

2016-03-09 Thread Benjamin Kramer via cfe-commits
bkramer added a comment.

GCC 6 is already doing this and people are already annotating their builds with 
-fno-delete-null-pointer-checks. Putting it under a different flag will break 
compatibility there :(


http://reviews.llvm.org/D17993



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


Re: [PATCH] D17861: [OpenCL] Accept __attribute__((nosvm))

2016-03-09 Thread Yaxun Liu via cfe-commits
yaxunl marked 7 inline comments as done.


Comment at: include/clang/Basic/Attr.td:701
@@ -699,1 +700,3 @@
 
+def OpenCLNoSVM : Attr {
+  let Spellings = [GNU<"nosvm">];

aaron.ballman wrote:
> Since the attribute is ignored by clang, you should inherit from IgnoredAttr.
I tried that from beginning. If I inherit from IgnoredAttr, it seems to be 
ignored by the parser and won't reach the sema check part, and I cannot emit 
error msg based on OpenCL version.


Repository:
  rL LLVM

http://reviews.llvm.org/D17861



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


Re: [PATCH] D17861: [OpenCL] Accept __attribute__((nosvm))

2016-03-09 Thread Aaron Ballman via cfe-commits
aaron.ballman added a subscriber: aaron.ballman.
aaron.ballman added a reviewer: aaron.ballman.


Comment at: include/clang/Basic/Attr.td:701
@@ -699,1 +700,3 @@
 
+def OpenCLNoSVM : Attr {
+  let Spellings = [GNU<"nosvm">];

Since the attribute is ignored by clang, you should inherit from IgnoredAttr.


Repository:
  rL LLVM

http://reviews.llvm.org/D17861



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


Re: [PATCH] D15944: [OpenMP] Parsing and sema support for target update directive

2016-03-09 Thread Samuel Antao via cfe-commits
sfantao added a comment.

Hi Kelvin,

Thanks for working on this! I have some minor comments inlined.



Comment at: lib/Sema/SemaOpenMP.cpp:9392
@@ +9391,3 @@
+  SemaRef.Diag(ELoc, diag::err_omp_map_shared_storage) << ERange;
+else
+  SemaRef.Diag(ELoc, 

I'd add an assertion here to make sure CKind is To/Form.


Comment at: lib/Sema/SemaOpenMP.cpp:9452
@@ +9451,3 @@
+  else
+SemaRef.Diag(ELoc, 
+ diag::err_omp_once_referenced_in_target_update)

Same thing.


Comment at: lib/Sema/SemaOpenMP.cpp:10045
@@ +10044,3 @@
+ SourceLocation EndLoc) {
+  SmallVector Vars;
+  for (auto  : VarList) {

Given that these checks are the same, I think it would be better to outline the 
map clause implementation to some static function and pass the clause kind 
along. Only a few map-specific things would have to be guarded with the kind.


Comment at: lib/Sema/SemaOpenMP.cpp:10108
@@ +10107,3 @@
+// environment, because the restrictions are different.
+if (CheckMapConflicts(*this, DSAStack, D, SimpleExpr,
+  /*CurrentRegionOnly=*/true, OMPC_to))

You should update the comment. The conflicts are not with the map clause but 
with to/from clauses of the same constructs. You can still say, that the 
concerns here are the same as in map clauses so you can reuse the same checks.


Comment at: lib/Sema/SemaOpenMP.cpp:10202
@@ +10201,3 @@
+// environment, because the restrictions are different.
+if (CheckMapConflicts(*this, DSAStack, D, SimpleExpr,
+  /*CurrentRegionOnly=*/true, OMPC_from))

Same thing here.


http://reviews.llvm.org/D15944



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


Re: [PATCH] D17861: [OpenCL] Accept __attribute__((nosvm))

2016-03-09 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: test/SemaOpenCL/nosvm.cl:9
@@ +8,3 @@
+#else
+void f(__attribute__((nosvm)) int* a); // expected-warning {{'nosvm' attribute 
ignored}}
+#endif

yaxunl wrote:
> Anastasia wrote:
> > yaxunl wrote:
> > > yaxunl wrote:
> > > > Anastasia wrote:
> > > > > It seems like it makes nosvm available for C and earlier standards of 
> > > > > OpenCL too?
> > > > > 
> > > > > Doesn't feel right. :(
> > > > Before my change, the original behavior of Clang is to emits a warning 
> > > > for any unknown GNU attribute, e.g.
> > > > unknown 'nosvm' attribute is ignored.
> > > > 
> > > > Should I just emit the same warning if the language is not OpenCL or if 
> > > > the language is OpenCL but the version is not 2.0? Or I should emit an 
> > > > error if the language is OpenCL but the version is not 2.0?
> > > Also, ``'nosvm' attribute ignored`` is the default warning msg used in 
> > > tablegen when LangOpt<"OpenCL"> is used. The following code is generated 
> > > by tablegen:
> > > 
> > >   static bool checkOpenCLLangOpts(Sema , const AttributeList ) {
> > > if (S.LangOpts.OpenCL)
> > >   return true;
> > > 
> > > S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
> > > return false;
> > >   }
> > > 
> > > Basically, if an attrib is defined for a specific language by using 
> > > LangOpt<> in Attr.td, when this attr is used in other languages, the 
> > > original behavior of Clang is to emit a warning like:
> > > 
> > >   'nosvm' attribute ignored
> > > 
> > > Do we want to fix this? Or simply don't use LangOpt<> for this attribute.
> > I am a bit confused now. So what diagnostic would Clang give if we don't 
> > use LanOpt<>? Is it the same as if with LangOpt<>? Is there anything we can 
> > do about CL version as well?
> > 
> > I don't feel like we should modify default Clang behavior wrt attributes a 
> > lot. Let's try to find the best way to use what we already have. 
> For non-OpenCL programs,
> 
> If we don't use LangOpt, Clang will emit warning
> 
>   unknown 'nosvm' attribute ignored
> 
> If we use LangOpt, Clang will emit warning
> 
>   'nosvm' attribute ignored
> 
> If we don't want to change Clang default behavior but also don't like the 
> second default warning, we should not use LangOpt.
> 
> I can emit a warning for OpenCL program which version is not 2.0:
> 
>   'nosvm' attribute is valid only for OpenCL 2.0
> 
> and emit a warning for non-OpenCL programs
>   
>   unknown 'nosvm' attribute is ignored
Yes, seems like it's best not to use LangOpt actually.

So if the change is not large I would prefer the second option you proposed!


Repository:
  rL LLVM

http://reviews.llvm.org/D17861



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


[libcxx] r263043 - Update status to mark 2579 complete

2016-03-09 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Mar  9 12:09:07 2016
New Revision: 263043

URL: http://llvm.org/viewvc/llvm-project?rev=263043=rev
Log:
Update status to mark 2579 complete

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=263043=263042=263043=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Wed Mar  9 12:09:07 2016
@@ -224,7 +224,7 @@
http://cplusplus.github.io/LWG/lwg-defects.html#2575;>2575[fund.ts.v2]
 experimental::function::assign should be 
removedJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2576;>2576istream_iterator
 and ostream_iterator should use 
std::addressofJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2577;>2577{shared,unique}_lock
 should use std::addressofJacksonville
-   http://cplusplus.github.io/LWG/lwg-defects.html#2579;>2579Inconsistency
 wrt Allocators in basic_string assignment vs. 
basic_string::assignJacksonville
+   http://cplusplus.github.io/LWG/lwg-defects.html#2579;>2579Inconsistency
 wrt Allocators in basic_string assignment vs. 
basic_string::assignJacksonvilleComplete
http://cplusplus.github.io/LWG/lwg-defects.html#2581;>2581Specialization
 of type_traits variable templates should be 
prohibitedJacksonvilleComplete
http://cplusplus.github.io/LWG/lwg-defects.html#2582;>2582[res.on.functions]/2's
 prohibition against incomplete types shouldn't apply to type 
traitsJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2583;>2583There
 is no way to supply an allocator for basic_string(str, 
pos)JacksonvilleComplete
@@ -238,7 +238,7 @@
 
   
 
-  Last Updated: 7-Mar-2016
+  Last Updated: 9-Mar-2016
 
 
 


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


[libcxx] r263042 - Implement LWG#2579: Inconsistency wrt Allocators in basic_string assignment vs. basic_string::assign

2016-03-09 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Mar  9 12:08:29 2016
New Revision: 263042

URL: http://llvm.org/viewvc/llvm-project?rev=263042=rev
Log:
Implement LWG#2579: Inconsistency wrt Allocators in basic_string assignment vs. 
basic_string::assign

Modified:
libcxx/trunk/include/string

libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp

Modified: libcxx/trunk/include/string
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=263042=263041=263042=diff
==
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Wed Mar  9 12:08:29 2016
@@ -1551,7 +1551,7 @@ public:
 _LIBCPP_INLINE_VISIBILITY const_reference back() const;
 
 _LIBCPP_INLINE_VISIBILITY
-basic_string& assign(const basic_string& __str);
+basic_string& assign(const basic_string& __str) { return *this = __str; }
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 _LIBCPP_INLINE_VISIBILITY
 basic_string& assign(basic_string&& str)
@@ -2489,7 +2489,7 @@ basic_string<_CharT, _Traits, _Allocator
 if (this != &__str)
 {
 __copy_assign_alloc(__str);
-assign(__str);
+assign(__str.data(), __str.size());
 }
 return *this;
 }
@@ -2581,14 +2581,6 @@ basic_string<_CharT, _Traits, _Allocator
 }
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str)
-{
-return assign(__str.data(), __str.size());
-}
-
-template 
 basic_string<_CharT, _Traits, _Allocator>&
 basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, 
size_type __pos, size_type __n)
 {

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp?rev=263042=263041=263042=diff
==
--- 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp
 Wed Mar  9 12:08:29 2016
@@ -15,7 +15,9 @@
 #include 
 #include 
 
+#include "test_macros.h"
 #include "min_allocator.h"
+#include "test_allocator.h"
 
 template 
 void
@@ -26,6 +28,16 @@ test(S s, S str, S expected)
 assert(s == expected);
 }
 
+template 
+void
+testAlloc(S s, S str, const typename S::allocator_type& a)
+{
+s.assign(str);
+assert(s.__invariants());
+assert(s == str);
+assert(s.get_allocator() == a);
+}
+
 int main()
 {
 {
@@ -50,7 +62,22 @@ int main()
 test(S("12345678901234567890"), S("1234567890"), S("1234567890"));
 test(S("12345678901234567890"), S("12345678901234567890"),
  S("12345678901234567890"));
+
+testAlloc(S(), S(), std::allocator());
+testAlloc(S(), S("12345"), std::allocator());
+testAlloc(S(), S("1234567890"), std::allocator());
+testAlloc(S(), S("12345678901234567890"), std::allocator());
+}
+
+{ //  LWG#5579 make sure assign takes the allocators where appropriate
+typedef other_allocator A;  // has POCCA --> true
+typedef std::basic_string S;
+testAlloc(S(A(5)), S(A(3)), A(3));
+testAlloc(S(A(5)), S("1"), A());
+testAlloc(S(A(5)), S("1", A(7)), A(7));
+testAlloc(S(A(5)), 
S("1234567890123456789012345678901234567890123456789012345678901234567890", 
A(7)), A(7));
 }
+
 #if TEST_STD_VER >= 11
 {
 typedef std::basic_string S;
@@ -74,9 +101,14 @@ int main()
 test(S("12345678901234567890"), S("1234567890"), S("1234567890"));
 test(S("12345678901234567890"), S("12345678901234567890"),
  S("12345678901234567890"));
+
+testAlloc(S(), S(), min_allocator());
+testAlloc(S(), S("12345"), min_allocator());
+testAlloc(S(), S("1234567890"), min_allocator());
+testAlloc(S(), S("12345678901234567890"), min_allocator());
 }
 #endif
-#if __cplusplus > 201402L
+#if TEST_STD_VER > 14
 {
 typedef std::string S;
 static_assert(noexcept(S().assign(S())), "");  // LWG#2063


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


r263041 - Use an explicit instantiation to work around delayed template parsing for MSVC-built bots.

2016-03-09 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Mar  9 12:07:17 2016
New Revision: 263041

URL: http://llvm.org/viewvc/llvm-project?rev=263041=rev
Log:
Use an explicit instantiation to work around delayed template parsing for 
MSVC-built bots.

Modified:
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=263041=263040=263041=diff
==
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Wed Mar  9 12:07:17 2016
@@ -2590,9 +2590,9 @@ TEST(Matcher, Initializers) {
 
 TEST(Matcher, ParenListExpr) {
   EXPECT_TRUE(
-matches(
-  "  template class foo { void bar() { foo X(*this); } }; 
",
-  varDecl(hasInitializer(parenListExpr(has(unaryOperator()));
+  matches("template class foo { void bar() { foo X(*this); } 
};"
+  "template class foo;",
+  varDecl(hasInitializer(parenListExpr(has(unaryOperator()));
 }
 
 TEST(Matcher, StmtExpr) {


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


r263038 - AArch64: remove a couple more tests already covered elsewhere.

2016-03-09 Thread Tim Northover via cfe-commits
Author: tnorthover
Date: Wed Mar  9 12:00:06 2016
New Revision: 263038

URL: http://llvm.org/viewvc/llvm-project?rev=263038=rev
Log:
AArch64: remove a couple more tests already covered elsewhere.

Removed:
cfe/trunk/test/CodeGen/arm64-scalar-test.c
cfe/trunk/test/CodeGen/arm64-vrsqrt.c

Removed: cfe/trunk/test/CodeGen/arm64-scalar-test.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm64-scalar-test.c?rev=263037=auto
==
--- cfe/trunk/test/CodeGen/arm64-scalar-test.c (original)
+++ cfe/trunk/test/CodeGen/arm64-scalar-test.c (removed)
@@ -1,547 +0,0 @@
-// REQUIRES: aarch64-registered-target
-// RUN: %clang_cc1 -triple arm64-apple-ios7.0 -target-feature +neon  \
-// RUN:   -S -O1 -o - -ffreestanding %s | FileCheck %s
-
-// We're explicitly using arm_neon.h here: some types probably don't match
-// the ACLE definitions, but we want to check current codegen.
-#include 
-
-float test_vrsqrtss_f32(float a, float b) {
-// CHECK: test_vrsqrtss_f32
-  return vrsqrtss_f32(a, b);
-// CHECK: frsqrts {{s[0-9]+}}, {{s[0-9]+}}, {{s[0-9]+}}
-}
-
-double test_vrsqrtsd_f64(double a, double b) {
-// CHECK: test_vrsqrtsd_f64
-  return vrsqrtsd_f64(a, b);
-// CHECK: frsqrts {{d[0-9]+}}, {{d[0-9]+}}, {{d[0-9]+}}
-}
-
-int64x1_t test_vrshl_s64(int64x1_t a, int64x1_t b) {
-// CHECK: test_vrshl_s64
-  return vrshl_s64(a, b);
-// CHECK: srshl {{d[0-9]+}}, {{d[0-9]+}}, {{d[0-9]+}}
-}
-
-uint64x1_t test_vrshl_u64(uint64x1_t a, int64x1_t b) {
-// CHECK: test_vrshl_u64
-  return vrshl_u64(a, b);
-// CHECK: urshl {{d[0-9]+}}, {{d[0-9]+}}, {{d[0-9]+}}
-}
-
-// CHECK: test_vrshld_s64
-int64_t test_vrshld_s64(int64_t a, int64_t b) {
-  return vrshld_s64(a, b);
-// CHECK: srshl {{d[0-9]+}}, {{d[0-9]+}}, {{d[0-9]+}}
-}
-
-// CHECK: test_vrshld_u64
-uint64_t test_vrshld_u64(uint64_t a, uint64_t b) {
-  return vrshld_u64(a, b);
-// CHECK: urshl {{d[0-9]+}}, {{d[0-9]+}}, {{d[0-9]+}}
-}
-
-// CHECK: test_vqrshlb_s8
-int8_t test_vqrshlb_s8(int8_t a, int8_t b) {
-  return vqrshlb_s8(a, b);
-// CHECK: sqrshl.8b {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}}
-}
-
-// CHECK: test_vqrshlh_s16
-int16_t test_vqrshlh_s16(int16_t a, int16_t b) {
-  return vqrshlh_s16(a, b);
-// CHECK: sqrshl.4h {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}}
-}
-
-// CHECK: test_vqrshls_s32
-int32_t test_vqrshls_s32(int32_t a, int32_t b) {
-  return vqrshls_s32(a, b);
-// CHECK: sqrshl {{s[0-9]+}}, {{s[0-9]+}}, {{s[0-9]+}}
-}
-
-// CHECK: test_vqrshld_s64
-int64_t test_vqrshld_s64(int64_t a, int64_t b) {
-  return vqrshld_s64(a, b);
-// CHECK: sqrshl {{d[0-9]+}}, {{d[0-9]+}}, {{d[0-9]+}}
-}
-
-// CHECK: test_vqrshlb_u8
-uint8_t test_vqrshlb_u8(uint8_t a, uint8_t b) {
-  return vqrshlb_u8(a, b);
-// CHECK: uqrshl.8b {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}}
-}
-
-// CHECK: test_vqrshlh_u16
-uint16_t test_vqrshlh_u16(uint16_t a, uint16_t b) {
-  return vqrshlh_u16(a, b);
-// CHECK: uqrshl.4h {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}}
-}
-
-// CHECK: test_vqrshls_u32
-uint32_t test_vqrshls_u32(uint32_t a, uint32_t b) {
-  return vqrshls_u32(a, b);
-// CHECK: uqrshl {{s[0-9]+}}, {{s[0-9]+}}, {{s[0-9]+}}
-}
-
-// CHECK: test_vqrshld_u64
-uint64_t test_vqrshld_u64(uint64_t a, uint64_t b) {
-  return vqrshld_u64(a, b);
-// CHECK: uqrshl {{d[0-9]+}}, {{d[0-9]+}}, {{d[0-9]+}}
-}
-
-// CHECK: test_vqshlb_s8
-int8_t test_vqshlb_s8(int8_t a, int8_t b) {
-  return vqshlb_s8(a, b);
-// CHECK: sqshl.8b {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}}
-}
-
-// CHECK: test_vqshlh_s16
-int16_t test_vqshlh_s16(int16_t a, int16_t b) {
-  return vqshlh_s16(a, b);
-// CHECK: sqshl.4h {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}}
-}
-
-// CHECK: test_vqshls_s32
-int32_t test_vqshls_s32(int32_t a, int32_t b) {
-  return vqshls_s32(a, b);
-// CHECK: sqshl {{s[0-9]+}}, {{s[0-9]+}}, {{s[0-9]+}}
-}
-
-// CHECK: test_vqshld_s64
-int64_t test_vqshld_s64(int64_t a, int64_t b) {
-  return vqshld_s64(a, b);
-// CHECK: sqshl {{d[0-9]+}}, {{d[0-9]+}}, {{d[0-9]+}}
-}
-
-// CHECK: test_vqshld_s64_i
-int64_t test_vqshld_s64_i(int64_t a) {
-  return vqshld_s64(a, 36);
-// CHECK: sqshl {{d[0-9]+}}, {{d[0-9]+}}, #36
-}
-
-// CHECK: test_vqshlb_u8
-uint8_t test_vqshlb_u8(uint8_t a, uint8_t b) {
-  return vqshlb_u8(a, b);
-// CHECK: uqshl.8b {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}}
-}
-
-// CHECK: test_vqshlh_u16
-uint16_t test_vqshlh_u16(uint16_t a, uint16_t b) {
-  return vqshlh_u16(a, b);
-// CHECK: uqshl.4h {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}}
-}
-
-// CHECK: test_vqshls_u32
-uint32_t test_vqshls_u32(uint32_t a, uint32_t b) {
-  return vqshls_u32(a, b);
-// CHECK: uqshl {{s[0-9]+}}, {{s[0-9]+}}, {{s[0-9]+}}
-}
-
-// CHECK: test_vqshld_u64
-uint64_t test_vqshld_u64(uint64_t a, uint64_t b) {
-  return vqshld_u64(a, b);
-// CHECK: uqshl {{d[0-9]+}}, {{d[0-9]+}}, {{d[0-9]+}}
-}
-
-// CHECK: test_vqshld_u64_i
-uint64_t test_vqshld_u64_i(uint64_t a) {
-  return vqshld_u64(a, 36);
-// CHECK: uqshl {{d[0-9]+}}, {{d[0-9]+}}, #36
-}
-
-// CHECK: test_vshld_u64

Re: [PATCH] D17627: Fix false positives for for-loop-analysis warning

2016-03-09 Thread Steven Wu via cfe-commits
steven_wu added a comment.

ping


http://reviews.llvm.org/D17627



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


[libcxx] r263036 - Implement LWG#2583: There is no way to supply an allocator for basic_string(str, pos)

2016-03-09 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Mar  9 11:51:43 2016
New Revision: 263036

URL: http://llvm.org/viewvc/llvm-project?rev=263036=rev
Log:
Implement LWG#2583: There is no way to supply an allocator for 
basic_string(str, pos)

Modified:
libcxx/trunk/include/string
libcxx/trunk/test/std/strings/basic.string/string.cons/substr.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/string
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=263036=263035=263036=diff
==
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Wed Mar  9 11:51:43 2016
@@ -98,8 +98,10 @@ public:
 basic_string(const basic_string& str);
 basic_string(basic_string&& str)
 noexcept(is_nothrow_move_constructible::value);
-basic_string(const basic_string& str, size_type pos, size_type n = npos,
+basic_string(const basic_string& str, size_type pos, // 
LWG#2583
  const allocator_type& a = allocator_type());
+basic_string(const basic_string& str, size_type pos, size_type n,// 
LWG#2583
+ const Allocator& a = Allocator()); 
 basic_string(const value_type* s, const allocator_type& a = 
allocator_type());
 basic_string(const value_type* s, size_type n, const allocator_type& a = 
allocator_type());
 basic_string(size_type n, value_type c, const allocator_type& a = 
allocator_type());
@@ -1397,7 +1399,9 @@ public:
 basic_string(size_type __n, value_type __c);
 _LIBCPP_INLINE_VISIBILITY
 basic_string(size_type __n, value_type __c, const allocator_type& __a);
-basic_string(const basic_string& __str, size_type __pos, size_type __n = 
npos,
+basic_string(const basic_string& __str, size_type __pos, size_type __n,
+ const allocator_type& __a = allocator_type());
+basic_string(const basic_string& __str, size_type __pos,
  const allocator_type& __a = allocator_type());
 template
 _LIBCPP_INLINE_VISIBILITY
@@ -2220,6 +2224,20 @@ basic_string<_CharT, _Traits, _Allocator
 #if _LIBCPP_DEBUG_LEVEL >= 2
 __get_db()->__insert_c(this);
 #endif
+}
+
+template 
+basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& 
__str, size_type __pos,
+const allocator_type& 
__a)
+: __r_(__a)
+{
+size_type __str_sz = __str.size();
+if (__pos > __str_sz)
+this->__throw_out_of_range();
+__init(__str.data() + __pos, __str_sz - __pos);
+#if _LIBCPP_DEBUG_LEVEL >= 2
+__get_db()->__insert_c(this);
+#endif
 }
 
 template 

Modified: libcxx/trunk/test/std/strings/basic.string/string.cons/substr.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/substr.pass.cpp?rev=263036=263035=263036=diff
==
--- libcxx/trunk/test/std/strings/basic.string/string.cons/substr.pass.cpp 
(original)
+++ libcxx/trunk/test/std/strings/basic.string/string.cons/substr.pass.cpp Wed 
Mar  9 11:51:43 2016
@@ -11,14 +11,21 @@
 // 
 
 // basic_string(const basic_string& str,
-//  size_type pos, size_type n = npos,
+//  size_type pos, size_type n,
+//  const Allocator& a = Allocator());
+//
+// basic_string(const basic_string& str,
+//  size_type pos,
 //  const Allocator& a = Allocator());
 
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 
+#include "test_macros.h"
 #include "test_allocator.h"
 #include "min_allocator.h"
 
@@ -91,6 +98,20 @@ test(S str, unsigned pos, unsigned n, co
 }
 }
 
+#if TEST_STD_VER >= 11
+void test2583()
+{   // LWG #2583
+typedef std::basic_string StringA;
+std::vector> vs;
+StringA s{"1234"};
+vs.emplace_back(s, 2);
+
+try { vs.emplace_back(s, 5); }
+catch (const std::out_of_range&) { return; }
+assert(false);
+}
+#endif
+
 int main()
 {
 {
@@ -131,7 +152,7 @@ int main()
 
test(S("1234567890123456789012345678901234567890123456789012345678901234567890",
 A(7)), 50, 10, A(8));
 
test(S("1234567890123456789012345678901234567890123456789012345678901234567890",
 A(7)), 50, 100, A(8));
 }
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
 {
 typedef min_allocator A;
 typedef std::basic_string S;
@@ -170,5 +191,7 @@ int main()
 
test(S("1234567890123456789012345678901234567890123456789012345678901234567890",
 A()), 50, 10, A());
 
test(S("1234567890123456789012345678901234567890123456789012345678901234567890",
 A()), 50, 100, A());
 }
+
+test2583();
 #endif
 }

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 

r263034 - Speculative fix for this test case (the test doesn't run on my typical build environment).

2016-03-09 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Mar  9 11:34:16 2016
New Revision: 263034

URL: http://llvm.org/viewvc/llvm-project?rev=263034=rev
Log:
Speculative fix for this test case (the test doesn't run on my typical build 
environment).

Modified:
cfe/trunk/test/Misc/ast-dump-color.cpp

Modified: cfe/trunk/test/Misc/ast-dump-color.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/ast-dump-color.cpp?rev=263034=263033=263034=diff
==
--- cfe/trunk/test/Misc/ast-dump-color.cpp (original)
+++ cfe/trunk/test/Misc/ast-dump-color.cpp Wed Mar  9 11:34:16 2016
@@ -34,7 +34,7 @@ struct Invalid {
 //CHECK: {{^}}[[Blue]]|-[[RESET]][[GREEN]]TypedefDecl[[RESET]][[Yellow]] 
0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]][[RESET]]> 
[[Yellow]][[RESET]] implicit[[CYAN]] __uint128_t[[RESET]] 
[[Green]]'unsigned __int128'[[RESET]]{{$}}
 //CHECK: {{^}}[[Blue]]|-[[RESET]][[GREEN]]TypedefDecl[[RESET]][[Yellow]] 
0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]][[RESET]]> 
[[Yellow]][[RESET]] implicit[[CYAN]] __builtin_va_list[[RESET]] 
[[Green]]'struct __va_list_tag [1]'[[RESET]]{{$}}
 //CHECK: {{^}}[[Blue]]|-[[RESET]][[GREEN]]VarDecl[[RESET]][[Yellow]] 
0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]{{.*}}ast-dump-color.cpp:6:1[[RESET]], 
[[Yellow]]col:5[[RESET]]> [[Yellow]]col:5[[RESET]][[CYAN]] Test[[RESET]] 
[[Green]]'int'[[RESET]]
-//CHECK: {{^}}[[Blue]]| 
|-[[RESET]][[BLUE:.\[0;1;34m]]UnusedAttr[[RESET]][[Yellow]] 
0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]col:25[[RESET]]>{{$}}
+//CHECK: {{^}}[[Blue]]| 
|-[[RESET]][[BLUE:.\[0;1;34m]]UnusedAttr[[RESET]][[Yellow]] 
0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]col:25[[RESET]]> unused{{$}}
 //CHECK: {{^}}[[Blue]]| `-[[RESET]][[Blue]]FullComment[[RESET]][[Yellow]] 
0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]line:4:4[[RESET]], 
[[Yellow]]line:5:8[[RESET]]>{{$}}
 //CHECK: {{^}}[[Blue]]|   
`-[[RESET]][[Blue]]ParagraphComment[[RESET]][[Yellow]] 
0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]line:4:4[[RESET]], 
[[Yellow]]line:5:8[[RESET]]>{{$}}
 //CHECK: {{^}}[[Blue]]| |-[[RESET]][[Blue]]TextComment[[RESET]][[Yellow]] 
0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]line:4:4[[RESET]]> Text=" "{{$}}


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


r263031 - ReleaseNotes: update 'you may prefer' link to 3.8

2016-03-09 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Mar  9 11:26:46 2016
New Revision: 263031

URL: http://llvm.org/viewvc/llvm-project?rev=263031=rev
Log:
ReleaseNotes: update 'you may prefer' link to 3.8

Modified:
cfe/trunk/docs/ReleaseNotes.rst

Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=263031=263030=263031=diff
==
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Wed Mar  9 11:26:46 2016
@@ -11,8 +11,8 @@ Written by the `LLVM Team `_.
+   prefer the `Clang 3.8 Release Notes
+   `_.
 
 Introduction
 


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


Re: [PATCH] D17993: [CodeGen] Apply 'nonnull' to 'this' pointer arguments.

2016-03-09 Thread Chandler Carruth via cfe-commits
chandlerc added a subscriber: chandlerc.
chandlerc added a comment.

If we're not going to fully implement "fdelete-null-pointer-checks" we 
shouldn't claim to... I'm really worried about us accepting that flag and not 
actually honoring it.

However, I *do* think this should be guarded by a flag, and it should be 
specific to the 'this' pointer. And I'm also sufficiently terrified of this 
that I think the flag should be off to start with so that folks can find out 
how bad this is really going to be...


http://reviews.llvm.org/D17993



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


Re: [PATCH] D17993: [CodeGen] Apply 'nonnull' to 'this' pointer arguments.

2016-03-09 Thread John McCall via cfe-commits
rjmccall added a comment.

Hal, I think you're talking about a slightly different thing.  This patch is 
adding an assumption that C++ this pointers are non-null, but only when 
-fno-delete-null-pointer-checks is not passed.  The flag is therefore at least 
somewhat functional.  (I would argue that it should also cover the other cases 
where we add non-null assumptions, e.g. with reference arguments.  It's less 
clear whether it should change the code-generation of, say, non-trivial l-value 
derived-to-base casts, where there's a null check that's implicitly elided in 
the frontend.)

If you're saying that GCC's interpretation of this flag is more aggressive than 
that — e.g. if it also changes how aggressively the optimizer will decide that 
a pointer is non-null due to (say) it having been previously used as a 
load/store argument, as in the infamous Linux kernel bug that GCC got heat over 
— then I agree that we should probably avoid saying that we support the 
attribute until we find a way to emulate that.  That, I assume, would have to 
be an attribute on the Function that weakens that analysis.

I hope GCC's interpretation of this flag doesn't completely disable null-check 
elimination, e.g. when the pointer is obviously the address of a local or 
global variable.



Comment at: include/clang/Driver/Options.td:1157
@@ -1154,1 +1156,3 @@
+def fno_delete_null_pointer_checks : Flag<["-"], 
"fno-delete-null-pointer-checks">,
+  Group, Flags<[CC1Option]>;
 

Please include HelpText, and it's probably worth talking about this in the 
actual docs.


http://reviews.llvm.org/D17993



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


Re: [PATCH] D16044: getDescriptiveName() for MemRegion

2016-03-09 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

I thunk the closest we have is region-store* tests, which is not quite the 
same. Feel free to add a new test.


http://reviews.llvm.org/D16044



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


[libcxx] r263029 - Add some more tests for the containers type requirements

2016-03-09 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Mar  9 11:19:07 2016
New Revision: 263029

URL: http://llvm.org/viewvc/llvm-project?rev=263029=rev
Log:
Add some more tests for the containers type requirements

Modified:
libcxx/trunk/test/std/containers/sequences/array/types.pass.cpp
libcxx/trunk/test/std/containers/sequences/deque/types.pass.cpp
libcxx/trunk/test/std/containers/sequences/forwardlist/types.pass.cpp
libcxx/trunk/test/std/containers/sequences/list/types.pass.cpp
libcxx/trunk/test/std/containers/sequences/vector.bool/types.pass.cpp
libcxx/trunk/test/std/containers/sequences/vector/types.pass.cpp

Modified: libcxx/trunk/test/std/containers/sequences/array/types.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/types.pass.cpp?rev=263029=263028=263029=diff
==
--- libcxx/trunk/test/std/containers/sequences/array/types.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/array/types.pass.cpp Wed Mar  9 
11:19:07 2016
@@ -44,6 +44,13 @@ int main()
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+
+static_assert((std::is_signed::value), 
"");
+static_assert((std::is_unsigned::value), "");
+static_assert((std::is_same::difference_type>::value), "");
+static_assert((std::is_same::difference_type>::value), "");
 }
 {
 typedef int* T;
@@ -58,5 +65,12 @@ int main()
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+
+static_assert((std::is_signed::value), 
"");
+static_assert((std::is_unsigned::value), "");
+static_assert((std::is_same::difference_type>::value), "");
+static_assert((std::is_same::difference_type>::value), "");
 }
 }

Modified: libcxx/trunk/test/std/containers/sequences/deque/types.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/types.pass.cpp?rev=263029=263028=263029=diff
==
--- libcxx/trunk/test/std/containers/sequences/deque/types.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/deque/types.pass.cpp Wed Mar  9 
11:19:07 2016
@@ -64,6 +64,12 @@ test()
 static_assert((std::is_same<
 typename C::const_reverse_iterator,
 std::reverse_iterator >::value), "");
+static_assert((std::is_signed::value), "");
+static_assert((std::is_unsigned::value), "");
+static_assert((std::is_same::difference_type>::value), "");
+static_assert((std::is_same::difference_type>::value), "");
 }
 
 int main()
@@ -73,6 +79,7 @@ int main()
 test();
 static_assert((std::is_same::value), "");
+
 #if __cplusplus >= 201103L
 {
 typedef std::deque C;
@@ -85,6 +92,13 @@ int main()
 //  min_allocator doesn't have a size_type, so one gets synthesized
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+
+static_assert((std::is_signed::value), 
"");
+static_assert((std::is_unsigned::value), "");
+static_assert((std::is_same::difference_type>::value), "");
+static_assert((std::is_same::difference_type>::value), "");
 }
 #endif
 }

Modified: libcxx/trunk/test/std/containers/sequences/forwardlist/types.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/types.pass.cpp?rev=263029=263028=263029=diff
==
--- libcxx/trunk/test/std/containers/sequences/forwardlist/types.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/types.pass.cpp Wed 
Mar  9 11:19:07 2016
@@ -44,6 +44,13 @@ int main()
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), 
"");
+
+static_assert((std::is_signed::value), "");
+static_assert((std::is_unsigned::value), "");
+static_assert((std::is_same::difference_type>::value), "");
+static_assert((std::is_same::difference_type>::value), "");
 }
 #if __cplusplus >= 201103L
 {
@@ -57,6 

Re: [PATCH] D17446: ASTMatchers: add new statement/decl matchers

2016-03-09 Thread Aaron Ballman via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

Commit in r263027.


http://reviews.llvm.org/D17446



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


r263027 - Adding new AST matchers for: addrLabelExpr, atomicExpr, binaryConditionalOperator, designatedInitExpr, designatorCountIs, hasSyntacticForm, implicitValueInitExpr, labelDecl, opaqueValueExpr,

2016-03-09 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Mar  9 11:11:51 2016
New Revision: 263027

URL: http://llvm.org/viewvc/llvm-project?rev=263027=rev
Log:
Adding new AST matchers for: addrLabelExpr, atomicExpr, 
binaryConditionalOperator, designatedInitExpr, designatorCountIs, 
hasSyntacticForm, implicitValueInitExpr, labelDecl, opaqueValueExpr, 
parenListExpr, predefinedExpr, requiresZeroInitialization, and stmtExpr.

Patch by Aleksei Sidorin.

Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
cfe/trunk/unittests/AST/MatchVerifier.h
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=263027=263026=263027=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Wed Mar  9 11:11:51 2016
@@ -271,6 +271,17 @@ Example matches f
 
 
 
+Matcherhttp://clang.llvm.org/doxygen/classclang_1_1Decl.html;>DecllabelDeclMatcherhttp://clang.llvm.org/doxygen/classclang_1_1LabelDecl.html;>LabelDecl...
+Matches a declaration of 
label.
+
+Given
+  goto FOO;
+  FOO: bar();
+labelDecl()
+  matches 'FOO:'
+
+
+
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1Decl.html;>DecllinkageSpecDeclMatcherhttp://clang.llvm.org/doxygen/classclang_1_1LinkageSpecDecl.html;>LinkageSpecDecl...
 Matches a 
declaration of a linkage specification.
 
@@ -497,6 +508,18 @@ nestedNameSpecifier()
 
 
 
+Matcherhttp://clang.llvm.org/doxygen/classclang_1_1Stmt.html;>StmtaddrLabelExprMatcherhttp://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html;>AddrLabelExpr...
+Matches address of 
label statements (GNU extension).
+
+Given
+  FOO: bar();
+  void *ptr = FOO;
+  goto *bar;
+addrLabelExpr()
+  matches 'FOO'
+
+
+
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1Stmt.html;>StmtarraySubscriptExprMatcherhttp://clang.llvm.org/doxygen/classclang_1_1ArraySubscriptExpr.html;>ArraySubscriptExpr...
 Matches array 
subscript expressions.
 
@@ -517,6 +540,21 @@ asmStmt()
 
 
 
+Matcherhttp://clang.llvm.org/doxygen/classclang_1_1Stmt.html;>StmtatomicExprMatcherhttp://clang.llvm.org/doxygen/classclang_1_1AtomicExpr.html;>AtomicExpr...
+Matches atomic builtins.
+Example matches __atomic_load_n(ptr, 1)
+  void foo() { int *ptr; __atomic_load_n(ptr, 1); }
+
+
+
+Matcherhttp://clang.llvm.org/doxygen/classclang_1_1Stmt.html;>StmtbinaryConditionalOperatorMatcherhttp://clang.llvm.org/doxygen/classclang_1_1BinaryConditionalOperator.html;>BinaryConditionalOperator...
+Matches 
binary conditional operator expressions (GNU extension).
+
+Example matches a ?: b
+  (a ?: b) + 42;
+
+
+
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1Stmt.html;>StmtbinaryOperatorMatcherhttp://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html;>BinaryOperator...
 Matches binary 
operator expressions.
 
@@ -876,6 +914,14 @@ defaultStmt()
 
 
 
+Matcherhttp://clang.llvm.org/doxygen/classclang_1_1Stmt.html;>StmtdesignatedInitExprMatcherhttp://clang.llvm.org/doxygen/classclang_1_1DesignatedInitExpr.html;>DesignatedInitExpr...
+Matches C99 
designated initializer expressions [C99 6.7.8].
+
+Example: Matches { [2].y = 1.0, [0].x = 1.0 }
+  point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 };
+
+
+
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1Stmt.html;>StmtdoStmtMatcherhttp://clang.llvm.org/doxygen/classclang_1_1DoStmt.html;>DoStmt...
 Matches do statements.
 
@@ -974,6 +1020,16 @@ eliding, as well as any type conversions
 
 
 
+Matcherhttp://clang.llvm.org/doxygen/classclang_1_1Stmt.html;>StmtimplicitValueInitExprMatcherhttp://clang.llvm.org/doxygen/classclang_1_1ImplicitValueInitExpr.html;>ImplicitValueInitExpr...
+Matches 
implicit initializers of init list expressions.
+
+Given
+  point ptarray[10] = { [2].y = 1.0, [2].x = 2.0, [0].x = 1.0 };
+implicitValueInitExpr()
+  matches "[0].y" (implicitly)
+
+
+
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1Stmt.html;>StmtinitListExprMatcherhttp://clang.llvm.org/doxygen/classclang_1_1InitListExpr.html;>InitListExpr...
 Matches init list 
expressions.
 
@@ -1062,6 +1118,16 @@ NSString's "alloc". This matcher should
 
 
 
+Matcherhttp://clang.llvm.org/doxygen/classclang_1_1Stmt.html;>StmtopaqueValueExprMatcherhttp://clang.llvm.org/doxygen/classclang_1_1OpaqueValueExpr.html;>OpaqueValueExpr...
+Matches opaque 
value expressions. They are used as helpers
+to reference another expressions and can be met
+in BinaryConditionalOperators, for example.
+
+Example matches 'a'
+  (a ?: c) + 42;
+
+
+
 

Re: [PATCH] D17865: Add replacement = "xxx" to DeprecatedAttr.

2016-03-09 Thread Aaron Ballman via cfe-commits
aaron.ballman added a subscriber: aaron.ballman.
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a comment.

I like the idea of a potential fixit being provided by the attribute, but I do 
not agree with the way the feature is surfaced in this patch.

For the GNU-style attribute, the named argument functionality is sufficiently 
novel syntax that I would strongly like to avoid it, especially since 
__attribute__((deprecated)) is supported by multiple compilers.

We should not be adding this functionality to the C++-style attribute in the 
gnu namespace; that's not our vendor namespace to modify. I wouldn't be opposed 
to adding a clang namespace where we support this feature, however.

We definitely need to make sure we are not modifying the functionality for the 
C++ standards-based attribute, or the __declspec based attribute (for pretty 
printing, as well as parsing, etc).

So this change is missing a lot of tests to make sure we do not support this 
feature in places where it doesn't belong.



Comment at: include/clang/Basic/Attr.td:716
@@ -715,2 +715,3 @@
+  StringArgument<"Replacement", 1>];
   let Documentation = [Undocumented];
 }

Would you mind adding some documentation to the attribute since we're changing 
it?


Comment at: lib/Parse/ParseDecl.cpp:1048
@@ +1047,3 @@
+/// \brief Parse the contents of the "deprecated" attribute.
+unsigned Parser::ParseDeprecatedAttribute(IdentifierInfo ,
+  SourceLocation DeprecatedLoc,

This also gets called for attributes parsed in the gnu:: namespace, which means 
that you are modifying the behavior of gnu::deprecated(), which we should not 
do unless GCC also supports this feature.


Comment at: lib/Parse/ParseDecl.cpp:1068
@@ +1067,3 @@
+if (Keyword != Ident_replacement) {
+}
+

I assume this was meant to do something useful?


Comment at: lib/Parse/ParseDecl.cpp:1070
@@ +1069,3 @@
+
+if (Tok.isNot(tok::equal)) {
+  Diag(Tok, diag::err_expected_after) << Keyword << tok::equal;

This now makes the attribute behave differently than 
`__attribute__((deprecated))` because you can have this odd named-argument 
behavior. I would strongly prefer this be an actual optional parameter instead 
of using this approach. e.g., `__attribute__((deprecated("", "fixit")))`.


Comment at: lib/Sema/SemaDeclAttr.cpp:5074
@@ +5073,3 @@
+  StringRef Str, Replacement;
+  if ((Attr.isArgExpr(0) && Attr.getArgAsExpr(0) &&
+   !S.checkStringLiteralArgumentAttr(Attr, 0, Str))||

This check should be moved above the extension warning above -- we only want to 
diagnose the extension if the attribute is actually applied.


Comment at: test/SemaCXX/cxx11-attr-print.cpp:16
@@ -15,3 +15,3 @@
 
-// CHECK: int b {{\[}}[gnu::deprecated("warning")]];
+// CHECK: int b {{\[}}[gnu::deprecated("warning", "")]];
 int b [[gnu::deprecated("warning")]];

This is a bug; we should not be hijacking the gnu attribute space.


Comment at: test/SemaCXX/cxx11-attr-print.cpp:18
@@ -17,2 +17,3 @@
 int b [[gnu::deprecated("warning")]];
 
+// CHECK: __attribute__((deprecated("", "")));

I would like a test that verifies we don't print an empty fixit literal when 
using the C++14 `[[deprecated]]` attribute. Same for `__declspec(deprecated)`.


http://reviews.llvm.org/D17865



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


r263025 - Implement support for [[maybe_unused]] in C++1z that is based off existing support for unused, and treat it as an extension pre-C++1z. This also means extending the existing unused attribute

2016-03-09 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Mar  9 10:48:08 2016
New Revision: 263025

URL: http://llvm.org/viewvc/llvm-project?rev=263025=rev
Log:
Implement support for [[maybe_unused]] in C++1z that is based off existing 
support for unused, and treat it as an extension pre-C++1z. This also means 
extending the existing unused attribute so that it can be placed on an enum and 
enumerator, in addition to the other subjects.

Added:
cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/
cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p1.cpp
cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p2.cpp
cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp
cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p4.cpp
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/AttrDocs.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/AttributeList.h
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/lib/Sema/SemaAttr.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=263025=263024=263025=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Wed Mar  9 10:48:08 2016
@@ -1484,11 +1484,11 @@ def ObjCRequiresPropertyDefs : Inheritab
 }
 
 def Unused : InheritableAttr {
-  let Spellings = [GCC<"unused">];
-  let Subjects = SubjectList<[Var, ObjCIvar, Type, Label, Field, ObjCMethod,
-  FunctionLike], WarnDiag,
- "ExpectedVariableFunctionOrLabel">;
-  let Documentation = [Undocumented];
+  let Spellings = [CXX11<"", "maybe_unused", 201603>, GCC<"unused">];
+  let Subjects = SubjectList<[Var, ObjCIvar, Type, Enum, EnumConstant, Label,
+  Field, ObjCMethod, FunctionLike], WarnDiag,
+ "ExpectedForMaybeUnused">;
+  let Documentation = [WarnMaybeUnusedDocs];
 }
 
 def Used : InheritableAttr {

Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=263025=263024=263025=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Wed Mar  9 10:48:08 2016
@@ -729,6 +729,32 @@ When one method overrides another, the o
   }];
 }
 
+def WarnMaybeUnusedDocs : Documentation {
+  let Category = DocCatVariable;
+  let Heading = "maybe_unused, unused, gnu::unused";
+  let Content = [{
+When passing the ``-Wunused`` flag to Clang, entities that are unused by the
+program may be diagnosed. The ``[[maybe_unused]]`` (or
+``__attribute__((unused))``) attribute can be used to silence such diagnostics
+when the entity cannot be removed. For instance, a local variable may exist
+solely for use in an ``assert()`` statement, which makes the local variable
+unused when ``NDEBUG`` is defined.
+
+The attribute may be applied to the declaration of a class, a typedef, a
+variable, a function or method, a function parameter, an enumeration, an
+enumerator, a non-static data member, or a label.
+
+.. code-block: c++
+  #include 
+
+  [[maybe_unused]] void f([[maybe_unused]] bool thing1,
+  [[maybe_unused]] bool thing2) {
+[[maybe_unused]] bool b = thing1 && thing2;
+assert(b);
+  }
+  }];
+}
+
 def WarnUnusedResultsDocs : Documentation {
   let Category = DocCatFunction;
   let Heading = "nodiscard, warn_unused_result, clang::warn_unused_result, 
gnu::warn_unused_result";

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=263025=263024=263025=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Mar  9 10:48:08 
2016
@@ -2468,8 +2468,7 @@ def warn_attribute_wrong_decl_type : War
   "variables and functions|functions and methods|parameters|"
   "functions, methods and blocks|functions, methods, and classes|"
   "functions, methods, and parameters|classes|enums|variables|methods|"
-  "variables, functions and labels|fields and global variables|structs|"
-  "variables and typedefs|thread-local variables|"
+  "fields and global variables|structs|variables and typedefs|thread-local 
variables|"
   "variables and fields|variables, data members and tag types|"
   "types and namespaces|Objective-C interfaces|methods and properties|"
   "struct or union|struct, union or class|types|"
@@ -2478,7 +2477,8 @@ def warn_attribute_wrong_decl_type : War
   

Re: [PATCH] D17453: [Driver] Enable --rtlib option for MSVC target

2016-03-09 Thread Renato Golin via cfe-commits
rengolin added a comment.

Hi,

The error is very sensible, but I'm not sure why you're adding compiler-rt in 
the second change. Why is that necessary, and where are the tests for it.

Thanks!
--renato


http://reviews.llvm.org/D17453



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


Re: [PATCH] D17983: Eliminate many benign instances of "potentially uninitialized local variable" warnings

2016-03-09 Thread Teresa Johnson via cfe-commits
On Wed, Mar 9, 2016 at 8:23 AM, David Blaikie  wrote:

>
> On Mar 9, 2016 8:18 AM, "Teresa Johnson"  wrote:
> >
> >
> >
> > On Wed, Mar 9, 2016 at 8:13 AM, David Blaikie 
> wrote:
> >>
> >>
> >> On Mar 9, 2016 8:11 AM, "Teresa Johnson via llvm-commits" <
> llvm-comm...@lists.llvm.org> wrote:
> >> >
> >> > tejohnson added a subscriber: tejohnson.
> >> > tejohnson added a comment.
> >> >
> >> > Thanks for doing this!
> >> >
> >> > I will fix these 3, which one of my changes would have provoked. It
> is a benign case since we do have an assert at the use site checking the
> same condition that the inits are guarded with, but there is no reason not
> to 0 init these to avoid the bogus warning.
> >>
> >> The reason not to is that it would silence msan catching the
> unintentional codepath (eg: if you didn't have the assert there, and they
> init and use conditions didn't match, msan would tell us - if we add what
> we believe to be a dead init, then msan no longer helps us here)
> >
> >
> > Hmm, ok. It's unfortunate that the warning and msan are at odds,
> although I don't know how to reconcile them.
>
> The approach we've taken so far, so far as I'm aware, is to disable
> warnings like this that have such false positives.
>
> > Will leave as is then. Is it worth a comment indicating why we are
> leaving them uninitialized?
>
> Not sure. If you think it helps readability. If it's fairly clear the
> variable is only used under the same condition that it's initialized, I
> think you could leave it.
>

Ok, sounds good.


> >>
> >> >
> >> > Warning C4701   potentially uninitialized local variable
> 'FnEntry8BitAbbrev' used   LLVMBitWriter
>  c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp   2353
> >> > Warning C4701   potentially uninitialized local variable
> 'FnEntry7BitAbbrev' used   LLVMBitWriter
>  c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp   2357
> >> > Warning C4701   potentially uninitialized local variable
> 'FnEntry6BitAbbrev' used   LLVMBitWriter
>  c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp   2355
> >> >
> >> >
> >> > http://reviews.llvm.org/D17983
> >> >
> >> >
> >> >
> >> > ___
> >> > llvm-commits mailing list
> >> > llvm-comm...@lists.llvm.org
> >> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> >
> >
> >
> >
> > --
> > Teresa Johnson |
> >  Software Engineer |
> >  tejohn...@google.com |
> >  408-460-2413
>



-- 
Teresa Johnson |  Software Engineer |  tejohn...@google.com |  408-460-2413
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17983: Eliminate many benign instances of "potentially uninitialized local variable" warnings

2016-03-09 Thread David Blaikie via cfe-commits
On Mar 9, 2016 8:18 AM, "Teresa Johnson"  wrote:
>
>
>
> On Wed, Mar 9, 2016 at 8:13 AM, David Blaikie  wrote:
>>
>>
>> On Mar 9, 2016 8:11 AM, "Teresa Johnson via llvm-commits" <
llvm-comm...@lists.llvm.org> wrote:
>> >
>> > tejohnson added a subscriber: tejohnson.
>> > tejohnson added a comment.
>> >
>> > Thanks for doing this!
>> >
>> > I will fix these 3, which one of my changes would have provoked. It is
a benign case since we do have an assert at the use site checking the same
condition that the inits are guarded with, but there is no reason not to 0
init these to avoid the bogus warning.
>>
>> The reason not to is that it would silence msan catching the
unintentional codepath (eg: if you didn't have the assert there, and they
init and use conditions didn't match, msan would tell us - if we add what
we believe to be a dead init, then msan no longer helps us here)
>
>
> Hmm, ok. It's unfortunate that the warning and msan are at odds, although
I don't know how to reconcile them.

The approach we've taken so far, so far as I'm aware, is to disable
warnings like this that have such false positives.

> Will leave as is then. Is it worth a comment indicating why we are
leaving them uninitialized?

Not sure. If you think it helps readability. If it's fairly clear the
variable is only used under the same condition that it's initialized, I
think you could leave it.

>>
>> >
>> > Warning C4701   potentially uninitialized local variable
'FnEntry8BitAbbrev' used   LLVMBitWriter
 c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp   2353
>> > Warning C4701   potentially uninitialized local variable
'FnEntry7BitAbbrev' used   LLVMBitWriter
 c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp   2357
>> > Warning C4701   potentially uninitialized local variable
'FnEntry6BitAbbrev' used   LLVMBitWriter
 c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp   2355
>> >
>> >
>> > http://reviews.llvm.org/D17983
>> >
>> >
>> >
>> > ___
>> > llvm-commits mailing list
>> > llvm-comm...@lists.llvm.org
>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
>
>
> --
> Teresa Johnson |
>  Software Engineer |
>  tejohn...@google.com |
>  408-460-2413
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r263023 - NFC fix documentation build by rL263015

2016-03-09 Thread Dmitry Polukhin via cfe-commits
Author: dpolukhin
Date: Wed Mar  9 10:19:04 2016
New Revision: 263023

URL: http://llvm.org/viewvc/llvm-project?rev=263023=rev
Log:
NFC fix documentation build by rL263015

Modified:
cfe/trunk/docs/ItaniumMangleAbiTags.rst

Modified: cfe/trunk/docs/ItaniumMangleAbiTags.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ItaniumMangleAbiTags.rst?rev=263023=263022=263023=diff
==
--- cfe/trunk/docs/ItaniumMangleAbiTags.rst (original)
+++ cfe/trunk/docs/ItaniumMangleAbiTags.rst Wed Mar  9 10:19:04 2016
@@ -99,3 +99,4 @@ in the type of a cast operator) are NOT
 Example: a cast operator to std::string (which is
 std::__cxx11::basic_string<...>) will use 'cxx11' as an active tag, as it is
 required from the return type `std::string` but not available.
+


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


Re: [PATCH] D17983: Eliminate many benign instances of "potentially uninitialized local variable" warnings

2016-03-09 Thread Teresa Johnson via cfe-commits
On Wed, Mar 9, 2016 at 8:13 AM, David Blaikie  wrote:

>
> On Mar 9, 2016 8:11 AM, "Teresa Johnson via llvm-commits" <
> llvm-comm...@lists.llvm.org> wrote:
> >
> > tejohnson added a subscriber: tejohnson.
> > tejohnson added a comment.
> >
> > Thanks for doing this!
> >
> > I will fix these 3, which one of my changes would have provoked. It is a
> benign case since we do have an assert at the use site checking the same
> condition that the inits are guarded with, but there is no reason not to 0
> init these to avoid the bogus warning.
>
> The reason not to is that it would silence msan catching the unintentional
> codepath (eg: if you didn't have the assert there, and they init and use
> conditions didn't match, msan would tell us - if we add what we believe to
> be a dead init, then msan no longer helps us here)
>

Hmm, ok. It's unfortunate that the warning and msan are at odds, although I
don't know how to reconcile them. Will leave as is then. Is it worth a
comment indicating why we are leaving them uninitialized?

> >
> > Warning C4701   potentially uninitialized local variable
> 'FnEntry8BitAbbrev' used   LLVMBitWriter
>  c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp   2353
> > Warning C4701   potentially uninitialized local variable
> 'FnEntry7BitAbbrev' used   LLVMBitWriter
>  c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp   2357
> > Warning C4701   potentially uninitialized local variable
> 'FnEntry6BitAbbrev' used   LLVMBitWriter
>  c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp   2355
> >
> >
> > http://reviews.llvm.org/D17983
> >
> >
> >
> > ___
> > llvm-commits mailing list
> > llvm-comm...@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>



-- 
Teresa Johnson |  Software Engineer |  tejohn...@google.com |  408-460-2413
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15314: Fix a bug in unavailable checking

2016-03-09 Thread Manman Ren via cfe-commits
manmanren added a comment.

Ping


http://reviews.llvm.org/D15314



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


Re: [PATCH] D17983: Eliminate many benign instances of "potentially uninitialized local variable" warnings

2016-03-09 Thread David Blaikie via cfe-commits
On Mar 9, 2016 8:11 AM, "Teresa Johnson via llvm-commits" <
llvm-comm...@lists.llvm.org> wrote:
>
> tejohnson added a subscriber: tejohnson.
> tejohnson added a comment.
>
> Thanks for doing this!
>
> I will fix these 3, which one of my changes would have provoked. It is a
benign case since we do have an assert at the use site checking the same
condition that the inits are guarded with, but there is no reason not to 0
init these to avoid the bogus warning.

The reason not to is that it would silence msan catching the unintentional
codepath (eg: if you didn't have the assert there, and they init and use
conditions didn't match, msan would tell us - if we add what we believe to
be a dead init, then msan no longer helps us here)

>
> Warning C4701   potentially uninitialized local variable
'FnEntry8BitAbbrev' used   LLVMBitWriter
 c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp   2353
> Warning C4701   potentially uninitialized local variable
'FnEntry7BitAbbrev' used   LLVMBitWriter
 c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp   2357
> Warning C4701   potentially uninitialized local variable
'FnEntry6BitAbbrev' used   LLVMBitWriter
 c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp   2355
>
>
> http://reviews.llvm.org/D17983
>
>
>
> ___
> llvm-commits mailing list
> llvm-comm...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17865: Add replacement = "xxx" to DeprecatedAttr.

2016-03-09 Thread Manman Ren via cfe-commits
manmanren added a comment.

Ping


http://reviews.llvm.org/D17865



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


Re: [PATCH] D17983: Eliminate many benign instances of "potentially uninitialized local variable" warnings

2016-03-09 Thread Teresa Johnson via cfe-commits
tejohnson added a subscriber: tejohnson.
tejohnson added a comment.

Thanks for doing this!

I will fix these 3, which one of my changes would have provoked. It is a benign 
case since we do have an assert at the use site checking the same condition 
that the inits are guarded with, but there is no reason not to 0 init these to 
avoid the bogus warning.

Warning C4701   potentially uninitialized local variable 'FnEntry8BitAbbrev' 
used   LLVMBitWriter   c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp
   2353
Warning C4701   potentially uninitialized local variable 'FnEntry7BitAbbrev' 
used   LLVMBitWriter   c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp
   2357
Warning C4701   potentially uninitialized local variable 'FnEntry6BitAbbrev' 
used   LLVMBitWriter   c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp
   2355


http://reviews.llvm.org/D17983



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


Re: [PATCH] D17993: [CodeGen] Apply 'nonnull' to 'this' pointer arguments.

2016-03-09 Thread Hal Finkel via cfe-commits
hfinkel added a subscriber: hfinkel.
hfinkel added a comment.

I'm *really* nervous about doing anything with  
-f(no-)delete-null-pointer-checks that makes it look like we support this 
feature without actually supporting it in the backend.

In computePointerICmp in InstructionSimplify.cpp, we have:

  // A non-null pointer is not equal to a null pointer.
  if (llvm::isKnownNonNull(LHS, TLI) && isa(RHS) &&
  (Pred == CmpInst::ICMP_EQ || Pred == CmpInst::ICMP_NE))
return ConstantInt::get(GetCompareTy(LHS),
!CmpInst::isTrueWhenEqual(Pred));

I'd much rather have the frontend add an attribute (and I think it must be an 
attribute because of how this needs to work in LTO) that disables this, and any 
other necessary checks.


http://reviews.llvm.org/D17993



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


Re: [PATCH] D14286: ASTImporter: expressions, pt.1

2016-03-09 Thread Aleksei Sidorin via cfe-commits
a.sidorin removed rL LLVM as the repository for this revision.
a.sidorin updated this revision to Diff 50140.
a.sidorin added a comment.

Stylish fixes.

Serge: ASTMatcher review is complete so there should be no more build problems. 
Could you try again?
Also, I'd prefer to add your changes in the next patch, without splitting. 
About missing tests: they are planned in later patches too.


http://reviews.llvm.org/D14286

Files:
  include/clang/AST/Type.h
  lib/AST/ASTImporter.cpp
  unittests/AST/ASTImporterTest.cpp
  unittests/AST/CMakeLists.txt
  unittests/AST/MatchVerifier.h

Index: unittests/AST/MatchVerifier.h
===
--- unittests/AST/MatchVerifier.h
+++ unittests/AST/MatchVerifier.h
@@ -62,6 +62,9 @@
  std::vector& Args,
  Language L);
 
+  template 
+  testing::AssertionResult match(const Decl *D, const MatcherType );
+
 protected:
   void run(const MatchFinder::MatchResult ) override;
   virtual void verify(const MatchFinder::MatchResult ,
@@ -127,6 +130,22 @@
   return testing::AssertionSuccess();
 }
 
+/// \brief Runs a matcher over some AST, and returns the result of the
+/// verifier for the matched node.
+template  template 
+testing::AssertionResult MatchVerifier::match(
+const Decl *D, const MatcherType ) {
+  MatchFinder Finder;
+  Finder.addMatcher(AMatcher.bind(""), this);
+
+  setFailure("Could not find match");
+  Finder.match(*D, D->getASTContext());
+
+  if (!Verified)
+return testing::AssertionFailure() << VerifyResult;
+  return testing::AssertionSuccess();
+}
+
 template 
 void MatchVerifier::run(const MatchFinder::MatchResult ) {
   const NodeType *Node = Result.Nodes.getNodeAs("");
Index: unittests/AST/CMakeLists.txt
===
--- unittests/AST/CMakeLists.txt
+++ unittests/AST/CMakeLists.txt
@@ -4,6 +4,7 @@
 
 add_clang_unittest(ASTTests
   ASTContextParentMapTest.cpp
+  ASTImporterTest.cpp
   ASTTypeTraitsTest.cpp
   ASTVectorTest.cpp
   CommentLexer.cpp
Index: unittests/AST/ASTImporterTest.cpp
===
--- /dev/null
+++ unittests/AST/ASTImporterTest.cpp
@@ -0,0 +1,460 @@
+//===- unittest/AST/ASTImporterTest.cpp - AST node import test ===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// Tests for the correct import of AST nodes from one AST context to another.
+//
+//===--===//
+
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/ASTImporter.h"
+#include "MatchVerifier.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
+#include "clang/Tooling/Tooling.h"
+#include "gtest/gtest.h"
+
+namespace clang {
+namespace ast_matchers {
+
+using clang::tooling::newFrontendActionFactory;
+using clang::tooling::runToolOnCodeWithArgs;
+using clang::tooling::FrontendActionFactory;
+
+typedef std::vector StringVector;
+
+void getLangArgs(Language Lang, StringVector ) {
+  switch (Lang) {
+  case Lang_C:
+Args.insert(Args.end(), { "-x", "c", "-std=c99" });
+break;
+  case Lang_C89:
+Args.insert(Args.end(), { "-x", "c", "-std=c89" });
+break;
+  case Lang_CXX:
+Args.push_back("-std=c++98");
+break;
+  case Lang_CXX11:
+Args.push_back("-std=c++11");
+break;
+  case Lang_OpenCL:
+  case Lang_OBJCXX:
+break;
+  }
+}
+
+template
+testing::AssertionResult
+testImport(const std::string , Language FromLang,
+   const std::string , Language ToLang,
+   MatchVerifier ,
+   const MatcherType ) {
+  StringVector FromArgs, ToArgs;
+  getLangArgs(FromLang, FromArgs);
+  getLangArgs(ToLang, ToArgs);
+
+  const char * const InputFileName = "input.cc";
+  const char * const OutputFileName = "output.cc";
+
+  std::unique_ptr
+  FromAST = tooling::buildASTFromCodeWithArgs(
+FromCode, FromArgs, InputFileName),
+  ToAST = tooling::buildASTFromCodeWithArgs(ToCode, ToArgs, OutputFileName);
+
+  ASTContext  = FromAST->getASTContext(),
+   = ToAST->getASTContext();
+
+  // Add input.cc to virtual file system so importer can 'find' it
+  // while importing SourceLocations.
+  vfs::OverlayFileSystem *OFS = static_cast(
+ToCtx.getSourceManager().getFileManager().getVirtualFileSystem().get());
+  vfs::InMemoryFileSystem *MFS = static_cast(
+OFS->overlays_begin()->get());
+  MFS->addFile(InputFileName, 0,
+   llvm::MemoryBuffer::getMemBuffer(FromCode.c_str()));
+
+  ASTImporter Importer(ToCtx, ToAST->getFileManager(),
+   FromCtx, FromAST->getFileManager(), false);
+
+  IdentifierInfo *ImportedII = 

Re: [PATCH] D17877: [OpenMP] Base support for target directive codegen on NVPTX device.

2016-03-09 Thread Arpith Jacob via cfe-commits
arpith-jacob marked 9 inline comments as done.


Comment at: lib/CodeGen/CGOpenMPRuntime.h:69
@@ +68,3 @@
+  /// evaluates to false.
+  virtual void emitTargetOutlinedFunctionHelper(const OMPExecutableDirective 
,
+StringRef ParentName,

Do we need 'virtual'?  This function needs to be called by the NVPTX 
implementation (in emitTargetOutlinedFunction) but doesn't need to be 
overridden.


http://reviews.llvm.org/D17877



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


Re: [PATCH] D17877: [OpenMP] Base support for target directive codegen on NVPTX device.

2016-03-09 Thread Arpith Jacob via cfe-commits
arpith-jacob updated this revision to Diff 50143.
arpith-jacob marked 2 inline comments as done.
arpith-jacob added a comment.

Stylistic changes to address feedback.


http://reviews.llvm.org/D17877

Files:
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGOpenMPRuntime.h
  lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
  lib/CodeGen/CGOpenMPRuntimeNVPTX.h
  test/OpenMP/nvptx_target_codegen.cpp

Index: test/OpenMP/nvptx_target_codegen.cpp
===
--- /dev/null
+++ test/OpenMP/nvptx_target_codegen.cpp
@@ -0,0 +1,587 @@
+// Test target codegen - host bc file has to be created first.
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -omptargets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -omptargets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -omp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple i386-unknown-unknown -omptargets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx-unknown-unknown -omptargets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device -omp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+// CHECK-DAG: [[OMP_NT:@.+]] = common addrspace(3) global i32 0
+// CHECK-DAG: [[OMP_WID:@.+]] = common addrspace(3) global i64 0
+
+template
+struct TT{
+  tx X;
+  ty Y;
+};
+
+int foo(int n) {
+  int a = 0;
+  short aa = 0;
+  float b[10];
+  float bn[n];
+  double c[5][10];
+  double cn[5][n];
+  TT d;
+
+  // CHECK: define {{.*}}void [[T1:@__omp_offloading_.+foo.+]]_worker()
+  // CHECK: br label {{%?}}[[AWAIT_WORK:.+]]
+  //
+  // CHECK: [[AWAIT_WORK]]
+  // CHECK-NEXT: call void @llvm.nvvm.barrier0()
+  // CHECK-NEXT: [[WORK:%.+]] = load i64, i64 addrspace(3)* [[OMP_WID]],
+  // CHECK-NEXT: [[SHOULD_EXIT:%.+]] = icmp eq i64 [[WORK]], 0
+  // CHECK-NEXT: br i1 [[SHOULD_EXIT]], label {{%?}}[[EXIT:.+]], label {{%?}}[[SEL_WORKERS:.+]]
+  //
+  // CHECK: [[SEL_WORKERS]]
+  // CHECK-NEXT: [[TID:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
+  // CHECK-NEXT: [[NT:%.+]] = load i32, i32 addrspace(3)* [[OMP_NT]]
+  // CHECK-NEXT: [[IS_ACTIVE:%.+]] = icmp slt i32 [[TID]], [[NT]]
+  // CHECK-NEXT: br i1 [[IS_ACTIVE]], label {{%?}}[[EXEC_PARALLEL:.+]], label {{%?}}[[BAR_PARALLEL:.+]]
+  //
+  // CHECK: [[EXEC_PARALLEL]]
+  // CHECK-NEXT: br label {{%?}}[[TERM_PARALLEL:.+]]
+  //
+  // CHECK: [[TERM_PARALLEL]]
+  // CHECK-NEXT: br label {{%?}}[[BAR_PARALLEL]]
+  //
+  // CHECK: [[BAR_PARALLEL]]
+  // CHECK-NEXT: call void @llvm.nvvm.barrier0()
+  // CHECK-NEXT: br label {{%?}}[[AWAIT_WORK]]
+  //
+  // CHECK: [[EXIT]]
+  // CHECK-NEXT: ret void
+
+  // CHECK: define {{.*}}void [[T1]]()
+  // CHECK: [[NTID:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.ntid.x()
+  // CHECK-NEXT: [[WS:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.warpsize()
+  // CHECK-NEXT: [[A:%.+]] = sub i32 [[WS]], 1
+  // CHECK-NEXT: [[B:%.+]] = sub i32 [[NTID]], 1
+  // CHECK-NEXT: [[C:%.+]] = xor i32 [[A]], -1
+  // CHECK-NEXT: [[MID:%.+]] = and i32 [[B]], [[C]]
+  // CHECK-NEXT: [[TID:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
+  // CHECK-NEXT: [[EXCESS:%.+]] = icmp ugt i32 [[TID]], [[MID]]
+  // CHECK-NEXT: br i1 [[EXCESS]], label {{%?}}[[EXIT:.+]], label {{%?}}[[CHECK_WORKER:.+]]
+  //
+  // CHECK: [[CHECK_WORKER]]
+  // CHECK-NEXT: [[IS_WORKER:%.+]] = icmp ult i32 [[TID]], [[MID]]
+  // CHECK-NEXT: br i1 [[IS_WORKER]], label {{%?}}[[WORKER:.+]], label {{%?}}[[MASTER:.+]]
+  //
+  // CHECK: [[WORKER]]
+  // CHECK-NEXT: call void [[T1]]_worker()
+  // CHECK-NEXT: br label {{%?}}[[EXIT]]
+  //
+  // CHECK: [[MASTER]]
+  // CHECK-NEXT: [[TID:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
+  // CHECK-NEXT: call void @__kmpc_kernel_init(i32 0, i32 [[TID]])
+  // CHECK-NEXT: br label {{%?}}[[TERM:.+]]
+  //
+  // CHECK: [[TERM]]
+  // CHECK-NEXT: store i64 0, i64 addrspace(3)* [[OMP_WID]],
+  // CHECK-NEXT: call void @llvm.nvvm.barrier0()
+  // CHECK-NEXT: br label {{%?}}[[EXIT]]
+  //
+  // CHECK: [[EXIT]]
+  // CHECK-NEXT: ret void
+  #pragma omp target
+  {
+  }
+
+  // CHECK-NOT: define {{.*}}void [[T2:@__omp_offloading_.+foo.+]]_worker()
+  #pragma omp target if(0)
+  {
+  }
+
+  // CHECK: define {{.*}}void [[T3:@__omp_offloading_.+foo.+]]_worker()
+  // CHECK: br label {{%?}}[[AWAIT_WORK:.+]]
+  //
+  // CHECK: [[AWAIT_WORK]]
+  // CHECK-NEXT: call void @llvm.nvvm.barrier0()
+  // CHECK-NEXT: [[WORK:%.+]] = load i64, i64 addrspace(3)* [[OMP_WID]],
+  // CHECK-NEXT: [[SHOULD_EXIT:%.+]] = icmp eq i64 [[WORK]], 0
+  // CHECK-NEXT: br i1 [[SHOULD_EXIT]], label {{%?}}[[EXIT:.+]], label {{%?}}[[SEL_WORKERS:.+]]
+  //
+  // CHECK: [[SEL_WORKERS]]
+  // CHECK-NEXT: [[TID:%.+]] = call i32 

Re: [PATCH] D17419: [libcxx] Split locale management out of locale_win32. NFCI

2016-03-09 Thread Ben Craig via cfe-commits
bcraig accepted this revision.
bcraig added a reviewer: bcraig.
bcraig added a comment.
This revision is now accepted and ready to land.

Committed


http://reviews.llvm.org/D17419



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


  1   2   >