Skip to content

Commit 9f67174

Browse files
author
Georgios Rokos
committed
Merge from '"main"' to '"sycl-web"' (9 commits)
CONFLICT (content): Merge conflict in clang/test/SemaSYCL/int128.cpp CONFLICT (content): Merge conflict in clang/test/SemaSYCL/float128.cpp
2 parents 23223a1 + 3dbcea8 commit 9f67174

File tree

2,571 files changed

+166433
-325718
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,571 files changed

+166433
-325718
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
<compnerd@compnerd.org> <abdulras@fb.com>
2626
<compnerd@compnerd.org> <abdulras@google.com>
27+
<hans@hanshq.net> <hans@chromium.org>
2728
<i@maskray.me> <maskray@google.com>
2829
<JCTremoulet@gmail.com> <jotrem@microsoft.com>
2930
<qiucofan@cn.ibm.com> <qiucf@cn.ibm.com>

clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ AST_MATCHER(Decl, isFromStdNamespaceOrSystemHeader) {
2424
if (const auto *D = Node.getDeclContext()->getEnclosingNamespaceContext())
2525
if (D->isStdNamespace())
2626
return true;
27+
if (Node.getLocation().isInvalid())
28+
return false;
2729
return Node.getASTContext().getSourceManager().isInSystemHeader(
2830
Node.getLocation());
2931
}

clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ class CppCoreGuidelinesModule : public ClangTidyModule {
106106
Opts["cppcoreguidelines-non-private-member-variables-in-classes."
107107
"IgnoreClassesWithAllMemberVariablesBeingPublic"] = "true";
108108

109-
Opts["cppcoreguidelines-explicit-virtual-functions."
110-
"IgnoreDestructors"] = "true";
111-
112109
return Options;
113110
}
114111
};

clang-tools-extra/clangd/FindTarget.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,8 @@ struct TargetFinder {
507507
// DeclRefExpr).
508508
if (Arg.getKind() == TemplateArgument::Template ||
509509
Arg.getKind() == TemplateArgument::TemplateExpansion) {
510-
if (TemplateDecl *TD = Arg.getAsTemplate().getAsTemplateDecl()) {
510+
if (TemplateDecl *TD =
511+
Arg.getAsTemplateOrTemplatePattern().getAsTemplateDecl()) {
511512
report(TD, Flags);
512513
}
513514
}

clang-tools-extra/clangd/IncludeCleaner.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,15 @@ struct ReferencedFiles {
121121
if (!Macros.insert(FID).second)
122122
return;
123123
const auto &Exp = SM.getSLocEntry(FID).getExpansion();
124-
add(Exp.getSpellingLoc());
125-
add(Exp.getExpansionLocStart());
126-
add(Exp.getExpansionLocEnd());
124+
// For token pasting operator in macros, spelling and expansion locations
125+
// can be within a temporary buffer that Clang creates (scratch space or
126+
// ScratchBuffer). That is not a real file we can include.
127+
if (!SM.isWrittenInScratchSpace(Exp.getSpellingLoc()))
128+
add(Exp.getSpellingLoc());
129+
if (!SM.isWrittenInScratchSpace(Exp.getExpansionLocStart()))
130+
add(Exp.getExpansionLocStart());
131+
if (!SM.isWrittenInScratchSpace(Exp.getExpansionLocEnd()))
132+
add(Exp.getExpansionLocEnd());
127133
}
128134
};
129135

clang-tools-extra/clangd/unittests/FindTargetTests.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,15 @@ TEST_F(TargetDeclTest, Types) {
341341
EXPECT_DECLS("TemplateSpecializationTypeLoc", "template <typename> class T");
342342
Flags.clear();
343343

344+
Code = R"cpp(
345+
template<template<typename> class ...T>
346+
class C {
347+
C<[[T...]]> foo;
348+
};
349+
)cpp";
350+
EXPECT_DECLS("TemplateArgumentLoc", {"template <typename> class ...T"});
351+
Flags.clear();
352+
344353
Code = R"cpp(
345354
struct S{};
346355
S X;

clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,47 @@ TEST(IncludeCleaner, GetUnusedHeaders) {
167167
UnorderedElementsAre("\"unused.h\"", "\"dir/unused.h\""));
168168
}
169169

