Skip to content

Commit 97d52a1

Browse files
committed
Merge from 'master' to 'sycl-web' (#147)
CONFLICT (content): Merge conflict in clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp CONFLICT (content): Merge conflict in clang/test/Driver/clang-offload-bundler.c
2 parents ccb4b0f + c53cb2b commit 97d52a1

File tree

481 files changed

+20620
-6119
lines changed

Some content is hidden

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

481 files changed

+20620
-6119
lines changed

clang-tools-extra/clang-tidy/cert/DefaultOperatorNewAlignmentCheck.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,13 @@ namespace clang {
1616
namespace tidy {
1717
namespace cert {
1818

19-
AST_MATCHER(CXXNewExpr, isPlacementNew) {
20-
return Node.getNumPlacementArgs() > 0;
21-
}
22-
2319
void DefaultOperatorNewAlignmentCheck::registerMatchers(MatchFinder *Finder) {
2420
// Check not applicable in C++17 (or newer).
2521
if (getLangOpts().CPlusPlus17)
2622
return;
2723

28-
Finder->addMatcher(cxxNewExpr(unless(isPlacementNew())).bind("new"), this);
24+
Finder->addMatcher(
25+
cxxNewExpr(unless(hasAnyPlacementArg(anything()))).bind("new"), this);
2926
}
3027

3128
void DefaultOperatorNewAlignmentCheck::check(

clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,16 @@ void MakeSmartPtrCheck::registerMatchers(ast_matchers::MatchFinder *Finder) {
8484
auto CanCallCtor = unless(has(ignoringImpCasts(
8585
cxxConstructExpr(hasDeclaration(decl(unless(isPublic())))))));
8686

87+
auto IsPlacement = hasAnyPlacementArg(anything());
88+
8789
Finder->addMatcher(
8890
cxxBindTemporaryExpr(has(ignoringParenImpCasts(
8991
cxxConstructExpr(
9092
hasType(getSmartPointerTypeMatcher()), argumentCountIs(1),
9193
hasArgument(0,
9294
cxxNewExpr(hasType(pointsTo(qualType(hasCanonicalType(
9395
equalsBoundNode(PointerType))))),
94-
CanCallCtor)
96+
CanCallCtor, unless(IsPlacement))
9597
.bind(NewExpression)),
9698
unless(isInTemplateInstantiation()))
9799
.bind(ConstructorCall)))),
@@ -101,7 +103,9 @@ void MakeSmartPtrCheck::registerMatchers(ast_matchers::MatchFinder *Finder) {
101103
cxxMemberCallExpr(
102104
thisPointerType(getSmartPointerTypeMatcher()),
103105
callee(cxxMethodDecl(hasName("reset"))),
104-
hasArgument(0, cxxNewExpr(CanCallCtor).bind(NewExpression)),
106+
hasArgument(
107+
0,
108+
cxxNewExpr(CanCallCtor, unless(IsPlacement)).bind(NewExpression)),
105109
unless(isInTemplateInstantiation()))
106110
.bind(ResetCall),
107111
this);
@@ -119,8 +123,6 @@ void MakeSmartPtrCheck::check(const MatchFinder::MatchResult &Result) {
119123
const auto *Type = Result.Nodes.getNodeAs<QualType>(PointerType);
120124
const auto *New = Result.Nodes.getNodeAs<CXXNewExpr>(NewExpression);
121125

122-
if (New->getNumPlacementArgs() != 0)
123-
return;
124126
// Skip when this is a new-expression with `auto`, e.g. new auto(1)
125127
if (New->getType()->getPointeeType()->getContainedAutoType())
126128
return;

clang-tools-extra/clangd/FSProvider.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ namespace clangd {
1919

2020
namespace {
2121
/// Always opens files in the underlying filesystem as "volatile", meaning they
22-
/// won't be memory-mapped. This avoid locking the files on Windows.
22+
/// won't be memory-mapped. Memory-mapping isn't desirable for clangd:
23+
/// - edits to the underlying files change contents MemoryBuffers owned by
24+
// SourceManager, breaking its invariants and leading to crashes
25+
/// - it locks files on windows, preventing edits
2326
class VolatileFileSystem : public llvm::vfs::ProxyFileSystem {
2427
public:
2528
explicit VolatileFileSystem(llvm::IntrusiveRefCntPtr<FileSystem> FS)
@@ -34,7 +37,7 @@ class VolatileFileSystem : public llvm::vfs::ProxyFileSystem {
3437
if (!File)
3538
return File;
3639
// Try to guess preamble files, they can be memory-mapped even on Windows as
37-
// clangd has exclusive access to those.
40+
// clangd has exclusive access to those and nothing else should touch them.
3841
llvm::StringRef FileName = llvm::sys::path::filename(Path);
3942
if (FileName.startswith("preamble-") && FileName.endswith(".pch"))
4043
return File;
@@ -70,15 +73,11 @@ class VolatileFileSystem : public llvm::vfs::ProxyFileSystem {
7073

7174
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>
7275
clang::clangd::RealFileSystemProvider::getFileSystem() const {
73-
// Avoid using memory-mapped files on Windows, they cause file locking issues.
74-
// FIXME: Try to use a similar approach in Sema instead of relying on
75-
// propagation of the 'isVolatile' flag through all layers.
76-
#ifdef _WIN32
76+
// Avoid using memory-mapped files.
77+
// FIXME: Try to use a similar approach in Sema instead of relying on
78+
// propagation of the 'isVolatile' flag through all layers.
7779
return new VolatileFileSystem(
7880
llvm::vfs::createPhysicalFileSystem().release());
79-
#else
80-
return llvm::vfs::createPhysicalFileSystem().release();
81-
#endif
8281
}
8382
} // namespace clangd
8483
} // namespace clang

clang-tools-extra/clangd/FSProvider.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class FileSystemProvider {
3030

3131
class RealFileSystemProvider : public FileSystemProvider {
3232
public:
33-
// FIXME: returns the single real FS instance, which is not threadsafe.
3433
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>
3534
getFileSystem() const override;
3635
};

clang-tools-extra/clangd/GlobalCompilationDatabase.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,11 @@ DirectoryBasedGlobalCompilationDatabase::getCDBInDirLocked(PathRef Dir) const {
115115
auto R = CompilationDatabases.try_emplace(Key);
116116
if (R.second) { // Cache miss, try to load CDB.
117117
CachedCDB &Entry = R.first->second;
118-
std::string Error = "";
118+
std::string Error;
119119
Entry.CDB = tooling::CompilationDatabase::loadFromDirectory(Dir, Error);
120120
Entry.Path = std::string(Dir);
121+
if (Entry.CDB)
122+
log("Loaded compilation database from {0}", Dir);
121123
}
122124
return R.first->second;
123125
}

clang-tools-extra/clangd/XRefs.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "index/SymbolLocation.h"
2323
#include "clang/AST/ASTContext.h"
2424
#include "clang/AST/Attr.h"
25+
#include "clang/AST/Attrs.inc"
2526
#include "clang/AST/Decl.h"
2627
#include "clang/AST/DeclCXX.h"
2728
#include "clang/AST/DeclTemplate.h"
@@ -277,7 +278,9 @@ std::vector<LocatedSymbol> locateSymbolAt(ParsedAST &AST, Position Pos,
277278
for (const NamedDecl *D : getDeclAtPosition(AST, SourceLoc, Relations)) {
278279
// Special case: void foo() ^override: jump to the overridden method.
279280
if (const auto *CMD = llvm::dyn_cast<CXXMethodDecl>(D)) {
280-
const auto *Attr = D->getAttr<OverrideAttr>();
281+
const InheritableAttr* Attr = D->getAttr<OverrideAttr>();
282+
if (!Attr)
283+
Attr = D->getAttr<FinalAttr>();
281284
const syntax::Token *Tok =
282285
spelledIdentifierTouching(SourceLoc, AST.getTokens());
283286
if (Attr && Tok &&

0 commit comments

Comments
 (0)