Re: r334677 - P0096R5, P0941R2: Update to match latest feature test macro specification.

2018-06-17 Thread Vitaly Buka via cfe-commits
Hi Richard,
After this patch check-all fails for me with:
  llvm-project/libcxx/utils/libcxx/test/config.py", line 467, in
configure_features
int(macros['__cpp_deduction_guides']) < 201611:
ValueError: invalid literal for int() with base 10: '201703L'

On Wed, Jun 13, 2018 at 5:44 PM Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rsmith
> Date: Wed Jun 13 17:40:20 2018
> New Revision: 334677
>
> URL: http://llvm.org/viewvc/llvm-project?rev=334677&view=rev
> Log:
> P0096R5, P0941R2: Update to match latest feature test macro specification.
>
> Modified:
> cfe/trunk/lib/Frontend/InitPreprocessor.cpp
> cfe/trunk/test/Lexer/cxx-features.cpp
> cfe/trunk/www/cxx_status.html
>
> Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=334677&r1=334676&r2=334677&view=diff
>
> ==
> --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
> +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed Jun 13 17:40:20 2018
> @@ -487,82 +487,86 @@ static void InitializeCPlusPlusFeatureTe
>   MacroBuilder &Builder) {
>// C++98 features.
>if (LangOpts.RTTI)
> -Builder.defineMacro("__cpp_rtti", "199711");
> +Builder.defineMacro("__cpp_rtti", "199711L");
>if (LangOpts.CXXExceptions)
> -Builder.defineMacro("__cpp_exceptions", "199711");
> +Builder.defineMacro("__cpp_exceptions", "199711L");
>
>// C++11 features.
>if (LangOpts.CPlusPlus11) {
> -Builder.defineMacro("__cpp_unicode_characters", "200704");
> -Builder.defineMacro("__cpp_raw_strings", "200710");
> -Builder.defineMacro("__cpp_unicode_literals", "200710");
> -Builder.defineMacro("__cpp_user_defined_literals", "200809");
> -Builder.defineMacro("__cpp_lambdas", "200907");
> +Builder.defineMacro("__cpp_unicode_characters", "200704L");
> +Builder.defineMacro("__cpp_raw_strings", "200710L");
> +Builder.defineMacro("__cpp_unicode_literals", "200710L");
> +Builder.defineMacro("__cpp_user_defined_literals", "200809L");
> +Builder.defineMacro("__cpp_lambdas", "200907L");
>  Builder.defineMacro("__cpp_constexpr",
> -LangOpts.CPlusPlus17 ? "201603" :
> -LangOpts.CPlusPlus14 ? "201304" : "200704");
> +LangOpts.CPlusPlus17 ? "201603L" :
> +LangOpts.CPlusPlus14 ? "201304L" : "200704");
>  Builder.defineMacro("__cpp_range_based_for",
> -LangOpts.CPlusPlus17 ? "201603" : "200907");
> +LangOpts.CPlusPlus17 ? "201603L" : "200907");
>  Builder.defineMacro("__cpp_static_assert",
> -LangOpts.CPlusPlus17 ? "201411" : "200410");
> -Builder.defineMacro("__cpp_decltype", "200707");
> -Builder.defineMacro("__cpp_attributes", "200809");
> -Builder.defineMacro("__cpp_rvalue_references", "200610");
> -Builder.defineMacro("__cpp_variadic_templates", "200704");
> -Builder.defineMacro("__cpp_initializer_lists", "200806");
> -Builder.defineMacro("__cpp_delegating_constructors", "200604");
> -Builder.defineMacro("__cpp_nsdmi", "200809");
> -Builder.defineMacro("__cpp_inheriting_constructors", "201511");
> -Builder.defineMacro("__cpp_ref_qualifiers", "200710");
> -Builder.defineMacro("__cpp_alias_templates", "200704");
> +LangOpts.CPlusPlus17 ? "201411L" : "200410");
> +Builder.defineMacro("__cpp_decltype", "200707L");
> +Builder.defineMacro("__cpp_attributes", "200809L");
> +Builder.defineMacro("__cpp_rvalue_references", "200610L");
> +Builder.defineMacro("__cpp_variadic_templates", "200704L");
> +Builder.defineMacro("__cpp_initializer_lists", "200806L");
> +Builder.defineMacro("__cpp_delegating_constructors", "200604L");
> +Builder.defineMacro("__cpp_nsdmi", "200809L");
> +Builder.defineMacro("__cpp_inheriting_constructors", "201511L");
> +Builder.defineMacro("__cpp_ref_qualifiers", "200710L");
> +Builder.defineMacro("__cpp_alias_templates", "200704L");
>}
>if (LangOpts.ThreadsafeStatics)
> -Builder.defineMacro("__cpp_threadsafe_static_init", "200806");
> +Builder.defineMacro("__cpp_threadsafe_static_init", "200806L");
>
>// C++14 features.
>if (LangOpts.CPlusPlus14) {
> -Builder.defineMacro("__cpp_binary_literals", "201304");
> -Builder.defineMacro("__cpp_digit_separators", "201309");
> -Builder.defineMacro("__cpp_init_captures", "201304");
> -Builder.defineMacro("__cpp_generic_lambdas", "201304");
> -Builder.defineMacro("__cpp_decltype_auto", "201304");
> -Builder.defineMacro("__cpp_return_type_deduction", "201304");
> -Builder.defineMacro("__cpp_aggregate_nsdmi", "201304");
> -Builder.defineMacro("__cpp_variable_templates", "201304");
> + 

Re: r334677 - P0096R5, P0941R2: Update to match latest feature test macro specification.

2018-06-17 Thread Richard Smith via cfe-commits
Looks like a bug / faulty assumption in the libc++ test suite. Should be
easy to fix, but I'm not sure how pervasive the issue is. I'll take a look
in the morning. If this is blocking anything in the mean time, feel free to
revert this (or fix libc++ yourself).

On Sun, 17 Jun 2018, 01:40 Vitaly Buka via cfe-commits, <
cfe-commits@lists.llvm.org> wrote:

> Hi Richard,
> After this patch check-all fails for me with:
>   llvm-project/libcxx/utils/libcxx/test/config.py", line 467, in
> configure_features
> int(macros['__cpp_deduction_guides']) < 201611:
> ValueError: invalid literal for int() with base 10: '201703L'
>
> On Wed, Jun 13, 2018 at 5:44 PM Richard Smith via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: rsmith
>> Date: Wed Jun 13 17:40:20 2018
>> New Revision: 334677
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=334677&view=rev
>> Log:
>> P0096R5, P0941R2: Update to match latest feature test macro specification.
>>
>> Modified:
>> cfe/trunk/lib/Frontend/InitPreprocessor.cpp
>> cfe/trunk/test/Lexer/cxx-features.cpp
>> cfe/trunk/www/cxx_status.html
>>
>> Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=334677&r1=334676&r2=334677&view=diff
>>
>> ==
>> --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
>> +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed Jun 13 17:40:20 2018
>> @@ -487,82 +487,86 @@ static void InitializeCPlusPlusFeatureTe
>>   MacroBuilder &Builder) {
>>// C++98 features.
>>if (LangOpts.RTTI)
>> -Builder.defineMacro("__cpp_rtti", "199711");
>> +Builder.defineMacro("__cpp_rtti", "199711L");
>>if (LangOpts.CXXExceptions)
>> -Builder.defineMacro("__cpp_exceptions", "199711");
>> +Builder.defineMacro("__cpp_exceptions", "199711L");
>>
>>// C++11 features.
>>if (LangOpts.CPlusPlus11) {
>> -Builder.defineMacro("__cpp_unicode_characters", "200704");
>> -Builder.defineMacro("__cpp_raw_strings", "200710");
>> -Builder.defineMacro("__cpp_unicode_literals", "200710");
>> -Builder.defineMacro("__cpp_user_defined_literals", "200809");
>> -Builder.defineMacro("__cpp_lambdas", "200907");
>> +Builder.defineMacro("__cpp_unicode_characters", "200704L");
>> +Builder.defineMacro("__cpp_raw_strings", "200710L");
>> +Builder.defineMacro("__cpp_unicode_literals", "200710L");
>> +Builder.defineMacro("__cpp_user_defined_literals", "200809L");
>> +Builder.defineMacro("__cpp_lambdas", "200907L");
>>  Builder.defineMacro("__cpp_constexpr",
>> -LangOpts.CPlusPlus17 ? "201603" :
>> -LangOpts.CPlusPlus14 ? "201304" : "200704");
>> +LangOpts.CPlusPlus17 ? "201603L" :
>> +LangOpts.CPlusPlus14 ? "201304L" : "200704");
>>  Builder.defineMacro("__cpp_range_based_for",
>> -LangOpts.CPlusPlus17 ? "201603" : "200907");
>> +LangOpts.CPlusPlus17 ? "201603L" : "200907");
>>  Builder.defineMacro("__cpp_static_assert",
>> -LangOpts.CPlusPlus17 ? "201411" : "200410");
>> -Builder.defineMacro("__cpp_decltype", "200707");
>> -Builder.defineMacro("__cpp_attributes", "200809");
>> -Builder.defineMacro("__cpp_rvalue_references", "200610");
>> -Builder.defineMacro("__cpp_variadic_templates", "200704");
>> -Builder.defineMacro("__cpp_initializer_lists", "200806");
>> -Builder.defineMacro("__cpp_delegating_constructors", "200604");
>> -Builder.defineMacro("__cpp_nsdmi", "200809");
>> -Builder.defineMacro("__cpp_inheriting_constructors", "201511");
>> -Builder.defineMacro("__cpp_ref_qualifiers", "200710");
>> -Builder.defineMacro("__cpp_alias_templates", "200704");
>> +LangOpts.CPlusPlus17 ? "201411L" : "200410");
>> +Builder.defineMacro("__cpp_decltype", "200707L");
>> +Builder.defineMacro("__cpp_attributes", "200809L");
>> +Builder.defineMacro("__cpp_rvalue_references", "200610L");
>> +Builder.defineMacro("__cpp_variadic_templates", "200704L");
>> +Builder.defineMacro("__cpp_initializer_lists", "200806L");
>> +Builder.defineMacro("__cpp_delegating_constructors", "200604L");
>> +Builder.defineMacro("__cpp_nsdmi", "200809L");
>> +Builder.defineMacro("__cpp_inheriting_constructors", "201511L");
>> +Builder.defineMacro("__cpp_ref_qualifiers", "200710L");
>> +Builder.defineMacro("__cpp_alias_templates", "200704L");
>>}
>>if (LangOpts.ThreadsafeStatics)
>> -Builder.defineMacro("__cpp_threadsafe_static_init", "200806");
>> +Builder.defineMacro("__cpp_threadsafe_static_init", "200806L");
>>
>>// C++14 features.
>>if (LangOpts.CPlusPlus14) {
>> -Builder.defineMacro("__cpp_binary_literals", "20130

[PATCH] D47687: [Sema] Missing -Wlogical-op-parentheses warnings in macros (PR18971)

2018-06-17 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added inline comments.



Comment at: lib/Sema/SemaExpr.cpp:12236
 
+/// Look for '&&' in the righ or left hand of a '||' expr
+static void DiagnoseLogicalAndInLogicalOr(Sema &Self, SourceLocation OpLoc,

- Please add a period at the end of the sentence.
- "righ" should be "right".




Comment at: lib/Sema/SemaExpr.cpp:12243
+DiagnoseLogicalAndInLogicalOrRHS(Self, OpLoc, LHSExpr, RHSExpr);
+  } else {
+SourceLocation OpExpansionLoc;

You can reduce nesting below by adding an early return above this.

I also think you should describe at a high-level what you're trying to do in 
the code that follows.  Something like:
```
// Only diagnose operators in macros if they're from the same argument position.
```



Comment at: lib/Sema/SemaExpr.cpp:12249
+SourceLocation ExprExpansionLoc;
+// LHS and operator are from same arg position of macro function
+if (SM.isMacroArgExpansion(LHSExpr->getExprLoc(), &ExprExpansionLoc) &&

This comment is just describing what's clear from the code.  I think you should 
drop it, and the similar one later.



Comment at: lib/Sema/SemaExpr.cpp:12251
+if (SM.isMacroArgExpansion(LHSExpr->getExprLoc(), &ExprExpansionLoc) &&
+OpExpansionLoc == ExprExpansionLoc)
+  DiagnoseLogicalAndInLogicalOrLHS(Self, OpLoc, LHSExpr, RHSExpr);

This line has odd indentation.  Please run clang-format-diff.py to clean up the 
patch.



Comment at: test/Sema/parentheses.c:17-18
 
+// testing macros
+// nesting macros testing
+#define NESTING_VOID(cond) ( (void)(cond) )

I don't think these comments are useful.



Comment at: test/Sema/parentheses.c:19
+// nesting macros testing
+#define NESTING_VOID(cond) ( (void)(cond) )
+#define NESTING_VOID_WRAPPER(op0, op1, x, y, z) ( (void)(x op0 y op1 z) )

Can you combine this with `NON_NESTING_VOID_0` (which I think should be called 
`VOID_CAST`) below?



Comment at: test/Sema/parentheses.c:20
+#define NESTING_VOID(cond) ( (void)(cond) )
+#define NESTING_VOID_WRAPPER(op0, op1, x, y, z) ( (void)(x op0 y op1 z) )
+

- You haven't actually wrapped `NESTING_VOID` here.
- A more descriptive name would be `APPLY_OPS` or something.



Comment at: test/Sema/parentheses.c:23
+// non-nesting macros
+#define NON_NESTING_VOID_0(cond) ( (void)(cond) )
+#define NON_NESTING_VOID_1(op0, op1, x, y, z) ( (void)(x op0 y op1 z) )

This name is strange.  `VOID_CAST` would be more descriptive.



Comment at: test/Sema/parentheses.c:24
+#define NON_NESTING_VOID_0(cond) ( (void)(cond) )
+#define NON_NESTING_VOID_1(op0, op1, x, y, z) ( (void)(x op0 y op1 z) )
+

I suggest `APPLY_OPS_DIRECTLY`.



Comment at: test/Sema/parentheses.c:109-111
+  //===--
+  // Logical operator in macros
+  //===--

I'm not sure this comment is particularly useful.



Comment at: test/Sema/parentheses.c:114
+  NON_NESTING_VOID_0(i && i || i); // expected-warning {{'&&' within '||'}} \
+   // expected-note {{place parentheses around 
the '&&' expression to silence this warning}}
+  NON_NESTING_VOID_0((i && i) || i); // no warning.

Can you add fix-it CHECKs?



Comment at: test/Sema/parentheses.c:117-124
+  // NON_NESTING_VOID_1(&&, ||, i, i, i);
+  // will be expanded to:
+  // i && i || i
+  // ^ arg position 2 (i)
+  //^ arg position 0 (&&)
+  //  ^ arg position 3 (||) should not be checked becaues `op ||` and 
nothing from same arg position
+  // ^ arg position 1 (i)

I think this comment should be fairly well implied by the commit and commit 
message the test is part of.  I don't think it's necessary.



Comment at: test/Sema/parentheses.c:140
+  
+  // same as this one
+  NESTING_VOID_WRAPPER(&&, ||, i && i || i, i, i); // expected-warning {{'&&' 
within '||'}} \