170+
TEST(IncludeCleaner, ScratchBuffer) {
171+
TestTU TU;
172+
TU.Filename = "foo.cpp";
173+
TU.Code = R"cpp(
174+
#include "macro_spelling_in_scratch_buffer.h"
175+
176+
using flags::FLAGS_FOO;
177+
178+
int concat(a, b) = 42;
179+
)cpp";
180+
// The pasting operator in combination with DEFINE_FLAG will create
181+
// ScratchBuffer with `flags::FLAGS_FOO` that will have FileID but not
182+
// FileEntry.
183+
TU.AdditionalFiles["macro_spelling_in_scratch_buffer.h"] = R"cpp(
184+
#define DEFINE_FLAG(X) \
185+
namespace flags { \
186+
int FLAGS_##X; \
187+
} \
188+
189+
DEFINE_FLAG(FOO)
190+
191+
#define ab x
192+
#define concat(x, y) x##y
193+
)cpp";
194+
ParsedAST AST = TU.build();
195+
auto &SM = AST.getSourceManager();
196+
auto &Includes = AST.getIncludeStructure();
197+
auto ReferencedFiles = findReferencedFiles(findReferencedLocations(AST), SM);
198+
auto Entry = SM.getFileManager().getFile(
199+
testPath("macro_spelling_in_scratch_buffer.h"));
200+
ASSERT_TRUE(Entry);
201+
auto FID = SM.translateFile(*Entry);
202+
// No "<scratch space>" FID.
203+
EXPECT_THAT(ReferencedFiles, UnorderedElementsAre(FID));
204+
// Should not crash due to <scratch space> "files" missing from include
205+
// structure.
206+
EXPECT_THAT(
207+
getUnused(Includes, translateToHeaderIDs(ReferencedFiles, Includes, SM)),
208+
::testing::IsEmpty());
209+
}
210+
170211
} // namespace
171212
} // namespace clangd
172213
} // namespace clang

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ New check aliases
113113
Changes in existing checks
114114
^^^^^^^^^^^^^^^^^^^^^^^^^^
115115

116+
- Removed default setting `cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors = "true"`,
117+
to match the current state of the C++ Core Guidelines.
118+
119+
116120
Removed checks
117121
^^^^^^^^^^^^^^
118122

clang-tools-extra/docs/clang-tidy/checks/bugprone-unused-return-value.rst

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,25 @@ Options
1010

1111
.. option:: CheckedFunctions
1212

13-
Semicolon-separated list of functions to check. Defaults to
14-
``::std::async;::std::launder;::std::remove;::std::remove_if;::std::unique;::std::unique_ptr::release;::std::basic_string::empty;::std::vector::empty``.
15-
This means that the calls to following functions are checked by default:
13+
Semicolon-separated list of functions to check. The function is checked if
14+
the name and scope matches, with any arguments.
15+
By default the following functions are checked:
16+
``std::async, std::launder, std::remove, std::remove_if, std::unique,
17+
std::unique_ptr::release, std::basic_string::empty, std::vector::empty,
18+
std::back_inserter, std::distance, std::find, std::find_if, std::inserter,
19+
std::lower_bound, std::make_pair, std::map::count, std::map::find,
20+
std::map::lower_bound, std::multimap::equal_range,
21+
std::multimap::upper_bound, std::set::count, std::set::find, std::setfill,
22+
std::setprecision, std::setw, std::upper_bound, std::vector::at,
23+
bsearch, ferror, feof, isalnum, isalpha, isblank, iscntrl, isdigit, isgraph,
24+
islower, isprint, ispunct, isspace, isupper, iswalnum, iswprint, iswspace,
25+
isxdigit, memchr, memcmp, strcmp, strcoll, strncmp, strpbrk, strrchr,
26+
strspn, strstr, wcscmp, access, bind, connect, difftime, dlsym, fnmatch,
27+
getaddrinfo, getopt, htonl, htons, iconv_open, inet_addr, isascii, isatty,
28+
mmap, newlocale, openat, pathconf, pthread_equal, pthread_getspecific,
29+
pthread_mutex_trylock, readdir, readlink, recvmsg, regexec, scandir,
30+
semget, setjmp, shm_open, shmget, sigismember, strcasecmp, strsignal,
31+
ttyname``
1632

1733
- ``std::async()``. Not using the return value makes the call synchronous.
1834
- ``std::launder()``. Not using the return value usually means that the

clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,8 @@ void test() {
151151
my_system_header_function(/*not_arg=*/1);
152152
}
153153
} // namespace system_header
154+
155+
void testInvalidSlocCxxConstructExpr() {
156+
__builtin_va_list __args;
157+
// __builtin_va_list has no defination in any source file
158+
}

0 commit comments

Comments
 (0)