This revision was automatically updated to reflect the committed changes. Closed by commit rC320755: Don't trigger -Wuser-defined-literals for system headers (authored by dim, committed by ).
Changed prior to commit: https://reviews.llvm.org/D41080?vs=126436&id=127029#toc Repository: rC Clang https://reviews.llvm.org/D41080 Files: lib/Sema/SemaDeclCXX.cpp test/SemaCXX/no-warn-user-defined-literals-in-system-headers.cpp test/SemaCXX/no-warn-user-defined-literals-in-system-headers.h Index: lib/Sema/SemaDeclCXX.cpp =================================================================== --- lib/Sema/SemaDeclCXX.cpp +++ lib/Sema/SemaDeclCXX.cpp @@ -13076,7 +13076,8 @@ StringRef LiteralName = FnDecl->getDeclName().getCXXLiteralIdentifier()->getName(); - if (LiteralName[0] != '_') { + if (LiteralName[0] != '_' && + !getSourceManager().isInSystemHeader(FnDecl->getLocation())) { // C++11 [usrlit.suffix]p1: // Literal suffix identifiers that do not start with an underscore // are reserved for future standardization. Index: test/SemaCXX/no-warn-user-defined-literals-in-system-headers.h =================================================================== --- test/SemaCXX/no-warn-user-defined-literals-in-system-headers.h +++ test/SemaCXX/no-warn-user-defined-literals-in-system-headers.h @@ -0,0 +1,2 @@ +// Header for no-warn-user-defined-literals-in-system-headers.cpp +void operator "" foo (const char *); Index: test/SemaCXX/no-warn-user-defined-literals-in-system-headers.cpp =================================================================== --- test/SemaCXX/no-warn-user-defined-literals-in-system-headers.cpp +++ test/SemaCXX/no-warn-user-defined-literals-in-system-headers.cpp @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -Wsystem-headers -isystem %S %s + +#include <no-warn-user-defined-literals-in-system-headers.h> + +void operator "" bar(long double); // expected-warning{{user-defined literal suffixes not starting with '_' are reserved}}
Index: lib/Sema/SemaDeclCXX.cpp =================================================================== --- lib/Sema/SemaDeclCXX.cpp +++ lib/Sema/SemaDeclCXX.cpp @@ -13076,7 +13076,8 @@ StringRef LiteralName = FnDecl->getDeclName().getCXXLiteralIdentifier()->getName(); - if (LiteralName[0] != '_') { + if (LiteralName[0] != '_' && + !getSourceManager().isInSystemHeader(FnDecl->getLocation())) { // C++11 [usrlit.suffix]p1: // Literal suffix identifiers that do not start with an underscore // are reserved for future standardization. Index: test/SemaCXX/no-warn-user-defined-literals-in-system-headers.h =================================================================== --- test/SemaCXX/no-warn-user-defined-literals-in-system-headers.h +++ test/SemaCXX/no-warn-user-defined-literals-in-system-headers.h @@ -0,0 +1,2 @@ +// Header for no-warn-user-defined-literals-in-system-headers.cpp +void operator "" foo (const char *); Index: test/SemaCXX/no-warn-user-defined-literals-in-system-headers.cpp =================================================================== --- test/SemaCXX/no-warn-user-defined-literals-in-system-headers.cpp +++ test/SemaCXX/no-warn-user-defined-literals-in-system-headers.cpp @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -Wsystem-headers -isystem %S %s + +#include <no-warn-user-defined-literals-in-system-headers.h> + +void operator "" bar(long double); // expected-warning{{user-defined literal suffixes not starting with '_' are reserved}}
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits