<div dir="ltr">I added -P to remove the line markers which were introducing the colons.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 21, 2019 at 2:58 PM Galina Kistanova via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello Richard,<br><br>This commit added broken test to the builder:<br><a href="http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/26522" target="_blank">http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/26522</a><br>. . .<br>Failing Tests (2):<br>    Clang :: Preprocessor/has_attribute.cpp<br>     . . .<br><br>Please have a look?<br>The builder was already red and did not send notifications.<br><br>Thanks<br><br>Galina</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 21, 2019 at 1:20 PM Richard Smith via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: rsmith<br>
Date: Fri Jun 21 13:20:21 2019<br>
New Revision: 364102<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=364102&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=364102&view=rev</a><br>
Log:<br>
Fix __has_cpp_attribute expansion to produce trailing L and (where<br>
necessary) leading whitespace.<br>
<br>
Simplify unit test and extend to cover no_unique_address attribute.<br>
<br>
Modified:<br>
    cfe/trunk/lib/Lex/PPMacroExpansion.cpp<br>
    cfe/trunk/test/Preprocessor/has_attribute.cpp<br>
<br>
Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=364102&r1=364101&r2=364102&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=364102&r1=364101&r2=364102&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)<br>
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Fri Jun 21 13:20:21 2019<br>
@@ -1330,9 +1330,13 @@ already_lexed:<br>
<br>
         // The last ')' has been reached; return the value if one found or<br>
         // a diagnostic and a dummy value.<br>
