[PATCH] D17239: Sema: typo correct both sides of binary expression

2016-02-12 Thread Saleem Abdulrasool via cfe-commits
compnerd created this revision.
compnerd added a reviewer: rtrieu.
compnerd added a subscriber: cfe-commits.

When parsing a ternary expression, we would parse the middle and the last
components of the expression.  If there was a typo in both, we would only
run the typo correction once.  Normally, this would be fine, but, when Sema
would be destructed in an Asserts build, we would assert that a delayed typo was
not handled.  This was caused by the fact that the RHS would evaluate as valid
as a TypoExpr would be returned via the ExprResult, and invalid simply ensures
that an expression is present.  Peek into the result and perform the handling
that we would reserve for the invalid type.

Resolves PR265598.

http://reviews.llvm.org/D17239

Files:
  lib/Parse/ParseExpr.cpp
  test/SemaCXX/typo-correction-cxx11.cpp
  test/SemaCXX/typo-correction-delayed.cpp
  test/SemaObjC/provisional-ivar-lookup.m

Index: test/SemaObjC/provisional-ivar-lookup.m
===
--- test/SemaObjC/provisional-ivar-lookup.m
+++ test/SemaObjC/provisional-ivar-lookup.m
@@ -3,7 +3,7 @@
 // rdar:// 8565343
 @interface Foo  {
 @private
-int _foo;
+int _foo; // expected-note {{'_foo' declared here}}
 int _foo2;
 }
 @property (readwrite, nonatomic) int foo, foo1, foo2, foo3;
@@ -16,7 +16,7 @@
 @synthesize foo1;
 
 - (void)setFoo:(int)value {
-_foo = foo; // expected-error {{use of undeclared identifier 'foo'}}
+_foo = foo; // expected-error {{use of undeclared identifier 'foo'; did 
you mean '_foo'}}
 }
 
 - (void)setFoo1:(int)value {
Index: test/SemaCXX/typo-correction-delayed.cpp
===
--- test/SemaCXX/typo-correction-delayed.cpp
+++ test/SemaCXX/typo-correction-delayed.cpp
@@ -208,8 +208,18 @@
 // expected-error-re@-1 {{use of undeclared identifier 'N'{{$
 }
 
+namespace PR26598 {
+int main() {
+  (((str) ? str : str))
+  // expected-error@-1 {{use of undeclared identifier 'str'}}
+  // expected-error@-2 {{use of undeclared identifier 'str'}}
+  // expected-error@-3 {{use of undeclared identifier 'str'}}
+}
+}
+
 // PR 23285. This test must be at the end of the file to avoid additional,
 // unwanted diagnostics.
 // expected-error-re@+2 {{use of undeclared identifier 'uintmax_t'{{$
 // expected-error@+1 {{expected ';' after top level declarator}}
 unsigned int a = 0(uintmax_t
+
Index: test/SemaCXX/typo-correction-cxx11.cpp
===
--- test/SemaCXX/typo-correction-cxx11.cpp
+++ test/SemaCXX/typo-correction-cxx11.cpp
@@ -19,8 +19,13 @@
 namespace PR23140 {
 auto lneed = gned.*[] {};  // expected-error-re {{use of undeclared identifier 
'gned'{{$
 
-void test(int aaa, int bbb, int thisvar) {  // expected-note {{'thisvar' 
declared here}}
-  int thatval = aaa * (bbb + thatvar);  // expected-error {{use of undeclared 
identifier 'thatvar'; did you mean 'thisvar'?}}
+void test(int aaa, int bbb, int thisvar) {
+  // expected-note@-1 {{'thisvar' declared here}}
+  int thatval = aaa * (bbb + thatvar);
+  // expected-error@-1 {{use of undeclared identifier 'thatvar'; did you mean 
'thatval'?}}
+  // expected-note@-2 {{'thatval' declared here}}
+  int thatval2 = aaa * (bbb + thisval);
+  // expected-error@-1 {{use of undeclared identifier 'thisval'; did you mean 
'thisvar'?}}
 }
 }
 
Index: lib/Parse/ParseExpr.cpp
===
--- lib/Parse/ParseExpr.cpp
+++ lib/Parse/ParseExpr.cpp
@@ -369,7 +369,7 @@
 else
   RHS = ParseCastExpression(false);
 
-if (RHS.isInvalid()) {
+if (RHS.isInvalid() || isa(RHS.get())) {
   // FIXME: Errors generated by the delayed typo correction should be
   // printed before errors from parsing the RHS, not after.
   Actions.CorrectDelayedTyposInExpr(LHS);


Index: test/SemaObjC/provisional-ivar-lookup.m
===
--- test/SemaObjC/provisional-ivar-lookup.m
+++ test/SemaObjC/provisional-ivar-lookup.m
@@ -3,7 +3,7 @@
 // rdar:// 8565343
 @interface Foo  {
 @private
-int _foo;
+int _foo; // expected-note {{'_foo' declared here}}
 int _foo2;
 }
 @property (readwrite, nonatomic) int foo, foo1, foo2, foo3;
@@ -16,7 +16,7 @@
 @synthesize foo1;
 
 - (void)setFoo:(int)value {
-_foo = foo; // expected-error {{use of undeclared identifier 'foo'}}
+_foo = foo; // expected-error {{use of undeclared identifier 'foo'; did you mean '_foo'}}
 }
 
 - (void)setFoo1:(int)value {
Index: test/SemaCXX/typo-correction-delayed.cpp
===
--- test/SemaCXX/typo-correction-delayed.cpp
+++ test/SemaCXX/typo-correction-delayed.cpp
@@ -208,8 +208,18 @@
 // expected-error-re@-1 {{use of undeclared identifier 'N'{{$
 }
 
+namespace PR26598 {
+int main() {
+  (((str) ? str : str))
+  // expected-error@-1 {{use of undeclared iden

Re: [PATCH] D17197: [OPENMP] NFC rewrite ParseOpenMPDirectiveKind

2016-02-12 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL260811: [OPENMP] NFC rewrite ParseOpenMPDirectiveKind 
(authored by dpolukhin).

Changed prior to commit:
  http://reviews.llvm.org/D17197?vs=47794&id=47899#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17197

Files:
  cfe/trunk/lib/Parse/ParseOpenMP.cpp

Index: cfe/trunk/lib/Parse/ParseOpenMP.cpp
===
--- cfe/trunk/lib/Parse/ParseOpenMP.cpp
+++ cfe/trunk/lib/Parse/ParseOpenMP.cpp
@@ -26,74 +26,80 @@
 // OpenMP declarative directives.
 //===--===//
 
+namespace {
+enum OpenMPDirectiveKindEx {
+  OMPD_cancellation = OMPD_unknown + 1,
+  OMPD_data,
+  OMPD_enter,
+  OMPD_exit,
+  OMPD_point,
+  OMPD_target_enter,
+  OMPD_target_exit
+};
+} // namespace
+
+// Map token string to extended OMP token kind that are
+// OpenMPDirectiveKind + OpenMPDirectiveKindEx.
+static unsigned getOpenMPDirectiveKindEx(StringRef S) {
+  auto DKind = getOpenMPDirectiveKind(S);
+  if (DKind != OMPD_unknown)
+return DKind;
+
+  return llvm::StringSwitch(S)
+  .Case("cancellation", OMPD_cancellation)
+  .Case("data", OMPD_data)
+  .Case("enter", OMPD_enter)
+  .Case("exit", OMPD_exit)
+  .Case("point", OMPD_point)
+  .Default(OMPD_unknown);
+}
+
 static OpenMPDirectiveKind ParseOpenMPDirectiveKind(Parser &P) {
   // Array of foldings: F[i][0] F[i][1] ===> F[i][2].
   // E.g.: OMPD_for OMPD_simd ===> OMPD_for_simd
   // TODO: add other combined directives in topological order.
-  const OpenMPDirectiveKind F[][3] = {
-  {OMPD_unknown /*cancellation*/, OMPD_unknown /*point*/,
-   OMPD_cancellation_point},
-  {OMPD_target, OMPD_unknown /*data*/, OMPD_target_data},
-  {OMPD_target, OMPD_unknown /*enter/exit*/,
-   OMPD_unknown /*target enter/exit*/},
-  {OMPD_unknown /*target enter*/, OMPD_unknown /*data*/,
-   OMPD_target_enter_data},
-  {OMPD_unknown /*target exit*/, OMPD_unknown /*data*/,
-   OMPD_target_exit_data},
-  {OMPD_for, OMPD_simd, OMPD_for_simd},
-  {OMPD_parallel, OMPD_for, OMPD_parallel_for},
-  {OMPD_parallel_for, OMPD_simd, OMPD_parallel_for_simd},
-  {OMPD_parallel, OMPD_sections, OMPD_parallel_sections},
-  {OMPD_taskloop, OMPD_simd, OMPD_taskloop_simd},
-  {OMPD_target, OMPD_parallel, OMPD_target_parallel},
-  {OMPD_target_parallel, OMPD_for, OMPD_target_parallel_for}};
+  static const unsigned F[][3] = {
+{ OMPD_cancellation, OMPD_point, OMPD_cancellation_point },
+{ OMPD_target, OMPD_data, OMPD_target_data },
+{ OMPD_target, OMPD_enter, OMPD_target_enter },
+{ OMPD_target, OMPD_exit, OMPD_target_exit },
+{ OMPD_target_enter, OMPD_data, OMPD_target_enter_data },
+{ OMPD_target_exit, OMPD_data, OMPD_target_exit_data },
+{ OMPD_for, OMPD_simd, OMPD_for_simd },
+{ OMPD_parallel, OMPD_for, OMPD_parallel_for },
+{ OMPD_parallel_for, OMPD_simd, OMPD_parallel_for_simd },
+{ OMPD_parallel, OMPD_sections, OMPD_parallel_sections },
+{ OMPD_taskloop, OMPD_simd, OMPD_taskloop_simd },
+{ OMPD_target, OMPD_parallel, OMPD_target_parallel },
+{ OMPD_target_parallel, OMPD_for, OMPD_target_parallel_for }
+  };
   auto Tok = P.getCurToken();
-  auto DKind =
+  unsigned DKind =
   Tok.isAnnotation()
-  ? OMPD_unknown
-  : getOpenMPDirectiveKind(P.getPreprocessor().getSpelling(Tok));
+  ? static_cast(OMPD_unknown)
+  : getOpenMPDirectiveKindEx(P.getPreprocessor().getSpelling(Tok));
+  if (DKind == OMPD_unknown)
+return OMPD_unknown;
 
-  bool TokenMatched = false;
   for (unsigned i = 0; i < llvm::array_lengthof(F); ++i) {
-if (!Tok.isAnnotation() && DKind == OMPD_unknown) {
-  TokenMatched =
-  ((i == 0) &&
-   !P.getPreprocessor().getSpelling(Tok).compare("cancellation")) ||
-  ((i == 3) &&
-   !P.getPreprocessor().getSpelling(Tok).compare("enter")) ||
-  ((i == 4) && !P.getPreprocessor().getSpelling(Tok).compare("exit"));
-} else {
-  TokenMatched = DKind == F[i][0] && DKind != OMPD_unknown;
-}
+if (DKind != F[i][0])
+  continue;
 
-if (TokenMatched) {
-  Tok = P.getPreprocessor().LookAhead(0);
-  auto TokenIsAnnotation = Tok.isAnnotation();
-  auto SDKind =
-  TokenIsAnnotation
-  ? OMPD_unknown
-  : getOpenMPDirectiveKind(P.getPreprocessor().getSpelling(Tok));
-
-  if (!TokenIsAnnotation && SDKind == OMPD_unknown) {
-TokenMatched =
-((i == 0) &&
- !P.getPreprocessor().getSpelling(Tok).compare("point")) ||
-((i == 1 || i == 3 || i == 4) &&
- !P.getPreprocessor().getSpelling(Tok).compare("data")) ||
-((i == 2) &&
- (!P.getPreprocessor().getSpelling(Tok).compare("enter") ||
-  !P.getPreprocessor().getSpelling(Tok).compa

r260811 - [OPENMP] NFC rewrite ParseOpenMPDirectiveKind

2016-02-12 Thread Dmitry Polukhin via cfe-commits
Author: dpolukhin
Date: Sat Feb 13 00:53:38 2016
New Revision: 260811

URL: http://llvm.org/viewvc/llvm-project?rev=260811&view=rev
Log:
[OPENMP] NFC rewrite ParseOpenMPDirectiveKind

New implementation is easier to read and extend.

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

Modified:
cfe/trunk/lib/Parse/ParseOpenMP.cpp

Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=260811&r1=260810&r2=260811&view=diff
==
--- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original)
+++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Sat Feb 13 00:53:38 2016
@@ -26,74 +26,80 @@ using namespace clang;
 // OpenMP declarative directives.
 
//===--===//
 
+namespace {
+enum OpenMPDirectiveKindEx {
+  OMPD_cancellation = OMPD_unknown + 1,
+  OMPD_data,
+  OMPD_enter,
+  OMPD_exit,
+  OMPD_point,
+  OMPD_target_enter,
+  OMPD_target_exit
+};
+} // namespace
+
+// Map token string to extended OMP token kind that are
+// OpenMPDirectiveKind + OpenMPDirectiveKindEx.
+static unsigned getOpenMPDirectiveKindEx(StringRef S) {
+  auto DKind = getOpenMPDirectiveKind(S);
+  if (DKind != OMPD_unknown)
+return DKind;
+
+  return llvm::StringSwitch(S)
+  .Case("cancellation", OMPD_cancellation)
+  .Case("data", OMPD_data)
+  .Case("enter", OMPD_enter)
+  .Case("exit", OMPD_exit)
+  .Case("point", OMPD_point)
+  .Default(OMPD_unknown);
+}
+
 static OpenMPDirectiveKind ParseOpenMPDirectiveKind(Parser &P) {
   // Array of foldings: F[i][0] F[i][1] ===> F[i][2].
   // E.g.: OMPD_for OMPD_simd ===> OMPD_for_simd
   // TODO: add other combined directives in topological order.
-  const OpenMPDirectiveKind F[][3] = {
-  {OMPD_unknown /*cancellation*/, OMPD_unknown /*point*/,
-   OMPD_cancellation_point},
-  {OMPD_target, OMPD_unknown /*data*/, OMPD_target_data},
-  {OMPD_target, OMPD_unknown /*enter/exit*/,
-   OMPD_unknown /*target enter/exit*/},
-  {OMPD_unknown /*target enter*/, OMPD_unknown /*data*/,
-   OMPD_target_enter_data},
-  {OMPD_unknown /*target exit*/, OMPD_unknown /*data*/,
-   OMPD_target_exit_data},
-  {OMPD_for, OMPD_simd, OMPD_for_simd},
-  {OMPD_parallel, OMPD_for, OMPD_parallel_for},
-  {OMPD_parallel_for, OMPD_simd, OMPD_parallel_for_simd},
-  {OMPD_parallel, OMPD_sections, OMPD_parallel_sections},
-  {OMPD_taskloop, OMPD_simd, OMPD_taskloop_simd},
-  {OMPD_target, OMPD_parallel, OMPD_target_parallel},
-  {OMPD_target_parallel, OMPD_for, OMPD_target_parallel_for}};
+  static const unsigned F[][3] = {
+{ OMPD_cancellation, OMPD_point, OMPD_cancellation_point },
+{ OMPD_target, OMPD_data, OMPD_target_data },
+{ OMPD_target, OMPD_enter, OMPD_target_enter },
+{ OMPD_target, OMPD_exit, OMPD_target_exit },
+{ OMPD_target_enter, OMPD_data, OMPD_target_enter_data },
+{ OMPD_target_exit, OMPD_data, OMPD_target_exit_data },
+{ OMPD_for, OMPD_simd, OMPD_for_simd },
+{ OMPD_parallel, OMPD_for, OMPD_parallel_for },
+{ OMPD_parallel_for, OMPD_simd, OMPD_parallel_for_simd },
+{ OMPD_parallel, OMPD_sections, OMPD_parallel_sections },
+{ OMPD_taskloop, OMPD_simd, OMPD_taskloop_simd },
+{ OMPD_target, OMPD_parallel, OMPD_target_parallel },
+{ OMPD_target_parallel, OMPD_for, OMPD_target_parallel_for }
+  };
   auto Tok = P.getCurToken();
-  auto DKind =
+  unsigned DKind =
   Tok.isAnnotation()
-  ? OMPD_unknown
-  : getOpenMPDirectiveKind(P.getPreprocessor().getSpelling(Tok));
+  ? static_cast(OMPD_unknown)
+  : getOpenMPDirectiveKindEx(P.getPreprocessor().getSpelling(Tok));
+  if (DKind == OMPD_unknown)
+return OMPD_unknown;
 
-  bool TokenMatched = false;
   for (unsigned i = 0; i < llvm::array_lengthof(F); ++i) {
-if (!Tok.isAnnotation() && DKind == OMPD_unknown) {
-  TokenMatched =
-  ((i == 0) &&
-   !P.getPreprocessor().getSpelling(Tok).compare("cancellation")) ||
-  ((i == 3) &&
-   !P.getPreprocessor().getSpelling(Tok).compare("enter")) ||
-  ((i == 4) && !P.getPreprocessor().getSpelling(Tok).compare("exit"));
-} else {
-  TokenMatched = DKind == F[i][0] && DKind != OMPD_unknown;
-}
+if (DKind != F[i][0])
+  continue;
 
-if (TokenMatched) {
-  Tok = P.getPreprocessor().LookAhead(0);
-  auto TokenIsAnnotation = Tok.isAnnotation();
-  auto SDKind =
-  TokenIsAnnotation
-  ? OMPD_unknown
-  : getOpenMPDirectiveKind(P.getPreprocessor().getSpelling(Tok));
-
-  if (!TokenIsAnnotation && SDKind == OMPD_unknown) {
-TokenMatched =
-((i == 0) &&
- !P.getPreprocessor().getSpelling(Tok).compare("point")) ||
-((i == 1 || i == 3 || i == 4) &&
- !P.getPreprocessor().getSpelling(Tok).

r260807 - [index] Change some default parameters to fix an MSVC ICE.

2016-02-12 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Fri Feb 12 23:17:15 2016
New Revision: 260807

URL: http://llvm.org/viewvc/llvm-project?rev=260807&view=rev
Log:
[index] Change some default parameters to fix an MSVC ICE.

Many thanks to Yunzhong Gao for tracking this down!

Modified:
cfe/trunk/lib/Index/IndexingContext.h

Modified: cfe/trunk/lib/Index/IndexingContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexingContext.h?rev=260807&r1=260806&r2=260807&view=diff
==
--- cfe/trunk/lib/Index/IndexingContext.h (original)
+++ cfe/trunk/lib/Index/IndexingContext.h Fri Feb 12 23:17:15 2016
@@ -62,18 +62,18 @@ public:
   static bool isTemplateImplicitInstantiation(const Decl *D);
 
   bool handleDecl(const Decl *D, SymbolRoleSet Roles = SymbolRoleSet(),
-  ArrayRef Relations = {});
+  ArrayRef Relations = None);
 
   bool handleDecl(const Decl *D, SourceLocation Loc,
   SymbolRoleSet Roles = SymbolRoleSet(),
-  ArrayRef Relations = {},
+  ArrayRef Relations = None,
   const DeclContext *DC = nullptr);
 
   bool handleReference(const NamedDecl *D, SourceLocation Loc,
const NamedDecl *Parent,
const DeclContext *DC,
SymbolRoleSet Roles,
-   ArrayRef Relations = {},
+   ArrayRef Relations = None,
const Expr *RefE = nullptr,
const Decl *RefD = nullptr);
 


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


Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-12 Thread Jorge Teixeira via cfe-commits
Hi,

I decided to strike while the iron was hot and add the remaining tests
for float.h.

1) clang was missing the C11 mandatory *_HAS_SUBNORM macros, so I
added them. The internal underscored versions are *_HAS_DENORM, and
the Std. defines only "subnormal" and "unnormalized", so there could
be, in theory, a discrepancy. I tried to learn more about APfloat
supported types (IEEEsingle,PPCDoubleDouble,etc.) and how the
underscored macros are generated in
/lib/Preprocessor/InitPreprocessor.cpp, but it was inconclusive
whether *_HAS_DENORM was added to mean subnormal like C11 expects, or
not normalized. If the former, all is good, if the latter, my patch is
wrong and C11 compliance is not achieved - the solution would be to
study all supported fp implementations and add a new macro stating
only the subnormal capabilities.

2) FLT_EVAL_METHOD was only introduced in C99, so I changed float.h
and float.c to reflect that.

3) To help ensure that all macros were tested, I reordered them in
float.h and float.c to match the C11 section. This added a little
noise to this diff, but should be a one-off thing and simplify
maintenance if further tests or new macros are added in the future.

4) The tests for the remaining macros in float.h were added. I have
some reservations about the ones involving floating point literals
(*_MAX, *_EPSILON, *_MIN, *_TRUE_MIN) due to the conversions and
rounding among the types. Not sure how to improve them without making
assumptions and/or overcomplicating the test
(https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).

5) There were no meaningful fp changes in the Technical Corrigenda for
C89, so the current tests (c89,c99,c11) should suffice. Not sure if
gnuxx modes are affected, but I don't expect them to define
__STRICT_ANSI__, so all macros should be exposed and tested
successfully.


Cheers,

JT

On Fri, Feb 12, 2016 at 2:32 PM, Hubert Tong
 wrote:
> Committed as r260710.
>
>
> On Fri, Feb 12, 2016 at 9:53 AM, Hubert Tong
>  wrote:
>>
>> Thanks Jorge. I'll work on committing this today.
>>
>> -- HT
>>
>> On Fri, Feb 12, 2016 at 12:10 AM, Jorge Teixeira
>>  wrote:
>>>
>>> Hubert,
>>>
>>> Thanks for the code review. Over the weekend I'll try to learn a bit
>>> more about using Phabricator, but for now I'll reply here, and attach
>>> a new patch.
>>>
>>> a) *_MANT_DIG < 1 --> *_MANT_DIG < 2
>>> That is a stricter check and I agree with your rationale. Done.
>>>
>>> b) _MIN_EXP --> FLT_MIN_EXP
>>> Done.
>>>
>>> c) Remove _MIN_EXP and _MIN_10_EXP FLT,DBL,LDBL comparisons
>>> Yes, as you and Richard pointed out the added mantissa bits can
>>> compensate for the lack of increase of the exponent.
>>> Already fixed in http://reviews.llvm.org/rL260639.
>>>
>>> d) *_MAX_EXP and *_MIN_EXP 2,-2 --> 1,-1
>>> Done.
>>>
>>> Richard, will do re: single patch for multiple files. Also, can you
>>> close the bug report? Even if more tests for float.h get
>>> added/changed, the original problem has been solved.
>>>
>>> JT
>>>
>>>
>>> On Thu, Feb 11, 2016 at 8:38 PM, Hubert Tong
>>>  wrote:
>>> > Hi Jorge,
>>> >
>>> > I responded to the initial commit with some comments here:
>>> > http://reviews.llvm.org/rL260577
>>> >
>>> > -- HT
>>> >
>>> > On Thu, Feb 11, 2016 at 7:53 PM, Jorge Teixeira
>>> > 
>>> > wrote:
>>> >>
>>> >> > You'll also need to change  to only provide DECIMAL_DIG in
>>> >> > C99
>>> >> > onwards.
>>> >> Done!
>>> >>
>>> >> > All of our -std versions are that standard plus applicable Defect
>>> >> > Reports. So -std=c89 includes TC1 and TC2, but not Amendment 1 (we
>>> >> > have -std=c94 for that, but the only difference from our C89 mode is
>>> >> > the addition of digraphs).
>>> >> I'll try to find the c89 TC2 and check if anything changed regarding
>>> >> these macros (unlikely).
>>> >>
>>> >> > __STRICT_ANSI__ is defined if Clang has not been asked to provide
>>> >> > extensions (either GNU extensions, perhaps via a flag like
>>> >> > -std=gnu99,
>>> >> > or MS extensions), and is used by C library headers to determine
>>> >> > that
>>> >> > they should provide a strictly-conforming set of declarations
>>> >> > without
>>> >> > extensions.
>>> >> Ok, so if !defined(__STRICT__ANSI__) clang should always expose "as
>>> >> much as possible", including stuff from later versions of the Std.
>>> >> and/or eventual extensions, just as it now on float.h and float.c,
>>> >> right?
>>> >>
>>> >> > Testing __STDC_VERSION__ for C94 makes sense if you're trying to
>>> >> > detect whether Amendment 1 features should be provided.
>>> >> Since this will affect only digraphs, I guess there is no need (for
>>> >> float.h, float.c).
>>> >>
>>> >> >> 3) Lastly, can you expand (...)
>>> >> >
>>> >> > No, it does not mean that.
>>> >> >
>>> >> > For PPC64, long double is (sometimes) modeled as a pair of doubles.
>>> >> > Under that model, the smallest normalized value for long double is
>>> >> > actually larger than the smallest normalized value for double
>>> >> >

r260802 - libclang/CMakeLists.txt: Prune IndexingContext.h out of ADDITIONAL_HEADERS. VS IDE uses it.

2016-02-12 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Fri Feb 12 22:01:49 2016
New Revision: 260802

URL: http://llvm.org/viewvc/llvm-project?rev=260802&view=rev
Log:
libclang/CMakeLists.txt: Prune IndexingContext.h out of ADDITIONAL_HEADERS. VS 
IDE uses it.

Modified:
cfe/trunk/tools/libclang/CMakeLists.txt

Modified: cfe/trunk/tools/libclang/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CMakeLists.txt?rev=260802&r1=260801&r2=260802&view=diff
==
--- cfe/trunk/tools/libclang/CMakeLists.txt (original)
+++ cfe/trunk/tools/libclang/CMakeLists.txt Fri Feb 12 22:01:49 2016
@@ -30,7 +30,6 @@ set(SOURCES
   CXTranslationUnit.h
   CXType.h
   Index_Internal.h
-  IndexingContext.h
   ../../include/clang-c/Index.h
   )
 


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


Re: [PATCH] D17148: [OPENMP] Basic teams directive implementation

2016-02-12 Thread Carlo Bertolli via cfe-commits
carlo.bertolli updated this revision to Diff 47890.
carlo.bertolli added a comment.

Apply changes to reflect review: have a single emit outlined function call for 
both parallel and teams; call push_num_teams outside of runtime class.


http://reviews.llvm.org/D17148

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

Index: test/OpenMP/teams_codegen.cpp
===
--- test/OpenMP/teams_codegen.cpp
+++ test/OpenMP/teams_codegen.cpp
@@ -208,4 +208,142 @@
 
 }
 #endif // CK3
+
+// Test target codegen - host bc file has to be created first.
+// RUN: %clang_cc1 -DCK4 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-llvm-bc %s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -DCK4 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-llvm %s -fopenmp-is-device -omp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CK4 --check-prefix CK4-64
+// RUN: %clang_cc1 -DCK4 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-pch -fopenmp-is-device -omp-host-ir-file-path %t-ppc-host.bc -o %t %s
+// RUN: %clang_cc1 -DCK4 -fopenmp -x c++ -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -std=c++11 -fopenmp-is-device -omp-host-ir-file-path %t-ppc-host.bc -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK4 --check-prefix CK4-64
+// RUN: %clang_cc1 -DCK4 -verify -fopenmp -x c++ -triple i386-unknown-unknown -omptargets=i386-pc-linux-gnu -emit-llvm-bc %s -o %t-x86-host.bc
+// RUN: %clang_cc1 -DCK4 -verify -fopenmp -x c++ -triple i386-unknown-unknown -omptargets=i386-pc-linux-gnu -emit-llvm %s -fopenmp-is-device -omp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CK4 --check-prefix CK4-32
+// RUN: %clang_cc1 -DCK4 -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -omptargets=i386-pc-linux-gnu -emit-pch -fopenmp-is-device -omp-host-ir-file-path %t-x86-host.bc -o %t %s
+// RUN: %clang_cc1 -DCK4 -fopenmp -x c++ -triple i386-unknown-unknown -omptargets=i386-pc-linux-gnu -std=c++11 -fopenmp-is-device -omp-host-ir-file-path %t-x86-host.bc -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK4 --check-prefix CK4-32
+
+#ifdef CK4
+
+// CK4-DAG: %ident_t = type { i32, i32, i32, i32, i8* }
+// CK4-DAG: [[STR:@.+]] = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00"
+// CK4-DAG: [[DEF_LOC_0:@.+]] = private unnamed_addr constant %ident_t { i32 0, i32 2, i32 0, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* [[STR]], i32 0, i32 0) }
+// CK4-DEBUG-DAG: [[LOC1:@.+]] = private unnamed_addr constant [{{.+}} x i8] c";{{.*}}teams_codegen.cpp;main;[[@LINE+14]];9;;\00"
+// CK4-DEBUG-DAG: [[LOC2:@.+]] = private unnamed_addr constant [{{.+}} x i8] c";{{.*}}teams_codegen.cpp;tmain;[[@LINE+7]];9;;\00"
+
+template 
+int tmain(T argc) {
+#pragma omp target
+#pragma omp teams
+  argc = 0;
+  return 0;
+}
+
+int main (int argc, char **argv) {
+#pragma omp target
+#pragma omp teams
+  argc = 0;
+  return tmain(argv);
+}
+
+// CK4:  define {{.*}}void @{{[^,]+}}(i{{.+}} %[[ARGC:.+]])
+// CK4:  [[ARGCADDR:%.+]] = alloca i{{.+}}
+// CK4:  store i{{.+}} %[[ARGC]], i{{.+}}* [[ARGCADDR]]
+// CK4-64:  [[CONV:%.+]] = bitcast i64* [[ARGCADDR]] to i32*
+// CK4-64:  call {{.*}}void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_teams(%ident_t* [[DEF_LOC_0]], i32 1, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, i32*)* {{.+}} to void (i32*, i32*, ...)*), i32* [[CONV]])
+// CK4-32:  call {{.*}}void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_teams(%ident_t* [[DEF_LOC_0]], i32 1, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, i32*)* {{.+}} to void (i32*, i32*, ...)*), i32* [[ARGCADDR]])
+// CK4:  ret void
+// CK4-NEXT: }
+
+// CK4:  define {{.*}}void @{{[^,]+}}(i8*** dereferenceable({{.}}) [[ARGC1:%.+]])
+// CK4:  [[ARGCADDR1:%.+]] = alloca i8***
+// CK4:  store i8*** [[ARGC1]], i8 [[ARGCADDR1]]
+// CK4:  [[CONV1:%.+]] = load i8***, i8 [[ARGCADDR1]]
+// CK4:  call {{.*}}void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_teams(%ident_t* [[DEF_LOC_0]], i32 1, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, i8***)* {{.+}} to void (i32*, i32*, ...)*), i8*** [[CONV1]])
+
+
+#endif // CK4
+
+// Test target codegen - host bc file has to be created first.
+// RUN: %clang_cc1 -DCK5 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-llvm-bc %s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -DCK5 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-llvm %s -fopenmp-is-device -omp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CK5 --check-prefix CK5-64
+// RUN: %clang_cc1 -DCK5 -fo

Re: [PATCH] D17148: [OPENMP] Basic teams directive implementation

2016-02-12 Thread Carlo Bertolli via cfe-commits
carlo.bertolli marked 2 inline comments as done.
carlo.bertolli added a comment.

I applied your suggestions and generated a new diff file.
Thanks!


http://reviews.llvm.org/D17148



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


Re: [PATCH] D17206: Fix AST printing of ascii char literals above 127.

2016-02-12 Thread Steven Watanabe via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL260795: Fix the ASTPrinter output for ascii char literals 
>127. (authored by steven_watanabe).

Changed prior to commit:
  http://reviews.llvm.org/D17206?vs=47822&id=47887#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17206

Files:
  cfe/trunk/lib/AST/StmtPrinter.cpp
  cfe/trunk/test/Misc/ast-print-char-literal.cpp

Index: cfe/trunk/test/Misc/ast-print-char-literal.cpp
===
--- cfe/trunk/test/Misc/ast-print-char-literal.cpp
+++ cfe/trunk/test/Misc/ast-print-char-literal.cpp
@@ -13,6 +13,8 @@
   h();
 }
 
+char j = '\xFF';
+
 // CHECK: char c = u8'1';
 // CHECK-NEXT: char d = '1';
 // CHECK-NEXT: char e = U'1';
@@ -22,3 +24,4 @@
 // CHECK: template 
 
 // CHECK: h();
+// CHECK: char j = '\xff';
Index: cfe/trunk/lib/AST/StmtPrinter.cpp
===
--- cfe/trunk/lib/AST/StmtPrinter.cpp
+++ cfe/trunk/lib/AST/StmtPrinter.cpp
@@ -1250,6 +1250,12 @@
 OS << "'\\v'";
 break;
   default:
+// A character literal might be sign-extended, which
+// would result in an invalid \U escape sequence.
+// FIXME: multicharacter literals such as '\xFF\xFF\xFF\xFF'
+// are not correctly handled.
+if ((value & ~0xFFu) == ~0xFFu && Node->getKind() == 
CharacterLiteral::Ascii)
+  value &= 0xFFu;
 if (value < 256 && isPrintable((unsigned char)value))
   OS << "'" << (char)value << "'";
 else if (value < 256)


Index: cfe/trunk/test/Misc/ast-print-char-literal.cpp
===
--- cfe/trunk/test/Misc/ast-print-char-literal.cpp
+++ cfe/trunk/test/Misc/ast-print-char-literal.cpp
@@ -13,6 +13,8 @@
   h();
 }
 
+char j = '\xFF';
+
 // CHECK: char c = u8'1';
 // CHECK-NEXT: char d = '1';
 // CHECK-NEXT: char e = U'1';
@@ -22,3 +24,4 @@
 // CHECK: template 
 
 // CHECK: h();
+// CHECK: char j = '\xff';
Index: cfe/trunk/lib/AST/StmtPrinter.cpp
===
--- cfe/trunk/lib/AST/StmtPrinter.cpp
+++ cfe/trunk/lib/AST/StmtPrinter.cpp
@@ -1250,6 +1250,12 @@
 OS << "'\\v'";
 break;
   default:
+// A character literal might be sign-extended, which
+// would result in an invalid \U escape sequence.
+// FIXME: multicharacter literals such as '\xFF\xFF\xFF\xFF'
+// are not correctly handled.
+if ((value & ~0xFFu) == ~0xFFu && Node->getKind() == CharacterLiteral::Ascii)
+  value &= 0xFFu;
 if (value < 256 && isPrintable((unsigned char)value))
   OS << "'" << (char)value << "'";
 else if (value < 256)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r260795 - Fix the ASTPrinter output for ascii char literals >127.

2016-02-12 Thread Steven Watanabe via cfe-commits
Author: steven_watanabe
Date: Fri Feb 12 20:31:28 2016
New Revision: 260795

URL: http://llvm.org/viewvc/llvm-project?rev=260795&view=rev
Log:
Fix the ASTPrinter output for ascii char literals >127.

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

Modified:
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/test/Misc/ast-print-char-literal.cpp

Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=260795&r1=260794&r2=260795&view=diff
==
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Fri Feb 12 20:31:28 2016
@@ -1250,6 +1250,12 @@ void StmtPrinter::VisitCharacterLiteral(
 OS << "'\\v'";
 break;
   default:
+// A character literal might be sign-extended, which
+// would result in an invalid \U escape sequence.
+// FIXME: multicharacter literals such as '\xFF\xFF\xFF\xFF'
+// are not correctly handled.
+if ((value & ~0xFFu) == ~0xFFu && Node->getKind() == 
CharacterLiteral::Ascii)
+  value &= 0xFFu;
 if (value < 256 && isPrintable((unsigned char)value))
   OS << "'" << (char)value << "'";
 else if (value < 256)

Modified: cfe/trunk/test/Misc/ast-print-char-literal.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/ast-print-char-literal.cpp?rev=260795&r1=260794&r2=260795&view=diff
==
--- cfe/trunk/test/Misc/ast-print-char-literal.cpp (original)
+++ cfe/trunk/test/Misc/ast-print-char-literal.cpp Fri Feb 12 20:31:28 2016
@@ -13,6 +13,8 @@ void i() {
   h();
 }
 
+char j = '\xFF';
+
 // CHECK: char c = u8'1';
 // CHECK-NEXT: char d = '1';
 // CHECK-NEXT: char e = U'1';
@@ -22,3 +24,4 @@ void i() {
 // CHECK: template 
 
 // CHECK: h();
+// CHECK: char j = '\xff';


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


Re: [PATCH] D17166: [Sema] More changes to fix Objective-C fallout from r249995.

2016-02-12 Thread Bob Wilson via cfe-commits
bob.wilson closed this revision.
bob.wilson marked an inline comment as done.
bob.wilson added a comment.

Committed in r260787.

I had previously missed a regression in one of the existing ovl-check.m tests. 
The testTakesCFTypeRef function was checking that the CFTypeRef overload was 
selected. However, that does not match the behavior prior to r249995, where 
neither overload candidate is chosen as the "best match" and clang falls back 
to using the first one. With my change here, the previous behavior is restored. 
I reordered the two overload candidates in the test to match that. While I was 
at it, I also merged my "Type2" typedef with the existing CFTypeRef in the test.



Comment at: lib/Sema/SemaExpr.cpp:7580
@@ +7579,3 @@
+  if (Diagnose) {
+// If an error was diagnosed here, replace the expression with a
+// corrected version and continue so we can find further errors.

george.burgess.iv wrote:
> Because we're doing a similar thing at line 7573 (not necessarily replacing 
> an expression, but still answering differently depending on the value of 
> `Diagnose`), can we either put a similar comment there, or make this comment 
> a bit more general and move it above `if (getLangOpts().ObjCAutoRefCount && 
> [...]`?
Good idea. I'm going to put a comment above the "if" but I'll also leave 
something to explain why the expression is replaced. (I'm also going to change 
those "result = Incompatible" lines to just return, since there is no point in 
continuing with further checks if we're not reporting the diagnostics anyway.)


http://reviews.llvm.org/D17166



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


Re: [PATCH] D15095: Accept "-Weverything" in pragma clang diagnostic ...

2016-02-12 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL260788: Accept "-Weverything" in clang diagnistic pragmas 
(authored by ssrivastava).

Changed prior to commit:
  http://reviews.llvm.org/D15095?vs=47866&id=47881#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15095

Files:
  cfe/trunk/lib/Lex/Pragma.cpp
  cfe/trunk/test/Preprocessor/Weverything_pragma.c
  cfe/trunk/test/Preprocessor/pragma_diagnostic.c
  cfe/trunk/test/Preprocessor/pushable-diagnostics.c

Index: cfe/trunk/test/Preprocessor/pragma_diagnostic.c
===
--- cfe/trunk/test/Preprocessor/pragma_diagnostic.c
+++ cfe/trunk/test/Preprocessor/pragma_diagnostic.c
@@ -30,3 +30,18 @@
 
 #pragma GCC diagnostic error "-Winvalid-name"  // expected-warning {{unknown warning group '-Winvalid-name', ignored}}
 
+
+// Testing pragma clang diagnostic with -Weverything
+void ppo(){} // First test that we do not diagnose on this.
+
+#pragma clang diagnostic warning "-Weverything"
+void ppp(){} // expected-warning {{no previous prototype for function 'ppp'}}
+
+#pragma clang diagnostic ignored "-Weverything" // Reset it.
+void ppq(){}
+
+#pragma clang diagnostic error "-Weverything" // Now set to error
+void ppr(){} // expected-error {{no previous prototype for function 'ppr'}}
+
+#pragma clang diagnostic warning "-Weverything" // This should not be effective
+void pps(){} // expected-error {{no previous prototype for function 'pps'}}
Index: cfe/trunk/test/Preprocessor/pushable-diagnostics.c
===
--- cfe/trunk/test/Preprocessor/pushable-diagnostics.c
+++ cfe/trunk/test/Preprocessor/pushable-diagnostics.c
@@ -15,3 +15,27 @@
 int c = 'df';  // expected-warning{{multi-character character constant}}
 
 #pragma clang diagnostic pop // expected-warning{{pragma diagnostic pop could not pop, no matching push}}
+
+// Test -Weverything
+
+void ppo0(){} // first verify that we do not give anything on this
+#pragma clang diagnostic push // now push
+
+#pragma clang diagnostic warning "-Weverything" 
+void ppr1(){} // expected-warning {{no previous prototype for function 'ppr1'}}
+
+#pragma clang diagnostic push // push again
+#pragma clang diagnostic ignored "-Weverything"  // Set to ignore in this level.
+void pps2(){}
+#pragma clang diagnostic warning "-Weverything"  // Set to warning in this level.
+void ppt2(){} // expected-warning {{no previous prototype for function 'ppt2'}}
+#pragma clang diagnostic error "-Weverything"  // Set to error in this level.
+void ppt3(){} // expected-error {{no previous prototype for function 'ppt3'}}
+#pragma clang diagnostic pop // pop should go back to warning level
+
+void pps1(){} // expected-warning {{no previous prototype for function 'pps1'}}
+
+
+#pragma clang diagnostic pop // Another pop should disble it again
+void ppu(){}
+
Index: cfe/trunk/test/Preprocessor/Weverything_pragma.c
===
--- cfe/trunk/test/Preprocessor/Weverything_pragma.c
+++ cfe/trunk/test/Preprocessor/Weverything_pragma.c
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -Weverything   -fsyntax-only -verify %s
+
+// Test that the pragma overrides command line option -Weverythings,
+
+// a diagnostic with DefaultIgnore. This is part of a group 'unused-macro'
+// but -Weverything forces it
+#define UNUSED_MACRO1 1 // expected-warning{{macro is not used}}
+
+void foo() // expected-warning {{no previous prototype for function}}
+{
+ // A diagnostic without DefaultIgnore, and not part of a group.
+ (void) L'ab'; // expected-warning {{extraneous characters in character constant ignored}}
+
+#pragma clang diagnostic warning "-Weverything" // Should not change anyhting.
+#define UNUSED_MACRO2 1 // expected-warning{{macro is not used}}
+ (void) L'cd'; // expected-warning {{extraneous characters in character constant ignored}}
+
+#pragma clang diagnostic ignored "-Weverything" // Ignore warnings now.
+#define UNUSED_MACRO2 1 // no warning
+ (void) L'ef'; // no warning here
+
+#pragma clang diagnostic warning "-Weverything" // Revert back to warnings.
+#define UNUSED_MACRO3 1 // expected-warning{{macro is not used}}
+ (void) L'gh'; // expected-warning {{extraneous characters in character constant ignored}}
+
+#pragma clang diagnostic error "-Weverything"  // Give errors now.
+#define UNUSED_MACRO4 1 // expected-error{{macro is not used}}
+ (void) L'ij'; // expected-error {{extraneous characters in character constant ignored}}
+}
Index: cfe/trunk/lib/Lex/Pragma.cpp
===
--- cfe/trunk/lib/Lex/Pragma.cpp
+++ cfe/trunk/lib/Lex/Pragma.cpp
@@ -1024,10 +1024,19 @@
   return;
 }
 
-if (PP.getDiagnostics().setSeverityForGroup(
-WarningName[1] == 'W' ? diag::Flavor::WarningOrError
-  : diag::Flavor::Remark,
-WarningName.substr(2), SV, D

r260788 - Accept "-Weverything" in clang diagnistic pragmas

2016-02-12 Thread Sunil Srivastava via cfe-commits
Author: ssrivastava
Date: Fri Feb 12 19:44:05 2016
New Revision: 260788

URL: http://llvm.org/viewvc/llvm-project?rev=260788&view=rev
Log:
Accept "-Weverything" in clang diagnistic pragmas

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

Added:
cfe/trunk/test/Preprocessor/Weverything_pragma.c
Modified:
cfe/trunk/lib/Lex/Pragma.cpp
cfe/trunk/test/Preprocessor/pragma_diagnostic.c
cfe/trunk/test/Preprocessor/pushable-diagnostics.c

Modified: cfe/trunk/lib/Lex/Pragma.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Pragma.cpp?rev=260788&r1=260787&r2=260788&view=diff
==
--- cfe/trunk/lib/Lex/Pragma.cpp (original)
+++ cfe/trunk/lib/Lex/Pragma.cpp Fri Feb 12 19:44:05 2016
@@ -1024,10 +1024,19 @@ public:
   return;
 }
 
-if (PP.getDiagnostics().setSeverityForGroup(
-WarningName[1] == 'W' ? diag::Flavor::WarningOrError
-  : diag::Flavor::Remark,
-WarningName.substr(2), SV, DiagLoc))
+diag::Flavor Flavor = WarningName[1] == 'W' ? diag::Flavor::WarningOrError
+: diag::Flavor::Remark;
+StringRef Group = WarningName.substr(2);
+bool unknownDiag = false;
+if (Group == "everything") {
+  // Special handling for pragma clang diagnostic ... "-Weverything".
+  // There is no formal group named "everything", so there has to be a
+  // special case for it.
+  PP.getDiagnostics().setSeverityForAll(Flavor, SV, DiagLoc);
+} else
+  unknownDiag = PP.getDiagnostics().setSeverityForGroup(Flavor, Group, SV,
+DiagLoc);
+if (unknownDiag)
   PP.Diag(StringLoc, diag::warn_pragma_diagnostic_unknown_warning)
 << WarningName;
 else if (Callbacks)

Added: cfe/trunk/test/Preprocessor/Weverything_pragma.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/Weverything_pragma.c?rev=260788&view=auto
==
--- cfe/trunk/test/Preprocessor/Weverything_pragma.c (added)
+++ cfe/trunk/test/Preprocessor/Weverything_pragma.c Fri Feb 12 19:44:05 2016
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -Weverything   -fsyntax-only -verify %s
+
+// Test that the pragma overrides command line option -Weverythings,
+
+// a diagnostic with DefaultIgnore. This is part of a group 'unused-macro'
+// but -Weverything forces it
+#define UNUSED_MACRO1 1 // expected-warning{{macro is not used}}
+
+void foo() // expected-warning {{no previous prototype for function}}
+{
+ // A diagnostic without DefaultIgnore, and not part of a group.
+ (void) L'ab'; // expected-warning {{extraneous characters in character 
constant ignored}}
+
+#pragma clang diagnostic warning "-Weverything" // Should not change anyhting.
+#define UNUSED_MACRO2 1 // expected-warning{{macro is not used}}
+ (void) L'cd'; // expected-warning {{extraneous characters in character 
constant ignored}}
+
+#pragma clang diagnostic ignored "-Weverything" // Ignore warnings now.
+#define UNUSED_MACRO2 1 // no warning
+ (void) L'ef'; // no warning here
+
+#pragma clang diagnostic warning "-Weverything" // Revert back to warnings.
+#define UNUSED_MACRO3 1 // expected-warning{{macro is not used}}
+ (void) L'gh'; // expected-warning {{extraneous characters in character 
constant ignored}}
+
+#pragma clang diagnostic error "-Weverything"  // Give errors now.
+#define UNUSED_MACRO4 1 // expected-error{{macro is not used}}
+ (void) L'ij'; // expected-error {{extraneous characters in character constant 
ignored}}
+}

Modified: cfe/trunk/test/Preprocessor/pragma_diagnostic.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/pragma_diagnostic.c?rev=260788&r1=260787&r2=260788&view=diff
==
--- cfe/trunk/test/Preprocessor/pragma_diagnostic.c (original)
+++ cfe/trunk/test/Preprocessor/pragma_diagnostic.c Fri Feb 12 19:44:05 2016
@@ -30,3 +30,18 @@
 
 #pragma GCC diagnostic error "-Winvalid-name"  // expected-warning {{unknown 
warning group '-Winvalid-name', ignored}}
 
+
+// Testing pragma clang diagnostic with -Weverything
+void ppo(){} // First test that we do not diagnose on this.
+
+#pragma clang diagnostic warning "-Weverything"
+void ppp(){} // expected-warning {{no previous prototype for function 'ppp'}}
+
+#pragma clang diagnostic ignored "-Weverything" // Reset it.
+void ppq(){}
+
+#pragma clang diagnostic error "-Weverything" // Now set to error
+void ppr(){} // expected-error {{no previous prototype for function 'ppr'}}
+
+#pragma clang diagnostic warning "-Weverything" // This should not be effective
+void pps(){} // expected-error {{no previous prototype for function 'pps'}}

Modified: cfe/trunk/test/Preprocessor/pushable-diagnostics.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Prepr

r260787 - [Sema] More changes to fix Objective-C fallout from r249995.

2016-02-12 Thread Bob Wilson via cfe-commits
Author: bwilson
Date: Fri Feb 12 19:41:41 2016
New Revision: 260787

URL: http://llvm.org/viewvc/llvm-project?rev=260787&view=rev
Log:
[Sema] More changes to fix Objective-C fallout from r249995.

This is a follow-up to PR26085. That was fixed in r257710 but the testcase
there was incomplete. There is a related issue where the overload resolution
for Objective-C incorrectly picks a method that is not valid without a
bridge cast. The call to Sema::CheckSingleAssignmentConstraints that was
added to SemaOverload.cpp's IsStandardConversion() function does not catch
that case and reports that the method is Compatible even when it is not.

The root cause here is that various Objective-C-related functions in Sema
do not consistently return a value to indicate whether there was an error.
This was fine in the past because they would report diagnostics when needed,
but r257710 changed them to suppress reporting diagnostics when checking
during overload resolution.

This patch adds a new ACR_error result to the ARCConversionResult enum and
updates Sema::CheckObjCARCConversion to return that value when there is an
error. Most of the calls to that function do not check the return value,
so adding this new result does not affect them. The one exception is in
SemaCast.cpp where it specifically checks for ACR_unbridged, so that is
also OK. The call in Sema::CheckSingleAssignmentConstraints can then check
for an ACR_okay result and identify assignments as Incompatible. To
preserve the existing behavior, it only changes the return value to
Incompatible when the new Diagnose argument (from r257710) is false.

Similarly, the CheckObjCBridgeRelatedConversions and
ConversionToObjCStringLiteralCheck need to identify when an assignment is
Incompatible. Those functions already return appropriate values but they
need some fixes related to the new Diagnose argument.

Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/test/SemaObjC/ovl-check.m

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=260787&r1=260786&r2=260787&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Feb 12 19:41:41 2016
@@ -8654,7 +8654,7 @@ public:
 Expr *CastExpr,
 SourceLocation RParenLoc);
 
-  enum ARCConversionResult { ACR_okay, ACR_unbridged };
+  enum ARCConversionResult { ACR_okay, ACR_unbridged, ACR_error };
 
   /// \brief Checks for invalid conversions and casts between
   /// retainable pointers and other pointer kinds.

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=260787&r1=260786&r2=260787&view=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Feb 12 19:41:41 2016
@@ -7566,13 +7566,24 @@ Sema::CheckSingleAssignmentConstraints(Q
   if (result != Incompatible && RHS.get()->getType() != LHSType) {
 QualType Ty = LHSType.getNonLValueExprType(Context);
 Expr *E = RHS.get();
-if (getLangOpts().ObjCAutoRefCount)
-  CheckObjCARCConversion(SourceRange(), Ty, E, CCK_ImplicitConversion,
- Diagnose, DiagnoseCFAudited);
+
+// Check for various Objective-C errors. If we are not reporting
+// diagnostics and just checking for errors, e.g., during overload
+// resolution, return Incompatible to indicate the failure.
+if (getLangOpts().ObjCAutoRefCount &&
+CheckObjCARCConversion(SourceRange(), Ty, E, CCK_ImplicitConversion,
+   Diagnose, DiagnoseCFAudited) != ACR_okay) {
+  if (!Diagnose)
+return Incompatible;
+}
 if (getLangOpts().ObjC1 &&
 (CheckObjCBridgeRelatedConversions(E->getLocStart(), LHSType,
E->getType(), E, Diagnose) ||
  ConversionToObjCStringLiteralCheck(LHSType, E, Diagnose))) {
+  if (!Diagnose)
+return Incompatible;
+  // Replace the expression with a corrected version and continue so we
+  // can find further errors.
   RHS = E;
   return Compatible;
 }
@@ -12035,10 +12046,11 @@ bool Sema::ConversionToObjCStringLiteral
   StringLiteral *SL = dyn_cast(SrcExpr);
   if (!SL || !SL->isAscii())
 return false;
-  if (Diagnose)
+  if (Diagnose) {
 Diag(SL->getLocStart(), diag::err_missing_atsign_prefix)
   << FixItHint::CreateInsertion(SL->getLocStart(), "@");
-  Exp = BuildObjCStringLiteral(SL->getLocStart(), SL).get();
+Exp = BuildObjCStringLiteral(SL->getLocStart(), SL).get();
+  }
   return true;
 }
 

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: 
http://llvm.

r260785 - [RecursiveASTVisitor] Introduce dataTraverseStmtPre()/dataTraverseStmtPost() to allow clients to do before/after actions during data recursive visitation.

2016-02-12 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Fri Feb 12 19:24:19 2016
New Revision: 260785

URL: http://llvm.org/viewvc/llvm-project?rev=260785&view=rev
Log:
[RecursiveASTVisitor] Introduce dataTraverseStmtPre()/dataTraverseStmtPost() to 
allow clients to do before/after actions during data recursive visitation.

This should fix the asan bot that hits stack overflow in a couple of test/Index 
tests.

Modified:
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/lib/Index/IndexBody.cpp

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=260785&r1=260784&r2=260785&view=diff
==
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Fri Feb 12 19:24:19 2016
@@ -163,6 +163,18 @@ public:
   /// otherwise (including when the argument is nullptr).
   bool TraverseStmt(Stmt *S, DataRecursionQueue *Queue = nullptr);
 
+  /// Invoked before visiting a statement or expression via data recursion.
+  ///
+  /// \returns false to skip visiting the node, true otherwise.
+  bool dataTraverseStmtPre(Stmt *S) { return true; }
+
+  /// Invoked after visiting a statement or expression via data recursion.
+  /// This is not invoked if the previously invoked \c dataTraverseStmtPre
+  /// returned false.
+  ///
+  /// \returns false if the visitation was terminated early, true otherwise.
+  bool dataTraverseStmtPost(Stmt *S) { return true; }
+
   /// \brief Recursively visit a type, by dispatching to
   /// Traverse*Type() based on the argument's getTypeClass() property.
   ///
@@ -557,7 +569,10 @@ bool RecursiveASTVisitor::Trave
 Stmt *CurrS = LocalQueue.pop_back_val();
 
 size_t N = LocalQueue.size();
-TRY_TO(dataTraverseNode(CurrS, &LocalQueue));
+if (getDerived().dataTraverseStmtPre(CurrS)) {
+  TRY_TO(dataTraverseNode(CurrS, &LocalQueue));
+  TRY_TO(dataTraverseStmtPost(CurrS));
+}
 // Process new children in the order they were added.
 std::reverse(LocalQueue.begin() + N, LocalQueue.end());
   }

Modified: cfe/trunk/lib/Index/IndexBody.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexBody.cpp?rev=260785&r1=260784&r2=260785&view=diff
==
--- cfe/trunk/lib/Index/IndexBody.cpp (original)
+++ cfe/trunk/lib/Index/IndexBody.cpp Fri Feb 12 19:24:19 2016
@@ -29,11 +29,15 @@ public:
   
   bool shouldWalkTypesOfTypeLocs() const { return false; }
 
-  bool TraverseStmt(Stmt *S) {
+  bool dataTraverseStmtPre(Stmt *S) {
 StmtStack.push_back(S);
-bool ret = base::TraverseStmt(S);
+return true;
+  }
+
+  bool dataTraverseStmtPost(Stmt *S) {
+assert(StmtStack.back() == S);
 StmtStack.pop_back();
-return ret;
+return true;
   }
 
   bool TraverseTypeLoc(TypeLoc TL) {


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


Re: [PATCH] D17188: AMDGPU: Add sin/cos builtins

2016-02-12 Thread Matt Arsenault via cfe-commits
arsenm closed this revision.
arsenm added a comment.

r260783


http://reviews.llvm.org/D17188



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


r260783 - AMDGPU: Add sin/cos builtins

2016-02-12 Thread Matt Arsenault via cfe-commits
Author: arsenm
Date: Fri Feb 12 19:21:09 2016
New Revision: 260783

URL: http://llvm.org/viewvc/llvm-project?rev=260783&view=rev
Log:
AMDGPU: Add sin/cos builtins

Modified:
cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl

Modified: cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def?rev=260783&r1=260782&r2=260783&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def Fri Feb 12 19:21:09 2016
@@ -29,6 +29,9 @@ BUILTIN(__builtin_amdgcn_rsq, "dd", "nc"
 BUILTIN(__builtin_amdgcn_rsqf, "ff", "nc")
 BUILTIN(__builtin_amdgcn_rsq_clamp, "dd", "nc")
 BUILTIN(__builtin_amdgcn_rsq_clampf, "ff", "nc")
+BUILTIN(__builtin_amdgcn_sinf, "ff", "nc")
+BUILTIN(__builtin_amdgcn_cosf, "ff", "nc")
+BUILTIN(__builtin_amdgcn_log_clampf, "ff", "nc")
 BUILTIN(__builtin_amdgcn_ldexp, "ddi", "nc")
 BUILTIN(__builtin_amdgcn_ldexpf, "ffi", "nc")
 BUILTIN(__builtin_amdgcn_class, "bdi", "nc")

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=260783&r1=260782&r2=260783&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Fri Feb 12 19:21:09 2016
@@ -7082,6 +7082,12 @@ Value *CodeGenFunction::EmitAMDGPUBuilti
   case AMDGPU::BI__builtin_amdgcn_rsq_clamp:
   case AMDGPU::BI__builtin_amdgcn_rsq_clampf:
 return emitUnaryBuiltin(*this, E, Intrinsic::amdgcn_rsq_clamp);
+  case AMDGPU::BI__builtin_amdgcn_sinf:
+return emitUnaryBuiltin(*this, E, Intrinsic::amdgcn_sin);
+  case AMDGPU::BI__builtin_amdgcn_cosf:
+return emitUnaryBuiltin(*this, E, Intrinsic::amdgcn_cos);
+  case AMDGPU::BI__builtin_amdgcn_log_clampf:
+return emitUnaryBuiltin(*this, E, Intrinsic::amdgcn_log_clamp);
   case AMDGPU::BI__builtin_amdgcn_ldexp:
   case AMDGPU::BI__builtin_amdgcn_ldexpf:
 return emitFPIntBuiltin(*this, E, Intrinsic::amdgcn_ldexp);

Modified: cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl?rev=260783&r1=260782&r2=260783&view=diff
==
--- cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl Fri Feb 12 19:21:09 2016
@@ -113,6 +113,27 @@ void test_rsq_clamp_f64(global double* o
   *out = __builtin_amdgcn_rsq_clamp(a);
 }
 
+// CHECK-LABEL: @test_sin_f32
+// CHECK: call float @llvm.amdgcn.sin.f32
+void test_sin_f32(global float* out, float a)
+{
+  *out = __builtin_amdgcn_sinf(a);
+}
+
+// CHECK-LABEL: @test_cos_f32
+// CHECK: call float @llvm.amdgcn.cos.f32
+void test_cos_f32(global float* out, float a)
+{
+  *out = __builtin_amdgcn_cosf(a);
+}
+
+// CHECK-LABEL: @test_log_clamp_f32
+// CHECK: call float @llvm.amdgcn.log.clamp.f32
+void test_log_clamp_f32(global float* out, float a)
+{
+  *out = __builtin_amdgcn_log_clampf(a);
+}
+
 // CHECK-LABEL: @test_ldexp_f32
 // CHECK: call float @llvm.amdgcn.ldexp.f32
 void test_ldexp_f32(global float* out, float a, int b)


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


r260781 - AMDGPU: Update builtin for intrinsic change

2016-02-12 Thread Matt Arsenault via cfe-commits
Author: arsenm
Date: Fri Feb 12 19:03:09 2016
New Revision: 260781

URL: http://llvm.org/viewvc/llvm-project?rev=260781&view=rev
Log:
AMDGPU: Update builtin for intrinsic change

Modified:
cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl

Modified: cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def?rev=260781&r1=260780&r2=260781&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def Fri Feb 12 19:03:09 2016
@@ -27,8 +27,8 @@ BUILTIN(__builtin_amdgcn_rcp, "dd", "nc"
 BUILTIN(__builtin_amdgcn_rcpf, "ff", "nc")
 BUILTIN(__builtin_amdgcn_rsq, "dd", "nc")
 BUILTIN(__builtin_amdgcn_rsqf, "ff", "nc")
-BUILTIN(__builtin_amdgcn_rsq_clamped, "dd", "nc")
-BUILTIN(__builtin_amdgcn_rsq_clampedf, "ff", "nc")
+BUILTIN(__builtin_amdgcn_rsq_clamp, "dd", "nc")
+BUILTIN(__builtin_amdgcn_rsq_clampf, "ff", "nc")
 BUILTIN(__builtin_amdgcn_ldexp, "ddi", "nc")
 BUILTIN(__builtin_amdgcn_ldexpf, "ffi", "nc")
 BUILTIN(__builtin_amdgcn_class, "bdi", "nc")

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=260781&r1=260780&r2=260781&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Fri Feb 12 19:03:09 2016
@@ -7079,9 +7079,9 @@ Value *CodeGenFunction::EmitAMDGPUBuilti
   case AMDGPU::BI__builtin_amdgcn_rsq:
   case AMDGPU::BI__builtin_amdgcn_rsqf:
 return emitUnaryBuiltin(*this, E, Intrinsic::amdgcn_rsq);
-  case AMDGPU::BI__builtin_amdgcn_rsq_clamped:
-  case AMDGPU::BI__builtin_amdgcn_rsq_clampedf:
-return emitUnaryBuiltin(*this, E, Intrinsic::amdgcn_rsq_clamped);
+  case AMDGPU::BI__builtin_amdgcn_rsq_clamp:
+  case AMDGPU::BI__builtin_amdgcn_rsq_clampf:
+return emitUnaryBuiltin(*this, E, Intrinsic::amdgcn_rsq_clamp);
   case AMDGPU::BI__builtin_amdgcn_ldexp:
   case AMDGPU::BI__builtin_amdgcn_ldexpf:
 return emitFPIntBuiltin(*this, E, Intrinsic::amdgcn_ldexp);

Modified: cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl?rev=260781&r1=260780&r2=260781&view=diff
==
--- cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl Fri Feb 12 19:03:09 2016
@@ -99,18 +99,18 @@ void test_rsq_f64(global double* out, do
   *out = __builtin_amdgcn_rsq(a);
 }
 
-// CHECK-LABEL: @test_rsq_clamped_f32
-// CHECK: call float @llvm.amdgcn.rsq.clamped.f32
-void test_rsq_clamped_f32(global float* out, float a)
+// CHECK-LABEL: @test_rsq_clamp_f32
+// CHECK: call float @llvm.amdgcn.rsq.clamp.f32
+void test_rsq_clamp_f32(global float* out, float a)
 {
-  *out = __builtin_amdgcn_rsq_clampedf(a);
+  *out = __builtin_amdgcn_rsq_clampf(a);
 }
 
-// CHECK-LABEL: @test_rsq_clamped_f64
-// CHECK: call double @llvm.amdgcn.rsq.clamped.f64
-void test_rsq_clamped_f64(global double* out, double a)
+// CHECK-LABEL: @test_rsq_clamp_f64
+// CHECK: call double @llvm.amdgcn.rsq.clamp.f64
+void test_rsq_clamp_f64(global double* out, double a)
 {
-  *out = __builtin_amdgcn_rsq_clamped(a);
+  *out = __builtin_amdgcn_rsq_clamp(a);
 }
 
 // CHECK-LABEL: @test_ldexp_f32


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


r260779 - Disable two tests that use a lot of stack under ASan.

2016-02-12 Thread Alexey Samsonov via cfe-commits
Author: samsonov
Date: Fri Feb 12 19:02:59 2016
New Revision: 260779

URL: http://llvm.org/viewvc/llvm-project?rev=260779&view=rev
Log:
Disable two tests that use a lot of stack under ASan.

Modified:
cfe/trunk/test/Index/index-many-call-ops.cpp
cfe/trunk/test/Index/index-many-logical-ops.c

Modified: cfe/trunk/test/Index/index-many-call-ops.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/index-many-call-ops.cpp?rev=260779&r1=260778&r2=260779&view=diff
==
--- cfe/trunk/test/Index/index-many-call-ops.cpp (original)
+++ cfe/trunk/test/Index/index-many-call-ops.cpp Fri Feb 12 19:02:59 2016
@@ -4,8 +4,8 @@
 // Check that we don't get stack overflow trying to index a huge number of
 // call operators.
 
-// UBSan increses stack usage.
-// REQUIRES: not_ubsan
+// ASan and UBSan increase stack usage.
+// REQUIRES: not_asan, not_ubsan
 
 struct S {
   S &operator()();

Modified: cfe/trunk/test/Index/index-many-logical-ops.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/index-many-logical-ops.c?rev=260779&r1=260778&r2=260779&view=diff
==
--- cfe/trunk/test/Index/index-many-logical-ops.c (original)
+++ cfe/trunk/test/Index/index-many-logical-ops.c Fri Feb 12 19:02:59 2016
@@ -4,8 +4,8 @@
 // Check that we don't get stack overflow trying to index a huge number of
 // logical operators.
 
-// UBSan increses stack usage.
-// REQUIRES: not_ubsan
+// ASan and UBSan increase stack usage.
+// REQUIRES: not_asan, not_ubsan
 
 // CHECK: [indexDeclaration]: kind: function | name: foo
 int foo(int x) {


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


[libclc] r260777 - Split sources for amdgcn and r600

2016-02-12 Thread Matt Arsenault via cfe-commits
Author: arsenm
Date: Fri Feb 12 19:01:59 2016
New Revision: 260777

URL: http://llvm.org/viewvc/llvm-project?rev=260777&view=rev
Log:
Split sources for amdgcn and r600

Most files remain in a common amdgpu directory.

Also switches barriers to to use convergent,
and use llvm.amdgcn.s.barrier.

This now requires 3.9/trunk to build amdgcn.

Added:
libclc/trunk/amdgcn/
libclc/trunk/amdgcn/lib/
libclc/trunk/amdgcn/lib/OVERRIDES
libclc/trunk/amdgcn/lib/SOURCES
libclc/trunk/amdgcn/lib/synchronization/
libclc/trunk/amdgcn/lib/synchronization/barrier_impl.ll
  - copied, changed from r260304, 
libclc/trunk/r600/lib/synchronization/barrier_impl.ll
libclc/trunk/amdgpu/
libclc/trunk/amdgpu/lib/
libclc/trunk/amdgpu/lib/OVERRIDES
  - copied, changed from r260304, libclc/trunk/r600/lib/OVERRIDES
libclc/trunk/amdgpu/lib/SOURCES
  - copied, changed from r260304, libclc/trunk/r600/lib/SOURCES
libclc/trunk/amdgpu/lib/atomic/
libclc/trunk/amdgpu/lib/atomic/atomic.cl
  - copied, changed from r260304, libclc/trunk/r600/lib/atomic/atomic.cl
libclc/trunk/amdgpu/lib/image/
libclc/trunk/amdgpu/lib/image/get_image_attributes_impl.ll
  - copied, changed from r260304, 
libclc/trunk/r600/lib/image/get_image_attributes_impl.ll
libclc/trunk/amdgpu/lib/image/get_image_channel_data_type.cl
  - copied, changed from r260304, 
libclc/trunk/r600/lib/image/get_image_channel_data_type.cl
libclc/trunk/amdgpu/lib/image/get_image_channel_order.cl
  - copied, changed from r260304, 
libclc/trunk/r600/lib/image/get_image_channel_order.cl
libclc/trunk/amdgpu/lib/image/get_image_depth.cl
  - copied, changed from r260304, 
libclc/trunk/r600/lib/image/get_image_depth.cl
libclc/trunk/amdgpu/lib/image/get_image_height.cl
  - copied, changed from r260304, 
libclc/trunk/r600/lib/image/get_image_height.cl
libclc/trunk/amdgpu/lib/image/get_image_width.cl
  - copied, changed from r260304, 
libclc/trunk/r600/lib/image/get_image_width.cl
libclc/trunk/amdgpu/lib/image/read_image_impl.ll
  - copied, changed from r260304, 
libclc/trunk/r600/lib/image/read_image_impl.ll
libclc/trunk/amdgpu/lib/image/read_imagef.cl
  - copied, changed from r260304, libclc/trunk/r600/lib/image/read_imagef.cl
libclc/trunk/amdgpu/lib/image/read_imagei.cl
  - copied, changed from r260304, libclc/trunk/r600/lib/image/read_imagei.cl
libclc/trunk/amdgpu/lib/image/read_imageui.cl
  - copied, changed from r260304, 
libclc/trunk/r600/lib/image/read_imageui.cl
libclc/trunk/amdgpu/lib/image/write_image_impl.ll
  - copied, changed from r260304, 
libclc/trunk/r600/lib/image/write_image_impl.ll
libclc/trunk/amdgpu/lib/image/write_imagef.cl
  - copied, changed from r260304, 
libclc/trunk/r600/lib/image/write_imagef.cl
libclc/trunk/amdgpu/lib/image/write_imagei.cl
  - copied, changed from r260304, 
libclc/trunk/r600/lib/image/write_imagei.cl
libclc/trunk/amdgpu/lib/image/write_imageui.cl
  - copied, changed from r260304, 
libclc/trunk/r600/lib/image/write_imageui.cl
libclc/trunk/amdgpu/lib/math/
libclc/trunk/amdgpu/lib/math/ldexp.cl
  - copied, changed from r260304, libclc/trunk/r600/lib/math/ldexp.cl
libclc/trunk/amdgpu/lib/math/nextafter.cl
  - copied, changed from r260304, libclc/trunk/r600/lib/math/nextafter.cl
libclc/trunk/amdgpu/lib/math/sqrt.cl
  - copied, changed from r260304, libclc/trunk/r600/lib/math/sqrt.cl
libclc/trunk/amdgpu/lib/synchronization/
libclc/trunk/amdgpu/lib/synchronization/barrier.cl
  - copied, changed from r260304, 
libclc/trunk/r600/lib/synchronization/barrier.cl
libclc/trunk/amdgpu/lib/workitem/
libclc/trunk/amdgpu/lib/workitem/get_global_size.ll
  - copied, changed from r260304, 
libclc/trunk/r600/lib/workitem/get_global_size.ll
libclc/trunk/amdgpu/lib/workitem/get_group_id.ll
  - copied, changed from r260304, 
libclc/trunk/r600/lib/workitem/get_group_id.ll
libclc/trunk/amdgpu/lib/workitem/get_local_id.ll
  - copied, changed from r260304, 
libclc/trunk/r600/lib/workitem/get_local_id.ll
libclc/trunk/amdgpu/lib/workitem/get_local_size.ll
  - copied, changed from r260304, 
libclc/trunk/r600/lib/workitem/get_local_size.ll
libclc/trunk/amdgpu/lib/workitem/get_num_groups.ll
  - copied, changed from r260304, 
libclc/trunk/r600/lib/workitem/get_num_groups.ll
libclc/trunk/amdgpu/lib/workitem/get_work_dim.ll
  - copied, changed from r260304, 
libclc/trunk/r600/lib/workitem/get_work_dim.ll
Removed:
libclc/trunk/r600/lib/atomic/atomic.cl
libclc/trunk/r600/lib/image/get_image_attributes_impl.ll
libclc/trunk/r600/lib/image/get_image_channel_data_type.cl
libclc/trunk/r600/lib/image/get_image_channel_order.cl
libclc/trunk/r600/lib/image/get_image_depth.cl
libclc/trunk/r600/lib/image/get_image_height.cl
libclc/trunk/r600/lib/image/get_image_width.cl
libclc/trunk/r600/lib/image/read_image_im

[libclc] r260778 - Update page to list supported targets

2016-02-12 Thread Matt Arsenault via cfe-commits
Author: arsenm
Date: Fri Feb 12 19:02:06 2016
New Revision: 260778

URL: http://llvm.org/viewvc/llvm-project?rev=260778&view=rev
Log:
Update page to list supported targets

Modified:
libclc/trunk/www/index.html

Modified: libclc/trunk/www/index.html
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/www/index.html?rev=260778&r1=260777&r2=260778&view=diff
==
--- libclc/trunk/www/index.html (original)
+++ libclc/trunk/www/index.html Fri Feb 12 19:02:06 2016
@@ -37,8 +37,8 @@ granularity of individual functions.
 
 
 
-libclc currently only supports the PTX target, but support for more
-targets is welcome.
+libclc currently supports the AMDGCN, and R600 and NVPTX targets, but
+support for more targets is welcome.
 
 
 Download


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


r260776 - Make -Wnull-conversion more useful.

2016-02-12 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Fri Feb 12 18:58:53 2016
New Revision: 260776

URL: http://llvm.org/viewvc/llvm-project?rev=260776&view=rev
Log:
Make -Wnull-conversion more useful.

When a null constant is used in a macro, walk through the macro stack to
determine where the null constant is written and where the context is located.
Only warn if both locations are within the same macro expansion.  This helps
function-like macros which involve pointers be treated as if they were
functions.

Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/SemaCXX/conversion.cpp

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=260776&r1=260775&r2=260776&view=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Fri Feb 12 18:58:53 2016
@@ -7265,14 +7265,21 @@ void DiagnoseNullConversion(Sema &S, Exp
 
   SourceLocation Loc = E->getSourceRange().getBegin();
 
+  // Venture through the macro stacks to get to the source of macro arguments.
+  // The new location is a better location than the complete location that was
+  // passed in.
+  while (S.SourceMgr.isMacroArgExpansion(Loc))
+Loc = S.SourceMgr.getImmediateMacroCallerLoc(Loc);
+
+  while (S.SourceMgr.isMacroArgExpansion(CC))
+CC = S.SourceMgr.getImmediateMacroCallerLoc(CC);
+
   // __null is usually wrapped in a macro.  Go up a macro if that is the case.
-  if (NullKind == Expr::NPCK_GNUNull) {
-if (Loc.isMacroID()) {
-  StringRef MacroName = Lexer::getImmediateMacroNameForDiagnostics(
-  Loc, S.SourceMgr, S.getLangOpts());
-  if (MacroName == "NULL")
-Loc = S.SourceMgr.getImmediateExpansionRange(Loc).first;
-}
+  if (NullKind == Expr::NPCK_GNUNull && Loc.isMacroID()) {
+StringRef MacroName = Lexer::getImmediateMacroNameForDiagnostics(
+Loc, S.SourceMgr, S.getLangOpts());
+if (MacroName == "NULL")
+  Loc = S.SourceMgr.getImmediateExpansionRange(Loc).first;
   }
 
   // Only warn if the null and context location are in the same macro 
expansion.

Modified: cfe/trunk/test/SemaCXX/conversion.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/conversion.cpp?rev=260776&r1=260775&r2=260776&view=diff
==
--- cfe/trunk/test/SemaCXX/conversion.cpp (original)
+++ cfe/trunk/test/SemaCXX/conversion.cpp Fri Feb 12 18:58:53 2016
@@ -256,3 +256,45 @@ bool run() {
 }
 
 }
+
+// More tests with macros.  Specficially, test function-like macros that either
+// have a pointer return type or take pointer arguments.  Basically, if the
+// macro was changed into a function and Clang doesn't warn, then it shouldn't
+// warn for the macro either.
+namespace test13 {
+#define check_str_nullptr_13(str) ((str) ? str : nullptr)
+#define check_str_null_13(str) ((str) ? str : NULL)
+#define test13(condition) if (condition) return;
+#define identity13(arg) arg
+#define CHECK13(condition) test13(identity13(!(condition)))
+
+void function1(const char* str) {
+  CHECK13(check_str_nullptr_13(str));
+  CHECK13(check_str_null_13(str));
+}
+
+bool some_bool_function(bool);
+void function2() {
+  CHECK13(some_bool_function(nullptr));  // expected-warning{{implicit 
conversion of nullptr constant to 'bool'}}
+  CHECK13(some_bool_function(NULL));  // expected-warning{{implicit conversion 
of NULL constant to 'bool'}}
+}
+
+#define run_check_nullptr_13(str) \
+if (check_str_nullptr_13(str)) return;
+#define run_check_null_13(str) \
+if (check_str_null_13(str)) return;
+void function3(const char* str) {
+  run_check_nullptr_13(str)
+  run_check_null_13(str)
+  if (check_str_nullptr_13(str)) return;
+  if (check_str_null_13(str)) return;
+}
+
+void run(int* ptr);
+#define conditional_run_13(ptr) \
+if (ptr) run(ptr);
+void function4() {
+  conditional_run_13(nullptr);
+  conditional_run_13(NULL);
+}
+}


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


Re: [PATCH] D15095: Accept "-Weverything" in pragma clang diagnostic ...

2016-02-12 Thread Richard Smith via cfe-commits
rsmith added a comment.

If a patch is LGTM'd and some small change is requested at the same time, that 
typically means "LGTM once you make the following changes, which I trust you to 
make with no further pre-commit review". If you'd prefer more pre-commit 
review, of course, that's fine too.

In any case, this still LGTM, assuming it also includes the functional change 
itself (which is somehow missing from the latest revision here) =)


http://reviews.llvm.org/D15095



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


Re: [PATCH] D15095: Accept "-Weverything" in pragma clang diagnostic ...

2016-02-12 Thread Sunil Srivastava via cfe-commits
Sunil_Srivastava updated this revision to Diff 47866.
Sunil_Srivastava added a comment.

Hi Richard,

Good point about that extra test. I suppose I need another LGTM for the new 
test.

No other changes.
(Sorry I had missed the code change in the last round)


http://reviews.llvm.org/D15095

Files:
  lib/Lex/Pragma.cpp
  test/Preprocessor/Weverything_pragma.c
  test/Preprocessor/pragma_diagnostic.c
  test/Preprocessor/pushable-diagnostics.c

Index: test/Preprocessor/pushable-diagnostics.c
===
--- test/Preprocessor/pushable-diagnostics.c
+++ test/Preprocessor/pushable-diagnostics.c
@@ -15,3 +15,27 @@
 int c = 'df';  // expected-warning{{multi-character character constant}}
 
 #pragma clang diagnostic pop // expected-warning{{pragma diagnostic pop could not pop, no matching push}}
+
+// Test -Weverything
+
+void ppo0(){} // first verify that we do not give anything on this
+#pragma clang diagnostic push // now push
+
+#pragma clang diagnostic warning "-Weverything" 
+void ppr1(){} // expected-warning {{no previous prototype for function 'ppr1'}}
+
+#pragma clang diagnostic push // push again
+#pragma clang diagnostic ignored "-Weverything"  // Set to ignore in this level.
+void pps2(){}
+#pragma clang diagnostic warning "-Weverything"  // Set to warning in this level.
+void ppt2(){} // expected-warning {{no previous prototype for function 'ppt2'}}
+#pragma clang diagnostic error "-Weverything"  // Set to error in this level.
+void ppt3(){} // expected-error {{no previous prototype for function 'ppt3'}}
+#pragma clang diagnostic pop // pop should go back to warning level
+
+void pps1(){} // expected-warning {{no previous prototype for function 'pps1'}}
+
+
+#pragma clang diagnostic pop // Another pop should disble it again
+void ppu(){}
+
Index: test/Preprocessor/pragma_diagnostic.c
===
--- test/Preprocessor/pragma_diagnostic.c
+++ test/Preprocessor/pragma_diagnostic.c
@@ -30,3 +30,18 @@
 
 #pragma GCC diagnostic error "-Winvalid-name"  // expected-warning {{unknown warning group '-Winvalid-name', ignored}}
 
+
+// Testing pragma clang diagnostic with -Weverything
+void ppo(){} // First test that we do not diagnose on this.
+
+#pragma clang diagnostic warning "-Weverything"
+void ppp(){} // expected-warning {{no previous prototype for function 'ppp'}}
+
+#pragma clang diagnostic ignored "-Weverything" // Reset it.
+void ppq(){}
+
+#pragma clang diagnostic error "-Weverything" // Now set to error
+void ppr(){} // expected-error {{no previous prototype for function 'ppr'}}
+
+#pragma clang diagnostic warning "-Weverything" // This should not be effective
+void pps(){} // expected-error {{no previous prototype for function 'pps'}}
Index: test/Preprocessor/Weverything_pragma.c
===
--- test/Preprocessor/Weverything_pragma.c
+++ test/Preprocessor/Weverything_pragma.c
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -Weverything   -fsyntax-only -verify %s
+
+// Test that the pragma overrides command line option -Weverythings,
+
+// a diagnostic with DefaultIgnore. This is part of a group 'unused-macro'
+// but -Weverything forces it
+#define UNUSED_MACRO1 1 // expected-warning{{macro is not used}}
+
+void foo() // expected-warning {{no previous prototype for function}}
+{
+ // A diagnostic without DefaultIgnore, and not part of a group.
+ (void) L'ab'; // expected-warning {{extraneous characters in character constant ignored}}
+
+#pragma clang diagnostic warning "-Weverything" // Should not change anyhting.
+#define UNUSED_MACRO2 1 // expected-warning{{macro is not used}}
+ (void) L'cd'; // expected-warning {{extraneous characters in character constant ignored}}
+
+#pragma clang diagnostic ignored "-Weverything" // Ignore warnings now.
+#define UNUSED_MACRO2 1 // no warning
+ (void) L'ef'; // no warning here
+
+#pragma clang diagnostic warning "-Weverything" // Revert back to warnings.
+#define UNUSED_MACRO3 1 // expected-warning{{macro is not used}}
+ (void) L'gh'; // expected-warning {{extraneous characters in character constant ignored}}
+
+#pragma clang diagnostic error "-Weverything"  // Give errors now.
+#define UNUSED_MACRO4 1 // expected-error{{macro is not used}}
+ (void) L'ij'; // expected-error {{extraneous characters in character constant ignored}}
+}
Index: lib/Lex/Pragma.cpp
===
--- lib/Lex/Pragma.cpp
+++ lib/Lex/Pragma.cpp
@@ -1024,10 +1024,19 @@
   return;
 }
 
-if (PP.getDiagnostics().setSeverityForGroup(
-WarningName[1] == 'W' ? diag::Flavor::WarningOrError
-  : diag::Flavor::Remark,
-WarningName.substr(2), SV, DiagLoc))
+diag::Flavor Flavor = WarningName[1] == 'W' ? diag::Flavor::WarningOrError
+: diag::Flavor::Remark;
+StringRef Group 

Re: [PATCH] D15095: Accept "-Weverything" in pragma clang diagnostic ...

2016-02-12 Thread Sunil Srivastava via cfe-commits
Sunil_Srivastava updated this revision to Diff 47865.
Sunil_Srivastava added a comment.

Hi Richard,

Good point about that extra test. I suppose I need another LGTM for the new 
test.

No other changes.


http://reviews.llvm.org/D15095

Files:
  Preprocessor/Weverything_pragma.c
  Preprocessor/pragma_diagnostic.c
  Preprocessor/pushable-diagnostics.c

Index: Preprocessor/pushable-diagnostics.c
===
--- Preprocessor/pushable-diagnostics.c
+++ Preprocessor/pushable-diagnostics.c
@@ -15,3 +15,27 @@
 int c = 'df';  // expected-warning{{multi-character character constant}}
 
 #pragma clang diagnostic pop // expected-warning{{pragma diagnostic pop could 
not pop, no matching push}}
+
+// Test -Weverything
+
+void ppo0(){} // first verify that we do not give anything on this
+#pragma clang diagnostic push // now push
+
+#pragma clang diagnostic warning "-Weverything" 
+void ppr1(){} // expected-warning {{no previous prototype for function 'ppr1'}}
+
+#pragma clang diagnostic push // push again
+#pragma clang diagnostic ignored "-Weverything"  // Set to ignore in this 
level.
+void pps2(){}
+#pragma clang diagnostic warning "-Weverything"  // Set to warning in this 
level.
+void ppt2(){} // expected-warning {{no previous prototype for function 'ppt2'}}
+#pragma clang diagnostic error "-Weverything"  // Set to error in this level.
+void ppt3(){} // expected-error {{no previous prototype for function 'ppt3'}}
+#pragma clang diagnostic pop // pop should go back to warning level
+
+void pps1(){} // expected-warning {{no previous prototype for function 'pps1'}}
+
+
+#pragma clang diagnostic pop // Another pop should disble it again
+void ppu(){}
+
Index: Preprocessor/pragma_diagnostic.c
===
--- Preprocessor/pragma_diagnostic.c
+++ Preprocessor/pragma_diagnostic.c
@@ -30,3 +30,18 @@
 
 #pragma GCC diagnostic error "-Winvalid-name"  // expected-warning {{unknown 
warning group '-Winvalid-name', ignored}}
 
+
+// Testing pragma clang diagnostic with -Weverything
+void ppo(){} // First test that we do not diagnose on this.
+
+#pragma clang diagnostic warning "-Weverything"
+void ppp(){} // expected-warning {{no previous prototype for function 'ppp'}}
+
+#pragma clang diagnostic ignored "-Weverything" // Reset it.
+void ppq(){}
+
+#pragma clang diagnostic error "-Weverything" // Now set to error
+void ppr(){} // expected-error {{no previous prototype for function 'ppr'}}
+
+#pragma clang diagnostic warning "-Weverything" // This should not be effective
+void pps(){} // expected-error {{no previous prototype for function 'pps'}}
Index: Preprocessor/Weverything_pragma.c
===
--- Preprocessor/Weverything_pragma.c
+++ Preprocessor/Weverything_pragma.c
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -Weverything   -fsyntax-only -verify %s
+
+// Test that the pragma overrides command line option -Weverythings,
+
+// a diagnostic with DefaultIgnore. This is part of a group 'unused-macro'
+// but -Weverything forces it
+#define UNUSED_MACRO1 1 // expected-warning{{macro is not used}}
+
+void foo() // expected-warning {{no previous prototype for function}}
+{
+ // A diagnostic without DefaultIgnore, and not part of a group.
+ (void) L'ab'; // expected-warning {{extraneous characters in character 
constant ignored}}
+
+#pragma clang diagnostic warning "-Weverything" // Should not change anyhting.
+#define UNUSED_MACRO2 1 // expected-warning{{macro is not used}}
+ (void) L'cd'; // expected-warning {{extraneous characters in character 
constant ignored}}
+
+#pragma clang diagnostic ignored "-Weverything" // Ignore warnings now.
+#define UNUSED_MACRO2 1 // no warning
+ (void) L'ef'; // no warning here
+
+#pragma clang diagnostic warning "-Weverything" // Revert back to warnings.
+#define UNUSED_MACRO3 1 // expected-warning{{macro is not used}}
+ (void) L'gh'; // expected-warning {{extraneous characters in character 
constant ignored}}
+
+#pragma clang diagnostic error "-Weverything"  // Give errors now.
+#define UNUSED_MACRO4 1 // expected-error{{macro is not used}}
+ (void) L'ij'; // expected-error {{extraneous characters in character constant 
ignored}}
+}


Index: Preprocessor/pushable-diagnostics.c
===
--- Preprocessor/pushable-diagnostics.c
+++ Preprocessor/pushable-diagnostics.c
@@ -15,3 +15,27 @@
 int c = 'df';  // expected-warning{{multi-character character constant}}
 
 #pragma clang diagnostic pop // expected-warning{{pragma diagnostic pop could not pop, no matching push}}
+
+// Test -Weverything
+
+void ppo0(){} // first verify that we do not give anything on this
+#pragma clang diagnostic push // now push
+
+#pragma clang diagnostic warning "-Weverything" 
+void ppr1(){} // expected-warning {{no previous prototype for function 'ppr1'}}
+
+#pragma clang diagnostic push // push again
+#p

r260762 - [index] Add llvm/Support/DataTypes.h header to fix build failures in the bots.

2016-02-12 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Fri Feb 12 17:30:07 2016
New Revision: 260762

URL: http://llvm.org/viewvc/llvm-project?rev=260762&view=rev
Log:
[index] Add llvm/Support/DataTypes.h header to fix build failures in the bots.

Modified:
cfe/trunk/include/clang/Index/IndexSymbol.h

Modified: cfe/trunk/include/clang/Index/IndexSymbol.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Index/IndexSymbol.h?rev=260762&r1=260761&r2=260762&view=diff
==
--- cfe/trunk/include/clang/Index/IndexSymbol.h (original)
+++ cfe/trunk/include/clang/Index/IndexSymbol.h Fri Feb 12 17:30:07 2016
@@ -11,6 +11,7 @@
 #define LLVM_CLANG_INDEX_INDEXSYMBOL_H
 
 #include "clang/Basic/LLVM.h"
+#include "llvm/Support/DataTypes.h"
 
 namespace clang {
   class Decl;


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


Buildbot numbers for week of 1/31/2016 - 2/06/2016

2016-02-12 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 1/31/2016 - 2/6/2016.
I have added a new report that shows a "status change ratio" for each
builder.
The idea is to provide some kind of metrics for a noise level a builder
produces. The number is a percent of builds that changed the builder status
from greed to red or from red to green.
The high number is not that bad, as faster builders would show a higher
ratio in general, just because they build more often and more granular. We
also have a different number of broken builds day to day.
But I hope this would give us another data point to tell our build bot
health.

Thanks

Galina


 buildername   | builds |
changes | status change ratio
---++-+-
 sanitizer-x86_64-linux| 99 |
51 |51.5
 clang-ppc64le-linux-lnt   | 81 |
28 |34.6
 lldb-x86_64-darwin-13.4   | 84 |
25 |29.8
 lldb-x86_64-ubuntu-14.04-android  |108 |
32 |29.6
 lldb-windows7-android |116 |
34 |29.3
 clang-native-aarch64-full | 18 |
4 |22.2
 clang-cmake-aarch64-full  | 42 |
8 |19.0
 perf-x86_64-penryn-O3-polly   |135 |
18 |13.3
 clang-cmake-armv7-a15-selfhost-neon   | 24 |
3 |12.5
 sanitizer-windows |330 |
41 |12.4
 sanitizer-ppc64le-linux   | 50 |
6 |12.0
 sanitizer-ppc64be-linux   |100 |
12 |12.0
 clang-native-arm-lnt-perf |  9 |
1 |11.1
 clang-cmake-mips  | 82 |
8 | 9.8
 clang-x64-ninja-win7  |177 |
16 | 9.0
 clang-cmake-thumbv7-a15-full-sh   | 23 |
2 | 8.7
 sanitizer-x86_64-linux-bootstrap  | 58 |
5 | 8.6
 clang-cmake-aarch64-42vma |151 |
10 | 6.6
 lldb-x86_64-ubuntu-14.04-cmake|225 |
14 | 6.2
 clang-ppc64le-linux-multistage| 84 |
5 | 6.0
 perf-x86_64-penryn-O3-polly-fast  |105 |
6 | 5.7
 perf-x86_64-penryn-O3 |195 |
11 | 5.6
 clang-x86-win2008-selfhost|173 |
9 | 5.2
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast|356 |
17 | 4.8
 clang-cmake-armv7-a15-full| 83 |
4 | 4.8
 clang-cmake-mipsel| 22 |
1 | 4.5
 llvm-mips-linux   | 44 |
2 | 4.5
 lldb-x86-windows-msvc2015 |221 |
10 | 4.5
 perf-x86_64-penryn-O3-polly-before-vectorizer | 91 |
4 | 4.4
 clang-ppc64be-linux-multistage|140 |
6 | 4.3
 clang-native-arm-lnt  | 95 |
4 | 4.2
 clang-cmake-aarch64-quick |143 |
6 | 4.2
 lld-x86_64-freebsd|197 |
8 | 4.1
 sanitizer-x86_64-linux-fast   |176 |
7 | 4.0
 clang-cmake-thumbv7-a15   |177 |
6 | 3.4
 polly-amd64-linux |235 |
8 | 3.4
 perf-x86_64-penryn-O3-polly-before-vectorizer-detect-only | 91 |
3 | 3.3
 lldb-x86_64-ubuntu-14.04-buildserver  |129 |
4 | 3.1
 sanitizer-x86_64-linux-fuzzer |205 |
6 | 2.9
 lldb-amd64-ninja-netbsd7  |142 |
4 | 2.8
 clang-bpf-build   |292 |
7 | 2.4
 clang-cmake-armv7-a15 |170 |
4 | 2.4
 clang-ppc64be-linux   |271 |
6 | 2.2
 clang-s390x-linux |274 |
6 |

Re: [PATCH] D17218: [Clang] Fix remaining Clang-tidy readability-redundant-control-flow warnings; other minor fixes

2016-02-12 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL260757: Fix remaining Clang-tidy 
readability-redundant-control-flow warnings; other… (authored by eugenezelenko).

Changed prior to commit:
  http://reviews.llvm.org/D17218?vs=47859&id=47860#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17218

Files:
  cfe/trunk/lib/Driver/ToolChain.cpp
  cfe/trunk/lib/Driver/ToolChains.cpp
  cfe/trunk/lib/Driver/Types.cpp
  cfe/trunk/lib/Index/USRGeneration.cpp
  cfe/trunk/lib/Lex/PPDirectives.cpp
  cfe/trunk/lib/Lex/TokenLexer.cpp
  cfe/trunk/lib/Parse/ParseObjc.cpp
  cfe/trunk/lib/Sema/SemaChecking.cpp
  cfe/trunk/lib/Sema/SemaDecl.cpp
  cfe/trunk/lib/Sema/SemaDeclAttr.cpp
  cfe/trunk/lib/Sema/SemaExprObjC.cpp
  cfe/trunk/lib/Sema/SemaInit.cpp
  cfe/trunk/lib/Sema/SemaObjCProperty.cpp
  cfe/trunk/lib/Sema/SemaTemplate.cpp

Index: cfe/trunk/lib/Driver/ToolChain.cpp
===
--- cfe/trunk/lib/Driver/ToolChain.cpp
+++ cfe/trunk/lib/Driver/ToolChain.cpp
@@ -516,7 +516,6 @@
   if (!needsProfileRT(Args)) return;
 
   CmdArgs.push_back(getCompilerRTArgString(Args, "profile"));
-  return;
 }
 
 ToolChain::RuntimeLibType ToolChain::GetRuntimeLibType(
Index: cfe/trunk/lib/Driver/Types.cpp
===
--- cfe/trunk/lib/Driver/Types.cpp
+++ cfe/trunk/lib/Driver/Types.cpp
@@ -241,7 +241,6 @@
   }
   assert(0 < P.size() && "Not enough phases in list");
   assert(P.size() <= phases::MaxNumberOfPhases && "Too many phases in list");
-  return;
 }
 
 ID types::lookupCXXTypeForCType(ID Id) {
Index: cfe/trunk/lib/Driver/ToolChains.cpp
===
--- cfe/trunk/lib/Driver/ToolChains.cpp
+++ cfe/trunk/lib/Driver/ToolChains.cpp
@@ -382,7 +382,6 @@
   }
   AddLinkRuntimeLib(Args, CmdArgs, Library,
 /*AlwaysLink*/ true);
-  return;
 }
 
 void DarwinClang::AddLinkSanitizerLibArgs(const ArgList &Args,
@@ -771,7 +770,6 @@
 
 void DarwinClang::AddCCKextLibArgs(const ArgList &Args,
ArgStringList &CmdArgs) const {
-
   // For Darwin platforms, use the compiler-rt-based support library
   // instead of the gcc-provided one (which is also incidentally
   // only present in the gcc lib dir, which makes it hard to find).
@@ -2451,7 +2449,6 @@
   return true;
 }
 
-
 void Generic_ELF::addClangTargetOptions(const ArgList &DriverArgs,
 ArgStringList &CC1Args) const {
   const Generic_GCC::GCCVersion &V = GCCInstallation.getVersion();
@@ -2610,7 +2607,6 @@
   return InstallRelDir;
 }
 
-
 Optional HexagonToolChain::getSmallDataThreshold(
   const ArgList &Args) {
   StringRef Gn = "";
@@ -2629,7 +2625,6 @@
   return None;
 }
 
-
 void HexagonToolChain::getHexagonLibraryPaths(const ArgList &Args,
   ToolChain::path_list &LibPaths) const {
   const Driver &D = getDriver();
@@ -3179,7 +3174,6 @@
 
 NetBSD::NetBSD(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
 : Generic_ELF(D, Triple, Args) {
-
   if (getDriver().UseStdLib) {
 // When targeting a 32-bit platform, try the special directory used on
 // 64-bit hosts, and only fall back to the main library directory if that
@@ -4037,7 +4031,6 @@
   addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include");
 }
 
-
 static std::string DetectLibcxxIncludePath(StringRef base) {
   std::error_code EC;
   int MaxVersion = 0;
Index: cfe/trunk/lib/Lex/PPDirectives.cpp
===
--- cfe/trunk/lib/Lex/PPDirectives.cpp
+++ cfe/trunk/lib/Lex/PPDirectives.cpp
@@ -27,6 +27,7 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/SaveAndRestore.h"
+
 using namespace clang;
 
 //===--===//
@@ -272,8 +273,6 @@
   }
 }
 
-
-
 /// SkipExcludedConditionalBlock - We just read a \#if or related directive and
 /// decided that the subsequent tokens are in the \#if'd out portion of the
 /// file.  Lex the rest of the file, until we see an \#endif.  If
@@ -497,7 +496,6 @@
 }
 
 void Preprocessor::PTHSkipExcludedConditionalBlock() {
-
   while (1) {
 assert(CurPTHLexer);
 assert(CurPTHLexer->LexingRawMode == false);
@@ -571,7 +569,6 @@
 }
 
 // Otherwise, skip this block and go to the next one.
-continue;
   }
 }
 
@@ -728,7 +725,6 @@
   return nullptr;
 }
 
-
 //===--===//
 // Preprocessor Directive Handling.
 //===--===//
@@ -740,9 +736,11 @@
 if (pp->MacroExpansionInDirectivesOverride)
   pp->DisableMacroExpansion = false;
   }
+
   ~ResetMacroExpansionHelper() {
 PP->DisableMacroExpansion = save;
   }
+
 private:
   Preprocessor *PP;
   bool 

r260757 - Fix remaining Clang-tidy readability-redundant-control-flow warnings; other minor fixes.

2016-02-12 Thread Eugene Zelenko via cfe-commits
Author: eugenezelenko
Date: Fri Feb 12 16:53:10 2016
New Revision: 260757

URL: http://llvm.org/viewvc/llvm-project?rev=260757&view=rev
Log:
Fix remaining Clang-tidy readability-redundant-control-flow warnings; other 
minor fixes.

Differential revision: http://reviews.llvm.org/D17218

