Re: [PATCH] D14471: [AArch64] Fix a crash in driver

2015-11-13 Thread Renato Golin via cfe-commits
rengolin added a comment.

In http://reviews.llvm.org/D14471#288621, @ahatanak wrote:

> In getAArch64TargetCPU, if it finds out the cpu name passed via -mtune or 
> -mcpu is "native",
>
> 1. Call llvm::sys::getHostCPUName to get the host CPU name.
> 2. Check the host CPU name to see if it is a valid AArch64 CPU. A CPU is 
> valid if it is one of these CPUs: cyclone, cortex-a53, cortex-a57, 
> cortex-a72, or generic (this is the set of CPUs that are valid in 
> DecodeAArch64Mcpu).
> 3. If the host CPU is valid, return the CPU name. Otherwise, return "native".


Something like that, yes. Only return native if -mcpu/tune was native to begin 
with, and decode CPU names using the already existing mechanisms, not creating 
a new StringSwitch.

thanks,
--renato


http://reviews.llvm.org/D14471



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


RE: r253011 - clang/test/Driver/mips-mti-linux.c: Tweak to match DOSish paths.

2015-11-13 Thread Vasileios Kalintiris via cfe-commits
Thank you for making this run on win buildbots!

- Vasileios

From: cfe-commits [cfe-commits-boun...@lists.llvm.org] on behalf of NAKAMURA 
Takumi via cfe-commits [cfe-commits@lists.llvm.org]
Sent: 13 November 2015 04:44
To: cfe-commits@lists.llvm.org
Subject: r253011 - clang/test/Driver/mips-mti-linux.c: Tweak to match DOSish 
paths.

Author: chapuni
Date: Thu Nov 12 22:44:51 2015
New Revision: 253011

URL: http://llvm.org/viewvc/llvm-project?rev=253011&view=rev
Log:
clang/test/Driver/mips-mti-linux.c: Tweak to match DOSish paths.

Modified:
cfe/trunk/test/Driver/mips-mti-linux.c

Modified: cfe/trunk/test/Driver/mips-mti-linux.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-mti-linux.c?rev=253011&r1=253010&r2=253011&view=diff
==
--- cfe/trunk/test/Driver/mips-mti-linux.c (original)
+++ cfe/trunk/test/Driver/mips-mti-linux.c Thu Nov 12 22:44:51 2015
@@ -5,8 +5,6 @@
 //Ideally, we'd like to have an --llvm-toolchain option similar to
 //the --gcc-toolchain one.

-// REQUIRES: shell
-
 // = Big-endian, mips32r2, hard float
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: --target=mips-mti-linux -mips32r2 -mhard-float \
@@ -21,7 +19,7 @@
 // CHECK-BE-HF-32R2-SAME: 
"[[SYSROOT]]/mips-r2-hard-musl/usr/lib{{/|}}crt1.o"
 // CHECK-BE-HF-32R2-SAME: 
"[[SYSROOT]]/mips-r2-hard-musl/usr/lib{{/|}}crti.o"
 // CHECK-BE-HF-32R2-SAME: "-L[[SYSROOT]]/mips-r2-hard-musl/usr/lib"
-// CHECK-BE-HF-32R2-SAME: 
"{{[^"]+}}/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a"
+// CHECK-BE-HF-32R2-SAME: 
"{{[^"]+}}/mips-r2-hard-musl{{/|}}lib{{/|}}linux{{/|}}libclang_rt.builtins-mips.a"
 // CHECK-BE-HF-32R2-SAME: "-lc"
 // CHECK-BE-HF-32R2-SAME: 
"[[SYSROOT]]/mips-r2-hard-musl/usr/lib{{/|}}crtn.o"

@@ -39,6 +37,6 @@
 // CHECK-LE-HF-32R2-SAME: 
"[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crt1.o"
 // CHECK-LE-HF-32R2-SAME: 
"[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crti.o"
 // CHECK-LE-HF-32R2-SAME: "-L[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib"
-// CHECK-LE-HF-32R2-SAME: 
"{{[^"]+}}/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a"
+// CHECK-LE-HF-32R2-SAME: 
"{{[^"]+}}/mipsel-r2-hard-musl{{/|}}lib{{/|}}linux{{/|}}libclang_rt.builtins-mipsel.a"
 // CHECK-LE-HF-32R2-SAME: "-lc"
 // CHECK-LE-HF-32R2-SAME: 
"[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crtn.o"


___
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] D14277: [Analyzer] Make referenced SymbolMetadata live even if its region is dead

2015-11-13 Thread Aleksei Sidorin via cfe-commits
a.sidorin added a comment.

> - What happens when you take a string's length, test it against something, 
> throw it away, then remeasure the string? In this case we'd be okay because 
> CStringChecker still hangs on to the symbol in its map until the region is 
> invalidated.


We cannot throw out anything related to live region we reference in the 
checker. While region lives, checker will keep its length alive, so this case 
seem to be OK.

> - Will we keep more symbols alive than we did previously, increasing the 
> analyzer's memory use? I think the answer is "yes", but not by very much: the 
> live/dead checking is two-pass, so we'll mark a metadata symbol live in 
> `checkLiveSymbols` but then find out we could have dropped it in 
> `checkDeadSymbols` when the region is found to be dead. It'll get cleaned up 
> the next time around, but I think that sort of conditional liveness is what 
> the old mechanism was trying to accomplish.


Yes, you are right. The lengths of dead regions will be garbage-collected only 
in the next collection so they will consume some memory.

> Do you have any ideas for how we could make that better? I can think of a 
> complicated case where you use `markInUse` if the metadata symbol exactly 
> matches the key, but `markLive` otherwise…but at some point I'm not sure it's 
> worth the complexity cost.


As I understand, to make a precise GC, we need to do it in a number of 
iterations but now we make only one iteration. This does not influence 
correctness because we are conservative and we don't remove information that is 
alive (but may keep some dead). However, iterative GC may dramatically decrease 
analyzer perfomance.

> (In particular, after this change, I'm not sure metadata symbols behave any 
> differently from regular conjured symbols. This is a good thing.)


Yes. But we extensively use SymbolMetadata's information in our summary 
implementation so don't hurry to throw it out :)

> (We've also talked about having better REGISTER_MAP_WITH_PROGRAMSTATE that 
> auto-remove any keys for dead symbols or dead regions. I'm sure Anna and 
> Devin would be happy to see someone pick that up.)


I don't think it is a good idea because some checkers handle dead symbols in 
customizable ways to detect leaks. Some helper for remove all items with dead 
keys from state working with common collections (in CheckerHelpers, for 
example) may be useful to to avoid code duplication, but it is an item for 
another patch.

BTW, what about my comment for line 457? Should we consider a metadata symbol 
always dead after this patch?


Repository:
  rL LLVM

http://reviews.llvm.org/D14277



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


Re: [PATCH] D14629: [analyzer] Configuration file for scan-build.

2015-11-13 Thread Антон Ярцев via cfe-commits
ayartsev added a comment.

In http://reviews.llvm.org/D14629#288478, @jroelofs wrote:

> `CommonStuff.pm` (which could stand to have a more descriptive name, 
> `libscanbuild.pm` maybe?) and `scan-build.cfg` belong in `share`.


Got it, I'll rename `CommonStuff.pm` and put it to `share` in the next patch 
iteration.

In http://reviews.llvm.org/D14629#288485, @jroelofs wrote:

> Also, how is this different from `-analyzer-config`?


`-analyzer-config` is used to transfers a number of options to the analyzer, 
while configuration file is used to customize `scan-build`, `ccc-analyzer` and 
`c++-analyzer` scripts.

In http://reviews.llvm.org/D14629#288495, @jroelofs wrote:

> Actually, now that I think about it more, `scan-build.cfg` doesn't belong in 
> share at all. The location of an instance of it should be read in via a 
> command-line argument, and it shouldn't be installed.


I intend to add a command-line argument to customize the configuration file 
location, but there must be some default example configuration file to describe 
all available options and rules (`scan-build.cfg` from this patch).

Thanks for looking at this!


http://reviews.llvm.org/D14629



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


[clang-tools-extra] r253036 - [clang-tidy] Remove unused #includes.

2015-11-13 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Fri Nov 13 06:16:10 2015
New Revision: 253036

URL: http://llvm.org/viewvc/llvm-project?rev=253036&view=rev
Log:
[clang-tidy] Remove unused #includes.

Summary: Testing Phab with git-svn

Reviewers: alexfh

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

Modified:
clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=253036&r1=253035&r2=253036&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Fri Nov 13 06:16:10 2015
@@ -36,8 +36,6 @@
 #include "clang/Tooling/Refactoring.h"
 #include "clang/Tooling/ReplacementsYaml.h"
 #include "clang/Tooling/Tooling.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Signals.h"
 #include 


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


Re: [PATCH] D14277: [Analyzer] Make referenced SymbolMetadata live even if its region is dead

2015-11-13 Thread Aleksei Sidorin via cfe-commits
a.sidorin added a comment.

Sorry, I misunderstood your first question. This case is OK because 
CStringChecker handles invalidation and shouldn't track invalidated regions 
until their lengths become known. Test strlen_global() (string.c:106) should 
confirm this.


Repository:
  rL LLVM

http://reviews.llvm.org/D14277



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


Re: [PATCH] D13351: [Power PC] add soft float support for ppc32

2015-11-13 Thread Strahinja Petrovic via cfe-commits
spetrovic set the repository for this revision to rL LLVM.
spetrovic updated this revision to Diff 40143.
spetrovic marked 2 inline comments as done.
spetrovic added a comment.

Comments addressed.


Repository:
  rL LLVM

http://reviews.llvm.org/D13351

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  lib/CodeGen/TargetInfo.cpp
  lib/Driver/Tools.cpp
  lib/Driver/Tools.h
  test/CodeGen/ppc-sfvarargs.c
  test/Driver/ppc-features.cpp

Index: test/Driver/ppc-features.cpp
===
--- test/Driver/ppc-features.cpp
+++ test/Driver/ppc-features.cpp
@@ -12,6 +12,50 @@
 // RUN: not %clang -target mips64-linux-gnu -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
 // RUN: not %clang -target sparc-unknown-solaris -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
 
+// check -msoft-float option for ppc32
+// RUN: %clang -target powerpc-unknown-linux-gnu %s -msoft-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTFLOAT %s
+// CHECK-SOFTFLOAT: "-target-feature" "+soft-float"
+
+// check -mfloat-abi=soft option for ppc32
+// RUN: %clang -target powerpc-unknown-linux-gnu %s -mfloat-abi=soft -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-FLOATABISOFT %s
+// CHECK-FLOATABISOFT: "-target-feature" "+soft-float"
+
+// check -mhard-float option for ppc32
+// RUN: %clang -target powerpc-unknown-linux-gnu %s -mhard-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-HARDFLOAT %s
+// CHECK-HARDFLOAT-NOT: "-target-feature" "+soft-float"
+
+// check -mfloat-abi=hard option for ppc32
+// RUN: %clang -target powerpc-unknown-linux-gnu %s -mfloat-abi=hard -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-FLOATABIHARD %s
+// CHECK-FLOATABIHARD-NOT: "-target-feature" "+soft-float"
+
+// check combine -mhard-float -msoft-float option for ppc32
+// RUN: %clang -target powerpc-unknown-linux-gnu %s -mhard-float -msoft-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-HARDSOFT %s
+// CHECK-HARDSOFT: "-target-feature" "+soft-float"
+
+// check combine -msoft-float -mhard-float option for ppc32
+// RUN: %clang -target powerpc-unknown-linux-gnu %s -msoft-float -mhard-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTHARD %s
+// CHECK-SOFTHARD-NOT: "-target-feature" "+soft-float"
+
+// check -mfloat-abi=x option
+// RUN: %clang -target powerpc-unknown-linux-gnu %s -mfloat-abi=x -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-ERRMSG %s
+// CHECK-ERRMSG: clang: error: invalid float ABI '-mfloat-abi=x'
+
+// check -msoft-float option for ppc64
+// RUN: %clang -target powerpc64-unknown-linux-gnu %s -msoft-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTFLOAT64 %s
+// CHECK-SOFTFLOAT64: clang: error: soft float is not supported for ppc64
+
+// check -mfloat-abi=soft option for ppc64
+// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mfloat-abi=soft -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-FLOATABISOFT64 %s
+// CHECK-FLOATABISOFT64: clang: error: soft float is not supported for ppc64
+
+// check -msoft-float option for ppc64
+// RUN: %clang -target powerpc64le-unknown-linux-gnu %s -msoft-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTFLOAT64le %s
+// CHECK-SOFTFLOAT64le: clang: error: soft float is not supported for ppc64
+
+// check -mfloat-abi=soft option for ppc64
+// RUN: %clang -target powerpc64le-unknown-linux-gnu %s -mfloat-abi=soft -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-FLOATABISOFT64le %s
+// CHECK-FLOATABISOFT64le: clang: error: soft float is not supported for ppc64
+
 // CHECK: invalid argument '-faltivec' only allowed with 'ppc/ppc64/ppc64le'
 
 // Check that -fno-altivec and -mno-altivec correctly disable the altivec
Index: test/CodeGen/ppc-sfvarargs.c
===
--- test/CodeGen/ppc-sfvarargs.c
+++ test/CodeGen/ppc-sfvarargs.c
@@ -0,0 +1,17 @@
+// RUN: %clang -O0 --target=powerpc-unknown-linux-gnu -EB -msoft-float -S -emit-llvm %s -o - | FileCheck %s
+
+#include 
+void test(char *fmt, ...) {
+  va_list ap;
+  va_start(ap, fmt);
+  va_arg(ap, double);
+  va_end(ap);
+}
+
+void foo() {
+  double a;
+  test("test",a);
+}
+// CHECK: %{{[0-9]+}} = add i8 %numUsedRegs, 1
+// CHECK: %{{[0-9]+}} = and i8 %{{[0-9]+}}, -2
+// CHECK: %{{[0-9]+}} = mul i8 %{{[0-9]+}}, 4
\ No newline at end of file
Index: lib/Driver/Tools.h
===
--- lib/Driver/Tools.h
+++ lib/Driver/Tools.h
@@ -731,6 +731,16 @@
 
 FloatABI getARMFloatABI(const ToolChain &TC, const llvm::opt::ArgList &Args);
 }
+
+namespace ppc {
+enum class FloatABI {
+  Invalid,
+  Soft,
+  Hard,
+};
+
+FloatABI getPPCFloatABI(const Driver &D, const llvm::opt::ArgList &Args);
+}
 namespace XCore {
 // For XCore, we do not need to instantiate tools for PreProcess, PreCompile and
 // Compile.
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools

Re: [PATCH] D14619: [PATCH] clang-tidy checker for nothrow copy constructible exception objects

2015-11-13 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Much better now. A few more comments.



Comment at: clang-tidy/cert/ThrownExceptionTypeCheck.cpp:18
@@ +17,3 @@
+namespace {
+AST_MATCHER(CXXConstructorDecl, isNoThrowCopyConstructible) {
+  if (!Node.isCopyConstructor())

nit: I suggest changing `isNoThrowCopyConstructible` to 
`isNoThrowCopyConstructor`, because "constructible" is a trait of a class, not 
its constructor.


Comment at: clang-tidy/cert/ThrownExceptionTypeCheck.cpp:22
@@ +21,3 @@
+
+  if (Node.isTrivial())
+return true;

Out of curiosity: are we short-circuiting here for performance reasons or would 
the code below return `false` in this case?


Comment at: clang-tidy/cert/ThrownExceptionTypeCheck.cpp:34
@@ +33,3 @@
+  }
+  return true;
+}

Is this `return` reachable? If yes, when exactly does this happen and is there 
a test for this case?


http://reviews.llvm.org/D14619



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


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

2015-11-13 Thread Yury Gribov via cfe-commits
ygribov created this revision.
ygribov added reviewers: zaks.anna, dcoughlin, jordan_rose.
ygribov added a subscriber: cfe-commits.

Conversions between unrelated pointer types (e.g. char * and void *) involve 
bitcasts which were not properly modeled in case of static initializers. The 
patch fixes this problem.

The problem was originally spotted by Artem Dergachev.

http://reviews.llvm.org/D14652

Files:
  lib/StaticAnalyzer/Core/SValBuilder.cpp
  test/Analysis/inline.cpp

Index: test/Analysis/inline.cpp
===
--- test/Analysis/inline.cpp
+++ test/Analysis/inline.cpp
@@ -275,7 +275,7 @@
 
 clang_analyzer_eval(defaultReferenceZero(1) == -1); // 
expected-warning{{TRUE}}
 clang_analyzer_eval(defaultReferenceZero() == 0); // 
expected-warning{{TRUE}}
-}
+  }
 
   double defaultFloatReference(const double &i = 42) {
 return -i;
@@ -300,6 +300,13 @@
 clang_analyzer_eval(defaultString("xyz") == 'y'); // 
expected-warning{{TRUE}}
 clang_analyzer_eval(defaultString() == 'b'); // expected-warning{{TRUE}}
   }
+
+  const void * const void_string = "abc";
+
+  void testBitcastedString() {
+clang_analyzer_eval(0 != void_string); // expected-warning{{TRUE}}
+clang_analyzer_eval(0 != ((char *)void_string)[1]); // 
expected-warning{{TRUE}}
+  }
 }
 
 namespace OperatorNew {
Index: lib/StaticAnalyzer/Core/SValBuilder.cpp
===
--- lib/StaticAnalyzer/Core/SValBuilder.cpp
+++ lib/StaticAnalyzer/Core/SValBuilder.cpp
@@ -275,11 +275,17 @@
 
   case Stmt::ImplicitCastExprClass: {
 const CastExpr *CE = cast(E);
-if (CE->getCastKind() == CK_ArrayToPointerDecay) {
-  Optional ArrayVal = getConstantVal(CE->getSubExpr());
-  if (!ArrayVal)
+switch (CE->getCastKind()) {
+default:
+  break;
+case CK_ArrayToPointerDecay:
+case CK_BitCast: {
+  const Expr *SE = CE->getSubExpr();
+  Optional Val = getConstantVal(SE);
+  if (!Val)
 return None;
-  return evalCast(*ArrayVal, CE->getType(), CE->getSubExpr()->getType());
+  return evalCast(*Val, CE->getType(), SE->getType());
+}
 }
 // FALLTHROUGH
   }


Index: test/Analysis/inline.cpp
===
--- test/Analysis/inline.cpp
+++ test/Analysis/inline.cpp
@@ -275,7 +275,7 @@
 
 clang_analyzer_eval(defaultReferenceZero(1) == -1); // expected-warning{{TRUE}}
 clang_analyzer_eval(defaultReferenceZero() == 0); // expected-warning{{TRUE}}
-}
+  }
 
   double defaultFloatReference(const double &i = 42) {
 return -i;
@@ -300,6 +300,13 @@
 clang_analyzer_eval(defaultString("xyz") == 'y'); // expected-warning{{TRUE}}
 clang_analyzer_eval(defaultString() == 'b'); // expected-warning{{TRUE}}
   }
+
+  const void * const void_string = "abc";
+
+  void testBitcastedString() {
+clang_analyzer_eval(0 != void_string); // expected-warning{{TRUE}}
+clang_analyzer_eval(0 != ((char *)void_string)[1]); // expected-warning{{TRUE}}
+  }
 }
 
 namespace OperatorNew {
Index: lib/StaticAnalyzer/Core/SValBuilder.cpp
===
--- lib/StaticAnalyzer/Core/SValBuilder.cpp
+++ lib/StaticAnalyzer/Core/SValBuilder.cpp
@@ -275,11 +275,17 @@
 
   case Stmt::ImplicitCastExprClass: {
 const CastExpr *CE = cast(E);
-if (CE->getCastKind() == CK_ArrayToPointerDecay) {
-  Optional ArrayVal = getConstantVal(CE->getSubExpr());
-  if (!ArrayVal)
+switch (CE->getCastKind()) {
+default:
+  break;
+case CK_ArrayToPointerDecay:
+case CK_BitCast: {
+  const Expr *SE = CE->getSubExpr();
+  Optional Val = getConstantVal(SE);
+  if (!Val)
 return None;
-  return evalCast(*ArrayVal, CE->getType(), CE->getSubExpr()->getType());
+  return evalCast(*Val, CE->getType(), SE->getType());
+}
 }
 // FALLTHROUGH
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D14639: LLDB JIT needs android vector passing rules.

2015-11-13 Thread Aidan Dodds via cfe-commits
ADodds created this revision.
ADodds added reviewers: asl, rsmith.
ADodds added subscribers: pirama, cfe-commits.
ADodds set the repository for this revision to rL LLVM.
Herald added subscribers: srhines, danalbert, tberghammer, aemerson.

Looking into some recent issues with LLDBs expression parser highlighted that 
upstream clang passes vectors types differently to Android Open Source 
Project's clang for Arm Android targets.
This patch reflects the changes present in the AOSP and allows LLDB's JIT 
expression evaluation to work correctly for Arm Android targets when passing 
vectors.

This is submitted with consent of the original author Stephen Hines.

Repository:
  rL LLVM

http://reviews.llvm.org/D14639

Files:
  lib/CodeGen/TargetInfo.cpp

Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -4724,6 +4724,11 @@
 }
   }
 
+  bool isAndroid() const {
+return (getTarget().getTriple().getEnvironment() ==
+llvm::Triple::Android);
+  }
+
   ABIKind getABIKind() const { return Kind; }
 
 private:
@@ -5227,15 +5232,23 @@
 
 /// isIllegalVector - check whether Ty is an illegal vector type.
 bool ARMABIInfo::isIllegalVectorType(QualType Ty) const {
-  if (const VectorType *VT = Ty->getAs()) {
-// Check whether VT is legal.
-unsigned NumElements = VT->getNumElements();
-uint64_t Size = getContext().getTypeSize(VT);
-// NumElements should be power of 2.
-if ((NumElements & (NumElements - 1)) != 0)
-  return true;
-// Size should be greater than 32 bits.
-return Size <= 32;
+  if (const VectorType *VT = Ty->getAs ()) {
+if (isAndroid()) {
+  // Check whether VT is legal.
+  unsigned NumElements = VT->getNumElements();
+  // NumElements should be power of 2 or equal to 3.
+  if ((NumElements & (NumElements - 1)) != 0 && NumElements != 3)
+return true;
+} else {
+  // Check whether VT is legal.
+  unsigned NumElements = VT->getNumElements();
+  uint64_t Size = getContext().getTypeSize(VT);
+  // NumElements should be power of 2.
+  if ((NumElements & (NumElements - 1)) != 0)
+return true;
+  // Size should be greater than 32 bits.
+  return Size <= 32;
+}
   }
   return false;
 }


Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -4724,6 +4724,11 @@
 }
   }
 
+  bool isAndroid() const {
+return (getTarget().getTriple().getEnvironment() ==
+llvm::Triple::Android);
+  }
+
   ABIKind getABIKind() const { return Kind; }
 
 private:
@@ -5227,15 +5232,23 @@
 
 /// isIllegalVector - check whether Ty is an illegal vector type.
 bool ARMABIInfo::isIllegalVectorType(QualType Ty) const {
-  if (const VectorType *VT = Ty->getAs()) {
-// Check whether VT is legal.
-unsigned NumElements = VT->getNumElements();
-uint64_t Size = getContext().getTypeSize(VT);
-// NumElements should be power of 2.
-if ((NumElements & (NumElements - 1)) != 0)
-  return true;
-// Size should be greater than 32 bits.
-return Size <= 32;
+  if (const VectorType *VT = Ty->getAs ()) {
+if (isAndroid()) {
+  // Check whether VT is legal.
+  unsigned NumElements = VT->getNumElements();
+  // NumElements should be power of 2 or equal to 3.
+  if ((NumElements & (NumElements - 1)) != 0 && NumElements != 3)
+return true;
+} else {
+  // Check whether VT is legal.
+  unsigned NumElements = VT->getNumElements();
+  uint64_t Size = getContext().getTypeSize(VT);
+  // NumElements should be power of 2.
+  if ((NumElements & (NumElements - 1)) != 0)
+return true;
+  // Size should be greater than 32 bits.
+  return Size <= 32;
+}
   }
   return false;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14441: [OpenCL] Pipe types support.

2015-11-13 Thread Xiuli PAN via cfe-commits
pxli168 added a comment.

F1095908: pipelog.txt 
This is the log of runing
 clang -cc1 -emit-llvm -cl-std=CL2.0 -o - pipe_types.c



Comment at: test/CodeGenOpenCL/pipe_types.cl:7
@@ +6,3 @@
+
+void test1(read_only pipe int p) {
+// CHECK: define void @test1(%opencl.pipe_t* %p)

I find the bug is really strange, I just changed the int here into int4 and the 
clang is broken(I will attach the log). But if int4 shows below some function 
with arg like pipe int, it will be alright.
Hope the log may help. 


http://reviews.llvm.org/D14441



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


Re: r252836 - [CMake] Setup an install component for libclang and c-index-test.

2015-11-13 Thread Aaron Ballman via cfe-commits
On Thu, Nov 12, 2015 at 8:51 PM, Argyrios Kyrtzidis  wrote:
> I assume you are referring to the install-c-index-test target, this should 
> not be added to IDEs after r253001.

Indeed, it is fixed for me now. Thank you!

~Aaron

>
>> On Nov 12, 2015, at 7:29 AM, Aaron Ballman  wrote:
>>
>> Is this target needed by IDEs? It currently adds the target to the
>> root level of the solution in MSVC.
>>
>> ~Aaron
>>
>> On Wed, Nov 11, 2015 at 7:46 PM, Argyrios Kyrtzidis via cfe-commits
>>  wrote:
>>> Author: akirtzidis
>>> Date: Wed Nov 11 18:46:57 2015
>>> New Revision: 252836
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=252836&view=rev
>>> Log:
>>> [CMake] Setup an install component for libclang and c-index-test.
>>>
>>> Also don't create libclang dylib symlinks on darwin.
>>>
>>> Modified:
>>>cfe/trunk/CMakeLists.txt
>>>cfe/trunk/tools/c-index-test/CMakeLists.txt
>>>cfe/trunk/tools/libclang/CMakeLists.txt
>>>
>>> Modified: cfe/trunk/CMakeLists.txt
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=252836&r1=252835&r2=252836&view=diff
>>> ==
>>> --- cfe/trunk/CMakeLists.txt (original)
>>> +++ cfe/trunk/CMakeLists.txt Wed Nov 11 18:46:57 2015
>>> @@ -354,7 +354,7 @@ endmacro()
>>>
>>> macro(add_clang_library name)
>>>   cmake_parse_arguments(ARG
>>> -""
>>> +"SHARED"
>>> ""
>>> "ADDITIONAL_HEADERS"
>>> ${ARGN})
>>> @@ -390,17 +390,29 @@ macro(add_clang_library name)
>>>   ${ARG_ADDITIONAL_HEADERS} # It may contain unparsed unknown args.
>>>   )
>>>   endif()
>>> -  llvm_add_library(${name} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
>>> +  if(ARG_SHARED)
>>> +set(ARG_ENABLE_SHARED SHARED)
>>> +  endif()
>>> +  llvm_add_library(${name} ${ARG_ENABLE_SHARED} ${ARG_UNPARSED_ARGUMENTS} 
>>> ${srcs})
>>>
>>>   if(TARGET ${name})
>>> target_link_libraries(${name} ${cmake_2_8_12_INTERFACE} 
>>> ${LLVM_COMMON_LIBS})
>>>
>>> if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "libclang")
>>>   install(TARGETS ${name}
>>> +COMPONENT ${name}
>>> EXPORT ClangTargets
>>> LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
>>> ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
>>> RUNTIME DESTINATION bin)
>>> +
>>> +  if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
>>> +add_custom_target(install-${name}
>>> +  DEPENDS ${name}
>>> +  COMMAND "${CMAKE_COMMAND}"
>>> +  -DCMAKE_INSTALL_COMPONENT=${name}
>>> +  -P 
>>> "${CMAKE_BINARY_DIR}/cmake_install.cmake")
>>> +  endif()
>>> endif()
>>> set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
>>>   else()
>>> @@ -451,6 +463,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
>>> endif()
>>>
>>> install(DIRECTORY include/clang-c
>>> +  COMPONENT libclang
>>>   DESTINATION include
>>>   FILES_MATCHING
>>>   PATTERN "*.h"
>>>
>>> Modified: cfe/trunk/tools/c-index-test/CMakeLists.txt
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/CMakeLists.txt?rev=252836&r1=252835&r2=252836&view=diff
>>> ==
>>> --- cfe/trunk/tools/c-index-test/CMakeLists.txt (original)
>>> +++ cfe/trunk/tools/c-index-test/CMakeLists.txt Wed Nov 11 18:46:57 2015
>>> @@ -28,3 +28,12 @@ if (CLANG_HAVE_LIBXML)
>>>   include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR})
>>>   target_link_libraries(c-index-test ${LIBXML2_LIBRARIES})
>>> endif()
>>> +
>>> +install(TARGETS c-index-test
>>> +  RUNTIME DESTINATION local/bin
>>> +  COMPONENT c-index-test)
>>> +add_custom_target(install-c-index-test
>>> +  DEPENDS c-index-test
>>> +  COMMAND "${CMAKE_COMMAND}"
>>> +  -DCMAKE_INSTALL_COMPONENT=c-index-test
>>> +  -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
>>>
>>> Modified: cfe/trunk/tools/libclang/CMakeLists.txt
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CMakeLists.txt?rev=252836&r1=252835&r2=252836&view=diff
>>> ==
>>> --- cfe/trunk/tools/libclang/CMakeLists.txt (original)
>>> +++ cfe/trunk/tools/libclang/CMakeLists.txt Wed Nov 11 18:46:57 2015
>>> @@ -102,18 +102,16 @@ if(ENABLE_SHARED)
>>>   PROPERTIES
>>>   VERSION ${LIBCLANG_LIBRARY_VERSION}
>>>   DEFINE_SYMBOL _CINDEX_LIB_)
>>> -  else()
>>> -set_target_properties(libclang
>>> -  PROPERTIES
>>> -  VERSION ${LIBCLANG_LIBRARY_VERSION}
>>> -  DEFINE_SYMBOL _CINDEX_LIB_)
>>> -  endif()
>>> -
>>> -  if(APPLE)
>>> +  elseif(APPLE)
>>> set(LIBCLANG_LINK_FLAGS " -Wl,-compatibility_version -Wl,1")
>>> set(LIBCLANG_LINK_FLAGS "${LIBCLANG_LINK_FLAGS} -Wl,-current_version 
>>> -Wl,${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
>>>
>>> set_property(TARGET libclang APPEND_STRING 

[PATCH] D14653: [libcxx] Introduce the mechanism for fixing -fno-exceptions test failures.

2015-11-13 Thread Asiri Rathnayake via cfe-commits
rmaprath created this revision.
rmaprath added reviewers: mclow.lists, jroelofs, rengolin.
rmaprath added a subscriber: cfe-commits.

Summary:

r252598 and r252870 added XFAILs to all those tests that are currently
failing on the -fno-exceptions libc++ library variant. This patch introduces
a mechanism to fix those tests.

Details:

Most of the failing tests have checks of the following nature:

// [1] setup some global state
try {
  do_something_bad();
  assert(false);
} catch (some_exception e) {
  // [2] check some (mostly global) state
  // for consistency.
}
// [3] check some more state
// [4] possibly more try/catch clauses

These tests have been written with the -fexceptions library in mind and does
not compile with -fno-exceptions, and hence cannot be used as-is for testing
the -fno-exceptions library variant.

The current patch attempts to improve the testing of the -fno-exceptions library
variant by leveraging as much as possible of these existing tests, without 
having
to change the tests themselves massively.

We have the following goals in mind:

  1. do_something_bad() should call abort() in the -fno-exceptions library
 variant. The tests should be able to verify this.

   Note: The -fno-exceptions library variant is a custom extension, the
   behaviour of this library when responding to error states does not fall
   into the scope of the C++ standard (which always assumes exceptions).
   Here we have made the decision to call abort() because:

 I. It captures the intention of -fno-exceptions: when the library has
 entered an error state and has no means of notifying it to user code,
 it makes sense to abort the program rather than continue.

 II. This behaviour is in-line with the IA64 CXX ABI:
   https://mentorembedded.github.io/cxx-abi/abi-eh.html#base-framework
 Note the unwinding process, where it says:
   "If the search phase reports failure, e.g. because no handler was
found, it will call terminate() rather than commence phase 2"

  2. The abort() call in 1) should not terminate the test itself, as that
 would prevent any follow-up tests (in the same source file) from running.

  3. We should leverage as much of the existing tests as possible, without 
having
 to change them drastically.

These goals lead us to the following approach:

We introduce a special support header file (noexcept.h) which when included in
the test file, re-writes code segments like the one above with something along
the lines of:

iflabel:
// [1] setup some global state
if (!abort_called()) {
  do_something_bad();
  assert(false);
} else {
  // [2] check some (mostly global) state
  // for consistency.
}
// [3] check some more state
// [4] possibly more try/catch clauses

The custom abort() method provided in the support header file makes a jump to
"iflabel" when called, causing the else branch to be taken after the abort()
call. This mechanism allows us to achieve all of the above goals without having
to modify the test cases greatly (in most cases, simply including the noexcept.h
header is all that is needed).

Are there alternatives approaches to improve the testing? without this kind of
re-writing of try/catch clauses?

  Two approaches come to mind:
1. Conditionalize try/catch/throw statements on _LIBCPP_NO_EXCEPTIONS
   and do the necessary adjustments case by case. This requires more effort
   and modifies the existing tests a lot.
2. Keep the current XFAILS, add separate tests for the -fno-exceptions
   library variant. Again, this is quite an involved task.

In sum, the approach above gives us the most benefit (able to catch quite a lot
of defects in the -fno-exceptions library) with significantly less effort. Of
course, additional tests can be added that specifically test the -fno-exceptions
library variant. Such tests may use _LIBCPP_NO_EXCEPTIONS explicitly.

Aside from the tests, we have also introduced one configuration header file to
the library itself (__noexcept). This header file introduces utility functions
that can be used to simplify the -fno-exceptions code path. The following
example shows how the library handles the -fno-exceptions as of today:

if (some_bad_state()) {
 #ifndef _LIBCPP_NO_EXCEPTIONS
   throw some_exception("some message");
 #else
   // Do one of:
   //  - assert(false)
   //  - abort()
   //  - ignore
 #endif
}

Note: In the sample test fix (.../array/at.pass.cpp and include/array) attached
to this patch, an assert() is used in the -fno-exceptions code path. The use of
assert() is unsafe here as compiling with NDEBUG will get rid of them, resulting
in code that essentially ignores the erroneous state.

The test changes presented above catches such situations where abort() is not
called. The throw_helper() functions in the __noexcept header does the right
thing depending on the availability of exceptions. So the library developers can
use these helper functi

Re: [PATCH] D13357: [Concepts] Diagnose when 'concept' is specified on a specialization

2015-11-13 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast added a comment.

Comment added inline. Otherwise, LGTM.



Comment at: lib/Sema/SemaDecl.cpp:7659
@@ +7658,3 @@
+Diag(D.getDeclSpec().getConceptSpecLoc(),
+ diag::err_concept_specified_specialization) << 1;
+  }

I don't think the declaration should still be marked as a concept in this case.


http://reviews.llvm.org/D13357



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


Re: [PATCH] D14619: [PATCH] clang-tidy checker for nothrow copy constructible exception objects

2015-11-13 Thread Aaron Ballman via cfe-commits
aaron.ballman marked 4 inline comments as done.


Comment at: clang-tidy/cert/ThrownExceptionTypeCheck.cpp:18
@@ +17,3 @@
+namespace {
+AST_MATCHER(CXXConstructorDecl, isNoThrowCopyConstructible) {
+  if (!Node.isCopyConstructor())

alexfh wrote:
> nit: I suggest changing `isNoThrowCopyConstructible` to 
> `isNoThrowCopyConstructor`, because "constructible" is a trait of a class, 
> not its constructor.
Good catch; that was a holdover from the previous version where it was 
operating on the CXXRecordDecl instead.


Comment at: clang-tidy/cert/ThrownExceptionTypeCheck.cpp:22
@@ +21,3 @@
+
+  if (Node.isTrivial())
+return true;

alexfh wrote:
> Out of curiosity: are we short-circuiting here for performance reasons or 
> would the code below return `false` in this case?
I pulled the logic from the unary type trait evaluation logic, but stripped out 
the bits that were already handled by the AST matcher logic itself. I don't 
believe this is actually necessary for this checker, however.


Comment at: clang-tidy/cert/ThrownExceptionTypeCheck.cpp:34
@@ +33,3 @@
+  }
+  return true;
+}

alexfh wrote:
> Is this `return` reachable? If yes, when exactly does this happen and is 
> there a test for this case?
No, it is not reachable. There's no way, that I am aware of, to get a copy 
constructor with no function prototype.


http://reviews.llvm.org/D14619



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


Re: [PATCH] D14619: [PATCH] clang-tidy checker for nothrow copy constructible exception objects

2015-11-13 Thread Aaron Ballman via cfe-commits
aaron.ballman updated this revision to Diff 40149.
aaron.ballman marked 3 inline comments as done.
aaron.ballman added a comment.

Updated to address review comments.


http://reviews.llvm.org/D14619

Files:
  clang-tidy/cert/CERTTidyModule.cpp
  clang-tidy/cert/CMakeLists.txt
  clang-tidy/cert/ThrownExceptionTypeCheck.cpp
  clang-tidy/cert/ThrownExceptionTypeCheck.h
  docs/clang-tidy/checks/cert-thrown-exception-type.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/cert-throw-exception-type.cpp

Index: test/clang-tidy/cert-throw-exception-type.cpp
===
--- test/clang-tidy/cert-throw-exception-type.cpp
+++ test/clang-tidy/cert-throw-exception-type.cpp
@@ -0,0 +1,112 @@
+// RUN: %check_clang_tidy %s cert-err60-cpp %t -- -- -std=c++11 -fcxx-exceptions
+
+struct S {};
+struct T : S {};
+struct U {
+  U() = default;
+  U(const U&) = default;
+};
+
+struct V {
+  V() = default;
+  V(const V&) noexcept;
+};
+
+struct W {
+  W() = default;
+  W(const W&) noexcept(false);
+};
+
+struct X {
+  X() = default;
+  X(const X&) {}
+};
+
+struct Y {
+  Y() = default;
+  Y(const Y&) throw();
+};
+
+struct Z {
+  Z() = default;
+  Z(const Z&) throw(int);
+};
+
+void g() noexcept(false);
+
+struct A {
+  A() = default;
+  A(const A&) noexcept(noexcept(g()));
+};
+
+struct B {
+  B() = default;
+  B(const B&) = default;
+  B(const A&) noexcept(false);
+};
+
+class C {
+  W M; // W is not no-throw copy constructible
+public:
+  C() = default;
+  C(const C&) = default;
+};
+
+struct D {
+  D() = default;
+  D(const D&) noexcept(false);
+  D(D&) noexcept(true);
+};
+
+struct E {
+  E() = default;
+  E(E&) noexcept(true);
+  E(const E&) noexcept(false);
+};
+
+struct Allocates {
+  int *x;
+  Allocates() : x(new int(0)) {}
+  Allocates(const Allocates &other) : x(new int(*other.x)) {}
+};
+
+struct OptionallyAllocates {
+  int *x;
+  OptionallyAllocates() : x(new int(0)) {}
+  OptionallyAllocates(const Allocates &other) noexcept(true) {
+try {
+  x = new int(*other.x);
+} catch (...) {
+  x = nullptr;
+}
+  }
+};
+
+void f() {
+  throw 12; // ok
+  throw "test"; // ok
+  throw S(); // ok
+  throw T(); // ok
+  throw U(); // ok
+  throw V(); // ok
+  throw W(); // match, noexcept(false)
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible [cert-err60-cpp]
+  throw X(); // match, no noexcept clause, nontrivial
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw Y(); // ok
+  throw Z(); // match, throw(int)
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw A(); // match, noexcept(false)
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw B(); // ok
+  throw C(); // match, C has a member variable that makes it throwing on copy
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw D(); // match, has throwing copy constructor
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw E(); // match, has throwing copy constructor
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw Allocates(); // match, copy constructor throws
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: thrown exception type is not nothrow copy constructible
+  throw OptionallyAllocates(); // ok
+
+}
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -3,6 +3,7 @@
 
 .. toctree::
cert-setlongjmp
+   cert-thrown-exception-type
cert-variadic-function-def
cppcoreguidelines-pro-bounds-array-to-pointer-decay
cppcoreguidelines-pro-bounds-pointer-arithmetic
Index: docs/clang-tidy/checks/cert-thrown-exception-type.rst
===
--- docs/clang-tidy/checks/cert-thrown-exception-type.rst
+++ docs/clang-tidy/checks/cert-thrown-exception-type.rst
@@ -0,0 +1,9 @@
+cert-err60-cpp
+==
+
+This check flags all throw expressions where the exception object is not nothrow
+copy constructible.
+
+This check corresponds to the CERT C++ Coding Standard rule
+`ERR60-CPP. Exception objects must be nothrow copy constructible
+`_.
Index: clang-tidy/cert/ThrownExceptionTypeCheck.h
===
--- clang-tidy/cert/ThrownExceptionTypeCheck.h
+++ clang-tidy/cert/ThrownExceptionTypeCheck.h
@@ -0,0 +1,34 @@
+//===--- ThrownExceptionTypeCheck.h - clang-tidy-*- C++ -*-===//
+//
+// The LLVM C

Re: r253016 - scan-build: Fix install.

2015-11-13 Thread Jonathan Roelofs via cfe-commits



On 11/12/15 11:48 PM, NAKAMURA Takumi via cfe-commits wrote:

Author: chapuni
Date: Fri Nov 13 00:48:02 2015
New Revision: 253016

URL: http://llvm.org/viewvc/llvm-project?rev=253016&view=rev
Log:
scan-build: Fix install.


My bad... thanks!


Jon



Modified:
 cfe/trunk/tools/scan-build/CMakeLists.txt

Modified: cfe/trunk/tools/scan-build/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/CMakeLists.txt?rev=253016&r1=253015&r2=253016&view=diff
==
--- cfe/trunk/tools/scan-build/CMakeLists.txt (original)
+++ cfe/trunk/tools/scan-build/CMakeLists.txt Fri Nov 13 00:48:02 2015
@@ -72,7 +72,7 @@ if(CLANG_INSTALL_SCANBUILD)
   ${CMAKE_BINARY_DIR}/share/scan-view/
 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
  list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
-install(FILES ${ShareFile} DESTINATION share/scan-view)
+install(FILES share/${ShareFile} DESTINATION share/scan-view)
endforeach()

add_custom_target(scan-build ALL DEPENDS ${Depends})


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



--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253046 - Deduplicate three identical copies of isExplicitInstantiationOrSpecialization, NFC.

2015-11-13 Thread Yaron Keren via cfe-commits
Author: yrnkrn
Date: Fri Nov 13 09:39:39 2015
New Revision: 253046

URL: http://llvm.org/viewvc/llvm-project?rev=253046&view=rev
Log:
Deduplicate three identical copies of isExplicitInstantiationOrSpecialization, 
NFC.


Modified:
cfe/trunk/include/clang/AST/DeclTemplate.h
cfe/trunk/include/clang/Basic/Specifiers.h

Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=253046&r1=253045&r2=253046&view=diff
==
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Fri Nov 13 09:39:39 2015
@@ -448,17 +448,8 @@ public:
   /// explicit instantiation declaration, or explicit instantiation
   /// definition.
   bool isExplicitInstantiationOrSpecialization() const {
-switch (getTemplateSpecializationKind()) {
-case TSK_ExplicitSpecialization:
-case TSK_ExplicitInstantiationDeclaration:
-case TSK_ExplicitInstantiationDefinition:
-  return true;
-
-case TSK_Undeclared:
-case TSK_ImplicitInstantiation:
-  return false;
-}
-llvm_unreachable("bad template specialization kind");
+return isTemplateExplicitInstantiationOrSpecialization(
+getTemplateSpecializationKind());
   }
 
   /// \brief Set the template specialization kind.
@@ -1644,17 +1635,8 @@ public:
   /// explicit instantiation declaration, or explicit instantiation
   /// definition.
   bool isExplicitInstantiationOrSpecialization() const {
-switch (getTemplateSpecializationKind()) {
-case TSK_ExplicitSpecialization:
-case TSK_ExplicitInstantiationDeclaration:
-case TSK_ExplicitInstantiationDefinition:
-  return true;
-
-case TSK_Undeclared:
-case TSK_ImplicitInstantiation:
-  return false;
-}
-llvm_unreachable("bad template specialization kind");
+return isTemplateExplicitInstantiationOrSpecialization(
+getTemplateSpecializationKind());
   }
 
   void setSpecializationKind(TemplateSpecializationKind TSK) {
@@ -2499,17 +2481,8 @@ public:
   /// explicit instantiation declaration, or explicit instantiation
   /// definition.
   bool isExplicitInstantiationOrSpecialization() const {
-switch (getTemplateSpecializationKind()) {
-case TSK_ExplicitSpecialization:
-case TSK_ExplicitInstantiationDeclaration:
-case TSK_ExplicitInstantiationDefinition:
-  return true;
-
-case TSK_Undeclared:
-case TSK_ImplicitInstantiation:
-  return false;
-}
-llvm_unreachable("bad template specialization kind");
+return isTemplateExplicitInstantiationOrSpecialization(
+getTemplateSpecializationKind());
   }
 
   void setSpecializationKind(TemplateSpecializationKind TSK) {

Modified: cfe/trunk/include/clang/Basic/Specifiers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Specifiers.h?rev=253046&r1=253045&r2=253046&view=diff
==
--- cfe/trunk/include/clang/Basic/Specifiers.h (original)
+++ cfe/trunk/include/clang/Basic/Specifiers.h Fri Nov 13 09:39:39 2015
@@ -18,6 +18,7 @@
 
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/DataTypes.h"
+#include "llvm/Support/ErrorHandling.h"
 
 namespace clang {
   /// \brief Specifies the width of a type, e.g., short, long, or long long.
@@ -157,6 +158,24 @@ namespace clang {
 return Kind != TSK_Undeclared && Kind != TSK_ExplicitSpecialization;
   }
 
+  /// \brief True if this template specialization kind is an explicit
+  /// specialization, explicit instantiation declaration, or explicit
+  /// instantiation definition.
+  inline bool isTemplateExplicitInstantiationOrSpecialization(
+  TemplateSpecializationKind Kind) {
+switch (Kind) {
+case TSK_ExplicitSpecialization:
+case TSK_ExplicitInstantiationDeclaration:
+case TSK_ExplicitInstantiationDefinition:
+  return true;
+
+case TSK_Undeclared:
+case TSK_ImplicitInstantiation:
+  return false;
+}
+llvm_unreachable("bad template specialization kind");
+  }
+
   /// \brief Thread storage-class-specifier.
   enum ThreadStorageClassSpecifier {
 TSCS_unspecified,


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


Re: [PATCH] D14639: LLDB JIT needs android vector passing rules.

2015-11-13 Thread David Blaikie via cfe-commits
On Fri, Nov 13, 2015 at 2:00 AM, Aidan Dodds via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> ADodds created this revision.
> ADodds added reviewers: asl, rsmith.
> ADodds added subscribers: pirama, cfe-commits.
> ADodds set the repository for this revision to rL LLVM.
> Herald added subscribers: srhines, danalbert, tberghammer, aemerson.
>
> Looking into some recent issues with LLDBs expression parser highlighted
> that upstream clang passes vectors types differently to Android Open Source
> Project's clang for Arm Android targets.
> This patch reflects the changes present in the AOSP and allows LLDB's JIT
> expression evaluation to work correctly for Arm Android targets when
> passing vectors.
>
> This is submitted with consent of the original author Stephen Hines.
>

I forget how much it matters (I know Chandler's spoken about it
previously), but usually better to have the original author submit it, I
think. (perhaps having them chime in on the thread is as good, not sure)


>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D14639
>
> Files:
>   lib/CodeGen/TargetInfo.cpp
>

Test case?


>
> Index: lib/CodeGen/TargetInfo.cpp
> ===
> --- lib/CodeGen/TargetInfo.cpp
> +++ lib/CodeGen/TargetInfo.cpp
> @@ -4724,6 +4724,11 @@
>  }
>}
>
> +  bool isAndroid() const {
> +return (getTarget().getTriple().getEnvironment() ==
> +llvm::Triple::Android);
>

No need for the extra parens around the return expression.


> +  }
> +
>ABIKind getABIKind() const { return Kind; }
>
>  private:
> @@ -5227,15 +5232,23 @@
>
>  /// isIllegalVector - check whether Ty is an illegal vector type.
>  bool ARMABIInfo::isIllegalVectorType(QualType Ty) const {
> -  if (const VectorType *VT = Ty->getAs()) {
> -// Check whether VT is legal.
> -unsigned NumElements = VT->getNumElements();
> -uint64_t Size = getContext().getTypeSize(VT);
> -// NumElements should be power of 2.
> -if ((NumElements & (NumElements - 1)) != 0)
> -  return true;
> -// Size should be greater than 32 bits.
> -return Size <= 32;
> +  if (const VectorType *VT = Ty->getAs ()) {
> +if (isAndroid()) {
> +  // Check whether VT is legal.
> +  unsigned NumElements = VT->getNumElements();
> +  // NumElements should be power of 2 or equal to 3.
> +  if ((NumElements & (NumElements - 1)) != 0 && NumElements != 3)
> +return true;
> +} else {
> +  // Check whether VT is legal.
> +  unsigned NumElements = VT->getNumElements();
> +  uint64_t Size = getContext().getTypeSize(VT);
> +  // NumElements should be power of 2.
> +  if ((NumElements & (NumElements - 1)) != 0)
> +return true;
> +  // Size should be greater than 32 bits.
> +  return Size <= 32;
> +}
>}
>return false;
>  }
>
>
>
> ___
> 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] D14639: LLDB JIT needs android vector passing rules.

2015-11-13 Thread Stephen Hines via cfe-commits
srhines added a comment.

Aidan did ask me about upstreaming this particular (reworked) patch from our 
Android repository, so I did consent to submitting it. I can try to put 
together a test case for our particular differences.


Repository:
  rL LLVM

http://reviews.llvm.org/D14639



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


r253055 - Slacken the norecurse test slightly

2015-11-13 Thread James Molloy via cfe-commits
Author: jamesm
Date: Fri Nov 13 11:29:18 2015
New Revision: 253055

URL: http://llvm.org/viewvc/llvm-project?rev=253055&view=rev
Log:
Slacken the norecurse test slightly

It has been reported that this test currently fails on some Power buildbots due 
to them adding a "signext" function attribute.

As that's not what we're checking here, slacken off the test a bit.

Modified:
cfe/trunk/test/CodeGenCXX/main-norecurse.cpp

Modified: cfe/trunk/test/CodeGenCXX/main-norecurse.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/main-norecurse.cpp?rev=253055&r1=253054&r2=253055&view=diff
==
--- cfe/trunk/test/CodeGenCXX/main-norecurse.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/main-norecurse.cpp Fri Nov 13 11:29:18 2015
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
 
-// CHECK: define i{{.*}} @main({{.*}}) #0
+// CHECK: define {{.*}} @main({{.*}}) #0
 int main(int argc, char **argv) {
 return 1;
 }


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


[PATCH] D14662: [ARM] Pass architecture to TargetParser defaulting to cope with API change

2015-11-13 Thread Bradley Smith via cfe-commits
bsmith created this revision.
bsmith added a reviewer: rengolin.
bsmith added a subscriber: cfe-commits.
bsmith set the repository for this revision to rL LLVM.
Herald added subscribers: rengolin, aemerson.

The TargetParser API to get the default FPU and extensions will change in 
D14661, this is so it can fall back to the architecture in case of a generic 
CPU. This patch adjusts calls to the changed functions to pass in the correct 
information.

Repository:
  rL LLVM

http://reviews.llvm.org/D14662

Files:
  lib/Basic/Targets.cpp

Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -4501,13 +4501,14 @@
  const std::vector &FeaturesVec) const override {
 
 std::vector TargetFeatures;
+unsigned Arch = llvm::ARM::parseArch(getTriple().getArchName());
 
 // get default FPU features
-unsigned FPUKind = llvm::ARM::getDefaultFPU(CPU);
+unsigned FPUKind = llvm::ARM::getDefaultFPU(CPU, Arch);
 llvm::ARM::getFPUFeatures(FPUKind, TargetFeatures);
 
 // get default Extension features
-unsigned Extensions = llvm::ARM::getDefaultExtensions(CPU);
+unsigned Extensions = llvm::ARM::getDefaultExtensions(CPU, Arch);
 llvm::ARM::getExtensionFeatures(Extensions, TargetFeatures);
 
 for (const char *Feature : TargetFeatures)


Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -4501,13 +4501,14 @@
  const std::vector &FeaturesVec) const override {
 
 std::vector TargetFeatures;
+unsigned Arch = llvm::ARM::parseArch(getTriple().getArchName());
 
 // get default FPU features
-unsigned FPUKind = llvm::ARM::getDefaultFPU(CPU);
+unsigned FPUKind = llvm::ARM::getDefaultFPU(CPU, Arch);
 llvm::ARM::getFPUFeatures(FPUKind, TargetFeatures);
 
 // get default Extension features
-unsigned Extensions = llvm::ARM::getDefaultExtensions(CPU);
+unsigned Extensions = llvm::ARM::getDefaultExtensions(CPU, Arch);
 llvm::ARM::getExtensionFeatures(Extensions, TargetFeatures);
 
 for (const char *Feature : TargetFeatures)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r242121 - Add support for -fuse-ld= in the mingw toolchain driver.

2015-11-13 Thread Rafael Espíndola via cfe-commits
This needs a testcase. Nothing is checking the linker invocation.

On 14 July 2015 at 01:23, Yaron Keren  wrote:
> Author: yrnkrn
> Date: Tue Jul 14 00:23:34 2015
> New Revision: 242121
>
> URL: http://llvm.org/viewvc/llvm-project?rev=242121&view=rev
> Log:
> Add support for -fuse-ld= in the mingw toolchain driver.
> We will still default to ld until such a time lld become a
> stable release. lld supports arm NT under the machine name "thumb2pe".
>
> http://reviews.llvm.org/D11088
>
> Patch by Martell Malone
> Reviewed by Reid Kleckner
>
>
> Modified:
> cfe/trunk/lib/Driver/Tools.cpp
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=242121&r1=242120&r2=242121&view=diff
> ==
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Tue Jul 14 00:23:34 2015
> @@ -8947,6 +8947,12 @@ void MinGW::Linker::ConstructJob(Compila
>// handled somewhere else.
>Args.ClaimAllArgs(options::OPT_w);
>
> +  StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "ld");
> +  if (LinkerName.equals_lower("lld")) {
> +CmdArgs.push_back("-flavor");
> +CmdArgs.push_back("gnu");
> +  }
> +
>if (!D.SysRoot.empty())
>  CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
>
> @@ -8958,6 +8964,8 @@ void MinGW::Linker::ConstructJob(Compila
>  CmdArgs.push_back("i386pe");
>if (TC.getArch() == llvm::Triple::x86_64)
>  CmdArgs.push_back("i386pep");
> +  if (TC.getArch() == llvm::Triple::arm)
> +CmdArgs.push_back("thumb2pe");
>
>if (Args.hasArg(options::OPT_mwindows)) {
>  CmdArgs.push_back("--subsystem");
> @@ -9067,7 +9075,7 @@ void MinGW::Linker::ConstructJob(Compila
>
>if (Args.hasArg(options::OPT_static))
>  CmdArgs.push_back("--end-group");
> -  else
> +  else if (!LinkerName.equals_lower("lld"))
>  AddLibGCC(Args, CmdArgs);
>  }
>
> @@ -9078,7 +9086,7 @@ void MinGW::Linker::ConstructJob(Compila
>CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
>  }
>}
> -  const char *Exec = Args.MakeArgString(TC.GetProgramPath("ld"));
> +  const char *Exec = 
> Args.MakeArgString(TC.GetProgramPath(LinkerName.data()));
>C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs));
>  }
>
>
>
> ___
> cfe-commits mailing list
> cfe-comm...@cs.uiuc.edu
> http://lists.cs.uiuc.edu/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] D14662: [ARM] Pass architecture to TargetParser defaulting to cope with API change

2015-11-13 Thread Renato Golin via cfe-commits
rengolin accepted this revision.
rengolin added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


Repository:
  rL LLVM

http://reviews.llvm.org/D14662



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


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

2015-11-13 Thread Artem Belevich via cfe-commits
tra updated this revision to Diff 40163.
tra added a comment.

Added a FIXME note regarding figuring out which compilation pass we're 
constructing.
Undone the change to make getToolchain public as it's no longer accessed from 
outside of Driver.
Converted the if(AuxToolchain) into assert.


http://reviews.llvm.org/D13144

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

Index: test/SemaCUDA/function-target-hd.cu
===
--- test/SemaCUDA/function-target-hd.cu
+++ 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: test/Driver/cuda-options.cu
===
--- test/Driver/cuda-options.cu
+++ 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: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3264,6 +3264,23 @@
   CmdArgs.push_back("-triple");
   CmdArgs.push_back(Args.MakeArgString(TripleStr));
 
+  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 

r253060 - Fix auto-link for text-based dynamic library SDKs.

2015-11-13 Thread Juergen Ributzka via cfe-commits
Author: ributzka
Date: Fri Nov 13 13:08:07 2015
New Revision: 253060

URL: http://llvm.org/viewvc/llvm-project?rev=253060&view=rev
Log:
Fix auto-link for text-based dynamic library SDKs.

When linking against text-based dynamic library SDKs the library name of a
framework has now more than one possible filename extensions. This fix tests for
both possible extensions (none, and .tbd).

This fixes rdar://problem/20609975

Added:
cfe/trunk/test/Modules/Inputs/AutolinkTBD.framework/
cfe/trunk/test/Modules/Inputs/AutolinkTBD.framework/AutolinkTBD.tbd
cfe/trunk/test/Modules/Inputs/AutolinkTBD.framework/Headers/
cfe/trunk/test/Modules/Inputs/AutolinkTBD.framework/Headers/AutolinkTBD.h
cfe/trunk/test/Modules/autolinkTBD.m
Modified:
cfe/trunk/lib/Lex/ModuleMap.cpp

Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=253060&r1=253059&r2=253060&view=diff
==
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Fri Nov 13 13:08:07 2015
@@ -581,9 +581,18 @@ static void inferFrameworkLink(Module *M
   SmallString<128> LibName;
   LibName += FrameworkDir->getName();
   llvm::sys::path::append(LibName, Mod->Name);
-  if (FileMgr.getFile(LibName)) {
-Mod->LinkLibraries.push_back(Module::LinkLibrary(Mod->Name,
- /*IsFramework=*/true));
+
+  // The library name of a framework has more than one possible extension since
+  // the introduction of the text-based dynamic library format. We need to 
check
+  // for both before we give up.
+  static const char *frameworkExtensions[] = {"", ".tbd"};
+  for (const auto *extension : frameworkExtensions) {
+llvm::sys::path::replace_extension(LibName, extension);
+if (FileMgr.getFile(LibName)) {
+  Mod->LinkLibraries.push_back(Module::LinkLibrary(Mod->Name,
+   /*IsFramework=*/true));
+  return;
+}
   }
 }
 

Added: cfe/trunk/test/Modules/Inputs/AutolinkTBD.framework/AutolinkTBD.tbd
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/AutolinkTBD.framework/AutolinkTBD.tbd?rev=253060&view=auto
==
--- cfe/trunk/test/Modules/Inputs/AutolinkTBD.framework/AutolinkTBD.tbd (added)
+++ cfe/trunk/test/Modules/Inputs/AutolinkTBD.framework/AutolinkTBD.tbd Fri Nov 
13 13:08:07 2015
@@ -0,0 +1 @@
+empty file - clang only needs to check if it exists.

Added: cfe/trunk/test/Modules/Inputs/AutolinkTBD.framework/Headers/AutolinkTBD.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/AutolinkTBD.framework/Headers/AutolinkTBD.h?rev=253060&view=auto
==
--- cfe/trunk/test/Modules/Inputs/AutolinkTBD.framework/Headers/AutolinkTBD.h 
(added)
+++ cfe/trunk/test/Modules/Inputs/AutolinkTBD.framework/Headers/AutolinkTBD.h 
Fri Nov 13 13:08:07 2015
@@ -0,0 +1 @@
+extern int foo();

Added: cfe/trunk/test/Modules/autolinkTBD.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/autolinkTBD.m?rev=253060&view=auto
==
--- cfe/trunk/test/Modules/autolinkTBD.m (added)
+++ cfe/trunk/test/Modules/autolinkTBD.m Fri Nov 13 13:08:07 2015
@@ -0,0 +1,17 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -emit-llvm -o - -fmodules-cache-path=%t -fmodules 
-fimplicit-module-maps -F %S/Inputs %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -fno-autolink -o - -fmodules-cache-path=%t 
-fmodules -fimplicit-module-maps -F %S/Inputs %s | FileCheck 
--check-prefix=CHECK-AUTOLINK-DISABLED %s
+
+@import AutolinkTBD;
+
+int f() {
+  return foo();
+}
+
+// CHECK: !llvm.module.flags = !{{{.*}}}
+// CHECK: !{{[0-9]+}} = !{i32 6, !"Linker Options", 
![[AUTOLINK_OPTIONS:[0-9]+]]}
+// CHECK: ![[AUTOLINK_OPTIONS]] = !{![[AUTOLINK_FRAMEWORK:[0-9]+]]}
+// CHECK: ![[AUTOLINK_FRAMEWORK]] = !{!"-framework", !"AutolinkTBD"}
+
+// CHECK-AUTOLINK-DISABLED: !llvm.module.flags
+// CHECK-AUTOLINK-DISABLED-NOT: "Linker Options"


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


r253066 - Add test case for mingw -fuse-ld= support introduced in r242121.

2015-11-13 Thread Yaron Keren via cfe-commits
Author: yrnkrn
Date: Fri Nov 13 13:46:02 2015
New Revision: 253066

URL: http://llvm.org/viewvc/llvm-project?rev=253066&view=rev
Log:
Add test case for mingw -fuse-ld= support introduced in r242121.


Added:
cfe/trunk/test/Driver/mingw-useld.c

Added: cfe/trunk/test/Driver/mingw-useld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-useld.c?rev=253066&view=auto
==
--- cfe/trunk/test/Driver/mingw-useld.c (added)
+++ cfe/trunk/test/Driver/mingw-useld.c Fri Nov 13 13:46:02 2015
@@ -0,0 +1,20 @@
+// RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_LD_32 %s
+// CHECK_LD_32: {{ld|ld.exe}}"
+// CHECK_LD_32: "i386pe"
+// CHECK_LD_32_NOT: "-flavor" "gnu"
+
+// RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_32 %s
+// CHECK_LLD_32: "lld" "-flavor" "gnu"
+// CHECK_LLD_32: "i386pe"
+
+// RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=link.exe 2>&1 | 
FileCheck -check-prefix=CHECK_LINK_32 %s
+// CHECK_LINK_32: link.exe"
+// CHECK_LINK_32: "i386pe"
+
+// RUN: %clang -### -target x86_64-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_64 %s
+// CHECK_LLD_64: "lld" "-flavor" "gnu"
+// CHECK_LLD_64: "i386pep"
+
+// RUN: %clang -### -target arm-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_ARM %s
+// CHECK_LLD_ARM: "lld" "-flavor" "gnu"
+// CHECK_LLD_ARM: "thumb2pe"


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


r253068 - [scan-build] Move non user-facing utilities to share

2015-11-13 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Fri Nov 13 13:56:07 2015
New Revision: 253068

URL: http://llvm.org/viewvc/llvm-project?rev=253068&view=rev
Log:
[scan-build] Move non user-facing utilities to share

Added:
cfe/trunk/tools/scan-view/share/Reporter.py
  - copied unchanged from r253045, cfe/trunk/tools/scan-view/Reporter.py
cfe/trunk/tools/scan-view/share/ScanView.py
  - copied unchanged from r253045, cfe/trunk/tools/scan-view/ScanView.py
cfe/trunk/tools/scan-view/share/startfile.py
  - copied unchanged from r253045, cfe/trunk/tools/scan-view/startfile.py
Removed:
cfe/trunk/tools/scan-view/Reporter.py
cfe/trunk/tools/scan-view/ScanView.py
cfe/trunk/tools/scan-view/startfile.py
Modified:
cfe/trunk/tools/scan-build/CMakeLists.txt
cfe/trunk/tools/scan-build/scan-build
cfe/trunk/tools/scan-view/CMakeLists.txt
cfe/trunk/tools/scan-view/Makefile
cfe/trunk/tools/scan-view/scan-view

Modified: cfe/trunk/tools/scan-build/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/CMakeLists.txt?rev=253068&r1=253067&r2=253068&view=diff
==
--- cfe/trunk/tools/scan-build/CMakeLists.txt (original)
+++ cfe/trunk/tools/scan-build/CMakeLists.txt Fri Nov 13 13:56:07 2015
@@ -64,15 +64,15 @@ if(CLANG_INSTALL_SCANBUILD)
   endforeach()
 
   foreach(ShareFile ${ShareFiles})
-add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile}
+add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile}
COMMAND ${CMAKE_COMMAND} -E make_directory
- ${CMAKE_BINARY_DIR}/share/scan-view
+ ${CMAKE_BINARY_DIR}/share/scan-build
COMMAND ${CMAKE_COMMAND} -E copy
  ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile}
