Re: [PATCH] D10802: [mips] Interrupt attribute support.

2015-11-17 Thread Simon Dardis via cfe-commits
sdardis updated this revision to Diff 40382.
sdardis marked 12 inline comments as done.
sdardis added a comment.

Updated documentation text.

Switched the various hard failures to semantic warnings/failures.

Strangely, the 'interrupt' attribute on a non-function defaults to a warning.

Thanks.


http://reviews.llvm.org/D10802

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/CodeGen/TargetInfo.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGen/mips-interrupt-attr.c
  test/Sema/mips-interrupt-attr.c

Index: test/Sema/mips-interrupt-attr.c
===
--- /dev/null
+++ test/Sema/mips-interrupt-attr.c
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 %s -triple mips-img-elf -verify -fsyntax-only
+struct a { int b; };
+
+struct a test __attribute__((interrupt)); // expected-warning {{'interrupt' attribute only applies to functions and methods}}
+
+__attribute__((interrupt("EIC"))) void foo1() {} // expected-warning {{'interrupt' attribute argument not supported: 'EIC'}}
+
+__attribute__((interrupt("eic", 1))) void foo2() {} // expected-error {{'interrupt' attribute takes no more than 1 argument}}
+
+__attribute__((interrupt("eic"))) void foo3() {}
+__attribute__((interrupt("vector=sw0"))) void foo4() {}
+__attribute__((interrupt("vector=hw0"))) void foo5() {}
+__attribute__((interrupt("vector=hw1"))) void foo6() {}
+__attribute__((interrupt("vector=hw2"))) void foo7() {}
+__attribute__((interrupt("vector=hw3"))) void foo8() {}
+__attribute__((interrupt("vector=hw4"))) void foo9() {}
+__attribute__((interrupt("vector=hw5"))) void fooa() {}
+
+__attribute__((interrupt)) int foob() {} // expected-error {{function 'foob' does not have the 'void' return type}}
+__attribute__((interrupt())) void fooc(int a) {} // expected-error {{function 'fooc' has too many arguments}}
+__attribute__((interrupt(""))) void food() {}
+__attribute__((interrupt,mips16)) void fooe() {} // expected-error {{'interrupt' and 'mips16' attributes are not compatible}}
Index: test/CodeGen/mips-interrupt-attr.c
===
--- /dev/null
+++ test/CodeGen/mips-interrupt-attr.c
@@ -0,0 +1,64 @@
+// RUN: %clang_cc1 -triple mipsel-unknown-linux -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK
+
+void __attribute__ ((interrupt("vector=sw0")))
+isr_sw0 (void)
+{
+  // CHECK: define void @isr_sw0() [[SW0:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=sw1")))
+isr_sw1 (void)
+{
+  // CHECK: define void @isr_sw1() [[SW1:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=hw0")))
+isr_hw0 (void)
+{
+  // CHECK: define void @isr_hw0() [[HW0:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=hw1")))
+isr_hw1 (void)
+{
+  // CHECK: define void @isr_hw1() [[HW1:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=hw2")))
+isr_hw2 (void)
+{
+  // CHECK: define void @isr_hw2() [[HW2:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=hw3")))
+isr_hw3 (void)
+{
+  // CHECK: define void @isr_hw3() [[HW3:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=hw4")))
+isr_hw4 (void)
+{
+  // CHECK: define void @isr_hw4() [[HW4:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=hw5")))
+isr_hw5 (void)
+{
+  // CHECK: define void @isr_hw5() [[HW5:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt))
+isr_eic (void)
+{
+  // CHECK: define void @isr_eic() [[EIC:#[0-9]+]]
+}
+// CHECK: attributes [[SW0]] = { {{.*}} "interrupt"="sw0" {{.*}} }
+// CHECK: attributes [[SW1]] = { {{.*}} "interrupt"="sw1" {{.*}} }
+// CHECK: attributes [[HW0]] = { {{.*}} "interrupt"="hw0" {{.*}} }
+// CHECK: attributes [[HW1]] = { {{.*}} "interrupt"="hw1" {{.*}} }
+// CHECK: attributes [[HW2]] = { {{.*}} "interrupt"="hw2" {{.*}} }
+// CHECK: attributes [[HW3]] = { {{.*}} "interrupt"="hw3" {{.*}} }
+// CHECK: attributes [[HW4]] = { {{.*}} "interrupt"="hw4" {{.*}} }
+// CHECK: attributes [[HW5]] = { {{.*}} "interrupt"="hw5" {{.*}} }
+// CHECK: attributes [[EIC]] = { {{.*}} "interrupt"="eic" {{.*}} }
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -4408,10 +4408,74 @@
   D->addAttr(UsedAttr::CreateImplicit(S.Context));
 }
 
+static void handleMipsInterruptAttr(Sema , Decl *D,
+const AttributeList ) {
+  // Only one optional argument permitted.
+  if (Attr.getNumArgs() > 1) {
+S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments)
+<< Attr.getName() << 1;
+return;
+  }
+
+  StringRef Str;
+  SourceLocation ArgLoc;
+
+  if (Attr.getNumArgs() == 0)
+Str = "";
+  else if (!S.checkStringLiteralArgumentAttr(Attr, 0, Str, ))
+return;
+
+
+  // Semantic checks for a function with the 'interrupt' attribute.
+  // a) Must be a function.
+  // b) Must take no arguments.
+  // c) Must have the 'void' return type.
+  // d) Cannot also 

Re: [PATCH] D14467: [MS] Fix for bug 25013 - #pragma vtordisp is unknown inside functions.

2015-11-17 Thread Denis Zobnin via cfe-commits
d.zobnin.bugzilla updated this revision to Diff 40380.
d.zobnin.bugzilla added a comment.

Only tests have been updated: enabled a test case for Sema, which pass with 
these changes, added corresponding test case for CodeGen.


http://reviews.llvm.org/D14467

Files:
  include/clang/Sema/Sema.h
  lib/Parse/ParseDeclCXX.cpp
  lib/Parse/ParseStmt.cpp
  test/Layout/ms-vtordisp-local.cpp
  test/SemaCXX/pragma-vtordisp.cpp

Index: lib/Parse/ParseDeclCXX.cpp
===
--- lib/Parse/ParseDeclCXX.cpp
+++ lib/Parse/ParseDeclCXX.cpp
@@ -2854,6 +2854,11 @@
 return DeclGroupPtrTy();
   }
 
+  if (Tok.is(tok::annot_pragma_ms_vtordisp)) {
+HandlePragmaMSVtorDisp();
+return DeclGroupPtrTy();
+  }
+
   // If we see a namespace here, a close brace was missing somewhere.
   if (Tok.is(tok::kw_namespace)) {
 DiagnoseUnexpectedNamespace(cast(TagDecl));
Index: lib/Parse/ParseStmt.cpp
===
--- lib/Parse/ParseStmt.cpp
+++ lib/Parse/ParseStmt.cpp
@@ -358,6 +358,11 @@
 HandlePragmaMSPragma();
 return StmtEmpty();
 
+  case tok::annot_pragma_ms_vtordisp:
+ProhibitAttributes(Attrs);
+HandlePragmaMSVtorDisp();
+return StmtEmpty();
+
   case tok::annot_pragma_loop_hint:
 ProhibitAttributes(Attrs);
 return ParsePragmaLoopHint(Stmts, OnlyStatement, TrailingElseLoc, Attrs);
@@ -885,6 +890,9 @@
 case tok::annot_pragma_ms_pragma:
   HandlePragmaMSPragma();
   break;
+case tok::annot_pragma_ms_vtordisp:
+  HandlePragmaMSVtorDisp();
+  break;
 default:
   checkForPragmas = false;
   break;
@@ -1895,6 +1903,11 @@
   PrettyDeclStackTraceEntry CrashInfo(Actions, Decl, LBraceLoc,
   "parsing function body");
 
+  // Save and reset current vtordisp stack if we have entered a C++ method body.
+  bool IsCXXMethod =
+  getLangOpts().CPlusPlus && Decl && isa(Decl);
+  Sema::VtorDispStackRAII SavedVtorDispStack(Actions, IsCXXMethod);
+
   // Do not enter a scope for the brace, as the arguments are in the same scope
   // (the function body) as the body itself.  Instead, just read the statement
   // list and put it into a CompoundStmt for safe keeping.
@@ -1934,6 +1947,11 @@
 return Actions.ActOnSkippedFunctionBody(Decl);
   }
 
+  // Save and reset current vtordisp stack if we have entered a C++ method body.
+  bool IsCXXMethod =
+  getLangOpts().CPlusPlus && Decl && isa(Decl);
+  Sema::VtorDispStackRAII SavedVtorDispStack(Actions, IsCXXMethod);
+
   SourceLocation LBraceLoc = Tok.getLocation();
   StmtResult FnBody(ParseCXXTryBlockCommon(TryLoc, /*FnTry*/true));
   // If we failed to parse the try-catch, we just give the function an empty
Index: include/clang/Sema/Sema.h
===
--- include/clang/Sema/Sema.h
+++ include/clang/Sema/Sema.h
@@ -1007,6 +1007,24 @@
 bool OldFPContractState : 1;
   };
 
+  /// Records and restores the vtordisp state on entry/exit of C++ method body.
+  class VtorDispStackRAII {
+  public:
+VtorDispStackRAII(Sema , bool ShouldSaveAndRestore)
+  : S(S), ShouldSaveAndRestore(ShouldSaveAndRestore), OldVtorDispStack() {
+  if (ShouldSaveAndRestore)
+OldVtorDispStack = S.VtorDispModeStack;
+}
+~VtorDispStackRAII() {
+  if (ShouldSaveAndRestore)
+S.VtorDispModeStack = OldVtorDispStack;
+}
+  private:
+Sema 
+bool ShouldSaveAndRestore;
+SmallVector OldVtorDispStack;
+  };
+
   void addImplicitTypedef(StringRef Name, QualType T);
 
 public:
Index: test/Layout/ms-vtordisp-local.cpp
===
--- test/Layout/ms-vtordisp-local.cpp
+++ test/Layout/ms-vtordisp-local.cpp
@@ -0,0 +1,217 @@
+// RUN: %clang_cc1 -fms-extensions -fexceptions -fcxx-exceptions -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only %s 2>&1 | FileCheck %s
+
+struct Base {
+  virtual ~Base() {}
+  virtual void BaseFunc() {}
+};
+
+#pragma vtordisp(0)
+
+struct Container {
+  static void f() try {
+#pragma vtordisp(2)
+struct HasVtorDisp : virtual Base {
+  virtual ~HasVtorDisp() {}
+  virtual void Func() {}
+};
+
+int x[sizeof(HasVtorDisp)];
+
+// HasVtorDisp: vtordisp because of pragma right before it.
+//
+// CHECK: *** Dumping AST Record Layout
+// CHECK: *** Dumping AST Record Layout
+// CHECK-NEXT:  0 | struct HasVtorDisp
+// CHECK-NEXT:  0 |   (HasVtorDisp vftable pointer)
+// CHECK-NEXT:  8 |   (HasVtorDisp vbtable pointer)
+// CHECK-NEXT: 20 |   (vtordisp for vbase Base)
+// CHECK-NEXT: 24 |   struct Base (virtual base)
+// CHECK-NEXT: 24 | (Base vftable pointer)
+// CHECK-NEXT:| [sizeof=32, align=8,
+// CHECK-NEXT:|  nvsize=16, nvalign=8]
+  } 

Re: r253269 - Make FP_CONTRACT ON the default.

2015-11-17 Thread Manuel Klimek via cfe-commits
Note that due to this change we're hitting an assert at
lib/CodeGen/CGExprScalar.cpp:2570 in llvm::Value *tryEmitFMulAdd(const
(anonymous namespace)::BinOpInfo &, const clang::CodeGen::CodeGenFunction
&, clang::CodeGen::CGBuilderTy &, bool): LHSBinOp->getNumUses(
) == 0 && "Operations with multiple uses shouldn't be contracted."

Don't have a small repro yet :(

On Tue, Nov 17, 2015 at 1:39 PM Hal Finkel via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> - Original Message -
> > From: "Renato Golin via cfe-commits" 
> > To: "Stephen Canon" 
> > Cc: "Clang Commits" 
> > Sent: Tuesday, November 17, 2015 3:51:23 AM
> > Subject: Re: r253269 - Make FP_CONTRACT ON the default.
> >
> > On 16 November 2015 at 23:09, Stephen Canon via cfe-commits
> >  wrote:
> > > Author: scanon
> > > Date: Mon Nov 16 17:09:11 2015
> > > New Revision: 253269
> > >
> > > URL: http://llvm.org/viewvc/llvm-project?rev=253269=rev
> > > Log:
> > > Make FP_CONTRACT ON the default.
> > >
> > > Differential Revision: D14200
> >
> > Hi Stephen,
> >
> > It seems your commit in the blame list is the only one that affects
> > AArch64 directly:
> >
> > http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/2388
> >
> > I haven't bisected yet, but would be good if you could try those
> > tests
> > locally, just to make sure it wasn't your commit, and revert if it
> > was, to fix offline.
>
> The test suite already has logic to add -ffp-contract=off on PowerPC so
> that we can compare to the binary outputs. We may need to do this now for
> all targets, at least until be come up with a better solution.
>
>  -Hal
>
> >
> > cheers,
> > --renato
> > ___
> > cfe-commits mailing list
> > cfe-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> >
>
> --
> Hal Finkel
> Assistant Computational Scientist
> Leadership Computing Facility
> Argonne National Laboratory
> ___
> 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: r253269 - Make FP_CONTRACT ON the default.

2015-11-17 Thread Hal Finkel via cfe-commits
- Original Message -
> From: "Renato Golin via cfe-commits" 
> To: "Stephen Canon" 
> Cc: "Clang Commits" 
> Sent: Tuesday, November 17, 2015 3:51:23 AM
> Subject: Re: r253269 - Make FP_CONTRACT ON the default.
> 
> On 16 November 2015 at 23:09, Stephen Canon via cfe-commits
>  wrote:
> > Author: scanon
> > Date: Mon Nov 16 17:09:11 2015
> > New Revision: 253269
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=253269=rev
> > Log:
> > Make FP_CONTRACT ON the default.
> >
> > Differential Revision: D14200
> 
> Hi Stephen,
> 
> It seems your commit in the blame list is the only one that affects
> AArch64 directly:
> 
> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/2388
> 
> I haven't bisected yet, but would be good if you could try those
> tests
> locally, just to make sure it wasn't your commit, and revert if it
> was, to fix offline.

The test suite already has logic to add -ffp-contract=off on PowerPC so that we 
can compare to the binary outputs. We may need to do this now for all targets, 
at least until be come up with a better solution.

 -Hal

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

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14467: [MS] Fix for bug 25013 - #pragma vtordisp is unknown inside functions.

2015-11-17 Thread Denis Zobnin via cfe-commits
d.zobnin.bugzilla added inline comments.


Comment at: test/SemaCXX/pragma-vtordisp.cpp:34-35
@@ -33,6 +33,4 @@
 
 struct C {
-// FIXME: Our implementation based on token insertion makes it impossible for
-// the pragma to appear everywhere we should support it.
-//#pragma vtordisp()
+#pragma vtordisp()
   struct D : virtual A {

Yes, we can. Enabled this case, it passes with these changes.


http://reviews.llvm.org/D14467



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


Re: [PATCH] D13731: [Analyzer] Supporting function attributes in .model files.

2015-11-17 Thread pierre gousseau via cfe-commits
pgousseau added a comment.

Ping!


http://reviews.llvm.org/D13731



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


Re: r253269 - Make FP_CONTRACT ON the default.

2015-11-17 Thread Manuel Klimek via cfe-commits
Reverted in r253337. Failing test case in commit message.

On Tue, Nov 17, 2015 at 4:39 PM Manuel Klimek  wrote:

> Repro:
> float foo(float U, float base, float cell) { return (U = 2 * base) - cell;
> }
> Preparing rollback of the CL.
>
> On Tue, Nov 17, 2015 at 2:46 PM Manuel Klimek  wrote:
>
>> Note that due to this change we're hitting an assert at
>> lib/CodeGen/CGExprScalar.cpp:2570 in llvm::Value *tryEmitFMulAdd(const
>> (anonymous namespace)::BinOpInfo &, const clang::CodeGen::CodeGenFunction
>> &, clang::CodeGen::CGBuilderTy &, bool): LHSBinOp->getNumUses(
>> ) == 0 && "Operations with multiple uses shouldn't be contracted."
>>
>> Don't have a small repro yet :(
>>
>> On Tue, Nov 17, 2015 at 1:39 PM Hal Finkel via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> - Original Message -
>>> > From: "Renato Golin via cfe-commits" 
>>> > To: "Stephen Canon" 
>>> > Cc: "Clang Commits" 
>>> > Sent: Tuesday, November 17, 2015 3:51:23 AM
>>> > Subject: Re: r253269 - Make FP_CONTRACT ON the default.
>>> >
>>> > On 16 November 2015 at 23:09, Stephen Canon via cfe-commits
>>> >  wrote:
>>> > > Author: scanon
>>> > > Date: Mon Nov 16 17:09:11 2015
>>> > > New Revision: 253269
>>> > >
>>> > > URL: http://llvm.org/viewvc/llvm-project?rev=253269=rev
>>> > > Log:
>>> > > Make FP_CONTRACT ON the default.
>>> > >
>>> > > Differential Revision: D14200
>>> >
>>> > Hi Stephen,
>>> >
>>> > It seems your commit in the blame list is the only one that affects
>>> > AArch64 directly:
>>> >
>>> >
>>> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/2388
>>> >
>>> > I haven't bisected yet, but would be good if you could try those
>>> > tests
>>> > locally, just to make sure it wasn't your commit, and revert if it
>>> > was, to fix offline.
>>>
>>> The test suite already has logic to add -ffp-contract=off on PowerPC so
>>> that we can compare to the binary outputs. We may need to do this now for
>>> all targets, at least until be come up with a better solution.
>>>
>>>  -Hal
>>>
>>> >
>>> > cheers,
>>> > --renato
>>> > ___
>>> > cfe-commits mailing list
>>> > cfe-commits@lists.llvm.org
>>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>> >
>>>
>>> --
>>> Hal Finkel
>>> Assistant Computational Scientist
>>> Leadership Computing Facility
>>> Argonne National Laboratory
>>> ___
>>> 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


r253337 - Revert "Make FP_CONTRACT ON the default."

2015-11-17 Thread Manuel Klimek via cfe-commits
Author: klimek
Date: Tue Nov 17 09:40:10 2015
New Revision: 253337

URL: http://llvm.org/viewvc/llvm-project?rev=253337=rev
Log:
Revert "Make FP_CONTRACT ON the default."

This reverts commit r253269.

This leads to assert / segfault triggering on the following reduced example:
float foo(float U, float base, float cell) { return (U = 2 * base) - cell; }

Removed:
cfe/trunk/test/CodeGen/aarch64-scalar-fma.c
Modified:
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/CodeGen/aarch64-neon-fma.c
cfe/trunk/test/CodeGen/fp-contract-pragma.cpp
cfe/trunk/test/Driver/clang_f_opts.c

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=253337=253336=253337=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Tue Nov 17 09:40:10 2015
@@ -187,7 +187,7 @@ BENIGN_LANGOPT(DebuggerObjCLiteral , 1,
 BENIGN_LANGOPT(SpellChecking , 1, 1, "spell-checking")
 LANGOPT(SinglePrecisionConstants , 1, 0, "treating double-precision floating 
point constants as single precision constants")
 LANGOPT(FastRelaxedMath , 1, 0, "OpenCL fast relaxed math")
-LANGOPT(DefaultFPContract , 1, 1, "FP_CONTRACT")
+LANGOPT(DefaultFPContract , 1, 0, "FP_CONTRACT")
 LANGOPT(NoBitFieldTypeAlign , 1, 0, "bit-field type alignment")
 LANGOPT(HexagonQdsp6Compat , 1, 0, "hexagon-qdsp6 backward compatibility")
 LANGOPT(ObjCAutoRefCount , 1, 0, "Objective-C automated reference counting")

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=253337=253336=253337=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Nov 17 09:40:10 2015
@@ -1336,6 +1336,7 @@ void CompilerInvocation::setLangDefaults
 Opts.ZVector = 0;
 Opts.CXXOperatorNames = 1;
 Opts.LaxVectorConversions = 0;
+Opts.DefaultFPContract = 1;
 Opts.NativeHalfType = 1;
   }
 

Modified: cfe/trunk/test/CodeGen/aarch64-neon-fma.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/aarch64-neon-fma.c?rev=253337=253336=253337=diff
==
--- cfe/trunk/test/CodeGen/aarch64-neon-fma.c (original)
+++ cfe/trunk/test/CodeGen/aarch64-neon-fma.c Tue Nov 17 09:40:10 2015
@@ -1,8 +1,5 @@
 // REQUIRES: aarch64-registered-target
-// RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon -S -O3 \
-// RUN:   -ffp-contract=off -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon -S -O3 \
-// RUN:   -o - %s | FileCheck -check-prefix=CHECK-FMA %s
+// RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon -S -O3 
-o - %s | FileCheck %s
 
 // Test new aarch64 intrinsics and types
 
@@ -13,7 +10,8 @@ float32x2_t test_vmla_n_f32(float32x2_t
   return vmla_n_f32(a, b, c);
   // CHECK: fmul {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.s[0]
   // CHECK: fadd {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
-  // CHECK-FMA: fmla {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.s[0]
+  // CHECK-FMA: dup {{v[0-9]+}}.2s, {{v[0-9]+}}.s[0]
+  // CHECK-FMA: fmla {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
 }
 
 float32x4_t test_vmlaq_n_f32(float32x4_t a, float32x4_t b, float32_t c) {
@@ -21,7 +19,8 @@ float32x4_t test_vmlaq_n_f32(float32x4_t
   return vmlaq_n_f32(a, b, c);
   // CHECK: fmul {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
   // CHECK: fadd {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
-  // CHECK-FMA: fmla {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
+  // CHECK-FMA: dup {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
+  // CHECK-FMA: fmla {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
 }
 
 float64x2_t test_vmlaq_n_f64(float64x2_t a, float64x2_t b, float64_t c) {
@@ -29,7 +28,8 @@ float64x2_t test_vmlaq_n_f64(float64x2_t
   return vmlaq_n_f64(a, b, c);
   // CHECK: fmul {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.d[0]
   // CHECK: fadd {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
-  // CHECK-FMA: fmla {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.d[0]
+  // CHECK-FMA: dup {{v[0-9]+}}.2d, {{v[0-9]+}}.d[0]
+  // CHECK-FMA: fmla {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
 }
 
 float32x4_t test_vmlsq_n_f32(float32x4_t a, float32x4_t b, float32_t c) {
@@ -37,7 +37,8 @@ float32x4_t test_vmlsq_n_f32(float32x4_t
   return vmlsq_n_f32(a, b, c);
   // CHECK: fmul {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
   // CHECK: fsub {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
-  // CHECK-FMA: fmls {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
+  // CHECK-FMA: dup {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
+  // CHECK-FMA: fmls 

Re: r253269 - Make FP_CONTRACT ON the default.

2015-11-17 Thread Manuel Klimek via cfe-commits
Repro:
float foo(float U, float base, float cell) { return (U = 2 * base) - cell; }
Preparing rollback of the CL.

On Tue, Nov 17, 2015 at 2:46 PM Manuel Klimek  wrote:

> Note that due to this change we're hitting an assert at
> lib/CodeGen/CGExprScalar.cpp:2570 in llvm::Value *tryEmitFMulAdd(const
> (anonymous namespace)::BinOpInfo &, const clang::CodeGen::CodeGenFunction
> &, clang::CodeGen::CGBuilderTy &, bool): LHSBinOp->getNumUses(
> ) == 0 && "Operations with multiple uses shouldn't be contracted."
>
> Don't have a small repro yet :(
>
> On Tue, Nov 17, 2015 at 1:39 PM Hal Finkel via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> - Original Message -
>> > From: "Renato Golin via cfe-commits" 
>> > To: "Stephen Canon" 
>> > Cc: "Clang Commits" 
>> > Sent: Tuesday, November 17, 2015 3:51:23 AM
>> > Subject: Re: r253269 - Make FP_CONTRACT ON the default.
>> >
>> > On 16 November 2015 at 23:09, Stephen Canon via cfe-commits
>> >  wrote:
>> > > Author: scanon
>> > > Date: Mon Nov 16 17:09:11 2015
>> > > New Revision: 253269
>> > >
>> > > URL: http://llvm.org/viewvc/llvm-project?rev=253269=rev
>> > > Log:
>> > > Make FP_CONTRACT ON the default.
>> > >
>> > > Differential Revision: D14200
>> >
>> > Hi Stephen,
>> >
>> > It seems your commit in the blame list is the only one that affects
>> > AArch64 directly:
>> >
>> > http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/2388
>> >
>> > I haven't bisected yet, but would be good if you could try those
>> > tests
>> > locally, just to make sure it wasn't your commit, and revert if it
>> > was, to fix offline.
>>
>> The test suite already has logic to add -ffp-contract=off on PowerPC so
>> that we can compare to the binary outputs. We may need to do this now for
>> all targets, at least until be come up with a better solution.
>>
>>  -Hal
>>
>> >
>> > cheers,
>> > --renato
>> > ___
>> > cfe-commits mailing list
>> > cfe-commits@lists.llvm.org
>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>> >
>>
>> --
>> Hal Finkel
>> Assistant Computational Scientist
>> Leadership Computing Facility
>> Argonne National Laboratory
>> ___
>> 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] D14134: [OpenMP] Parsing and sema support for map clause

2015-11-17 Thread Alexey Bataev via cfe-commits
ABataev added inline comments.


Comment at: include/clang/AST/OpenMPClause.h:2660-2662
@@ +2659,5 @@
+  ///
+  /// \param StartLoc Starting location of the clause.
+  /// \param EndLoc Ending location of the clause.
+  /// \param N Number of the variables in the clause.
+  ///

Not all important arguments are described


Comment at: include/clang/AST/OpenMPClause.h:2683-2686
@@ +2682,6 @@
+  ///
+  /// \param C AST context.
+  /// \brief StartLoc Starting location of the clause.
+  /// \brief EndLoc Ending location of the clause.
+  /// \param VL List of references to the variables.
+  ///

Not all important arguments are described


Comment at: lib/Basic/OpenMPKinds.cpp:199
@@ +198,3 @@
+  return "unknown";
+#define OPENMP_MAP_KIND(Name)\
+  case OMPC_MAP_##Name:  \

Extra spaces between arg and ')'


Comment at: lib/Sema/SemaOpenMP.cpp:318-342
@@ -310,1 +317,27 @@
+
+  MapInfo getMapInfoForVar(VarDecl *VD) {
+MapInfo Tmp = {0};
+for (auto Cnt = Stack.size() - 1; Cnt > 0; --Cnt) {
+  if (Stack[Cnt].MappedDecls.count(VD)) {
+Tmp = Stack[Cnt].MappedDecls[VD];
+break;
+  }
+}
+return Tmp;
+  }
+
+  void addMapInfoForVar(VarDecl *VD, MapInfo MI) {
+if (Stack.size() > 1) {
+  Stack.back().MappedDecls[VD] = MI;
+}
+  }
+
+  MapInfo IsMappedInCurrentRegion(VarDecl *VD) {
+assert(Stack.size() > 1 && "Target level is 0");
+MapInfo Tmp = {0};
+if (Stack.size() > 1 && Stack.back().MappedDecls.count(VD)) {
+  Tmp = Stack.back().MappedDecls[VD];
+}
+return Tmp;
+  }
 };

Tmp is bad name.


Comment at: test/OpenMP/target_data_ast_print.cpp:1
@@ -1,2 +1,2 @@
 // RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s
 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s

Also add tests for templates, serialization/deserialization


Comment at: test/OpenMP/target_map_messages.cpp:2
@@ +1,3 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+
+void foo() {

Still no tests for templates


http://reviews.llvm.org/D14134



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


Re: [PATCH] D10802: [mips] Interrupt attribute support.

2015-11-17 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: include/clang/Basic/DiagnosticSemaKinds.td:255
@@ -254,1 +254,3 @@
 def err_parameter_name_omitted : Error<"parameter name omitted">;
+def err_excess_arguments : Error<"function %0 has too many arguments">;
+def err_wrong_return_type : Error<"function %0 does not have the \'void\' 
return type">;

I would combine these, and name the result so that it is obvious it relates to 
the MIPS interrupt attribute. This can then become: "MIPS 'interrupt' attribute 
only applies to functions %select{with no parameters|a 'void' return type}0" 
Generally speaking, we make these warnings instead of errors (though the choice 
is obviously yours), and add them to the IgnoredAttributes group (so you warn, 
and then never attach the attribute to the declaration).


Comment at: lib/Sema/SemaDeclAttr.cpp:4441
@@ +4440,3 @@
+
+  DeclarationName Name = D->getAsFunction()->getNameInfo().getName();
+

No need for this; you can pass any NamedDecl * into Diag() and it will get 
quoted and displayed properly. Since you've already checked that it's a 
function or method, you can simply use cast(D) when needed.


Comment at: lib/Sema/SemaDeclAttr.cpp:4448
@@ +4447,3 @@
+
+  if (!(getFunctionOrMethodResultType(D)->isVoidType())) {
+S.Diag(D->getLocation(), diag::err_wrong_return_type) << Name;

No need for the extra set of parens.


Comment at: lib/Sema/SemaDeclAttr.cpp:4453
@@ +4452,3 @@
+
+  if (D->hasAttr()) {
+S.Diag(Attr.getLoc(), diag::err_attributes_are_not_compatible)

Please use checkAttrMutualExclusion() instead. Also, you need to add a similar 
check to the Mips16 attribute handler to ensure the mutual exclusion is 
properly checked. Should have semantic test cases for both orderings:
```
__attribute__((mips16)) __attribute__((interrupt)) void f();
__attribute__((interrupt)) __attribute__((mips16)) void g();
```
What about the nomips16 attribute? Should this be mutually exclusive as well?


http://reviews.llvm.org/D10802



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


[PATCH] D14748: bmiintrin.h: Allow using the tzcnt intrinsics for non-BMI targets

2015-11-17 Thread Hans Wennborg via cfe-commits
hans created this revision.
hans added reviewers: thakis, echristo.
hans added a subscriber: cfe-commits.

The tzcnt intrinsics are used non non-BMI targets by code (e.g. ffmpeg) that 
uses it as a potentially faster BSF.

The TZCNT instruction is special in that it's encoded in a backward-compatible 
way and behaves as BSF on non-BMI targets.

http://reviews.llvm.org/D14748

Files:
  lib/Headers/bmiintrin.h

Index: lib/Headers/bmiintrin.h
===
--- lib/Headers/bmiintrin.h
+++ lib/Headers/bmiintrin.h
@@ -39,7 +39,12 @@
 /* Define the default attributes for the functions in this file. */
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, 
__target__("bmi")))
 
-static __inline__ unsigned short __DEFAULT_FN_ATTRS
+/* Allow using the tzcnt intrinsics even for non-BMI targets. Since the TZCNT
+   instruction behaves as BSF on non-BMI targets, there is code that expects
+   to use it as a potentially faster version of BSF. */
+#define __RELAXED_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
+
+static __inline__ unsigned short __RELAXED_FN_ATTRS
 __tzcnt_u16(unsigned short __X)
 {
   return __X ? __builtin_ctzs(__X) : 16;
@@ -83,7 +88,7 @@
   return __X & (__X - 1);
 }
 
-static __inline__ unsigned int __DEFAULT_FN_ATTRS
+static __inline__ unsigned int __RELAXED_FN_ATTRS
 __tzcnt_u32(unsigned int __X)
 {
   return __X ? __builtin_ctz(__X) : 32;
@@ -136,14 +141,15 @@
   return __X & (__X - 1);
 }
 
-static __inline__ unsigned long long __DEFAULT_FN_ATTRS
+static __inline__ unsigned long long __RELAXED_FN_ATTRS
 __tzcnt_u64(unsigned long long __X)
 {
   return __X ? __builtin_ctzll(__X) : 64;
 }
 
 #endif /* __x86_64__ */
 
 #undef __DEFAULT_FN_ATTRS
+#undef __RELAXED_FN_ATTRS
 
 #endif /* __BMIINTRIN_H */


Index: lib/Headers/bmiintrin.h
===
--- lib/Headers/bmiintrin.h
+++ lib/Headers/bmiintrin.h
@@ -39,7 +39,12 @@
 /* Define the default attributes for the functions in this file. */
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("bmi")))
 
-static __inline__ unsigned short __DEFAULT_FN_ATTRS
+/* Allow using the tzcnt intrinsics even for non-BMI targets. Since the TZCNT
+   instruction behaves as BSF on non-BMI targets, there is code that expects
+   to use it as a potentially faster version of BSF. */
+#define __RELAXED_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
+
+static __inline__ unsigned short __RELAXED_FN_ATTRS
 __tzcnt_u16(unsigned short __X)
 {
   return __X ? __builtin_ctzs(__X) : 16;
@@ -83,7 +88,7 @@
   return __X & (__X - 1);
 }
 
-static __inline__ unsigned int __DEFAULT_FN_ATTRS
+static __inline__ unsigned int __RELAXED_FN_ATTRS
 __tzcnt_u32(unsigned int __X)
 {
   return __X ? __builtin_ctz(__X) : 32;
@@ -136,14 +141,15 @@
   return __X & (__X - 1);
 }
 
-static __inline__ unsigned long long __DEFAULT_FN_ATTRS
+static __inline__ unsigned long long __RELAXED_FN_ATTRS
 __tzcnt_u64(unsigned long long __X)
 {
   return __X ? __builtin_ctzll(__X) : 64;
 }
 
 #endif /* __x86_64__ */
 
 #undef __DEFAULT_FN_ATTRS
+#undef __RELAXED_FN_ATTRS
 
 #endif /* __BMIINTRIN_H */
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253350 - Add trivial utility to append -L arguments to linker step. NFC

2015-11-17 Thread Douglas Katzman via cfe-commits
Author: dougk
Date: Tue Nov 17 11:41:23 2015
New Revision: 253350

URL: http://llvm.org/viewvc/llvm-project?rev=253350=rev
Log:
Add trivial utility to append -L arguments to linker step. NFC

Modified:
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=253350=253349=253350=diff
==
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Tue Nov 17 11:41:23 2015
@@ -377,6 +377,10 @@ public:
   virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList ,
llvm::opt::ArgStringList ) const;
 
+  /// AddFilePathLibArgs - Add each thing in getFilePaths() as a "-L" option.
+  void AddFilePathLibArgs(const llvm::opt::ArgList ,
+  llvm::opt::ArgStringList ) const;
+
   /// AddCCKextLibArgs - Add the system specific linker arguments to use
   /// for kernel extensions (Darwin-specific).
   virtual void AddCCKextLibArgs(const llvm::opt::ArgList ,

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=253350=253349=253350=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Tue Nov 17 11:41:23 2015
@@ -616,6 +616,12 @@ void ToolChain::AddCXXStdlibLibArgs(cons
   }
 }
 
+void ToolChain::AddFilePathLibArgs(const ArgList ,
+   ArgStringList ) const {
+  for (const auto  : getFilePaths())
+CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
+}
+
 void ToolChain::AddCCKextLibArgs(const ArgList ,
  ArgStringList ) const {
   CmdArgs.push_back("-lcc_kext");

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253350=253349=253350=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Nov 17 11:41:23 2015
@@ -6153,9 +6153,7 @@ constructHexagonLinkArgs(Compilation ,
   
//
   // Library Search Paths
   
//
-  const ToolChain::path_list  = ToolChain.getFilePaths();
-  for (const auto  : LibPaths)
-CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
+  ToolChain.AddFilePathLibArgs(Args, CmdArgs);
 
   
//
   //
@@ -6525,9 +6523,7 @@ void cloudabi::Linker::ConstructJob(Comp
   }
 
   Args.AddAllArgs(CmdArgs, options::OPT_L);
-  const ToolChain::path_list  = ToolChain.getFilePaths();
-  for (const auto  : Paths)
-CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + Path));
+  ToolChain.AddFilePathLibArgs(Args, CmdArgs);
   Args.AddAllArgs(CmdArgs,
   {options::OPT_T_Group, options::OPT_e, options::OPT_s,
options::OPT_t, options::OPT_Z_Flag, options::OPT_r});
@@ -7127,9 +7123,7 @@ void solaris::Linker::ConstructJob(Compi
 Args.MakeArgString(getToolChain().GetFilePath("crtbegin.o")));
   }
 
-  const ToolChain::path_list  = getToolChain().getFilePaths();
-  for (const auto  : Paths)
-CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + Path));
+  getToolChain().AddFilePathLibArgs(Args, CmdArgs);
 
   Args.AddAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
 options::OPT_e, options::OPT_r});
@@ -7674,9 +7668,7 @@ void freebsd::Linker::ConstructJob(Compi
   }
 
   Args.AddAllArgs(CmdArgs, options::OPT_L);
-  const ToolChain::path_list  = ToolChain.getFilePaths();
-  for (const auto  : Paths)
-CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + Path));
+  ToolChain.AddFilePathLibArgs(Args, CmdArgs);
   Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
   Args.AddAllArgs(CmdArgs, options::OPT_e);
   Args.AddAllArgs(CmdArgs, options::OPT_s);
@@ -8567,10 +8559,7 @@ void gnutools::Linker::ConstructJob(Comp
   Args.AddAllArgs(CmdArgs, options::OPT_L);
   Args.AddAllArgs(CmdArgs, options::OPT_u);
 
-  const ToolChain::path_list  = ToolChain.getFilePaths();
-
-  for (const auto  : Paths)
-CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + Path));
+  ToolChain.AddFilePathLibArgs(Args, CmdArgs);
 
   if (D.isUsingLTO())
 AddGoldPlugin(ToolChain, Args, CmdArgs, D.getLTOMode() == LTOK_Thin);
@@ -8771,10 +8760,7 @@ void nacltools::Linker::ConstructJob(Com
   Args.AddAllArgs(CmdArgs, options::OPT_L);
   Args.AddAllArgs(CmdArgs, options::OPT_u);
 
-  const 

Re: [PATCH] D14748: bmiintrin.h: Allow using the tzcnt intrinsics for non-BMI targets

2015-11-17 Thread Eric Christopher via cfe-commits
echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

Sounds good to me. Weird, but fine :)

-eric


http://reviews.llvm.org/D14748



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


r253358 - bmiintrin.h: Allow using the tzcnt intrinsics for non-BMI targets

2015-11-17 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Tue Nov 17 12:46:48 2015
New Revision: 253358

URL: http://llvm.org/viewvc/llvm-project?rev=253358=rev
Log:
bmiintrin.h: Allow using the tzcnt intrinsics for non-BMI targets

The tzcnt intrinsics are used non non-BMI targets by code (e.g. ffmpeg)
that uses it as a potentially faster BSF.

The TZCNT instruction is special in that it's encoded in a
backward-compatible way and behaves as BSF on non-BMI targets.

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

Modified:
cfe/trunk/lib/Headers/bmiintrin.h

Modified: cfe/trunk/lib/Headers/bmiintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/bmiintrin.h?rev=253358=253357=253358=diff
==
--- cfe/trunk/lib/Headers/bmiintrin.h (original)
+++ cfe/trunk/lib/Headers/bmiintrin.h Tue Nov 17 12:46:48 2015
@@ -39,7 +39,12 @@
 /* Define the default attributes for the functions in this file. */
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, 
__target__("bmi")))
 