Not a useful comment.



Comment at: test/Sema/parentheses.c:153
+  // ^ arg position 4 (i)
+  NON_NESTING_VOID_1(&&, ||, i, i && i || i, i); // expected-warning {{'&&' 
within '||'}} \
+ // expected-note {{place 
parentheses around the '&&' expression to silence this warning}}

I don't think checking within other macro arguments is necessary here.  You 
have a combinatorial explosion of tests, but it seems unlikely code would be 
written in such a way as to make this wrong.

I would like to see tests like the following:
```
NESTING_VOID_WRAPPER(&&, ||, i, i, i && i); // no warning.
NESTI

[libcxx] r334917 - Fix libcxx tests after clang r334677.

2018-06-17 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Sun Jun 17 12:58:45 2018
New Revision: 334917

URL: http://llvm.org/viewvc/llvm-project?rev=334917&view=rev
Log:
Fix libcxx tests after clang r334677.

Feature test macro versions may have a trailing L.

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

Modified: libcxx/trunk/utils/libcxx/test/config.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/test/config.py?rev=334917&r1=334916&r2=334917&view=diff
==
--- libcxx/trunk/utils/libcxx/test/config.py (original)
+++ libcxx/trunk/utils/libcxx/test/config.py Sun Jun 17 12:58:45 2018
@@ -50,6 +50,11 @@ def loadSiteConfig(lit_config, config, p
 ld_fn(config, site_cfg)
 lit_config.load_config = ld_fn
 
+# Extract the value of a numeric macro such as __cplusplus or a feature-test
+# macro.
+def intMacroValue(token):
+return int(token.rstrip('LlUu'))
+
 class Configuration(object):
 # pylint: disable=redefined-outer-name
 def __init__(self, lit_config, config):
@@ -464,7 +469,7 @@ class Configuration(object):
 self.config.available_features.add('libcpp-no-structured-bindings')
 
 if '__cpp_deduction_guides' not in macros or \
-int(macros['__cpp_deduction_guides']) < 201611:
+intMacroValue(macros['__cpp_deduction_guides']) < 201611:
 self.config.available_features.add('libcpp-no-deduction-guides')
 
 if self.is_windows:
@@ -1012,8 +1017,7 @@ class Configuration(object):
 '__cpp_coroutines is not defined')
 # Consider coroutines supported only when the feature test macro
 # reflects a recent value.
-val = macros['__cpp_coroutines'].replace('L', '')
-if int(val) >= 201703:
+if intMacroValue(macros['__cpp_coroutines']) >= 201703:
 self.config.available_features.add('fcoroutines-ts')
 
 def configure_modules(self):


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


Re: r334677 - P0096R5, P0941R2: Update to match latest feature test macro specification.

2018-06-17 Thread Richard Smith via cfe-commits
Fixed in r334917.

On 17 June 2018 at 02:51, Richard Smith  wrote:

> Looks like a bug / faulty assumption in the libc++ test suite. Should be
> easy to fix, but I'm not sure how pervasive the issue is. I'll take a look
> in the morning. If this is blocking anything in the mean time, feel free to
> revert this (or fix libc++ yourself).
>
>
> On Sun, 17 Jun 2018, 01:40 Vitaly Buka via cfe-commits, <
> cfe-commits@lists.llvm.org> wrote:
>
>> Hi Richard,
>> After this patch check-all fails for me with:
>>   llvm-project/libcxx/utils/libcxx/test/config.py", line 467, in
>> configure_features
>> int(macros['__cpp_deduction_guides']) < 201611:
>> ValueError: invalid literal for int() with base 10: '201703L'
>>
>> On Wed, Jun 13, 2018 at 5:44 PM Richard Smith via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: rsmith
>>> Date: Wed Jun 13 17:40:20 2018
>>> New Revision: 334677
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=334677&view=rev
>>> Log:
>>> P0096R5, P0941R2: Update to match latest feature test macro
>>> specification.
>>>
>>> Modified:
>>> cfe/trunk/lib/Frontend/InitPreprocessor.cpp
>>> cfe/trunk/test/Lexer/cxx-features.cpp
>>> cfe/trunk/www/cxx_status.html
>>>
>>> Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/
>>> Frontend/InitPreprocessor.cpp?rev=334677&r1=334676&r2=334677&view=diff
>>> 
>>> ==
>>> --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
>>> +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed Jun 13 17:40:20 2018
>>> @@ -487,82 +487,86 @@ static void InitializeCPlusPlusFeatureTe
>>>   MacroBuilder &Builder)
>>> {
>>>// C++98 features.
>>>if (LangOpts.RTTI)
>>> -Builder.defineMacro("__cpp_rtti", "199711");
>>> +Builder.defineMacro("__cpp_rtti", "199711L");
>>>if (LangOpts.CXXExceptions)
>>> -Builder.defineMacro("__cpp_exceptions", "199711");
>>> +Builder.defineMacro("__cpp_exceptions", "199711L");
>>>
>>>// C++11 features.
>>>if (LangOpts.CPlusPlus11) {
>>> -Builder.defineMacro("__cpp_unicode_characters", "200704");
>>> -Builder.defineMacro("__cpp_raw_strings", "200710");
>>> -Builder.defineMacro("__cpp_unicode_literals", "200710");
>>> -Builder.defineMacro("__cpp_user_defined_literals", "200809");
>>> -Builder.defineMacro("__cpp_lambdas", "200907");
>>> +Builder.defineMacro("__cpp_unicode_characters", "200704L");
>>> +Builder.defineMacro("__cpp_raw_strings", "200710L");
>>> +Builder.defineMacro("__cpp_unicode_literals", "200710L");
>>> +Builder.defineMacro("__cpp_user_defined_literals", "200809L");
>>> +Builder.defineMacro("__cpp_lambdas", "200907L");
>>>  Builder.defineMacro("__cpp_constexpr",
>>> -LangOpts.CPlusPlus17 ? "201603" :
>>> -LangOpts.CPlusPlus14 ? "201304" : "200704");
>>> +LangOpts.CPlusPlus17 ? "201603L" :
>>> +LangOpts.CPlusPlus14 ? "201304L" : "200704");
>>>  Builder.defineMacro("__cpp_range_based_for",
>>> -LangOpts.CPlusPlus17 ? "201603" : "200907");
>>> +LangOpts.CPlusPlus17 ? "201603L" : "200907");
>>>  Builder.defineMacro("__cpp_static_assert",
>>> -LangOpts.CPlusPlus17 ? "201411" : "200410");
>>> -Builder.defineMacro("__cpp_decltype", "200707");
>>> -Builder.defineMacro("__cpp_attributes", "200809");
>>> -Builder.defineMacro("__cpp_rvalue_references", "200610");
>>> -Builder.defineMacro("__cpp_variadic_templates", "200704");
>>> -Builder.defineMacro("__cpp_initializer_lists", "200806");
>>> -Builder.defineMacro("__cpp_delegating_constructors", "200604");
>>> -Builder.defineMacro("__cpp_nsdmi", "200809");
>>> -Builder.defineMacro("__cpp_inheriting_constructors", "201511");
>>> -Builder.defineMacro("__cpp_ref_qualifiers", "200710");
>>> -Builder.defineMacro("__cpp_alias_templates", "200704");
>>> +LangOpts.CPlusPlus17 ? "201411L" : "200410");
>>> +Builder.defineMacro("__cpp_decltype", "200707L");
>>> +Builder.defineMacro("__cpp_attributes", "200809L");
>>> +Builder.defineMacro("__cpp_rvalue_references", "200610L");
>>> +Builder.defineMacro("__cpp_variadic_templates", "200704L");
>>> +Builder.defineMacro("__cpp_initializer_lists", "200806L");
>>> +Builder.defineMacro("__cpp_delegating_constructors", "200604L");
>>> +Builder.defineMacro("__cpp_nsdmi", "200809L");
>>> +Builder.defineMacro("__cpp_inheriting_constructors", "201511L");
>>> +Builder.defineMacro("__cpp_ref_qualifiers", "200710L");
>>> +Builder.defineMacro("__cpp_alias_templates", "200704L");
>>>}
>>>if (LangOpts.ThreadsafeStatics)
>>> -Builder.defineMacro("__cpp_threadsafe_static_init", "200806");
>>> +Buil

[PATCH] D45616: [X86] Lower _mm[256|512]_cmp[.]_mask intrinsics to native llvm IR

2018-06-17 Thread Craig Topper via Phabricator via cfe-commits
craig.topper accepted this revision.
craig.topper added a comment.
This revision is now accepted and ready to land.

LGTM with that one comment.




Comment at: lib/CodeGen/CGBuiltin.cpp:10070
+
+assert(CC < 0x20 && "condition code should be validated by sema checking");
+

Sink this into the switch as the default case with an llvm_unreachable


https://reviews.llvm.org/D45616



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


[PATCH] D47687: [Sema] Missing -Wlogical-op-parentheses warnings in macros (PR18971)

2018-06-17 Thread Xing via Phabricator via cfe-commits
Higuoxing marked 9 inline comments as done.
Higuoxing added inline comments.



Comment at: test/Sema/parentheses.c:20
+#define NESTING_VOID(cond) ( (void)(cond) )
+#define NESTING_VOID_WRAPPER(op0, op1, x, y, z) ( (void)(x op0 y op1 z) )
+

dexonsmith wrote:
> - You haven't actually wrapped `NESTING_VOID` here.
> - A more descriptive name would be `APPLY_OPS` or something.
Yes, I made a crucial mistake! So, I make a little adjustment here, we will 
check parentheses for expressions, if and only if the operator and its LHS, RHS 
are from same arg position of a *non-nesting macro*, because it seems very 
difficult to distinguish a nesting macro's args are from same arg position of 
its `father` macro



Comment at: test/Sema/parentheses.c:109-111
+  //===--
+  // Logical operator in macros
+  //===--

dexonsmith wrote:
> I'm not sure this comment is particularly useful.
Yes, I delete them : )



Comment at: test/Sema/parentheses.c:114
+  NON_NESTING_VOID_0(i && i || i); // expected-warning {{'&&' within '||'}} \
+   // expected-note {{place parentheses around 
the '&&' expression to silence this warning}}
+  NON_NESTING_VOID_0((i && i) || i); // no warning.

dexonsmith wrote:
> Can you add fix-it CHECKs?
```
llvm/tools/clang/test/Sema/parentheses.c:109:15: note: place parentheses around 
the '&&' expression to silence this warning
  VOID_CAST(i && i || i); // expected-warning {{'&&' within '||'}} \