- ${CMAKE_BINARY_DIR}/share/scan-view/
+ ${CMAKE_BINARY_DIR}/share/scan-build/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
-list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
-install(FILES share/${ShareFile} DESTINATION share/scan-view)
+list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile})
+install(FILES share/${ShareFile} DESTINATION share/scan-build)
   endforeach()
 
   add_custom_target(scan-build ALL DEPENDS ${Depends})

Modified: cfe/trunk/tools/scan-build/scan-build
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/scan-build?rev=253068&r1=253067&r2=253068&view=diff
==
--- cfe/trunk/tools/scan-build/scan-build (original)
+++ cfe/trunk/tools/scan-build/scan-build Fri Nov 13 13:56:07 2015
@@ -462,7 +462,7 @@ sub CopyFiles {
 
   my $Dir = shift;
 
-  my $JS = Cwd::realpath("$RealBin/sorttable.js");
+  my $JS = Cwd::realpath("$RealBin/../share/scan-build/sorttable.js");
 
   DieDiag("Cannot find 'sorttable.js'.\n")
 if (! -r $JS);
@@ -472,7 +472,7 @@ sub CopyFiles {
   DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n")
 if (! -r "$Dir/sorttable.js");
 
-  my $CSS = Cwd::realpath("$RealBin/scanview.css");
+  my $CSS = Cwd::realpath("$RealBin/../share/scan-build/scanview.css");
 
   DieDiag("Cannot find 'scanview.css'.\n")
 if (! -r $CSS);

Modified: cfe/trunk/tools/scan-view/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/CMakeLists.txt?rev=253068&r1=253067&r2=253068&view=diff
==
--- cfe/trunk/tools/scan-view/CMakeLists.txt (original)
+++ cfe/trunk/tools/scan-view/CMakeLists.txt Fri Nov 13 13:56:07 2015
@@ -1,12 +1,12 @@
 option(CLANG_INSTALL_SCANVIEW "Install the scan-view tool" ON)
 
 set(BinFiles
-  Reporter.py
-  ScanView.py
-  scan-view
-  startfile.py)
+  scan-view)
 
 set(ShareFiles
+  ScanView.py
+  Reporter.py
+  startfile.py
   FileRadar.scpt
   GetRadarVersion.scpt
   bugcatcher.ico)

Modified: cfe/trunk/tools/scan-view/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/Makefile?rev=253068&r1=253067&r2=253068&view=diff
==
--- cfe/trunk/tools/scan-view/Makefile (original)
+++ cfe/trunk/tools/scan-view/Makefile Fri Nov 13 13:56:07 2015
@@ -15,10 +15,10 @@ include $(CLANG_LEVEL)/Makefile
 CLANG_INSTALL_SCANVIEW ?= 1
 
 ifeq ($(CLANG_INSTALL_SCANVIEW), 1)
-  InstallTargets := $(ToolDir)/Reporter.py \
-$(ToolDir)/ScanView.py \
-$(ToolDir)/scan-view \
-$(ToolDir)/startfile.py \
+  InstallTargets := $(ToolDir)/scan-view \
+$(ShareDir)/scan-view/Reporter.py \
+$(ShareDir)/scan-view/ScanView.py \
+$(ShareDir)/scan-view/star

r253069 - Relax mingw-useld test to fix bot failures.

2015-11-13 Thread Yaron Keren via cfe-commits
Author: yrnkrn
Date: Fri Nov 13 14:02:08 2015
New Revision: 253069

URL: http://llvm.org/viewvc/llvm-project?rev=253069&view=rev
Log:
Relax mingw-useld test to fix bot failures.


Modified:
cfe/trunk/test/Driver/mingw-useld.c

Modified: cfe/trunk/test/Driver/mingw-useld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-useld.c?rev=253069&r1=253068&r2=253069&view=diff
==
--- cfe/trunk/test/Driver/mingw-useld.c (original)
+++ cfe/trunk/test/Driver/mingw-useld.c Fri Nov 13 14:02:08 2015
@@ -4,7 +4,7 @@
 // CHECK_LD_32_NOT: "-flavor" "gnu"
 
 // RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_32 %s
-// CHECK_LLD_32: "lld" "-flavor" "gnu"
+// CHECK_LLD_32: lld" "-flavor" "gnu"
 // CHECK_LLD_32: "i386pe"
 
 // RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=link.exe 2>&1 | 
FileCheck -check-prefix=CHECK_LINK_32 %s
@@ -12,9 +12,9 @@
 // CHECK_LINK_32: "i386pe"
 
 // RUN: %clang -### -target x86_64-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_64 %s
-// CHECK_LLD_64: "lld" "-flavor" "gnu"
+// CHECK_LLD_64: lld" "-flavor" "gnu"
 // CHECK_LLD_64: "i386pep"
 
 // RUN: %clang -### -target arm-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_ARM %s
-// CHECK_LLD_ARM: "lld" "-flavor" "gnu"
+// CHECK_LLD_ARM: lld" "-flavor" "gnu"
 // CHECK_LLD_ARM: "thumb2pe"


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


Re: r242121 - Add support for -fuse-ld= in the mingw toolchain driver.

2015-11-13 Thread Yaron Keren via cfe-commits
Sure, r253066.


2015-11-13 19:40 GMT+02:00 Rafael Espíndola :

> This needs a testcase. Nothing is checking the linker invocation.
>
> On 14 July 2015 at 01:23, Yaron Keren  wrote:
> > Author: yrnkrn
> > Date: Tue Jul 14 00:23:34 2015
> > New Revision: 242121
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=242121&view=rev
> > Log:
> > Add support for -fuse-ld= in the mingw toolchain driver.
> > We will still default to ld until such a time lld become a
> > stable release. lld supports arm NT under the machine name "thumb2pe".
> >
> > http://reviews.llvm.org/D11088
> >
> > Patch by Martell Malone
> > Reviewed by Reid Kleckner
> >
> >
> > Modified:
> > cfe/trunk/lib/Driver/Tools.cpp
> >
> > Modified: cfe/trunk/lib/Driver/Tools.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=242121&r1=242120&r2=242121&view=diff
> >
> ==
> > --- cfe/trunk/lib/Driver/Tools.cpp (original)
> > +++ cfe/trunk/lib/Driver/Tools.cpp Tue Jul 14 00:23:34 2015
> > @@ -8947,6 +8947,12 @@ void MinGW::Linker::ConstructJob(Compila
> >// handled somewhere else.
> >Args.ClaimAllArgs(options::OPT_w);
> >
> > +  StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ,
> "ld");
> > +  if (LinkerName.equals_lower("lld")) {
> > +CmdArgs.push_back("-flavor");
> > +CmdArgs.push_back("gnu");
> > +  }
> > +
> >if (!D.SysRoot.empty())
> >  CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
> >
> > @@ -8958,6 +8964,8 @@ void MinGW::Linker::ConstructJob(Compila
> >  CmdArgs.push_back("i386pe");
> >if (TC.getArch() == llvm::Triple::x86_64)
> >  CmdArgs.push_back("i386pep");
> > +  if (TC.getArch() == llvm::Triple::arm)
> > +CmdArgs.push_back("thumb2pe");
> >
> >if (Args.hasArg(options::OPT_mwindows)) {
> >  CmdArgs.push_back("--subsystem");
> > @@ -9067,7 +9075,7 @@ void MinGW::Linker::ConstructJob(Compila
> >
> >if (Args.hasArg(options::OPT_static))
> >  CmdArgs.push_back("--end-group");
> > -  else
> > +  else if (!LinkerName.equals_lower("lld"))
> >  AddLibGCC(Args, CmdArgs);
> >  }
> >
> > @@ -9078,7 +9086,7 @@ void MinGW::Linker::ConstructJob(Compila
> >CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
> >  }
> >}
> > -  const char *Exec = Args.MakeArgString(TC.GetProgramPath("ld"));
> > +  const char *Exec =
> Args.MakeArgString(TC.GetProgramPath(LinkerName.data()));
> >C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs));
> >  }
> >
> >
> >
> > ___
> > cfe-commits mailing list
> > cfe-comm...@cs.uiuc.edu
> > http://lists.cs.uiuc.edu/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] D13357: [Concepts] Diagnose when 'concept' is specified on a specialization

2015-11-13 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

Aside from one question, LGTM.

~Aaron



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2003
@@ +2002,3 @@
+def err_concept_specified_specialization : Error<
+  "%'concept' cannot be applied on an "
+  "%select{explicit instantiation|explicit specialization|partial 
specialization}0">;

Is this an extraneous %?


http://reviews.llvm.org/D13357



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


r253081 - Fix build... again

2015-11-13 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Fri Nov 13 15:04:14 2015
New Revision: 253081

URL: http://llvm.org/viewvc/llvm-project?rev=253081&view=rev
Log:
Fix build... again

Modified:
cfe/trunk/tools/scan-build/Makefile

Modified: cfe/trunk/tools/scan-build/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/Makefile?rev=253081&r1=253080&r2=253081&view=diff
==
--- cfe/trunk/tools/scan-build/Makefile (original)
+++ cfe/trunk/tools/scan-build/Makefile Fri Nov 13 15:04:14 2015
@@ -47,7 +47,7 @@ $(ShareDir)/man/man1/%: man/% Makefile $
$(Echo) "Copying $(notdir $<) to the 'man' directory..."
$(Verb)cp $< $@
 
-$(ShareDir)/scan-build/%: share/% Makefile $(ShareDir)/scan-build/.dir
+$(ShareDir)/scan-build/%: share/scan-build/% Makefile 
$(ShareDir)/scan-build/.dir
$(Echo) "Copying $(notdir $<) to the 'share' directory..."
$(Verb)cp $< $@
 


___
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-13 Thread Kelvin Li via cfe-commits
kkwli0 updated this revision to Diff 40176.
kkwli0 added a comment.

Update the patch after the first review.


http://reviews.llvm.org/D14134

Files:
  include/clang/AST/DataRecursiveASTVisitor.h
  include/clang/AST/OpenMPClause.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/OpenMPKinds.def
  include/clang/Basic/OpenMPKinds.h
  include/clang/Sema/Sema.h
  lib/AST/OpenMPClause.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/Basic/OpenMPKinds.cpp
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/Parse/ParseOpenMP.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  test/OpenMP/target_ast_print.cpp
  test/OpenMP/target_data_ast_print.cpp
  test/OpenMP/target_map_messages.cpp
  tools/libclang/CIndex.cpp

Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -2171,6 +2171,9 @@
 void OMPClauseEnqueue::VisitOMPDependClause(const OMPDependClause *C) {
   VisitOMPClauseList(C);
 }