Modified:
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/Types.cpp
cfe/trunk/lib/Index/USRGeneration.cpp
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/lib/Lex/TokenLexer.cpp
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=260757&r1=260756&r2=260757&view=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Feb 12 16:53:10 2016
@@ -516,7 +516,6 @@ void ToolChain::addProfileRTLibs(const l
   if (!needsProfileRT(Args)) return;
 
   CmdArgs.push_back(getCompilerRTArgString(Args, "profile"));
-  return;
 }
 
 ToolChain::RuntimeLibType ToolChain::GetRuntimeLibType(

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=260757&r1=260756&r2=260757&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Feb 12 16:53:10 2016
@@ -382,7 +382,6 @@ void Darwin::addProfileRTLibs(const ArgL
   }
   AddLinkRuntimeLib(Args, CmdArgs, Library,
 /*AlwaysLink*/ true);
-  return;
 }
 
 void DarwinClang::AddLinkSanitizerLibArgs(const ArgList &Args,
@@ -771,7 +770,6 @@ void DarwinClang::AddCXXStdlibLibArgs(co
 
 void DarwinClang::AddCCKextLibArgs(const ArgList &Args,
ArgStringList &CmdArgs) const {
-
   // For Darwin platforms, use the compiler-rt-based support library
   // instead of the gcc-provided one (which is also incidentally
   // only present in the gcc lib dir, which makes it hard to find).
@@ -2451,7 +2449,6 @@ bool Generic_GCC::addLibStdCXXIncludePat
   return true;
 }
 
-
 void Generic_ELF::addClangTargetOptions(const ArgList &DriverArgs,
 ArgStringList &CC1Args) const {
   const Generic_GCC::GCCVersion &V = GCCInstallation.getVersion();
@@ -2610,7 +2607,6 @@ std::string HexagonToolChain::getHexagon
   return InstallRelDir;
 }
 
-
 Optional HexagonToolChain::getSmallDataThreshold(
   const ArgList &Args) {
   StringRef Gn = "";
@@ -2629,7 +2625,6 @@ Optional HexagonToolChain::get
   return None;
 }
 
-
 void HexagonToolChain::getHexagonLibraryPaths(const ArgList &Args,
   ToolChain::path_list &LibPaths) const {
   const Driver &D = getDriver();
@@ -3179,7 +3174,6 @@ SanitizerMask FreeBSD::getSupportedSanit
 
 NetBSD::NetBSD(const Driver &D, const llvm::Triple &Triple, const ArgList 
&Args)
 : Generic_ELF(D, Triple, Args) {
-
   if (getDriver().UseStdLib) {
 // When targeting a 32-bit platform, try the special directory used on
 // 64-bit hosts, and only fall back to the main library directory if that
@@ -4037,7 +4031,6 @@ void Linux::AddClangSystemIncludeArgs(co
   addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include");
 }
 
-
 static std::string DetectLibcxxIncludePath(StringRef base) {
   std::error_code EC;
   int MaxVersion = 0;

Modified: cfe/trunk/lib/Driver/Types.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Types.cpp?rev=260757&r1=260756&r2=260757&view=diff
==
--- cfe/trunk/lib/Driver/Types.cpp (original)
+++ cfe/trunk/lib/Driver/Types.cpp Fri Feb 12 16:53:10 2016
@@ -241,7 +241,6 @@ void types::getCompilationPhases(ID Id,
   }
   assert(0 < P.size() && "Not enough phases in list");
   assert(P.size() <= phases::MaxNumberOfPhases && "Too many phases in list");
-  return;
 }
 
 ID types::lookupCXXTypeForCType(ID Id) {

Modified: cfe/trunk/lib/Index/USRGeneration.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/USRGeneration.cpp?rev=260757&r1=260756&r2=260757&view=diff
==
--- cfe/trunk/lib/Index/USRGeneration.cpp (original)
+++ cfe/trunk/lib/Index/USRGeneration.cpp Fri Feb 12 16:53:10 2016
@@ -90,18 +90,23 @@ public:
   void VisitVarDecl(const VarDecl *D);
   void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D);
   void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D);
+
   void VisitLinkageSpecDecl(const Linkage

Re: [PATCH] D13704: [Fix] Allow implicit conversions of the address of overloadable functions in C + docs update

2016-02-12 Thread George Burgess IV via cfe-commits
george.burgess.iv added a comment.

FYI: I noticed a few cases this patch misses. Will add them soon.


http://reviews.llvm.org/D13704



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


Re: r260616 - Now that Sparc/Sparc64 backend is mostly usable, provide the same

2016-02-12 Thread Hans Wennborg via cfe-commits
On Thu, Feb 11, 2016 at 3:18 PM, Joerg Sonnenberger via cfe-commits
 wrote:
> Author: joerg
> Date: Thu Feb 11 17:18:36 2016
> New Revision: 260616
>
> URL: http://llvm.org/viewvc/llvm-project?rev=260616&view=rev
> Log:
> Now that Sparc/Sparc64 backend is mostly usable, provide the same
> linking defaults as other NetBSD targets, i.e. compiler_rt-in-libc and
> libc++ as STL.
>
> Modified:
> cfe/trunk/lib/Driver/ToolChains.cpp
> cfe/trunk/lib/Driver/Tools.cpp
> cfe/trunk/test/Driver/netbsd.c
> cfe/trunk/test/Driver/netbsd.cpp

joerg requested that this be merged to 3.8. r260756.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17214: Stop using "template" when printing qualtype names

2016-02-12 Thread Sterling Augustine via cfe-commits
saugustine added a comment.

Thanks for the quick review. Assuming my response to your comment on line 138 
is adequate, would you mind checking it in?



Comment at: unittests/Tooling/QualTypeNamesTest.cpp:138
@@ -136,3 +137,3 @@
   "  typedef int non_dependent_type;\n"
   "  dependent_type dependent_type_var;\n"
   "  non_dependent_type non_dependent_type_var;\n"

rnk wrote:
> What's supposed to be printed for dependent_type_var?
I'm not clever enough to generate one that compiles when it is at the end of 
the TU.

When not at the end of the TU, this prints: FOO::dependent_type, omitting 
the keyword.

I don't think this is worth adding as a test-case.



http://reviews.llvm.org/D17214



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


Re: [PATCH] D17218: [Clang] Fix remaining Clang-tidy readability-redundant-control-flow warnings; other minor fixes

2016-02-12 Thread Hans Wennborg via cfe-commits
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rL LLVM

http://reviews.llvm.org/D17218



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


r260755 - Darwin: pass -stdlib=libc++ down to cc1 whenever we're targeting libc++

2016-02-12 Thread Tim Northover via cfe-commits
Author: tnorthover
Date: Fri Feb 12 16:30:42 2016
New Revision: 260755

URL: http://llvm.org/viewvc/llvm-project?rev=260755&view=rev
Log:
Darwin: pass -stdlib=libc++ down to cc1 whenever we're targeting libc++

Recent refactoring meant it only got passed down when explicitly specified,
which breaks header search on Darwin.

Added:
cfe/trunk/darwin-stdlib.cpp
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp

Added: cfe/trunk/darwin-stdlib.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/darwin-stdlib.cpp?rev=260755&view=auto
==
--- cfe/trunk/darwin-stdlib.cpp (added)
+++ cfe/trunk/darwin-stdlib.cpp Fri Feb 12 16:30:42 2016
@@ -0,0 +1,16 @@
+// RUN: %clang -target x86_64-apple-darwin -arch arm64 
-miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-LIBCXX
+// RUN: %clang -target x86_64-apple-darwin -mmacosx-version-min=10.8 %s -### 
2>&1 | FileCheck %s --check-prefix=CHECK-LIBSTDCXX
+// RUN: %clang -target x86_64-apple-darwin -mmacosx-version-min=10.9 %s -### 
2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX
+// RUN: %clang -target x86_64-apple-darwin -arch armv7s 
-miphoneos-version-min=6.1 %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-LIBSTDCXX
+// RUN: %clang -target x86_64-apple-darwin -arch armv7s 
-miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-LIBCXX
+// RUN: %clang -target x86_64-apple-darwin -arch armv7k %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-LIBCXX
+
+// The purpose of this test is that the libc++ headers should be found
+// properly. At the moment this is done by passing -stdlib=libc++ down to the
+// cc1 invocation. If and when we change to finding them in the driver this 
test
+// should reflect that.
+
+// CHECK-LIBCXX: -stdlib=libc++
+
+// CHECK-LIBSTDCXX-NOT: -stdlib=libc++
+// CHECK-LIBSTDCXX-NOT: -stdlib=libstdc++

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=260755&r1=260754&r2=260755&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Feb 12 16:30:42 2016
@@ -1030,6 +1030,7 @@ DerivedArgList *Darwin::TranslateArgs(co
   const char *BoundArch) const {
   // First get the generic Apple args, before moving onto Darwin-specific ones.
   DerivedArgList *DAL = MachO::TranslateArgs(Args, BoundArch);
+  const OptTable &Opts = getDriver().getOpts();
 
   // If no architecture is bound, none of the translations here are relevant.
   if (!BoundArch)
@@ -1060,6 +1061,11 @@ DerivedArgList *Darwin::TranslateArgs(co
 }
   }
 
+  if (!Args.getLastArg(options::OPT_stdlib_EQ) &&
+  GetDefaultCXXStdlibType() == ToolChain::CST_Libcxx)
+DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_stdlib_EQ),
+  "libc++");
+
   // Validate the C++ standard library choice.
   CXXStdlibType Type = GetCXXStdlibType(*DAL);
   if (Type == ToolChain::CST_Libcxx) {


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


[PATCH] D17218: [Clang] Fix remaining Clang-tidy readability-redundant-control-flow warnings; other minor fixes

2016-02-12 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko created this revision.
Eugene.Zelenko added reviewers: hans, aaron.ballman.
Eugene.Zelenko added a subscriber: cfe-commits.
Eugene.Zelenko set the repository for this revision to rL LLVM.

I checked this patch on my own build on RHEL 6. Regressions were OK.

Repository:
  rL LLVM

http://reviews.llvm.org/D17218

Files:
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/Types.cpp
  lib/Index/USRGeneration.cpp
  lib/Lex/PPDirectives.cpp
  lib/Lex/TokenLexer.cpp
  lib/Parse/ParseObjc.cpp
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaExprObjC.cpp
  lib/Sema/SemaInit.cpp
  lib/Sema/SemaObjCProperty.cpp
  lib/Sema/SemaTemplate.cpp

Index: lib/Parse/ParseObjc.cpp
===
--- lib/Parse/ParseObjc.cpp
+++ lib/Parse/ParseObjc.cpp
@@ -21,6 +21,7 @@
 #include "clang/Sema/Scope.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
+
 using namespace clang;
 
 /// Skips attributes after an Objective-C @ directive. Emits a diagnostic.
@@ -99,16 +100,20 @@
   Sema &Actions;
   Scope *S;
   ObjCTypeParamList *Params;
+
 public:
   ObjCTypeParamListScope(Sema &Actions, Scope *S)
   : Actions(Actions), S(S), Params(nullptr) {}
+
   ~ObjCTypeParamListScope() {
 leave();
   }
+
   void enter(ObjCTypeParamList *P) {
 assert(!Params);
 Params = P;
   }
+
   void leave() {
 if (Params)
   Actions.popObjCTypeParamList(S, Params);
@@ -1961,7 +1966,6 @@
   }
   HelperActionsForIvarDeclarations(interfaceDecl, atLoc,
T, AllIvarDecls, false);
-  return;
 }
 
 ///   objc-protocol-declaration:
@@ -2938,7 +2942,6 @@
   InMessageExpression)
 return false;
   
-  
   ParsedType Type;
 
   if (Tok.is(tok::annot_typename)) 
@@ -3567,7 +3570,7 @@
  T.getOpenLocation(),
  T.getCloseLocation(),
  !HasOptionalParen);
- }
+}
 
 void Parser::ParseLexedObjCMethodDefs(LexedMethod &LM, bool parseMethod) {
   // MCDecl might be null due to error in method or c-function  prototype, etc.
@@ -3623,6 +3626,4 @@
   while (Tok.getLocation() != OrigLoc && Tok.isNot(tok::eof))
 ConsumeAnyToken();
   }
-  
-  return;
 }
Index: lib/Index/USRGeneration.cpp
===
--- lib/Index/USRGeneration.cpp
+++ lib/Index/USRGeneration.cpp
@@ -90,18 +90,23 @@
   void VisitVarDecl(const VarDecl *D);
   void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D);
   void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D);
+
   void VisitLinkageSpecDecl(const LinkageSpecDecl *D) {
 IgnoreResults = true;
   }
+
   void VisitUsingDirectiveDecl(const UsingDirectiveDecl *D) {
 IgnoreResults = true;
   }
+
   void VisitUsingDecl(const UsingDecl *D) {
 IgnoreResults = true;
   }
+
   void VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D) {
 IgnoreResults = true;
   }
+
   void VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl *D) {
 IgnoreResults = true;
   }
@@ -126,14 +131,17 @@
   void GenObjCClass(StringRef cls) {
 generateUSRForObjCClass(cls, Out);
   }
+
   /// Generate a USR for an Objective-C class category.
   void GenObjCCategory(StringRef cls, StringRef cat) {
 generateUSRForObjCCategory(cls, cat, Out);
   }
+
   /// Generate a USR fragment for an Objective-C property.
   void GenObjCProperty(StringRef prop) {
 generateUSRForObjCProperty(prop, Out);
   }
+
   /// Generate a USR for an Objective-C protocol.
   void GenObjCProtocol(StringRef prot) {
 generateUSRForObjCProtocol(prot, Out);
@@ -148,7 +156,6 @@
   ///  the decl had no name.
   bool EmitDeclName(const NamedDecl *D);
 };
-
 } // end anonymous namespace
 
 //===--===//
@@ -287,13 +294,11 @@
 void USRGenerator::VisitNonTypeTemplateParmDecl(
 const NonTypeTemplateParmDecl *D) {
   GenLoc(D, /*IncludeOffset=*/true);
-  return;
 }
 
 void USRGenerator::VisitTemplateTemplateParmDecl(
 const TemplateTemplateParmDecl *D) {
   GenLoc(D, /*IncludeOffset=*/true);
-  return;
 }
 
 void USRGenerator::VisitNamespaceDecl(const NamespaceDecl *D) {
@@ -500,7 +505,6 @@
 
 void USRGenerator::VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) {
   GenLoc(D, /*IncludeOffset=*/true);
-  return;
 }
 
 bool USRGenerator::GenLoc(const Decl *D, bool IncludeOffset) {
@@ -875,4 +879,3 @@
   Out << MD->getName()->getName();
   return false;
 }
-
Index: lib/Driver/ToolChain.cpp
===
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -515,7 +515,6 @@
   if (!needsProfileRT(Args)) return;
 
   CmdArgs.push_back

[PATCH] D17217: Bail on compilation as soon as a job fails.

2016-02-12 Thread Justin Lebar via cfe-commits
jlebar created this revision.
jlebar added a reviewer: rafael.
jlebar added subscribers: tra, echristo, jhen, cfe-commits.

(Re-land of r260448, which was reverted in r260522 due to a test failure
in Driver/output-file-cleanup.c that only showed up in fresh builds.)

Previously we attempted to be smart; if one job failed, we'd run all
jobs that didn't depend on the failing job.

Problem is, this doesn't work well for e.g. CUDA compilation without
-save-temps.  In this case, the device-side and host-side Assemble
actions (which actually are responsible for preprocess, compile,
backend, and assemble, since we're not saving temps) are necessarily
distinct.  So our clever heuristic doesn't help us, and we repeat every
error message once for host and once for each device arch.

The main effect of this change, other than fixing CUDA, is that if you
pass multiple cc files to one instance of clang and you get a compile
error, we'll stop when the first cc1 job fails.

http://reviews.llvm.org/D17217

Files:
  lib/Driver/Compilation.cpp
  test/Driver/output-file-cleanup.c

Index: test/Driver/output-file-cleanup.c
===
--- test/Driver/output-file-cleanup.c
+++ test/Driver/output-file-cleanup.c
@@ -38,14 +38,17 @@
 // RUN: test -f %t1.s
 // RUN: test ! -f %t2.s
 
+// When given multiple .c files to compile, clang compiles them in order until
+// it hits an error, at which point it stops.
+//
 // RUN: touch %t1.c
 // RUN: echo "invalid C code" > %t2.c
 // RUN: touch %t3.c
 // RUN: echo "invalid C code" > %t4.c
 // RUN: touch %t5.c
 // RUN: cd %T && not %clang -S %t1.c %t2.c %t3.c %t4.c %t5.c
 // RUN: test -f %t1.s
 // RUN: test ! -f %t2.s
-// RUN: test -f %t3.s
+// RUN: test ! -f %t3.s
 // RUN: test ! -f %t4.s
-// RUN: test -f %t5.s
+// RUN: test ! -f %t5.s
Index: lib/Driver/Compilation.cpp
===
--- lib/Driver/Compilation.cpp
+++ lib/Driver/Compilation.cpp
@@ -163,39 +163,17 @@
   return ExecutionFailed ? 1 : Res;
 }
 
-typedef SmallVectorImpl< std::pair > FailingCommandList;
-
-static bool ActionFailed(const Action *A,
- const FailingCommandList &FailingCommands) {
-
-  if (FailingCommands.empty())
-return false;
-
-  for (FailingCommandList::const_iterator CI = FailingCommands.begin(),
- CE = FailingCommands.end(); CI != CE; ++CI)
-if (A == &(CI->second->getSource()))
-  return true;
-
-  for (Action::const_iterator AI = A->begin(), AE = A->end(); AI != AE; ++AI)
-if (ActionFailed(*AI, FailingCommands))
-  return true;
-
-  return false;
-}
-
-static bool InputsOk(const Command &C,
- const FailingCommandList &FailingCommands) {
-  return !ActionFailed(&C.getSource(), FailingCommands);
-}
-
-void Compilation::ExecuteJobs(const JobList &Jobs,
-  FailingCommandList &FailingCommands) const {
+void Compilation::ExecuteJobs(
+const JobList &Jobs,
+SmallVectorImpl> &FailingCommands) const {
   for (const auto &Job : Jobs) {
-if (!InputsOk(Job, FailingCommands))
-  continue;
 const Command *FailingCommand = nullptr;
-if (int Res = ExecuteCommand(Job, FailingCommand))
+if (int Res = ExecuteCommand(Job, FailingCommand)) {
   FailingCommands.push_back(std::make_pair(Res, FailingCommand));
+  // Bail as soon as one command fails, so we don't output duplicate error
+  // messages if we die on e.g. the same file.
+  return;
+}
   }
 }
 


Index: test/Driver/output-file-cleanup.c
===
--- test/Driver/output-file-cleanup.c
+++ test/Driver/output-file-cleanup.c
@@ -38,14 +38,17 @@
 // RUN: test -f %t1.s
 // RUN: test ! -f %t2.s
 
+// When given multiple .c files to compile, clang compiles them in order until
+// it hits an error, at which point it stops.
+//
 // RUN: touch %t1.c
 // RUN: echo "invalid C code" > %t2.c
 // RUN: touch %t3.c
 // RUN: echo "invalid C code" > %t4.c
 // RUN: touch %t5.c
 // RUN: cd %T && not %clang -S %t1.c %t2.c %t3.c %t4.c %t5.c
 // RUN: test -f %t1.s
 // RUN: test ! -f %t2.s
-// RUN: test -f %t3.s
+// RUN: test ! -f %t3.s
 // RUN: test ! -f %t4.s
-// RUN: test -f %t5.s
+// RUN: test ! -f %t5.s
Index: lib/Driver/Compilation.cpp
===
--- lib/Driver/Compilation.cpp
+++ lib/Driver/Compilation.cpp
@@ -163,39 +163,17 @@
   return ExecutionFailed ? 1 : Res;
 }
 
-typedef SmallVectorImpl< std::pair > FailingCommandList;
-
-static bool ActionFailed(const Action *A,
- const FailingCommandList &FailingCommands) {
-
-  if (FailingCommands.empty())
-return false;
-
-  for (FailingCommandList::const_iterator CI = FailingCommands.begin(),
- CE = FailingCommands.end(); CI != CE; ++CI)
-if (A == &(CI->second->getSource()))
-  return true;
-
-  for (Action::const_iterator AI = A->begin()

[PATCH] D17216: Make test/Driver/output-file-cleanup.c hermetic.

2016-02-12 Thread Justin Lebar via cfe-commits
jlebar created this revision.
jlebar added a reviewer: rafael.
jlebar added a subscriber: cfe-commits.

It checks that certain files do and exist, so make sure that they don't
exist at the beginning of the test.

This hid a failure in r260448; to see the failure, you had to run the test with
a clean-ish objdir.

http://reviews.llvm.org/D17216

Files:
  test/Driver/output-file-cleanup.c

Index: test/Driver/output-file-cleanup.c
===
--- test/Driver/output-file-cleanup.c
+++ test/Driver/output-file-cleanup.c
@@ -1,3 +1,5 @@
+// RUN: rm -f "%t.d" "%t1.s" "%t2.s" "%t3.s" "%t4.s" "%t5.s"
+//
 // RUN: touch %t.s
 // RUN: not %clang -S -DCRASH -o %t.s -MMD -MF %t.d %s
 // RUN: test ! -f %t.s


Index: test/Driver/output-file-cleanup.c
===
--- test/Driver/output-file-cleanup.c
+++ test/Driver/output-file-cleanup.c
@@ -1,3 +1,5 @@
+// RUN: rm -f "%t.d" "%t1.s" "%t2.s" "%t3.s" "%t4.s" "%t5.s"
+//
 // RUN: touch %t.s
 // RUN: not %clang -S -DCRASH -o %t.s -MMD -MF %t.d %s
 // RUN: test ! -f %t.s
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17214: Stop using "template" when printing qualtype names

2016-02-12 Thread Reid Kleckner via cfe-commits
rnk added a subscriber: rnk.
rnk accepted this revision.
rnk added a reviewer: rnk.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm

This code seems like it's intended to avoid operating on dependent types, so it 
shouldn't need the template keyword. It's hard to have a fully qualified name 
that's valid at global scope and still somehow mentions template parameters.



Comment at: unittests/Tooling/QualTypeNamesTest.cpp:138
@@ -136,3 +137,3 @@
   "  typedef int non_dependent_type;\n"
   "  dependent_type dependent_type_var;\n"
   "  non_dependent_type non_dependent_type_var;\n"

What's supposed to be printed for dependent_type_var?


http://reviews.llvm.org/D17214



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


[PATCH] D17215: Fix PR14211 Crash for explicit instantiation of overloaded template function within class template

2016-02-12 Thread don hinton via cfe-commits
hintonda created this revision.
hintonda added reviewers: lvoufo, rjmccall.
hintonda added a subscriber: cfe-commits.

Fix PR14211

Only add FunctionDecl's that are actual template methods to the set of
matches passed to getMostSpecializied() -- otherwise it will
assert/crash.  If a match to a non-template method is found, save the
pointer and don't call getMostSpecialized().

http://reviews.llvm.org/D17215

Files:
  lib/Sema/SemaTemplate.cpp
  test/SemaCXX/pr14211-crash-on-invalid.cpp

Index: test/SemaCXX/pr14211-crash-on-invalid.cpp
===
--- /dev/null
+++ test/SemaCXX/pr14211-crash-on-invalid.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+// Don't crash (PR14211).
+
+template
+struct X {
+  void bar(T t) {}
+  void foo(T t, int i) {}
+  template
+  void foo(T t, U i) {}
+};
+
+template class X; // expected-note {{previous explicit instantiation 
is here}}
+template void X::foo(double t, int i); // expected-error {{duplicate 
explicit instantiation of 'foo'}}
+template void X::foo(double t, int i);
Index: lib/Sema/SemaTemplate.cpp
===
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -7826,19 +7826,23 @@
   //  instantiated from the member definition associated with its class
   //  template.
   UnresolvedSet<8> Matches;
+  FunctionDecl *Specialization = nullptr;
   TemplateSpecCandidateSet FailedCandidates(D.getIdentifierLoc());
   for (LookupResult::iterator P = Previous.begin(), PEnd = Previous.end();
P != PEnd; ++P) {
 NamedDecl *Prev = *P;
 if (!HasExplicitTemplateArgs) {
   if (CXXMethodDecl *Method = dyn_cast(Prev)) {
 QualType Adjusted = adjustCCAndNoReturn(R, Method->getType());
 if (Context.hasSameUnqualifiedType(Method->getType(), Adjusted)) {
-  Matches.clear();
-
-  Matches.addDecl(Method, P.getAccess());
-  if (Method->getTemplateSpecializationKind() == TSK_Undeclared)
-break;
+  if (cast(Method)->getPrimaryTemplate()){
+Matches.clear();
+
+Matches.addDecl(Method, P.getAccess());
+if (Method->getTemplateSpecializationKind() == TSK_Undeclared)
+  break;
+  } else
+Specialization = Method;
 }
   }
 }
@@ -7866,18 +7870,20 @@
   }
 
   // Find the most specialized function template specialization.
-  UnresolvedSetIterator Result = getMostSpecialized(
-  Matches.begin(), Matches.end(), FailedCandidates,
-  D.getIdentifierLoc(),
-  PDiag(diag::err_explicit_instantiation_not_known) << Name,
-  PDiag(diag::err_explicit_instantiation_ambiguous) << Name,
-  PDiag(diag::note_explicit_instantiation_candidate));
-
-  if (Result == Matches.end())
-return true;
+  if (!Specialization) {
+UnresolvedSetIterator Result = getMostSpecialized(
+Matches.begin(), Matches.end(), FailedCandidates,
+D.getIdentifierLoc(),
+PDiag(diag::err_explicit_instantiation_not_known) << Name,
+PDiag(diag::err_explicit_instantiation_ambiguous) << Name,
+PDiag(diag::note_explicit_instantiation_candidate));
+
+if (Result == Matches.end())
+  return true;
 
-  // Ignore access control bits, we don't need them for redeclaration checking.
-  FunctionDecl *Specialization = cast(*Result);
+// Ignore access control bits, we don't need them for redeclaration 
checking.
+Specialization = cast(*Result);
+  }
 
   // C++11 [except.spec]p4
   // In an explicit instantiation an exception-specification may be specified,


Index: test/SemaCXX/pr14211-crash-on-invalid.cpp
===
--- /dev/null
+++ test/SemaCXX/pr14211-crash-on-invalid.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+// Don't crash (PR14211).
+
+template
+struct X {
+  void bar(T t) {}
+  void foo(T t, int i) {}
+  template
+  void foo(T t, U i) {}
+};
+
+template class X; // expected-note {{previous explicit instantiation is here}}
+template void X::foo(double t, int i); // expected-error {{duplicate explicit instantiation of 'foo'}}
+template void X::foo(double t, int i);
Index: lib/Sema/SemaTemplate.cpp
===
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -7826,19 +7826,23 @@
   //  instantiated from the member definition associated with its class
   //  template.
   UnresolvedSet<8> Matches;