~~^~~~
llvm/tools/clang/test/Sema/parentheses.c:17:34: note: expanded from macro 
'VOID_CAST'
#define VOID_CAST(cond) ( (void)(cond) )
 ^~~~
```

Sorry, it seems that when deal with expressions in macros, there is no fix-it 
hint ...



Comment at: test/Sema/parentheses.c:117-124
+  // NON_NESTING_VOID_1(&&, ||, i, i, i);
+  // will be expanded to:
+  // i && i || i
+  // ^ arg position 2 (i)
+  //^ arg position 0 (&&)
+  //  ^ arg position 3 (||) should not be checked becaues `op ||` and 
nothing from same arg position
+  // ^ arg position 1 (i)

dexonsmith wrote:
> I think this comment should be fairly well implied by the commit and commit 
> message the test is part of.  I don't think it's necessary.
Yes, I delete them


https://reviews.llvm.org/D47687



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


[PATCH] D47687: [Sema] Missing -Wlogical-op-parentheses warnings in macros (PR18971)

2018-06-17 Thread Xing via Phabricator via cfe-commits
Higuoxing updated this revision to Diff 151654.
Higuoxing marked an inline comment as done.

https://reviews.llvm.org/D47687

Files:
  lib/Sema/SemaExpr.cpp
  test/Sema/parentheses.c


Index: test/Sema/parentheses.c
===
--- test/Sema/parentheses.c
+++ test/Sema/parentheses.c
@@ -14,6 +14,10 @@
   if ((i = 4)) {}
 }
 
+#define VOID_CAST(cond) ( (void)(cond) )
+#define APPLY_OPS(op0, op1, x, y, z) ( VOID_CAST(x op0 y op1 z) )
+#define APPLY_OPS_DIRECTLY(op0, op1, x, y, z) ( (void)(x op0 y op1 z) )
+
 void bitwise_rel(unsigned i) {
   (void)(i & 0x2 == 0); // expected-warning {{& has lower precedence than ==}} 
\
 // expected-note{{place parentheses around the '==' 
expression to silence this warning}} \
@@ -96,6 +100,13 @@
 
   (void)(i && i || 0); // no warning.
   (void)(0 || i && i); // no warning.
+
+  VOID_CAST(i && i || i);   // expected-warning {{'&&' within '||'}} \
+// expected-note {{place parentheses around the 
'&&' expression to silence this warning}}
+  VOID_CAST((i && i) || i); // no warning.
+
+  APPLY_OPS_DIRECTLY(&&, ||, i, i, i); // no warning.
+  APPLY_OPS(&&, ||, i, i, i);  // no warning.
 }
 
 _Bool someConditionFunc();
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -12233,6 +12233,35 @@
   }
 }
 
+/// Look for '&&' in the righ or left hand of a '||' expr
+static void DiagnoseLogicalAndInLogicalOr(Sema &Self, SourceLocation OpLoc,
+  Expr *LHSExpr, Expr *RHSExpr) {
+  SourceManager &SM = Self.getSourceManager();
+  if (!OpLoc.isMacroID()) {
+DiagnoseLogicalAndInLogicalOrLHS(Self, OpLoc, LHSExpr, RHSExpr);
+DiagnoseLogicalAndInLogicalOrRHS(Self, OpLoc, LHSExpr, RHSExpr);
+return;
+  } else {
+// Diagnose parentheses if and only if operator and its LHS, RHS
+// are from the same argument position of first level macros
+SourceLocation OpExpansionLoc;
+if (!SM.isMacroArgExpansion(OpLoc, &OpExpansionLoc) ||
+SM.getImmediateMacroCallerLoc(OpLoc).isMacroID())
+  return;
+
+SourceLocation ExprExpansionLoc;
+if (SM.isMacroArgExpansion(LHSExpr->getExprLoc(), &ExprExpansionLoc) &&
+!SM.getImmediateMacroCallerLoc(LHSExpr->getExprLoc()).isMacroID() &&
+OpExpansionLoc == ExprExpansionLoc)
+  DiagnoseLogicalAndInLogicalOrLHS(Self, OpLoc, LHSExpr, RHSExpr);
+
+if (SM.isMacroArgExpansion(RHSExpr->getExprLoc(), &ExprExpansionLoc) &&
+!SM.getImmediateMacroCallerLoc(LHSExpr->getExprLoc()).isMacroID() &&
+OpExpansionLoc == ExprExpansionLoc)
+  DiagnoseLogicalAndInLogicalOrRHS(Self, OpLoc, LHSExpr, RHSExpr);
+  }
+}
+
 /// Look for bitwise op in the left or right hand of a bitwise op with
 /// lower precedence and emit a diagnostic together with a fixit hint that 
wraps
 /// the '&' expression in parentheses.
@@ -12310,10 +12339,8 @@
 
   // Warn about arg1 || arg2 && arg3, as GCC 4.3+ does.
   // We don't warn for 'assert(a || b && "bad")' since this is safe.
-  if (Opc == BO_LOr && !OpLoc.isMacroID()/* Don't warn in macros. */) {
-DiagnoseLogicalAndInLogicalOrLHS(Self, OpLoc, LHSExpr, RHSExpr);
-DiagnoseLogicalAndInLogicalOrRHS(Self, OpLoc, LHSExpr, RHSExpr);
-  }
+  if (Opc == BO_LOr)
+DiagnoseLogicalAndInLogicalOr(Self, OpLoc, LHSExpr, RHSExpr);
 
   if ((Opc == BO_Shl && 
LHSExpr->getType()->isIntegralType(Self.getASTContext()))
   || Opc == BO_Shr) {


Index: test/Sema/parentheses.c
===
--- test/Sema/parentheses.c
+++ test/Sema/parentheses.c
@@ -14,6 +14,10 @@
   if ((i = 4)) {}
 }
 
+#define VOID_CAST(cond) ( (void)(cond) )
+#define APPLY_OPS(op0, op1, x, y, z) ( VOID_CAST(x op0 y op1 z) )
+#define APPLY_OPS_DIRECTLY(op0, op1, x, y, z) ( (void)(x op0 y op1 z) )
+
 void bitwise_rel(unsigned i) {
   (void)(i & 0x2 == 0); // expected-warning {{& has lower precedence than ==}} \
 // expected-note{{place parentheses around the '==' expression to silence this warning}} \
@@ -96,6 +100,13 @@
 
   (void)(i && i || 0); // no warning.
   (void)(0 || i && i); // no warning.
+
+  VOID_CAST(i && i || i);   // expected-warning {{'&&' within '||'}} \
+// expected-note {{place parentheses around the '&&' expression to silence this warning}}
+  VOID_CAST((i && i) || i); // no warning.
+
+  APPLY_OPS_DIRECTLY(&&, ||, i, i, i); // no warning.
+  APPLY_OPS(&&, ||, i, i, i);  // no warning.
 }
 
 _Bool someConditionFunc();
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -12233,6 +12233,35 @@
   }
 }
 
+/// Look for '&&' in the righ or left hand of a '||' expr
+static void DiagnoseLogicalAndInLogicalOr(Sema &Self, SourceLocation 

[PATCH] D47687: [Sema] Missing -Wlogical-op-parentheses warnings in macros (PR18971)

2018-06-17 Thread Xing via Phabricator via cfe-commits
Higuoxing added inline comments.



Comment at: test/Sema/parentheses.c:114
+  NON_NESTING_VOID_0(i && i || i); // expected-warning {{'&&' within '||'}} \
+   // expected-note {{place parentheses around 
the '&&' expression to silence this warning}}
+  NON_NESTING_VOID_0((i && i) || i); // no warning.

Higuoxing wrote:
> dexonsmith wrote:
> > Can you add fix-it CHECKs?
> ```
> llvm/tools/clang/test/Sema/parentheses.c:109:15: note: place parentheses 
> around the '&&' expression to silence this warning
>   VOID_CAST(i && i || i); // expected-warning {{'&&' within '||'}} \
> ~~^~~~
> llvm/tools/clang/test/Sema/parentheses.c:17:34: note: expanded from macro 
> 'VOID_CAST'
> #define VOID_CAST(cond) ( (void)(cond) )
>  ^~~~
> ```
> 
> Sorry, it seems that when deal with expressions in macros, there is no fix-it 
> hint ...
The `suggestParentheses` suppress the fix-it hint when the expression is in 
macros

```
  if (ParenRange.getBegin().isFileID() && ParenRange.getEnd().isFileID() &&
  EndLoc.isValid()) {
Self.Diag(Loc, Note)
  << FixItHint::CreateInsertion(ParenRange.getBegin(), "(")
  << FixItHint::CreateInsertion(EndLoc, ")");
  } else {
// We can't display the parentheses, so just show the bare note.
Self.Diag(Loc, Note) << ParenRange;
  }