+void OMPClauseEnqueue::VisitOMPMapClause(const OMPMapClause *C) {
+  VisitOMPClauseList(C);
+}
 }
 
 void EnqueueVisitor::EnqueueChildren(const OMPClause *S) {
Index: test/OpenMP/target_map_messages.cpp
===
--- /dev/null
+++ test/OpenMP/target_map_messages.cpp
@@ -0,0 +1,119 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+
+void foo() {
+}
+
+bool foobool(int argc) {
+  return argc;
+}
+
+struct S1; // expected-note {{declared here}}
+extern S1 a;
+class S2 {
+  mutable int a;
+public:
+  S2():a(0) { }
+  S2(S2 &s2):a(s2.a) { }
+  static float S2s; // expected-note 2 {{mappable type cannot contain static members}}
+  static const float S2sc; // expected-note 2 {{mappable type cannot contain static members}}
+};
+const float S2::S2sc = 0;
+const S2 b;
+const S2 ba[5];
+class S3 {
+  int a;
+public:
+  S3():a(0) { }
+  S3(S3 &s3):a(s3.a) { }
+};
+const S3 c;
+const S3 ca[5];
+extern const int f;
+class S4 {
+  int a;
+  S4();
+  S4(const S4 &s4);
+public:
+  S4(int v):a(v) { }
+};
+class S5 {
+  int a;
+  S5():a(0) {}
+  S5(const S5 &s5):a(s5.a) { }
+public:
+  S5(int v):a(v) { }
+};
+
+S3 h;
+#pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
+
+int main(int argc, char **argv) {
+  const int d = 5;
+  const int da[5] = { 0 };
+  S4 e(4);
+  S5 g(5);
+  int i;
+  int &j = i;
+  int *k = &j;
+  int x;
+  int y;
+  int to, tofrom, always;
+  const int (&l)[5] = da;
+  #pragma omp target map // expected-error {{expected '(' after 'map'}}
+  #pragma omp target map ( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
+  #pragma omp target map () // expected-error {{expected expression}}
+  #pragma omp target map (alloc) // expected-error {{use of undeclared identifier 'alloc'}}
+  #pragma omp target map (to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}}
+  #pragma omp target map (to:) // expected-error {{expected expression}}
+  #pragma omp target map (from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+  #pragma omp target map (x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
+  #pragma omp target map (x)
+  foo();
+  #pragma omp target map (to: x)
+  foo();
+  #pragma omp target map (to: to)
+  foo();
+  #pragma omp target map (to)
+  foo();
+  #pragma omp target map (to, x)
+  foo();
+  #pragma omp target map (to x) // expected-error {{expected ',' or ')' in 'map' clause}}
+  #pragma omp target map (tofrom: argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name, array element or array section}}
+  #pragma omp target map (argc)
+  #pragma omp target map (S1) // expected-error {{'S1' does not refer to a value}}
+  #pragma omp target map (a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
+  #pragma omp target map (argv[1])
+  #pragma omp target map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
+  #pragma omp target map(ca)
+  #pragma omp target map(da)
+  #pragma omp target map(S2::S2s)
+  #pragma omp target map(S2::S2sc)
+  #pragma omp target map(e, g)
+  #pragma omp target map(h) // expected-error {{threadprivate variables are not allowed in map clause}}
+  #pragma omp target map(k), map(k) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}}
+  #pragma omp target map(k), map(k[:5]) // expected-error {{variable already marked as mapped in current construct}} expecte

r253099 - [CMake] Don't install c-index-test when LLVM_INSTALL_TOOLCHAIN_ONLY=ON.

2015-11-13 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Fri Nov 13 16:41:14 2015
New Revision: 253099

URL: http://llvm.org/viewvc/llvm-project?rev=253099&view=rev
Log:
[CMake] Don't install c-index-test when LLVM_INSTALL_TOOLCHAIN_ONLY=ON.

Modified:
cfe/trunk/tools/c-index-test/CMakeLists.txt

Modified: cfe/trunk/tools/c-index-test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/CMakeLists.txt?rev=253099&r1=253098&r2=253099&view=diff
==
--- cfe/trunk/tools/c-index-test/CMakeLists.txt (original)
+++ cfe/trunk/tools/c-index-test/CMakeLists.txt Fri Nov 13 16:41:14 2015
@@ -29,20 +29,22 @@ if (CLANG_HAVE_LIBXML)
   target_link_libraries(c-index-test ${LIBXML2_LIBRARIES})
 endif()
 
-if(INTERNAL_INSTALL_PREFIX)
-  set(INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/bin")
-else()
-  set(INSTALL_DESTINATION bin)
-endif()
+if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+  if(INTERNAL_INSTALL_PREFIX)
+set(INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/bin")
+  else()
+set(INSTALL_DESTINATION bin)
+  endif()
 
-install(TARGETS c-index-test
-  RUNTIME DESTINATION "${INSTALL_DESTINATION}"
-  COMPONENT c-index-test)
+  install(TARGETS c-index-test
+RUNTIME DESTINATION "${INSTALL_DESTINATION}"
+COMPONENT c-index-test)
 
-if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
-  add_custom_target(install-c-index-test
-DEPENDS c-index-test
-COMMAND "${CMAKE_COMMAND}"
--DCMAKE_INSTALL_COMPONENT=c-index-test
--P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+  if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
+add_custom_target(install-c-index-test
+  DEPENDS c-index-test
+  COMMAND "${CMAKE_COMMAND}"
+  -DCMAKE_INSTALL_COMPONENT=c-index-test
+  -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+  endif()
 endif()


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


r253104 - Revert "[AArch64] Unconditionally pass subtarget feature reserve-x18 on Darwin."

2015-11-13 Thread Justin Bogner via cfe-commits
Author: bogner
Date: Fri Nov 13 17:07:31 2015
New Revision: 253104

URL: http://llvm.org/viewvc/llvm-project?rev=253104&view=rev
Log:
Revert "[AArch64] Unconditionally pass subtarget feature reserve-x18 on Darwin."

This reverts r243310, which is redundant as of r253102.

Conflicts:
lib/Driver/Tools.cpp

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/aarch64-fixed-x18.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253104&r1=253103&r2=253104&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Nov 13 17:07:31 2015
@@ -2091,9 +2091,7 @@ getAArch64MicroArchFeaturesFromMcpu(cons
   return getAArch64MicroArchFeaturesFromMtune(D, CPU, Args, Features);
 }
 
-static void getAArch64TargetFeatures(const Driver &D,
- const llvm::Triple &Triple,
- const ArgList &Args,
+static void getAArch64TargetFeatures(const Driver &D, const ArgList &Args,
  std::vector &Features) {
   Arg *A;
   bool success = true;
@@ -2139,7 +2137,7 @@ static void getAArch64TargetFeatures(con
 if (A->getOption().matches(options::OPT_mno_unaligned_access))
   Features.push_back("+strict-align");
 
-  if (Args.hasArg(options::OPT_ffixed_x18) || Triple.isOSDarwin())
+  if (Args.hasArg(options::OPT_ffixed_x18))
 Features.push_back("+reserve-x18");
 }
 
@@ -2193,7 +2191,7 @@ static void getTargetFeatures(const Tool
 break;
   case llvm::Triple::aarch64:
   case llvm::Triple::aarch64_be:
-getAArch64TargetFeatures(D, Triple, Args, Features);
+getAArch64TargetFeatures(D, Args, Features);
 break;
   case llvm::Triple::x86:
   case llvm::Triple::x86_64:

Modified: cfe/trunk/test/Driver/aarch64-fixed-x18.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/aarch64-fixed-x18.c?rev=253104&r1=253103&r2=253104&view=diff
==
--- cfe/trunk/test/Driver/aarch64-fixed-x18.c (original)
+++ cfe/trunk/test/Driver/aarch64-fixed-x18.c Fri Nov 13 17:07:31 2015
@@ -1,9 +1,4 @@
 // RUN: %clang -target aarch64-none-gnu -ffixed-x18 -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-FIXED-X18 < %t %s
-// RUN: %clang -target aarch64-none-gnu -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-NO-FIXED-X18 < %t %s
-// RUN: %clang -target -arm64-apple-ios -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-FIXED-X18 < %t %s
 
 // CHECK-FIXED-X18: "-target-feature" "+reserve-x18"
-// CHECK-NO-FIXED-X18-NOT: "-target-feature" "+reserve-x18"


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


Re: [PATCH] D13834: Produce a better diagnostic for global register variables

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

LGTM.

Thanks!

-eric


http://reviews.llvm.org/D13834



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


Re: [PATCH] Allow "redefinition" of typedef of anon tag from unimported submodule

2015-11-13 Thread Ben Langmuir via cfe-commits
This time sending to the right list address.

> On Nov 13, 2015, at 4:00 PM, Ben Langmuir  wrote:
> 
> Hey Richard,
> 
> After your commit r233345 we started diagnosing “redefinition” errors for 
> typedefs of anonymous tags that are *not visible* in case like this:
> 
> module that isn’t imported:
>   typedef struct { … } Foo_t;
> source file:
>   typedef struct { … } Foo_t;
> 
> I think the only change needed is to not consider these anonymous tags to be 
> the same entity unless we’re in C++.  Patch attached.
> 


redef-typedef.patch
Description: Binary data
> 
> 
> 
> Ben

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


Re: [PATCH] Allow "redefinition" of typedef of anon tag from unimported submodule

2015-11-13 Thread Richard Smith via cfe-commits
On Fri, Nov 13, 2015 at 4:03 PM, Ben Langmuir via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> This time sending to the right list address.


Likewise =)

> On Nov 13, 2015, at 4:00 PM, Ben Langmuir  wrote:
> >
> > Hey Richard,
> >
> > After your commit r233345 we started diagnosing “redefinition” errors
> for typedefs of anonymous tags that are *not visible* in case like this:
> >
> > module that isn’t imported:
> >   typedef struct { … } Foo_t;
> > source file:
> >   typedef struct { … } Foo_t;
> >
> > I think the only change needed is to not consider these anonymous tags
> to be the same entity unless we’re in C++.  Patch attached.
>

Looks fine. Do we also miscompute the linkage for these things in C (where
types don't really have linkage), or is this just a problem because we bail
out before we hit the isExternallyVisible check?
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13263: Addition of __attribute__((pass_object_size)) to Clang

2015-11-13 Thread George Burgess IV via cfe-commits
george.burgess.iv added inline comments.


Comment at: include/clang/AST/Expr.h:631-634
@@ -630,1 +630,6 @@
 
+  /// tryEvaluateObjectSize - If the current Expr is a pointer, this will try 
to
+  /// statically determine how many bytes remain in the object this pointer is
+  /// pointing to.
+  bool tryEvaluateObjectSize(llvm::APSInt &Result, ASTContext &Ctx,
+ unsigned Type) const;

rsmith wrote:
> ... and what if the current expression isn't a pointer? Is that a 
> precondition (function might assert / crash) or does it result in 'return 
> false'?
> 
> Also, don't use `"/// FunctionName - [...]"` in new code, use `"/// \brief 
> [...]"` instead.
> ... and what if the current expression isn't a pointer? Is that a 
> precondition (function might assert / crash) or does it result in 'return 
> false'?

Fixed-ish. Do you think the new comment is sufficient, or would you like to see 
each parameter documented for consistency?

> Also, don't use "/// FunctionName - [...]" in new code, use "/// \brief 
> [...]" instead

Thanks!


Comment at: include/clang/AST/Type.h:3110-3112
@@ -3106,2 +3109,5 @@
 
+  /// Whether this function has pass_object_size attribute(s) on its parameters
+  unsigned HasPassObjectSizeParams : 1;
+
   // ParamInfo - There is an variable size array after the class in memory that

rsmith wrote:
> Seems nicer to put this right after `HasAnyConsumedParams`. (I'm also 
> surprised to find that we have a spare bit here...)
No longer an issue. (I was too.)


Comment at: include/clang/AST/Type.h:3131-3134
@@ -3124,3 +3130,6 @@
 
-  friend class ASTContext;  // ASTContext creates these.
+  // PassObjectSizeParams - A variable size array, following ConsumedParameters
+  // and of length NumParams, holding flags indicating which parameters have 
the
+  // pass_object_size attribute. This only appears if HasPassObjectSizeParams 
is
+  // true.
 

rsmith wrote:
> Do we really want just flags here rather than the `type` value? Should `int 
> (void * __attribute__((pass_object_size(1` and `int (void 
> *__attribute((pass_object_size(2` be the same type?
No longer an issue


Comment at: include/clang/Basic/AttrDocs.td:354-365
@@ +353,14 @@
+
+* Because the size is passed at runtime, ``CallFoo`` below will always call
+  A:
+
+  .. code-block:: c++
+
+int Foo(int n) __attribute__((enable_if(n > 0, ""))); // function A
+int Foo(int n) __attribute__((enable_if(n <= 0, ""))); // function B
+int CallFoo(const void *p __attribute__((pass_object_size(0
+__attribute__((noinline)) {
+  return Foo(__builtin_object_size(p, 0));
+}
+  }];
+}

rsmith wrote:
> I would expect this to result in an error: neither A nor B is viable because 
> their conditions are non-constant.
I agree; I have no clue why I thought this was sane. ¯\_(ツ)_/¯


Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2068
@@ -2064,1 +2067,3 @@
 def err_attribute_pointers_only : Error;
+def err_attribute_constant_pointers_only : Error<
+  "%0 attribute only applies to constant pointer arguments">;

aaron.ballman wrote:
> Instead of making a new diagnostic, I think it better to modify 
> warn_attribute_pointers_only to use a %select statement (then 
> err_attribute_pointers_only also gets updated). I would separate that into a 
> prequel patch since it's likely to introduce a fair amount of unrelated 
> changes to this patch.
There were only four small distinct changes, so I just rolled it all into this 
patch; I'm happy to pull it out into its own if we feel like that's a bit too 
much clutter.


Comment at: lib/AST/ExprConstant.cpp:6505-6507
@@ -6504,5 +6545,3 @@
 // handle all cases where the expression has side-effects.
-// Likewise, if Type is 3, we must handle this because CodeGen cannot give 
a
-// conservatively correct answer in that case.
-if (E->getArg(0)->HasSideEffects(Info.Ctx) || Type == 3)
   return Success((Type & 2) ? 0 : -1, E);

rsmith wrote:
> Where is the handling for `Type == 3` now?
It was moved to CodeGenFunction::emitBuiltinSizeOf. I feel it fits better there 
because it's more of an implementation detail of @llvm.objectsize; I'm happy to 
move the check back here if you disagree.


Comment at: lib/AST/ExprConstant.cpp:9523
@@ +9522,3 @@
+  if (!getType()->isPointerType() &&
+  !getType()->canDecayToPointerType())
+return false;

rsmith wrote:
> I don't see where you handle types that decay to pointers (in particular, for 
> the case where the expression has array type).
Do you have recommendations for how to test that? Code like


```
int fn(void *__attribute__((pass_object_size(0;
int a[5];
int r = fn(a);
```

Generates an implicit Array->Pointer decay on `a` in `fn(a)`, which is handled 
fine; so, A

Re: [PATCH] D13263: Addition of __attribute__((pass_object_size)) to Clang

2015-11-13 Thread George Burgess IV via cfe-commits
george.burgess.iv updated this revision to Diff 40185.
george.burgess.iv marked 22 inline comments as done.
george.burgess.iv added a comment.

- Removed pass_object_size-related information from FunctionType
- Unified enable_if/pass_object_size error handling when the address of a 
function with enable_if/pass_object_size is taken (this fixes bugs in enable_if 
and simplifies code in a number of places; will add enable_if-related tests in 
a followup patch, because this one is large enough as-is).
- Added more tests
- Otherwise addressed all comments

Thanks for all of the feedback! :)


http://reviews.llvm.org/D13263

Files:
  include/clang/AST/Expr.h
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/CodeGen/CodeGenABITypes.h
  include/clang/Sema/Initialization.h
  include/clang/Sema/Sema.h
  include/clang/Sema/TemplateDeduction.h
  lib/AST/ExprConstant.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/MicrosoftMangle.cpp
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CGCXXABI.cpp
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CodeGenABITypes.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenTypes.cpp
  lib/CodeGen/CodeGenTypes.h
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/CodeGen/MicrosoftCXXABI.cpp
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaInit.cpp
  lib/Sema/SemaLambda.cpp
  lib/Sema/SemaOverload.cpp
  lib/Sema/SemaTemplate.cpp
  lib/Sema/SemaType.cpp
  test/CodeGen/pass-object-size.c
  test/CodeGenCXX/pass-object-size.cpp
  test/Sema/pass-object-size.c
  test/SemaCXX/init-priority-attr.cpp
  test/SemaCXX/pass-object-size.cpp

Index: test/SemaCXX/pass-object-size.cpp
===
--- /dev/null
+++ test/SemaCXX/pass-object-size.cpp
@@ -0,0 +1,122 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
+
+namespace simple {
+int Foo(void *const p __attribute__((pass_object_size(0;
+
+int OvlFoo(void *const p __attribute__((pass_object_size(0;
+int OvlFoo(void *const p, int);
+
+struct Statics {
+  static int Foo(void *const p __attribute__((pass_object_size(0;
+  static int OvlFoo(void *const p __attribute__((pass_object_size(0;
+  static int OvlFoo(void *const p __attribute__((pass_object_size(1; // expected-error{{conflicting pass_object_size attributes on parameters}} expected-note@-1{{previous declaration is here}}
+  static int OvlFoo(double *p);
+};
+
+struct Members {
+  int Foo(void *const p __attribute__((pass_object_size(0;
+  int OvlFoo(void *const p __attribute__((pass_object_size(0;
+  int OvlFoo(void *const p, int);
+};
+
+void Decls() {
+  int (*A)(void *) = &Foo; //expected-error{{cannot take address of function 'Foo' because parameter 1 has pass_object_size attribute}}
+  int (*B)(void *) = Foo; //expected-error{{cannot take address of function 'Foo' because parameter 1 has pass_object_size attribute}}
+
+  int (*C)(void *) = &OvlFoo; //expected-error{{address of overloaded function 'OvlFoo' does not match required type 'int (void *)'}} expected-note@6{{candidate address cannot be taken because parameter 1 has pass_object_size attribute}} expected-note@7{{candidate function has different number of parameters (expected 1 but has 2)}}
+  int (*D)(void *) = OvlFoo; //expected-error{{address of overloaded function 'OvlFoo' does not match required type 'int (void *)'}} expected-note@6{{candidate address cannot be taken because parameter 1 has pass_object_size attribute}} expected-note@7{{candidate function has different number of parameters (expected 1 but has 2)}}
+
+  int (*E)(void *) = &Statics::Foo; //expected-error{{cannot take address of function 'Foo' because parameter 1 has pass_object_size attribute}}
+  int (*F)(void *) = &Statics::OvlFoo; //expected-error{{address of overloaded function 'OvlFoo' does not match required type 'int (void *)'}} expected-note@11{{candidate address cannot be taken because parameter 1 has pass_object_size attribute}} expected-note@13{{candidate function has type mismatch at 1st parameter (expected 'void *' but has 'double *')}}
+
+  int (*G)(void *) = &Members::Foo; //expected-error{{cannot take address of function 'Foo' because parameter 1 has pass_object_size attribute}}
+  int (*H)(void *) = &Members::OvlFoo; //expected-error{{address of overloaded function 'OvlFoo' does not match required type 'int (void *)'}} expected-note@18{{candidate address cannot be taken because parameter 1 has pass_object_size attribute}} expected-note@19{{candidate function has different number of parameters (expected 1 but has 2)}}
+}
+
+void Assigns() {
+  int (*A)(void *);
+  A = &Foo; //expected-error{{cannot take address of function 'Foo' because parameter 1 has pass_object_size attribute}}
+  A = Foo; //expected-error{{cannot take address of function 'Foo' because parameter 1 has pass_objec

Re: [PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-11-13 Thread Matthias Gehre via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253107: CFG: Delay creating Dtors for CompoundStmts which 
end in ReturnStmt (authored by mgehre).

Changed prior to commit:
  http://reviews.llvm.org/D13973?vs=38359&id=40188#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13973

Files:
  cfe/trunk/lib/Analysis/CFG.cpp
  cfe/trunk/test/Analysis/no-unreachable-dtors.cpp

Index: cfe/trunk/lib/Analysis/CFG.cpp
===
--- cfe/trunk/lib/Analysis/CFG.cpp
+++ cfe/trunk/lib/Analysis/CFG.cpp
@@ -1942,7 +1942,15 @@
 
 
 CFGBlock *CFGBuilder::VisitCompoundStmt(CompoundStmt *C) {
-  addLocalScopeAndDtors(C);
+  LocalScope::const_iterator scopeBeginPos = ScopePos;
+  if (BuildOpts.AddImplicitDtors) {
+addLocalScopeForStmt(C);
+  }
+  if (!C->body_empty() && !isa(*C->body_rbegin())) {
+// If the body ends with a ReturnStmt, the dtors will be added in 
VisitReturnStmt
+addAutomaticObjDtors(ScopePos, scopeBeginPos, C);
+  }
+
   CFGBlock *LastBlock = Block;
 
   for (CompoundStmt::reverse_body_iterator I=C->body_rbegin(), 
E=C->body_rend();
Index: cfe/trunk/test/Analysis/no-unreachable-dtors.cpp
===
--- cfe/trunk/test/Analysis/no-unreachable-dtors.cpp
+++ cfe/trunk/test/Analysis/no-unreachable-dtors.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=debug.Stats -verify 
-Wno-unreachable-code %s
+
+struct S {
+  ~S();
+};
+
+// the return at the end of an CompoundStmt does not lead to an unreachable 
block containing the dtors
+void test() { // expected-warning-re{{test -> Total CFGBlocks: {{[0-9]+}} | 
Unreachable CFGBlocks: 0 | Exhausted Block: no | Empty WorkList: yes}}
+  S s;
+  return;
+}


Index: cfe/trunk/lib/Analysis/CFG.cpp
===
--- cfe/trunk/lib/Analysis/CFG.cpp
+++ cfe/trunk/lib/Analysis/CFG.cpp
@@ -1942,7 +1942,15 @@
 
 
 CFGBlock *CFGBuilder::VisitCompoundStmt(CompoundStmt *C) {
-  addLocalScopeAndDtors(C);
+  LocalScope::const_iterator scopeBeginPos = ScopePos;
+  if (BuildOpts.AddImplicitDtors) {
+addLocalScopeForStmt(C);
+  }
+  if (!C->body_empty() && !isa(*C->body_rbegin())) {
+// If the body ends with a ReturnStmt, the dtors will be added in VisitReturnStmt
+addAutomaticObjDtors(ScopePos, scopeBeginPos, C);
+  }
+
   CFGBlock *LastBlock = Block;
 
   for (CompoundStmt::reverse_body_iterator I=C->body_rbegin(), E=C->body_rend();
Index: cfe/trunk/test/Analysis/no-unreachable-dtors.cpp
===
--- cfe/trunk/test/Analysis/no-unreachable-dtors.cpp
+++ cfe/trunk/test/Analysis/no-unreachable-dtors.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=debug.Stats -verify -Wno-unreachable-code %s
+
+struct S {
+  ~S();
+};
+
+// the return at the end of an CompoundStmt does not lead to an unreachable block containing the dtors
+void test() { // expected-warning-re{{test -> Total CFGBlocks: {{[0-9]+}} | Unreachable CFGBlocks: 0 | Exhausted Block: no | Empty WorkList: yes}}
+  S s;
+  return;
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253107 - CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-11-13 Thread Matthias Gehre via cfe-commits
Author: mgehre
Date: Fri Nov 13 18:36:50 2015
New Revision: 253107

URL: http://llvm.org/viewvc/llvm-project?rev=253107&view=rev
Log:
CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

Summary:
VisitReturnStmt would create a new block with including Dtors, so the Dtors 
created
in VisitCompoundStmts would be in an unreachable block.

Example:

struct S {
  ~S();
};

void f()
{
  S s;
  return;
}

void g()
{
  S s;
}

Before this patch, f has one additional unreachable block containing just the
destructor of S. With this patch, both f and g have the same blocks.

Reviewers: krememek

Subscribers: cfe-commits

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

Added:
cfe/trunk/test/Analysis/no-unreachable-dtors.cpp
Modified:
cfe/trunk/lib/Analysis/CFG.cpp

Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=253107&r1=253106&r2=253107&view=diff
==
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Fri Nov 13 18:36:50 2015
@@ -1942,7 +1942,15 @@ CFGBlock *CFGBuilder::VisitChooseExpr(Ch
 
 
 CFGBlock *CFGBuilder::VisitCompoundStmt(CompoundStmt *C) {
-  addLocalScopeAndDtors(C);
+  LocalScope::const_iterator scopeBeginPos = ScopePos;
+  if (BuildOpts.AddImplicitDtors) {
+addLocalScopeForStmt(C);
+  }
+  if (!C->body_empty() && !isa(*C->body_rbegin())) {
+// If the body ends with a ReturnStmt, the dtors will be added in 
VisitReturnStmt
+addAutomaticObjDtors(ScopePos, scopeBeginPos, C);
+  }
+
   CFGBlock *LastBlock = Block;
 
   for (CompoundStmt::reverse_body_iterator I=C->body_rbegin(), 
E=C->body_rend();

Added: cfe/trunk/test/Analysis/no-unreachable-dtors.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/no-unreachable-dtors.cpp?rev=253107&view=auto
==
--- cfe/trunk/test/Analysis/no-unreachable-dtors.cpp (added)
+++ cfe/trunk/test/Analysis/no-unreachable-dtors.cpp Fri Nov 13 18:36:50 2015
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=debug.Stats -verify 
-Wno-unreachable-code %s
+
+struct S {
+  ~S();
+};
+
+// the return at the end of an CompoundStmt does not lead to an unreachable 
block containing the dtors
+void test() { // expected-warning-re{{test -> Total CFGBlocks: {{[0-9]+}} | 
Unreachable CFGBlocks: 0 | Exhausted Block: no | Empty WorkList: yes}}
+  S s;
+  return;
+}


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


r253114 - Make some tests LLVM-optimization agnostic and remove some others that were beyond value/repair

2015-11-13 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Fri Nov 13 19:10:38 2015
New Revision: 253114

URL: http://llvm.org/viewvc/llvm-project?rev=253114&view=rev
Log:
Make some tests LLVM-optimization agnostic and remove some others that were 
beyond value/repair

Several of these tests (the two deleted, and the one removal edit) were
relying on the optimizer to collapse things to test some frontend
feature. The tests were really old and features seemed amply covered by
other parts of the test suite, so I just removed them.

If anyone thinks they're valuable enough to keep/fix, we can play around
with that, for sure.

(inspired by r252872)

Removed:
cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp
cfe/trunk/test/CodeGenCXX/member-initializers.cpp
Modified:
cfe/trunk/test/CodeGen/attr-minsize.cpp
cfe/trunk/test/CodeGen/function-attributes.c
cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp

Modified: cfe/trunk/test/CodeGen/attr-minsize.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/attr-minsize.cpp?rev=253114&r1=253113&r2=253114&view=diff
==
--- cfe/trunk/test/CodeGen/attr-minsize.cpp (original)
+++ cfe/trunk/test/CodeGen/attr-minsize.cpp Fri Nov 13 19:10:38 2015
@@ -1,9 +1,9 @@
-// RUN: %clang_cc1 -Oz -emit-llvm %s -o - | FileCheck %s -check-prefix=Oz
-// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
-// RUN: %clang_cc1 -O1 -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
-// RUN: %clang_cc1 -O2 -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
-// RUN: %clang_cc1 -O3 -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
-// RUN: %clang_cc1 -Os -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
+// RUN: %clang_cc1 -Oz -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s 
-check-prefix=Oz
+// RUN: %clang_cc1 -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s 
-check-prefix=OTHER
+// RUN: %clang_cc1 -O1 -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s 
-check-prefix=OTHER
+// RUN: %clang_cc1 -O2 -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s 
-check-prefix=OTHER
+// RUN: %clang_cc1 -O3 -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s 
-check-prefix=OTHER
+// RUN: %clang_cc1 -Os -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s 
-check-prefix=OTHER
 // Check that we set the minsize attribute on each function
 // when Oz optimization level is set.
 
@@ -76,4 +76,4 @@ void test5(float arg);
 
 // Oz: attributes [[MINSIZE]] = { minsize{{.*}} }
 
-// OTHER: attributes [[MS]] = { minsize {{(norecurse )?}}nounwind{{.*}} }
+// OTHER: attributes [[MS]] = { minsize nounwind{{.*}} }

Modified: cfe/trunk/test/CodeGen/function-attributes.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/function-attributes.c?rev=253114&r1=253113&r2=253114&view=diff
==
--- cfe/trunk/test/CodeGen/function-attributes.c (original)
+++ cfe/trunk/test/CodeGen/function-attributes.c Fri Nov 13 19:10:38 2015
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -Os -o - %s | 
FileCheck %s
-// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -Os -std=c99 -o - 
%s | FileCheck %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm 
-disable-llvm-optzns -Os -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm 
-disable-llvm-optzns -Os -std=c99 -o - %s | FileCheck %s
 // CHECK: define signext i8 @f0(i32 %x) [[NUW:#[0-9]+]]
 // CHECK: define zeroext i8 @f1(i32 %x) [[NUW]]
 // CHECK: define void @f2(i8 signext %x) [[NUW]]
@@ -56,31 +56,11 @@ int f12(int arg) {
   return arg ? 0 : f10_t();
 }
 
-// CHECK: define void @f13() [[NUW]]
+// CHECK: define void @f13() [[NUW_OS_RN:#[0-9]+]]
 void f13(void) __attribute__((pure)) __attribute__((const));
 void f13(void){}
 
 
-// Ensure that these get inlined: rdar://6853279
-// CHECK-LABEL: define void @f14
-// CHECK-NOT: @ai_
-// CHECK: call void @f14_end
-static __inline__ __attribute__((always_inline))
-int ai_1() {  return 4; }
-
-static __inline__ __attribute__((always_inline))
-struct {
-  int a, b, c, d, e;
-} ai_2() { while (1) {} }
-
-void f14(int a) {
-  extern void f14_end(void);
-  if (a)
-ai_2();
-  ai_1();
-  f14_end();
-}
-
 //  [irgen] clang isn't setting the optsize bit on 
functions
 // CHECK-LABEL: define void @f15
 // CHECK: [[NUW]]
@@ -128,10 +108,11 @@ void f20(void) {
   _setjmp(0);
 }
 
-// CHECK: attributes [[NUW]] = { norecurse nounwind optsize readnone{{.*}} }
-// CHECK: attributes [[AI]] = { alwaysinline norecurse nounwind optsize 
readnone{{.*}} }
-// CHECK: attributes [[ALIGN]] = { norecurse nounwind optsize readnone 
alignstack=16{{.*}} }
+// CHECK: attributes [[NUW]] = { nounwind optsize{{.*}} }
+// CHECK: attributes [[AI]] = { alwaysinline nounwind optsize{{.*}} }
+// CHECK: attributes [[NUW_OS_RN]] = { nounwind optsize readnone{{.*}} }
+// CHECK:

Re: r252872 - Update clang regression tests for 'norecurse'

2015-11-13 Thread David Blaikie via cfe-commits
Did some cleaning up in r253114

On Thu, Nov 12, 2015 at 8:18 AM, James Molloy 
wrote:

> Hi David,
>
> Honestly, I really don't know. I just updated them due to a change in LLVM
> - I hadn't considered doing an audit.
>
> James
>
> On Thu, 12 Nov 2015 at 16:08 David Blaikie via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> On Thu, Nov 12, 2015 at 2:56 AM, James Molloy via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: jamesm
>>> Date: Thu Nov 12 04:56:51 2015
>>> New Revision: 252872
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=252872&view=rev
>>> Log:
>>> Update clang regression tests for 'norecurse'
>>>
>>> FunctionAttrs has just been taught how to infer 'norecurse'. Update
>>> clang tests for LLVM r252871.
>>>
>>
>> Do all these tests need to run FunctionAttrs? Could some/all of them be
>> switched to use -disable-llvm-optzns?
>>
>>
>>>
>>> Modified:
>>> cfe/trunk/test/CodeGen/attr-minsize.cpp
>>> cfe/trunk/test/CodeGen/function-attributes.c
>>> cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp
>>> cfe/trunk/test/CodeGenCXX/member-initializers.cpp
>>> cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp
>>>
>>> Modified: cfe/trunk/test/CodeGen/attr-minsize.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/attr-minsize.cpp?rev=252872&r1=252871&r2=252872&view=diff
>>>
>>> ==
>>> --- cfe/trunk/test/CodeGen/attr-minsize.cpp (original)
>>> +++ cfe/trunk/test/CodeGen/attr-minsize.cpp Thu Nov 12 04:56:51 2015
>>> @@ -76,4 +76,4 @@ void test5(float arg);
>>>
>>>  // Oz: attributes [[MINSIZE]] = { minsize{{.*}} }
>>>
>>> -// OTHER: attributes [[MS]] = { minsize nounwind{{.*}} }
>>> +// OTHER: attributes [[MS]] = { minsize {{(norecurse )?}}nounwind{{.*}}
>>> }
>>>
>>> Modified: cfe/trunk/test/CodeGen/function-attributes.c
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/function-attributes.c?rev=252872&r1=252871&r2=252872&view=diff
>>>
>>> ==
>>> --- cfe/trunk/test/CodeGen/function-attributes.c (original)
>>> +++ cfe/trunk/test/CodeGen/function-attributes.c Thu Nov 12 04:56:51 2015
>>> @@ -128,9 +128,9 @@ void f20(void) {
>>>_setjmp(0);
>>>  }
>>>
>>> -// CHECK: attributes [[NUW]] = { nounwind optsize readnone{{.*}} }
>>> -// CHECK: attributes [[AI]] = { alwaysinline nounwind optsize
>>> readnone{{.*}} }
>>> -// CHECK: attributes [[ALIGN]] = { nounwind optsize readnone
>>> alignstack=16{{.*}} }
>>> +// CHECK: attributes [[NUW]] = { norecurse nounwind optsize
>>> readnone{{.*}} }
>>> +// CHECK: attributes [[AI]] = { alwaysinline norecurse nounwind optsize
>>> readnone{{.*}} }
>>> +// CHECK: attributes [[ALIGN]] = { norecurse nounwind optsize readnone
>>> alignstack=16{{.*}} }
>>>  // CHECK: attributes [[RT]] = { nounwind optsize returns_twice{{.*}} }
>>>  // CHECK: attributes [[NR]] = { noreturn nounwind optsize }
>>>  // CHECK: attributes [[NUW_RN]] = { nounwind optsize readnone }
>>>
>>> Modified: cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp?rev=252872&r1=252871&r2=252872&view=diff
>>>
>>> ==
>>> --- cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp (original)
>>> +++ cfe/trunk/test/CodeGenCXX/default-destructor-synthesis.cpp Thu Nov
>>> 12 04:56:51 2015
>>> @@ -35,4 +35,4 @@ int f() {
>>>return count;
>>>  }
>>>
>>> -// CHECK: attributes [[NUW]] = { nounwind{{.*}} }
>>> +// CHECK: attributes [[NUW]] = { norecurse nounwind{{.*}} }
>>>
>>> Modified: cfe/trunk/test/CodeGenCXX/member-initializers.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/member-initializers.cpp?rev=252872&r1=252871&r2=252872&view=diff
>>>
>>> ==
>>> --- cfe/trunk/test/CodeGenCXX/member-initializers.cpp (original)
>>> +++ cfe/trunk/test/CodeGenCXX/member-initializers.cpp Thu Nov 12
>>> 04:56:51 2015
>>> @@ -32,4 +32,4 @@ int test_fold() {
>>>return A(2).i;
>>>  }
>>>
>>> -// CHECK: attributes [[NUW_RN]] = { nounwind readnone{{.*}} }
>>> +// CHECK: attributes [[NUW_RN]] = { norecurse nounwind readnone{{.*}} }
>>>
>>> Modified: cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp?rev=252872&r1=252871&r2=252872&view=diff
>>>
>>> ==
>>> --- cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp (original)
>>> +++ cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp Thu Nov 12
>>> 04:56:51 2015
>>> @@ -295,4 +295,4 @@ U u;
>>>  // CHECK-GLOBAL: @_ZN11IndirectPDM1uE = global %"union.

Re: [PATCH] Allow "redefinition" of typedef of anon tag from unimported submodule

2015-11-13 Thread Ben Langmuir via cfe-commits

> On Nov 13, 2015, at 4:20 PM, Richard Smith  wrote:
> 
> On Fri, Nov 13, 2015 at 4:03 PM, Ben Langmuir via cfe-commits 
> mailto:cfe-commits@lists.llvm.org>> wrote:
> This time sending to the right list address.
> 
> Likewise =)
> 
> > On Nov 13, 2015, at 4:00 PM, Ben Langmuir  > > wrote:
> >
> > Hey Richard,
> >
> > After your commit r233345 we started diagnosing “redefinition” errors for 
> > typedefs of anonymous tags that are *not visible* in case like this:
> >
> > module that isn’t imported:
> >   typedef struct { … } Foo_t;
> > source file:
> >   typedef struct { … } Foo_t;
> >
> > I think the only change needed is to not consider these anonymous tags to 
> > be the same entity unless we’re in C++.  Patch attached.
> 
> Looks fine. Do we also miscompute the linkage for these things in C (where 
> types don't really have linkage), or is this just a problem because we bail 
> out before we hit the isExternallyVisible check?


Ack, my copy of clang was a couple of days old and I guess you’ve been working 
in this area!  My patch is no longer sufficient...___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253117 - Clarify and elaborate the conditions on which we're checking target

2015-11-13 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Fri Nov 13 19:56:04 2015
New Revision: 253117

URL: http://llvm.org/viewvc/llvm-project?rev=253117&view=rev
Log:
Clarify and elaborate the conditions on which we're checking target
features for calls.

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

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=253117&r1=253116&r2=253117&view=diff
==
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Fri Nov 13 19:56:04 2015
@@ -3748,10 +3748,12 @@ RValue CodeGenFunction::EmitCall(QualTyp
  "Call must have function pointer type!");
 
   if (const FunctionDecl *FD = dyn_cast_or_null(TargetDecl))
-// If this isn't an always_inline function we can't guarantee that any
-// function isn't being used correctly so only check if we have the
-// attribute and a set of target attributes that might be different from
-// our default.
+// We can only guarantee that a function is called from the correct
+// context/function based on the appropriate target attributes,
+// so only check in the case where we have both always_inline and target
+// since otherwise we could be making a conditional call after a check for
+// the proper cpu features (and it won't cause code generation issues due 
to
+// function based code generation).
 if (TargetDecl->hasAttr() &&
 TargetDecl->hasAttr())
   checkTargetFeatures(E, FD);


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


r253119 - Use %select to merge similar diagnostics. NFC

2015-11-13 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Fri Nov 13 20:09:55 2015
New Revision: 253119

URL: http://llvm.org/viewvc/llvm-project?rev=253119&view=rev
Log:
Use %select to merge similar diagnostics. NFC

Modified:
cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
cfe/trunk/lib/Lex/Lexer.cpp
cfe/trunk/lib/Lex/LiteralSupport.cpp
cfe/trunk/lib/Lex/PPExpressions.cpp
cfe/trunk/test/Misc/warning-flags-enabled.c
cfe/trunk/test/Misc/warning-flags.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=253119&r1=253118&r2=253119&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Fri Nov 13 20:09:55 2015
@@ -13,9 +13,8 @@
 
 let Component = "Lex", CategoryName = "Lexical or Preprocessor Issue" in {
 
-def null_in_string : Warning<"null character(s) preserved in string literal">,
-  InGroup;
-def null_in_char : Warning<"null character(s) preserved in character literal">,
+def null_in_char_or_string : Warning<
+  "null character(s) preserved in %select{char|string}0 literal">,
   InGroup;
 def null_in_file : Warning<"null character ignored">, InGroup;
 def warn_nested_block_comment : Warning<"'/*' within block comment">,
@@ -67,10 +66,8 @@ def ext_token_used : Extension<"extensio
 def warn_cxx11_keyword : Warning<"'%0' is a keyword in C++11">,
   InGroup, DefaultIgnore;
 
-def ext_unterminated_string : ExtWarn<"missing terminating '\"' character">,
-  InGroup;
-def ext_unterminated_char : ExtWarn<"missing terminating ' character">,
-  InGroup;
+def ext_unterminated_char_or_string : ExtWarn<
+  "missing terminating %select{'|'\"'}0 character">, InGroup;
 def ext_empty_character : ExtWarn<"empty character constant">,
   InGroup;
 def err_unterminated_block_comment : Error<"unterminated /* comment">;
@@ -154,9 +151,8 @@ def ext_nonstandard_escape : Extension<
   "use of non-standard escape character '\\%0'">;
 def ext_unknown_escape : ExtWarn<"unknown escape sequence '\\%0'">,
   InGroup>;
-def err_invalid_decimal_digit : Error<"invalid digit '%0' in decimal 
constant">;
-def err_invalid_binary_digit : Error<"invalid digit '%0' in binary constant">;
-def err_invalid_octal_digit : Error<"invalid digit '%0' in octal constant">;
+def err_invalid_digit : Error<
+  "invalid digit '%0' in %select{decimal|octal|binary}1 constant">;
 def err_invalid_suffix_constant : Error<
   "invalid suffix '%0' on %select{integer|floating}1 constant">;
 def warn_cxx11_compat_digit_separator : Warning<
@@ -173,10 +169,8 @@ def err_multichar_utf_character_literal
 def err_exponent_has_no_digits : Error<"exponent has no digits">;
 def ext_imaginary_constant : Extension<
   "imaginary constants are a GNU extension">, InGroup;
-def err_hexconstant_requires_exponent : Error<
-  "hexadecimal floating constants require an exponent">;
-def err_hexconstant_requires_digits : Error<
-  "hexadecimal floating constants require a significand">;
+def err_hexconstant_requires: Error<
+  "hexadecimal floating constants require %select{an exponent|a 
significand}0">;
 def ext_hexconstant_invalid : Extension<
   "hexadecimal floating constants are a C99 feature">, InGroup;
 def ext_binary_literal : Extension<
@@ -187,8 +181,8 @@ def warn_cxx11_compat_binary_literal : W
   "binary integer literals are incompatible with C++ standards before C++14">,
   InGroup, DefaultIgnore;
 def err_pascal_string_too_long : Error<"Pascal string is too long">;
-def err_octal_escape_too_large : Error<"octal escape sequence out of range">;
-def err_hex_escape_too_large : Error<"hex escape sequence out of range">;
+def err_escape_too_large : Error<
+  "%select{hex|octal}0 escape sequence out of range">;
 def ext_string_too_long : Extension<"string literal of length %0 exceeds "
   "maximum length %1 that %select{C90|ISO C99|C++}2 compilers are required to "
   "support">, InGroup;
@@ -304,10 +298,9 @@ def pp_invalid_string_literal : Warning<
   "invalid string literal, ignoring final '\\'">;
 def warn_pp_expr_overflow : Warning<
   "integer overflow in preprocessor expression">;
-def warn_pp_convert_lhs_to_positive : Warning<
-  "left side of operator converted from negative value to unsigned: %0">;
-def warn_pp_convert_rhs_to_positive : Warning<
-  "right side of operator converted from negative value to unsigned: %0">;
+def warn_pp_convert_to_positive : Warning<
+  "%select{left|right}0 side of operator converted from negative value to "
+  "unsigned: %1">;
 
 def ext_pp_import_directive : Extension<"#import is a language extension">,
   InGroup>;

Modified: cfe/trunk/lib/Lex/Lexer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=253119&r1=253118&r2=253119&view=diff
==
--- cfe/trunk/lib/Lex/Lexer.cpp (original)

Re: [Diffusion] rL251335: MismatchingNewDeleteDetector uses incorrect field, and finds no initializer

2015-11-13 Thread Tom Stellard via cfe-commits
tstellarAMD added a project: 3.7.1-merged.

Users:
  ismailp (Author)
  rsmith (Auditor)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)

http://reviews.llvm.org/rL251335



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


Re: [Diffusion] rL248424: Push OpenMP linker flags after linker input on Darwin. Don't add any

2015-11-13 Thread Tom Stellard via cfe-commits
tstellarAMD added a project: 3.7.1-merged.

Users:
  joerg (Author, Auditor)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)
  rsmith (Auditor)

http://reviews.llvm.org/rL248424



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


Re: [Diffusion] rL248426: Support linking against OpenMP runtime on NetBSD.

2015-11-13 Thread Tom Stellard via cfe-commits
tstellarAMD added a project: 3.7.1-merged.

Users:
  joerg (Author, Auditor)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)
  rsmith (Auditor)

http://reviews.llvm.org/rL248426



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


Re: r252834 - Provide a frontend based error for always_inline functions that require

2015-11-13 Thread Eric Christopher via cfe-commits
Hi Akira,

I don't think there's currently a good reason we don't perform a diagnostic
there, just right now we'd have to say something bland like "unable to
inline always_inline function 'foo'" without a reason. We might not have
gotten a diagnostic in the past because of compatibility reasons/transition
reasons, but even gcc warns here. Logically the programmer said
"always_inline" - if we can't we should probably say something.

-eric

On Wed, Nov 11, 2015 at 6:17 PM Akira Hatanaka  wrote:

> Currently, we inline a function only if the call to isInlineViable returns
> true, which means there are cases where we don't inline functions marked
> always_inline. Is there a reason we haven't made changes to produce any
> diagnostic in those cases? The comment also says "should be inlined
> whenever possible", which gives the impression that this is only a best
> effort attribute.
>
>
> On Wed, Nov 11, 2015 at 6:09 PM, Eric Christopher 
> wrote:
>
>>
>>
>> On Wed, Nov 11, 2015 at 6:08 PM Akira Hatanaka 
>> wrote:
>>
>>> I think you are suggesting we change the inliner to produce a diagnostic
>>> (error or warning?) when the callee is marked always_inline and its
>>> function attributes are not compatible with the caller's
>>> (functionsHaveCompatibleAttributes returns false). Is that correct?
>>>
>>>
>> Yep. And I think an error is appropriate here. The programmer said that
>> the function must always inline and it's not always being inlined.
>>
>> I think it's a larger change because it'll require some refactoring and
>> the ability to give reasons out of the always inline pass when faced with
>> cost analysis.
>>
>> -eric
>>
>>
>>> On Wed, Nov 11, 2015 at 4:48 PM, Eric Christopher 
>>> wrote:
>>>
 FWIW we should also have the backend avoid inlining and perhaps produce
 a diagnostic if something makes it there as well.

 -eric

 On Wed, Nov 11, 2015 at 4:46 PM Eric Christopher via cfe-commits <
 cfe-commits@lists.llvm.org> wrote:

> Author: echristo
> Date: Wed Nov 11 18:44:12 2015
> New Revision: 252834
>
> URL: http://llvm.org/viewvc/llvm-project?rev=252834&view=rev
> Log:
> Provide a frontend based error for always_inline functions that require
> target features that the caller function doesn't provide. This matches
> the existing backend failure to inline functions that don't have
> matching target features - and diagnoses earlier in the case of
> always_inline.
>
> Fix up a few test cases that were, in fact, invalid if you tried
> to generate code from the backend with the specified target features
> and add a couple of tests to illustrate what's going on.
>
> This should fix PR25246.
>
> Added:
> cfe/trunk/test/CodeGen/target-features-error-2.c
> cfe/trunk/test/CodeGen/target-features-error.c
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/lib/CodeGen/CGExpr.cpp
> cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
> cfe/trunk/test/CodeGen/3dnow-builtins.c
> cfe/trunk/test/CodeGen/avx512vl-builtins.c
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=252834&r1=252833&r2=252834&view=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Nov 11
> 18:44:12 2015
> @@ -431,6 +431,9 @@ def err_builtin_definition : Error<"defi
>  def err_arm_invalid_specialreg : Error<"invalid special register for
> builtin">;
>  def err_invalid_cpu_supports : Error<"invalid cpu feature string for
> builtin">;
>  def err_builtin_needs_feature : Error<"%0 needs target feature %1">;
> +def err_function_needs_feature
> +: Error<"function %0 and always_inline callee function %1 are
> required to "
> +"have matching target features">;
>  def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
>InGroup, DefaultError;
>  def warn_dyn_class_memaccess : Warning<
>
> Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=252834&r1=252833&r2=252834&view=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGExpr.cpp Wed Nov 11 18:44:12 2015
> @@ -3747,6 +3747,15 @@ RValue CodeGenFunction::EmitCall(QualTyp
>assert(CalleeType->isFunctionPointerType() &&
>   "Call must have function pointer type!");
>
> +  if (const FunctionDecl *FD =
> dyn_cast_or_null(TargetDecl))
> +// If this isn't an always_inline functi

Re: r252834 - Provide a frontend based error for always_inline functions that require

2015-11-13 Thread Eric Christopher via cfe-commits
On Thu, Nov 12, 2015 at 11:55 AM Robinson, Paul <
paul_robin...@playstation.sony.com> wrote:

>
>
> > -Original Message-
> > From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
> Of
> > Eric Christopher via cfe-commits
> > Sent: Wednesday, November 11, 2015 4:44 PM
> > To: cfe-commits@lists.llvm.org
> > Subject: r252834 - Provide a frontend based error for always_inline
> > functions that require
> >
> > Author: echristo
> > Date: Wed Nov 11 18:44:12 2015
> > New Revision: 252834
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=252834&view=rev
> > Log:
> > Provide a frontend based error for always_inline functions that require
> > target features that the caller function doesn't provide. This matches
> > the existing backend failure to inline functions that don't have
> > matching target features - and diagnoses earlier in the case of
> > always_inline.
> >
> > Fix up a few test cases that were, in fact, invalid if you tried
> > to generate code from the backend with the specified target features
> > and add a couple of tests to illustrate what's going on.
> >
> > This should fix PR25246.
> >
> > Added:
> > cfe/trunk/test/CodeGen/target-features-error-2.c
> > cfe/trunk/test/CodeGen/target-features-error.c
> > Modified:
> > cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> > cfe/trunk/lib/CodeGen/CGExpr.cpp
> > cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
> > cfe/trunk/test/CodeGen/3dnow-builtins.c
> > cfe/trunk/test/CodeGen/avx512vl-builtins.c
> >
> > Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> > URL: http://llvm.org/viewvc/llvm-
> >
> project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=252834&r1
> > =252833&r2=252834&view=diff
> >
> ==
> > 
> > --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> > +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Nov 11
> > 18:44:12 2015
> > @@ -431,6 +431,9 @@ def err_builtin_definition : Error<"defi
> >  def err_arm_invalid_specialreg : Error<"invalid special register for
> > builtin">;
> >  def err_invalid_cpu_supports : Error<"invalid cpu feature string for
> > builtin">;
> >  def err_builtin_needs_feature : Error<"%0 needs target feature %1">;
> > +def err_function_needs_feature
> > +: Error<"function %0 and always_inline callee function %1 are
> > required to "
> > +"have matching target features">;
> >  def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
> >InGroup, DefaultError;
> >  def warn_dyn_class_memaccess : Warning<
> >
> > Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
> > URL: http://llvm.org/viewvc/llvm-
> >
> project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=252834&r1=252833&r2=252834&vi
> > ew=diff
> >
> ==
> > 
> > --- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
> > +++ cfe/trunk/lib/CodeGen/CGExpr.cpp Wed Nov 11 18:44:12 2015
> > @@ -3747,6 +3747,15 @@ RValue CodeGenFunction::EmitCall(QualTyp
> >assert(CalleeType->isFunctionPointerType() &&
> >   "Call must have function pointer type!");
> >
> > +  if (const FunctionDecl *FD =
> > dyn_cast_or_null(TargetDecl))
> > +// If this isn't an always_inline function we can't guarantee that
> > any
> > +// function isn't being used correctly
>
> Uh... I wouldn't mind this not using no fewer negatives...
> an "only if" kind of phrasing might help.
>

Fair :). I've reworded it in r253117, that help?

-eric


> Thanks,
> --paulr
>
> > so only check if we have the
> > +// attribute and a set of target attributes that might be different
> > from
> > +// our default.
> > +if (TargetDecl->hasAttr() &&
> > +TargetDecl->hasAttr())
> > +  checkTargetFeatures(E, FD);
> > +
> >CalleeType = getContext().getCanonicalType(CalleeType);
> >
> >const auto *FnType =
> >
> > Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
> > URL: http://llvm.org/viewvc/llvm-
> >
> project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=252834&r1=252833&r2=
> > 252834&view=diff
> >
> ==
> > 
> > --- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
> > +++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Wed Nov 11 18:44:12 2015
> > @@ -1843,7 +1843,8 @@ template void CGBuilderInserter >  llvm::BasicBlock::iterator InsertPt) const;
> >  #undef PreserveNames
> >
> > -// Returns true if we have a valid set of target features.
> > +// Emits an error if we don't have a valid set of target features for
> the
> > +// called function.
> >  void CodeGenFunction::checkTargetFeatures(const CallExpr *E,
> >const FunctionDecl
> *TargetDecl)
> > {
> >// Early exit if this is an indirect call.
> > @@ -1856,31 +1857,70 @@ void CodeGenFunction::checkTargetFeature
> >if (!FD)
> >  retu

Re: [Diffusion] rL248379: Refactor library decision for -fopenmp support from Darwin into a

2015-11-13 Thread Tom Stellard via cfe-commits
tstellarAMD added a project: 3.7.1-merged.

Users:
  joerg (Author, Auditor)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)
  rsmith (Auditor)

http://reviews.llvm.org/rL248379



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


r253121 - Add support for the always_inline + target feature diagnostic to print

2015-11-13 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Fri Nov 13 20:38:37 2015
New Revision: 253121

URL: http://llvm.org/viewvc/llvm-project?rev=253121&view=rev
Log:
Add support for the always_inline + target feature diagnostic to print
out the first missing target feature that's required and reword
the diagnostic accordingly.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/test/CodeGen/target-features-error-2.c
cfe/trunk/test/CodeGen/target-features-error.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=253121&r1=253120&r2=253121&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Nov 13 20:38:37 
2015
@@ -432,8 +432,9 @@ def err_arm_invalid_specialreg : Error<"
 def err_invalid_cpu_supports : Error<"invalid cpu feature string for builtin">;
 def err_builtin_needs_feature : Error<"%0 needs target feature %1">;
 def err_function_needs_feature
-: Error<"function %0 and always_inline callee function %1 are required to "
-"have matching target features">;
+: Error<"always_inline function %1 requires target feature '%2', but would 
"
+"be inlined into function %0 that is compiled without support for "
+"'%2'">;
 def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
   InGroup, DefaultError;
 def warn_dyn_class_memaccess : Warning<

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=253121&r1=253120&r2=253121&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Fri Nov 13 20:38:37 2015
@@ -1852,7 +1852,8 @@ template void CGBuilderInserter &ReqFeatures,
-CodeGenModule &CGM, const FunctionDecl *FD) {
+CodeGenModule &CGM, const FunctionDecl *FD,
+std::string &FirstMissing) {
   // If there aren't any required features listed then go ahead and return.
   if (ReqFeatures.empty())
 return false;
@@ -1870,7 +1871,11 @@ static bool hasRequiredFeatures(const Sm
 Feature.split(OrFeatures, "|");
 return std::any_of(OrFeatures.begin(), OrFeatures.end(),
[&](StringRef Feature) {
- return CallerFeatureMap.lookup(Feature);
+ if (!CallerFeatureMap.lookup(Feature)) {
+   FirstMissing = Feature.str();
+   return false;
+ }
+ return true;
});
   });
 }
@@ -1893,6 +1898,7 @@ void CodeGenFunction::checkTargetFeature
   // the td file with the default cpu, for an always_inline function this is 
any
   // listed cpu and any listed features.
   unsigned BuiltinID = TargetDecl->getBuiltinID();
+  std::string MissingFeature;
   if (BuiltinID) {
 SmallVector ReqFeatures;
 const char *FeatureList =
@@ -1901,8 +1907,7 @@ void CodeGenFunction::checkTargetFeature
 if (!FeatureList || StringRef(FeatureList) == "")
   return;
 StringRef(FeatureList).split(ReqFeatures, ",");
-
-if (!hasRequiredFeatures(ReqFeatures, CGM, FD))
+if (!hasRequiredFeatures(ReqFeatures, CGM, FD, MissingFeature))
   CGM.getDiags().Report(E->getLocStart(), diag::err_builtin_needs_feature)
   << TargetDecl->getDeclName()
   << CGM.getContext().BuiltinInfo.getRequiredFeatures(BuiltinID);
@@ -1914,8 +1919,8 @@ void CodeGenFunction::checkTargetFeature
 CGM.getFunctionFeatureMap(CalleeFeatureMap, TargetDecl);
 for (const auto &F : CalleeFeatureMap)
   ReqFeatures.push_back(F.getKey());
-if (!hasRequiredFeatures(ReqFeatures, CGM, FD))
+if (!hasRequiredFeatures(ReqFeatures, CGM, FD, MissingFeature))
   CGM.getDiags().Report(E->getLocStart(), diag::err_function_needs_feature)
-  << FD->getDeclName() << TargetDecl->getDeclName();
+  << FD->getDeclName() << TargetDecl->getDeclName() << MissingFeature;
   }
 }

Modified: cfe/trunk/test/CodeGen/target-features-error-2.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/target-features-error-2.c?rev=253121&r1=253120&r2=253121&view=diff
==
--- cfe/trunk/test/CodeGen/target-features-error-2.c (original)
+++ cfe/trunk/test/CodeGen/target-features-error-2.c Fri Nov 13 20:38:37 2015
@@ -3,5 +3,5 @@
 #include 
 
 int baz(__m256i a) {
-  return _mm256_extract_epi32(a, 3); // expected-error {{function 'baz' and 
always_i

Re: r252834 - Provide a frontend based error for always_inline functions that require

2015-11-13 Thread Eric Christopher via cfe-commits
On Wed, Nov 11, 2015 at 5:38 PM Richard Smith  wrote:

> On Wed, Nov 11, 2015 at 5:25 PM, Eric Christopher 
> wrote:
>
>> On Wed, Nov 11, 2015 at 5:03 PM Richard Smith 
>> wrote:
>>
>>> On Wed, Nov 11, 2015 at 4:44 PM, Eric Christopher via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 Author: echristo
 Date: Wed Nov 11 18:44:12 2015
 New Revision: 252834

 URL: http://llvm.org/viewvc/llvm-project?rev=252834&view=rev
 Log:
 Provide a frontend based error for always_inline functions that require
 target features that the caller function doesn't provide. This matches
 the existing backend failure to inline functions that don't have
 matching target features - and diagnoses earlier in the case of
 always_inline.

 Fix up a few test cases that were, in fact, invalid if you tried
 to generate code from the backend with the specified target features
 and add a couple of tests to illustrate what's going on.

 This should fix PR25246.

 Added:
 cfe/trunk/test/CodeGen/target-features-error-2.c
 cfe/trunk/test/CodeGen/target-features-error.c
 Modified:
 cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
 cfe/trunk/lib/CodeGen/CGExpr.cpp
 cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
 cfe/trunk/test/CodeGen/3dnow-builtins.c
 cfe/trunk/test/CodeGen/avx512vl-builtins.c

 Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=252834&r1=252833&r2=252834&view=diff

 ==
 --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
 +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Nov 11
 18:44:12 2015
 @@ -431,6 +431,9 @@ def err_builtin_definition : Error<"defi
  def err_arm_invalid_specialreg : Error<"invalid special register for
 builtin">;
  def err_invalid_cpu_supports : Error<"invalid cpu feature string for
 builtin">;
  def err_builtin_needs_feature : Error<"%0 needs target feature %1">;
 +def err_function_needs_feature
 +: Error<"function %0 and always_inline callee function %1 are
 required to "
 +"have matching target features">;

>>>
>>> It would be useful to say which feature is missing here. Also,
>>> "matching" implies to
>>>
>>
>> Right.
>>
>>
>>> me that the sets must be the same, whereas I think the rule is that the
>>> caller must at least all the features that the callee uses. Something like:
>>> "always_inline callee function %0 uses target feature %1 that caller %2
>>> does not require" might be more useful?
>>>
>>
>> So, I was waiting on this I admit :)
>>
>> What we really need is a "string set" way of doing set difference and
>> then optionally translating that to command line options. I'm really leery
>> of doing the "full set of options missing" though due to just the sheer
>> size of the error messages out the other end. i.e. "default" compiles and
>> "function that requires everything a skylake processor has". An
>> intermediate result could be taking a look at the target attribute on the
>> callee and posting that as a "set" of features that are required by the
>> caller without bothering to do the set difference?
>>
>>  I'll look into doing that, though it might not be immediately.
>>
>> Thoughts?
>>
>
> In the short term, just listing the first feature you find that's missing
> would help (the feature that causes you to fall out of the all_of check
> below).
>

Done thusly:

M lib/CodeGen/CodeGenFunction.cpp
M test/CodeGen/target-features-error.c
M test/CodeGen/target-features-error-2.c
M include/clang/Basic/DiagnosticSemaKinds.td
r253121 = ce876e3e4b1e86a09e1504f1fa681502d81059c4
(refs/remotes/origin/master)

and thanks for the wording help :)

-eric


>
>
>> -eric
>>
>>
>>>
>>>
  def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
InGroup, DefaultError;
  def warn_dyn_class_memaccess : Warning<

 Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=252834&r1=252833&r2=252834&view=diff

 ==
 --- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
 +++ cfe/trunk/lib/CodeGen/CGExpr.cpp Wed Nov 11 18:44:12 2015
 @@ -3747,6 +3747,15 @@ RValue CodeGenFunction::EmitCall(QualTyp
assert(CalleeType->isFunctionPointerType() &&
   "Call must have function pointer type!");

 +  if (const FunctionDecl *FD =
 dyn_cast_or_null(TargetDecl))
 +// If this isn't an always_inline function we can't guarantee that
 any
 +// function isn't being used correctly so only check if we have the
 +// attribute and a set of targ

Re: r253012 - [modules] When a declaration has non-trivial visibility, check whether it's

2015-11-13 Thread Sean Silva via cfe-commits
On Thu, Nov 12, 2015 at 9:14 PM, Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rsmith
> Date: Thu Nov 12 23:14:45 2015
> New Revision: 253012
>
> URL: http://llvm.org/viewvc/llvm-project?rev=253012&view=rev
> Log:
> [modules] When a declaration has non-trivial visibility, check whether it's
>

What is "non-trivial visibility"? Is this "visibility" something that
exists in the present C++ language? (e.g. `using namespace std` etc.) or is
this a different notion?

-- Sean Silva


> actually hidden before we check its linkage. This avoids computing the
> linkage
> "too early" for an anonymous struct with a typedef name for linkage.
>
> Modified:
> cfe/trunk/include/clang/Sema/Lookup.h
> cfe/trunk/test/Modules/submodule-visibility.cpp
>
> Modified: cfe/trunk/include/clang/Sema/Lookup.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=253012&r1=253011&r2=253012&view=diff
>
> ==
> --- cfe/trunk/include/clang/Sema/Lookup.h (original)
> +++ cfe/trunk/include/clang/Sema/Lookup.h Thu Nov 12 23:14:45 2015
> @@ -303,8 +303,7 @@ public:
>  if (!D->isInIdentifierNamespace(IDNS))
>return nullptr;
>
> -if (!D->isHidden() || isHiddenDeclarationVisible(D) ||
> -isVisibleSlow(getSema(), D))
> +if (isVisible(getSema(), D) || isHiddenDeclarationVisible(D))
>return D;
>
>  return getAcceptableDeclSlow(D);
>
> Modified: cfe/trunk/test/Modules/submodule-visibility.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/submodule-visibility.cpp?rev=253012&r1=253011&r2=253012&view=diff
>
> ==
> --- cfe/trunk/test/Modules/submodule-visibility.cpp (original)
> +++ cfe/trunk/test/Modules/submodule-visibility.cpp Thu Nov 12 23:14:45
> 2015
> @@ -28,3 +28,10 @@ int k = n + m; // OK, a and b are visibl
>  #ifndef B
>  #error B is not defined
>  #endif
> +
> +// Ensure we don't compute the linkage of this struct before we find it
> has a
> +// typedef name for linkage purposes.
> +typedef struct {
> +  int p;
> +  void (*f)(int p);
> +} name_for_linkage;
>
>
> ___
> 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


r253123 - [modules] Allow "redefinition" of typedef of anon tag from unimported submodule

2015-11-13 Thread Ben Langmuir via cfe-commits
Author: benlangmuir
Date: Fri Nov 13 21:26:14 2015
New Revision: 253123

URL: http://llvm.org/viewvc/llvm-project?rev=253123&view=rev
Log:
[modules] Allow "redefinition" of typedef of anon tag from unimported submodule

r233345 started being stricter about typedef names for linkage purposes
in non-visible modules, but broke languages without the ODR.

rdar://23527954

Added:
cfe/trunk/test/Modules/Inputs/typedef-tag-hidden.h
cfe/trunk/test/Modules/Inputs/typedef-tag.h
cfe/trunk/test/Modules/typedef-tag-not-visible.m
Modified:
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Index/usrs.m
cfe/trunk/test/Modules/Inputs/module.map

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=253123&r1=253122&r2=253123&view=diff
==
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Fri Nov 13 21:26:14 2015
@@ -1256,7 +1256,8 @@ static LinkageInfo computeLVForDecl(cons
 case Decl::TypeAlias:
   // A typedef declaration has linkage if it gives a type a name for
   // linkage purposes.
-  if (!cast(D)
+  if (!D->getASTContext().getLangOpts().CPlusPlus ||
+  !cast(D)
->getAnonDeclWithTypedefName(/*AnyRedecl*/true))
 return LinkageInfo::none();
   break;

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=253123&r1=253122&r2=253123&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Nov 13 21:26:14 2015
@@ -1829,7 +1829,8 @@ static void filterNonConflictingPrevious
 
   // If both declarations give a tag declaration a typedef name for linkage
   // purposes, then they declare the same entity.
-  if (OldTD->getAnonDeclWithTypedefName(/*AnyRedecl*/true) &&
+  if (S.getLangOpts().CPlusPlus &&
+  OldTD->getAnonDeclWithTypedefName(/*AnyRedecl*/true) &&
   Decl->getAnonDeclWithTypedefName())
 continue;
 }

Modified: cfe/trunk/test/Index/usrs.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/usrs.m?rev=253123&r1=253122&r2=253123&view=diff
==
--- cfe/trunk/test/Index/usrs.m (original)
+++ cfe/trunk/test/Index/usrs.m Fri Nov 13 21:26:14 2015
@@ -119,7 +119,7 @@ int test_multi_declaration(void) {
 // CHECK: usrs.m c:@SA@MyStruct Extent=[15:9 - 18:2]
 // CHECK: usrs.m c:@SA@MyStruct@FI@wa Extent=[16:3 - 16:9]
 // CHECK: usrs.m c:@SA@MyStruct@FI@moo Extent=[17:3 - 17:10]
-// CHECK: usrs.m c:@T@MyStruct Extent=[15:1 - 18:11]
+// CHECK: usrs.m c:usrs.m@T@MyStruct Extent=[15:1 - 18:11]
 // CHECK: usrs.m c:@E@Pizza Extent=[20:1 - 23:2]
 // CHECK: usrs.m c:@E@Pizza@CHEESE Extent=[21:3 - 21:9]
 // CHECK: usrs.m c:@E@Pizza@MUSHROOMS Extent=[22:3 - 22:12]

Modified: cfe/trunk/test/Modules/Inputs/module.map
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/module.map?rev=253123&r1=253122&r2=253123&view=diff
==
--- cfe/trunk/test/Modules/Inputs/module.map (original)
+++ cfe/trunk/test/Modules/Inputs/module.map Fri Nov 13 21:26:14 2015
@@ -379,3 +379,10 @@ module DebugSubmodules {
 module ExtensionTestA {
   header "ExtensionTestA.h"
 }
+
+module TypedefTag {
+  header "typedef-tag.h"
+  explicit module Hidden {
+header "typedef-tag-hidden.h"
+  }
+}

Added: cfe/trunk/test/Modules/Inputs/typedef-tag-hidden.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/typedef-tag-hidden.h?rev=253123&view=auto
==
--- cfe/trunk/test/Modules/Inputs/typedef-tag-hidden.h (added)
+++ cfe/trunk/test/Modules/Inputs/typedef-tag-hidden.h Fri Nov 13 21:26:14 2015
@@ -0,0 +1 @@
+typedef struct { int x; } TypedefStructHidden_t;

Added: cfe/trunk/test/Modules/Inputs/typedef-tag.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/typedef-tag.h?rev=253123&view=auto
==
--- cfe/trunk/test/Modules/Inputs/typedef-tag.h (added)
+++ cfe/trunk/test/Modules/Inputs/typedef-tag.h Fri Nov 13 21:26:14 2015
@@ -0,0 +1 @@
+typedef struct { int x; } TypedefStructVisible_t;

Added: cfe/trunk/test/Modules/typedef-tag-not-visible.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/typedef-tag-not-visible.m?rev=253123&view=auto
==
--- cfe/trunk/test/Modules/typedef-tag-not-visible.m (added)
+++ cfe/trunk/test/Modules/typedef-tag-not-visible.m Fri Nov 13 21:26:14 2015
@@ -0,0 +1,8 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodule

Re: [PATCH] Allow "redefinition" of typedef of anon tag from unimported submodule

2015-11-13 Thread Ben Langmuir via cfe-commits

> On Nov 13, 2015, at 5:32 PM, Ben Langmuir via cfe-commits 
>  wrote:
> 
> 
>> On Nov 13, 2015, at 4:20 PM, Richard Smith > > wrote:
>> 
>> On Fri, Nov 13, 2015 at 4:03 PM, Ben Langmuir via cfe-commits 
>> mailto:cfe-commits@lists.llvm.org>> wrote:
>> This time sending to the right list address.
>> 
>> Likewise =)
>> 
>> > On Nov 13, 2015, at 4:00 PM, Ben Langmuir > > > wrote:
>> >
>> > Hey Richard,
>> >
>> > After your commit r233345 we started diagnosing “redefinition” errors for 
>> > typedefs of anonymous tags that are *not visible* in case like this:
>> >
>> > module that isn’t imported:
>> >   typedef struct { … } Foo_t;
>> > source file:
>> >   typedef struct { … } Foo_t;
>> >
>> > I think the only change needed is to not consider these anonymous tags to 
>> > be the same entity unless we’re in C++.  Patch attached.
>> 
>> Looks fine. Do we also miscompute the linkage for these things in C (where 
>> types don't really have linkage), or is this just a problem because we bail 
>> out before we hit the isExternallyVisible check?
> 
> 
> Ack, my copy of clang was a couple of days old and I guess you’ve been 
> working in this area!  My patch is no longer sufficient…

Okay, committed this patch with an additional fix for the non-C++ linkage in 
r253123.

Thanks,

Ben

> ___
> 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] D14619: [PATCH] clang-tidy checker for nothrow copy constructible exception objects

2015-11-13 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Looks good with one nit. Thank you!



Comment at: clang-tidy/cert/ThrownExceptionTypeCheck.cpp:23
@@ +22,3 @@
+  if (const auto *FnTy = Node.getType()->getAs()) {
+// If any of the copy constructors is throwing, we will assume that it
+// is plausible that the constructor may be selected by the throw and

The comment is not relevant now.


http://reviews.llvm.org/D14619



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


Re: r252834 - Provide a frontend based error for always_inline functions that require

2015-11-13 Thread Bruno Cardoso Lopes via cfe-commits
Hi Eric,

This is very nice!

After the addition of this feature, LNT started crashing on x86_64h:

FAIL: SingleSource/UnitTests/Vector/SSE/sse_expandfft.compile_time (3 of 2244)
FAIL: SingleSource/UnitTests/Vector/SSE/sse_isamax.compile_time (4 of 2244)
FAIL: SingleSource/UnitTests/Vector/SSE/sse_shift.compile_time (5 of 2244)
FAIL: SingleSource/UnitTests/Vector/SSE/sse_stepfft.compile_time (6 of 2244)
<... among other internal ones>

The reason is that x86_64h implies "-fsgsbase", whereas SSE intrinsics
do require it. Since this isn't the case for plain x86_64, it only
shows up on x86_64h, example:

sse.expandfft.c:195:18: error: always_inline function '_mm_mul_ps'
requires target feature 'fsgsbase', but would be inlined into function
'cfft2' that is
  compiled without support for 'fsgsbase'
V0 = _mm_mul_ps(V6,V3);

We could annotate cfft2 with 'fsgsbase' in the tests, but it seems odd
to me that we would need to care about any function that use x86
intrinsics when compiling for x86_64h. Any thoughts on that?


On Wed, Nov 11, 2015 at 4:44 PM, Eric Christopher via cfe-commits
 wrote:
> Author: echristo
> Date: Wed Nov 11 18:44:12 2015
> New Revision: 252834
>
> URL: http://llvm.org/viewvc/llvm-project?rev=252834&view=rev
> Log:
> Provide a frontend based error for always_inline functions that require
> target features that the caller function doesn't provide. This matches
> the existing backend failure to inline functions that don't have
> matching target features - and diagnoses earlier in the case of
> always_inline.
>
> Fix up a few test cases that were, in fact, invalid if you tried
> to generate code from the backend with the specified target features
> and add a couple of tests to illustrate what's going on.
>
> This should fix PR25246.
>
> Added:
> cfe/trunk/test/CodeGen/target-features-error-2.c
> cfe/trunk/test/CodeGen/target-features-error.c
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/lib/CodeGen/CGExpr.cpp
> cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
> cfe/trunk/test/CodeGen/3dnow-builtins.c
> cfe/trunk/test/CodeGen/avx512vl-builtins.c
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=252834&r1=252833&r2=252834&view=diff
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Nov 11 18:44:12 
> 2015
> @@ -431,6 +431,9 @@ def err_builtin_definition : Error<"defi
>  def err_arm_invalid_specialreg : Error<"invalid special register for 
> builtin">;
>  def err_invalid_cpu_supports : Error<"invalid cpu feature string for 
> builtin">;
>  def err_builtin_needs_feature : Error<"%0 needs target feature %1">;
> +def err_function_needs_feature
> +: Error<"function %0 and always_inline callee function %1 are required 
> to "
> +"have matching target features">;
>  def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
>InGroup, DefaultError;
>  def warn_dyn_class_memaccess : Warning<
>
> Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=252834&r1=252833&r2=252834&view=diff
> ==
> --- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGExpr.cpp Wed Nov 11 18:44:12 2015
> @@ -3747,6 +3747,15 @@ RValue CodeGenFunction::EmitCall(QualTyp
>assert(CalleeType->isFunctionPointerType() &&
>   "Call must have function pointer type!");
>
> +  if (const FunctionDecl *FD = dyn_cast_or_null(TargetDecl))
> +// If this isn't an always_inline function we can't guarantee that any
> +// function isn't being used correctly so only check if we have the
> +// attribute and a set of target attributes that might be different from
> +// our default.
> +if (TargetDecl->hasAttr() &&
> +TargetDecl->hasAttr())
> +  checkTargetFeatures(E, FD);
> +
>CalleeType = getContext().getCanonicalType(CalleeType);
>
>const auto *FnType =
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=252834&r1=252833&r2=252834&view=diff
> ==
> --- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Wed Nov 11 18:44:12 2015
> @@ -1843,7 +1843,8 @@ template void CGBuilderInserter  llvm::BasicBlock::iterator InsertPt) const;
>  #undef PreserveNames
>
> -// Returns true if we have a valid set of target features.
> +// Emits an error if we don't have a valid set of target features for the
> +// called function.
>  void CodeGenFunction::check

Re: r252834 - Provide a frontend based error for always_inline functions that require

2015-11-13 Thread Eric Christopher via cfe-commits
This all sounds a little weird as _mm_mul_ps only requires sse. Can you
give me a testcase and command line that you're using to trigger this?

Thanks!

-eric

On Fri, Nov 13, 2015 at 8:28 PM Bruno Cardoso Lopes 
wrote:

> Hi Eric,
>
> This is very nice!
>
> After the addition of this feature, LNT started crashing on x86_64h:
>
> FAIL: SingleSource/UnitTests/Vector/SSE/sse_expandfft.compile_time (3 of
> 2244)
> FAIL: SingleSource/UnitTests/Vector/SSE/sse_isamax.compile_time (4 of 2244)
> FAIL: SingleSource/UnitTests/Vector/SSE/sse_shift.compile_time (5 of 2244)
> FAIL: SingleSource/UnitTests/Vector/SSE/sse_stepfft.compile_time (6 of
> 2244)
> <... among other internal ones>
>
> The reason is that x86_64h implies "-fsgsbase", whereas SSE intrinsics
> do require it. Since this isn't the case for plain x86_64, it only
> shows up on x86_64h, example:
>
> sse.expandfft.c:195:18: error: always_inline function '_mm_mul_ps'
> requires target feature 'fsgsbase', but would be inlined into function
> 'cfft2' that is
>   compiled without support for 'fsgsbase'
> V0 = _mm_mul_ps(V6,V3);
>
> We could annotate cfft2 with 'fsgsbase' in the tests, but it seems odd
> to me that we would need to care about any function that use x86
> intrinsics when compiling for x86_64h. Any thoughts on that?
>
>
> On Wed, Nov 11, 2015 at 4:44 PM, Eric Christopher via cfe-commits
>  wrote:
> > Author: echristo
> > Date: Wed Nov 11 18:44:12 2015
> > New Revision: 252834
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=252834&view=rev
> > Log:
> > Provide a frontend based error for always_inline functions that require
> > target features that the caller function doesn't provide. This matches
> > the existing backend failure to inline functions that don't have
> > matching target features - and diagnoses earlier in the case of
> > always_inline.
> >
> > Fix up a few test cases that were, in fact, invalid if you tried
> > to generate code from the backend with the specified target features
> > and add a couple of tests to illustrate what's going on.
> >
> > This should fix PR25246.
> >
> > Added:
> > cfe/trunk/test/CodeGen/target-features-error-2.c
> > cfe/trunk/test/CodeGen/target-features-error.c
> > Modified:
> > cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> > cfe/trunk/lib/CodeGen/CGExpr.cpp
> > cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
> > cfe/trunk/test/CodeGen/3dnow-builtins.c
> > cfe/trunk/test/CodeGen/avx512vl-builtins.c
> >
> > Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=252834&r1=252833&r2=252834&view=diff
> >
> ==
> > --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> > +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Nov 11
> 18:44:12 2015
> > @@ -431,6 +431,9 @@ def err_builtin_definition : Error<"defi
> >  def err_arm_invalid_specialreg : Error<"invalid special register for
> builtin">;
> >  def err_invalid_cpu_supports : Error<"invalid cpu feature string for
> builtin">;
> >  def err_builtin_needs_feature : Error<"%0 needs target feature %1">;
> > +def err_function_needs_feature
> > +: Error<"function %0 and always_inline callee function %1 are
> required to "
> > +"have matching target features">;
> >  def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
> >InGroup, DefaultError;
> >  def warn_dyn_class_memaccess : Warning<
> >
> > Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=252834&r1=252833&r2=252834&view=diff
> >
> ==
> > --- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
> > +++ cfe/trunk/lib/CodeGen/CGExpr.cpp Wed Nov 11 18:44:12 2015
> > @@ -3747,6 +3747,15 @@ RValue CodeGenFunction::EmitCall(QualTyp
> >assert(CalleeType->isFunctionPointerType() &&
> >   "Call must have function pointer type!");
> >
> > +  if (const FunctionDecl *FD =
> dyn_cast_or_null(TargetDecl))
> > +// If this isn't an always_inline function we can't guarantee that
> any
> > +// function isn't being used correctly so only check if we have the
> > +// attribute and a set of target attributes that might be different
> from
> > +// our default.
> > +if (TargetDecl->hasAttr() &&
> > +TargetDecl->hasAttr())
> > +  checkTargetFeatures(E, FD);
> > +
> >CalleeType = getContext().getCanonicalType(CalleeType);
> >
> >const auto *FnType =
> >
> > Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=252834&r1=252833&r2=252834&view=diff
> >
> ==
> > --- cfe/trunk/lib/CodeGen/CodeGen

r253128 - Mark is_destructible/is_nothrow_destructible as implemented

2015-11-13 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Sat Nov 14 01:21:35 2015
New Revision: 253128

URL: http://llvm.org/viewvc/llvm-project?rev=253128&view=rev
Log:
Mark is_destructible/is_nothrow_destructible as implemented

These were implemented back in r244564.  However, I forgot to update the
docs.

Modified:
cfe/trunk/docs/LanguageExtensions.rst

Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=253128&r1=253127&r2=253128&view=diff
==
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Sat Nov 14 01:21:35 2015
@@ -1017,8 +1017,8 @@ The following type trait primitives are
   ``argtypes...`` such that no non-trivial functions are called as part of
   that initialization.  This trait is required to implement the C++11 standard
   library.
-* ``__is_destructible`` (MSVC 2013): partially implemented
-* ``__is_nothrow_destructible`` (MSVC 2013): partially implemented
+* ``__is_destructible`` (MSVC 2013)
+* ``__is_nothrow_destructible`` (MSVC 2013)
 * ``__is_nothrow_assignable`` (MSVC 2013, clang)
 * ``__is_constructible`` (MSVC 2013, clang)
 * ``__is_nothrow_constructible`` (MSVC 2013, clang)


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