-static __inline__ unsigned short __DEFAULT_FN_ATTRS
+/* Allow using the tzcnt intrinsics even for non-BMI targets. Since the TZCNT
+   instruction behaves as BSF on non-BMI targets, there is code that expects
+   to use it as a potentially faster version of BSF. */
+#define __RELAXED_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
+
+static __inline__ unsigned short __RELAXED_FN_ATTRS
 __tzcnt_u16(unsigned short __X)
 {
   return __X ? __builtin_ctzs(__X) : 16;
@@ -83,7 +88,7 @@ __blsr_u32(unsigned int __X)
   return __X & (__X - 1);
 }
 
-static __inline__ unsigned int __DEFAULT_FN_ATTRS
+static __inline__ unsigned int __RELAXED_FN_ATTRS
 __tzcnt_u32(unsigned int __X)
 {
   return __X ? __builtin_ctz(__X) : 32;
@@ -136,7 +141,7 @@ __blsr_u64(unsigned long long __X)
   return __X & (__X - 1);
 }
 
-static __inline__ unsigned long long __DEFAULT_FN_ATTRS
+static __inline__ unsigned long long __RELAXED_FN_ATTRS
 __tzcnt_u64(unsigned long long __X)
 {
   return __X ? __builtin_ctzll(__X) : 64;
@@ -145,5 +150,6 @@ __tzcnt_u64(unsigned long long __X)
 #endif /* __x86_64__ */
 
 #undef __DEFAULT_FN_ATTRS
+#undef __RELAXED_FN_ATTRS
 
 #endif /* __BMIINTRIN_H */


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


Re: r253398 - [modules] When a #include is mapped to a module import and appears somewhere

2015-11-17 Thread Richard Smith via cfe-commits
On Tue, Nov 17, 2015 at 3:40 PM, David Blaikie  wrote:

> On Tue, Nov 17, 2015 at 3:32 PM, Richard Smith via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: rsmith
>> Date: Tue Nov 17 17:32:01 2015
>> New Revision: 253398
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=253398=rev
>> Log:
>> [modules] When a #include is mapped to a module import and appears
>> somewhere
>> other than the top level, we issue an error. This breaks a fair amount of
>> C++
>> code wrapping C libraries, where the C library is #included within a
>> namespace
>> / extern "C" combination, because the C library (probably) includes C++
>> standard library headers which may be within modules.
>>
>> Without modules, this setup is harmless if (and *only* if) the
>> corresponding
>> standard library module was already included outside the namespace,
>
>
> ^ if that's the only place it's valid, is it that much more work to just
> remove all such inclusions as pointless?
>

Yes, and that would break the build of the third-party library in a lot of
cases. The pattern looks like this:

c_header.h:
#include 
my decls(); // use stuff from stdio.h here

cxx_header.h:
#include  // important, do not remove
namespace WrappedCLibrary {
extern "C" {
#include "c_header.h"
}
}

Note that removing the include from c_header.h will potentially break all
the other (C) users of that header.


> If they ever trigger they'll do bad things, yes?
>
> (but I guess on a large enough codebase this fight is not worth fighting
> in the effort to transition to modules? even if it's just deletions (code
> review turnaround, etc))
>
>
>> so
>> downgrade the error to a default-error extension in that case, so that it
>> can
>> be selectively disabled for such misbehaving libraries.
>>
>> Modified:
>> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> cfe/trunk/lib/Parse/ParseDecl.cpp
>> cfe/trunk/lib/Parse/ParseDeclCXX.cpp
>> cfe/trunk/lib/Parse/ParseStmt.cpp
>> cfe/trunk/lib/Sema/SemaDecl.cpp
>> cfe/trunk/test/Modules/auto-module-import.m
>>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=253398=253397=253398=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Nov 17
>> 17:32:01 2015
>> @@ -7930,6 +7930,9 @@ def note_module_import_in_extern_c : Not
>>"extern \"C\" language linkage specification begins here">;
>>  def err_module_import_not_at_top_level_fatal : Error<
>>"import of module '%0' appears within %1">, DefaultFatal;
>> +def ext_module_import_not_at_top_level_noop : ExtWarn<
>> +  "redundant #include of module '%0' appears within %1">, DefaultError,
>> +  InGroup>;
>>  def note_module_import_not_at_top_level : Note<"%0 begins here">;
>>  def err_module_self_import : Error<
>>"import of module '%0' appears within same top-level module '%1'">;
>>
>> Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=253398=253397=253398=diff
>>
>> ==
>> --- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
>> +++ cfe/trunk/lib/Parse/ParseDecl.cpp Tue Nov 17 17:32:01 2015
>> @@ -3589,8 +3589,8 @@ void Parser::ParseStructUnionBody(Source
>>SmallVector FieldDecls;
>>
>>// While we still have something to read, read the declarations in the
>> struct.
>> -  while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof) &&
>> - !tryParseMisplacedModuleImport()) {
>> +  while (!tryParseMisplacedModuleImport() && Tok.isNot(tok::r_brace) &&
>> + Tok.isNot(tok::eof)) {
>>  // Each iteration of this loop reads one struct-declaration.
>>
>>  // Check for extraneous top-level semicolon.
>>
>> Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=253398=253397=253398=diff
>>
>> ==
>> --- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
>> +++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Tue Nov 17 17:32:01 2015
>> @@ -210,8 +210,8 @@ void Parser::ParseInnerNamespace(std::ve
>>   ParsedAttributes ,
>>   BalancedDelimiterTracker ) {
>>if (index == Ident.size()) {
>> -while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof) &&
>> -   !tryParseMisplacedModuleImport()) {
>> +while (!tryParseMisplacedModuleImport() && Tok.isNot(tok::r_brace) &&
>> +   Tok.isNot(tok::eof)) {
>>ParsedAttributesWithRange attrs(AttrFactory);
>>MaybeParseCXX11Attributes(attrs);
>>

r253398 - [modules] When a #include is mapped to a module import and appears somewhere

2015-11-17 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Tue Nov 17 17:32:01 2015
New Revision: 253398

URL: http://llvm.org/viewvc/llvm-project?rev=253398=rev
Log:
[modules] When a #include is mapped to a module import and appears somewhere
other than the top level, we issue an error. This breaks a fair amount of C++
code wrapping C libraries, where the C library is #included within a namespace
/ extern "C" combination, because the C library (probably) includes C++
standard library headers which may be within modules.

Without modules, this setup is harmless if (and *only* if) the corresponding
standard library module was already included outside the namespace, so
downgrade the error to a default-error extension in that case, so that it can
be selectively disabled for such misbehaving libraries.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/lib/Parse/ParseStmt.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Modules/auto-module-import.m

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=253398=253397=253398=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Nov 17 17:32:01 
2015
@@ -7930,6 +7930,9 @@ def note_module_import_in_extern_c : Not
   "extern \"C\" language linkage specification begins here">;
 def err_module_import_not_at_top_level_fatal : Error<
   "import of module '%0' appears within %1">, DefaultFatal;
+def ext_module_import_not_at_top_level_noop : ExtWarn<
+  "redundant #include of module '%0' appears within %1">, DefaultError,
+  InGroup>;
 def note_module_import_not_at_top_level : Note<"%0 begins here">;
 def err_module_self_import : Error<
   "import of module '%0' appears within same top-level module '%1'">;

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=253398=253397=253398=diff
==
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Tue Nov 17 17:32:01 2015
@@ -3589,8 +3589,8 @@ void Parser::ParseStructUnionBody(Source
   SmallVector FieldDecls;
 
   // While we still have something to read, read the declarations in the 
struct.
-  while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof) &&
- !tryParseMisplacedModuleImport()) {
+  while (!tryParseMisplacedModuleImport() && Tok.isNot(tok::r_brace) &&
+ Tok.isNot(tok::eof)) {
 // Each iteration of this loop reads one struct-declaration.
 
 // Check for extraneous top-level semicolon.

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=253398=253397=253398=diff
==
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Tue Nov 17 17:32:01 2015
@@ -210,8 +210,8 @@ void Parser::ParseInnerNamespace(std::ve
  ParsedAttributes ,
  BalancedDelimiterTracker ) {
   if (index == Ident.size()) {
-while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof) &&
-   !tryParseMisplacedModuleImport()) {
+while (!tryParseMisplacedModuleImport() && Tok.isNot(tok::r_brace) &&
+   Tok.isNot(tok::eof)) {
   ParsedAttributesWithRange attrs(AttrFactory);
   MaybeParseCXX11Attributes(attrs);
   MaybeParseMicrosoftAttributes(attrs);
@@ -3064,8 +3064,8 @@ void Parser::ParseCXXMemberSpecification
 
   if (TagDecl) {
 // While we still have something to read, read the member-declarations.
-while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof) &&
-   !tryParseMisplacedModuleImport()) {
+while (!tryParseMisplacedModuleImport() && Tok.isNot(tok::r_brace) &&
+   Tok.isNot(tok::eof)) {
   // Each iteration of this loop reads one member-declaration.
   ParseCXXClassMemberDeclarationWithPragmas(
   CurAS, AccessAttrs, static_cast(TagType), TagDecl);

Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=253398=253397=253398=diff
==
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Tue Nov 17 17:32:01 2015
@@ -948,8 +948,8 @@ StmtResult Parser::ParseCompoundStatemen
   Stmts.push_back(R.get());
   }
 
-  while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof) &&
- !tryParseMisplacedModuleImport()) {
+  while (!tryParseMisplacedModuleImport() && 

Re: [PATCH] D14744: PR10235: support for vector mode attributes + warning

2015-11-17 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin added a comment.

Thank you for prompt response!



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2765
@@ +2764,3 @@
+def warn_vector_mode_deprecated : Warning<
+  "specifying vector types with __attribute__ ((mode)) is deprecated, "
+  "use __attribute__ ((vector_size)) instead">,

aaron.ballman wrote:
> How about:
> 
> "'mode' attribute is not supported for vector types; use the 'vector_size' 
> attribute instead"
Both GCC and ICC support vector types in mode attribute with similar warning so 
for compatibility reasons it is better to implement it. Taking into account 
that detection of vector types is more than half of supporting them. I do agree 
that warning group is confusing. I was not able to find more suitable warning 
group so would you recommend to create new one for this warning?


http://reviews.llvm.org/D14744



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


Re: [PATCH] D9600: Add scan-build python implementation

2015-11-17 Thread Laszlo Nagy via cfe-commits
rizsotto.mailinglist added a comment.

In http://reviews.llvm.org/D9600#290031, @jroelofs wrote:

> Thanks for re-uploading!


thanks for your comments! :)

most of your comments are about to embed it more into the clang build, test 
infrastructure. i think these are valid points!

i would like to have these code in the repository first and to do -the work 
you've proposed- afterwards. i might need help for some of those too. (like 
using lint to run python unit tests.)


http://reviews.llvm.org/D9600



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


Re: [PATCH] D14748: bmiintrin.h: Allow using the tzcnt intrinsics for non-BMI targets

2015-11-17 Thread Craig Topper via cfe-commits
craig.topper added a subscriber: craig.topper.
craig.topper added a comment.

The summary of why this is ok is slightly misleading. The backend won't try to 
encode the TZCNT instruction when the BMI feature is not enabled. Notice this 
just maps the to the generic non-x86 specific __builtin_ctz. The backend will 
emit a regular BSF instruction if BMI is not supported. There will be a zero 
check around it unless the backend can prove that the input is not 0.


Repository:
  rL LLVM

http://reviews.llvm.org/D14748



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


r253410 - Fix for use-after-free which caused test failure in cuda-detect.cu.

2015-11-17 Thread Artem Belevich via cfe-commits
Author: tra
Date: Tue Nov 17 18:37:41 2015
New Revision: 253410

URL: http://llvm.org/viewvc/llvm-project?rev=253410=rev
Log:
Fix for use-after-free which caused test failure in cuda-detect.cu.

Return std::string itself instead StringRef to a temporary std::string.

Modified:
cfe/trunk/lib/Driver/ToolChains.h

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=253410=253409=253410=diff
==
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Tue Nov 17 18:37:41 2015
@@ -186,7 +186,7 @@ protected:
 /// \brief Get the detected Cuda device library path.
 StringRef getLibDevicePath() const { return CudaLibDevicePath; }
 /// \brief Get libdevice file for given architecture
-StringRef getLibDeviceFile(StringRef Gpu) const {
+std::string getLibDeviceFile(StringRef Gpu) const {
   return CudaLibDeviceMap.lookup(Gpu);
 }
   };


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


Re: [PATCH] D13488: [analyzer] Assume escape is possible through system functions taking void*

2015-11-17 Thread Anna Zaks via cfe-commits
zaks.anna closed this revision.
zaks.anna added a comment.

Committed in r251449.


http://reviews.llvm.org/D13488



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


Re: r252853 - libclang: add clang_Cursor_getCXXManglings

2015-11-17 Thread Reid Kleckner via cfe-commits
This introduced a memory leak, which I'm testing a patch for.

Aside from that, did you get Doug to review this? We probably want to be
really careful about changing libclang's C API, so you should be more
cautious here than you would be normally.

On Wed, Nov 11, 2015 at 7:57 PM, Saleem Abdulrasool via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: compnerd
> Date: Wed Nov 11 21:57:22 2015
> New Revision: 252853
>
> URL: http://llvm.org/viewvc/llvm-project?rev=252853=rev
> Log:
> libclang: add clang_Cursor_getCXXManglings
>
> This function permits the mangling of a C++ 'structor.  Depending on the
> ABI and
> the declaration, the declaration may contain more than one associated
> symbol for
> a given declaration.  This allows the consumer to retrieve all of the
> associated
> symbols for the declaration the cursor points to.
>
> Added:
> cfe/trunk/test/Index/print-cxx-manglings.cpp
> Modified:
> cfe/trunk/include/clang-c/Index.h
> cfe/trunk/tools/c-index-test/c-index-test.c
> cfe/trunk/tools/libclang/CIndex.cpp
> cfe/trunk/tools/libclang/libclang.exports
>
> Modified: cfe/trunk/include/clang-c/Index.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=252853=252852=252853=diff
>
> ==
> --- cfe/trunk/include/clang-c/Index.h (original)
> +++ cfe/trunk/include/clang-c/Index.h Wed Nov 11 21:57:22 2015
> @@ -3863,6 +3863,12 @@ CINDEX_LINKAGE CXString clang_Cursor_get
>  CINDEX_LINKAGE CXString clang_Cursor_getMangling(CXCursor);
>
>  /**
> + * \brief Retrieve the CXStrings representing the mangled symbols of the
> C++
> + * constructor or destructor at the cursor.
> + */
> +CINDEX_LINKAGE CXStringSet *clang_Cursor_getCXXManglings(CXCursor);
> +
> +/**
>   * @}
>   */
>
>
> Added: cfe/trunk/test/Index/print-cxx-manglings.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/print-cxx-manglings.cpp?rev=252853=auto
>
> ==
> --- cfe/trunk/test/Index/print-cxx-manglings.cpp (added)
> +++ cfe/trunk/test/Index/print-cxx-manglings.cpp Wed Nov 11 21:57:22 2015
> @@ -0,0 +1,66 @@
> +// REQUIRES: x86-registered-target
> +
> +// RUN: c-index-test -write-pch %t.itanium.ast -target i686-pc-linux-gnu
> -fdeclspec %s
> +// RUN: c-index-test -test-print-manglings %t.itanium.ast | FileCheck
> --check-prefix=ITANIUM %s
> +
> +// RUN: c-index-test -write-pch %t.macho.ast -target i686-apple-darwin
> -fdeclspec %s
> +// RUN: c-index-test -test-print-manglings %t.macho.ast | FileCheck
> --check-prefix=MACHO %s
> +
> +// RUN: c-index-test -write-pch %t.msvc.ast -target i686-pc-windows %s
> +// RUN: c-index-test -test-print-manglings %t.msvc.ast | FileCheck
> --check-prefix=MSVC %s
> +
> +struct s {
> +  s(int);
> +  ~s();
> +  int m(int);
> +};
> +
> +// ITANIUM: CXXConstructor=s{{.*}}[mangled=_ZN1sC2Ei] [mangled=_ZN1sC1Ei]
> +// ITANIUM: CXXDestructor=~s{{.*}}[mangled=_ZN1sD2Ev] [mangled=_ZN1sD1Ev]
> [mangled=_ZN1sD0Ev]
> +
> +// MACHO: CXXConstructor=s{{.*}}[mangled=__ZN1sC2Ei] [mangled=__ZN1sC1Ei]
> +// MACHO: CXXDestructor=~s{{.*}}[mangled=__ZN1sD2Ev] [mangled=__ZN1sD1Ev]
> [mangled=__ZN1sD0Ev]
> +
> +// MSVC: CXXConstructor=s{{.*}}[mangled=??0s@@QAE@H@Z]
> +// MSVC: CXXDestructor=~s{{.*}}[mangled=??1s@@QAE@XZ]
> +
> +struct t {
> +  t(int);
> +  virtual ~t();
> +  int m(int);
> +};
> +
> +// ITANIUM: CXXConstructor=t{{.*}}[mangled=_ZN1tC2Ei] [mangled=_ZN1tC1Ei]
> +// ITANIUM: CXXDestructor=~t{{.*}}[mangled=_ZN1tD2Ev] [mangled=_ZN1tD1Ev]
> +
> +// MACHO: CXXConstructor=t{{.*}}[mangled=__ZN1tC2Ei] [mangled=__ZN1tC1Ei]
> +// MACHO: CXXDestructor=~t{{.*}}[mangled=__ZN1tD2Ev] [mangled=__ZN1tD1Ev]
> +
> +// MSVC: CXXConstructor=t{{.*}}[mangled=??0t@@QAE@H@Z]
> +// MSVC: CXXDestructor=~t{{.*}}[mangled=??1t@@UAE@XZ]
> +
> +struct u {
> +  u();
> +  virtual ~u();
> +  virtual int m(int) = 0;
> +};
> +
> +// ITANIUM: CXXConstructor=u{{.*}}[mangled=_ZN1uC2Ev]
> +// ITANIUM: CXXDestructor=~u{{.*}}[mangled=_ZN1uD2Ev] [mangled=_ZN1uD1Ev]
> +
> +// MACHO: CXXConstructor=u{{.*}}[mangled=__ZN1uC2Ev]
> +// MACHO: CXXDestructor=~u{{.*}}[mangled=__ZN1uD2Ev] [mangled=__ZN1uD1Ev]
> +
> +// MSVC: CXXConstructor=u{{.*}}[mangled=??0u@@QAE@XZ]
> +// MSVC: CXXDestructor=~u{{.*}}[mangled=??1u@@UAE@XZ]
> +
> +struct v {
> +  __declspec(dllexport) v(int = 0);
> +};
> +
> +// ITANIUM: CXXConstructor=v{{.*}}[mangled=_ZN1vC2Ei] [mangled=_ZN1vC1Ei]
> +
> +// MACHO: CXXConstructor=v{{.*}}[mangled=__ZN1vC2Ei] [mangled=__ZN1vC1Ei]
> +
> +// MSVC: CXXConstructor=v{{.*}}[mangled=??0v@@QAE@H@Z] [mangled=??_Fv@
> @QAEXXZ]
> +
>
> Modified: cfe/trunk/tools/c-index-test/c-index-test.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=252853=252852=252853=diff
>
> ==
> --- cfe/trunk/tools/c-index-test/c-index-test.c 

Re: [PATCH] D14737: Convert some ObjC msgSends to runtime calls

2015-11-17 Thread Stephane Moore via cfe-commits
stephanemoore added a subscriber: stephanemoore.
stephanemoore added a comment.

I hope that it's not presumptuous of me to inquire but I was wondering if the 
intent of this patch is to optimize calls to RR methods (and alloc) in non-ARC 
code? Would I be correct in assuming that clang will already emit direct calls 
to relevant RR runtime functions when ARC is enabled?


http://reviews.llvm.org/D14737



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


Re: [clang-tools-extra] r253401 - [clang-tidy] add check cppcoreguidelines-pro-bounds-constant-array-index

2015-11-17 Thread Bruno Cardoso Lopes via cfe-commits
Hi Matthias,

This is failing on the green dragon bot:
http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/13184/
http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/13184/consoleFull#54616856949ba4694-19c4-4d7e-bec5-911270d8a58c

Thanks,

On Tue, Nov 17, 2015 at 3:43 PM, Matthias Gehre via cfe-commits
 wrote:
> Author: mgehre
> Date: Tue Nov 17 17:43:20 2015
> New Revision: 253401
>
> URL: http://llvm.org/viewvc/llvm-project?rev=253401=rev
> Log:
> [clang-tidy] add check cppcoreguidelines-pro-bounds-constant-array-index
>
> Summary:
> This check flags all array subscriptions on static arrays and
> std::arrays that either have a non-compile-time-constant index or are
> out of bounds.
>
> Dynamic accesses into arrays are difficult for both tools and humans to
> validate as safe. array_view is a bounds-checked, safe type for
> accessing arrays of data. at() is another alternative that ensures
> single accesses are bounds-checked. If iterators are needed to access an
> array, use the iterators from an array_view constructed over the array.
>
> This rule is part of the "Bounds safety" profile of the C++ Core
> Guidelines, see
> https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds2-only-index-into-arrays-using-constant-expressions
>
> Reviewers: alexfh, sbenza, bkramer, aaron.ballman
>
> Subscribers: cfe-commits
>
> Differential Revision: http://reviews.llvm.org/D13746
>
> Added:
> 
> clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
> 
> clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h
> 
> clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst
> 
> clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-bounds-constant-array-index.cpp
> Modified:
> clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt
> 
> clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
> clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst
>
> Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt
> URL: 
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt?rev=253401=253400=253401=diff
> ==
> --- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt 
> (original)
> +++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt Tue 
> Nov 17 17:43:20 2015
> @@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS support)
>  add_clang_library(clangTidyCppCoreGuidelinesModule
>CppCoreGuidelinesTidyModule.cpp
>ProBoundsArrayToPointerDecayCheck.cpp
> +  ProBoundsConstantArrayIndexCheck.cpp
>ProBoundsPointerArithmeticCheck.cpp
>ProTypeConstCastCheck.cpp
>ProTypeCstyleCastCheck.cpp
>
> Modified: 
> clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp?rev=253401=253400=253401=diff
> ==
> --- 
> clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
>  (original)
> +++ 
> clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
>  Tue Nov 17 17:43:20 2015
> @@ -12,6 +12,7 @@
>  #include "../ClangTidyModuleRegistry.h"
>  #include "../misc/AssignOperatorSignatureCheck.h"
>  #include "ProBoundsArrayToPointerDecayCheck.h"
> +#include "ProBoundsConstantArrayIndexCheck.h"
>  #include "ProBoundsPointerArithmeticCheck.h"
>  #include "ProTypeConstCastCheck.h"
>  #include "ProTypeCstyleCastCheck.h"
> @@ -30,6 +31,8 @@ public:
>void addCheckFactories(ClangTidyCheckFactories ) override {
>  CheckFactories.registerCheck(
>  "cppcoreguidelines-pro-bounds-array-to-pointer-decay");
> +CheckFactories.registerCheck(
> +"cppcoreguidelines-pro-bounds-constant-array-index");
>  CheckFactories.registerCheck(
>  "cppcoreguidelines-pro-bounds-pointer-arithmetic");
>  CheckFactories.registerCheck(
>
> Added: 
> clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp?rev=253401=auto
> ==
> --- 
> clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
>  (added)
> +++ 
> clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
>  Tue Nov 17 17:43:20 2015
> @@ -0,0 +1,131 @@
> +//===--- ProBoundsConstantArrayIndexCheck.cpp - 
> clang-tidy-===//

Re: [PATCH] D14652: [analyzer] Improve modeling of static initializers.

2015-11-17 Thread Anna Zaks via cfe-commits
zaks.anna added inline comments.


Comment at: test/Analysis/inline.cpp:308
@@ +307,3 @@
+clang_analyzer_eval(0 != void_string); // expected-warning{{TRUE}}
+clang_analyzer_eval(0 != ((char *)void_string)[1]); // 
expected-warning{{TRUE}}
+  }

Why are we checking that the first element is not '0'?


http://reviews.llvm.org/D14652



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


[clang-tools-extra] r253428 - Revert r253401, "[clang-tidy] add check cppcoreguidelines-pro-bounds-constant-array-index"

2015-11-17 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Tue Nov 17 20:14:35 2015
New Revision: 253428

URL: http://llvm.org/viewvc/llvm-project?rev=253428=rev
Log:
Revert r253401, "[clang-tidy] add check 
cppcoreguidelines-pro-bounds-constant-array-index"

cppcoreguidelines-pro-bounds-constant-array-index.cpp is failing in several 
hosts.

Removed:

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h

clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst

clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-bounds-constant-array-index.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst

Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt?rev=253428=253427=253428=diff
==
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt 
(original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt Tue Nov 
17 20:14:35 2015
@@ -3,7 +3,6 @@ set(LLVM_LINK_COMPONENTS support)
 add_clang_library(clangTidyCppCoreGuidelinesModule
   CppCoreGuidelinesTidyModule.cpp
   ProBoundsArrayToPointerDecayCheck.cpp
-  ProBoundsConstantArrayIndexCheck.cpp
   ProBoundsPointerArithmeticCheck.cpp
   ProTypeConstCastCheck.cpp
   ProTypeCstyleCastCheck.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp?rev=253428=253427=253428=diff
==
--- 
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
 (original)
+++ 
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
 Tue Nov 17 20:14:35 2015
@@ -12,7 +12,6 @@
 #include "../ClangTidyModuleRegistry.h"
 #include "../misc/AssignOperatorSignatureCheck.h"
 #include "ProBoundsArrayToPointerDecayCheck.h"
-#include "ProBoundsConstantArrayIndexCheck.h"
 #include "ProBoundsPointerArithmeticCheck.h"
 #include "ProTypeConstCastCheck.h"
 #include "ProTypeCstyleCastCheck.h"
@@ -31,8 +30,6 @@ public:
   void addCheckFactories(ClangTidyCheckFactories ) override {
 CheckFactories.registerCheck(
 "cppcoreguidelines-pro-bounds-array-to-pointer-decay");
-CheckFactories.registerCheck(
-"cppcoreguidelines-pro-bounds-constant-array-index");
 CheckFactories.registerCheck(
 "cppcoreguidelines-pro-bounds-pointer-arithmetic");
 CheckFactories.registerCheck(

Removed: 
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp?rev=253427=auto
==
--- 
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
 (original)
+++ 
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
 (removed)
@@ -1,131 +0,0 @@
-//===--- ProBoundsConstantArrayIndexCheck.cpp - 
clang-tidy-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-
-#include "ProBoundsConstantArrayIndexCheck.h"
-#include "clang/AST/ASTContext.h"
-#include "clang/ASTMatchers/ASTMatchFinder.h"
-#include "clang/Frontend/CompilerInstance.h"
-#include "clang/Lex/Preprocessor.h"
-
-using namespace clang::ast_matchers;
-
-namespace clang {
-namespace tidy {
-
-ProBoundsConstantArrayIndexCheck::ProBoundsConstantArrayIndexCheck(
-StringRef Name, ClangTidyContext *Context)
-: ClangTidyCheck(Name, Context), GslHeader(Options.get("GslHeader", "")),
-  IncludeStyle(IncludeSorter::parseIncludeStyle(
-  Options.get("IncludeStyle", "llvm"))) {}
-
-void ProBoundsConstantArrayIndexCheck::storeOptions(
-ClangTidyOptions::OptionMap ) {
-  Options.store(Opts, "GslHeader", GslHeader);
-}
-
-void ProBoundsConstantArrayIndexCheck::registerPPCallbacks(
-CompilerInstance ) {
-  if (!getLangOpts().CPlusPlus)
-return;
-
-  Inserter.reset(new IncludeInserter(Compiler.getSourceManager(),
- Compiler.getLangOpts(), IncludeStyle));
-  

r253434 - BuildUniversalActions(): Prune obsolete \param(s). [-Wdocumentation]

2015-11-17 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Tue Nov 17 23:15:21 2015
New Revision: 253434

URL: http://llvm.org/viewvc/llvm-project?rev=253434=rev
Log:
BuildUniversalActions(): Prune obsolete \param(s). [-Wdocumentation]

FIXME: Describe BAInputs.

Modified:
cfe/trunk/include/clang/Driver/Driver.h

Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=253434=253433=253434=diff
==
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Tue Nov 17 23:15:21 2015
@@ -310,8 +310,6 @@ public:
   ///
   /// \param C - The compilation that is being built.
   /// \param TC - The default host tool chain.
-  /// \param Args - The input arguments.
-  /// \param Actions - The list to store the resulting actions onto.
   void BuildUniversalActions(Compilation , const ToolChain ,
  const InputList ) const;
 


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


[libcxxabi] r253435 - c++abi: use __builtin_offsetof instead of offsetof

2015-11-17 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Tue Nov 17 23:33:38 2015
New Revision: 253435

URL: http://llvm.org/viewvc/llvm-project?rev=253435=rev
Log:
c++abi: use __builtin_offsetof instead of offsetof

Use `__builtin_offsetof` in place of `offsetof`.  Certain environments provide a
macro definition of `offsetof` which may end up causing issues.  This was
observed on Windows.  Use `__builtin_offsetof` to ensure correct evaluation
everywhere.  NFC.

Modified:
libcxxabi/trunk/src/cxa_exception.cpp

Modified: libcxxabi/trunk/src/cxa_exception.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_exception.cpp?rev=253435=253434=253435=diff
==
--- libcxxabi/trunk/src/cxa_exception.cpp (original)
+++ libcxxabi/trunk/src/cxa_exception.cpp Tue Nov 17 23:33:38 2015
@@ -448,14 +448,15 @@ void __cxa_end_catch()
   static_assert(sizeof(__cxa_exception) == sizeof(__cxa_dependent_exception),
 "sizeof(__cxa_exception) must be equal to "
 "sizeof(__cxa_dependent_exception)");
-static_assert(offsetof(__cxa_exception, referenceCount) ==
-  offsetof(__cxa_dependent_exception, primaryException),
-  "the layout of __cxa_exception must match the layout of "
-  "__cxa_dependent_exception");
-static_assert(offsetof(__cxa_exception, handlerCount) ==
-  offsetof(__cxa_dependent_exception, handlerCount),
-  "the layout of __cxa_exception must match the layout of "
-  "__cxa_dependent_exception");
+  static_assert(__builtin_offsetof(__cxa_exception, referenceCount) ==
+__builtin_offsetof(__cxa_dependent_exception,
+   primaryException),
+"the layout of __cxa_exception must match the layout of "
+"__cxa_dependent_exception");
+  static_assert(__builtin_offsetof(__cxa_exception, handlerCount) ==
+__builtin_offsetof(__cxa_dependent_exception, 
handlerCount),
+"the layout of __cxa_exception must match the layout of "
+"__cxa_dependent_exception");
 __cxa_eh_globals* globals = __cxa_get_globals_fast(); // __cxa_get_globals 
called in __cxa_begin_catch
 __cxa_exception* exception_header = globals->caughtExceptions;
 // If we've rethrown a foreign exception, then globals->caughtExceptions


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


r253431 - [NFC] Change the evaluation context of a non-type default template argument from Unevaluated to ConstantEvaluated.

2015-11-17 Thread Faisal Vali via cfe-commits
Author: faisalv
Date: Tue Nov 17 22:29:22 2015
New Revision: 253431

URL: http://llvm.org/viewvc/llvm-project?rev=253431=rev
Log:
[NFC] Change the evaluation context of a non-type default template argument 
from Unevaluated to ConstantEvaluated.  

This patch emits a more appropriate (but still noisy) diagnostic stream when a 
lambda-expression is encountered within a non-type default argument. 

For e.g. template int f();

As opposed to complaining that a lambda expression is not allowed in an 
unevaluated operand, the patch complains about the lambda being forbidden in a 
constant expression context (which will be allowed in C++17 now that they have 
been accepted by EWG, unless of course CWG or national bodies (that have so far 
shown no signs of concern) rise in protest) 

As I start submitting patches for constexpr lambdas (http://wg21.link/P0170R0) 
under C++1z (OK'd by Richard Smith at Kona), this will be one less change to 
make.

Thanks!

Modified:
cfe/trunk/lib/Parse/ParseTemplate.cpp
cfe/trunk/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp

Modified: cfe/trunk/lib/Parse/ParseTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTemplate.cpp?rev=253431=253430=253431=diff
==
--- cfe/trunk/lib/Parse/ParseTemplate.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTemplate.cpp Tue Nov 17 22:29:22 2015
@@ -695,7 +695,8 @@ Parser::ParseNonTypeTemplateParameter(un
 //   end of the template-parameter-list rather than a greater-than
 //   operator.
 GreaterThanIsOperatorScope G(GreaterThanIsOperator, false);
-EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated);
+EnterExpressionEvaluationContext Unevaluated(Actions,
+ Sema::ConstantEvaluated);
 
 DefaultArg = 
Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression());
 if (DefaultArg.isInvalid())

Modified: cfe/trunk/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp?rev=253431=253430=253431=diff
==
--- cfe/trunk/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp Tue Nov 17 
22:29:22 2015
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -triple=x86_64-linux-gnu %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -triple=x86_64-linux-gnu 
%s -DCPP11ONLY
 
 // C++11 [temp.arg.nontype]p1:
 //
@@ -6,6 +7,8 @@
 //   be one of:
 //   -- an integral constant expression; or
 //   -- the name of a non-type template-parameter ; or
+#ifndef CPP11ONLY 
+
 namespace non_type_tmpl_param {
   template  struct X0 { X0(); };
   template  X0::X0() { }
@@ -95,3 +98,14 @@ namespace bad_args {
   int* iptr = 
   X0 x0b; // expected-error{{non-type template argument for template 
parameter of pointer type 'int *' must have its address taken}}
 }
+#endif // CPP11ONLY
+
+namespace default_args {
+#ifdef CPP11ONLY
+namespace lambdas {
+template //expected-error 2{{constant 
expression}} expected-note{{constant expression}}
+int f();
+}
+#endif // CPP11ONLY
+
+}
\ No newline at end of file


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


Re: [PATCH] D14652: [analyzer] Improve modeling of static initializers.

2015-11-17 Thread Yury Gribov via cfe-commits
ygribov added inline comments.


Comment at: test/Analysis/inline.cpp:308
@@ +307,3 @@
+clang_analyzer_eval(0 != void_string); // expected-warning{{TRUE}}
+clang_analyzer_eval(0 != ((char *)void_string)[1]); // 
expected-warning{{TRUE}}
+  }

zaks.anna wrote:
> Why are we checking that the first element is not '0'?
We could check s[0] as well, there is no difference actually.


http://reviews.llvm.org/D14652



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


Re: [PATCH] D14506: Porting shouldVisitImplicitCode to DataRecursiveASTVisitor.

2015-11-17 Thread Manuel Klimek via cfe-commits
Richard, this is still optional, right? (the AST matchers need to control
visitation)

On Tue, Nov 17, 2015 at 2:26 AM Argyrios Kyrtzidis via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> W00t! That’s awesome Richard!
>
> On Nov 16, 2015, at 5:10 PM, Richard Smith  wrote:
>
> Attached patch makes RAV fully data-recursive when visiting statements,
> except in cases where the derived class could tell the difference (when it
> falls back to a normal recursive walk). The queue representation is
> slightly less compact than before: instead of storing a child iterator, we
> now store a list of all children. This allows us to handle any Stmt
> subclass that we can traverse, not just those ones that finish by
> traversing all their children in the usual order.
>
> Thoughts?
>
> On Mon, Nov 16, 2015 at 2:28 PM, Craig, Ben via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> I'm fine with this approach.  How about I leave the file in place, but
>> replace the contents with a "using DataRecursiveASTVisitor =
>> RecursiveASTVisitor;" and see what breaks?  That way I won't need to go
>> through a large retrofit.
>>
>>
>> On 11/16/2015 3:28 PM, Richard Smith wrote:
>>
>> Rather than trying to maintain the horrible duplication between
>> DataRecursiveASTVisitor and RecursiveASTVisitor, can we just delete
>> DataRecursiveASTVisitor? RecursiveASTVisitor is data-recursive too these
>> days (and has a smarter implementation than DataRecursiveASTVisitor's from
>> what I can see), but doesn't yet apply data recursion in so many cases.
>>
>> On Mon, Nov 16, 2015 at 1:07 PM, Argyrios Kyrtzidis < 
>> akyr...@gmail.com> wrote:
>>
>>> LGTM.
>>>
>>> > On Nov 16, 2015, at 12:32 PM, Ben Craig < 
>>> ben.cr...@codeaurora.org> wrote:
>>> >
>>> > bcraig added a comment.
>>> >
>>> > Ping.  Note that the test is basically a copy / paste job, and the new
>>> code in DataRecursiveASTVisitor.h is a very direct translation from the
>>> 'regular' RecursiveASTVisitor.h.
>>> >
>>> >
>>> > http://reviews.llvm.org/D14506
>>> >
>>> >
>>> >
>>>
>>>
>>
>> --
>> Employee of Qualcomm Innovation Center, Inc.
>> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux 
>> Foundation Collaborative Project
>>
>>
>> ___
>> 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
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14506: Porting shouldVisitImplicitCode to DataRecursiveASTVisitor.

2015-11-17 Thread Richard Smith via cfe-commits
LOn Nov 17, 2015 12:49 AM, "Manuel Klimek"  wrote:
> Richard, this is still optional, right? (the AST matchers need to control
visitation)

This doesn't change RAV semantics at all (or if it does, it's a bug). If
any of the extension points are overridden in the derived class, data
recursion is automatically disabled for that case.

> On Tue, Nov 17, 2015 at 2:26 AM Argyrios Kyrtzidis via cfe-commits <
cfe-commits@lists.llvm.org> wrote:
>>
>> W00t! That’s awesome Richard!
>>
>>> On Nov 16, 2015, at 5:10 PM, Richard Smith 
wrote:
>>>
>>> Attached patch makes RAV fully data-recursive when visiting statements,
except in cases where the derived class could tell the difference (when it
falls back to a normal recursive walk). The queue representation is
slightly less compact than before: instead of storing a child iterator, we
now store a list of all children. This allows us to handle any Stmt
subclass that we can traverse, not just those ones that finish by
traversing all their children in the usual order.
>>>
>>> Thoughts?
>>>
>>> On Mon, Nov 16, 2015 at 2:28 PM, Craig, Ben via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

 I'm fine with this approach.  How about I leave the file in place, but
replace the contents with a "using DataRecursiveASTVisitor =
RecursiveASTVisitor;" and see what breaks?  That way I won't need to go
through a large retrofit.


 On 11/16/2015 3:28 PM, Richard Smith wrote:
>
> Rather than trying to maintain the horrible duplication between
DataRecursiveASTVisitor and RecursiveASTVisitor, can we just delete
DataRecursiveASTVisitor? RecursiveASTVisitor is data-recursive too these
days (and has a smarter implementation than DataRecursiveASTVisitor's from
what I can see), but doesn't yet apply data recursion in so many cases.
>
> On Mon, Nov 16, 2015 at 1:07 PM, Argyrios Kyrtzidis 
wrote:
>>
>> LGTM.
>>
>> > On Nov 16, 2015, at 12:32 PM, Ben Craig 
wrote:
>> >
>> > bcraig added a comment.
>> >
>> > Ping.  Note that the test is basically a copy / paste job, and the
new code in DataRecursiveASTVisitor.h is a very direct translation from the
'regular' RecursiveASTVisitor.h.
>> >
>> >
>> > http://reviews.llvm.org/D14506
>> >
>> >
>> >
>>
>

 --
 Employee of Qualcomm Innovation Center, Inc.
 Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
Linux Foundation Collaborative Project


 ___
 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
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14506: Porting shouldVisitImplicitCode to DataRecursiveASTVisitor.

2015-11-17 Thread Manuel Klimek via cfe-commits
On Tue, Nov 17, 2015 at 10:14 AM Richard Smith 
wrote:

> LOn Nov 17, 2015 12:49 AM, "Manuel Klimek"  wrote:
> > Richard, this is still optional, right? (the AST matchers need to
> control visitation)
>
> This doesn't change RAV semantics at all (or if it does, it's a bug). If
> any of the extension points are overridden in the derived class, data
> recursion is automatically disabled for that case.
>

Ah, cool, sg.

> > On Tue, Nov 17, 2015 at 2:26 AM Argyrios Kyrtzidis via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> >>
> >> W00t! That’s awesome Richard!
> >>
> >>> On Nov 16, 2015, at 5:10 PM, Richard Smith 
> wrote:
> >>>
> >>> Attached patch makes RAV fully data-recursive when visiting
> statements, except in cases where the derived class could tell the
> difference (when it falls back to a normal recursive walk). The queue
> representation is slightly less compact than before: instead of storing a
> child iterator, we now store a list of all children. This allows us to
> handle any Stmt subclass that we can traverse, not just those ones that
> finish by traversing all their children in the usual order.
> >>>
> >>> Thoughts?
> >>>
> >>> On Mon, Nov 16, 2015 at 2:28 PM, Craig, Ben via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> 
>  I'm fine with this approach.  How about I leave the file in place,
> but replace the contents with a "using DataRecursiveASTVisitor =
> RecursiveASTVisitor;" and see what breaks?  That way I won't need to go
> through a large retrofit.
> 
> 
>  On 11/16/2015 3:28 PM, Richard Smith wrote:
> >
> > Rather than trying to maintain the horrible duplication between
> DataRecursiveASTVisitor and RecursiveASTVisitor, can we just delete
> DataRecursiveASTVisitor? RecursiveASTVisitor is data-recursive too these
> days (and has a smarter implementation than DataRecursiveASTVisitor's from
> what I can see), but doesn't yet apply data recursion in so many cases.
> >
> > On Mon, Nov 16, 2015 at 1:07 PM, Argyrios Kyrtzidis <
> akyr...@gmail.com> wrote:
> >>
> >> LGTM.
> >>
> >> > On Nov 16, 2015, at 12:32 PM, Ben Craig 
> wrote:
> >> >
> >> > bcraig added a comment.
> >> >
> >> > Ping.  Note that the test is basically a copy / paste job, and
> the new code in DataRecursiveASTVisitor.h is a very direct translation from
> the 'regular' RecursiveASTVisitor.h.
> >> >
> >> >
> >> > http://reviews.llvm.org/D14506
> >> >
> >> >
> >> >
> >>
> >
> 
>  --
>  Employee of Qualcomm Innovation Center, Inc.
>  Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
> Linux Foundation Collaborative Project
> 
> 
>  ___
>  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
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14736: [analyzer] DeadStoresChecker: Treat locals captured by reference in C++ lambdas as escaped.

2015-11-17 Thread Gábor Horváth via cfe-commits
xazax.hun added a comment.

This looks good to me, I have one question inline.



Comment at: lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp:425
@@ +424,3 @@
+llvm::DenseMap CaptureFields;
+FieldDecl *ThisCaptureField;
+LambdaClass->getCaptureFields(CaptureFields, ThisCaptureField);

As far as I can see ThisCaptureField is not used. Does this solution work, when 
there is a dead store to a class member (through captured this)?


http://reviews.llvm.org/D14736



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


Re: [PATCH] D14170: Fix false positive warning about memory leak for QApplication::postEvent

2015-11-17 Thread Gábor Horváth via cfe-commits
xazax.hun added inline comments.


Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:2514
@@ -2513,1 +2513,3 @@
 
+  if (FName.endswith("postEvent") &&
+  FD->getQualifiedNameAsString() == "QCoreApplication::postEvent") {

Shouldn't you use == instead of endswith here?


http://reviews.llvm.org/D14170



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


Re: [PATCH] D14744: PR10235: support for vector mode attributes + warning

2015-11-17 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2765
@@ +2764,3 @@
+def warn_vector_mode_deprecated : Warning<
+  "specifying vector types with __attribute__ ((mode)) is deprecated, "
+  "use __attribute__ ((vector_size)) instead">,

DmitryPolukhin wrote:
> aaron.ballman wrote:
> > How about:
> > 
> > "'mode' attribute is not supported for vector types; use the 'vector_size' 
> > attribute instead"
> Both GCC and ICC support vector types in mode attribute with similar warning 
> so for compatibility reasons it is better to implement it. Taking into 
> account that detection of vector types is more than half of supporting them. 
> I do agree that warning group is confusing. I was not able to find more 
> suitable warning group so would you recommend to create new one for this 
> warning?
Are there headers from major library vendors that rely on supporting this 
feature? If not, then I would say it's probably better to simply not implement 
the diagnostic and fail to support such constructs at all. If it is used by 
major vendors and would prevent otherwise functional code from working, then 
this approach is reasonable. In that case, I would add a new diagnostic group 
(DeprecatedAttributes and add it to the Deprecated group).


http://reviews.llvm.org/D14744



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


[libcxx] r253382 - Fix bad variable name. project_root -> project_obj_root

2015-11-17 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Tue Nov 17 15:48:29 2015
New Revision: 253382

URL: http://llvm.org/viewvc/llvm-project?rev=253382=rev
Log:
Fix bad variable name. project_root -> project_obj_root

Modified:
libcxx/trunk/test/libcxx/test/config.py

Modified: libcxx/trunk/test/libcxx/test/config.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=253382=253381=253382=diff
==
--- libcxx/trunk/test/libcxx/test/config.py (original)
+++ libcxx/trunk/test/libcxx/test/config.py Tue Nov 17 15:48:29 2015
@@ -202,7 +202,7 @@ class Configuration(object):
 if os.path.isdir(possible_root):
 self.libcxx_obj_root = possible_root
 else:
-self.libcxx_obj_root = self.project_root
+self.libcxx_obj_root = self.project_obj_root
 
 def configure_cxx_library_root(self):
 self.cxx_library_root = self.get_lit_conf('cxx_library_root',


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


[PATCH] D14756: Handle ARMv6-J as an alias, instead of fake architecture

2015-11-17 Thread A. Skrobov via cfe-commits
tyomitch created this revision.
tyomitch added reviewers: rengolin, bogden, compnerd.
tyomitch added a subscriber: cfe-commits.
Herald added subscribers: rengolin, aemerson.

Clang-side update, corresponding to D14755

http://reviews.llvm.org/D14756

Files:
  test/Driver/arm-cortex-cpus.c

Index: test/Driver/arm-cortex-cpus.c
===
--- test/Driver/arm-cortex-cpus.c
+++ test/Driver/arm-cortex-cpus.c
@@ -57,11 +57,11 @@
 
 // FIXME %clang -target armv6j -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6J %s
 // RUN: %clang -target arm -march=armv6j -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6J %s
-// CHECK-V6J: "-cc1"{{.*}} "-triple" "armv6-{{.*}} "-target-cpu" "arm1136j-s"
+// CHECK-V6J: "-cc1"{{.*}} "-triple" "armv6-{{.*}} "-target-cpu" "arm1136jf-s"
 
 // FIXME %clang -target armv6j -mthumb -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6J-THUMB %s
 // RUN: %clang -target arm -march=armv6j -mthumb -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6J-THUMB %s
-// CHECK-V6J-THUMB: "-cc1"{{.*}} "-triple" "thumbv6-{{.*}} "-target-cpu" 
"arm1136j-s"
+// CHECK-V6J-THUMB: "-cc1"{{.*}} "-triple" "thumbv6-{{.*}} "-target-cpu" 
"arm1136jf-s"
 
 // FIXME %clang -target armv6z -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6Z %s
 // FIXME %clang -target arm -march=armv6z -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6Z %s


Index: test/Driver/arm-cortex-cpus.c
===
--- test/Driver/arm-cortex-cpus.c
+++ test/Driver/arm-cortex-cpus.c
@@ -57,11 +57,11 @@
 
 // FIXME %clang -target armv6j -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6J %s
 // RUN: %clang -target arm -march=armv6j -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6J %s
-// CHECK-V6J: "-cc1"{{.*}} "-triple" "armv6-{{.*}} "-target-cpu" "arm1136j-s"
+// CHECK-V6J: "-cc1"{{.*}} "-triple" "armv6-{{.*}} "-target-cpu" "arm1136jf-s"
 
 // FIXME %clang -target armv6j -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6J-THUMB %s
 // RUN: %clang -target arm -march=armv6j -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6J-THUMB %s
-// CHECK-V6J-THUMB: "-cc1"{{.*}} "-triple" "thumbv6-{{.*}} "-target-cpu" "arm1136j-s"
+// CHECK-V6J-THUMB: "-cc1"{{.*}} "-triple" "thumbv6-{{.*}} "-target-cpu" "arm1136jf-s"
 
 // FIXME %clang -target armv6z -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6Z %s
 // FIXME %clang -target arm -march=armv6z -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6Z %s
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253389 - [CUDA] Make CUDA compilation usable by default.

2015-11-17 Thread Artem Belevich via cfe-commits
Author: tra
Date: Tue Nov 17 16:28:55 2015
New Revision: 253389

URL: http://llvm.org/viewvc/llvm-project?rev=253389=rev
Log:
[CUDA] Make CUDA compilation usable by default.

Currently clang requires several additional command
line options in order to enable new features needed
during CUDA compilation. This patch makes these
options default.

* Automatically include cuda_runtime.h if we've found
  a valid CUDA installation.
* Disable automatic CUDA header inclusion during unit tests.
* Added test case for command line construction.
* Enabled target overloads and relaxed call checks that are
  needed in order to include CUDA headers.
* Added CUDA-7.5 installation path to the CUDA installation search list.
* Define __CUDA__ macro to indicate CUDA compilation.

Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/test/Driver/cuda-detect.cu
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=253389=253388=253389=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Nov 17 16:28:55 2015
@@ -1629,6 +1629,7 @@ void Generic_GCC::CudaInstallationDetect
 Args.getLastArgValue(options::OPT_cuda_path_EQ));
   else {
 CudaPathCandidates.push_back(D.SysRoot + "/usr/local/cuda");
+CudaPathCandidates.push_back(D.SysRoot + "/usr/local/cuda-7.5");
 CudaPathCandidates.push_back(D.SysRoot + "/usr/local/cuda-7.0");
   }
 
@@ -4134,8 +4135,11 @@ void Linux::AddCudaIncludeArgs(const Arg
   if (DriverArgs.hasArg(options::OPT_nocudainc))
 return;
 
-  if (CudaInstallation.isValid())
+  if (CudaInstallation.isValid()) {
 addSystemInclude(DriverArgs, CC1Args, CudaInstallation.getIncludePath());
+CC1Args.push_back("-include");
+CC1Args.push_back("cuda_runtime.h");
+  }
 }
 
 bool Linux::isPIEDefault() const { return getSanitizerArgs().requiresPIE(); }

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253389=253388=253389=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Nov 17 16:28:55 2015
@@ -3292,6 +3292,8 @@ void Clang::ConstructJob(Compilation ,
 assert(AuxToolChain != nullptr && "No aux toolchain.");
 CmdArgs.push_back("-aux-triple");
 CmdArgs.push_back(Args.MakeArgString(AuxToolChain->getTriple().str()));
+CmdArgs.push_back("-fcuda-target-overloads");
+CmdArgs.push_back("-fcuda-disable-target-call-checks");
   }
 
   if (Triple.isOSWindows() && (Triple.getArch() == llvm::Triple::arm ||

Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=253389=253388=253389=diff
==
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Tue Nov 17 16:28:55 2015
@@ -411,6 +411,8 @@ static void InitializeStandardPredefined
   // Not "standard" per se, but available even with the -undef flag.
   if (LangOpts.AsmPreprocessor)
 Builder.defineMacro("__ASSEMBLER__");
+  if (LangOpts.CUDA)
+Builder.defineMacro("__CUDA__");
 }
 
 /// Initialize the predefined C++ language feature test macros defined in

Modified: cfe/trunk/test/Driver/cuda-detect.cu
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cuda-detect.cu?rev=253389=253388=253389=diff
==
--- cfe/trunk/test/Driver/cuda-detect.cu (original)
+++ cfe/trunk/test/Driver/cuda-detect.cu Tue Nov 17 16:28:55 2015
@@ -8,8 +8,6 @@
 // RUN: %clang -v --target=i386-unknown-linux \
 // RUN:   --sysroot=%S/Inputs/CUDA 2>&1 | FileCheck %s
 // RUN: %clang -v --target=i386-unknown-linux \
-// RUN:   --sysroot=%S/Inputs/CUDA 2>&1 | FileCheck %s
-// RUN: %clang -v --target=i386-unknown-linux \
 // RUN:   --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 | FileCheck %s
 
 // Make sure we map libdevice bitcode files to proper GPUs.
@@ -40,6 +38,12 @@
 // RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \
 // RUN:   -nocudalib --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \
 // RUN:   | FileCheck %s -check-prefix COMMON -check-prefix NOLIBDEVICE
+// Verify that we don't add include paths, link with libdevice or
+// -include cuda_runtime without valid CUDA installation.
+// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \
+// RUN:   --cuda-path=%S/no-cuda-there %s 2>&1 \
+// RUN:   | FileCheck %s -check-prefix COMMON \
+// RUN: -check-prefix NOCUDAINC -check-prefix NOLIBDEVICE

Re: [PATCH] D13144: [CUDA] propagate to CUDA sub-compilations target triple of opposite side.

2015-11-17 Thread Artem Belevich via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253385: [CUDA] use -aux-triple to pass target triple of 
opposite side of compilation (authored by tra).

Changed prior to commit:
  http://reviews.llvm.org/D13144?vs=40163=40432#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13144

Files:
  cfe/trunk/include/clang/Driver/Action.h
  cfe/trunk/include/clang/Driver/Compilation.h
  cfe/trunk/include/clang/Driver/Driver.h
  cfe/trunk/lib/Driver/Action.cpp
  cfe/trunk/lib/Driver/Compilation.cpp
  cfe/trunk/lib/Driver/Driver.cpp
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/Driver/cuda-options.cu
  cfe/trunk/test/SemaCUDA/function-target-hd.cu

Index: cfe/trunk/test/SemaCUDA/function-target-hd.cu
===
--- cfe/trunk/test/SemaCUDA/function-target-hd.cu
+++ cfe/trunk/test/SemaCUDA/function-target-hd.cu
@@ -8,9 +8,9 @@
 // host device functions are not allowed to call device functions.
 
 // RUN: %clang_cc1 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -fsyntax-only -fcuda-is-device -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fcuda-is-device -triple nvptx-unknown-cuda -verify %s
 // RUN: %clang_cc1 -fsyntax-only -fcuda-allow-host-calls-from-host-device -verify %s -DTEST_WARN_HD
-// RUN: %clang_cc1 -fsyntax-only -fcuda-is-device -fcuda-allow-host-calls-from-host-device -verify %s -DTEST_WARN_HD
+// RUN: %clang_cc1 -fsyntax-only -fcuda-is-device -triple nvptx-unknown-cuda -fcuda-allow-host-calls-from-host-device -verify %s -DTEST_WARN_HD
 
 #include "Inputs/cuda.h"
 
Index: cfe/trunk/test/Driver/cuda-options.cu
===
--- cfe/trunk/test/Driver/cuda-options.cu
+++ cfe/trunk/test/Driver/cuda-options.cu
@@ -111,14 +111,6 @@
 // Make sure we don't link anything.
 // RUN:   -check-prefix CUDA-NL %s
 
-// Match device-side preprocessor, and compiler phases with -save-temps
-// CUDA-D1S: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda"
-// CUDA-D1S-SAME: "-fcuda-is-device"
-// CUDA-D1S-SAME: "-x" "cuda"
-// CUDA-D1S: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda"
-// CUDA-D1S-SAME: "-fcuda-is-device"
-// CUDA-D1S-SAME: "-x" "cuda-cpp-output"
-
 // --cuda-host-only should never trigger unused arg warning.
 // RUN: %clang -### -target x86_64-linux-gnu --cuda-host-only -c %s 2>&1 | \
 // RUN:FileCheck -check-prefix CUDA-NO-UNUSED-CHO %s
@@ -133,34 +125,47 @@
 // RUN: %clang -### -target x86_64-linux-gnu --cuda-device-only -x c -c %s 2>&1 | \
 // RUN:FileCheck -check-prefix CUDA-UNUSED-CDO %s
 
+// Match device-side preprocessor, and compiler phases with -save-temps
+// CUDA-D1S: "-cc1" "-triple" "nvptx64-nvidia-cuda"
+// CUDA-D1S-SAME: "-aux-triple" "x86_64--linux-gnu"
+// CUDA-D1S-SAME: "-fcuda-is-device"
+// CUDA-D1S-SAME: "-x" "cuda"
+
+// CUDA-D1S: "-cc1" "-triple" "nvptx64-nvidia-cuda"
+// CUDA-D1S-SAME: "-aux-triple" "x86_64--linux-gnu"
+// CUDA-D1S-SAME: "-fcuda-is-device"
+// CUDA-D1S-SAME: "-x" "cuda-cpp-output"
+
 // Match the job that produces PTX assembly
-// CUDA-D1: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda"
+// CUDA-D1: "-cc1" "-triple" "nvptx64-nvidia-cuda"
+// CUDA-D1NS-SAME: "-aux-triple" "x86_64--linux-gnu"
 // CUDA-D1-SAME: "-fcuda-is-device"
 // CUDA-D1-SM35-SAME: "-target-cpu" "sm_35"
 // CUDA-D1-SAME: "-o" "[[GPUBINARY1:[^"]*]]"
 // CUDA-D1NS-SAME: "-x" "cuda"
 // CUDA-D1S-SAME: "-x" "ir"
 
-// Match anothe device-side compilation
-// CUDA-D2: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda"
+// Match another device-side compilation
+// CUDA-D2: "-cc1" "-triple" "nvptx64-nvidia-cuda"
+// CUDA-D2-SAME: "-aux-triple" "x86_64--linux-gnu"
 // CUDA-D2-SAME: "-fcuda-is-device"
 // CUDA-D2-SM30-SAME: "-target-cpu" "sm_30"
 // CUDA-D2-SAME: "-o" "[[GPUBINARY2:[^"]*]]"
 // CUDA-D2-SAME: "-x" "cuda"
 
 // Match no device-side compilation
-// CUDA-ND-NOT: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda"
+// CUDA-ND-NOT: "-cc1" "-triple" "nvptx64-nvidia-cuda"
 // CUDA-ND-SAME-NOT: "-fcuda-is-device"
 
 // Match host-side preprocessor job with -save-temps
-// CUDA-HS: "-cc1" "-triple"
-// CUDA-HS-SAME-NOT: "nvptx{{(64)?}}-nvidia-cuda"
+// CUDA-HS: "-cc1" "-triple" "x86_64--linux-gnu"
+// CUDA-HS-SAME: "-aux-triple" "nvptx64-nvidia-cuda"
 // CUDA-HS-SAME-NOT: "-fcuda-is-device"
 // CUDA-HS-SAME: "-x" "cuda"
 
 // Match host-side compilation
-// CUDA-H: "-cc1" "-triple"
-// CUDA-H-SAME-NOT: "nvptx{{(64)?}}-nvidia-cuda"
+// CUDA-H: "-cc1" "-triple" "x86_64--linux-gnu"
+// CUDA-H-SAME: "-aux-triple" "nvptx64-nvidia-cuda"
 // CUDA-H-SAME-NOT: "-fcuda-is-device"
 // CUDA-H-SAME: "-o" "[[HOSTOUTPUT:[^"]*]]"
 // CUDA-HNS-SAME: "-x" "cuda"
Index: cfe/trunk/lib/Driver/Compilation.cpp
===
--- cfe/trunk/lib/Driver/Compilation.cpp
+++ cfe/trunk/lib/Driver/Compilation.cpp
@@ -24,8 +24,9 @@
 
 Compilation::Compilation(const Driver , const ToolChain &_DefaultToolChain,
  

Re: [PATCH] D13170: [CUDA] Driver changes to pass flags needed to use detected CUDA installation.

2015-11-17 Thread Artem Belevich via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253386: [CUDA] added include paths for both sides of CUDA 
compilation. (authored by tra).

Changed prior to commit:
  http://reviews.llvm.org/D13170?vs=39860=40433#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13170

Files:
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/include/clang/Driver/ToolChain.h
  cfe/trunk/lib/Driver/ToolChain.cpp
  cfe/trunk/lib/Driver/ToolChains.cpp
  cfe/trunk/lib/Driver/ToolChains.h
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/lib/Driver/Tools.h
  cfe/trunk/test/Driver/cuda-detect.cu

Index: cfe/trunk/lib/Driver/ToolChain.cpp
===
--- cfe/trunk/lib/Driver/ToolChain.cpp
+++ cfe/trunk/lib/Driver/ToolChain.cpp
@@ -662,3 +662,6 @@
 Res |= CFIICall;
   return Res;
 }
+
+void ToolChain::AddCudaIncludeArgs(const ArgList ,
+   ArgStringList ) const {}
Index: cfe/trunk/lib/Driver/ToolChains.h
===
--- cfe/trunk/lib/Driver/ToolChains.h
+++ cfe/trunk/lib/Driver/ToolChains.h
@@ -784,6 +784,8 @@
   void AddClangCXXStdlibIncludeArgs(
   const llvm::opt::ArgList ,
   llvm::opt::ArgStringList ) const override;
+  void AddCudaIncludeArgs(const llvm::opt::ArgList ,
+  llvm::opt::ArgStringList ) const override;
   bool isPIEDefault() const override;
   SanitizerMask getSupportedSanitizers() const override;
   void addProfileRTLibs(const llvm::opt::ArgList ,
Index: cfe/trunk/lib/Driver/Tools.h
===
--- cfe/trunk/lib/Driver/Tools.h
+++ cfe/trunk/lib/Driver/Tools.h
@@ -57,7 +57,8 @@
const Driver , const llvm::opt::ArgList ,
llvm::opt::ArgStringList ,
const InputInfo ,
-   const InputInfoList ) const;
+   const InputInfoList ,
+   const ToolChain *AuxToolChain) const;
 
   void AddAArch64TargetArgs(const llvm::opt::ArgList ,
 llvm::opt::ArgStringList ) const;
Index: cfe/trunk/lib/Driver/ToolChains.cpp
===
--- cfe/trunk/lib/Driver/ToolChains.cpp
+++ cfe/trunk/lib/Driver/ToolChains.cpp
@@ -4104,6 +4104,15 @@
   }
 }
 
+void Linux::AddCudaIncludeArgs(const ArgList ,
+   ArgStringList ) const {
+  if (DriverArgs.hasArg(options::OPT_nocudainc))
+return;
+
+  if (CudaInstallation.isValid())
+addSystemInclude(DriverArgs, CC1Args, CudaInstallation.getIncludePath());
+}
+
 bool Linux::isPIEDefault() const { return getSanitizerArgs().requiresPIE(); }
 
 SanitizerMask Linux::getSupportedSanitizers() const {
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -278,7 +278,8 @@
 const Driver , const ArgList ,
 ArgStringList ,
 const InputInfo ,
-const InputInfoList ) const {
+const InputInfoList ,
+const ToolChain *AuxToolChain) const {
   Arg *A;
 
   CheckPreprocessingOptions(D, Args);
@@ -470,12 +471,26 @@
   // OBJCPLUS_INCLUDE_PATH - system includes enabled when compiling ObjC++.
   addDirectoryList(Args, CmdArgs, "-objcxx-isystem", "OBJCPLUS_INCLUDE_PATH");
 
+  // Optional AuxToolChain indicates that we need to include headers
+  // for more than one target. If that's the case, add include paths
+  // from AuxToolChain right after include paths of the same kind for
+  // the current target.
+
   // Add C++ include arguments, if needed.
-  if (types::isCXX(Inputs[0].getType()))
+  if (types::isCXX(Inputs[0].getType())) {
 getToolChain().AddClangCXXStdlibIncludeArgs(Args, CmdArgs);
+if (AuxToolChain)
+  AuxToolChain->AddClangCXXStdlibIncludeArgs(Args, CmdArgs);
+  }
 
   // Add system include arguments.
   getToolChain().AddClangSystemIncludeArgs(Args, CmdArgs);
+  if (AuxToolChain)
+  AuxToolChain->AddClangCXXStdlibIncludeArgs(Args, CmdArgs);
+
+  // Add CUDA include arguments, if needed.
+  if (types::isCuda(Inputs[0].getType()))
+getToolChain().AddCudaIncludeArgs(Args, CmdArgs);
 }
 
 // FIXME: Move to target hook.
@@ -3262,12 +3277,12 @@
   CmdArgs.push_back("-triple");
   CmdArgs.push_back(Args.MakeArgString(TripleStr));
 
+  const ToolChain *AuxToolChain = nullptr;
   if (IsCuda) {
 // FIXME: We need a (better) way to pass information about
 // particular compilation pass we're constructing here. For now we
 // can check which toolchain we're using and pick the other one 

Re: [PATCH] D14754: [Myriad]: insert -L paths into linker cmd only when they exist.

2015-11-17 Thread James Y Knight via cfe-commits
jyknight added inline comments.


Comment at: lib/Driver/ToolChains.cpp:4319
@@ +4318,3 @@
+  // This contains libc, libg (a superset of libc), libm, libstdc++, libssp.
+  SmallString<128> LibDir(GCCInstallation.getParentLibPath());
+  if (Triple.getArch() == llvm::Triple::sparcel)

Should check GCCInstallation.isValid() before doing any of this.


Comment at: lib/Driver/ToolChains.cpp:4324
@@ +4323,3 @@
+llvm::sys::path::append(LibDir, "../sparc-myriad-elf/lib");
+  if (getVFS().exists(LibDir))
+getFilePaths().push_back(LibDir.str());

addPathIfExists instead of if/push_back.


http://reviews.llvm.org/D14754



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


r253440 - Update for llvm change.

2015-11-17 Thread Rafael Espindola via cfe-commits
Author: rafael
Date: Wed Nov 18 00:54:13 2015
New Revision: 253440

URL: http://llvm.org/viewvc/llvm-project?rev=253440=rev
Log:
Update for llvm change.

Modified:
cfe/trunk/include/clang/Lex/HeaderSearchOptions.h
cfe/trunk/lib/CodeGen/CGObjCMac.cpp

Modified: cfe/trunk/include/clang/Lex/HeaderSearchOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearchOptions.h?rev=253440=253439=253440=diff
==
--- cfe/trunk/include/clang/Lex/HeaderSearchOptions.h (original)
+++ cfe/trunk/include/clang/Lex/HeaderSearchOptions.h Wed Nov 18 00:54:13 2015
@@ -141,7 +141,7 @@ public:
 
   /// \brief The set of macro names that should be ignored for the purposes
   /// of computing the module hash.
-  llvm::SetVector ModulesIgnoreMacros;
+  llvm::SmallSetVector ModulesIgnoreMacros;
 
   /// \brief The set of user-provided virtual filesystem overlay files.
   std::vector VFSOverlayFiles;

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=253440=253439=253440=diff
==
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Wed Nov 18 00:54:13 2015
@@ -833,7 +833,7 @@ protected:
   llvm::DenseMap MethodVarNames;
 
   /// DefinedCategoryNames - list of category names in form Class_Category.
-  llvm::SetVector DefinedCategoryNames;
+  llvm::SmallSetVector DefinedCategoryNames;
 
   /// MethodVarTypes - uniqued method type signatures. We have to use
   /// a StringMap here because have no other unique reference.


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


[clang-tools-extra] r253442 - Replace a dyn_cast with isa where the result was only being used as a boolean. NFC.

2015-11-17 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Wed Nov 18 01:08:11 2015
New Revision: 253442

URL: http://llvm.org/viewvc/llvm-project?rev=253442=rev
Log:
Replace a dyn_cast with isa where the result was only being used as a boolean. 
NFC.

Modified:
clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp?rev=253442=253441=253442=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp Wed Nov 18 
01:08:11 2015
@@ -302,7 +302,7 @@ void UseDefaultCheck::check(const MatchF
   if (!StartLoc.isValid())
 return;
 }
-  } else if (dyn_cast(SpecialFunctionDecl)) {
+  } else if (isa(SpecialFunctionDecl)) {
 SpecialFunctionName = "destructor";
   } else {
 if (!isCopyAssignmentAndCanBeDefaulted(Result.Context, 
SpecialFunctionDecl))


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