+  FunctionDecl *Specialization = nullptr;
   TemplateSpecCandidateSet FailedCandidates(D.getIdentifierLoc());
   for (LookupResult::iterator P = Previous.begin(), PEnd = Previous.end();
P != PEnd; ++P) {
 NamedDecl *Prev = *P;
 if (!HasExplicitTemplateArgs) {
   if (CXXMethodDecl *Method = dyn_cast(Prev)) {
 QualType Adjusted = adjustCCAndNoReturn(R, Method->getType());
 if (Cont

Re: [PATCH] D16514: Add -stop-on-failure driver option, and enable it by default for CUDA compiles.

2016-02-12 Thread Justin Lebar via cfe-commits
jlebar added a comment.

espindola reverted this in r260522 because of test failures in 
Driver/output-file-cleanup.c.

The reason I didn't catch this locally is that the test is non-hermetic -- if 
it passed once in an objdir, this patch does not make it fail again.  You have 
to nuke (part of) the objdir before it will fail.

I'll send a patch to make the test hermetic.  Unsure yet whether it's a bug in 
this patch or the test that the test fails at all.


Repository:
  rL LLVM

http://reviews.llvm.org/D16514



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


[PATCH] D17214: Stop using "template" when printing qualtype names

2016-02-12 Thread Sterling Augustine via cfe-commits
saugustine created this revision.
saugustine added a reviewer: rsmith.
saugustine added subscribers: cfe-commits, klimek.

The keyword "template" isn't necessary when
printing a fully-qualified qualtype name, and, in fact,
results in a syntax error if one tries to use it. So stop
printing it.

http://reviews.llvm.org/D17214

Files:
  lib/Tooling/Core/QualTypeNames.cpp
  unittests/Tooling/QualTypeNamesTest.cpp

Index: unittests/Tooling/QualTypeNamesTest.cpp
===
--- unittests/Tooling/QualTypeNamesTest.cpp
+++ unittests/Tooling/QualTypeNamesTest.cpp
@@ -85,7 +85,8 @@
   // Namespace alias
   Visitor.ExpectedQualTypeNames["CheckL"] = "A::B::C::MyInt";
   Visitor.ExpectedQualTypeNames["non_dependent_type_var"] =
-  "template Foo::non_dependent_type";
+  "Foo::non_dependent_type";
+  Visitor.ExpectedQualTypeNames["AnEnumVar"] = "EnumScopeClass::AnEnum";
   Visitor.runOver(
   "int CheckInt;\n"
   "namespace A {\n"
@@ -143,6 +144,11 @@
   "  var.dependent_type_var = 0;\n"
   "var.non_dependent_type_var = 0;\n"
   "}\n"
+  "class EnumScopeClass {\n"
+  "public:\n"
+  "  enum AnEnum { ZERO, ONE };\n"
+  "};\n"
+  "EnumScopeClass::AnEnum AnEnumVar;\n"
 );
 
   TypeNameVisitor Complex;
Index: lib/Tooling/Core/QualTypeNames.cpp
===
--- lib/Tooling/Core/QualTypeNames.cpp
+++ lib/Tooling/Core/QualTypeNames.cpp
@@ -329,7 +329,8 @@
 NestedNameSpecifier *createNestedNameSpecifier(
 const ASTContext &Ctx, const TypeDecl *TD, bool FullyQualify) {
   return NestedNameSpecifier::Create(Ctx, createOuterNNS(Ctx, TD, 
FullyQualify),
- true /*Template*/, TD->getTypeForDecl());
+ false /*No TemplateKeyword*/,
+ TD->getTypeForDecl());
 }
 
 /// \brief Return the fully qualified type, including fully-qualified


Index: unittests/Tooling/QualTypeNamesTest.cpp
===
--- unittests/Tooling/QualTypeNamesTest.cpp
+++ unittests/Tooling/QualTypeNamesTest.cpp
@@ -85,7 +85,8 @@
   // Namespace alias
   Visitor.ExpectedQualTypeNames["CheckL"] = "A::B::C::MyInt";
   Visitor.ExpectedQualTypeNames["non_dependent_type_var"] =
-  "template Foo::non_dependent_type";
+  "Foo::non_dependent_type";
+  Visitor.ExpectedQualTypeNames["AnEnumVar"] = "EnumScopeClass::AnEnum";
   Visitor.runOver(
   "int CheckInt;\n"
   "namespace A {\n"
@@ -143,6 +144,11 @@
   "  var.dependent_type_var = 0;\n"
   "var.non_dependent_type_var = 0;\n"
   "}\n"
+  "class EnumScopeClass {\n"
+  "public:\n"
+  "  enum AnEnum { ZERO, ONE };\n"
+  "};\n"
+  "EnumScopeClass::AnEnum AnEnumVar;\n"
 );
 
   TypeNameVisitor Complex;
Index: lib/Tooling/Core/QualTypeNames.cpp
===
--- lib/Tooling/Core/QualTypeNames.cpp
+++ lib/Tooling/Core/QualTypeNames.cpp
@@ -329,7 +329,8 @@
 NestedNameSpecifier *createNestedNameSpecifier(
 const ASTContext &Ctx, const TypeDecl *TD, bool FullyQualify) {
   return NestedNameSpecifier::Create(Ctx, createOuterNNS(Ctx, TD, FullyQualify),
- true /*Template*/, TD->getTypeForDecl());
+ false /*No TemplateKeyword*/,
+ TD->getTypeForDecl());
 }
 
 /// \brief Return the fully qualified type, including fully-qualified
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r260719 - Added missing '__'.

2016-02-12 Thread Eric Christopher via cfe-commits
*nod* I figure at least include them into something :)

-eric

On Fri, Feb 12, 2016 at 1:31 PM Artem Belevich  wrote:

> No problem. It's hard to test CUDA wrappers properly without real CUDA
> headers. :-(
>
>
> On Fri, Feb 12, 2016 at 1:28 PM, Eric Christopher 
> wrote:
>
>> Ah thanks. Since my running the test suite yesterday didn't notice,
>> perhaps a test would be appropriate as well. :)
>>
>> On Fri, Feb 12, 2016, 12:31 PM Artem Belevich via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: tra
>>> Date: Fri Feb 12 14:26:43 2016
>>> New Revision: 260719
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=260719&view=rev
>>> Log:
>>> Added missing '__'.
>>>
>>> Modified:
>>> cfe/trunk/lib/Headers/__clang_cuda_cmath.h
>>>
>>> Modified: cfe/trunk/lib/Headers/__clang_cuda_cmath.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__clang_cuda_cmath.h?rev=260719&r1=260718&r2=260719&view=diff
>>>
>>> ==
>>> --- cfe/trunk/lib/Headers/__clang_cuda_cmath.h (original)
>>> +++ cfe/trunk/lib/Headers/__clang_cuda_cmath.h Fri Feb 12 14:26:43 2016
>>> @@ -156,7 +156,7 @@ using ::nanf;
>>>  using ::nearbyint;
>>>  using ::nextafter;
>>>  __DEVICE__ float nexttoward(float __from, float __to) {
>>> -  return __builtin_nexttowardf(from, to);
>>> +  return __builtin_nexttowardf(__from, __to);
>>>  }
>>>  __DEVICE__ double nexttoward(double __from, double __to) {
>>>return __builtin_nexttoward(__from, __to);
>>>
>>>
>>> ___
>>> cfe-commits mailing list
>>> cfe-commits@lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>
>>
>
>
> --
> --Artem Belevich
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r260744 - [CMake] Fixing bots I broke.

2016-02-12 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Fri Feb 12 15:46:25 2016
New Revision: 260744

URL: http://llvm.org/viewvc/llvm-project?rev=260744&view=rev
Log:
[CMake] Fixing bots I broke.

Modified:
cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=260744&r1=260743&r2=260744&view=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Fri Feb 12 15:46:25 2016
@@ -605,7 +605,7 @@ set(CLANG_ORDER_FILE ${CMAKE_CURRENT_BIN
   "Order file to use when compiling clang in order to improve startup time.")
 
 if(CLANG_ORDER_FILE AND NOT EXISTS ${CLANG_ORDER_FILE})
-  string(FIND CLANG_ORDER_FILE "${CMAKE_CURRENT_BINARY_DIR}" PATH_START)
+  string(FIND "${CLANG_ORDER_FILE}" "${CMAKE_CURRENT_BINARY_DIR}" PATH_START)
   if(PATH_START EQUAL 0)
 file(WRITE ${CLANG_ORDER_FILE} "\n")
   else()


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


Re: [PATCH] D16012: Carry raw string literal information through to the AST StringLiteral representation

2016-02-12 Thread Richard Smith via cfe-commits
rsmith added a comment.

In http://reviews.llvm.org/D16012#351821, @aaron.ballman wrote:

> Ping. Richard, I think we've provided justification that warrants this 
> functionality (mostly for clang-tidy checks).


I am not convinced. This flag does not seem to make sense for `StringLiteral`, 
because it is not a property of the AST-level `StringLiteral` object; it is a 
property of the underlying tokens instead (and in general the `StringLiteral` 
object corresponds to multiple underlying tokens with differing rawness). We do 
not store other spelling information from the underlying tokens, such as 
whether a character was written literally or with an escape sequence, and in 
AST printing we do not preserve that; I do not see why this case should be any 
different. (We do store the translated value of the string, but that is a 
different case, both because it's part of the semantic model of the expression 
-- we don't want IR generation doing semantic string literal analysis -- and 
because it's needed frequently enough to justify caching it.)

I'm definitely sympathetic to making `StringLiteralParser` expose information 
on whether each token in the string literal is a raw string literal, and if so 
what prefix it uses. I can also see an argument for exposing an easier 
interface for constructing a `StringLiteralParser` from an existing 
`StringLiteral` object (note that `StringLiteral::getLocationOfByte` already 
does this dance). But I don't see that there's a compelling reason to break out 
and cache this information separately from its actual point of truth.

If we want to make AST printing round-trip string literals as-written, we 
should make it re-lex the string literal tokens and print them out verbatim -- 
making this work for raw vs non-raw strings but not for escapes versus 
non-escapes, or different flavours of escape sequence, doesn't make a lot of 
sense to me.


http://reviews.llvm.org/D16012



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


Re: [PATCH] D16999: [CMake] Improve the clang order-file generation workflow

2016-02-12 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL260742: [CMake] Improve the clang order-file generation 
workflow (authored by cbieneman).

Changed prior to commit:
  http://reviews.llvm.org/D16999?vs=47241&id=47852#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16999

Files:
  cfe/trunk/CMakeLists.txt
  cfe/trunk/tools/driver/CMakeLists.txt
  cfe/trunk/utils/perf-training/CMakeLists.txt

Index: cfe/trunk/tools/driver/CMakeLists.txt
===
--- cfe/trunk/tools/driver/CMakeLists.txt
+++ cfe/trunk/tools/driver/CMakeLists.txt
@@ -87,8 +87,24 @@
   set(TOOL_INFO_BUILD_VERSION)
 endif()
 
-if(CLANG_ORDER_FILE AND EXISTS CLANG_ORDER_FILE)
-  target_link_libraries(clang "-Wl,-order_file,${CLANG_ORDER_FILE}")
+if(CLANG_ORDER_FILE)
+  include(CMakePushCheckState)
+
+  function(check_linker_flag flag out_var)
+cmake_push_check_state()
+set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
+check_cxx_compiler_flag("" ${out_var})
+cmake_pop_check_state()
+  endfunction()
+
+  # This is a test to ensure the actual order file works with the linker.
+  check_linker_flag("-Wl,-order_file,${CLANG_ORDER_FILE}"
+LINKER_ORDER_FILE_WORKS)
+  
+  if(LINKER_ORDER_FILE_WORKS)
+target_link_libraries(clang "-Wl,-order_file,${CLANG_ORDER_FILE}")
+set_target_properties(clang PROPERTIES LINK_DEPENDS ${CLANG_ORDER_FILE})
+  endif()
 endif()
 
 if(WITH_POLLY AND LINK_POLLY_INTO_TOOLS)
Index: cfe/trunk/utils/perf-training/CMakeLists.txt
===
--- cfe/trunk/utils/perf-training/CMakeLists.txt
+++ cfe/trunk/utils/perf-training/CMakeLists.txt
@@ -55,9 +55,8 @@
 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py 
clean ${CMAKE_CURRENT_BINARY_DIR} dtrace
 COMMENT "Clearing old dtrace data")
 
-
   add_custom_target(generate-order-file
-COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py 
gen-order-file --binary $ --output 
${CMAKE_CURRENT_BINARY_DIR}/clang.order ${CMAKE_CURRENT_BINARY_DIR}
+COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py 
gen-order-file --binary $ --output ${CLANG_ORDER_FILE} 
${CMAKE_CURRENT_BINARY_DIR}
 COMMENT "Generating order file"
 DEPENDS generate-dtrace-logs)
 endif()
Index: cfe/trunk/CMakeLists.txt
===
--- cfe/trunk/CMakeLists.txt
+++ cfe/trunk/CMakeLists.txt
@@ -595,18 +595,24 @@
   add_subdirectory(docs)
 endif()
 
-if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/clang.order")
-  file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/clang.order")
-endif()
-
-if(CLANG_ORDER_FILE STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/clang.order")
+# this line is needed as a cleanup to ensure that any CMakeCaches with the old
+# default value get updated to the new default.
+if(CLANG_ORDER_FILE STREQUAL "")
   unset(CLANG_ORDER_FILE CACHE)
-  unset(CLANG_ORDER_FILE)
 endif()
 
-set(CLANG_ORDER_FILE "" CACHE FILEPATH
+set(CLANG_ORDER_FILE ${CMAKE_CURRENT_BINARY_DIR}/clang.order CACHE FILEPATH
   "Order file to use when compiling clang in order to improve startup time.")
 
+if(CLANG_ORDER_FILE AND NOT EXISTS ${CLANG_ORDER_FILE})
+  string(FIND CLANG_ORDER_FILE "${CMAKE_CURRENT_BINARY_DIR}" PATH_START)
+  if(PATH_START EQUAL 0)
+file(WRITE ${CLANG_ORDER_FILE} "\n")
+  else()
+message(FATAL_ERROR "Specified order file '${CLANG_ORDER_FILE}' does not 
exist.")
+  endif()
+endif()
+
 if (CLANG_BUILT_STANDALONE OR CMAKE_VERSION VERSION_EQUAL 3 OR
 CMAKE_VERSION VERSION_GREATER 3)
   # Generate a list of CMake library targets so that other CMake projects can


Index: cfe/trunk/tools/driver/CMakeLists.txt
===
--- cfe/trunk/tools/driver/CMakeLists.txt
+++ cfe/trunk/tools/driver/CMakeLists.txt
@@ -87,8 +87,24 @@
   set(TOOL_INFO_BUILD_VERSION)
 endif()
 
-if(CLANG_ORDER_FILE AND EXISTS CLANG_ORDER_FILE)
-  target_link_libraries(clang "-Wl,-order_file,${CLANG_ORDER_FILE}")
+if(CLANG_ORDER_FILE)
+  include(CMakePushCheckState)
+
+  function(check_linker_flag flag out_var)
+cmake_push_check_state()
+set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
+check_cxx_compiler_flag("" ${out_var})
+cmake_pop_check_state()
+  endfunction()
+
+  # This is a test to ensure the actual order file works with the linker.
+  check_linker_flag("-Wl,-order_file,${CLANG_ORDER_FILE}"
+LINKER_ORDER_FILE_WORKS)
+  
+  if(LINKER_ORDER_FILE_WORKS)
+target_link_libraries(clang "-Wl,-order_file,${CLANG_ORDER_FILE}")
+set_target_properties(clang PROPERTIES LINK_DEPENDS ${CLANG_ORDER_FILE})
+  endif()
 endif()
 
 if(WITH_POLLY AND LINK_POLLY_INTO_TOOLS)
Index: cfe/trunk/utils/perf-training/CMakeLists.txt
===
--- cfe/trunk/utils/perf-training/CMakeLists.txt
+++ cfe/trunk/ut

r260742 - [CMake] Improve the clang order-file generation workflow

2016-02-12 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Fri Feb 12 15:36:55 2016
New Revision: 260742

URL: http://llvm.org/viewvc/llvm-project?rev=260742&view=rev
Log:
[CMake] Improve the clang order-file generation workflow

Summary:
This commit re-lands r259862. The underlying cause of the build breakage was an 
incorrectly written capabilities test. In tools/Driver/CMakeLists.txt I was 
attempting to check if a linker flag worked, the test was passing it to the 
compiler, not the linker. CMake doesn't have a linker test, so we have a 
hand-rolled one.

Original Patch Review: http://reviews.llvm.org/D16896

Original Summary:
With this change generating clang order files using dtrace uses the following 
workflow:

cmake 

ninja generate-order-file

ninja clang

This patch works by setting a default path to the order file (which can be 
overridden by the user). If the order file doesn't exist during configuration 
CMake will create an empty one.

CMake then ties up the dependencies between the clang link job and the order 
file, and generate-order-file overwrites CLANG_ORDER_FILE with the new order 
file.

Reviewers: bogner

Subscribers: cfe-commits

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

Modified:
cfe/trunk/CMakeLists.txt
cfe/trunk/tools/driver/CMakeLists.txt
cfe/trunk/utils/perf-training/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=260742&r1=260741&r2=260742&view=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Fri Feb 12 15:36:55 2016
@@ -595,18 +595,24 @@ if( CLANG_INCLUDE_DOCS )
   add_subdirectory(docs)
 endif()
 
-if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/clang.order")
-  file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/clang.order")
-endif()
-
-if(CLANG_ORDER_FILE STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/clang.order")
+# this line is needed as a cleanup to ensure that any CMakeCaches with the old
+# default value get updated to the new default.
+if(CLANG_ORDER_FILE STREQUAL "")
   unset(CLANG_ORDER_FILE CACHE)
-  unset(CLANG_ORDER_FILE)
 endif()
 
-set(CLANG_ORDER_FILE "" CACHE FILEPATH
+set(CLANG_ORDER_FILE ${CMAKE_CURRENT_BINARY_DIR}/clang.order CACHE FILEPATH
   "Order file to use when compiling clang in order to improve startup time.")
 
+if(CLANG_ORDER_FILE AND NOT EXISTS ${CLANG_ORDER_FILE})
+  string(FIND CLANG_ORDER_FILE "${CMAKE_CURRENT_BINARY_DIR}" PATH_START)
+  if(PATH_START EQUAL 0)
+file(WRITE ${CLANG_ORDER_FILE} "\n")
+  else()
+message(FATAL_ERROR "Specified order file '${CLANG_ORDER_FILE}' does not 
exist.")
+  endif()
+endif()
+
 if (CLANG_BUILT_STANDALONE OR CMAKE_VERSION VERSION_EQUAL 3 OR
 CMAKE_VERSION VERSION_GREATER 3)
   # Generate a list of CMake library targets so that other CMake projects can

Modified: cfe/trunk/tools/driver/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/CMakeLists.txt?rev=260742&r1=260741&r2=260742&view=diff
==
--- cfe/trunk/tools/driver/CMakeLists.txt (original)
+++ cfe/trunk/tools/driver/CMakeLists.txt Fri Feb 12 15:36:55 2016
@@ -87,8 +87,24 @@ if (APPLE)
   set(TOOL_INFO_BUILD_VERSION)
 endif()
 
-if(CLANG_ORDER_FILE AND EXISTS CLANG_ORDER_FILE)
-  target_link_libraries(clang "-Wl,-order_file,${CLANG_ORDER_FILE}")
+if(CLANG_ORDER_FILE)
+  include(CMakePushCheckState)
+
+  function(check_linker_flag flag out_var)
+cmake_push_check_state()
+set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
+check_cxx_compiler_flag("" ${out_var})
+cmake_pop_check_state()
+  endfunction()
+
+  # This is a test to ensure the actual order file works with the linker.
+  check_linker_flag("-Wl,-order_file,${CLANG_ORDER_FILE}"
+LINKER_ORDER_FILE_WORKS)
+  
+  if(LINKER_ORDER_FILE_WORKS)
+target_link_libraries(clang "-Wl,-order_file,${CLANG_ORDER_FILE}")
+set_target_properties(clang PROPERTIES LINK_DEPENDS ${CLANG_ORDER_FILE})
+  endif()
 endif()
 
 if(WITH_POLLY AND LINK_POLLY_INTO_TOOLS)

Modified: cfe/trunk/utils/perf-training/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/perf-training/CMakeLists.txt?rev=260742&r1=260741&r2=260742&view=diff
==
--- cfe/trunk/utils/perf-training/CMakeLists.txt (original)
+++ cfe/trunk/utils/perf-training/CMakeLists.txt Fri Feb 12 15:36:55 2016
@@ -55,9 +55,8 @@ if(DTRACE)
 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py 
clean ${CMAKE_CURRENT_BINARY_DIR} dtrace
 COMMENT "Clearing old dtrace data")
 
-
   add_custom_target(generate-order-file
-COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py 
gen-order-file --binary $ --output 
${CMAKE_CURRENT_BINARY_DIR}/clang.order ${CMAKE_CURRENT_BINARY_DIR}
+COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helpe

Re: r260719 - Added missing '__'.

2016-02-12 Thread Artem Belevich via cfe-commits
No problem. It's hard to test CUDA wrappers properly without real CUDA
headers. :-(


On Fri, Feb 12, 2016 at 1:28 PM, Eric Christopher 
wrote:

> Ah thanks. Since my running the test suite yesterday didn't notice,
> perhaps a test would be appropriate as well. :)
>
> On Fri, Feb 12, 2016, 12:31 PM Artem Belevich via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: tra
>> Date: Fri Feb 12 14:26:43 2016
>> New Revision: 260719
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=260719&view=rev
>> Log:
>> Added missing '__'.
>>
>> Modified:
>> cfe/trunk/lib/Headers/__clang_cuda_cmath.h
>>
>> Modified: cfe/trunk/lib/Headers/__clang_cuda_cmath.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__clang_cuda_cmath.h?rev=260719&r1=260718&r2=260719&view=diff
>>
>> ==
>> --- cfe/trunk/lib/Headers/__clang_cuda_cmath.h (original)
>> +++ cfe/trunk/lib/Headers/__clang_cuda_cmath.h Fri Feb 12 14:26:43 2016
>> @@ -156,7 +156,7 @@ using ::nanf;
>>  using ::nearbyint;
>>  using ::nextafter;
>>  __DEVICE__ float nexttoward(float __from, float __to) {
>> -  return __builtin_nexttowardf(from, to);
>> +  return __builtin_nexttowardf(__from, __to);
>>  }
>>  __DEVICE__ double nexttoward(double __from, double __to) {
>>return __builtin_nexttoward(__from, __to);
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>


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


Re: [PATCH] D16012: Carry raw string literal information through to the AST StringLiteral representation

2016-02-12 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

Ping. Richard, I think we've provided justification that warrants this 
functionality (mostly for clang-tidy checks). Any issues with the code?


http://reviews.llvm.org/D16012



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


Re: [PATCH] D17206: Fix AST printing of ascii char literals above 127.

2016-02-12 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

LGTM



Comment at: lib/AST/StmtPrinter.cpp:1253-1256
@@ -1252,2 +1252,6 @@
   default:
+// A character literal might be sign-extended, which
+// would result in an invalid \U escape sequence.
+if ((value & ~0xFFu) == ~0xFFu && Node->getKind() == 
CharacterLiteral::Ascii)
+  value &= 0xFFu;
 if (value < 256 && isPrintable((unsigned char)value))

Hmm, this is not correct for multicharacter `char` literals:

  auto n = '\xff\xff\xff\xff';

Here, the value of the literal is -1, but printing it as '\xff' would give a 
literal of a different type. However, we get that case wrong here in general 
(printing invalid \U... escapes), so this is no worse than today. Can you add a 
FIXME?


http://reviews.llvm.org/D17206



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


Re: r260719 - Added missing '__'.

2016-02-12 Thread Eric Christopher via cfe-commits
Ah thanks. Since my running the test suite yesterday didn't notice, perhaps
a test would be appropriate as well. :)

On Fri, Feb 12, 2016, 12:31 PM Artem Belevich via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: tra
> Date: Fri Feb 12 14:26:43 2016
> New Revision: 260719
>
> URL: http://llvm.org/viewvc/llvm-project?rev=260719&view=rev
> Log:
> Added missing '__'.
>
> Modified:
> cfe/trunk/lib/Headers/__clang_cuda_cmath.h
>
> Modified: cfe/trunk/lib/Headers/__clang_cuda_cmath.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__clang_cuda_cmath.h?rev=260719&r1=260718&r2=260719&view=diff
>
> ==
> --- cfe/trunk/lib/Headers/__clang_cuda_cmath.h (original)
> +++ cfe/trunk/lib/Headers/__clang_cuda_cmath.h Fri Feb 12 14:26:43 2016
> @@ -156,7 +156,7 @@ using ::nanf;
>  using ::nearbyint;
>  using ::nextafter;
>  __DEVICE__ float nexttoward(float __from, float __to) {
> -  return __builtin_nexttowardf(from, to);
> +  return __builtin_nexttowardf(__from, __to);
>  }
>  __DEVICE__ double nexttoward(double __from, double __to) {
>return __builtin_nexttoward(__from, __to);
>
>
> ___
> 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] D16999: [CMake] Improve the clang order-file generation workflow

2016-02-12 Thread Justin Bogner via cfe-commits
Chris Bieneman  writes:
> beanz created this revision.
> beanz added a reviewer: bogner.
> beanz added a subscriber: cfe-commits.
>
> This commit re-lands r259862. The underlying cause of the build
> breakage was an incorrectly written capabilities test. In
> tools/Driver/CMakeLists.txt I was attempting to check if a linker flag
> worked, the test was passing it to the compiler, not the linker. CMake
> doesn't have a linker test, so we have a hand-rolled one.
>
> Original Patch Review: http://reviews.llvm.org/D16896
>
> Original Summary:
> With this change generating clang order files using dtrace uses the
> following workflow:
>
> cmake 
>
> ninja generate-order-file
>
> ninja clang
>
> This patch works by setting a default path to the order file (which
> can be overridden by the user). If the order file doesn't exist during
> configuration CMake will create an empty one.
>
> CMake then ties up the dependencies between the clang link job and the
> order file, and generate-order-file overwrites CLANG_ORDER_FILE with
> the new order file.

This looks it'll work. I do have one comment / concern below, but as
long as that's addressed this LGTM.

> http://reviews.llvm.org/D16999
>
> Files:
>   CMakeLists.txt
>   tools/driver/CMakeLists.txt
>   utils/perf-training/CMakeLists.txt
>
> Index: utils/perf-training/CMakeLists.txt
> ===
> --- utils/perf-training/CMakeLists.txt
> +++ utils/perf-training/CMakeLists.txt
> @@ -55,9 +55,8 @@
>  COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py 
> clean ${CMAKE_CURRENT_BINARY_DIR} dtrace
>  COMMENT "Clearing old dtrace data")
>  
> -
>add_custom_target(generate-order-file
> -COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py 
> gen-order-file --binary $ --output 
> ${CMAKE_CURRENT_BINARY_DIR}/clang.order ${CMAKE_CURRENT_BINARY_DIR}
> +COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py 
> gen-order-file --binary $ --output ${CLANG_ORDER_FILE} 
> ${CMAKE_CURRENT_BINARY_DIR}
>  COMMENT "Generating order file"
>  DEPENDS generate-dtrace-logs)
>  endif()
> Index: tools/driver/CMakeLists.txt
> ===
> --- tools/driver/CMakeLists.txt
> +++ tools/driver/CMakeLists.txt
> @@ -87,8 +87,24 @@
>set(TOOL_INFO_BUILD_VERSION)
>  endif()
>  
> -if(CLANG_ORDER_FILE AND EXISTS CLANG_ORDER_FILE)
> -  target_link_libraries(clang "-Wl,-order_file,${CLANG_ORDER_FILE}")
> +if(CLANG_ORDER_FILE)
> +  include(CMakePushCheckState)
> +
> +  function(check_linker_flag flag out_var)
> +cmake_push_check_state()
> +set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
> +check_cxx_compiler_flag("" ${out_var})
> +cmake_pop_check_state()
> +  endfunction()
> +
> +  # This is a test to ensure the actual order file works with the linker.
> +  check_linker_flag("-Wl,-order_file,${CLANG_ORDER_FILE}"
> +LINKER_ORDER_FILE_WORKS)
> +  
> +  if(LINKER_ORDER_FILE_WORKS)
> +target_link_libraries(clang "-Wl,-order_file,${CLANG_ORDER_FILE}")
> +set_target_properties(clang PROPERTIES LINK_DEPENDS ${CLANG_ORDER_FILE})
> +  endif()
>  endif()
>  
>  if(WITH_POLLY AND LINK_POLLY_INTO_TOOLS)
> Index: CMakeLists.txt
> ===
> --- CMakeLists.txt
> +++ CMakeLists.txt
> @@ -586,18 +586,19 @@
>add_subdirectory(docs)
>  endif()
>  
> -if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/clang.order")
> -  file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/clang.order")
> -endif()
> -
> -if(CLANG_ORDER_FILE STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/clang.order")
> +# this line is needed as a cleanup to ensure that any CMakeCaches with the 
> old
> +# default value get updated to the new default.
> +if(CLANG_ORDER_FILE STREQUAL "")
>unset(CLANG_ORDER_FILE CACHE)
> -  unset(CLANG_ORDER_FILE)
>  endif()
>  
> -set(CLANG_ORDER_FILE "" CACHE FILEPATH
> +set(CLANG_ORDER_FILE ${CMAKE_CURRENT_BINARY_DIR}/clang.order CACHE FILEPATH
>"Order file to use when compiling clang in order to improve startup time.")
>  
> +if(CLANG_ORDER_FILE AND NOT EXISTS ${CLANG_ORDER_FILE})
> +  file(WRITE ${CLANG_ORDER_FILE} "\n")
> +endif()

What happens if someone typos their order file? Won't we end up writing
an empty file somewhere random on their filesystem?

I think we should only do the "create an empty file" thing if the order
file is inside ${CMAKE_CURRENT_BINARY_DIR} - if someone specifies
-DCLANG_ORDER_FILE=/path/to/nonexistent they should get an error.

> +
>  if (CLANG_BUILT_STANDALONE OR CMAKE_VERSION VERSION_EQUAL 3 OR
>  CMAKE_VERSION VERSION_GREATER 3)
># Generate a list of CMake library targets so that other CMake projects can
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libcxx] r260431 - Recommit r260012 - Cleanup node-type handling in the unordered containers.

2016-02-12 Thread Evgenii Stepanov via cfe-commits
Hi,

hash_map still looks broken to me.
I don't have a simple reproducer, but these declarations in __hash_table:

template  class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator;
 template  class _LIBCPP_TYPE_VIS_ONLY
__hash_map_const_iterator;

should not they be prefixed with __gnu_cxx:: ?

Clang says that std::__1::__hash_const_iterator and
__gnu_cxx::__hash_map_const_iterator are not friends and
__non_const_iterator at ext/hash_map:432 is private.


On Wed, Feb 10, 2016 at 12:46 PM, Eric Fiselier via cfe-commits
 wrote:
> Author: ericwf
> Date: Wed Feb 10 14:46:23 2016
> New Revision: 260431
>
> URL: http://llvm.org/viewvc/llvm-project?rev=260431&view=rev
> Log:
> Recommit r260012 - Cleanup node-type handling in the unordered containers.
>
> This time I kept  working!
>
> This patch is the first in a series of patches that's meant to better
> support unordered_map. unordered_map has a special "value_type" that
> differs from pair. In order to meet the EmplaceConstructible
> and CopyInsertable requirements we need to teach __hash_table about this
> special value_type.
>
> This patch creates a "__hash_node_types" traits class that contains
> all of the typedefs needed by the unordered containers and it's iterators.
> These typedefs include ones for each node type and  node pointer type,
> as well as special typedefs for "unordered_map"'s value type.
>
> As a result of this change all of the unordered containers now all support
> incomplete types.
>
> As a drive-by fix I changed the difference_type in __hash_table to always
> be ptrdiff_t. There is a corresponding change to size_type but it cannot
> take affect until an ABI break.
>
> This patch will be followed up shortly with fixes for various unordered_map
> bugs and problems.
>
> Added:
> libcxx/trunk/test/libcxx/containers/unord/key_value_traits.pass.cpp
> libcxx/trunk/test/std/containers/unord/iterator_difference_type.pass.cpp
> libcxx/trunk/test/std/containers/unord/unord.map/incomplete_type.pass.cpp
> libcxx/trunk/test/std/containers/unord/unord.multimap/incomplete.pass.cpp
> libcxx/trunk/test/std/containers/unord/unord.multiset/incomplete.pass.cpp
> libcxx/trunk/test/std/containers/unord/unord.set/incomplete.pass.cpp
> Modified:
> libcxx/trunk/include/__config
> libcxx/trunk/include/__hash_table
> libcxx/trunk/include/ext/hash_map
> libcxx/trunk/include/unordered_map
>
> Modified: libcxx/trunk/include/__config
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=260431&r1=260430&r2=260431&view=diff
> ==
> --- libcxx/trunk/include/__config (original)
> +++ libcxx/trunk/include/__config Wed Feb 10 14:46:23 2016
> @@ -42,6 +42,7 @@
>  // Fix undefined behavior in how std::list stores it's linked nodes.
>  #define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
>  #define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
> +#define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
>  #endif
>
>  #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
>
> Modified: libcxx/trunk/include/__hash_table
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__hash_table?rev=260431&r1=260430&r2=260431&view=diff
> ==
> --- libcxx/trunk/include/__hash_table (original)
> +++ libcxx/trunk/include/__hash_table Wed Feb 10 14:46:23 2016
> @@ -17,6 +17,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include <__undef_min_max>
>  #include <__undef___deallocate>
> @@ -49,10 +50,10 @@ struct __hash_node
>   typename __rebind_pointer<_VoidPtr, __hash_node<_Tp, 
> _VoidPtr> >::type
>   >
>  {
> -typedef _Tp value_type;
> +typedef _Tp __node_value_type;
>
>  size_t __hash_;
> -value_type __value_;
> +__node_value_type __value_;
>  };
>
>  inline _LIBCPP_INLINE_VISIBILITY
> @@ -77,23 +78,126 @@ __next_hash_pow2(size_t __n)
>  }
>
>  template  class 
> __hash_table;
> +
> +template   class _LIBCPP_TYPE_VIS_ONLY __hash_iterator;
>  template  class _LIBCPP_TYPE_VIS_ONLY 
> __hash_const_iterator;
> +template   class _LIBCPP_TYPE_VIS_ONLY 
> __hash_local_iterator;
> +template  class _LIBCPP_TYPE_VIS_ONLY 
> __hash_const_local_iterator;
>  template  class _LIBCPP_TYPE_VIS_ONLY 
> __hash_map_iterator;
>  template  class _LIBCPP_TYPE_VIS_ONLY 
> __hash_map_const_iterator;
>
> +#if __cplusplus >= 201103L
> +template 
> +union __hash_value_type;
> +#else
> +template 
> +struct __hash_value_type;
> +#endif
> +
> +template 
> +struct __key_value_types {
> +  static_assert(!is_reference<_Tp>::value && !is_const<_Tp>::value, "");
> +  typedef _Tp key_type;
> +  typedef _Tp __node_value_type;
> +  typedef _Tp __container_value_type;
> +  static const bool __is_map = false;
> +};
> +
> +template 
> +struct __key_value_types<__hash_value_type<_Key, _Tp> > {
> +  typedef _Key

r260719 - Added missing '__'.

2016-02-12 Thread Artem Belevich via cfe-commits
Author: tra
Date: Fri Feb 12 14:26:43 2016
New Revision: 260719

URL: http://llvm.org/viewvc/llvm-project?rev=260719&view=rev
Log:
Added missing '__'.

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

Modified: cfe/trunk/lib/Headers/__clang_cuda_cmath.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__clang_cuda_cmath.h?rev=260719&r1=260718&r2=260719&view=diff
==
--- cfe/trunk/lib/Headers/__clang_cuda_cmath.h (original)
+++ cfe/trunk/lib/Headers/__clang_cuda_cmath.h Fri Feb 12 14:26:43 2016
@@ -156,7 +156,7 @@ using ::nanf;
 using ::nearbyint;
 using ::nextafter;
 __DEVICE__ float nexttoward(float __from, float __to) {
-  return __builtin_nexttowardf(from, to);
+  return __builtin_nexttowardf(__from, __to);
 }
 __DEVICE__ double nexttoward(double __from, double __to) {
   return __builtin_nexttoward(__from, __to);


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


Re: [PATCH] D16529: [clang-tidy] Add modernize-raw-string-literal check

2016-02-12 Thread Richard via cfe-commits
LegalizeAdulthood added inline comments.


Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:97
@@ +96,3 @@
+}
+
+} // namespace

alexfh wrote:
> > I believe we agree on the following: ...
> 
> Yes.
> 
> > Where we seem to disagree is what algorithm should be used to determine the 
> > delimiter when a delimited raw string literal is required.
> 
> Pretty much so. IMO, we don't need a universal algorithm that will hardly 
> ever go further than the second iteration, and even in this case would 
> produce a result that's likely undesirable (as I said, `R"lit0()lit0"` is 
> not what I would want to see in my code).
> 
> The possibility of this code causing performance issues is probably not that 
> high, but I can imagine a code where this could be sub-optimal.
> 
> > My implementation is the minimum performance impact for the typical case 
> > where the string does not contain )".
> 
> One concern about this part is that it could issue 4 concatenation calls 
> fewer in case of an empty delimiter. This may already be handled well by the 
> `llvm::Twine` though.
> 
> Any code following potentially-problematic patterns might be fine on its own, 
> but it will attract unnecessary attention when reading code. High frequency 
> of such false alarms has non-trivial cost for code readers and makes it 
> harder to find actual problems.
> 
> So please, change the code to avoid these issues. Here's a possible 
> alternative:
> 
>   llvm::Optional asRawStringLiteral(const StringLiteral 
> *Literal) {
> const StringRef Bytes = Literal->getBytes();
> static const StringRef Delimiters[2][] =
>   {{"R\"(", ")\""}, {"R\"lit(", ")lit\""}, {"R\"str(", ")str\""},
>   /* add more different ones to make it unlikely to meet all of these in 
> a single literal in the wild */};
> for (const auto &Delim : Delimiters) {
>   if (Bytes.find(Delim[1]) != StringRef::npos)
> return (Delim[0] + Bytes + Delim[1]).str();
> }
> // Give up gracefully on literals having all our delimiters.
> return llvm::None;
>   }
I just don't see why replacing a general algorithm that always works with a 
bunch of hard-coded special cases is better.

You've reiterated your preference for one over the other, but since it simply a 
matter of preference, I don't see why this should be a requirement.

Working with the hard-coded list of delimiters is no more or less efficient 
than the general algorithm that I implemented, so efficiency is not the concern 
here.


Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:110
@@ +109,3 @@
+  if (const auto *Literal = Result.Nodes.getNodeAs("lit")) {
+if (isMacroExpansionLocation(Result, Literal->getLocStart()))
+  return;

alexfh wrote:
>   if (Literal->getLocStart().isMacroID())
> return;
I don't understand what this code is doing.  `isMacroID` is undocumented, so I 
don't know what it means for this function to return true without reverse 
engineering the implementation.


http://reviews.llvm.org/D16529



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


Re: r260707 - [CMake] Pass stage1 tools through to stage2 when building with LTO

2016-02-12 Thread ChrisBieneman via cfe-commits
It is needed if you're doing LTO. If you're not doing an LTO build using the 
host AR will work, and it is faster to not have to build extra targets.

It is really just a build-time optimization.

-Chris

> On Feb 12, 2016, at 11:52 AM, Rafael Espíndola  
> wrote:
> 
> Any reason it is lto specific? For example, it is nice to test llvm-ar
> in stage2 even if not doing LTO, no?
> 
> Cheers,
> Rafael
> 
> 
> On 12 February 2016 at 14:06, Chris Bieneman via cfe-commits
>  wrote:
>> Author: cbieneman
>> Date: Fri Feb 12 13:06:12 2016
>> New Revision: 260707
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=260707&view=rev
>> Log:
>> [CMake] Pass stage1 tools through to stage2 when building with LTO
>> 
>> This was originally a hacky if(APPLE) block. Now that we have an option for 
>> enabling LTO, it is better to properly gate this.
>> 
>> Modified:
>>cfe/trunk/CMakeLists.txt
>> 
>> Modified: cfe/trunk/CMakeLists.txt
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=260707&r1=260706&r2=260707&view=diff
>> ==
>> --- cfe/trunk/CMakeLists.txt (original)
>> +++ cfe/trunk/CMakeLists.txt Fri Feb 12 13:06:12 2016
>> @@ -677,11 +677,15 @@ if (CLANG_ENABLE_BOOTSTRAP)
>> 
>>   # If on Darwin we need to make bootstrap depend on LTO and pass
>>   # DARWIN_LTO_LIBRARY so that -flto will work using the just-built compiler
>> -  if(APPLE)
>> +  if(BOOTSTRAP_LLVM_ENABLE_LTO OR LLVM_ENABLE_LTO)
>> set(LTO_DEP LTO llvm-ar llvm-ranlib)
>> -set(LTO_LIBRARY 
>> -DDARWIN_LTO_LIBRARY=${LLVM_SHLIB_OUTPUT_INTDIR}/libLTO.dylib)
>> set(LTO_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar)
>> set(LTO_RANLIB -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib)
>> +if(APPLE)
>> +  set(LTO_LIBRARY 
>> -DDARWIN_LTO_LIBRARY=${LLVM_SHLIB_OUTPUT_INTDIR}/libLTO.dylib)
>> +elseif(NOT WIN32)
>> +  list(APPEND LTO_DEP LLVMgold)
>> +endif()
>>   endif()
>> 
>>   add_custom_target(${NEXT_CLANG_STAGE}-clear
>> 
>> 
>> ___
>> 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: r260707 - [CMake] Pass stage1 tools through to stage2 when building with LTO

2016-02-12 Thread Rafael Espíndola via cfe-commits
Any reason it is lto specific? For example, it is nice to test llvm-ar
in stage2 even if not doing LTO, no?

Cheers,
Rafael


On 12 February 2016 at 14:06, Chris Bieneman via cfe-commits
 wrote:
> Author: cbieneman
> Date: Fri Feb 12 13:06:12 2016
> New Revision: 260707
>
> URL: http://llvm.org/viewvc/llvm-project?rev=260707&view=rev
> Log:
> [CMake] Pass stage1 tools through to stage2 when building with LTO
>
> This was originally a hacky if(APPLE) block. Now that we have an option for 
> enabling LTO, it is better to properly gate this.
>
> Modified:
> cfe/trunk/CMakeLists.txt
>
> Modified: cfe/trunk/CMakeLists.txt
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=260707&r1=260706&r2=260707&view=diff
> ==
> --- cfe/trunk/CMakeLists.txt (original)
> +++ cfe/trunk/CMakeLists.txt Fri Feb 12 13:06:12 2016
> @@ -677,11 +677,15 @@ if (CLANG_ENABLE_BOOTSTRAP)
>
># If on Darwin we need to make bootstrap depend on LTO and pass
># DARWIN_LTO_LIBRARY so that -flto will work using the just-built compiler
> -  if(APPLE)
> +  if(BOOTSTRAP_LLVM_ENABLE_LTO OR LLVM_ENABLE_LTO)
>  set(LTO_DEP LTO llvm-ar llvm-ranlib)
> -set(LTO_LIBRARY 
> -DDARWIN_LTO_LIBRARY=${LLVM_SHLIB_OUTPUT_INTDIR}/libLTO.dylib)
>  set(LTO_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar)
>  set(LTO_RANLIB -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib)
> +if(APPLE)
> +  set(LTO_LIBRARY 
> -DDARWIN_LTO_LIBRARY=${LLVM_SHLIB_OUTPUT_INTDIR}/libLTO.dylib)
> +elseif(NOT WIN32)
> +  list(APPEND LTO_DEP LLVMgold)
> +endif()
>endif()
>
>add_custom_target(${NEXT_CLANG_STAGE}-clear
>
>
> ___
> 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] D17188: AMDGPU: Add sin/cos builtins

2016-02-12 Thread Tom Stellard via cfe-commits
tstellarAMD accepted this revision.
tstellarAMD added a comment.
This revision is now accepted and ready to land.

LGTM.


http://reviews.llvm.org/D17188



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


Re: [PATCH] D17104: [VFS] Drop path traversal assertion

2016-02-12 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a comment.

> I'm not sure I understand how the 2nd path would cover the realpath case.  It 
> is just an entry for the realpath itself; that doesn't help if the client 
> looks up "/install-dir/lib/clang/3.8.0" directly (not just from removing dots 
> from bin/..).


What I was suggestting is this:

'type': 'directory',
'name': "/install-dir/lib/clang/3.8.0/include",
'contents': [

  ...
  {
'type': 'file',
'name': "altivec.h",
'external-contents': 
"/private/tmp/a/b/lib/clang/3.8.0/include/altivec.h"
  },

'type': 'directory',
'name': "/private/tmp/a/b/lib/clang/3.8.0/include",
'contents': [

  ...
  {
'type': 'file',
'name': "altivec.h",
'external-contents': 
"/private/tmp/a/b/lib/clang/3.8.0/include/altivec.h"
  },
  ...

The second case is here to address what you mentioned in the first comment 
"looking up the path *without* the .. won't work, which means anything that 
looks up a realpath will fail". But thinking more about it, I don't see how 
it's useful to have this second entry since the VFS will only be requested for 
"/install-dir/bin/../lib/clang/3.8.0/include" anyway. What about we stick to 
1st path? This should solve the ".." issue and at the same time synchronise 
with the virtual path lookup if we use remove_dots() over there too. Am I 
missing something here?

> > Correct me if I'm wrong, but do you suggest we have a new entry type in the 
> > YAML file for declaring symlinks? Right now, we handle symlinks by copying 
> > them out as real files inside the VFS. However, adding extra "name" entries 
> > to map for real paths for such symlinks inside the YAML should do it.

> 

> 

> Yes, that's what I'm suggesting.


Is there any real reason for this additional logic? Why an regular additional 
entry in the YAML file isn't enough?
BTW, there are two cases for symlinks:

(A) The above where the symlink is a path component. Unless I missed something, 
this could be solved with only one path entry, like discussed above.
(B) The symlink is the final header itself, this could be solved without any 
extra logic by duplicating the entries while maintaining only one copy in the 
.cache/vfs dir, example:

Take the symlink:
/usr/include/pthread.h -> pthread/pthread.h

'type': 'directory',
'name': "/usr/include/",
'contents': [

  ...
  {
'type': 'file',
'name': "pthread.h",
'external-contents': "/usr/include/pthread/pthread.h"
  },

...
'type': 'directory',
'name': "/usr/include/pthread",
'contents': [

  ...
  {
'type': 'file',
'name': "pthread.h",
'external-contents': "/usr/include/pthread/pthread.h"
  },
  ...


http://reviews.llvm.org/D17104



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


Re: [PATCH] D16152: [clang-tidy] Add check performance-faster-string-find

2016-02-12 Thread Samuel Benzaquen via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL260712: [clang-tidy] Add check 
performance-faster-string-find (authored by sbenza).

Changed prior to commit:
  http://reviews.llvm.org/D16152?vs=47808&id=47825#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16152

Files:
  clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt
  clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp
  clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.h
  clang-tools-extra/trunk/clang-tidy/performance/PerformanceTidyModule.cpp
  clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/performance-faster-string-find.rst
  clang-tools-extra/trunk/test/clang-tidy/performance-faster-string-find.cpp

Index: clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.h
===
--- clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.h
+++ clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.h
@@ -0,0 +1,43 @@
+//===--- FasterStringFindCheck.h - clang-tidy*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_FASTER_STRING_FIND_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_FASTER_STRING_FIND_H
+
+#include "../ClangTidy.h"
+
+#include 
+#include 
+
+namespace clang {
+namespace tidy {
+namespace performance {
+
+/// Optimize calls to std::string::find() and friends when the needle passed is
+/// a single character string literal.
+/// The character literal overload is more efficient.
+///
+/// For the user-facing documentation see:
+/// http://clang.llvm.org/extra/clang-tidy/checks/performance-faster-string-find.html
+class FasterStringFindCheck : public ClangTidyCheck {
+public:
+  FasterStringFindCheck(StringRef Name, ClangTidyContext *Context);
+  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
+  void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+  void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
+
+private:
+  const std::vector StringLikeClasses;
+};
+
+} // namespace performance
+} // namespace tidy
+} // namespace clang
+
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_FASTER_STRING_FIND_H
Index: clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt
===
--- clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt
+++ clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt
@@ -1,6 +1,7 @@
 set(LLVM_LINK_COMPONENTS support)
 
 add_clang_library(clangTidyPerformanceModule
+  FasterStringFindCheck.cpp
   ForRangeCopyCheck.cpp
   ImplicitCastInLoopCheck.cpp
   PerformanceTidyModule.cpp
Index: clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp
@@ -0,0 +1,128 @@
+//===--- FasterStringFindCheck.cpp - clang-tidy===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "FasterStringFindCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang {
+namespace tidy {
+namespace performance {
+
+namespace {
+
+static const char StringLikeClassesDelimiter[] = ";";
+
+std::vector ParseClasses(StringRef Option) {
+  SmallVector Classes;
+  Option.split(Classes, StringLikeClassesDelimiter);
+  std::vector Result;
+  for (StringRef &Class : Classes) {
+Class = Class.trim();
+if (!Class.empty())
+  Result.push_back(Class);
+  }
+  return Result;
+}
+
+llvm::Optional MakeCharacterLiteral(const StringLiteral *Literal) {
+  std::string Result;
+  {
+llvm::raw_string_ostream OS(Result);
+Literal->outputString(OS);
+  }
+  // Now replace the " with '.
+  auto pos = Result.find_first_of('"');
+  if (pos == Result.npos) return llvm::None;
+  Result[pos] = '\'';
+  pos = Result.find_last_of('"');
+  if (pos == Result.npos) return llvm::None;
+  Result[pos] = '\'';
+  return Result;
+}
+
+AST_MATCHER(StringLiteral, lengthIsOne) { return Node.getLength() == 1; }
+
+AST_MATCHER_FUNCTION(ast_m

Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct

2016-02-12 Thread H.J. Lu via cfe-commits
On Fri, Feb 12, 2016 at 6:58 AM, Matthijs van Duin
 wrote:
> On 11 February 2016 at 16:31, H.J. Lu  wrote:
>> struct A {
>> static void foo (void) ();
>> static int xxx;
>> };
>
> What about it? It's an empty struct.  (And it declares a function and
> a variable in the namespace of A, which however do not have any
> relevant impact here.)
>

Thanks for all the feedbacks.  Here is the new proposal:

1. "empty type".  An empty type is a trivially-copyable aggregate
occupying zero bytes (excluding any padding).
2. No memory slot nor register should be used to pass or return an object
of empty type.

Footnote: Array of empty type can only passed by reference in C/C++.


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


[clang-tools-extra] r260712 - [clang-tidy] Add check performance-faster-string-find

2016-02-12 Thread Samuel Benzaquen via cfe-commits
Author: sbenza
Date: Fri Feb 12 13:28:14 2016
New Revision: 260712

URL: http://llvm.org/viewvc/llvm-project?rev=260712&view=rev
Log:
[clang-tidy] Add check performance-faster-string-find

Summary:
Add check performance-faster-string-find.
It replaces single character string literals to character literals in calls to 
string::find and friends.

Reviewers: alexfh

Subscribers: cfe-commits

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

Added:
clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp
clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.h

clang-tools-extra/trunk/docs/clang-tidy/checks/performance-faster-string-find.rst
clang-tools-extra/trunk/test/clang-tidy/performance-faster-string-find.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt
clang-tools-extra/trunk/clang-tidy/performance/PerformanceTidyModule.cpp
clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst

Modified: clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt?rev=260712&r1=260711&r2=260712&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt Fri Feb 12 
13:28:14 2016
@@ -1,6 +1,7 @@
 set(LLVM_LINK_COMPONENTS support)
 
 add_clang_library(clangTidyPerformanceModule
+  FasterStringFindCheck.cpp
   ForRangeCopyCheck.cpp
   ImplicitCastInLoopCheck.cpp
   PerformanceTidyModule.cpp

Added: clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp?rev=260712&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp 
(added)
+++ clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp 
Fri Feb 12 13:28:14 2016
@@ -0,0 +1,128 @@
+//===--- FasterStringFindCheck.cpp - 
clang-tidy===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "FasterStringFindCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang {
+namespace tidy {
+namespace performance {
+
+namespace {
+
+static const char StringLikeClassesDelimiter[] = ";";
+
+std::vector ParseClasses(StringRef Option) {
+  SmallVector Classes;
+  Option.split(Classes, StringLikeClassesDelimiter);
+  std::vector Result;
+  for (StringRef &Class : Classes) {
+Class = Class.trim();
+if (!Class.empty())
+  Result.push_back(Class);
+  }
+  return Result;
+}
+
+llvm::Optional MakeCharacterLiteral(const StringLiteral *Literal) 
{
+  std::string Result;
+  {
+llvm::raw_string_ostream OS(Result);
+Literal->outputString(OS);
+  }
+  // Now replace the " with '.
+  auto pos = Result.find_first_of('"');
+  if (pos == Result.npos) return llvm::None;
+  Result[pos] = '\'';
+  pos = Result.find_last_of('"');
+  if (pos == Result.npos) return llvm::None;
+  Result[pos] = '\'';
+  return Result;
+}
+
+AST_MATCHER(StringLiteral, lengthIsOne) { return Node.getLength() == 1; }
+
+AST_MATCHER_FUNCTION(ast_matchers::internal::Matcher,
+ hasSubstitutedType) {
+  return hasType(qualType(anyOf(substTemplateTypeParmType(),
+hasDescendant(substTemplateTypeParmType();
+}
+
+} // namespace
+
+FasterStringFindCheck::FasterStringFindCheck(StringRef Name,
+ ClangTidyContext *Context)
+: ClangTidyCheck(Name, Context),
+  StringLikeClasses(
+  ParseClasses(Options.get("StringLikeClasses", "std::basic_string"))) 
{
+}
+
+void FasterStringFindCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
+  Options.store(Opts, "StringLikeClasses",
+llvm::join(StringLikeClasses.begin(), StringLikeClasses.end(),
+   StringLikeClassesDelimiter));
+}
+
+void FasterStringFindCheck::registerMatchers(MatchFinder *Finder) {
+  if (!getLangOpts().CPlusPlus)
+return;
+
+  const auto SingleChar =
+  expr(ignoringParenCasts(stringLiteral(lengthIsOne()).bind("literal")));
+
+  const auto StringFindFunctions =
+  anyOf(hasName("find"), hasName("rfind"), hasName("find_first_of"),
+hasName("find_first_not_of"), hasName("find_last_of"),
+hasName("find_last_not_of"));
+
+  llvm::Optional> IsStringC

[PATCH] D17206: Fix AST printing of ascii char literals above 127.

2016-02-12 Thread Steven Watanabe via cfe-commits
steven_watanabe created this revision.
steven_watanabe added a reviewer: rsmith.
steven_watanabe added a subscriber: cfe-commits.

Currently literals like '\xff' may be sign extended, resulting in output like 
'\U', which is not valid.

http://reviews.llvm.org/D17206

Files:
  lib/AST/StmtPrinter.cpp
  test/Misc/ast-print-char-literal.cpp

Index: test/Misc/ast-print-char-literal.cpp
===
--- test/Misc/ast-print-char-literal.cpp
+++ test/Misc/ast-print-char-literal.cpp
@@ -13,6 +13,8 @@
   h();
 }
 
+char j = '\xFF';
+
 // CHECK: char c = u8'1';
 // CHECK-NEXT: char d = '1';
 // CHECK-NEXT: char e = U'1';
@@ -22,3 +24,4 @@
 // CHECK: template 
 
 // CHECK: h();
+// CHECK: char j = '\xff';
Index: lib/AST/StmtPrinter.cpp
===
--- lib/AST/StmtPrinter.cpp
+++ lib/AST/StmtPrinter.cpp
@@ -1250,6 +1250,10 @@
 OS << "'\\v'";
 break;
   default:
+// A character literal might be sign-extended, which
+// would result in an invalid \U escape sequence.
+if ((value & ~0xFFu) == ~0xFFu && Node->getKind() == 
CharacterLiteral::Ascii)
+  value &= 0xFFu;
 if (value < 256 && isPrintable((unsigned char)value))
   OS << "'" << (char)value << "'";
 else if (value < 256)


Index: test/Misc/ast-print-char-literal.cpp
===
--- test/Misc/ast-print-char-literal.cpp
+++ test/Misc/ast-print-char-literal.cpp
@@ -13,6 +13,8 @@
   h();
 }
 
+char j = '\xFF';
+
 // CHECK: char c = u8'1';
 // CHECK-NEXT: char d = '1';
 // CHECK-NEXT: char e = U'1';
@@ -22,3 +24,4 @@
 // CHECK: template 
 
 // CHECK: h();
+// CHECK: char j = '\xff';
Index: lib/AST/StmtPrinter.cpp
===
--- lib/AST/StmtPrinter.cpp
+++ lib/AST/StmtPrinter.cpp
@@ -1250,6 +1250,10 @@
 OS << "'\\v'";
 break;
   default:
+// A character literal might be sign-extended, which
+// would result in an invalid \U escape sequence.
+if ((value & ~0xFFu) == ~0xFFu && Node->getKind() == CharacterLiteral::Ascii)
+  value &= 0xFFu;
 if (value < 256 && isPrintable((unsigned char)value))
   OS << "'" << (char)value << "'";
 else if (value < 256)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-12 Thread Hubert Tong via cfe-commits
Committed as r260710 .

On Fri, Feb 12, 2016 at 9:53 AM, Hubert Tong <
hubert.reinterpretc...@gmail.com> wrote:

> Thanks Jorge. I'll work on committing this today.
>
> -- HT
>
> On Fri, Feb 12, 2016 at 12:10 AM, Jorge Teixeira <
> j.lopes.teixe...@gmail.com> wrote:
>
>> Hubert,
>>
>> Thanks for the code review. Over the weekend I'll try to learn a bit
>> more about using Phabricator, but for now I'll reply here, and attach
>> a new patch.
>>
>> a) *_MANT_DIG < 1 --> *_MANT_DIG < 2
>> That is a stricter check and I agree with your rationale. Done.
>>
>> b) _MIN_EXP --> FLT_MIN_EXP
>> Done.
>>
>> c) Remove _MIN_EXP and _MIN_10_EXP FLT,DBL,LDBL comparisons
>> Yes, as you and Richard pointed out the added mantissa bits can
>> compensate for the lack of increase of the exponent.
>> Already fixed in http://reviews.llvm.org/rL260639.
>>
>> d) *_MAX_EXP and *_MIN_EXP 2,-2 --> 1,-1
>> Done.
>>
>> Richard, will do re: single patch for multiple files. Also, can you
>> close the bug report? Even if more tests for float.h get
>> added/changed, the original problem has been solved.
>>
>> JT
>>
>>
>> On Thu, Feb 11, 2016 at 8:38 PM, Hubert Tong
>>  wrote:
>> > Hi Jorge,
>> >
>> > I responded to the initial commit with some comments here:
>> > http://reviews.llvm.org/rL260577
>> >
>> > -- HT
>> >
>> > On Thu, Feb 11, 2016 at 7:53 PM, Jorge Teixeira <
>> j.lopes.teixe...@gmail.com>
>> > wrote:
>> >>
>> >> > You'll also need to change  to only provide DECIMAL_DIG in
>> C99
>> >> > onwards.
>> >> Done!
>> >>
>> >> > All of our -std versions are that standard plus applicable Defect
>> >> > Reports. So -std=c89 includes TC1 and TC2, but not Amendment 1 (we
>> >> > have -std=c94 for that, but the only difference from our C89 mode is
>> >> > the addition of digraphs).
>> >> I'll try to find the c89 TC2 and check if anything changed regarding
>> >> these macros (unlikely).
>> >>
>> >> > __STRICT_ANSI__ is defined if Clang has not been asked to provide
>> >> > extensions (either GNU extensions, perhaps via a flag like
>> -std=gnu99,
>> >> > or MS extensions), and is used by C library headers to determine that
>> >> > they should provide a strictly-conforming set of declarations without
>> >> > extensions.
>> >> Ok, so if !defined(__STRICT__ANSI__) clang should always expose "as
>> >> much as possible", including stuff from later versions of the Std.
>> >> and/or eventual extensions, just as it now on float.h and float.c,
>> >> right?
>> >>
>> >> > Testing __STDC_VERSION__ for C94 makes sense if you're trying to
>> >> > detect whether Amendment 1 features should be provided.
>> >> Since this will affect only digraphs, I guess there is no need (for
>> >> float.h, float.c).
>> >>
>> >> >> 3) Lastly, can you expand (...)
>> >> >
>> >> > No, it does not mean that.
>> >> >
>> >> > For PPC64, long double is (sometimes) modeled as a pair of doubles.
>> >> > Under that model, the smallest normalized value for long double is
>> >> > actually larger than the smallest normalized value for double
>> >> > (remember that for a normalized value with exponent E, all numbers of
>> >> > the form 1.X * 2^E, with the right number of mantissa digits, are
>> >> > exactly representable, so increasing the number of mantissa bits
>> >> > without changing the number of exponent bits increases the magnitude
>> >> > of the smallest normalized positive number).
>> >> >
>> >> > The set of values of long double in this model *is* a superset of the
>> >> > set of values of double.
>> >> >
>> >> I see now, and removed the bogus tests. The patch should now test
>> >> cleanly unless something needs DECIMAL_DIG but did not set the
>> >> appropriate std. level, or defined __STRICT__ANSI__.
>> >>
>> >> Thanks for the learning experience,
>> >>
>> >> JT
>> >>
>> >>
>> >>
>> >> >> From /test/Preprocessor/init.cpp:
>> >> >> // PPC64:#define __DBL_MIN_EXP__ (-1021)
>> >> >> // PPC64:#define __FLT_MIN_EXP__ (-125)
>> >> >> // PPC64:#define __LDBL_MIN_EXP__ (-968)
>> >> >>
>> >> >> This issue happened before
>> >> >> (
>> https://lists.gnu.org/archive/html/bug-gnulib/2011-08/msg00262.html,
>> >> >> http://www.openwall.com/lists/musl/2013/11/15/1), but all it means
>> is
>> >> >> that ppc64 is not compliant with C without soft-float. The test is
>> >> >> valid and should stay, and if someone tries to compile for ppc64 in
>> >> >> c89, c99 or c11 modes, clang should 1) use soft float (bad idea), 2)
>> >> >> issue a diagnostic saying that that arch cannot meet the desired C
>> >> >> standard without a big performance penalty - the diag should be
>> >> >> suppressible with some special cmd line argument.
>> >> >> Thus, I added the tests back and the FAIL for PPC64 for the time
>> >> >> being, with a comment. If you know of a way to skip only the
>> specific
>> >> >> *_MIN_EXP and *_MIN_10_EXP tests, please add it, because there might
>> >> >> be more similar cases in the future.
>> >> >>
>> >> >> JT
>> >> >>
>> >> >> On Thu, Feb 11, 2016 at

r260710 - test/Headers/float.c: fix theoretical edge values

2016-02-12 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Fri Feb 12 13:24:36 2016
New Revision: 260710

URL: http://llvm.org/viewvc/llvm-project?rev=260710&view=rev
Log:
test/Headers/float.c: fix theoretical edge values

For *_MANT_DIG, *_MAX_EXP and *_MIN_EXP, the C Standard does not list
the least requirements directly. This patch adjusts the test values with
refined ones.

Patch by Jorge Teixeira!

Modified:
cfe/trunk/test/Headers/float.c

Modified: cfe/trunk/test/Headers/float.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/float.c?rev=260710&r1=260709&r2=260710&view=diff
==
--- cfe/trunk/test/Headers/float.c (original)
+++ cfe/trunk/test/Headers/float.c Fri Feb 12 13:24:36 2016
@@ -24,17 +24,17 @@
 
 #ifndef FLT_MANT_DIG
 #error "Mandatory macro FLT_MANT_DIG is missing."
-#elif   FLT_MANT_DIG < 1
+#elif   FLT_MANT_DIG < 2
 #error "Mandatory macro FLT_MANT_DIG is invalid."
 #endif
 #ifndef DBL_MANT_DIG
 #error "Mandatory macro DBL_MANT_DIG is missing."
-#elif   DBL_MANT_DIG < 1
+#elif   DBL_MANT_DIG < 2
 #error "Mandatory macro DBL_MANT_DIG is invalid."
 #endif
 #ifndef LDBL_MANT_DIG
 #error "Mandatory macro LDBL_MANT_DIG is missing."
-#elif   LDBL_MANT_DIG < 1
+#elif   LDBL_MANT_DIG < 2
 #error "Mandatory macro LDBL_MANT_DIG is invalid."
 #endif
 #if ((FLT_MANT_DIG > DBL_MANT_DIG) || (DBL_MANT_DIG > LDBL_MANT_DIG))
@@ -108,18 +108,18 @@
 
 
 #ifndef FLT_MIN_EXP
-#error "Mandatory macro _MIN_EXP is missing."
-#elif   FLT_MIN_EXP > -2
-#error "Mandatory macro _MIN_EXP is invalid."
+#error "Mandatory macro FLT_MIN_EXP is missing."
+#elif   FLT_MIN_EXP > -1
+#error "Mandatory macro FLT_MIN_EXP is invalid."
 #endif
 #ifndef DBL_MIN_EXP
 #error "Mandatory macro DBL_MIN_EXP is missing."
-#elif   DBL_MIN_EXP > -2
+#elif   DBL_MIN_EXP > -1
 #error "Mandatory macro DBL_MIN_EXP is invalid."
 #endif
 #ifndef LDBL_MIN_EXP
 #error "Mandatory macro LDBL_MIN_EXP is missing."
-#elif   LDBL_MIN_EXP > -2
+#elif   LDBL_MIN_EXP > -1
 #error "Mandatory macro LDBL_MIN_EXP is invalid."
 #endif
 
@@ -143,17 +143,17 @@
 
 #ifndef FLT_MAX_EXP
 #error "Mandatory macro FLT_MAX_EXP is missing."
-#elif   FLT_MAX_EXP < 2
+#elif   FLT_MAX_EXP < 1
 #error "Mandatory macro FLT_MAX_EXP is invalid."
 #endif
 #ifndef DBL_MAX_EXP
 #error "Mandatory macro DBL_MAX_EXP is missing."
-#elif   DBL_MAX_EXP < 2
+#elif   DBL_MAX_EXP < 1
 #error "Mandatory macro DBL_MAX_EXP is invalid."
 #endif
 #ifndef LDBL_MAX_EXP
 #error "Mandatory macro LDBL_MAX_EXP is missing."
-#elif   LDBL_MAX_EXP < 2
+#elif   LDBL_MAX_EXP < 1
 #error "Mandatory macro LDBL_MAX_EXP is invalid."
 #endif
 #if ((FLT_MAX_EXP > DBL_MAX_EXP) || (DBL_MAX_EXP > LDBL_MAX_EXP))


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


r260709 - [AST] Fix typos in RecordLayoutBuilder

2016-02-12 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Fri Feb 12 13:21:02 2016
New Revision: 260709

URL: http://llvm.org/viewvc/llvm-project?rev=260709&view=rev
Log:
[AST] Fix typos in RecordLayoutBuilder

No functional change is intended.

Modified:
cfe/trunk/lib/AST/RecordLayoutBuilder.cpp

Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=260709&r1=260708&r2=260709&view=diff
==
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Fri Feb 12 13:21:02 2016
@@ -2125,7 +2125,7 @@ static bool isMsLayout(const ASTContext
 //   function pointer) and a vbptr (virtual base pointer).  They can each be
 //   shared with a, non-virtual bases. These bases need not be the same.  
vfptrs
 //   always occur at offset 0.  vbptrs can occur at an arbitrary offset and are
-//   placed after the lexiographically last non-virtual base.  This placement
+//   placed after the lexicographically last non-virtual base.  This placement
 //   is always before fields but can be in the middle of the non-virtual bases
 //   due to the two-pass layout scheme for non-virtual-bases.
 // * Virtual bases sometimes require a 'vtordisp' field that is laid out before
@@ -2146,7 +2146,7 @@ static bool isMsLayout(const ASTContext
 //   pushes all bases and fields back by the alignment imposed by those bases
 //   and fields.  This can potentially add a significant amount of padding.
 //   vbptrs are injected immediately after the last non-virtual base as
-//   lexiographically ordered in the code.  If this site isn't pointer aligned
+//   lexicographically ordered in the code.  If this site isn't pointer aligned
 //   the vbptr is placed at the next properly aligned location.  Enough padding
 //   is added to guarantee a fit.
 // * The last zero sized non-virtual base can be placed at the end of the
@@ -2469,7 +2469,7 @@ MicrosoftRecordLayoutBuilder::layoutNonV
   // out any bases that do not contain vfptrs.  We implement this as two passes
   // over the bases.  This approach guarantees that the primary base is laid 
out
   // first.  We use these passes to calculate some additional aggregated
-  // information about the bases, such as reqruied alignment and the presence 
of
+  // information about the bases, such as required alignment and the presence 
of
   // zero sized members.
   const ASTRecordLayout *PreviousBaseLayout = nullptr;
   // Iterate through the bases and lay out the non-virtual ones.
@@ -2481,7 +2481,7 @@ MicrosoftRecordLayoutBuilder::layoutNonV
   HasVBPtr = true;
   continue;
 }
-// Check fo a base to share a VBPtr with.
+// Check for a base to share a VBPtr with.
 if (!SharedVBPtrBase && BaseLayout.hasVBPtr()) {
   SharedVBPtrBase = BaseDecl;
   HasVBPtr = true;
@@ -3063,7 +3063,7 @@ ASTContext::getObjCLayout(const ObjCInte
   // Add in synthesized ivar count if laying out an implementation.
   if (Impl) {
 unsigned SynthCount = CountNonClassIvars(D);
-// If there aren't any sythesized ivars then reuse the interface
+// If there aren't any synthesized ivars then reuse the interface
 // entry. Note we can't cache this because we simply free all
 // entries later; however we shouldn't look up implementations
 // frequently.


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


Re: [PATCH] D16928: [OpenCL] Apply missing restrictions for Blocks in OpenCL v2.0

2016-02-12 Thread Anastasia Stulova via cfe-commits
Anastasia removed rL LLVM as the repository for this revision.
Anastasia updated this revision to Diff 47823.
Anastasia added a comment.

Update according to review comments!


http://reviews.llvm.org/D16928

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaType.cpp
  test/CodeGen/blocks-opencl.cl
  test/SemaOpenCL/event_t.cl
  test/SemaOpenCL/invalid-blocks-cl20.cl
  test/SemaOpenCL/invalid-func.cl
  test/SemaOpenCL/invalid-kernel-parameters.cl
  test/SemaOpenCL/sampler_t.cl

Index: test/SemaOpenCL/sampler_t.cl
===
--- test/SemaOpenCL/sampler_t.cl
+++ test/SemaOpenCL/sampler_t.cl
@@ -2,7 +2,11 @@
 
 constant sampler_t glb_smp = 5;
 
-void foo(sampler_t); 
+void foo(sampler_t);
+
+constant struct sampler_s {
+  sampler_t smp; // expected-error {{the 'sampler_t' type cannot be used to declare a structure or union field}}
+} sampler_str = {0};
 
 void kernel ker(sampler_t argsmp) {
   local sampler_t smp; // expected-error {{sampler type cannot be used with the __local and __global address space qualifiers}}
Index: test/SemaOpenCL/invalid-kernel-parameters.cl
===
--- test/SemaOpenCL/invalid-kernel-parameters.cl
+++ test/SemaOpenCL/invalid-kernel-parameters.cl
@@ -24,7 +24,10 @@
 
 typedef struct FooImage2D // expected-note{{within field of type 'FooImage2D' declared here}}
 {
-  image2d_t imageField; // expected-note{{field of illegal type 'image2d_t' declared here}}
+  // TODO: Clean up needed - we don't really need to check for image, event, etc
+  // as a note here any longer.
+  // They are diagnosed as an error for all struct fields (OpenCL v1.2 s6.9b,r).
+  image2d_t imageField; // expected-note{{field of illegal type 'image2d_t' declared here}} expected-error{{the 'image2d_t' type cannot be used to declare a structure or union field}}
 } FooImage2D;
 
 kernel void image_in_struct_arg(FooImage2D arg) { } // expected-error{{struct kernel parameters may not contain pointers}}
Index: test/SemaOpenCL/invalid-func.cl
===
--- /dev/null
+++ test/SemaOpenCL/invalid-func.cl
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL2.0 -DCL20
+// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL1.2 -DCL12
+// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL1.1 -DCL11
+
+void foo(int, ...); // expected-error{{OpenCL does not allow variadic arguments}}
+int printf(const char *, ...);
Index: test/SemaOpenCL/invalid-blocks-cl20.cl
===
--- /dev/null
+++ test/SemaOpenCL/invalid-blocks-cl20.cl
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL2.0 -fblocks
+
+// OpenCL v2.0 s6.12.5
+
+// All blocks declarations must be const qualified and initialized.
+void f1() {
+  int (^bl1)() = ^() {}; // expected-error{{invalid block variable declaration - must be const qualified}}
+  int (^const bl2)(); // expected-error{{invalid block variable declaration - must be initialized}}
+  int (^const bl3)() = ^const(){
+  };
+}
+
+// A block with extern storage class is not allowed.
+extern int (^const bl)() = ^const(){}; // expected-error{{invalid block variable declaration - using 'extern' storage class is disallowed}}
+void f2() {
+  extern int (^const bl)() = ^const(){}; // expected-error{{invalid block variable declaration - using 'extern' storage class is disallowed}}
+}
+
+// A block with variadic argument is not allowed.
+typedef int (^const bl_t)(int, ...); // expected-error{{OpenCL does not allow variadic arguments}}
+
+// A block cannot be the return value of a function.
+typedef int (^bl_t)(void);
+bl_t f3(bl_t bl); // expected-error{{declaring function return value of type 'bl_t' (aka 'int (^const)(int, ...)') is not allowed}}
+
+struct bl_s {
+  int (^bl)(void); // expected-error {{the 'int (^)(void)' type cannot be used to declare a structure or union field}}
+};
+
+void f4() {
+  __block int a = 10; // expected-error {{the __block storage type is not permitted}}
+}
Index: test/SemaOpenCL/event_t.cl
===
--- test/SemaOpenCL/event_t.cl
+++ test/SemaOpenCL/event_t.cl
@@ -3,7 +3,7 @@
 event_t glb_evt; // expected-error {{the event_t type cannot be used to declare a program scope variable}}
 
 constant struct evt_s {
-  event_t evt;  // expected-error {{the event_t type cannot be used to declare a structure or union field}}
+  event_t evt; // expected-error {{the 'event_t' type cannot be used to declare a structure or union field}}
 } evt_str = {0};
 
 void foo(event_t evt); // expected-note {{passing argument to parameter 'evt' here}}
Index: test/CodeGen/blocks-opencl.cl
===
--- test/CodeGen/blocks-opencl.cl
+++ test/CodeGen/blocks-opencl.cl
@@ -2,15 +2,16 @@
 // This 

r260707 - [CMake] Pass stage1 tools through to stage2 when building with LTO

2016-02-12 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Fri Feb 12 13:06:12 2016
New Revision: 260707

URL: http://llvm.org/viewvc/llvm-project?rev=260707&view=rev
Log:
[CMake] Pass stage1 tools through to stage2 when building with LTO

This was originally a hacky if(APPLE) block. Now that we have an option for 
enabling LTO, it is better to properly gate this.

Modified:
cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=260707&r1=260706&r2=260707&view=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Fri Feb 12 13:06:12 2016
@@ -677,11 +677,15 @@ if (CLANG_ENABLE_BOOTSTRAP)
 
   # If on Darwin we need to make bootstrap depend on LTO and pass
   # DARWIN_LTO_LIBRARY so that -flto will work using the just-built compiler
-  if(APPLE)
+  if(BOOTSTRAP_LLVM_ENABLE_LTO OR LLVM_ENABLE_LTO)
 set(LTO_DEP LTO llvm-ar llvm-ranlib)
-set(LTO_LIBRARY 
-DDARWIN_LTO_LIBRARY=${LLVM_SHLIB_OUTPUT_INTDIR}/libLTO.dylib)
 set(LTO_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar)
 set(LTO_RANLIB -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib)
+if(APPLE)
+  set(LTO_LIBRARY 
-DDARWIN_LTO_LIBRARY=${LLVM_SHLIB_OUTPUT_INTDIR}/libLTO.dylib)
+elseif(NOT WIN32)
+  list(APPEND LTO_DEP LLVMgold)
+endif()
   endif()
 
   add_custom_target(${NEXT_CLANG_STAGE}-clear


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


Re: [PATCH] D17104: [VFS] Drop path traversal assertion

2016-02-12 Thread Ben Langmuir via cfe-commits
benlangmuir added a comment.

> Given the two-path solution, another thing we could do in the first path, is 
> to default to the remove_dots() version for the source, i.e. 
> "/install-dir/lib/clang/3.8.0/include" instead of 
> "/install-dir/bin/../lib/clang/3.8.0/include". The path after remove_dots() 
> might be different from what realpath() would return (but this is covered in 
> the 2nd path) but at least we canonicalize for a future virtual path request 
> (which can safely request the VFS based on the returned path from 
> remove_dots()). What do you think about it?


I'm not sure I understand how the 2nd path would cover the realpath case.  It 
is just an entry for the realpath itself; that doesn't help if the client looks 
up "/install-dir/lib/clang/3.8.0" directly (not just from removing dots from 
bin/..).

> Correct me if I'm wrong, but do you suggest we have a new entry type in the 
> YAML file for declaring symlinks? Right now, we handle symlinks by copying 
> them out as real files inside the VFS. However, adding extra "name" entries 
> to map for real paths for such symlinks inside the YAML should do it.


Yes, that's what I'm suggesting.


http://reviews.llvm.org/D17104



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


Re: [libcxx] r259682 - re.results.form: Format out-of-range subexpression references as null

2016-02-12 Thread Hans Wennborg via cfe-commits
Marshall: ping?

On Wed, Feb 3, 2016 at 5:08 PM, Hans Wennborg  wrote:
> I'm OK if Marshall is.
>
> Thanks,
> Hans
>
> On Wed, Feb 3, 2016 at 4:59 PM, Duncan P. N. Exon Smith via
> cfe-commits  wrote:
>> Hans, do you mind merging this to the 3.8 branch?
>>
>> Marshall, do you agree this is okay to take?
>>
>>> On 2016-Feb-03, at 11:30, Duncan P. N. Exon Smith via cfe-commits 
>>>  wrote:
>>>
>>> Author: dexonsmith
>>> Date: Wed Feb  3 13:30:20 2016
>>> New Revision: 259682
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=259682&view=rev
>>> Log:
>>> re.results.form: Format out-of-range subexpression references as null
>>>
>>> Rather than crashing in match_results::format() when a reference to a
>>> marked subexpression is out of range, format the subexpression as empty
>>> (i.e., replace it with an empty string).  Note that
>>> match_results::operator[]() has a range-check and returns a null match
>>> in this case, so this just re-uses that logic.
>>>
>>> Modified:
>>>libcxx/trunk/include/regex
>>>libcxx/trunk/test/std/re/re.results/re.results.form/form1.pass.cpp
>>>
>>> Modified: libcxx/trunk/include/regex
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=259682&r1=259681&r2=259682&view=diff
>>> ==
>>> --- libcxx/trunk/include/regex (original)
>>> +++ libcxx/trunk/include/regex Wed Feb  3 13:30:20 2016
>>> @@ -5387,8 +5387,8 @@ match_results<_BidirectionalIterator, _A
>>> if ('0' <= *__fmt_first && *__fmt_first <= '9')
>>> {
>>> size_t __i = *__fmt_first - '0';
>>> -__out = _VSTD::copy(__matches_[__i].first,
>>> -   __matches_[__i].second, __out);
>>> +__out = _VSTD::copy((*this)[__i].first,
>>> +(*this)[__i].second, __out);
>>> }
>>> else
>>> {
>>> @@ -5439,8 +5439,8 @@ match_results<_BidirectionalIterator, _A
>>> ++__fmt_first;
>>> __i = 10 * __i + *__fmt_first - '0';
>>> }
>>> -__out = _VSTD::copy(__matches_[__i].first,
>>> -   __matches_[__i].second, __out);
>>> +__out = _VSTD::copy((*this)[__i].first,
>>> +(*this)[__i].second, __out);
>>> }
>>> else
>>> {
>>>
>>> Modified: libcxx/trunk/test/std/re/re.results/re.results.form/form1.pass.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/re/re.results/re.results.form/form1.pass.cpp?rev=259682&r1=259681&r2=259682&view=diff
>>> ==
>>> --- libcxx/trunk/test/std/re/re.results/re.results.form/form1.pass.cpp 
>>> (original)
>>> +++ libcxx/trunk/test/std/re/re.results/re.results.form/form1.pass.cpp Wed 
>>> Feb  3 13:30:20 2016
>>> @@ -38,6 +38,31 @@ int main()
>>> {
>>> std::match_results m;
>>> const char s[] = "abcdefghijk";
>>> +assert(std::regex_search(s, m, std::regex("cd((e)fg)hi",
>>> +  
>>> std::regex_constants::nosubs)));
>>> +
>>> +char out[100] = {0};
>>> +const char fmt[] = "prefix: $`, match: $&, suffix: $', m[1]: $1, 
>>> m[2]: $2";
>>> +char* r = m.format(output_iterator(out),
>>> +fmt, fmt + std::char_traits::length(fmt)).base();
>>> +assert(r == out + 54);
>>> +assert(std::string(out) == "prefix: ab, match: cdefghi, suffix: 
>>> jk, m[1]: , m[2]: ");
>>> +}
>>> +{
>>> +std::match_results m;
>>> +const char s[] = "abcdefghijk";
>>> +assert(std::regex_search(s, m, std::regex("cdefghi")));
>>> +
>>> +char out[100] = {0};
>>> +const char fmt[] = "prefix: $`, match: $&, suffix: $', m[1]: $1, 
>>> m[2]: $2";
>>> +char* r = m.format(output_iterator(out),
>>> +fmt, fmt + std::char_traits::length(fmt)).base();
>>> +assert(r == out + 54);
>>> +assert(std::string(out) == "prefix: ab, match: cdefghi, suffix: 
>>> jk, m[1]: , m[2]: ");
>>> +}
>>> +{
>>> +std::match_results m;
>>> +const char s[] = "abcdefghijk";
>>> assert(std::regex_search(s, m, std::regex("cd((e)fg)hi")));
>>>
>>> char out[100] = {0};
>>> @@ -61,6 +86,33 @@ int main()
>>> assert(r == out + 34);
>>> assert(std::string(out) == "match: cdefghi, m[1]: efg, m[2]: e");
>>> }
>>> +{
>>> +std::match_results m;
>>> +const char s[] = "abcdefghijk";
>>> +assert(std::regex_search(s, m, std::regex("cd((e)fg)hi",
>>> +  
>>> std::regex_constants::n

LLVM buildmaster will be updated and restarted tonight

2016-02-12 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be updated and restarted after 6 PM Pacific time
today.

Thanks

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


Re: [PATCH] D16870: [CUDA] Tweak attribute-based overload resolution to match nvcc behavior.

2016-02-12 Thread Artem Belevich via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL260697: [CUDA] Tweak attribute-based overload resolution to 
match nvcc behavior. (authored by tra).

Changed prior to commit:
  http://reviews.llvm.org/D16870?vs=47753&id=47819#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16870

Files:
  cfe/trunk/include/clang/Sema/Sema.h
  cfe/trunk/lib/Sema/SemaCUDA.cpp
  cfe/trunk/lib/Sema/SemaOverload.cpp
  cfe/trunk/test/CodeGenCUDA/function-overload.cu
  cfe/trunk/test/SemaCUDA/function-overload.cu

Index: cfe/trunk/test/CodeGenCUDA/function-overload.cu
===
--- cfe/trunk/test/CodeGenCUDA/function-overload.cu
+++ cfe/trunk/test/CodeGenCUDA/function-overload.cu
@@ -7,7 +7,8 @@
 // RUN: | FileCheck -check-prefix=CHECK-BOTH -check-prefix=CHECK-HOST %s
 // RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fcuda-is-device \
 // RUN: -fcuda-target-overloads -emit-llvm -o - %s \
-// RUN: | FileCheck -check-prefix=CHECK-BOTH -check-prefix=CHECK-DEVICE %s
+// RUN: | FileCheck -check-prefix=CHECK-BOTH -check-prefix=CHECK-DEVICE \
+// RUN:   -check-prefix=CHECK-DEVICE-STRICT %s
 
 // Check target overloads handling with disabled call target checks.
 // RUN: %clang_cc1 -DNOCHECKS -triple x86_64-unknown-linux-gnu -emit-llvm \
@@ -77,24 +78,120 @@
 extern "C" __host__ __device__ int chd(void) {return 14;}
 // CHECK-BOTH: ret i32 14
 
+// HD functions are sometimes allowed to call H or D functions -- this
+// is an artifact of the source-to-source splitting performed by nvcc
+// that we need to mimic. During device mode compilation in nvcc, host
+// functions aren't present at all, so don't participate in
+// overloading. But in clang, H and D functions are present in both
+// compilation modes. Clang normally uses the target attribute as a
+// tiebreaker between overloads with otherwise identical priority, but
+// in order to match nvcc's behavior, we sometimes need to wholly
+// discard overloads that would not be present during compilation
+// under nvcc.
+
+template  T template_vs_function(T arg) { return 15; }
+__device__ float template_vs_function(float arg) { return 16; }
+
+// Here we expect to call the templated function during host
+// compilation, even if -fcuda-disable-target-call-checks is passed,
+// and even though C++ overload rules prefer the non-templated
+// function.
+// CHECK-BOTH-LABEL: define void @_Z5hd_tfv()
+__host__ __device__ void hd_tf(void) {
+  template_vs_function(1.0f);
+  // CHECK-HOST: call float @_Z20template_vs_functionIfET_S0_(float
+  // CHECK-DEVICE: call float @_Z20template_vs_functionf(float
+  template_vs_function(2.0);
+  // CHECK-HOST: call double @_Z20template_vs_functionIdET_S0_(double
+  // CHECK-DEVICE: call float @_Z20template_vs_functionf(float
+}
+
+// Calls from __host__ and __device__ functions should always call the
+// overloaded function that matches their mode.
+// CHECK-HOST-LABEL: define void @_Z4h_tfv()
+__host__ void h_tf() {
+  template_vs_function(1.0f);
+  // CHECK-HOST: call float @_Z20template_vs_functionIfET_S0_(float
+  template_vs_function(2.0);
+  // CHECK-HOST: call double @_Z20template_vs_functionIdET_S0_(double
+}
+
+// CHECK-DEVICE-LABEL: define void @_Z4d_tfv()
+__device__ void d_tf() {
+  template_vs_function(1.0f);
+  // CHECK-DEVICE: call float @_Z20template_vs_functionf(float
+  template_vs_function(2.0);
+  // CHECK-DEVICE: call float @_Z20template_vs_functionf(float
+}
+
+// In case we have a mix of HD and H-only or D-only candidates in the
+// overload set, normal C++ overload resolution rules apply first.
+template  T template_vs_hd_function(T arg) { return 15; }
+__host__ __device__ float template_vs_hd_function(float arg) { return 16; }
+
+// CHECK-BOTH-LABEL: define void @_Z7hd_thdfv()
+__host__ __device__ void hd_thdf() {
+  template_vs_hd_function(1.0f);
+  // CHECK-HOST: call float @_Z23template_vs_hd_functionf(float
+  // CHECK-DEVICE: call float @_Z23template_vs_hd_functionf(float
+  template_vs_hd_function(1);
+  // CHECK-HOST: call i32 @_Z23template_vs_hd_functionIiET_S0_(i32
+  // CHECK-DEVICE-STRICT: call float @_Z23template_vs_hd_functionf(float
+  // CHECK-DEVICE-NC: call i32 @_Z23template_vs_hd_functionIiET_S0_(i32
+}
+
+// CHECK-HOST-LABEL: define void @_Z6h_thdfv()
+__host__ void h_thdf() {
+  template_vs_hd_function(1.0f);
+  // CHECK-HOST: call float @_Z23template_vs_hd_functionf(float
+  template_vs_hd_function(1);
+  // CHECK-HOST: call i32 @_Z23template_vs_hd_functionIiET_S0_(i32
+}
+
+// CHECK-DEVICE-LABEL: define void @_Z6d_thdfv()
+__device__ void d_thdf() {
+  template_vs_hd_function(1.0f);
+  // CHECK-DEVICE: call float @_Z23template_vs_hd_functionf(float
+  template_vs_hd_function(1);
+  // Host-only function template is not callable with strict call checks,
+  // so for device side HD function will be the only choice.
+  // CHECK-DEVICE: call float @_Z23template_vs_hd_functionf(float
+}
+

r260697 - [CUDA] Tweak attribute-based overload resolution to match nvcc behavior.

2016-02-12 Thread Artem Belevich via cfe-commits
Author: tra
Date: Fri Feb 12 12:29:18 2016
New Revision: 260697

URL: http://llvm.org/viewvc/llvm-project?rev=260697&view=rev
Log:
[CUDA] Tweak attribute-based overload resolution to match nvcc behavior.

This is an artefact of split-mode CUDA compilation that we need to
mimic. HD functions are sometimes allowed to call H or D functions. Due
to split compilation mode device-side compilation will not see host-only
function and thus they will not be considered at all. For clang both H
and D variants will become function overloads visible to
compiler. Normally target attribute is considered only if C++ rules can
not determine which function is better. However in this case we need to
ignore functions that would not be present during current compilation
phase before we apply normal overload resolution rules.

Changes:
* introduced another level of call preference to better describe
  possible call combinations.
* removed WrongSide functions from consideration if the set contains
  SameSide function.
* disabled H->D, D->H and G->H calls. These combinations are
  not allowed by CUDA and we were reluctantly allowing them to work
  around device-side calls to math functions in std namespace.
  We no longer need it after r258880.

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

Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaCUDA.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/CodeGenCUDA/function-overload.cu
cfe/trunk/test/SemaCUDA/function-overload.cu

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=260697&r1=260696&r2=260697&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Feb 12 12:29:18 2016
@@ -8794,12 +8794,18 @@ public:
 
   CUDAFunctionTarget IdentifyCUDATarget(const FunctionDecl *D);
 
+  // CUDA function call preference. Must be ordered numerically from
+  // worst to best.
   enum CUDAFunctionPreference {
 CFP_Never,  // Invalid caller/callee combination.
-CFP_LastResort, // Lowest priority. Only in effect if
+CFP_WrongSide,  // Calls from host-device to host or device
+// function that do not match current compilation
+// mode. Only in effect if
 // LangOpts.CUDADisableTargetCallChecks is true.
-CFP_Fallback,   // Low priority caller/callee combination
-CFP_Best,   // Preferred caller/callee combination
+CFP_HostDevice, // Any calls to host/device functions.
+CFP_SameSide,   // Calls from host-device to host or device
+// function matching current compilation mode.
+CFP_Native, // host-to-host or device-to-device calls.
   };
 
   /// Identifies relative preference of a given Caller/Callee

Modified: cfe/trunk/lib/Sema/SemaCUDA.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCUDA.cpp?rev=260697&r1=260696&r2=260697&view=diff
==
--- cfe/trunk/lib/Sema/SemaCUDA.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCUDA.cpp Fri Feb 12 12:29:18 2016
@@ -68,26 +68,26 @@ Sema::CUDAFunctionTarget Sema::IdentifyC
 // Ph - preference in host mode
 // Pd - preference in device mode
 // H  - handled in (x)
-// Preferences: b-best, f-fallback, l-last resort, n-never.
+// Preferences: N:native, HD:host-device, SS:same side, WS:wrong side, 
--:never.
 //
-// | F  | T  | Ph | Pd |  H  |
-// |++++-+
-// | d  | d  | b  | b  | (b) |
-// | d  | g  | n  | n  | (a) |
-// | d  | h  | l  | l  | (e) |
-// | d  | hd | f  | f  | (c) |
-// | g  | d  | b  | b  | (b) |
-// | g  | g  | n  | n  | (a) |
-// | g  | h  | l  | l  | (e) |
-// | g  | hd | f  | f  | (c) |
-// | h  | d  | l  | l  | (e) |
-// | h  | g  | b  | b  | (b) |
-// | h  | h  | b  | b  | (b) |
-// | h  | hd | f  | f  | (c) |
-// | hd | d  | l  | f  | (d) |
-// | hd | g  | f  | n  |(d/a)|
-// | hd | h  | f  | l  | (d) |
-// | hd | hd | b  | b  | (b) |
+// | F  | T  | Ph  | Pd  |  H  |
+// |++-+-+-+
+// | d  | d  | N   | N   | (c) |
+// | d  | g  | --  | --  | (a) |
+// | d  | h  | --  | --  | (e) |
+// | d  | hd | HD  | HD  | (b) |
+// | g  | d  | N   | N   | (c) |
+// | g  | g  | --  | --  | (a) |
+// | g  | h  | --  | --  | (e) |
+// | g  | hd | HD  | HD  | (b) |
+// | h  | d  | --  | --  | (e) |
+// | h  | g  | N   | N   | (c) |
+// | h  | h  | N   | N   | (c) |
+// | h  | hd | HD  | HD  | (b) |
+// | hd | d  | WS  | SS  | (d) |
+// | hd | g  | SS  | --  |(d/a)|
+// | hd | h  | SS  | WS  | (d) |
+// | hd | hd | HD  | HD  | (b) |
 
 Sema::CUDAFunctionPreference
 Sema::IdentifyCUDAPreference(const FunctionDecl *Caller,
@@ -112,39 +112,38 @@ Sema::IdentifyCUDAPreference(const Funct
(CallerTarget == CFT_HostDevice && getLangOpts().CUDAIsDevice)))
 re

Re: [PATCH] D16040: [OpenCL] Refine OpenCLImageAccessAttr to OpenCLAccessAttr

2016-02-12 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: lib/Sema/SemaDeclAttr.cpp:5823
@@ -5788,8 +5822,3 @@
 
-  // Walk the declarator structure, applying decl attributes that were in a 
type
-  // position to the decl itself.  This handles cases like:
-  //   int *__attr__(x)** D;
-  // when X is a decl attribute.
-  for (unsigned i = 0, e = PD.getNumTypeObjects(); i != e; ++i)
-if (const AttributeList *Attrs = PD.getTypeObject(i).getAttrs())
-  ProcessDeclAttributeList(S, D, Attrs, /*IncludeCXX11Attributes=*/false);
+  // Skip pipe type, otherwise it will be processed twice with its element type
+  const ParmVarDecl *PDecl = llvm::dyn_cast(D);

Anastasia wrote:
> aaron.ballman wrote:
> > Anastasia wrote:
> > > . missing
> > Missing punctuation.
> > 
> > Of bigger concern -- this code is highly suspect -- this is called for 
> > every declaration in the source code. Why is this complexity needed here 
> > instead of elsewhere?
> I assume we could do this check in ProcessDeclAttributeList or just after:
>   if (const AttributeList *Attrs = PD.getTypeObject(i).getAttrs())
Is this an attribute that's written on the type declarator, and needs to be 
"slid" onto the declaration? If so, we do that in ProcessDeclAttributes, around 
line 5794. But we should not be adding ad hoc special cases to filter these 
out, they should probably be handled in distributeTypeAttrsFromDeclarator() in 
SemaType.cpp.


http://reviews.llvm.org/D16040



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


Re: [PATCH] D16040: [OpenCL] Refine OpenCLImageAccessAttr to OpenCLAccessAttr

2016-02-12 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: lib/Sema/SemaDeclAttr.cpp:5823
@@ -5788,8 +5822,3 @@
 
-  // Walk the declarator structure, applying decl attributes that were in a 
type
-  // position to the decl itself.  This handles cases like:
-  //   int *__attr__(x)** D;
-  // when X is a decl attribute.
-  for (unsigned i = 0, e = PD.getNumTypeObjects(); i != e; ++i)
-if (const AttributeList *Attrs = PD.getTypeObject(i).getAttrs())
-  ProcessDeclAttributeList(S, D, Attrs, /*IncludeCXX11Attributes=*/false);
+  // Skip pipe type, otherwise it will be processed twice with its element type
+  const ParmVarDecl *PDecl = llvm::dyn_cast(D);

aaron.ballman wrote:
> Anastasia wrote:
> > . missing
> Missing punctuation.
> 
> Of bigger concern -- this code is highly suspect -- this is called for every 
> declaration in the source code. Why is this complexity needed here instead of 
> elsewhere?
I assume we could do this check in ProcessDeclAttributeList or just after:
  if (const AttributeList *Attrs = PD.getTypeObject(i).getAttrs())


http://reviews.llvm.org/D16040



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


Re: [PATCH] D17104: [VFS] Drop path traversal assertion

2016-02-12 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a comment.

> Your two-path solution seems like it's on the right track but I don't like 
> that it brings us back to having ".." in the source path.


Given the two-path solution, another thing we could do in the first path, is to 
default to the remove_dots() version for the source, i.e. 
"/install-dir/lib/clang/3.8.0/include" instead of 
"/install-dir/bin/../lib/clang/3.8.0/include". The path after remove_dots() 
might be different from what realpath() would return (but this is covered in 
the 2nd path) but at least we canonicalize for a future virtual path request 
(which can safely request the VFS based on the returned path from 
remove_dots()). What do you think about it?

> Do you think it's feasible to store a mapping from the realpath, and 
> additionally have a symlink entry in the VFS (which would be a new feature 
> for the VFS in general)?

>  When we write the YAML file, we could realpath(source) and if it is 
> different from remove_dots(source) we would add a symlink entry.


Correct me if I'm wrong, but do you suggest we have a new entry type in the 
YAML file for declaring symlinks? Right now, we handle symlinks by copying them 
out as real files inside the VFS. However, adding extra "name" entries to map 
for real paths for such symlinks inside the YAML should do it.

> I suspect figuring out whthe symlink would add non-trivial overhead, since 
> we'd have to look at every path component... at least it would only be paid 
> when creating the YAML, not when reading it. Any thoughts?


I agree that the price should only be paid only when creating the YAML files.


http://reviews.llvm.org/D17104



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


Re: [libcxx] r258107 - Fix PR#26175. Thanks to Josh Petrie for the report and the patch. Reviewed as http://reviews.llvm.org/D16262

2016-02-12 Thread Hans Wennborg via cfe-commits
Marshall: ping?

On Mon, Feb 1, 2016 at 1:48 PM, Hans Wennborg  wrote:
> Marshall: ping?
>
> On Tue, Jan 26, 2016 at 11:08 AM, Hans Wennborg  wrote:
>> On Tue, Jan 19, 2016 at 9:21 AM, Hans Wennborg  wrote:
>>> On Tue, Jan 19, 2016 at 12:01 AM, Dimitry Andric  wrote:
 On 19 Jan 2016, at 01:50, Marshall Clow via cfe-commits 
  wrote:
>
> Author: marshall
> Date: Mon Jan 18 18:50:37 2016
> New Revision: 258107
>
> URL: http://llvm.org/viewvc/llvm-project?rev=258107&view=rev
> Log:
> Fix PR#26175. Thanks to Josh Petrie for the report and the patch. 
> Reviewed as http://reviews.llvm.org/D16262

 This looks like a good candidate for the 3.8 branch, do you agree?
>>>
>>> Sounds good to me if Marshall agrees.
>>
>> Ping?
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16686: [OpenCL] Generate metadata for opencl_unroll_hint attribute

2016-02-12 Thread Anastasia Stulova via cfe-commits
Anastasia added a comment.

@Pekka, Xiuli, Richard, any more comments here?

Thanks!


http://reviews.llvm.org/D16686



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


Re: [PATCH] D17197: [OPENMP] NFC rewrite ParseOpenMPDirectiveKind

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

LG


http://reviews.llvm.org/D17197



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


Re: [PATCH] D16152: [clang-tidy] Add check performance-faster-string-find

2016-02-12 Thread Samuel Benzaquen via cfe-commits
sbenza updated this revision to Diff 47808.
sbenza marked an inline comment as done.
sbenza added a comment.

Minor fix on comment


http://reviews.llvm.org/D16152

Files:
  clang-tidy/performance/CMakeLists.txt
  clang-tidy/performance/FasterStringFindCheck.cpp
  clang-tidy/performance/FasterStringFindCheck.h
  clang-tidy/performance/PerformanceTidyModule.cpp
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/performance-faster-string-find.rst
  test/clang-tidy/performance-faster-string-find.cpp

Index: test/clang-tidy/performance-faster-string-find.cpp
===
--- /dev/null
+++ test/clang-tidy/performance-faster-string-find.cpp
@@ -0,0 +1,110 @@
+// RUN: %check_clang_tidy %s performance-faster-string-find %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: performance-faster-string-find.StringLikeClasses, \
+// RUN:   value: 'std::basic_string; ::llvm::StringRef;'}]}" --
+
+namespace std {
+template 
+struct basic_string {
+  int find(const Char *, int = 0) const;
+  int find(const Char *, int, int) const;
+  int rfind(const Char *) const;
+  int find_first_of(const Char *) const;
+  int find_first_not_of(const Char *) const;
+  int find_last_of(const Char *) const;
+  int find_last_not_of(const Char *) const;
+};
+
+typedef basic_string string;
+typedef basic_string wstring;
+}  // namespace std
+
+namespace llvm {
+struct StringRef {
+  int find(const char *) const;
+};
+}  // namespace llvm
+
+struct NotStringRef {
+  int find(const char *);
+};
+
+void StringFind() {
+  std::string Str;
+
+  Str.find("a");
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: find called with a string literal consisting of a single character; consider using the more effective overload accepting a character [performance-faster-string-find]
+  // CHECK-FIXES: Str.find('a');
+
+  // Works with the pos argument.
+  Str.find("a", 1);
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: find called with a string literal
+  // CHECK-FIXES: Str.find('a', 1);
+
+  // Doens't work with strings smaller or larger than 1 char.
+  Str.find("");
+  Str.find("ab");
+
+  // Doesn't do anything with the 3 argument overload.
+  Str.find("a", 1, 1);
+
+  // Other methods that can also be replaced
+  Str.rfind("a");
+  // CHECK-MESSAGES: [[@LINE-1]]:13: warning: rfind called with a string literal
+  // CHECK-FIXES: Str.rfind('a');
+  Str.find_first_of("a");
+  // CHECK-MESSAGES: [[@LINE-1]]:21: warning: find_first_of called with a string
+  // CHECK-FIXES: Str.find_first_of('a');
+  Str.find_first_not_of("a");
+  // CHECK-MESSAGES: [[@LINE-1]]:25: warning: find_first_not_of called with a
+  // CHECK-FIXES: Str.find_first_not_of('a');
+  Str.find_last_of("a");
+  // CHECK-MESSAGES: [[@LINE-1]]:20: warning: find_last_of called with a string
+  // CHECK-FIXES: Str.find_last_of('a');
+  Str.find_last_not_of("a");
+  // CHECK-MESSAGES: [[@LINE-1]]:24: warning: find_last_not_of called with a
+  // CHECK-FIXES: Str.find_last_not_of('a');
+
+  // std::wstring should work.
+  std::wstring WStr;
+  WStr.find(L"n");
+  // CHECK-MESSAGES: [[@LINE-1]]:13: warning: find called with a string literal
+  // CHECK-FIXES: Str.find(L'n');
+  // Even with unicode that fits in one wide char.
+  WStr.find(L"\x3A9");
+  // CHECK-MESSAGES: [[@LINE-1]]:13: warning: find called with a string literal
+  // CHECK-FIXES: Str.find(L'\x3A9');
+
+  // Also with other types, but only if it was specified in the options.
+  llvm::StringRef sr;
+  sr.find("x");
+  // CHECK-MESSAGES: [[@LINE-1]]:11: warning: find called with a string literal
+  // CHECK-FIXES: sr.find('x');
+  NotStringRef nsr;
+  nsr.find("x");
+}
+
+
+template 
+int FindTemplateDependant(T value) {
+  return value.find("A");
+}
+template 
+int FindTemplateNotDependant(T pos) {
+  return std::string().find("A", pos);
+  // CHECK-MESSAGES: [[@LINE-1]]:29: warning: find called with a string literal
+  // CHECK-FIXES: return std::string().find('A', pos);
+}
+
+int FindStr() {
+  return FindTemplateDependant(std::string()) + FindTemplateNotDependant(1);
+}
+
+#define STR_MACRO(str) str.find("A")
+#define POS_MACRO(pos) std::string().find("A",pos)
+
+int Macros() {
+  return STR_MACRO(std::string()) + POS_MACRO(1);
+  // CHECK-MESSAGES: [[@LINE-1]]:10: warning: find called with a string literal
+  // CHECK-MESSAGES: [[@LINE-2]]:37: warning: find called with a string literal
+}
Index: docs/clang-tidy/checks/performance-faster-string-find.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/performance-faster-string-find.rst
@@ -0,0 +1,22 @@
+.. title:: clang-tidy - performance-faster-string-find
+
+performance-faster-string-find
+==
+
+Optimize calls to std::string::find() and friends when the needle passed is
+a single character string literal.
+The character literal overload is more efficient.
+
+By default only `std::basic_string` is con

Re: [PATCH] D17163: [ASTMatchers] Add matcher hasAnyName.

2016-02-12 Thread Samuel Benzaquen via cfe-commits
sbenza updated this revision to Diff 47802.
sbenza marked 2 inline comments as done.
sbenza added a comment.

Minor fixes:

- Add argument comments
- Move vector contructor to callers to simply API of HasNameMatcher


http://reviews.llvm.org/D17163

Files:
  docs/LibASTMatchersReference.html
  docs/tools/dump_ast_matchers.py
  include/clang/ASTMatchers/ASTMatchers.h
  include/clang/ASTMatchers/ASTMatchersInternal.h
  lib/ASTMatchers/ASTMatchersInternal.cpp
  lib/ASTMatchers/Dynamic/Registry.cpp
  unittests/ASTMatchers/ASTMatchersTest.cpp

Index: unittests/ASTMatchers/ASTMatchersTest.cpp
===
--- unittests/ASTMatchers/ASTMatchersTest.cpp
+++ unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -2873,6 +2873,19 @@
   EXPECT_TRUE(matches(code, fieldDecl(hasName("::a::F(int)::S::m";
 }
 
+TEST(Matcher, HasAnyName) {
+  const std::string Code = "namespace a { namespace b { class C; } }";
+
+  EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("XX", "a::b::C";
+  EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("a::b::C", "XX";
+  EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("XX::C", "a::b::C";
+  EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("XX", "C";
+
+  EXPECT_TRUE(notMatches(Code, recordDecl(hasAnyName("::C", "::b::C";
+  EXPECT_TRUE(
+  matches(Code, recordDecl(hasAnyName("::C", "::b::C", "::a::b::C";
+}
+
 TEST(Matcher, IsDefinition) {
   DeclarationMatcher DefinitionOfClassA =
   recordDecl(hasName("A"), isDefinition());
Index: lib/ASTMatchers/Dynamic/Registry.cpp
===
--- lib/ASTMatchers/Dynamic/Registry.cpp
+++ lib/ASTMatchers/Dynamic/Registry.cpp
@@ -190,6 +190,7 @@
   REGISTER_MATCHER(hasAncestor);
   REGISTER_MATCHER(hasAnyArgument);
   REGISTER_MATCHER(hasAnyConstructorInitializer);
+  REGISTER_MATCHER(hasAnyName);
   REGISTER_MATCHER(hasAnyParameter);
   REGISTER_MATCHER(hasAnySubstatement);
   REGISTER_MATCHER(hasAnyTemplateArgument);
Index: lib/ASTMatchers/ASTMatchersInternal.cpp
===
--- lib/ASTMatchers/ASTMatchersInternal.cpp
+++ lib/ASTMatchers/ASTMatchersInternal.cpp
@@ -14,6 +14,7 @@
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/ASTMatchers/ASTMatchersInternal.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/ManagedStatic.h"
 
 namespace clang {
@@ -293,14 +294,26 @@
   return false;
 }
 
-HasNameMatcher::HasNameMatcher(StringRef NameRef)
-: UseUnqualifiedMatch(NameRef.find("::") == NameRef.npos), Name(NameRef) {
-  assert(!Name.empty());
+Matcher hasAnyNameFunc(ArrayRef NameRefs) {
+  std::vector Names;
+  for (auto *Name : NameRefs)
+Names.emplace_back(*Name);
+  return internal::Matcher(
+  new internal::HasNameMatcher(std::move(Names)));
+}
+
+HasNameMatcher::HasNameMatcher(std::vector N)
+: UseUnqualifiedMatch(std::all_of(
+  N.begin(), N.end(),
+  [](StringRef Name) { return Name.find("::") == Name.npos; })),
+  Names(std::move(N)) {
+  for (StringRef Name : Names)
+assert(!Name.empty());
 }
 
 namespace {
 
-bool ConsumeNameSuffix(StringRef &FullName, StringRef Suffix) {
+bool consumeNameSuffix(StringRef &FullName, StringRef Suffix) {
   StringRef Name = FullName;
   if (!Name.endswith(Suffix))
 return false;
@@ -314,79 +327,127 @@
   return true;
 }
 
-bool ConsumeNodeName(StringRef &Name, const NamedDecl &Node) {
+StringRef getNodeName(const NamedDecl &Node, llvm::SmallString<128> &Scratch) {
   // Simple name.
   if (Node.getIdentifier())
-return ConsumeNameSuffix(Name, Node.getName());
+return Node.getName();
 
   if (Node.getDeclName()) {
 // Name needs to be constructed.
-llvm::SmallString<128> NodeName;
-llvm::raw_svector_ostream OS(NodeName);
+Scratch.clear();
+llvm::raw_svector_ostream OS(Scratch);
 Node.printName(OS);
-return ConsumeNameSuffix(Name, OS.str());
+return OS.str();
   }
 
-  return ConsumeNameSuffix(Name, "(anonymous)");
+  return "(anonymous)";
 }
 
+StringRef getNodeName(const RecordDecl &Node, llvm::SmallString<128> &Scratch) {
+  if (Node.getIdentifier()) {
+return Node.getName();
+  }
+  Scratch.clear();
+  return ("(anonymous " + Node.getKindName() + ")").toStringRef(Scratch);
+}
+
+StringRef getNodeName(const NamespaceDecl &Node,
+  llvm::SmallString<128> &Scratch) {
+  return Node.isAnonymousNamespace() ? "(anonymous namespace)" : Node.getName();
+}
+
+
+class PatternSet {
+public:
+  PatternSet(ArrayRef Names) {
+for (StringRef Name : Names)
+  Patterns.push_back({Name, Name.startswith("::")});
+  }
+
+  /// Consumes the name suffix from each pattern in the set and removes the ones
+  /// that didn't match.
+  /// Return true if there are still any patterns left.
+  bool consumeNameSuffix(StringRef NodeName, bool CanSkip) {
+for (size_t I = 0; I < Patterns.s

Re: [PATCH] D17163: [ASTMatchers] Add matcher hasAnyName.

2016-02-12 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments.


Comment at: include/clang/ASTMatchers/ASTMatchersInternal.h:644
@@ -643,2 +643,3 @@
   explicit HasNameMatcher(StringRef Name);
+  explicit HasNameMatcher(ArrayRef Names);
 

alexfh wrote:
> bkramer wrote:
> > alexfh wrote:
> > > Why not `ArrayRef`?
> > That's an artifact of how llvm::VariadicFunction works. It gives you an 
> > array ref of pointers to the arguments.
> Thanks! Good to know. Maybe a add a comment or is it just me who doesn't know 
> this?
No reason to leak the VariadicFunction design into here.
I moved the transformation into std::vector<> to the caller.


http://reviews.llvm.org/D17163



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


Re: [PATCH] D16152: [clang-tidy] Add check performance-faster-string-find

2016-02-12 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM with one tiny nit.



Comment at: clang-tidy/performance/FasterStringFindCheck.cpp:44
@@ +43,3 @@
+  }
+  // Now replace the " with '
+  auto pos = Result.find_first_of('"');

Minor nit: missing punctuation for the comment. 


http://reviews.llvm.org/D16152



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


Re: [PATCH] D17183: Make TargetInfo store an actual DataLayout instead of a string.

2016-02-12 Thread Paul Robinson via cfe-commits
probinson added a comment.

In http://reviews.llvm.org/D17183#351361, @jyknight wrote:

> Those changes were necessary due to a name (IIRC it was "Module") existing
>  in both the clang and llvm namespaces, and after this change, becoming
>  ambiguous in those files.


Ah, that one. Okay.


http://reviews.llvm.org/D17183



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


Re: [PATCH] D16517: ClangTidy check to flag uninitialized builtin and pointer fields.

2016-02-12 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! Thank you for the new awesome check and to Jonathan for the 
original patch!


http://reviews.llvm.org/D16517



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


Re: [PATCH] D16152: [clang-tidy] Add check performance-faster-string-find

2016-02-12 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment.

Friendly ping.


http://reviews.llvm.org/D16152



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


Re: [PATCH] D16749: [OpenMP] Map clause codegeneration.

2016-02-12 Thread Samuel Antao via cfe-commits
sfantao added a comment.

Ping!


http://reviews.llvm.org/D16749



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


Re: [PATCH] D16308: clang-tidy Enhance readability-simplify-boolean-expr check to handle implicit conversions of integral types to bool and member pointers

2016-02-12 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

I have commit in r260681. You should look into obtaining commit privileges: 
http://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access

~Aaron


http://reviews.llvm.org/D16308



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


[clang-tools-extra] r260681 - Reapply r260096.

2016-02-12 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Fri Feb 12 09:09:05 2016
New Revision: 260681

URL: http://llvm.org/viewvc/llvm-project?rev=260681&view=rev
Log:
Reapply r260096.

Expand the simplify boolean expression check to handle implicit conversion of 
integral types to bool and improve the handling of implicit conversion of 
member pointers to bool.

Implicit conversion of member pointers are replaced with explicit comparisons 
to nullptr.

Implicit conversions of integral types are replaced with explicit comparisons 
to 0.

Patch by Richard Thomson.

Modified:
clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.h

clang-tools-extra/trunk/docs/clang-tidy/checks/readability-simplify-boolean-expr.rst
clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.cpp?rev=260681&r1=260680&r2=260681&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.cpp 
Fri Feb 12 09:09:05 2016
@@ -85,10 +85,11 @@ bool needsParensAfterUnaryNegation(const
   E = E->IgnoreImpCasts();
   if (isa(E) || isa(E))
 return true;
-  if (const auto *Op = dyn_cast(E)) {
+
+  if (const auto *Op = dyn_cast(E))
 return Op->getNumArgs() == 2 && Op->getOperator() != OO_Call &&
Op->getOperator() != OO_Subscript;
-  }
+
   return false;
 }
 
@@ -107,12 +108,8 @@ StringRef negatedOperator(const BinaryOp
 }
 
 std::pair OperatorNames[] = {
-{OO_EqualEqual, "=="},
-{OO_ExclaimEqual, "!="},
-{OO_Less, "<"},
-{OO_GreaterEqual, ">="},
-{OO_Greater, ">"},
-{OO_LessEqual, "<="}};
+{OO_EqualEqual, "=="},   {OO_ExclaimEqual, "!="}, {OO_Less, "<"},
+{OO_GreaterEqual, ">="}, {OO_Greater, ">"},   {OO_LessEqual, "<="}};
 
 StringRef getOperatorName(OverloadedOperatorKind OpKind) {
   for (auto Name : OperatorNames) {
@@ -148,7 +145,15 @@ std::string asBool(StringRef text, bool
 
 bool needsNullPtrComparison(const Expr *E) {
   if (const auto *ImpCast = dyn_cast(E))
-return ImpCast->getCastKind() == CK_PointerToBoolean;
+return ImpCast->getCastKind() == CK_PointerToBoolean ||
+   ImpCast->getCastKind() == CK_MemberPointerToBoolean;
+
+  return false;
+}
+
+bool needsZeroComparison(const Expr *E) {
+  if (const auto *ImpCast = dyn_cast(E))
+return ImpCast->getCastKind() == CK_IntegralToBoolean;
 
   return false;
 }
@@ -172,6 +177,29 @@ bool needsStaticCast(const Expr *E) {
   return !E->getType()->isBooleanType();
 }
 
+std::string compareExpressionToConstant(const MatchFinder::MatchResult &Result,
+const Expr *E, bool Negated,
+const char *Constant) {
+  E = E->IgnoreImpCasts();
+  const std::string ExprText =
+  (isa(E) ? ("(" + getText(Result, *E) + ")")
+  : getText(Result, *E))
+  .str();
+  return ExprText + " " + (Negated ? "!=" : "==") + " " + Constant;
+}
+
+std::string compareExpressionToNullPtr(const MatchFinder::MatchResult &Result,
+   const Expr *E, bool Negated) {
+  const char *NullPtr =
+  Result.Context->getLangOpts().CPlusPlus11 ? "nullptr" : "NULL";
+  return compareExpressionToConstant(Result, E, Negated, NullPtr);
+}
+
+std::string compareExpressionToZero(const MatchFinder::MatchResult &Result,
+const Expr *E, bool Negated) {
+  return compareExpressionToConstant(Result, E, Negated, "0");
+}
+
 std::string replacementExpression(const MatchFinder::MatchResult &Result,
   bool Negated, const Expr *E) {
   E = E->ignoreParenBaseCasts();
@@ -180,14 +208,20 @@ std::string replacementExpression(const
 if (const auto *UnOp = dyn_cast(E)) {
   if (UnOp->getOpcode() == UO_LNot) {
 if (needsNullPtrComparison(UnOp->getSubExpr()))
-  return (getText(Result, *UnOp->getSubExpr()) + " != nullptr").str();
+  return compareExpressionToNullPtr(Result, UnOp->getSubExpr(), true);
+
+if (needsZeroComparison(UnOp->getSubExpr()))
+  return compareExpressionToZero(Result, UnOp->getSubExpr(), true);
 
 return replacementExpression(Result, false, UnOp->getSubExpr());
   }
 }
 
 if (needsNullPtrComparison(E))
-  return (getText(Result, *E) + " == nullptr").str();
+  return compareExpressionToNullPtr(Result, E, false);
+
+if (needsZeroComparison(E))
+  return compareExpressionToZero(Result, E, false);
 
 StringRef NegatedOperator;
 const Expr *LHS = nullptr;
@@ -203,18 +

Re: [PATCH] D16529: [clang-tidy] Add modernize-raw-string-literal check

2016-02-12 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Sorry for the delay. I'm trying to prioritize reviews that are taking less time 
per-iteration. Unfortunately, here we have a bunch of disagreements and I have 
to spend significant time to read through your arguments and address your 
points.



Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:75
@@ +74,3 @@
+
+  return containsEscapes(Text, R"lit('\"?x01)lit");
+}

Please remove `lit`. I understand your desire to make the string less 
'crowded', but it's totally uncommon for this code to use delimiters in raw 
strings unless absolutely necessary.


Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:79
@@ +78,3 @@
+bool containsDelimiter(StringRef Bytes, const std::string &Delimiter) {
+  return Bytes.find(")" + Delimiter + R"quote(")quote") != StringRef::npos;
+}

Please remove `quote`. I understand your desire to make the string less 
'crowded', but it's totally uncommon for this code to use delimiters in raw 
strings unless absolutely necessary.


Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:92
@@ +91,3 @@
+
+bool isMacroExpansionLocation(const MatchFinder::MatchResult &Result,
+  SourceLocation Loc) {

This is not needed, see the comment below at the call to this function.


Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:97
@@ +96,3 @@
+}
+
+} // namespace

> I believe we agree on the following: ...

Yes.

> Where we seem to disagree is what algorithm should be used to determine the 
> delimiter when a delimited raw string literal is required.

Pretty much so. IMO, we don't need a universal algorithm that will hardly ever 
go further than the second iteration, and even in this case would produce a 
result that's likely undesirable (as I said, `R"lit0()lit0"` is not what I 
would want to see in my code).

The possibility of this code causing performance issues is probably not that 
high, but I can imagine a code where this could be sub-optimal.

> My implementation is the minimum performance impact for the typical case 
> where the string does not contain )".

One concern about this part is that it could issue 4 concatenation calls fewer 
in case of an empty delimiter. This may already be handled well by the 
`llvm::Twine` though.

Any code following potentially-problematic patterns might be fine on its own, 
but it will attract unnecessary attention when reading code. High frequency of 
such false alarms has non-trivial cost for code readers and makes it harder to 
find actual problems.

So please, change the code to avoid these issues. Here's a possible alternative:

  llvm::Optional asRawStringLiteral(const StringLiteral *Literal) {
const StringRef Bytes = Literal->getBytes();
static const StringRef Delimiters[2][] =
  {{"R\"(", ")\""}, {"R\"lit(", ")lit\""}, {"R\"str(", ")str\""},
  /* add more different ones to make it unlikely to meet all of these in a 
single literal in the wild */};
for (const auto &Delim : Delimiters) {
  if (Bytes.find(Delim[1]) != StringRef::npos)
return (Delim[0] + Bytes + Delim[1]).str();
}
// Give up gracefully on literals having all our delimiters.
return llvm::None;
  }


Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:109
@@ +108,3 @@
+
+  if (const auto *Literal = Result.Nodes.getNodeAs("lit")) {
+if (isMacroExpansionLocation(Result, Literal->getLocStart()))

There's no need to check the result of `getNodeAs` here, since the binding is 
done in a non-optional branch of the matcher and the type of the matcher 
corresponds to the template argument type of `getNodeAs`. At most, an `assert` 
is needed to simplify debugging in case the code is changed.


Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:110
@@ +109,3 @@
+  if (const auto *Literal = Result.Nodes.getNodeAs("lit")) {
+if (isMacroExpansionLocation(Result, Literal->getLocStart()))
+  return;

  if (Literal->getLocStart().isMacroID())
return;


Comment at: test/clang-tidy/modernize-raw-string-literal.cpp:2
@@ +1,3 @@
+// RUN: %check_clang_tidy %s modernize-raw-string-literal %t
+
+char const *const BackSlash{"goink\\frob"};

This can be sorted out later. Please add a FIXME next to the relevant test for 
now.


Comment at: test/clang-tidy/modernize-raw-string-literal.cpp:47
@@ +46,3 @@
+char const *const AlreadyRaw{R"(foobie\\bletch)"};
+char const *const UTF8Literal{u8"foobie\\bletch"};
+char const *const UTF8RawLiteral{u8R"(foobie\\bletch)"};

Please add a FIXME to handle utf8, utf16, utf32 and wide string literals.


http://reviews.llvm.org/D16529



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

Re: [PATCH] D16040: [OpenCL] Refine OpenCLImageAccessAttr to OpenCLAccessAttr

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


Comment at: include/clang/Basic/Attr.td:671
@@ -670,3 +670,3 @@
 Keyword<"write_only">]>];
   let Documentation = [Undocumented];
 }

Please, if you are updating this attribute, document it.


Comment at: lib/Sema/SemaDeclAttr.cpp:5050
@@ +5049,3 @@
+
+  // Check if there is only one access qualifier
+  if (D->hasAttr()) {

Missing punctuation. ;-)


Comment at: lib/Sema/SemaDeclAttr.cpp:5052
@@ +5051,3 @@
+  if (D->hasAttr()) {
+S.Diag(D->getLocation(), diag::err_opencl_multiple_access_qualifiers)
+<< D->getSourceRange();

This should be pointing to the attribute, not the declaration, shouldn't it?


Comment at: lib/Sema/SemaDeclAttr.cpp:5063
@@ +5062,3 @@
+  // qualifier is a compilation error.
+  if (const ParmVarDecl *PDecl = llvm::dyn_cast(D)) {
+const Type *DeclTy = PDecl->getType().getCanonicalType().getTypePtr();

Drop the llvm namespace specifier.


Comment at: lib/Sema/SemaDeclAttr.cpp:5067
@@ +5066,3 @@
+  if (S.getLangOpts().OpenCLVersion < 200 || DeclTy->isPipeType()) {
+S.Diag(D->getLocation(), diag::err_opencl_invalid_read_write)
+<< PDecl->getType() << DeclTy->isImageType() << 
D->getSourceRange();

This seems like it should also be pointing to the attribute instead of the 
declaration (I assume the declaration would be fine were it not for the 
presence of the attribute).


Comment at: lib/Sema/SemaDeclAttr.cpp:5823
@@ -5788,8 +5822,3 @@
 
-  // Walk the declarator structure, applying decl attributes that were in a 
type
-  // position to the decl itself.  This handles cases like:
-  //   int *__attr__(x)** D;
-  // when X is a decl attribute.
-  for (unsigned i = 0, e = PD.getNumTypeObjects(); i != e; ++i)
-if (const AttributeList *Attrs = PD.getTypeObject(i).getAttrs())
-  ProcessDeclAttributeList(S, D, Attrs, /*IncludeCXX11Attributes=*/false);
+  // Skip pipe type, otherwise it will be processed twice with its element type
+  const ParmVarDecl *PDecl = llvm::dyn_cast(D);

Anastasia wrote:
> . missing
Missing punctuation.

Of bigger concern -- this code is highly suspect -- this is called for every 
declaration in the source code. Why is this complexity needed here instead of 
elsewhere?


http://reviews.llvm.org/D16040



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


Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct

2016-02-12 Thread Matthijs van Duin via cfe-commits
On 11 February 2016 at 16:31, H.J. Lu  wrote:
> struct A {
> static void foo (void) ();
> static int xxx;
> };

What about it? It's an empty struct.  (And it declares a function and
a variable in the namespace of A, which however do not have any
relevant impact here.)

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


Re: [PATCH] D17183: Make TargetInfo store an actual DataLayout instead of a string.

2016-02-12 Thread James Y Knight via cfe-commits
Those changes were necessary due to a name (IIRC it was "Module") existing
in both the clang and llvm namespaces, and after this change, becoming
ambiguous in those files.
On Feb 12, 2016 3:16 AM, "Paul Robinson" 
wrote:

> probinson added a subscriber: probinson.
> probinson added a comment.
>
> Driveby comment: the changes in unittests look unrelated?
>
>
> http://reviews.llvm.org/D17183
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-12 Thread Hubert Tong via cfe-commits
Thanks Jorge. I'll work on committing this today.

-- HT

On Fri, Feb 12, 2016 at 12:10 AM, Jorge Teixeira  wrote:

> Hubert,
>
> Thanks for the code review. Over the weekend I'll try to learn a bit
> more about using Phabricator, but for now I'll reply here, and attach
> a new patch.
>
> a) *_MANT_DIG < 1 --> *_MANT_DIG < 2
> That is a stricter check and I agree with your rationale. Done.
>
> b) _MIN_EXP --> FLT_MIN_EXP
> Done.
>
> c) Remove _MIN_EXP and _MIN_10_EXP FLT,DBL,LDBL comparisons
> Yes, as you and Richard pointed out the added mantissa bits can
> compensate for the lack of increase of the exponent.
> Already fixed in http://reviews.llvm.org/rL260639.
>
> d) *_MAX_EXP and *_MIN_EXP 2,-2 --> 1,-1
> Done.
>
> Richard, will do re: single patch for multiple files. Also, can you
> close the bug report? Even if more tests for float.h get
> added/changed, the original problem has been solved.
>
> JT
>
>
> On Thu, Feb 11, 2016 at 8:38 PM, Hubert Tong
>  wrote:
> > Hi Jorge,
> >
> > I responded to the initial commit with some comments here:
> > http://reviews.llvm.org/rL260577
> >
> > -- HT
> >
> > On Thu, Feb 11, 2016 at 7:53 PM, Jorge Teixeira <
> j.lopes.teixe...@gmail.com>
> > wrote:
> >>
> >> > You'll also need to change  to only provide DECIMAL_DIG in
> C99
> >> > onwards.
> >> Done!
> >>
> >> > All of our -std versions are that standard plus applicable Defect
> >> > Reports. So -std=c89 includes TC1 and TC2, but not Amendment 1 (we
> >> > have -std=c94 for that, but the only difference from our C89 mode is
> >> > the addition of digraphs).
> >> I'll try to find the c89 TC2 and check if anything changed regarding
> >> these macros (unlikely).
> >>
> >> > __STRICT_ANSI__ is defined if Clang has not been asked to provide
> >> > extensions (either GNU extensions, perhaps via a flag like -std=gnu99,
> >> > or MS extensions), and is used by C library headers to determine that
> >> > they should provide a strictly-conforming set of declarations without
> >> > extensions.
> >> Ok, so if !defined(__STRICT__ANSI__) clang should always expose "as
> >> much as possible", including stuff from later versions of the Std.
> >> and/or eventual extensions, just as it now on float.h and float.c,
> >> right?
> >>
> >> > Testing __STDC_VERSION__ for C94 makes sense if you're trying to
> >> > detect whether Amendment 1 features should be provided.
> >> Since this will affect only digraphs, I guess there is no need (for
> >> float.h, float.c).
> >>
> >> >> 3) Lastly, can you expand (...)
> >> >
> >> > No, it does not mean that.
> >> >
> >> > For PPC64, long double is (sometimes) modeled as a pair of doubles.
> >> > Under that model, the smallest normalized value for long double is
> >> > actually larger than the smallest normalized value for double
> >> > (remember that for a normalized value with exponent E, all numbers of
> >> > the form 1.X * 2^E, with the right number of mantissa digits, are
> >> > exactly representable, so increasing the number of mantissa bits
> >> > without changing the number of exponent bits increases the magnitude
> >> > of the smallest normalized positive number).
> >> >
> >> > The set of values of long double in this model *is* a superset of the
> >> > set of values of double.
> >> >
> >> I see now, and removed the bogus tests. The patch should now test
> >> cleanly unless something needs DECIMAL_DIG but did not set the
> >> appropriate std. level, or defined __STRICT__ANSI__.
> >>
> >> Thanks for the learning experience,
> >>
> >> JT
> >>
> >>
> >>
> >> >> From /test/Preprocessor/init.cpp:
> >> >> // PPC64:#define __DBL_MIN_EXP__ (-1021)
> >> >> // PPC64:#define __FLT_MIN_EXP__ (-125)
> >> >> // PPC64:#define __LDBL_MIN_EXP__ (-968)
> >> >>
> >> >> This issue happened before
> >> >> (https://lists.gnu.org/archive/html/bug-gnulib/2011-08/msg00262.html
> ,
> >> >> http://www.openwall.com/lists/musl/2013/11/15/1), but all it means
> is
> >> >> that ppc64 is not compliant with C without soft-float. The test is
> >> >> valid and should stay, and if someone tries to compile for ppc64 in
> >> >> c89, c99 or c11 modes, clang should 1) use soft float (bad idea), 2)
> >> >> issue a diagnostic saying that that arch cannot meet the desired C
> >> >> standard without a big performance penalty - the diag should be
> >> >> suppressible with some special cmd line argument.
> >> >> Thus, I added the tests back and the FAIL for PPC64 for the time
> >> >> being, with a comment. If you know of a way to skip only the specific
> >> >> *_MIN_EXP and *_MIN_10_EXP tests, please add it, because there might
> >> >> be more similar cases in the future.
> >> >>
> >> >> JT
> >> >>
> >> >> On Thu, Feb 11, 2016 at 3:04 PM, Richard Smith <
> rich...@metafoo.co.uk>
> >> >> wrote:
> >> >>> Thanks, I modified the test to also test C89 and C99 modes and
> >> >>> committed this as r260577.
> >> >>>
> >> >>> On Thu, Feb 11, 2016 at 11:29 AM, Jorge Teixeira
> >> >>>  wrote:
> >>  Here is a revised test, which I renamed to

r260680 - [Hexagon] Specify vector alignment in DataLayout string

2016-02-12 Thread Krzysztof Parzyszek via cfe-commits
Author: kparzysz
Date: Fri Feb 12 08:48:34 2016
New Revision: 260680

URL: http://llvm.org/viewvc/llvm-project?rev=260680&view=rev
Log:
[Hexagon] Specify vector alignment in DataLayout string

The DataLayout can calculate alignment of vectors based on the alignment
of the element type and the number of elements. In fact, it is the product
of these two values. The problem is that for vectors of N x i1, this will
return the alignment of N bytes, since the alignment of i1 is 8 bits. The
vector types of vNi1 should be aligned to N bits instead. Provide explicit
alignment for HVX vectors to avoid such complications.


Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/CodeGen/target-data.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=260680&r1=260679&r2=260680&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Feb 12 08:48:34 2016
@@ -5697,9 +5697,12 @@ class HexagonTargetInfo : public TargetI
 public:
   HexagonTargetInfo(const llvm::Triple &Triple) : TargetInfo(Triple) {
 BigEndian = false;
-DataLayoutString = "e-m:e-p:32:32:32-"
-   "i64:64:64-i32:32:32-i16:16:16-i1:8:8-"
-   "f64:64:64-f32:32:32-v64:64:64-v32:32:32-a:0-n16:32";
+// Specify the vector alignment explicitly. For v512x1, the calculated
+// alignment would be 512*alignment(i1), which is 512 bytes, instead of
+// the required minimum of 64 bytes.
+DataLayoutString = "e-m:e-p:32:32:32-a:0-n16:32-"
+"i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-"
+"v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048";
 SizeType= UnsignedInt;
 PtrDiffType = SignedInt;
 IntPtrType  = SignedInt;

Modified: cfe/trunk/test/CodeGen/target-data.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/target-data.c?rev=260680&r1=260679&r2=260680&view=diff
==
--- cfe/trunk/test/CodeGen/target-data.c (original)
+++ cfe/trunk/test/CodeGen/target-data.c Fri Feb 12 08:48:34 2016
@@ -157,7 +157,7 @@
 
 // RUN: %clang_cc1 -triple hexagon-unknown -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=HEXAGON
-// HEXAGON: target datalayout = 
"e-m:e-p:32:32:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f64:64:64-f32:32:32-v64:64:64-v32:32:32-a:0-n16:32"
+// HEXAGON: target datalayout = 
"e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
 
 // RUN: %clang_cc1 -triple s390x-unknown -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=SYSTEMZ


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


Re: [PATCH] D9888: [OPENMP] Driver support for OpenMP offloading

2016-02-12 Thread Jonas Hahnfeld via cfe-commits
Hahnfeld added a comment.

@rsmith could you possibly take a look at this one? It has been around for 
roughly 8 months now and hasn't received much feedback


http://reviews.llvm.org/D9888



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


Re: [PATCH] D17134: [clang-tidy] Fix an assert failure of ForStmt in `readability-braces-around-statements` check.

2016-02-12 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: 
test/clang-tidy/readability-braces-around-statements-assert-failure.cpp:8
@@ +7,3 @@
+
+#include 
+

Tests shouldn't include any library headers. This is problematic in many 
different ways:

  * standard library can be different in different setups, which may cause test 
breakages;
  * including system headers may not work in some test setups;
  * including system headers may lead to significant increase in testing time;
  * there's no way to test something with different library implementations in 
the same test setup.

This is why we usually model APIs needed for the test in the tests (e.g. see 
test/clang-tidy/misc-inaccurate-erase.cpp). In this specific case the check 
doesn't  need an actual std::vector<>, it just needs to simulate a specific 
compile error that would lead to a specific incompleteness in the AST. So, 
please, reduce the test case (the largest reduction would be the removal of 
`#include `) ;)


Comment at: 
test/clang-tidy/readability-braces-around-statements-assert-failure.cpp:16
@@ -6,2 +15,2 @@
   }
 }

hokein wrote:
> > Interesting. Does creduce fail to further reduce the test?
> 
> I reduce the test case manually. 
> 
> Now I use FileCheck with `-implicit-check-not` parameter to ignore all 
> compilation errors.
> I reduce the test case manually.

That's why I was asking about creduce. It can do a much better job with a much 
less manual effort ;)


http://reviews.llvm.org/D17134



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


Re: [PATCH] D17163: [ASTMatchers] Add matcher hasAnyName.

2016-02-12 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: include/clang/ASTMatchers/ASTMatchersInternal.h:644
@@ -643,2 +643,3 @@
   explicit HasNameMatcher(StringRef Name);
+  explicit HasNameMatcher(ArrayRef Names);
 

bkramer wrote:
> alexfh wrote:
> > Why not `ArrayRef`?
> That's an artifact of how llvm::VariadicFunction works. It gives you an array 
> ref of pointers to the arguments.
Thanks! Good to know. Maybe a add a comment or is it just me who doesn't know 
this?


http://reviews.llvm.org/D17163



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


Re: [PATCH] D17134: [clang-tidy] Fix an assert failure of ForStmt in `readability-braces-around-statements` check.

2016-02-12 Thread Haojian Wu via cfe-commits
hokein marked an inline comment as done.


Comment at: 
test/clang-tidy/readability-braces-around-statements-assert-failure.cpp:16
@@ -6,2 +15,2 @@
   }
 }

> Interesting. Does creduce fail to further reduce the test?

I reduce the test case manually. 

Now I use FileCheck with `-implicit-check-not` parameter to ignore all 
compilation errors.


http://reviews.llvm.org/D17134



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


Re: [PATCH] D17134: [clang-tidy] Fix an assert failure of ForStmt in `readability-braces-around-statements` check.

2016-02-12 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 47795.
hokein added a comment.

Make test ignore all compliation errors.


http://reviews.llvm.org/D17134

Files:
  clang-tidy/readability/BracesAroundStatementsCheck.cpp
  test/clang-tidy/readability-braces-around-statements-assert-failure.cpp

Index: test/clang-tidy/readability-braces-around-statements-assert-failure.cpp
===
--- test/clang-tidy/readability-braces-around-statements-assert-failure.cpp
+++ test/clang-tidy/readability-braces-around-statements-assert-failure.cpp
@@ -1,7 +1,16 @@
-// RUN: %check_clang_tidy %s readability-braces-around-statements %t
+// RUN: clang-tidy -checks='-*,readability-braces-around-statements' %s 2>& 1 
| FileCheck -implicit-check-not='{{error:}}' %s
 
 int test_failure() {
   if (std::rand()) {
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: error: use of undeclared identifier 'std'
+  }
+}
+
+#include 
+
+int test_failure2() {
+  std::vector e;
+  for (typename std::vector::const_reverse_iterator iter = e.rbegin(),
+   end2 = e.rend();
+   ;++iter) {
   }
 }
Index: clang-tidy/readability/BracesAroundStatementsCheck.cpp
===
--- clang-tidy/readability/BracesAroundStatementsCheck.cpp
+++ clang-tidy/readability/BracesAroundStatementsCheck.cpp
@@ -215,6 +215,8 @@
 return false;
   }
 
+  if (!InitialLoc.isValid())
+return false;
   const SourceManager &SM = *Result.SourceManager;
   const ASTContext *Context = Result.Context;
 
@@ -225,8 +227,6 @@
   if (FileRange.isInvalid())
 return false;
 
-  // InitialLoc points at the last token before opening brace to be inserted.
-  assert(InitialLoc.isValid());
   // Convert InitialLoc to file location, if it's on the same macro expansion
   // level as the start of the statement. We also need file locations for
   // Lexer::getLocForEndOfToken working properly.


Index: test/clang-tidy/readability-braces-around-statements-assert-failure.cpp
===
--- test/clang-tidy/readability-braces-around-statements-assert-failure.cpp
+++ test/clang-tidy/readability-braces-around-statements-assert-failure.cpp
@@ -1,7 +1,16 @@
-// RUN: %check_clang_tidy %s readability-braces-around-statements %t
+// RUN: clang-tidy -checks='-*,readability-braces-around-statements' %s 2>& 1 | FileCheck -implicit-check-not='{{error:}}' %s
 
 int test_failure() {
   if (std::rand()) {
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: error: use of undeclared identifier 'std'
+  }
+}
+
+#include 
+
+int test_failure2() {
+  std::vector e;
+  for (typename std::vector::const_reverse_iterator iter = e.rbegin(),
+   end2 = e.rend();
+   ;++iter) {
   }
 }
Index: clang-tidy/readability/BracesAroundStatementsCheck.cpp
===
--- clang-tidy/readability/BracesAroundStatementsCheck.cpp
+++ clang-tidy/readability/BracesAroundStatementsCheck.cpp
@@ -215,6 +215,8 @@
 return false;
   }
 
+  if (!InitialLoc.isValid())
+return false;
   const SourceManager &SM = *Result.SourceManager;
   const ASTContext *Context = Result.Context;
 
@@ -225,8 +227,6 @@
   if (FileRange.isInvalid())
 return false;
 
-  // InitialLoc points at the last token before opening brace to be inserted.
-  assert(InitialLoc.isValid());
   // Convert InitialLoc to file location, if it's on the same macro expansion
   // level as the start of the statement. We also need file locations for
   // Lexer::getLocForEndOfToken working properly.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17163: [ASTMatchers] Add matcher hasAnyName.

2016-02-12 Thread Benjamin Kramer via cfe-commits
bkramer added a subscriber: bkramer.


Comment at: include/clang/ASTMatchers/ASTMatchersInternal.h:644
@@ -643,2 +643,3 @@
   explicit HasNameMatcher(StringRef Name);
+  explicit HasNameMatcher(ArrayRef Names);
 

alexfh wrote:
> Why not `ArrayRef`?
That's an artifact of how llvm::VariadicFunction works. It gives you an array 
ref of pointers to the arguments.


http://reviews.llvm.org/D17163



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


  1   2   >