```

You see, there is a `isFileID()`


https://reviews.llvm.org/D47687



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


[PATCH] D48266: [Driver] Add -fno-digraphs

2018-06-17 Thread Jacob Bandes-Storch via Phabricator via cfe-commits
jtbandes created this revision.

Add a flag `-fno-digraphs` to disable digraphs in the lexer, similar to 
`-fno-operator-names` which disables alternative names for C++ operators.


Repository:
  rC Clang

https://reviews.llvm.org/D48266

Files:
  include/clang/Driver/Options.td
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/Lexer/digraph.c


Index: test/Lexer/digraph.c
===
--- test/Lexer/digraph.c
+++ test/Lexer/digraph.c
@@ -1,6 +1,9 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -ffreestanding %s
-// expected-no-diagnostics
+// RUN: %clang_cc1 -DDIGRAPHS -fsyntax-only -verify -ffreestanding %s
+// RUN: %clang_cc1 -fno-digraphs -fsyntax-only -verify -ffreestanding %s
+
+#if DIGRAPHS
 
+// expected-no-diagnostics
 %:include 
 
 %:ifndef BUFSIZE
@@ -14,3 +17,15 @@
 d<:len:> = s<:len:>;
 %>
 %>
+#else
+
+// expected-error@+1 {{expected identifier or '('}}
+%:include 
+;
+// expected-error@+1 {{expected ')'}} expected-note@+1{{to match this '('}}
+void copy(char d<::>);
+
+// expected-error@+1 {{expected function body}}
+void copy() <% %>
+
+#endif
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2174,6 +2174,9 @@
   Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords,
   Opts.GNUKeywords);
 
+  if (Args.hasArg(OPT_fno_digraphs))
+Opts.Digraphs = 0;
+
   if (Args.hasArg(OPT_fno_operator_names))
 Opts.CXXOperatorNames = 0;
 
Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -3970,6 +3970,7 @@
   // Forward -f (flag) options which we can pass directly.
   Args.AddLastArg(CmdArgs, options::OPT_femit_all_decls);
   Args.AddLastArg(CmdArgs, options::OPT_fheinous_gnu_extensions);
+  Args.AddLastArg(CmdArgs, options::OPT_fno_digraphs);
   Args.AddLastArg(CmdArgs, options::OPT_fno_operator_names);
   Args.AddLastArg(CmdArgs, options::OPT_femulated_tls,
   options::OPT_fno_emulated_tls);
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1334,6 +1334,8 @@
 def fno_diagnostics_show_option : Flag<["-"], "fno-diagnostics-show-option">, 
Group;
 def fno_diagnostics_show_note_include_stack : Flag<["-"], 
"fno-diagnostics-show-note-include-stack">,
 Flags<[CC1Option]>, Group;
+def fno_digraphs : Flag<["-"], "fno-digraphs">, Group, 
Flags<[CC1Option]>,
+  HelpText<"Disallow alternative token representations '<:', ':>', '<%', '%>', 
'%:'">;
 def fno_declspec : Flag<["-"], "fno-declspec">, Group,
   HelpText<"Disallow __declspec as a keyword">, Flags<[CC1Option]>;
 def fno_dollars_in_identifiers : Flag<["-"], "fno-dollars-in-identifiers">, 
Group,


Index: test/Lexer/digraph.c
===
--- test/Lexer/digraph.c
+++ test/Lexer/digraph.c
@@ -1,6 +1,9 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -ffreestanding %s
-// expected-no-diagnostics
+// RUN: %clang_cc1 -DDIGRAPHS -fsyntax-only -verify -ffreestanding %s
+// RUN: %clang_cc1 -fno-digraphs -fsyntax-only -verify -ffreestanding %s
+
+#if DIGRAPHS
 
+// expected-no-diagnostics
 %:include 
 
 %:ifndef BUFSIZE
@@ -14,3 +17,15 @@
 d<:len:> = s<:len:>;
 %>
 %>
+#else
+
+// expected-error@+1 {{expected identifier or '('}}
+%:include 
+;
+// expected-error@+1 {{expected ')'}} expected-note@+1{{to match this '('}}
+void copy(char d<::>);
+
+// expected-error@+1 {{expected function body}}
+void copy() <% %>
+
+#endif
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2174,6 +2174,9 @@
   Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords,
   Opts.GNUKeywords);
 
+  if (Args.hasArg(OPT_fno_digraphs))
+Opts.Digraphs = 0;
+
   if (Args.hasArg(OPT_fno_operator_names))
 Opts.CXXOperatorNames = 0;
 
Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -3970,6 +3970,7 @@
   // Forward -f (flag) options which we can pass directly.
   Args.AddLastArg(CmdArgs, options::OPT_femit_all_decls);
   Args.AddLastArg(CmdArgs, options::OPT_fheinous_gnu_extensions);
+  Args.AddLastArg(CmdArgs, options::OPT_fno_digraphs);
   Args.AddLastArg(CmdArgs, options::OPT_fno_operator_names);
   Args.AddLastArg(CmdArgs, options::OPT_femulated_tls,
   options::OPT_fno_emulated_tls);
Index:

[PATCH] D48259: [clang-format] Fix bug with UT_Always when there is less than one full tab

2018-06-17 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added inline comments.



Comment at: lib/Format/WhitespaceManager.cpp:678
 // Indent with tabs only when there's at least one full tab.
-if (FirstTabWidth + Style.TabWidth <= Spaces) {
+if (Style.TabWidth <= Spaces) {
   Spaces -= FirstTabWidth;

Why is this not just if (FirstTabWidth <= Spaces) then?



Comment at: unittests/Format/FormatTest.cpp:9372
+  FormatStyle::UseTabStyle OldTabStyle = Alignment.UseTab;
+  unsigned OldTabWidth = Alignment.TabWidth;
+  Alignment.UseTab = FormatStyle::UT_Always;

Instead of doing the save/restore dance, just put it at the end of a test or 
create a new test (or alternatively create a new style as copy and then change 
the settings on that).


Repository:
  rC Clang

https://reviews.llvm.org/D48259



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


[PATCH] D48266: [Driver] Add -fno-digraphs

2018-06-17 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: include/clang/Driver/Options.td:1337-1338
 Flags<[CC1Option]>, Group;
+def fno_digraphs : Flag<["-"], "fno-digraphs">, Group, 
Flags<[CC1Option]>,
+  HelpText<"Disallow alternative token representations '<:', ':>', '<%', '%>', 
'%:'">;
 def fno_declspec : Flag<["-"], "fno-declspec">, Group,

In the driver, we generally want a `-ffoo` option matching `-fno-foo`. That is, 
the driver (but not `-cc1`) should support a matching `-fdigraphs` option to 
undo the effect of `-fno-digraphs`, unless there's a good reason not to do so.


Repository:
  rC Clang

https://reviews.llvm.org/D48266



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


[libcxxabi] r334924 - Fix libcxx tests after clang r334677.

2018-06-17 Thread Vitaly Buka via cfe-commits
Author: vitalybuka
Date: Sun Jun 17 23:24:29 2018
New Revision: 334924

URL: http://llvm.org/viewvc/llvm-project?rev=334924&view=rev
Log:
Fix libcxx tests after clang r334677.

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

Modified: libcxxabi/trunk/test/libcxxabi/test/config.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/libcxxabi/test/config.py?rev=334924&r1=334923&r2=334924&view=diff
==
--- libcxxabi/trunk/test/libcxxabi/test/config.py (original)
+++ libcxxabi/trunk/test/libcxxabi/test/config.py Sun Jun 17 23:24:29 2018
@@ -10,6 +10,7 @@ import os
 import sys
 
 from libcxx.test.config import Configuration as LibcxxConfiguration
+from libcxx.test.config import intMacroValue
 
 
 class Configuration(LibcxxConfiguration):
@@ -34,7 +35,7 @@ class Configuration(LibcxxConfiguration)
 super(Configuration, self).configure_obj_root()
 
 def has_cpp_feature(self, feature, required_value):
-return int(self.cxx.dumpMacros().get('__cpp_' + feature, 0)) >= 
required_value
+return intMacroValue(self.cxx.dumpMacros().get('__cpp_' + feature, 0)) 
>= required_value
 
 def configure_features(self):
 super(Configuration, self).configure_features()


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


Re: r334677 - P0096R5, P0941R2: Update to match latest feature test macro specification.

2018-06-17 Thread Vitaly Buka via cfe-commits
Thanks!
also r334924

On Sun, Jun 17, 2018 at 1:03 PM Richard Smith  wrote:

> Fixed in r334917.
>
> On 17 June 2018 at 02:51, Richard Smith  wrote:
>
>> Looks like a bug / faulty assumption in the libc++ test suite. Should be
>> easy to fix, but I'm not sure how pervasive the issue is. I'll take a look
>> in the morning. If this is blocking anything in the mean time, feel free to
>> revert this (or fix libc++ yourself).
>>
>>
>> On Sun, 17 Jun 2018, 01:40 Vitaly Buka via cfe-commits, <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Hi Richard,
>>> After this patch check-all fails for me with:
>>>   llvm-project/libcxx/utils/libcxx/test/config.py", line 467, in
>>> configure_features
>>> int(macros['__cpp_deduction_guides']) < 201611:
>>> ValueError: invalid literal for int() with base 10: '201703L'
>>>
>>> On Wed, Jun 13, 2018 at 5:44 PM Richard Smith via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 Author: rsmith
 Date: Wed Jun 13 17:40:20 2018
 New Revision: 334677

 URL: http://llvm.org/viewvc/llvm-project?rev=334677&view=rev
 Log:
 P0096R5, P0941R2: Update to match latest feature test macro
 specification.

 Modified:
 cfe/trunk/lib/Frontend/InitPreprocessor.cpp
 cfe/trunk/test/Lexer/cxx-features.cpp
 cfe/trunk/www/cxx_status.html

 Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=334677&r1=334676&r2=334677&view=diff

 ==
 --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
 +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed Jun 13 17:40:20 2018
 @@ -487,82 +487,86 @@ static void InitializeCPlusPlusFeatureTe
   MacroBuilder
 &Builder) {
// C++98 features.
if (LangOpts.RTTI)
 -Builder.defineMacro("__cpp_rtti", "199711");
 +Builder.defineMacro("__cpp_rtti", "199711L");
if (LangOpts.CXXExceptions)
 -Builder.defineMacro("__cpp_exceptions", "199711");
 +Builder.defineMacro("__cpp_exceptions", "199711L");

// C++11 features.
if (LangOpts.CPlusPlus11) {
 -Builder.defineMacro("__cpp_unicode_characters", "200704");
 -Builder.defineMacro("__cpp_raw_strings", "200710");
 -Builder.defineMacro("__cpp_unicode_literals", "200710");
 -Builder.defineMacro("__cpp_user_defined_literals", "200809");
 -Builder.defineMacro("__cpp_lambdas", "200907");
 +Builder.defineMacro("__cpp_unicode_characters", "200704L");
 +Builder.defineMacro("__cpp_raw_strings", "200710L");
 +Builder.defineMacro("__cpp_unicode_literals", "200710L");
 +Builder.defineMacro("__cpp_user_defined_literals", "200809L");
 +Builder.defineMacro("__cpp_lambdas", "200907L");
  Builder.defineMacro("__cpp_constexpr",
 -LangOpts.CPlusPlus17 ? "201603" :
 -LangOpts.CPlusPlus14 ? "201304" : "200704");
 +LangOpts.CPlusPlus17 ? "201603L" :
 +LangOpts.CPlusPlus14 ? "201304L" : "200704");
  Builder.defineMacro("__cpp_range_based_for",
 -LangOpts.CPlusPlus17 ? "201603" : "200907");
 +LangOpts.CPlusPlus17 ? "201603L" : "200907");
  Builder.defineMacro("__cpp_static_assert",
 -LangOpts.CPlusPlus17 ? "201411" : "200410");
 -Builder.defineMacro("__cpp_decltype", "200707");
 -Builder.defineMacro("__cpp_attributes", "200809");
 -Builder.defineMacro("__cpp_rvalue_references", "200610");
 -Builder.defineMacro("__cpp_variadic_templates", "200704");
 -Builder.defineMacro("__cpp_initializer_lists", "200806");
 -Builder.defineMacro("__cpp_delegating_constructors", "200604");
 -Builder.defineMacro("__cpp_nsdmi", "200809");
 -Builder.defineMacro("__cpp_inheriting_constructors", "201511");
 -Builder.defineMacro("__cpp_ref_qualifiers", "200710");
 -Builder.defineMacro("__cpp_alias_templates", "200704");
 +LangOpts.CPlusPlus17 ? "201411L" : "200410");
 +Builder.defineMacro("__cpp_decltype", "200707L");
 +Builder.defineMacro("__cpp_attributes", "200809L");
 +Builder.defineMacro("__cpp_rvalue_references", "200610L");
 +Builder.defineMacro("__cpp_variadic_templates", "200704L");
 +Builder.defineMacro("__cpp_initializer_lists", "200806L");
 +Builder.defineMacro("__cpp_delegating_constructors", "200604L");
 +Builder.defineMacro("__cpp_nsdmi", "200809L");
 +Builder.defineMacro("__cpp_inheriting_constructors", "201511L");
 +Builder.defineMacro("__cpp_ref_qualifiers", "200710L");
 +Builder.defineM

[PATCH] D48211: [clangd] Do not show namespace comments.

2018-06-17 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.



Comment at: clangd/CodeCompletionStrings.cpp:172
   // get this declaration, so we don't show documentation in that case.
   if (Result.Kind != CodeCompletionResult::RK_Declaration)
 return "";

while here, should this be if (Result.Declaration)? I make this mistake a lot...



Comment at: clangd/CodeCompletionStrings.cpp:177
 return "";
+  if (llvm::isa(Decl)) {
+// Namespaces often have too many redecls for any particular redecl comment

nit: canRequestComment looks a little expensive, hoist above that?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D48211



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


[libcxxabi] r334926 - Fix libcxxabi tests after clang r334924

2018-06-17 Thread Vitaly Buka via cfe-commits
Author: vitalybuka
Date: Sun Jun 17 23:43:55 2018
New Revision: 334926

URL: http://llvm.org/viewvc/llvm-project?rev=334926&view=rev
Log:
Fix libcxxabi tests after clang r334924

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

Modified: libcxxabi/trunk/test/libcxxabi/test/config.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/libcxxabi/test/config.py?rev=334926&r1=334925&r2=334926&view=diff
==
--- libcxxabi/trunk/test/libcxxabi/test/config.py (original)
+++ libcxxabi/trunk/test/libcxxabi/test/config.py Sun Jun 17 23:43:55 2018
@@ -35,7 +35,7 @@ class Configuration(LibcxxConfiguration)
 super(Configuration, self).configure_obj_root()
 
 def has_cpp_feature(self, feature, required_value):
-return intMacroValue(self.cxx.dumpMacros().get('__cpp_' + feature, 0)) 
>= required_value
+return intMacroValue(self.cxx.dumpMacros().get('__cpp_' + feature, 
'0')) >= required_value
 
 def configure_features(self):
 super(Configuration, self).configure_features()


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