-        if (Result.hasValue())<br>
+        if (Result.hasValue()) {<br>
           OS << Result.getValue();<br>
-        else {<br>
+          // For strict conformance to __has_cpp_attribute rules, use 'L'<br>
+          // suffix for dated literals.<br>
+          if (Result.getValue() > 1)<br>
+            OS << 'L';<br>
+        } else {<br>
           OS << 0;<br>
           if (!SuppressDiagnostic)<br>
             PP.Diag(Tok.getLocation(), diag::err_too_few_args_in_macro_invoc);<br>
@@ -1454,6 +1458,8 @@ void Preprocessor::ExpandBuiltinMacro(To<br>
   // Set up the return result.<br>
   Tok.setIdentifierInfo(nullptr);<br>
   Tok.clearFlag(Token::NeedsCleaning);<br>
+  bool IsAtStartOfLine = Tok.isAtStartOfLine();<br>
+  bool HasLeadingSpace = Tok.hasLeadingSpace();<br>
<br>
   if (II == Ident__LINE__) {<br>
     // C99 6.10.8: "__LINE__: The presumed line number (within the current<br>
@@ -1807,6 +1813,8 @@ void Preprocessor::ExpandBuiltinMacro(To<br>
     llvm_unreachable("Unknown identifier!");<br>
   }<br>
   CreateString(OS.str(), Tok, Tok.getLocation(), Tok.getLocation());<br>
+  Tok.setFlagValue(Token::StartOfLine, IsAtStartOfLine);<br>
+  Tok.setFlagValue(Token::LeadingSpace, HasLeadingSpace);<br>
 }<br>
<br>
 void Preprocessor::markMacroAsUsed(MacroInfo *MI) {<br>
<br>
Modified: cfe/trunk/test/Preprocessor/has_attribute.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/has_attribute.cpp?rev=364102&r1=364101&r2=364102&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/has_attribute.cpp?rev=364102&r1=364101&r2=364102&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Preprocessor/has_attribute.cpp (original)<br>
+++ cfe/trunk/test/Preprocessor/has_attribute.cpp Fri Jun 21 13:20:21 2019<br>
@@ -1,98 +1,80 @@<br>
-// RUN: %clang_cc1 -triple i386-unknown-unknown -fms-compatibility -std=c++11 -E %s -o - | FileCheck %s<br>
+// RUN: %clang_cc1 -triple i386-unknown-unknown -fms-compatibility -std=c++11 -E %s -o - | FileCheck %s --check-prefixes=CHECK,ITANIUM --implicit-check-not=:<br>
+// RUN: %clang_cc1 -triple i386-windows -fms-compatibility -std=c++11 -E %s -o - | FileCheck %s --check-prefixes=CHECK,WINDOWS --implicit-check-not=:<br>
<br>
-// CHECK: has_cxx11_carries_dep<br>
-#if __has_cpp_attribute(carries_dependency)<br>
-  int has_cxx11_carries_dep();<br>
-#endif<br>
-<br>
-// CHECK: has_clang_fallthrough_1<br>
-#if __has_cpp_attribute(clang::fallthrough)<br>
-  int has_clang_fallthrough_1();<br>
-#endif<br>
-<br>
-// CHECK: does_not_have_selectany<br>
-#if !__has_cpp_attribute(selectany)<br>
-  int does_not_have_selectany();<br>
-#endif<br>
+#define CXX11(x) x: __has_cpp_attribute(x)<br>
+<br>
+// CHECK: clang::fallthrough: 201603L<br>
+CXX11(clang::fallthrough)<br>
+<br>
+// CHECK: selectany: 0<br>
+CXX11(selectany)<br>
<br>
 // The attribute name can be bracketed with double underscores.<br>
-// CHECK: has_clang_fallthrough_2<br>
-#if __has_cpp_attribute(clang::__fallthrough__)<br>
-  int has_clang_fallthrough_2();<br>
-#endif<br>
+// CHECK: clang::__fallthrough__: 201603L<br>
+CXX11(clang::__fallthrough__)<br>
<br>
 // The scope cannot be bracketed with double underscores unless it is<br>
 // for gnu or clang.<br>
-// CHECK: does_not_have___gsl___suppress<br>
-#if !__has_cpp_attribute(__gsl__::suppress)<br>
-  int does_not_have___gsl___suppress();<br>
-#endif<br>
+// CHECK: __gsl__::suppress: 0<br>
+CXX11(__gsl__::suppress)<br>
<br>
 // We do somewhat support the __clang__ vendor namespace, but it is a<br>
 // predefined macro and thus we encourage users to use _Clang instead.<br>
 // Because of this, we do not support __has_cpp_attribute for that<br>
 // vendor namespace.<br>
-// CHECK: does_not_have___clang___fallthrough<br>
-#if !__has_cpp_attribute(__clang__::fallthrough)<br>
-  int does_not_have___clang___fallthrough();<br>
-#endif<br>
-<br>
-// CHECK: does_have_Clang_fallthrough<br>
-#if __has_cpp_attribute(_Clang::fallthrough)<br>
-  int does_have_Clang_fallthrough();<br>
-#endif<br>
-<br>
-// CHECK: has_gnu_const<br>
-#if __has_cpp_attribute(__gnu__::__const__)<br>
-  int has_gnu_const();<br>
-#endif<br>
-<br>
-// Test that C++11, target-specific attributes behave properly.<br>
-<br>
-// CHECK: does_not_have_mips16<br>
-#if !__has_cpp_attribute(gnu::mips16)<br>
-  int does_not_have_mips16();<br>
-#endif<br>
-<br>
-// Test that the version numbers of attributes listed in SD-6 are supported<br>
-// correctly.<br>
-<br>
-// CHECK: has_cxx11_carries_dep_vers<br>
-#if __has_cpp_attribute(carries_dependency) == 200809<br>
-  int has_cxx11_carries_dep_vers();<br>
-#endif<br>
-<br>
-// CHECK: has_cxx11_noreturn_vers<br>
-#if __has_cpp_attribute(noreturn) == 200809<br>
-  int has_cxx11_noreturn_vers();<br>
-#endif<br>
-<br>
-// CHECK: has_cxx14_deprecated_vers<br>
-#if __has_cpp_attribute(deprecated) == 201309<br>
-  int has_cxx14_deprecated_vers();<br>
-#endif<br>
-<br>
-// CHECK: has_cxx1z_nodiscard<br>
-#if __has_cpp_attribute(nodiscard) == 201603<br>
-  int has_cxx1z_nodiscard();<br>
-#endif<br>
-<br>
-// CHECK: has_cxx1z_fallthrough<br>
-#if __has_cpp_attribute(fallthrough) == 201603<br>
-  int has_cxx1z_fallthrough();<br>
-#endif<br>
-<br>
-// CHECK: has_declspec_uuid<br>
-#if __has_declspec_attribute(uuid)<br>
-  int has_declspec_uuid();<br>
-#endif<br>
-<br>
-// CHECK: has_declspec_uuid2<br>
-#if __has_declspec_attribute(__uuid__)<br>
-  int has_declspec_uuid2();<br>
-#endif<br>
-<br>
-// CHECK: does_not_have_declspec_fallthrough<br>
-#if !__has_declspec_attribute(fallthrough)<br>
-  int does_not_have_declspec_fallthrough();<br>
-#endif<br>
+//<br>
+// Note, we can't use CXX11 here because it will expand __clang__ to 1<br>
+// too early.<br>
+// CHECK: 1::fallthrough: 0<br>
+__clang__::fallthrough: __has_cpp_attribute(__clang__::fallthrough)<br>
+<br>
+// CHECK: _Clang::fallthrough: 201603L<br>
+CXX11(_Clang::fallthrough)<br>
+<br>
+// CHECK: __gnu__::__const__: 1<br>
+CXX11(__gnu__::__const__)<br>
+<br>
+// Test that C++11, target-specific attributes behave properly.<br>
+<br>
+// CHECK: gnu::mips16: 0<br>
+CXX11(gnu::mips16)<br>
+<br>
+// Test for standard attributes as listed in C++2a [cpp.cond] paragraph 6.<br>
+<br>
+CXX11(assert)<br>
+CXX11(carries_dependency)<br>
+CXX11(deprecated)<br>
+CXX11(ensures)<br>
+CXX11(expects)<br>
+CXX11(fallthrough)<br>
+CXX11(likely)<br>
+CXX11(maybe_unused)<br>
+CXX11(no_unique_address)<br>
+CXX11(nodiscard)<br>
+CXX11(noreturn)<br>
+CXX11(unlikely)<br>
+// FIXME(201806L) CHECK: assert: 0<br>
+// CHECK: carries_dependency: 200809L<br>
+// CHECK: deprecated: 201309L<br>
+// FIXME(201806L) CHECK: ensures: 0<br>
+// FIXME(201806L) CHECK: expects: 0<br>
+// CHECK: fallthrough: 201603L<br>
+// FIXME(201803L) CHECK: likely: 0<br>
+// CHECK: maybe_unused: 201603L<br>
+// ITANIUM: no_unique_address: 201803L<br>
+// WINDOWS: no_unique_address: 0<br>
+// CHECK: nodiscard: 201603L<br>
+// CHECK: noreturn: 200809L<br>
+// FIXME(201803L) CHECK: unlikely: 0<br>
+<br>
+// Test for Microsoft __declspec attributes<br>
+<br>
+#define DECLSPEC(x) x: __has_declspec_attribute(x)<br>
+<br>
+// CHECK: uuid: 1<br>
+// CHECK: __uuid__: 1<br>
+DECLSPEC(uuid)<br>
+DECLSPEC(__uuid__)<br>
+<br>
+// CHECK: fallthrough: 0<br>
+DECLSPEC(fallthrough)<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div>